Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- scheduler.ajax.js
- function approveTasksPlanned_ajax(onDateUnixTimeStamp, factsTableTasksApprove, confirmButton) {
- $('#factsEntry_dataTable_wrapper').find('span:contains("Apstiprināt")').parent().addClass('inactiveLink');
- var axJournalId = $('input[name=_AxJournalId]').val();
- var tasksApproveStringified = JSON.stringify(factsTableTasksApprove);
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/ApproveTasksPlanned?AxJournalId=" + axJournalId,
- data: '{ "onDateUnixTimeStamp":' + onDateUnixTimeStamp + ', "factsTableTasksApprove": ' + tasksApproveStringified + ' }',
- contentType: "application/json; charset=utf-8",
- dataType: "json"
- });
- request.done(function (response) {
- if (response.success) {
- if (response.result.log.length > 0) {
- showLogInfo_dlg(response.result.log);
- }
- //if (response.result.log.length == 0) {
- dhtmlx.message("Stundas atjaunotas");
- // }
- if (lastTimeStamp) {
- refreshFactsTable_ajax(lastTimeStamp, confirmButton);
- }
- } else {
- dhtmlx.message("Kļūda apstiprinot stundas");
- showLogInfo_dlg(response.result.log);
- refreshSumColumnsData_ajax();
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function refreshFactsTable_ajax(onDateUnixTimeStamp, confirmButton) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/GenerateFactsTableItems?AxJournalId=" + axJournalId,
- data: '{ "onDateUnixTimeStamp": ' + onDateUnixTimeStamp + ' }',
- contentType: "application/json; charset=utf-8",
- dataType: "json"
- });
- request.done(function (response) {
- if (response.success) {
- let factsEntryTable = $('#factsEntry_dataTable').DataTable();
- factsEntryTable.destroy();
- createFactsTable(response.result.factsTableContent, lastTimeStamp);
- $(confirmButton).prop('disabled', false);
- recalculateAndLoadSchedulingData_ajax();
- //refreshSumColumnsData_ajax(true);
- } else {
- dhtmlx.message("Kļūda ģenerējot faktu tabulu");
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function manuallyScheduleEmployee_ajax(wtTaskId, emplId, period, wd1, hd1, wd2, hd2, planOtherPlaces, fromTemplateStart) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/ManuallyScheduleEmployee?AxJournalId=" + axJournalId,
- data: '{ "wtTaskId":' + wtTaskId + ', "emplId": ' + emplId + ', "period": "' + period +
- '", "wd1": ' + wd1 + ', "hd1": ' + hd1 + ', "wd2": ' + wd2 + ', "hd2": ' + hd2 +
- ', "planOtherPlaces": ' + planOtherPlaces + ', "fromTemplateStart": ' + fromTemplateStart + ' }',
- contentType: "application/json; charset=utf-8",
- dataType: "json"
- });
- request.done(function (response) {
- if (response.success) {
- dhtmlx.message("Manuālā darbinieka plānošana pabeigta");
- refreshSumColumnsData_ajax();
- //clearAndLoadSchedulingData_ajax();
- showInfoLog_dlg(response.result.dlgLogData, response.result.dlgHeaderData);
- } else {
- dhtmlx.message("Kļūda plānojot");
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function editEmployeeWorkingTime_ajax(taskId, newTimeFromStr, newTimeToStr) {
- console.log('{ "taskId":"' + taskId + '", "newTimeFromStr": "' + newTimeFromStr + '", "newTimeToStr": "' + newTimeToStr +'" }')
- var axJournalId = $('input[name=_AxJournalId]').val();
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/UpdateEmployeeWorkingTime?AxJournalId=" + axJournalId,
- data: '{ "taskId":"' + taskId + '", "newTimeFromStr": "' + newTimeFromStr + '", "newTimeToStr": "' + newTimeToStr +'" }',
- contentType: "application/json; charset=utf-8",
- dataType: "json"
- })
- request.done(function (response) {
- console.log(response);
- if (response.success) {
- if (response.result.valid) {
- editEmployeeWorkingTime_dlg.dialog("close");
- refreshFactsTable_ajax();
- refreshSumColumnsData_ajax();
- dhtmlx.message(response.result.message);
- } else {
- showEditEmployeeWorkingTimeFail_dlg("Info", response.message);
- }
- } else {
- editEmployeeWorkingTime_dlg.dialog("close");
- showEditEmployeeWorkingTimeFail_dlg("Error", response.message);
- }
- });
- }
- function manuallyEditTime_ajax(wtTaskId, newTimeFromStr, newTimeToStr, validate) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/UpdateWorkingTime?AxJournalId=" + axJournalId,
- data: '{ "taskId":"' + wtTaskId + '", "newTimeFromStr": "' + newTimeFromStr + '", "newTimeToStr": "' + newTimeToStr +
- '", "validate": "' + validate + '" }',
- contentType: "application/json; charset=utf-8",
- dataType: "json"
- });
- request.done(function (response) {
- if (response.success) {
- if (!response.result.valid) {
- showCorrectWorkingTime_dlg(wtTaskId, response.result.suggestedTimeFrom, response.result.suggestedTimeTo, response.result.message);
- return;
- }
- var editWorkingTime_dlg = $("#editWorkingTime_dlg").dialog();
- editWorkingTime_dlg.dialog("close");
- dhtmlx.message("Darbavietas laiks mainīts");
- if (!validate) {
- refreshSumColumnsData_ajax();
- return;
- }
- clearAndLoadSchedulingData_ajax();
- } else {
- dhtmlx.message("Kļūda mainot darbalaiku");
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function manuallyScheduleWorkingTime_ajax(wpStructureId, onDateUnixTimeStamp, period, weekSchedule, includeHolidays) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- var weekScheduleStringified = JSON.stringify(weekSchedule);
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/ManuallyScheduleWorkingTime?AxJournalId=" + axJournalId,
- data: '{ "wpStructureId":' + wpStructureId + ', "onDateUnixTimeStamp": ' + onDateUnixTimeStamp + ', "period": "' + period +
- '", "weekSchedule": ' + weekScheduleStringified + ', "includeHolidays": ' + includeHolidays + ' }',
- contentType: "application/json; charset=utf-8",
- dataType: "json"
- });
- request.done(function (response) {
- if (response.success) {
- dhtmlx.message("Manuālā darbalaika plānošana pabeigta");
- refreshSumColumnsData_ajax();
- //clearAndLoadSchedulingData_ajax();
- } else {
- dhtmlx.message("Kļūda plānojot");
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function autoScheduleEmployee_ajax(wtTaskId, emplId, period, templateId) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/AutoScheduleEmployee?AxJournalId=" + axJournalId,
- data: '{ "wtTaskId":' + wtTaskId + ', "emplId": ' + emplId + ', "period": "' + period + '", "templateId": ' + templateId + ' }',
- contentType: "application/json; charset=utf-8",
- dataType: "json"
- });
- request.done(function (response) {
- if (response.success) {
- dhtmlx.message("Plānošana no veidnes pabeigta");
- refreshSumColumnsData_ajax();
- //clearAndLoadSchedulingData_ajax();
- showInfoLog_dlg(response.result.dlgLogData, response.result.dlgHeaderData);
- } else {
- dhtmlx.message("Kļūda plānojot");
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function autoScheduleWorkingTime_ajax(wpStructureId, onDateUnixTimeStamp, period, templateId) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/AutoScheduleWorkingTime?AxJournalId=" + axJournalId,
- data: '{ "wpStructureId": ' + wpStructureId + ', "onDateUnixTimeStamp": ' + onDateUnixTimeStamp + ', "period": "' + period + '", "templateId": ' + templateId + ' }',
- contentType: "application/json; charset=utf-8",
- dataType: "json"
- });
- request.done(function (response) {
- if (response.success) {
- dhtmlx.message("Darbalaika plānošana pabeigta");
- refreshSumColumnsData_ajax();
- // clearAndLoadSchedulingData_ajax();
- //scheduler.load("/Scheduler/Data?AxJournalId=" + axJournalId, "json");
- //rerenderScheduler(true);
- } else {
- dhtmlx.message("Kļūda plānojot");
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function clearAndLoadSchedulingData_ajax() {
- var axJournalId = $('input[name=_AxJournalId]').val();
- var request = $.ajax({
- type: "GET",
- url: "/Scheduler/Data?AxJournalId=" + axJournalId,
- contentType: "application/json; charset=utf-8",
- dataType: "json"
- });
- request.done(function (response) {
- if (response) {
- scheduler.clearAll();
- scheduler.parse(response.data, "json");
- //logic for second scheduler
- scheduler2.clearAll();
- scheduler2.parse(response.data, "json");
- rerenderScheduler(true);
- window.event.preventDefault();
- window.event.stopImmediatePropagation();
- window.event.stopPropagation();
- } else {
- dhtmlx.message("Kļūda ielādējot datus");
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function recalculateAndLoadSchedulingData_ajax() {
- var axJournalId = $('input[name=_AxJournalId]').val();
- var request = $.ajax({
- type: "GET",
- url: "/Scheduler/Data?AxJournalId=" + axJournalId + '&Recalc=true',
- contentType: "application/json; charset=utf-8",
- dataType: "json"
- });
- request.done(function (response) {
- if (response) {
- scheduler.clearAll();
- scheduler.parse(response.data, "json");
- refreshSumColumnsData_ajax();
- rerenderScheduler(true);
- } else {
- dhtmlx.message("Kļūda ielādējot datus");
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function initSumColumnsData_ajax() {
- var axJournalId = $('input[name=_AxJournalId]').val();
- let res = document.URL;
- res = res.split('/Scheduler/Show/');
- if (!axJournalId) {
- axJournalId = res[1];
- }
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/GetSumColumnData?AxJournalId=" + axJournalId,
- contentType: "application/json; charset=utf-8",
- dataType: "json"
- });
- request.done(function (response) {
- if (response.success) {
- sumColumnsData = response.result.sumColumns;
- getCoefficient(sumColumnsData);
- executeAfterInit();
- executeAfterInit2();
- //setSumColumnsValues();
- }
- if (!response.success) {
- dhtmlx.message("Kļūda atjaunojot summas kolonnas");
- console.log(response.message);
- executeAfterInit();
- executeAfterInit2();
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda atjaunojot summas kolonnas");
- console.log(jqXHR);
- console.log(textStatus);
- executeAfterInit();
- executeAfterInit2();
- });
- }
- function refreshSumColumnsData_ajax(rerequest=false) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/GetSumColumnData?AxJournalId=" + axJournalId,
- contentType: "application/json; charset=utf-8",
- dataType: "json"
- });
- request.done(function (response) {
- if (response.success) {
- console.log(sumColumnsData === response.result.sumColumns);
- sumColumnsData = response.result.sumColumns;
- getCoefficient(sumColumnsData);
- if (rerequest) {
- refreshSumColumnsData_ajax(false);
- }
- clearAndLoadSchedulingData_ajax();
- }
- if (!response.success) {
- dhtmlx.message("Kļūda atjaunojot summas kolonnas");
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda atjaunojot summas kolonnas");
- console.log(jqXHR);
- console.log(textStatus);
- // executeAfterInit();
- });
- }
- function manualInputSumColumnsData_ajax(structureId, sumColumnParameter, value) {
- isFirstRender = false;
- value = value.replace(',', '.');
- value = parseFloat(value);
- var axJournalId = $('input[name=_AxJournalId]').val();
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/SetSumColumnParameter?AxJournalId=" + axJournalId,
- data: `{ "refStructureId": '${structureId}', "value": ${value}, "sumColumnParameter": '${sumColumnParameter}'}`,
- contentType: "application/json; charset=utf-8",
- dataType: "json"
- });
- request.done(function (response) {
- if (response.success) {
- dhtmlx.message("Vērtība atjaunota");
- refreshSumColumnsData_ajax();
- //clearAndLoadSchedulingData_ajax();
- }
- if (!response.success) {
- showManualInputError_dlg(response.message)
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda atjaunojot summas kolonnas");
- console.log(jqXHR);
- console.log(textStatus);
- executeAfterInit();
- executeAfterInit2();
- });
- }
- function deleteTasks_ajax(callerTaskId, period, mode, includeSiblings) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/DeleteTasks?AxJournalId=" + axJournalId,
- data: '{ "callerTaskId": ' + callerTaskId + ', "period": "' + period + '", "mode": "' + mode + '", includeSiblings:' + includeSiblings + ' }',
- contentType: "application/json; charset=utf-8",
- dataType: "json"
- });
- request.done(function (response) {
- if (response.success) {
- dhtmlx.message("Dzēšana pabeigta");
- refreshSumColumnsData_ajax();
- //clearAndLoadSchedulingData_ajax();
- //rerenderScheduler(true);
- } else {
- dhtmlx.message("Kļūda dzēšot");
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function requestFactsTable_ajax(onDateUnixTimeStamp) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/GenerateFactsTableItems?AxJournalId=" + axJournalId,
- data: '{ "onDateUnixTimeStamp": ' + onDateUnixTimeStamp + ' }',
- contentType: "application/json; charset=utf-8",
- dataType: "json"
- });
- request.done(function (response) {
- if (response.success) {
- showFactsTable_dlg(response.result, onDateUnixTimeStamp);
- rerenderScheduler(true);
- } else {
- dhtmlx.message("Kļūda ģenerējot faktu tabulu");
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function requestSchedulingDates_ajax(onDate, schedulingPeriod, updTarget = "") {
- var axJournalId = $('input[name=_AxJournalId]').val();
- var onDateUnixTimeStamp = parseInt((new Date(onDate).getTime() / 1000).toFixed(0));
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/GetSchedulingDates?AxJournalId=" + axJournalId,
- data: '{ "SchedulingPeriod": "' + schedulingPeriod + '", "OnDateUnixTimeStamp": ' + onDateUnixTimeStamp + ' }',
- contentType: "application/json; charset=utf-8",
- dataType: "json"
- });
- request.done(function (response) {
- if (response.success) {
- var schedStartDate = new Date(response.result.schedulingStartDate * 1000);
- var schedEndDate = new Date(response.result.schedulingEndDate * 1000);
- setSchedulingDates(schedStartDate, schedEndDate, updTarget);
- rerenderScheduler(true);
- } else {
- dhtmlx.message("Kļūda pieprasot plānošanas datumus");
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function requestMenuItems_ajax(callerType, caller, selector, id, onDate, wpStructureId, offsetLeft, offsetTop, screenX, isFrozen = false) {
- calculateGlobalOffset();
- let currentDate = new Date(onDate);
- if ($($(caller)[0].parentElement.parentElement).hasClass('dhx_scell_level0')) {
- wpStructureId = getBuildingLevelStructureId();
- }
- if (screenX) {
- //get scheduler offset for fix context menu date
- let schedulerContainerOffset = $('#scheduler_here').offset();
- let additionalDays = Math.floor((screenX - schedulerContainerOffset.left) / ($('.dhx_marked_timespan').outerWidth()));
- currentDate = scheduler._min_date.addDays(additionalDays);
- console.log(currentDate);
- }
- var axJournalId = $('input[name=_AxJournalId]').val();
- var onDateUnixTimeStamp = parseInt((new Date(currentDate).getTime() / 1000).toFixed(0));
- onDateUnixTimeStamp = onDateUnixTimeStamp != undefined ? onDateUnixTimeStamp : "";
- wpStructureId = wpStructureId != undefined ? wpStructureId : "0";
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/GenerateMenuItems?AxJournalId=" + axJournalId,
- data: '{ "taskId": ' + id + ', "onDateUnixTimeStamp": ' + onDateUnixTimeStamp + ', "wpStructureId": ' + wpStructureId + ', "caller": "' + callerType + '", "isFrozen": ' + isFrozen + '}',
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- async: true
- });
- request.done(function (response) {
- if (response.success) {
- if (response.result) {
- showContextMenu(response.result, selector, offsetLeft, offsetTop);
- setContextMenuPositionForAsync(caller);
- }
- }
- else {
- dhtmlx.message("Kļūda pieprasot izvēlnes saturu");
- console.log(response.message);
- }
- //scrollScheluder();
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function requestJournalItems_ajax(wpStructureId, level, dialogName, action) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- wpStructureId = wpStructureId != undefined ? wpStructureId : "0";
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/GetJournalItems?AxJournalId=" + axJournalId,
- data: '{ "itemType": ' + level + ', "refStructureId" : ' + wpStructureId + ' }',
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- async: false
- });
- request.done(function (response) {
- if (response.success) {
- showInsertJourStructure_dlg(response.result, level, dialogName, wpStructureId, action);
- rerenderScheduler(true);
- }
- else {
- dhtmlx.message("Kļūda pieprasot žurnāla struktūras elementus");
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function addAbsence_ajax(emplId, approveAbsence, dateFromUnixTimeStamp, dateToUnixTimeStamp, absenceId, validateOnly) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/AddEmplAbsence?AxJournalId=" + axJournalId,
- data: `{ "ApproveAbsence": ${approveAbsence}, "ValidateOnly" : ${validateOnly}, "EmplId": ${emplId}, "AbsenceId": ${absenceId},
- "DateFromUnixTimeStamp": ${dateFromUnixTimeStamp}, "DateToUnixTimeStamp": ${dateToUnixTimeStamp}}`,
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- async: false
- });
- request.done(function (response) {
- if (!response.success) {
- showMessageAbsence3A_dlg(response.message)
- return;
- }
- if (validateOnly) {
- if (!response.result.valid) {
- //display #2A
- showMessageAbsence2A_dlg(response.result.message);
- return;
- }
- //display #2b
- showMessageAbsence2B_dlg(emplId, approveAbsence, dateFromUnixTimeStamp, dateToUnixTimeStamp, absenceId, response.result.message);
- return;
- }
- if (!response.result.axSuccess) {
- //display #3A
- showMessageAbsence3A_dlg(response.result.message)
- return;
- }
- if (response.result.removalLog.length > 0) {
- //display #3B
- showMessageAbsence3B_dlg(response.result.removalLog);
- return;
- }
- dhtmlx.message("Prombūtne pievienota");
- messageAbsence2B_dlg.dialog("close");
- employeeAbsence_dlg.dialog("close");
- return;
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function getAbsenceList_ajax(emplFullName, axEmplId, action, dateStart, emplId) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- var request = $.ajax({
- type: "GET",
- url: "/Scheduler/GetAbsences?AxJournalId=" + axJournalId,
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- async: false
- });
- request.done(function (response) {
- if (response.success) {
- showEmployeeAbsence_dlg(emplFullName, axEmplId, action, response.result.absences, dateStart, emplId);
- }
- else {
- //dhtmlx.message("Kļūda pieprasot žurnāla struktūras elementus");
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function wtEmplSchedMove_ajax(taskFromId, taskToId, bidirect, validateOnly) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/WtEmplSchedMove?AxJournalId=" + axJournalId,
- data: `{ "taskFromId": '${taskFromId}', "taskToId" : '${taskToId}', "bidirect" : '${bidirect}', "validateOnly" : '${validateOnly}' }`,
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- async: false
- });
- request.done(function (response) {
- if (response.success) {
- if (!response.result.dlgHeaderData.valid) {
- if (response.result.dlgLogData.error.length == 0) {
- dhtmlx.message("Kļūda pārvietojot/validējot darbinieku");
- return;
- }
- showError_dlg(response.result.dlgLogData.error);
- }
- if (response.result.dlgHeaderData.valid) {
- if (validateOnly == false) {
- refreshSumColumnsData_ajax();
- dhtmlx.message("Pārvietošana pabeigta");
- }
- showConfirm_dlg();
- return;
- }
- }
- else {
- dhtmlx.message("Kļūda pārvietojot/validējot darbinieku");
- clearAndLoadSchedulingData_ajax();
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- clearAndLoadSchedulingData_ajax();
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function requestUpdateJournalStructure_ajax(updateType, refStructureId, itemId) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- refStructureId = refStructureId != undefined ? refStructureId : "0";
- itemId = itemId != undefined ? itemId : "0";
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/UpdateJournalStructure?AxJournalId=" + axJournalId,
- data: '{ "updateType": "' + updateType + '", "refStructureId": "' + refStructureId + '", "itemId": "' + itemId + '" }',
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- async: false
- });
- request.done(function (response) {
- if (response.success) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- //scheduler.load("/Scheduler/Data?AxJournalId=" + axJournalId, "json");
- if (updateType == 'InsertJourStructure' || updateType == 'InsertAboveJourStructure' || updateType == 'DeleteSection') {
- requestGetSchedulerRender(refStructureId);
- refreshSumColumnsData_ajax();
- return;
- }
- scheduler2.load("/Scheduler/Data?AxJournalId=" + axJournalId, "json");
- //if (updateType !='InsertJourStructure') {
- // requestGetSchedulerRender(-1);
- // rerenderScheduler(true);
- // return;
- //}
- requestGetSchedulerRender(refStructureId, updateType);
- rerenderScheduler(true);
- }
- else {
- dhtmlx.message("Kļūda dzēsot žurnāla struktūras elementus");
- console.log(response.message);
- }
- });
- request.fail(function (jqXHR, textStatus) {
- dhtmlx.message("Kļūda veicot pieprasījumu");
- console.log(jqXHR);
- console.log(textStatus);
- });
- }
- function requestGetSchedulerRender(refStructureId = null, updateType = null) {
- $('#load-page').val(true);
- var axJournalId = $('input[name=_AxJournalId]').val();
- if (!axJournalId) {
- setTimeout(function () {
- $('#load-page').val(false);
- }, 5000);
- return;
- }
- $.ajax({
- type: "POST",
- url: "/Scheduler/GetSectionsTree?AxJournalId=" + axJournalId,
- success: function (result) {
- if (!result.result.length) {
- $('.context-menu-root').remove();
- scheduler.deleteAllSections();
- scheduler2.deleteAllSections();
- }
- if (!result || !result.success) {
- return;
- }
- result = result.result;
- var schedulerUnit = scheduler.matrix['timeline'].y_unit_original[0];
- createFirstLevel(result, refStructureId, updateType);
- var isResponsibleInTree = checkIfEmployeeInTree(filterValue);
- if (isResponsibleInTree) { // c20deae1, e65b0308
- filterByResponsibleEmployeeId(filterValue);
- }
- rerenderScheduler(true);
- if (!result || $.isEmptyObject(result)) {
- $('.dhx_row_folder').remove();
- }
- setTimeout(function () {
- $('#load-page').val(false);
- }, 5000);
- },
- error: function (error) {
- console.log(error);
- }
- });
- }
- function getInitialTreePromise() {
- return new Promise(function (resolve, reject) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- if (!axJournalId) {
- resolve();
- }
- else {
- $.ajax({
- type: "POST",
- url: "/Scheduler/GetSectionsTree?AxJournalId=" + axJournalId,
- async: false,
- success: function (result) {
- if (!result || !result.success) {
- resolve();
- }
- else {
- if (!result.result.length) {
- $('.context-menu-root').remove();
- scheduler.deleteAllSections();
- scheduler2.deleteAllSections();
- }
- createFirstLevel(result.result);
- var responsibleEmployeeId = $('input[name=_EmplId]').val();
- if (responsibleEmployeeId && !isNaN(responsibleEmployeeId)) {
- filterValue = parseInt(responsibleEmployeeId);
- var isResponsibleInTree = checkIfEmployeeInTree(filterValue);
- if (isResponsibleInTree) {
- filterByResponsibleEmployeeId(filterValue);
- }
- }
- resolve();
- }
- },
- error: function (error) {
- resolve();
- console.log(error);
- }
- });
- }
- });
- }
- function checkIfEmployeeInTree(responsibleEmployeeId) {
- var root = jQuery.extend(true, {}, initialSection);
- if (root && root.children) {
- return root.children.some(function (department) {
- return department.responsibleEmplId === responsibleEmployeeId;
- });
- }
- return false;
- }
- function calculateHoursToPlanPromise(timeStartStr, timeEndStr, emplId, itemCombinationId, onDate) {
- return new Promise(function (resolve, reject) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- if (!axJournalId) {
- reject();
- }
- else {
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/CalculateHoursToPlan?AxJournalId=" + axJournalId,
- data: JSON.stringify({ timeStart: timeStartStr, timeEnd: timeEndStr, emplId: emplId, itemCombinationId: itemCombinationId, onDate: onDate }),
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- async: false
- });
- request.done(function (response) {
- if (response.success) {
- resolve(response.result);
- }
- else {
- reject();
- }
- });
- request.fail(function (jqXHR, textStatus) {
- reject();
- });
- }
- });
- }
- function calculateNightHoursPromise(timeStartStr, timeEndStr, emplId, itemCombinationId, onDate) {
- return new Promise(function (resolve, reject) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- if (!axJournalId) {
- reject();
- }
- else {
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/CalculateNightHours?AxJournalId=" + axJournalId,
- data: JSON.stringify({ timeStart: timeStartStr, timeEnd: timeEndStr, emplId: emplId, itemCombinationId: itemCombinationId, onDate: onDate }),
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- async: false
- });
- request.done(function (response) {
- if (response.success) {
- resolve(response.result);
- }
- else {
- reject();
- }
- });
- request.fail(function (jqXHR, textStatus) {
- reject();
- });
- }
- });
- }
- function updateJournalStatusPromise(taskType, toJournalStatusId) {
- return new Promise(function (resolve, reject) {
- var axJournalId = $('input[name=_AxJournalId]').val();
- if (!axJournalId) {
- reject();
- }
- else {
- var data = {
- taskType: taskType,
- toJournalStatusId: toJournalStatusId
- };
- var request = $.ajax({
- type: "POST",
- url: "/Scheduler/UpdateJournalStatus?AxJournalId=" + axJournalId,
- data: JSON.stringify(data),
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- async: false //add button disabling and change to true??
- });
- request.done(function (response) {
- if (response.success && response.result) {
- resolve(response.result);
- }
- if (!response.success) {
- if (response.message) {
- showManualInputError_dlg(response.message);
- console.log(response.message);
- }
- if (response.result.axLog) {
- showLog_dlg(response.result.axLog);
- }
- reject();
- }
- });
- request.fail(function (jqXHR, textStatus) {
- reject();
- });
- }
- });
- }
- scheduler.contextmenu.js
- function generateContextMenu(wpStructureId, date, id, caller, offsetLeft, offsetTop, screenX) {
- //if ($(caller).is('.timeline_item_label')) {
- if (glSelector != '') {
- $.contextMenu('destroy', glSelector);
- glSelector = '';
- }
- var context = $();
- var isFrozen = false;
- var selector = "";
- var callerType = "";
- if ($(caller).is('.dhx_time_block')) {
- selector = '.dhx_matrix_cell, .dhx_marked_timespan';
- //$.contextMenu('destroy', selector);
- return;
- }
- else if (id) { // has task id
- if (($(caller).is('.task_schedule')) || ($(caller).is('.conflict_indicator'))) {
- selector = '.task_schedule';
- callerType = "EmployeeTask";
- }
- else if ($(caller).is('.task_workplace')) {
- selector = '.task_workplace';
- callerType = "WorkingTimeTask";
- }
- }
- else if ($(caller).is('.dhx_scale_bar')) {
- selector = '.dhx_scale_bar';
- callerType = "Scale";
- }
- else if ($(caller).is('.dhx_matrix_cell, .dhx_marked_timespan')) {
- // ja section ir folder section tipa, neizsaukt ctx menu
- var workplacesDetails = scheduler.serverList("workplacesDetails");
- for (var j = 0; j < workplacesDetails.length; j++) {
- if (workplacesDetails[j].key == wpStructureId) {
- if (workplacesDetails[j].Level == 4) {
- var tasks = scheduler.getEvents(
- new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0),
- new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59)
- );
- for (var i = 0; i < tasks.length; i++) { //ja ir tasks ieplanots un menu izsauc no briva darbalaika sanos, neradit
- if (tasks[i].StructureId == wpStructureId) {
- selector = '.dhx_matrix_cell, .dhx_marked_timespan';
- //$.contextMenu('destroy', selector);
- }
- }
- selector = '.dhx_matrix_cell, .dhx_marked_timespan';
- callerType = "EmptyDay";
- }
- else if (workplacesDetails[j].Level == 1) { //ja section folder tipa un veikals, un nav ieplanota struktura, izsaukt
- //if (workplacesDetails.length == 1) {
- selector = '.dhx_matrix_cell, .dhx_marked_timespan';
- callerType = "EmptyDay";
- /* } else {
- selector = '.dhx_matrix_cell, .dhx_marked_timespan';
- $.contextMenu('destroy', selector);
- return;
- }*/
- }
- else {
- selector = '.dhx_matrix_cell, .dhx_marked_timespan';
- //$.contextMenu('destroy', selector);
- return;
- }
- break;
- }
- }
- selector = '.dhx_matrix_cell, .dhx_marked_timespan';
- callerType = "EmptyDay";
- }
- else if (($(caller).is('.timeline_item_label')) || ($(caller).is('.timeline_item_label_line'))) {
- selector = '.timeline_item_label';
- callerType = "Section";
- var workplacesDetails = scheduler.serverList("workplacesDetails");
- for (var i = 0; i < workplacesDetails.length; i++) {
- if (workplacesDetails[i].key == wpStructureId) {
- if (workplacesDetails[i].Level == 1) {
- //isFrozen = true / false; todo: set the value here
- }
- }
- }
- }
- else if ($(caller).is('.dhx_cal_data')) {
- if (wpStructureId == undefined) {
- selector = '.dhx_cal_data';
- callerType = "Section";
- }
- else {
- selector = '.dhx_cal_data';
- // $.contextMenu('destroy', selector);
- return;
- }
- }
- if (!wpStructureId) {
- $.contextMenu('destroy');
- } else {
- $.contextMenu('destroy', selector);
- }
- if ($('.dhx_cal_data').hasClass('frozen')) {
- isFrozen = true;
- } else {
- isFrozen = false;
- }
- if (callerType != "" && selector != "") {
- //$.contextMenu('destroy', selector);
- // store a callback on the trigger
- glSelector = selector;
- requestMenuItems_ajax(callerType, caller, selector, id, date, wpStructureId, offsetLeft, offsetTop, screenX, isFrozen);
- }
- }
- function setContextMenuPositionForAsync(caller) {
- var contextMenuElement = $(caller);
- var _offsetHeader = $('#new-header').offset();
- var _offsetHeader2 = $('#new-header2').offset();
- if (!_offsetHeader && !_offsetHeader2) {
- return;
- }
- var _offset = contextMenuElement.offset();
- var topContext = _offset.top + 10;
- if (_offsetHeader.top + 41 > _offset.top) {
- topContext = _offsetHeader.top + 41;
- }
- var position = {
- x: _offset.left + 10,
- y: topContext
- };
- //comment because jquery has an error
- //contextMenuElement.contextMenu(position);
- }
- function showContextMenu(menuItems, selector, offsetLeft, offsetTop ) {
- if ($.isEmptyObject(menuItems)) {
- return;
- }
- $.contextMenu({
- selector: selector,
- className: 'contextmenu-custom',
- items: menuItems,
- callback: executeCtxMenuAction
- });
- setContextmenuWidth(offsetLeft, offsetTop);
- }
- function setContextmenuWidth(offsetLeft, offsetTop ) {
- var context = $('.context-menu-list.context-menu-root');
- if (!context) {
- return;
- }
- if ($(window).height() < offsetTop + context.outerHeight()) {
- offsetTop = offsetTop - context.outerHeight();
- }
- if ($(window).width() < offsetLeft + context.outerWidth()) {
- offsetLeft = offsetLeft - context.outerWidth();
- }
- context.css('display', 'block');
- context.css('left', `${offsetLeft}px`);
- context.css('top', `${offsetTop}px`);
- setBoldSpans();
- //because not all menus removed from html
- for (var index in context) {
- if (isNaN(index)) {
- return;
- }
- var menuRootElement = $(context[index]);
- var firstLevel = menuRootElement.children('.context-menu-item');
- var width = getWidth(firstLevel);
- menuRootElement.css('width', width + 'px');
- setFirstLevel(firstLevel);
- }
- }
- function setBoldSpans() {
- let boldSpans = $(".context-menu-item span:contains('/!\')");
- boldSpans.each(function () {
- spanText = $(this).html();
- let text = spanText.replace("/!", '');
- let newText = text.replace(/\\/g, "");
- $(this).html(newText);
- //$(this).css('font-weight', 'bold');
- //$(this).css('font-size', '0.9em');
- $(this).css('text-shadow', '-0.06ex 0 black, 0.06ex 0 black');
- })
- }
- function setFirstLevel(firstLevel) {
- for (var i = 0; i < firstLevel.length; i++) {
- var list = $(firstLevel[i]).children('.context-menu-list');
- if (list.length === 0) {
- continue;
- }
- var elements = list.children('.context-menu-item');
- var width = getWidth(elements);
- if (width != 0) {
- list.css('width', width + 'px');
- }
- setFirstLevel(elements);
- }
- }
- function getWidth(elements) {
- if (elements.length == 0) {
- return 0;
- }
- var padding = 35;
- var maximumWidth = 0;
- for (var i = 0; i < elements.length; i++) {
- var element = $(elements[i]);
- var span = element.children('span').clone(false)[0];
- if (!span) {
- continue;
- }
- span.setAttribute('style', 'visibility: hidden;position: absolute;font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;');
- document.body.appendChild(span);
- var spanWidth = span.offsetWidth;
- document.body.removeChild(span);
- if (spanWidth > maximumWidth) {
- maximumWidth = spanWidth;
- }
- }
- return maximumWidth + padding;
- }
- function executeCtxMenuAction(key, opt) {
- var menuItemCmd = opt.commands[key];
- var action = menuItemCmd.action;
- console.log(action);
- console.log(menuItemCmd);
- switch (action) {
- case "AddEmployee": {
- if (menuItemCmd.wtTaskId == 0) { // ja izsauc no nodalas, dv izvelnes planot uz menesi, gadijums iespejams
- dhtmlx.message("Darbalaiks vēl nav ieplānots");
- return;
- }
- if (menuItemCmd.templateId == -1) { //ManualEmployeeSchedule.TemplateId const
- showManualEmployeeSchedule_dlg(menuItemCmd.wtTaskId, menuItemCmd.period, menuItemCmd.emplId, menuItemCmd.axEmplId, menuItemCmd.emplFullName, menuItemCmd.planOtherPlaces);
- }
- else {
- autoScheduleEmployee_ajax(menuItemCmd.wtTaskId, menuItemCmd.emplId, menuItemCmd.period, menuItemCmd.templateId);
- }
- break;
- }
- case "DeleteWorkingTime": {
- showDeleteWorkplaceOrWorker_dlg(menuItemCmd.wtTaskId, menuItemCmd.period, action, menuItemCmd.includeSiblings);
- break;
- }
- case "EditWorkingTime": {
- showEditWorkingTime_dlg(menuItemCmd.wtTaskId, menuItemCmd.onDateUnixTimestamp, menuItemCmd.workingTimeFromHHmm, menuItemCmd.workingTimeToHHmm, menuItemCmd.wtName);
- break;
- }
- case "DeleteEmployee": {
- if (menuItemCmd.emplTaskId == 0) { // ja izsauc no nodalas, dv izvelnes dzest uz menesi, gadijums iespejams
- dhtmlx.message("Darbinieks vēl nav ieplānots");
- return;
- }
- var extMsg = '';
- if (menuItemCmd.extMsg) {
- extMsg += "UZMANĪBU tiks dzēsts darbinieks " + menuItemCmd.axEmplId + " " + menuItemCmd.emplFullName
- + " VISAM MĒNESIM no " + menuItemCmd.workplacePath + ". Vai vēlaties turpināt?"
- }
- showDeleteWorkplaceOrWorker_dlg(menuItemCmd.emplTaskId, menuItemCmd.period, action, menuItemCmd.includeSiblings, extMsg);
- break;
- }
- case "AddWorkingTime": {
- if (menuItemCmd.templateId == -1) { //ManualWorkingTimeSchedule.TemplateId const
- showManualWorkingTimeSchedule_dlg(menuItemCmd.wpStructureId, menuItemCmd.onDateUnixTimeStamp, menuItemCmd.period);
- }
- else {
- autoScheduleWorkingTime_ajax(menuItemCmd.wpStructureId, menuItemCmd.onDateUnixTimeStamp, menuItemCmd.period, menuItemCmd.templateId);
- }
- break;
- }
- case "AddEmployeeAbsence": {
- getAbsenceList_ajax(menuItemCmd.emplFullName, menuItemCmd.axEmplId, action, menuItemCmd.dateStart, menuItemCmd.emplId);
- break;
- }
- case "ShowFactsForm": {
- requestFactsTable_ajax(menuItemCmd.onDateUnixTimeStamp);
- break;
- }
- case "UnfreezeSection": {
- $('#freeze-scheduler').val(false);
- unfreezeScheduler();
- synchronizeSchedulersScroll();
- break;
- }
- case "FreezeSection": {
- $('#freeze-scheduler').val(true);
- freezeScheduler(true);
- synchronizeSchedulersScroll();
- break;
- }
- case "InsertJourStructure": {
- requestJournalItems_ajax(menuItemCmd.wpStructureId, menuItemCmd.level, menuItemCmd.name, action);
- break;
- }
- case "InsertAboveJourStructure": {
- requestJournalItems_ajax(menuItemCmd.wpStructureId, menuItemCmd.level, menuItemCmd.name, action);
- break;
- }
- case "MoveAboveJourStructure": {
- isContextBlocked = true;
- requestUpdateJournalStructure_ajax(action, menuItemCmd.wpStructureId, 0);
- asyncBlockContextMenu();
- break;
- }
- case "MoveBelowJourStructure": {
- isContextBlocked = true;
- requestUpdateJournalStructure_ajax(action, menuItemCmd.wpStructureId, 0);
- asyncBlockContextMenu();
- break;
- }
- case "MoveTopJourStructure": {
- isContextBlocked = true;
- requestUpdateJournalStructure_ajax(action, menuItemCmd.wpStructureId, 0);
- asyncBlockContextMenu();
- break;
- }
- case "MoveBottomJourStructure": {
- isContextBlocked = true;
- requestUpdateJournalStructure_ajax(action, menuItemCmd.wpStructureId, 0);
- asyncBlockContextMenu();
- break;
- }
- case "DeleteSection": {
- isContextBlocked = true;
- showDeleteJourSection_dlg(menuItemCmd.level, menuItemCmd.wpStructureId, action);
- asyncBlockContextMenu();
- break;
- }
- case "EditEmployeeTime": {
- isContextBlocked = true;
- //var onDateUnixTimeStamp = new Date(menuItemCmd.onDate).getTime() / 1000;
- showEditEmployeeWorkingTime_dlg(menuItemCmd.taskId, menuItemCmd.onDate, menuItemCmd.timeStart, menuItemCmd.timeEnd, menuItemCmd.emplFullName);
- asyncBlockContextMenu();
- break;
- }
- }
- }
- function freezeScheduler(hide) {
- var isFrozen = JSON.parse($('#freeze-scheduler').val());
- if (!isFrozen) {
- return;
- }
- $('.dhx_cal_data').addClass('frozen');
- addRowScheluder(hide);
- $('.dhx_cal_data').unbind('scroll', scrollScheluder);
- $('.dhx_cal_data').scroll(scrollScheluder);
- //prevent multiple binding
- }
- function addRowScheluder(hide) {
- var rows = $('.dhx_cal_data').find('tr');
- var bodyFirst = $('.dhx_cal_data').find('tbody:first');
- if (rows.length < 3) {
- return;
- }
- if (bodyFirst.length < 1) {
- return;
- }
- var headerExist = checkTable('new-header');
- if (!headerExist) {
- var element = $(rows[0]).clone();
- var elementHtml = $(element[0]);
- elementHtml.attr('id', 'new-header');
- elementHtml.css('position', 'absolute');
- elementHtml.css('z-index', '0');
- elementHtml.css('overflow', 'hidden');
- elementHtml.css('width', $('.dhx_cal_data').outerWidth());
- // $('#new-header').css('width', $('.dhx_cal_date').outerWidth());
- if (rows.length < 3) {
- return;
- }
- var body = $(bodyFirst[0]);
- body.append(elementHtml);
- $(bodyFirst[0]).append(elementHtml);
- if (hide) {
- elementHtml.hide();
- }
- }
- //add header for right scheduler
- var headerExist = checkTable('new-header2');
- if (!headerExist) {
- var secondHeader = $('#new-header2');
- if (secondHeader.length == 0) {
- rows = $('#scheduler_here .dhx_cal_data').find('tr');
- element = $(rows[0]).clone();
- elementHtml = $(element[0]);
- elementHtml.attr('id', 'new-header2');
- elementHtml.css('position', 'absolute');
- elementHtml.css('z-index', '0');
- elementHtml.css('overflow', 'hidden');
- elementHtml.css('width', $('#scheduler_here .dhx_cal_data').outerWidth());
- body = $(bodyFirst[1]);
- body.append(elementHtml);
- $(bodyFirst[1]).append(elementHtml);
- if (hide) {
- elementHtml.hide();
- }
- }
- }
- scrollScheluder();
- }
- function checkTable(headerId) {
- var flag = false;
- var rows = $('.dhx_cal_data').find('tr');
- for (var i = 0; i < rows.length; i++) {
- var attributeId = $(rows[i]).attr('id');
- if (attributeId && attributeId == headerId) {
- flag = true;
- break;
- }
- }
- return flag;
- }
- function scrollScheluder() {
- var rows = $('.dhx_cal_data').find('tr');
- if (rows.length < 3) {
- return;
- }
- var element = $('#new-header');
- if (element.length == 0) {
- addRowScheluder(true);
- return;
- }
- var secondElement = $(rows[2]);
- if (element.length)
- var top = element.offset().top;
- var secondTop = secondElement.offset().top;
- var scroll = $('#scheduler2_here .dhx_cal_data').scrollTop();
- var elementTop = scroll;
- if (secondTop < 243 || scroll > 0) {
- element.show();
- element.css('top', elementTop + 'px');
- }
- var elemendColumns = element.find('td');
- var column = elemendColumns.length > 2 ? $(elemendColumns[1]) : null;
- if (column) {
- column.addClass('disabled-frozen');
- }
- if (secondTop >= 243) {
- element.hide();
- if (column) {
- column.removeClass('disabled-frozen');
- }
- }
- //config for header of right scheduler
- var rows = $('#scheduler_here .dhx_cal_data').find('tr');
- if (rows.length < 3) {
- return;
- }
- var element = $('#new-header2');
- if (element.length == 0) {
- addRowScheluder(true);
- return;
- }
- var secondElement = $(rows[2]);
- if (element.length)
- var top = element.offset().top;
- var secondTop = secondElement.offset().top;
- var scroll = $('#scheduler_here .dhx_cal_data').scrollTop();
- var elementTop = scroll;
- if (secondTop < 243 || scroll > 0) {
- element.show();
- element.css('top', elementTop + 'px');
- }
- var elemendColumns = element.find('td');
- var column = elemendColumns.length > 2 ? $(elemendColumns[1]) : null;
- if (column) {
- column.addClass('disabled-frozen');
- }
- if (secondTop >= 243) {
- element.hide();
- if (column) {
- column.removeClass('disabled-frozen');
- }
- }
- }
- function unfreezeScheduler() {
- $('.dhx_cal_data').removeClass('frozen');
- $('.dhx_cal_data').unbind('scroll');
- $(window).unbind('scroll');
- var rows = $('.dhx_cal_data').find('tr');
- if (rows.length < 3) {
- return;
- }
- var element = $('#new-header');
- element.hide();
- var elemendColumns = element.find('td');
- var column = elemendColumns.length > 2 ? $(elemendColumns[1]) : null;
- if (column) {
- column.removeClass('disabled-frozen');
- }
- //right scheduler header
- element = $('#new-header2');
- element.hide();
- elemendColumns = element.find('td');
- column = elemendColumns.length > 2 ? $(elemendColumns[1]) : null;
- if (column) {
- column.removeClass('disabled-frozen');
- }
- clearInterval(interval);
- interval = null;
- }
- scheduler.dialogs.js
- $(document).ready(function () {
- $(document).on('click', '.columnItem', function (e) {
- let items = $('.columnItem');
- for (var i = 0; i < items.length; i++) {
- $(items[i]).removeClass('selectedCol');
- }
- if ($(e.target).is('label')) {
- $(e.currentTarget).addClass('selectedCol');
- }
- });
- $('#employeeAbsence_dlg').on('dialogclose', function (event) {
- $('#isApproved').prop('checked', false);
- $('.dateStart').datepicker().val('');
- $('.dateEnd').datepicker().val('');
- });
- $('#messageAbsence2A_dlg').on('dialogclose', function (event) {
- $(this).empty();
- });
- $('#messageAbsence2B_dlg').on('dialogclose', function (event) {
- let inputs = $(this).find('input');
- $(this).empty();
- $(this).append(inputs);
- });
- $('#messageAbsence3A_dlg').on('dialogclose', function (event) {
- $(this).empty();
- });
- $('#messageAbsence3B_dlg').on('dialogclose', function (event) {
- $(this).empty();
- });
- $('.up').click(function () {
- let selectedItem = $('.selectedCol');
- if (selectedItem) {
- setPositionUp(selectedItem)
- }
- });
- $('.down').click(function () {
- let selectedItem = $('.selectedCol');
- if (selectedItem) {
- setPositionDown(selectedItem)
- }
- });
- $(".allownumeric").on("keypress keyup blur", function (event) {
- if ((event.which != 46 || $(this).val().indexOf('.') != -1) && ((event.which != 44 && event.which < 48) || event.which > 57)) {
- event.preventDefault();
- }
- });
- $(document).on('click', '.dhx_scell_level1 .dhx_scell_name', function () {
- setOffsetLevel2();
- });
- $(document).on('click', '.timeline_item_cell', function (e) {
- e.preventDefault();
- });
- $(document).on('mouseover', '.timeline_item_header', function () {
- $(document).tooltip({ tooltipClass: "tooltipMaster" });
- }).mousemove(function (e) {
- var mousex = e.pageX + 10;
- var mousey = e.pageY + 5;
- $('.tooltipMaster')
- .css({ top: mousey, left: mousex })
- });
- $(document).on('mouseover', '.timeline_item_cell', function () {
- $(document).tooltip({ tooltipClass: "tooltipMaster" });
- }).mousemove(function (e) {
- var mousex = e.pageX + 10;
- var mousey = e.pageY + 5;
- $('.tooltipMaster')
- .css({ top: mousey, left: mousex })
- });
- });
- async function bindLabelClick() {
- let res = await bindLabelClickAsync();
- }
- function deleteContext() {
- return new Promise(function (resolve) {
- for (var i = 0; i < 1; i++) {
- setTimeout(() => {
- var res = $('.context-menu-list.context-menu-root');
- if (res.length > 1) {
- for (var i = 0; i <= res.length - 2; i++) {
- res[i].remove();
- }
- }
- resolve('resolved');
- }, 700);
- }
- });
- }
- function bindLabelClickAsync() {
- return new Promise(function (resolve) {
- setTimeout(() => {
- let res = $('.timeline_item_label')[0];
- $(res).on('dblclick', function (event) {
- let wpStructureId = getWorkplacesDetails(event);
- sumColumnParameter = 'WorkLoad';
- showManualInput_dlg(wpStructureId, sumColumnParameter, null);
- });
- resolve('resolved');
- }, 2500);
- });
- };
- function setOffsetLevel2() {
- let items = $('.dhx_scell_level2 .dhx_scell_name');
- if (items) {
- for (var i = 0; i < items.length; i++) {
- if (i % 2 == 0) {
- let el = items[i].childNodes[0];
- $(el).css('margin-left', '-1px');
- }
- }
- }
- }
- //async function initSumColumnsDataAsync() {
- // let result = await initSumColumnsData();;
- //}
- function initSumColumnsDataAsync() {
- return new Promise(function (resolve, reject) {
- initSumColumnsData().then(function () {
- }, reject);
- });
- }
- function initSumColumnsData() {
- return new Promise(resolve => {
- setTimeout(() => {
- initSumColumnsData_ajax();
- }, 400);
- });
- }
- function createSumRow(column, rowData, rowHtml, key) {
- rowHtml = `${sumColumnsBody[column]} 0 <span style='font-weight: normal; display: block'> 0 </span></div>`;
- if (!rowData) {
- return `${sumColumnsBody[column]} <span style='font-weight: normal; display: block'> </span></div>`;
- }
- if (column == 'sCol1') {
- rowHtml = sumColumnsBody[column] + `${rowData.BudgetHours == null ? '' : rowData.BudgetHours} <span style='font-weight: normal; display: block'>${rowData.WorkLoadAmount == null ? '' : rowData.WorkLoadAmount}</span> </div> `;
- }
- if (column == 'sCol2') {
- rowHtml = sumColumnsBody[column] + `${rowData.BudgetAmount == null ? '' : rowData.BudgetAmount} </div> `;
- }
- if (column == 'sCol3') {
- rowHtml = sumColumnsBody[column] + `${rowData.AmountPlanned == null ? '' : rowData.AmountPlanned} <span style='font-weight: normal; display: block'>${rowData.AmountPlannedMinusBudget == null ? '' : rowData.AmountPlannedMinusBudget}</span></div> `;
- }
- if (column == 'sCol4') {
- rowHtml = sumColumnsBody[column] + `${rowData.AmountActual == null ? '' : rowData.AmountActual} <span style='font-weight: normal; display: block'>${rowData.AmountActualMinusPlanned == null ? '' : rowData.AmountActualMinusPlanned}</span></div> `;
- }
- if (column == 'sCol5') {
- rowHtml = sumColumnsBody[column] + `${rowData.PublicHolidaysAmount == null ? '' : rowData.PublicHolidaysAmount} <span style='font-weight: normal; display: block'>${rowData.PublicHolidaysHours == null ? '' : rowData.PublicHolidaysHours}</span></div> `;
- }
- if (column == 'sCol6') {
- rowHtml = sumColumnsBody[column] + `${rowData.OvertimeAmount == null ? '' : rowData.OvertimeAmount} <span style='font-weight: normal; display: block'>${rowData.OvertimeHours == null ? '' : rowData.OvertimeHours}</span></div> `;
- }
- if (column == 'sCol7') {
- rowHtml = sumColumnsBody[column] + `${rowData.BonusAmount == null ? '' : rowData.BonusAmount} </div> `;
- }
- if (column == 'sCol8') {
- rowHtml = sumColumnsBody[column] + `${rowData.SickLeaveAmount == null ? '' : rowData.SickLeaveAmount} </div> `;
- }
- if ((column == 'sCol9') && (rowData.Level < 4)) {
- rowHtml = sumColumnsBody[column] + `${rowData.HoursPlannedPrevMonth == null ? '' : rowData.HoursPlannedPrevMonth} <span style='font-weight: normal; display: block'>${rowData.HoursPlannedMinusPrevMonth == null ? 0 + ' / ' : rowData.HoursPlannedMinusPrevMonth + ' / '} ${rowData.HoursPlannedMinusPrevMonthPercent == null ? 0 : rowData.HoursPlannedMinusPrevMonthPercent}</span></div> `;
- }
- if ((column == 'sCol9') && (rowData.Level > 3)) {
- rowHtml = sumColumnsBody[column] + `${rowData.HoursPlannedPrevMonth == null ? '' : rowData.HoursPlannedPrevMonth} </div> `;
- }
- if ((column == 'sCol10') && (rowData.Level < 4)) {
- rowHtml = sumColumnsBody[column] + `${rowData.HoursPlannedPrevYear == null ? '' : rowData.HoursPlannedPrevYear} <span style='font-weight: normal; display: block'>${rowData.HoursPlannedMinusPrevYear == null ? 0 + ' / ' : rowData.HoursPlannedMinusPrevYear + ' / '} ${rowData.HoursPlannedMinusPrevYearPercent == null ? 0 : rowData.HoursPlannedMinusPrevYearPercent}</span></div> `;
- }
- if ((column == 'sCol10') && (rowData.Level > 3)) {
- rowHtml = sumColumnsBody[column] + `${rowData.HoursPlannedPrevYear == null ? '' : rowData.HoursPlannedPrevYear} </div> `;
- }
- if ((column == 'sCol11') && (rowData.Level < 4)) {
- rowHtml = sumColumnsBody[column] + `${rowData.WpHoursPlanned == null ? 0 : rowData.WpHoursPlanned} <span style='font-weight: normal; display: block'>${rowData.WpHoursPlannedMinusBudgetHours == null ? 0 + ' / ' : rowData.WpHoursPlannedMinusBudgetHours + ' / '} ${rowData.WpHoursPlannedWorkLoad == null ? 0 : rowData.WpHoursPlannedWorkLoad}</span></div> `;
- }
- if ((column == 'sCol11') && (rowData.Level > 3)) {
- rowHtml = sumColumnsBody[column] + `${rowData.WpHoursPlanned == null ? 0 : rowData.WpHoursPlanned} </div> `;
- }
- if ((column == 'sCol12') && (rowData.Level < 4)) {
- rowHtml = sumColumnsBody[column] + `${rowData.EmplHoursPlanned == null ? '' : rowData.EmplHoursPlanned} <span style='font-weight: normal; display: block'>${rowData.EmplMinusWpHoursPlanned == null ? 0 : rowData.EmplMinusWpHoursPlanned}</span></div> `;
- }
- if ((column == 'sCol12') && (rowData.Level > 3)) {
- rowHtml = sumColumnsBody[column] + `${rowData.EmplHoursPlanned == null ? 0 + ' / ' : rowData.EmplHoursPlanned + ' / '} ${rowData.EmplMinusWpHoursPlanned == null ? 0 : rowData.EmplMinusWpHoursPlanned}</div> `;
- }
- if ((column == 'sCol13') && (rowData.Level < 4)) {
- rowHtml = sumColumnsBody[column] + `${rowData.EmplHoursActual == null ? '' : rowData.EmplHoursActual} <span style='font-weight: normal; display: block'>${rowData.EmplHoursActualMinusPlanned == null ? 0 : rowData.EmplHoursActualMinusPlanned}</span></div> `;
- }
- if ((column == 'sCol13') && (rowData.Level > 3)) {
- rowHtml = sumColumnsBody[column] + `${rowData.EmplHoursActual == null ? 0 + ' / ' : rowData.EmplHoursActual + ' / '} ${rowData.EmplHoursActualMinusPlanned == null ? 0 : rowData.EmplHoursActualMinusPlanned}</div> `;
- }
- return rowHtml;
- }
- function setTitles() {
- var timelineItemCells = $('.timeline_item_cell');
- for (var i = 0; i < timelineItemCells.length; i++) {
- var cellItem = $(timelineItemCells[i]);
- if ((cellItem[0].offsetParent) && (cellItem[0].attributes[1].nodeValue == "")) {
- if (cellItem.hasClass('sCol1') && (cellItem[0].offsetParent.firstChild) && (cellItem[0].offsetParent.firstChild.className != "dhx_scell_level2")) {
- cellItem.attr('title', 'Budžeta stundu un slodžu skaits');
- }
- if (cellItem.hasClass('sCol2') && (cellItem[0].offsetParent.firstChild) && (cellItem[0].offsetParent.firstChild.className == "dhx_scell_level1") && (cellItem[0].offsetParent.firstChild.className != "dhx_scell_level0")) {
- cellItem.attr('title', 'Ēkas budžets EUR');
- }
- if (cellItem.hasClass('sCol3') && (cellItem[0].offsetParent.firstChild) && (cellItem[0].offsetParent.firstChild.className == "dhx_scell_level0")) {
- cellItem.attr('title', 'Plānotā summa EUR, starpība ar Budžetu EUR');
- }
- if (cellItem.hasClass('sCol3') && (cellItem[0].offsetParent.firstChild) && (cellItem[0].offsetParent.firstChild.className == "dhx_scell_level1")) {
- cellItem.attr('title', 'Plānotā summa EUR');
- }
- if (cellItem.hasClass('sCol4') && (cellItem[0].offsetParent.firstChild) && (cellItem[0].offsetParent.firstChild.className != "dhx_scell_level2")) {
- cellItem.attr('title', 'Faktiskā summa EUR, starpība ar Plānoto summu EUR');
- }
- if (cellItem.hasClass('sCol5') && (cellItem[0].offsetParent.firstChild) && (cellItem[0].offsetParent.firstChild.className != "dhx_scell_level2")) {
- cellItem.attr('title', 'Svētku dienās ieplānotā summa EUR un stundas');
- }
- if (cellItem.hasClass('sCol6') && (cellItem[0].offsetParent.firstChild) && (cellItem[0].offsetParent.firstChild.className != "dhx_scell_level2")) {
- cellItem.attr('title', 'Virsstundu summa EUR un stundu skaits');
- }
- if (cellItem.hasClass('sCol7') && (cellItem[0].offsetParent.firstChild) && (cellItem[0].offsetParent.firstChild.className != "dhx_scell_level2")) {
- cellItem.attr('title', 'Prēmiju summa EUR');
- }
- if (cellItem.hasClass('sCol8') && (cellItem[0].offsetParent.firstChild) && (cellItem[0].offsetParent.firstChild.className != "dhx_scell_level2")) {
- cellItem.attr('title', 'Slimības lapu summa EUR');
- }
- if (cellItem.hasClass('sCol9') && (cellItem[0].offsetParent.firstChild) && (cellItem[0].offsetParent.firstChild.className != "dhx_scell_level2")) {
- cellItem.attr('title', 'Iepriekšējā mēneša plānotās stundas, starpība ar šo mēnesi, izmaiņas %');
- }
- if (cellItem.hasClass('sCol10') && (cellItem[0].offsetParent.firstChild) && (cellItem[0].offsetParent.firstChild.className != "dhx_scell_level2")) {
- cellItem.attr('title', 'Iepriekšējā gada plānotās stundas šim mēnesim, starpība ar šo mēnesi, izmaiņas %');
- }
- if (cellItem.hasClass('sCol11') && (cellItem[0].offsetParent.firstChild) && (cellItem[0].offsetParent.firstChild.className != "dhx_scell_level2")) {
- cellItem.attr('title', 'Plānotās posteņu stundas, starpība ar budžeta stundām, slodžu skaits');
- }
- if (cellItem.hasClass('sCol11') && (cellItem[0].offsetParent.firstChild) && (cellItem[0].offsetParent.firstChild.className == "dhx_scell_level2")) {
- cellItem.attr('title', 'Plānotās posteņu stundas');
- }
- if (cellItem.hasClass('sCol12')) {
- cellItem.attr('title', 'Plānotās darbinieku stundas, starpība ar posteņu stundām');
- }
- if (cellItem.hasClass('sCol13')) {
- cellItem.attr('title', 'Faktiskās darbinieku stundas, starpība ar posteņu stundām');
- }
- }
- }
- clearTooltips();
- }
- function setPositionUp(selectedItem) {
- let items = $('.columnItem');
- for (let i = 0; i < items.length; i++) {
- if (selectedItem.is(items[i]) && ((i - 1) >= 0)) {
- let copyTo = $(items[i - 1]).clone(true);
- let copyFrom = $(selectedItem).clone(true);
- $(items[i - 1]).replaceWith(copyFrom);
- $(selectedItem).replaceWith(copyTo);
- }
- }
- }
- function setPositionDown(selectedItem) {
- let items = $('.columnItem');
- for (var i = 0; i < items.length; i++) {
- if (selectedItem.is(items[i]) && ((i + 1) <= items.length - 1)) {
- let copyTo = $(items[i + 1]).clone(true);
- let copyFrom = $(selectedItem).clone(true);
- $(items[i + 1]).replaceWith(copyFrom);
- $(selectedItem).replaceWith(copyTo);
- }
- }
- }
- function showInfoLog_dlg(logJson, dlgHeaderData) {
- var templateName = dlgHeaderData.templateName;
- var axEmplId = dlgHeaderData.axEmplId;
- var emplFullName = dlgHeaderData.emplFullName;
- var dateFrom = dlgHeaderData.dateFrom;
- var dateTo = dlgHeaderData.dateTo;
- var infoLogOptions = {
- "title": "Plānot darbinieku - '" + axEmplId + "' " + emplFullName + "; Grafiks: " + templateName + "; Periods: " + dateFrom + "-" + dateTo + "",
- "width": 900,
- "height": 300,
- "modal": false,
- "close": function () { $(this).remove(); }
- };
- infoLogOptions.buttons = { "Aizvērt": function () { $(this).dialog("close"); } };
- var infoLogExtendOptions = {
- "resizable": true,
- "closable": false,
- "minimizable": true,
- "collapsable": true,
- "minimizeLocation": "right",
- "dblclick": "minimize",
- "icons": {
- // "close": "ui-icon-circle-closethick", //todo:
- "maximize": "ui-icon-extlink",
- "minimize": "ui-icon-minus",
- "restore": "ui-icon-newwin"
- }
- };
- var errorEntries = logJson["error"];
- var infoEntries = logJson["info"];
- var infoLog_dlg = $("<div />").dialog(infoLogOptions).dialogExtend(infoLogExtendOptions);
- infoLog_dlg.append("<b>Uzmanību! Netika ieplānots:</b><br />");
- errorEntries.forEach(function (entry) {
- infoLog_dlg.append("<span class='error-log-entry'> " + entry.msg + "</span><br />");
- });
- infoLog_dlg.append("<b>Ieplānotie darbinieki:</b><br />");
- infoEntries.forEach(function (entry) {
- infoLog_dlg.append("<span class='info-log-entry'> " + entry.msg + "</span><br />");
- });
- }
- function showLog_dlg(logJson) {
- var infoLogOptions = {
- "title": "Kļūda mainot vērtību",
- "width": 450,
- "height": 300,
- "modal": false,
- "close": function () { $(this).remove(); }
- };
- infoLogOptions.buttons = { "Aizvērt": function () { $(this).dialog("close"); } };
- var infoLogExtendOptions = {
- "resizable": true,
- "closable": false,
- "minimizable": true,
- "collapsable": true,
- "minimizeLocation": "right",
- "dblclick": "minimize",
- "icons": {
- // "close": "ui-icon-circle-closethick", //todo:
- "maximize": "ui-icon-extlink",
- "minimize": "ui-icon-minus",
- "restore": "ui-icon-newwin"
- }
- };
- var errorEntries = logJson.filter(el => el.level == 'Error');
- var infoEntries = logJson.filter(el => el.level == 'Info');
- var infoLog_dlg = $("<div />").dialog(infoLogOptions).dialogExtend(infoLogExtendOptions);
- errorEntries.forEach(function (entry) {
- let errorLog = "<span class='error-log-entry'> " + entry.msgLines + "</span><br />"
- errorLog = errorLog.replace(/\,/g, ' <span class="ui-icon ui-icon-arrowthick-1-e journal-status-dialog-arrow"></span> ');
- infoLog_dlg.append(`<b>${entry.level}</b><br />`);
- infoLog_dlg.append(errorLog);
- });
- infoEntries.forEach(function (entry) {
- let errorLog = "<span class='error-log-entry'> " + entry.msgLines + "</span><br />"
- errorLog = errorLog.replace(/\,/g, ' <span class="ui-icon ui-icon-arrowthick-1-e journal-status-dialog-arrow"></span> ');
- infoLog_dlg.append(`<b>${entry.level}</b><br />`);
- infoLog_dlg.append(errorLog);
- });
- }
- function showLogInfo_dlg(logJson) {
- var infoLogOptions = {
- "title": "Kļūda mainot vērtību",
- "width": 450,
- "height": 300,
- "modal": true,
- "close": function () { $(this).remove(); }
- };
- infoLogOptions.buttons = {
- "Aizvērt": function () {
- $(this).dialog("close");
- }
- };
- var infoLogExtendOptions = {
- "resizable": true,
- "closable": false,
- "minimizable": true,
- "collapsable": true,
- "minimizeLocation": "right",
- "dblclick": "minimize",
- "icons": {
- // "close": "ui-icon-circle-closethick", //todo:
- "maximize": "ui-icon-extlink",
- "minimize": "ui-icon-minus",
- "restore": "ui-icon-newwin"
- }
- };
- var infoLog_dlg = $("<div />").dialog(infoLogOptions).dialogExtend(infoLogExtendOptions);
- logJson.forEach(function (entry) {
- let errorLog = "<span class='error-log-entry'> " + entry.msg + "</span><br />"
- infoLog_dlg.append(errorLog);
- });
- }
- function showSumColumns_dlg() {
- let sumColumnsFilter = localStorage.getItem('sumColumnsUserFilter');
- if (sumColumnsFilter) {
- let userFilter = jsonToObject(sumColumnsFilter);
- let items = $('.columnItem');
- let sortedElements = new Array(13);
- for (var i = 0; i < items.length; i++) {
- for (var j = 0; j < items.length; j++) {
- if (items[j].children[0].name == userFilter[0][i].colId) {
- let l1 = items[j].children[0].name;
- let r1 = userFilter[0][i].colId;
- items[j].children[0].checked = userFilter[0][i].isVisible;
- sortedElements[userFilter[0][i].sortOrder] = items[j];
- }
- }
- }
- $('.columnItem').remove();
- for (var i = 0; i < sortedElements.length; i++) {
- $('.columnsList').append(sortedElements[i]);
- }
- }
- sumColumns_dlg.dialog("open");
- }
- function showManualInput_dlg(structureId, sumColumnParameter, currentValue) {
- var dlg = $('#manualInput_dlg');
- dlg.dialog({ title: "Ievadīt vērtību" });
- if (sumColumnParameter == 'WorkLoad') {
- dlg.dialog({ title: "Ievadīt slodzes koeficienta vērtību" });
- dlg.find('input[name=sumColumnValue]').val(workLoadCoefficient);
- }
- if (currentValue || currentValue == 0) {
- dlg.find('input[name=sumColumnValue]').val(currentValue);
- }
- dlg.find('input[name=structureId]').val(structureId);
- dlg.find('input[name=sumColumnParameter]').val(sumColumnParameter);
- manualInput_dlg.dialog("open");
- }
- function mapToJson(map) {
- return JSON.stringify([map]);
- }
- function jsonToObject(jsonStr) {
- return JSON.parse(jsonStr);
- }
- function showManualInputError_dlg(message) {
- var infoLogOptions = {
- "title": "Kļūda mainot vērtību",
- "width": 450,
- "height": 300,
- "modal": false,
- "close": function () { $(this).remove(); }
- };
- infoLogOptions.buttons = { "Aizvērt": function () { $(this).dialog("close"); } };
- var infoLogExtendOptions = {
- "resizable": true,
- "closable": false,
- "minimizable": true,
- "collapsable": true,
- "minimizeLocation": "right",
- "dblclick": "minimize",
- "icons": {
- "maximize": "ui-icon-extlink",
- "minimize": "ui-icon-minus",
- "restore": "ui-icon-newwin"
- }
- };
- var infoLog_dlg = $("<div />").dialog(infoLogOptions).dialogExtend(infoLogExtendOptions);
- let errorLog = message;
- if (message.constructor === Array) {
- errorLog = '';
- for (var i = 0; i < message.length; i++) {
- errorLog += `<b> ${message[i].level} </b> </br >${message[i].msgLines.map(el => el)} `;
- }
- errorLog = errorLog.replace(/\,/g, ' ');
- }
- infoLog_dlg.append(errorLog);
- }
- function showEditWorkingTime_dlg(wtTaskId, onDateUnixTimeStamp, fromDate, toDate, wtName) {
- console.log("showEditWorkingTime_dlg");
- var onDate = new Date(onDateUnixTimeStamp * 1000);
- var dateFormat = onDate.ddmmyyyy();
- var dlg = $('#editWorkingTime_dlg');
- dlg.find('input[name=wtTaskId]').val(wtTaskId);
- dlg.find('input[name=datums]').val(dateFormat);
- dlg.find('input[name=datums]').prop('disabled', true);
- dlg.find('input[name=timeFrom]').val(fromDate);
- dlg.find('input[name=timeTo]').val(toDate);
- dlg.dialog({ title: "Plānot darba vietu (" + wtName + ")" });
- editWorkingTime_dlg.dialog("open");
- }
- function showEditEmployeeWorkingTime_dlg(taskId, onDate, fromDate, toDate, employeeName) {
- var dlg = $('#editEmployeeWorkingTime_dlg');
- dlg.find('input[name=wtTaskId]').val(taskId);
- dlg.find('input[name=datums]').val(onDate);
- dlg.find('input[name=datums]').prop('disabled', true);
- dlg.find('input[name=timeFrom]').val(fromDate);
- dlg.find('input[name=timeTo]').val(toDate);
- dlg.dialog({ title: "Edit employee working time (" + employeeName + ")" });
- editEmployeeWorkingTime_dlg.dialog("open");
- }
- function showEditEmployeeWorkingTimeFail_dlg(title, message) {
- var dlg = $('#editEmployeeWorkingTimeFail_dlg');
- dlg.dialog({ title: title });
- dlg.append(message);
- editEmployeeWorkingTimeFail_dlg.dialog("open");
- }
- function showCorrectWorkingTime_dlg(wtTaskId, fromDate, toDate, message) {
- console.log("showCorrectWorkingTime_dlg");
- var dlg = $('#correctWorkingTime_dlg');
- dlg.find('.info p').remove();
- dlg.find('.info').append(`<p>${message}</p>`);
- dlg.find('input[name=wtTaskId]').val(wtTaskId);
- dlg.find('input[name=timeFrom]').val(fromDate);
- dlg.find('input[name=timeTo]').val(toDate);
- dlg.dialog({ title: "Apstiprināt darbalaika maiņu" });
- correctWorkingTime_dlg.dialog("open");
- }
- function showManualWorkingTimeSchedule_dlg(wpStructureId, onDateUnixTimeStamp, period) {
- var onDate = new Date(onDateUnixTimeStamp * 1000);
- var dateFormat = onDate.ddmmyyyy();
- var workplaceItemPath = "";
- var workplacesDetails = scheduler.serverList("workplacesDetails");
- for (var i = 0; i < workplacesDetails.length; i++) {
- if (workplacesDetails[i].key == wpStructureId) {
- workplaceItemPath += workplacesDetails[i].WorkplacePath;
- break;
- }
- }
- var dlg = $('#manualWtScheduling_dlg');
- dlg.find('input[name=wpStructureId]').attr('value', wpStructureId);
- dlg.find('input[name=onDateUnixTimeStamp]').attr('value', onDateUnixTimeStamp);
- dlg.find('input[name=period]').attr('value', period);
- requestSchedulingDates_ajax(onDate, period, 'manualWtScheduling_dlg');
- dlg.dialog({ title: "Manuāls grafiks - " + workplaceItemPath });
- manualWtScheduling_dlg.dialog("open");
- }
- function clearSumColumnsManualinput() {
- var dlg = $('#manualInput_dlg');
- dlg.find('input[name=structureId]').val('');
- dlg.find('input[name=sumColumnParameter]').val('');
- dlg.find('input[name=sumColumnValue]').val('');
- }
- function showFactsTable_dlg(factsTableJson, onDateUnixTimeStamp) {
- $('#factsEntry_dlg_journalIdHolder').text(factsTableJson.tableHeaderData.journal.journalId);
- $('#factsEntry_dlg_mainOrgUnitHolder').text(factsTableJson.tableHeaderData.journal.mainOrgUnit);
- $('#factsEntry_dlg_periodHolder').text(factsTableJson.tableHeaderData.journal.period);
- $('#factsEntry_dlg_dateHolder').text(factsTableJson.tableHeaderData.onDate);
- createFactsTable(factsTableJson.factsTableContent, onDateUnixTimeStamp);
- factsEntry_dlg.dialog("open");
- }
- function showInsertJourStructure_dlg(journalItems, itemType, dialogName, wpStructureId, action) {
- createJourStructureList(journalItems, itemType);
- insertJourStructure_dlg.dialog('option', 'title', dialogName);
- var dlg = $('#insertJourStructure_dlg');
- dlg.find('input[name=refStructureId]').attr('value', wpStructureId);
- dlg.find('input[name=action]').attr('value', action);
- insertJourStructure_dlg.dialog("open");
- }
- function showEmployeeAbsence_dlg(emplFullName, axEmplId, action, absences, dateStart, emplId) {
- employeeAbsence_dlg.dialog('option', 'title', `Ievadīt prombūtni ${emplFullName}: ${axEmplId == null ? '' : axEmplId}`);
- var dlg = $('#employeeAbsence_dlg');
- if (dateStart === "") {
- $('.dateStart').datepicker({ defaultDate: new Date(scheduler._min_date) }).val('');
- $('.dateEnd').datepicker({ defaultDate: new Date(scheduler._max_date) }).val('');
- }
- else {
- $('.dateStart').datepicker().val(dateStart);
- var dateSplit = dateStart.split('.');
- var date = new Date(dateSplit[1] + '.' + dateSplit[0] + '.' + dateSplit[2]);
- $('.dateEnd').datepicker({ defaultDate: date }).val('');
- }
- dlg.find('input[name=emplId]').attr('value', emplId);
- //dlg.find('input[name=action]').attr('value', action);
- employeeAbsence_dlg.dialog("open");
- createAbsenceList(absences);
- }
- function showDeleteJourSection_dlg(itemLevel, wpStructureId, action) {
- var questionMessage = "";
- if (itemLevel == 1) {
- questionMessage += "Vai tiešām dzēst ēku/veikalu?"
- }
- if (itemLevel == 3) {
- questionMessage += "Vai tiešām dzēst nodaļu?"
- }
- if (itemLevel == 4) {
- questionMessage += "Kopā ar darbavietu tiks dzēsti arī visi darbavietas ieplānotie darbinieki. Vai tiešām dzēst darbavietu?";
- }
- deleteJourSection_dlg.dialog('option', 'title', "Apstiprināt dzēšanu");
- var dlg = $('#deleteJourSection_dlg');
- dlg.find('input[name=refStructureId]').attr('value', wpStructureId);
- dlg.find('input[name=action]').attr('value', action);
- dlg.find('span[name=questionMessage]').text(questionMessage);
- deleteJourSection_dlg.dialog("open");
- }
- function showDeleteWorkplaceOrWorker_dlg(callerTaskId, period, action, includeSiblings, extMsg) {
- var questionMessage = "";
- if (action == "DeleteWorkingTime") {
- questionMessage += "Vai tiešām dzēst darbavietu?"
- }
- if (action == "DeleteEmployee") {
- if (extMsg != '')
- questionMessage += extMsg;
- else
- questionMessage += "Vai tiešām dzēst darbinieku?"
- }
- deleteWorkplaceOrWorker_dlg.dialog('option', 'title', "Apstiprināt dzēšanu");
- var dlg = $('#deleteWorkplaceOrWorker_dlg');
- dlg.find('input[name=callerTaskId]').attr('value', callerTaskId);
- dlg.find('input[name=period]').attr('value', period);
- dlg.find('input[name=action]').attr('value', action);
- dlg.find('input[name=includeSiblings]').attr('value', includeSiblings);
- dlg.find('span[name=questionMessage]').text(questionMessage);
- deleteWorkplaceOrWorker_dlg.dialog("open");
- }
- function showDragOrWorker_dlg(emplTasksCount_target, taskId_source, taskId_target) {
- $('input[name=cb1]').prop('checked', false);
- $('input[name=cb2]').prop('checked', false);
- var dlg = $('#dragWorker_dlg');
- if (emplTasksCount_target == 1) {
- $('input[name=cb1]').prop('checked', true);
- }
- if (emplTasksCount_target == 0) {
- $('input[name=cb2]').prop('disabled', true);
- $('input[name=cb1]').prop('disabled', true);
- $('input[name=cb2]').prop('checked', true);
- }
- dlg.find('input[name=taskId_target]').val(taskId_target);
- dlg.find('input[name=taskId_source]').val(taskId_source);
- dragWorker_dlg.dialog("open");
- }
- function showMessageAbsence3A_dlg(message) {
- messageAbsence3A_dlg.dialog('option', 'title', 'Informācija');
- let dlg = $('#messageAbsence3A_dlg');
- dlg.append(message);
- messageAbsence3A_dlg.dialog("open");
- }
- function showMessageAbsence3B_dlg(messageLog) {
- messageAbsence3B_dlg.dialog('option', 'title', 'Darbinieks izņemts');
- let dlg = $('#messageAbsence3B_dlg');
- messageLog.forEach(function (item) {
- dlg.append(item + '<br/>');
- });
- messageAbsence3B_dlg.dialog("open");
- }
- function showMessageAbsence2A_dlg(message) {
- messageAbsence2A_dlg.dialog('option', 'title', 'Informācija');
- let dlg = $('#messageAbsence2A_dlg');
- dlg.append(message + '</br>')
- messageAbsence2A_dlg.dialog("open");
- }
- function showMessageAbsence2B_dlg(emplId, approveAbsence, dateFromUnixTimeStamp, dateToUnixTimeStamp, absenceId, message) {
- messageAbsence2B_dlg.dialog('option', 'title', 'Turpināt');
- let dlg = $('#messageAbsence2B_dlg');
- dlg.find('input[name=emplId]').val(emplId);
- dlg.find('input[name=approveAbsence]').val(approveAbsence);
- dlg.find('input[name=dateFromUnixTimeStamp]').val(dateFromUnixTimeStamp);
- dlg.find('input[name=dateToUnixTimeStamp]').val(dateToUnixTimeStamp);
- dlg.find('input[name=absenceId]').val(absenceId);
- dlg.append(message + '</br>');
- messageAbsence2B_dlg.dialog("open");
- }
- function showConfirm_dlg(confirmTitle, confirmText) {
- var dlg = $('#dragWorker_dlg');
- var confirmText = dlg.find('input[name=confirmText]').val();
- $("#confirm_dlg .info p br").remove();
- $("#confirm_dlg .info p").remove();
- var dlg = $('#confirm_dlg');
- dlg.find('.info').append(`<p>${confirmText}</p>`);
- confirm_dlg.dialog("open");
- }
- function showError_dlg(errors) {
- var confirmText = '';
- for (let error of errors) {
- confirmText += `<p>${error.msg}</p>`;
- }
- var dlg = $('#error_dlg');
- error_dlg.dialog('option', 'title', 'Pārvietošana nav atļauta');
- dlg.find('.info').append(confirmText);
- error_dlg.dialog("open");
- }
- function createJourStructureList(journalItems, level) {
- var select = $('#insertJourStructure_dlg_itemTable');
- select.empty();
- var option = document.createElement('option');
- option.value = 0;
- option.setAttribute('disabled', '');
- option.setAttribute('selected', 'true');
- if (level == 1) {
- option.innerHTML = 'Ēka/veikals - Nosaukums';
- }
- if (level == 3) {
- option.innerHTML = 'Nodaļa - Nosaukums';
- }
- if (level == 4) {
- option.innerHTML = 'Darbavieta - Nosaukums';
- }
- select.append(option);
- journalItems.forEach(function (item) {
- var option = document.createElement('option');
- option.value = item.ItemId;
- option.innerHTML = item.AxItemId + ' - ' + item.Name;
- select.append(option);
- });
- }
- function createAbsenceList(absenceItems) {
- var select = $('#absenceList');
- select.empty();
- var option = document.createElement('option');
- option.value = 0;
- option.setAttribute('disabled', '');
- option.setAttribute('selected', 'true');
- option.innerHTML = 'Prombūtnes veids – Prombūtnes veida nosaukums';
- select.append(option);
- absenceItems.forEach(function (item) {
- var option = document.createElement('option');
- option.value = item.AbsenceId;
- option.innerHTML = item.AxAbsenceId + ' - ' + item.AxName;
- select.append(option);
- });
- }
- function setSchedulingDates(schedStartDate, schedEndDate, updTarget) {
- var schedulingStartDateTxt = schedStartDate.ddmmyyyy();
- var schedulingEndDateTxt = schedEndDate.ddmmyyyy();
- switch (updTarget) {
- case "manualScheduling_dlg": {
- $('#manualScheduling_dlg_dateFrom').text(schedulingStartDateTxt);
- $('#manualScheduling_dlg_dateTo').text(schedulingEndDateTxt);
- break;
- }
- case "manualWtScheduling_dlg": {
- $('#manualWtScheduling_dlg_dateFrom').text(schedulingStartDateTxt);
- $('#manualWtScheduling_dlg_dateTo').text(schedulingEndDateTxt);
- break;
- }
- }
- }
- function showManualEmployeeSchedule_dlg(wtTaskId, period, emplId, axEmplId, emplFullName, planOtherPlaces) {
- var wtTask = scheduler.getEvent(wtTaskId);
- var dateFormat = new Date(wtTask.DateTimeStart).ddmmyyyy();
- var dlgTitle = "Plānot darbinieku";
- var dlg = $('#manualScheduling_dlg');
- dlg.find('input[name=wtTaskId]').attr('value', wtTaskId);
- dlg.find('input[name=period]').attr('value', period);
- dlg.find('input[name=emplId]').attr('value', emplId);
- if (planOtherPlaces) {
- var planOtherPlacesCb = dlg.find('input[name=cb1]');
- planOtherPlacesCb.prop('checked', true);
- planOtherPlacesCb.prop('disabled', true);
- planOtherPlacesCb.prop('readonly', true);
- }
- requestSchedulingDates_ajax(wtTask.DateTimeStart, period, 'manualScheduling_dlg');
- $('#manualScheduling_dlg_workplaceHolder').text(wtTask.WorkplacePath);
- dlgTitle += (' (' + emplFullName + ': ' + axEmplId + ')');
- dlg.dialog({ title: dlgTitle });
- manualScheduling_dlg.dialog("open");
- }
- function runManualEmployeeScheduling() {
- var dlg = $('#manualScheduling_dlg');
- var wtTaskId = dlg.find('input[name=wtTaskId]').val();
- var period = dlg.find('input[name=period]').val();
- var emplId = dlg.find('input[name=emplId]').val();
- var wd1 = parseInt(dlg.find('input[name=wd1]').val());
- var hd1 = parseInt(dlg.find('input[name=hd1]').val());
- var wd2 = parseInt(dlg.find('input[name=wd2]').val());
- var hd2 = parseInt(dlg.find('input[name=hd2]').val());
- if (wd1 == NaN) { wd1 = 0; }
- if (hd1 == NaN) { hd1 = 0; }
- if (wd2 == NaN) { wd2 = 0; }
- if (hd2 == NaN) { hd2 = 0; }
- if (hd1 + hd2 == 0) {
- dhtmlx.message("Ievadiet vismaz vienu darbadienu šablonā!");
- return;
- }
- var planOtherPlaces = dlg.find('input[name=cb1]:checked').length > 0;
- var fromTemplateStart = dlg.find('input[name=cb2]:checked').length > 0;
- manualScheduling_dlg.dialog("close");
- resetFields_ManualEmplSchedDlg();
- manuallyScheduleEmployee_ajax(wtTaskId, emplId, period, wd1, hd1, wd2, hd2, planOtherPlaces, fromTemplateStart);
- }
- function resetFields_ManualEmplSchedDlg() {
- var dlg = $('#manualScheduling_dlg');
- dlg.find('input[name=wd1]').val('');
- dlg.find('input[name=hd1]').val('');
- dlg.find('input[name=wd2]').val('');
- dlg.find('input[name=hd2]').val('');
- dlg.find('input[name=cb2]').prop('checked', false);
- var planOtherPlacesCb = dlg.find('input[name=cb1]');
- planOtherPlacesCb.prop('disabled', false);
- planOtherPlacesCb.prop('readonly', false);
- //planOtherPlacesCb.removeProp('disabled'); //dbl check
- //planOtherPlacesCb.removeProp('readonly'); //dbl check
- planOtherPlacesCb.prop('checked', false);
- }
- function runManualWorkingTimeScheduling() {
- var dlg = $('#manualWtScheduling_dlg');
- var wpStructureId = dlg.find('input[name=wpStructureId]').val();
- var onDateUnixTimeStamp = dlg.find('input[name=onDateUnixTimeStamp]').val();
- var period = dlg.find('input[name=period]').val();
- var weekSchedule = [];
- for (let dayNr = 1; dayNr <= 7; dayNr++) {
- var schedOnDay = dlg.find('input[name=sched-' + dayNr + ']:checked').length > 0;
- if (schedOnDay) {
- var timeFromStr = dlg.find('input[name=timeFrom-' + dayNr + ']').val();
- var timeToStr = dlg.find('input[name=timeTo-' + dayNr + ']').val();
- if (!isTime(timeFromStr) || !isTime(timeToStr)) {
- dhtmlx.message("Ievadiet laiku formātā hh:mm");
- return;
- }
- /*if (timeFromStr == timeToStr && timeToStr != "00:00") {
- dhtmlx.message("Laiks no nevar būt vienāds ar laiku līdz");
- return;
- }
- if (timeFromStr > timeToStr && timeToStr != "00:00") {
- dhtmlx.message("Laikam no jābūt mazākam kā laikam līdz");
- return;
- }*/
- var timeFromHHmm = timeFromStr.split(":");
- var timeFromHours = timeFromHHmm[0];
- var timeFromMinutes = timeFromHHmm[1];
- var timeToHHmm = timeToStr.split(":");
- var timeToHours = timeToHHmm[0];
- var timeToMinutes = timeToHHmm[1];
- if (timeToStr == "00:00" || timeToStr == "24:00")
- timeToStr = "23:59";
- var dayObj = {};
- dayObj.dayNr = dayNr;
- dayObj.timeToStr = timeToStr;
- dayObj.timeFromStr = timeFromStr;
- weekSchedule.push(dayObj);
- }
- }
- var includeHolidays = dlg.find('input[name=includeHolidays]:checked').length > 0;
- manualWtScheduling_dlg.dialog("close");
- manuallyScheduleWorkingTime_ajax(wpStructureId, onDateUnixTimeStamp, period, weekSchedule, includeHolidays);
- resetFields_ManualWtSchedDlg();
- }
- function resetFields_DragOrWorker_dlg() {
- var dlg = $('#dragWorker_dlg');
- dlg.find('input[name=cb1]').prop('checked', false);
- dlg.find('input[name=cb2]').prop('checked', false);
- dlg.find('input[name=cb2]').prop('disabled', false);
- dlg.find('input[name=cb1]').prop('disabled', false);
- }
- function runEditEmployeeWorkingTime() {
- var dlg = $('#editEmployeeWorkingTime_dlg');
- var taskId = dlg.find('input[name=wtTaskId]').val();
- var newTimeFromStr = dlg.find('input[name=timeFrom]').val();
- var newTimeToStr = dlg.find('input[name=timeTo]').val();
- editEmployeeWorkingTime_ajax(taskId, newTimeFromStr, newTimeToStr);
- }
- function runManualEditTime() {
- var dlg = $('#editWorkingTime_dlg');
- var wtTaskId = dlg.find('input[name=wtTaskId]').val();
- var newTimeFromStr = dlg.find('input[name=timeFrom]').val();
- var newTimeToStr = dlg.find('input[name=timeTo]').val();
- if (newTimeFromStr > newTimeToStr && newTimeToStr != "00:00") {
- dhtmlx.message("Laikam no jābūt mazākam kā laikam līdz");
- return;
- }
- if (newTimeFromStr == newTimeToStr && newTimeToStr != "00:00") {
- dhtmlx.message("Laiks no nevar būt vienāds ar laiku līdz");
- return;
- }
- if (newTimeToStr == "00:00" || newTimeToStr == "24:00")
- newTimeToStr = "23:59";
- manuallyEditTime_ajax(wtTaskId, newTimeFromStr, newTimeToStr, true);
- }
- function resetFields_ManualWtSchedDlg() {
- var dlg = $('#manualWtScheduling_dlg');
- for (let dayNr = 1; dayNr <= 7; dayNr++) {
- var defaultTime = "00:00";
- dlg.find('input[name=sched-' + dayNr + ']').prop('checked', false);
- dlg.find('input[name=timeFrom-' + dayNr + ']').val(defaultTime);
- dlg.find('input[name=timeTo-' + dayNr + ']').val(defaultTime);
- }
- dlg.find('input[name=includeHolidays]').prop('checked', false);
- dlg.find('input[name=manualWtSched_TimeFrom]').val(defaultTime);
- dlg.find('input[name=manualWtSched_TimeTo]').val(defaultTime);
- dlg.find('#manualWtSched_WorkingDaysCb').prop('checked', false);
- dlg.find('#manualWtSched_WeekendsCb').prop('checked', false);
- dlg.find('#manualWtSched_AllDaysCb').prop('checked', false);
- }
- function inputInfoForConfirmDlg(confirmTitle, confirmText) {
- $('#dragWorker_dlg').find('input[name=confirmText]').val(confirmText);
- $('#confirm_dlg').dialog('option', 'title', confirmTitle);
- }
- $(function () {
- // on manual wt sched dialog checkbox clicks
- $('#manualWtSched_WorkingDaysCb').change(function () {
- var dlg = $('#manualWtScheduling_dlg');
- if (this.checked) {
- var timeFromValue = dlg.find('input[name=manualWtSched_TimeFrom]').val();
- var timeToValue = dlg.find('input[name=manualWtSched_TimeTo]').val();
- for (let dayNr = 1; dayNr <= 5; dayNr++) {
- dlg.find('input[name=sched-' + dayNr + ']').prop('checked', true);
- dlg.find('input[name=timeFrom-' + dayNr + ']').val(timeFromValue);
- dlg.find('input[name=timeTo-' + dayNr + ']').val(timeToValue);
- }
- for (let dayNr = 6; dayNr <= 7; dayNr++) {
- //dlg.find('input[name=sched-' + dayNr + ']').prop('checked', false);
- }
- //$('#manualWtSched_WeekendsCb').prop('checked', false);
- //$('#manualWtSched_AllDaysCb').prop('checked', false);
- }
- else {
- for (let dayNr = 1; dayNr <= 5; dayNr++) {
- var defaultTime = "00:00";
- dlg.find('input[name=sched-' + dayNr + ']').prop('checked', false);
- dlg.find('input[name=timeFrom-' + dayNr + ']').val(defaultTime);
- dlg.find('input[name=timeTo-' + dayNr + ']').val(defaultTime);
- }
- }
- });
- $('#manualWtSched_WeekendsCb').change(function () {
- var dlg = $('#manualWtScheduling_dlg');
- if (this.checked) {
- var timeFromValue = dlg.find('input[name=manualWtSched_TimeFrom]').val();
- var timeToValue = dlg.find('input[name=manualWtSched_TimeTo]').val();
- for (let dayNr = 6; dayNr <= 7; dayNr++) {
- dlg.find('input[name=sched-' + dayNr + ']').prop('checked', true);
- dlg.find('input[name=timeFrom-' + dayNr + ']').val(timeFromValue);
- dlg.find('input[name=timeTo-' + dayNr + ']').val(timeToValue);
- }
- for (let dayNr = 1; dayNr <= 5; dayNr++) {
- //dlg.find('input[name=sched-' + dayNr + ']').prop('checked', false);
- }
- //$('#manualWtSched_WorkingDaysCb').prop('checked', false);
- //$('#manualWtSched_AllDaysCb').prop('checked', false);
- }
- else {
- for (let dayNr = 6; dayNr <= 7; dayNr++) {
- var defaultTime = "00:00";
- dlg.find('input[name=sched-' + dayNr + ']').prop('checked', false);
- dlg.find('input[name=timeFrom-' + dayNr + ']').val(defaultTime);
- dlg.find('input[name=timeTo-' + dayNr + ']').val(defaultTime);
- }
- }
- });
- $('#manualWtSched_AllDaysCb').change(function () {
- var dlg = $('#manualWtScheduling_dlg');
- if (this.checked) {
- var timeFromValue = dlg.find('input[name=manualWtSched_TimeFrom]').val();
- var timeToValue = dlg.find('input[name=manualWtSched_TimeTo]').val();
- for (let dayNr = 1; dayNr <= 7; dayNr++) {
- dlg.find('input[name=sched-' + dayNr + ']').prop('checked', true);
- dlg.find('input[name=timeFrom-' + dayNr + ']').val(timeFromValue);
- dlg.find('input[name=timeTo-' + dayNr + ']').val(timeToValue);
- }
- //$('#manualWtSched_WorkingDaysCb').prop('checked', false);
- //$('#manualWtSched_WeekendsCb').prop('checked', false);
- }
- else {
- for (let dayNr = 1; dayNr <= 7; dayNr++) {
- var defaultTime = "00:00";
- dlg.find('input[name=sched-' + dayNr + ']').prop('checked', false);
- dlg.find('input[name=timeFrom-' + dayNr + ']').val(defaultTime);
- dlg.find('input[name=timeTo-' + dayNr + ']').val(defaultTime);
- }
- }
- });
- manualScheduling_dlg = $("#manualScheduling_dlg").dialog({
- closeOnEscape: true,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 500,
- width: 600,
- modal: true,
- buttons: {
- "Plānot": runManualEmployeeScheduling,
- "Atcelt": function () {
- manualScheduling_dlg.dialog("close");
- resetFields_ManualEmplSchedDlg();
- }
- }
- });
- editWorkingTime_dlg = $("#editWorkingTime_dlg").dialog({
- closeOnEscape: true,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 200,
- width: 420,
- modal: true,
- buttons: {
- "Labi": runManualEditTime,
- "Atcelt": function () {
- editWorkingTime_dlg.dialog("close");
- }
- }
- });
- editEmployeeWorkingTime_dlg = $("#editEmployeeWorkingTime_dlg").dialog({
- closeOnEscape: true,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 200,
- width: 420,
- modal: true,
- buttons: {
- "Labi": runEditEmployeeWorkingTime,
- "Atcelt": function () {
- editEmployeeWorkingTime_dlg.dialog("close");
- }
- }
- });
- editEmployeeWorkingTimeFail_dlg = $("#editEmployeeWorkingTimeFail_dlg").dialog({
- closeOnEscape: true,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 200,
- width: 420,
- modal: true,
- buttons: {
- "Close": function () {
- editEmployeeWorkingTimeFail_dlg.dialog("close");
- }
- }
- });
- sumColumns_dlg = $("#sumColumns_dlg").dialog({
- closeOnEscape: true,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 430,
- width: 420,
- modal: true,
- buttons: {
- "Labi": function () {
- let filterInfo = [];
- let items = $('.columnItem');
- let checkedCount = 0;
- for (let i = 0; i < items.length; i++) {
- if (items[i].children[0].checked) {
- checkedCount++;
- }
- filterInfo.push({
- colId: items[i].children[0].name,
- isVisible: items[i].children[0].checked,
- sortOrder: i
- });
- }
- let oldFilter = localStorage.getItem('sumColumnsUserFilter');
- if (oldFilter) {
- localStorage.removeItem('sumColumnsUserFilter');
- }
- localStorage.setItem('sumColumnsUserFilter', mapToJson(filterInfo));
- clearAndLoadSchedulingData_ajax();
- //initOffset();
- initOffset2();
- setOffsetLevel2();
- scheduler.updateView();
- scheduler2.updateView();
- changeSchedulerWrapperWidth();
- sumColumns_dlg.dialog("close");
- //for visible scheduler if empty data
- $('#scheduler2_here').css('min-width', `${checkedCount * 95 + 270}px`);
- setMaxWidthToTreeScheduler(checkedCount * 95 + 270);
- },
- "Atcelt": function () {
- let items = $('.columnItem');
- for (var i = 0; i < items.length; i++) {
- $(items[i]).removeClass('selectedCol');
- }
- sumColumns_dlg.dialog("close");
- }
- }
- });
- correctWorkingTime_dlg = $("#correctWorkingTime_dlg").dialog({
- closeOnEscape: true,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 250,
- width: 420,
- modal: true,
- buttons: {
- "Jā": function () {
- var dlg = $('#correctWorkingTime_dlg');
- var wtTaskId = dlg.find('input[name=wtTaskId]').val();
- var newTimeFromStr = dlg.find('input[name=timeFrom]').val();
- var newTimeToStr = dlg.find('input[name=timeTo]').val();
- correctWorkingTime_dlg.dialog("close");
- manuallyEditTime_ajax(wtTaskId, newTimeFromStr, newTimeToStr, false);
- },
- "Nē": function () {
- correctWorkingTime_dlg.dialog("close");
- }
- }
- });
- manualWtScheduling_dlg = $("#manualWtScheduling_dlg").dialog({
- closeOnEscape: true,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 620,
- width: 600,
- modal: true,
- buttons: {
- "Plānot": runManualWorkingTimeScheduling,
- "Atcelt": function () {
- manualWtScheduling_dlg.dialog("close");
- resetFields_ManualWtSchedDlg();
- }
- }
- });
- insertJourStructure_dlg = $("#insertJourStructure_dlg").dialog({
- closeOnEscape: false,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 150,
- width: 500,
- modal: true,
- buttons: {
- "Labi": function () {
- var dlg = $('#insertJourStructure_dlg');
- var updateType = dlg.find('input[name=action]').val();
- var refStructureId = dlg.find('input[name=refStructureId]').val();
- var itemId = $('#insertJourStructure_dlg_itemTable').val();
- isContextBlocked = true;
- if (!itemId || itemId == 0) {
- return;
- }
- requestUpdateJournalStructure_ajax(updateType, refStructureId, itemId);
- insertJourStructure_dlg.dialog("close");
- asyncBlockContextMenu();
- },
- "Atcelt": function () {
- insertJourStructure_dlg.dialog("close");
- }
- }
- });
- employeeAbsence_dlg = $("#employeeAbsence_dlg").dialog({
- closeOnEscape: false,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 220,
- width: 480,
- modal: true,
- buttons: {
- "Labi": function () {
- let dlg = $('#employeeAbsence_dlg');
- let emplId = parseInt(dlg.find('input[name=emplId]').val());
- let approveAbsence = $('#isApproved').prop("checked");
- let dateFrom = $('.dateStart').datepicker('getDate');
- let dateTo = $('.dateEnd').datepicker('getDate');
- let absenceId = parseInt($('#absenceList').find(':selected').val());
- if (!absenceId) {
- dhtmlx.message("Nav izvēlēts prombūtnes tips");
- return;
- }
- if ($('.dateEnd')[0].value == "00.00.0000" || $('.dateEnd')[0].value == "") {
- return;
- }
- if (!isValidDate($('.dateStart')[0].value)) {
- return;
- }
- if (!isValidDate($('.dateEnd')[0].value)) {
- return;
- }
- var dateFromUnixTimeStamp = parseInt((new Date(dateFrom).getTime() / 1000).toFixed(0));
- dateFromUnixTimeStamp = dateFromUnixTimeStamp != undefined ? dateFromUnixTimeStamp : "";
- var dateToUnixTimeStamp = parseInt((new Date(dateTo).getTime() / 1000).toFixed(0));
- dateToUnixTimeStamp = dateToUnixTimeStamp != undefined ? dateToUnixTimeStamp : "";
- addAbsence_ajax(emplId, approveAbsence, dateFromUnixTimeStamp, dateToUnixTimeStamp, absenceId, true);
- },
- "Atcelt": function () {
- employeeAbsence_dlg.dialog("close");
- }
- }
- });
- messageAbsence2A_dlg = $("#messageAbsence2A_dlg").dialog({
- closeOnEscape: false,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 220,
- width: 300,
- modal: true,
- buttons: {
- "Aizvērt": function () {
- messageAbsence2A_dlg.dialog("close");
- }
- }
- });
- messageAbsence2B_dlg = $("#messageAbsence2B_dlg").dialog({
- closeOnEscape: false,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 220,
- width: 300,
- modal: true,
- buttons: {
- "Jā": function () {
- let dlg = $("#messageAbsence2B_dlg");
- let emplId = dlg.find('input[name=emplId]').val();
- let approveAbsence = dlg.find('input[name=approveAbsence]').val();
- let dateFromUnixTimeStamp = dlg.find('input[name=dateFromUnixTimeStamp]').val();
- let dateToUnixTimeStamp = dlg.find('input[name=dateToUnixTimeStamp]').val();
- let absenceId = dlg.find('input[name=absenceId]').val();
- addAbsence_ajax(emplId, approveAbsence, dateFromUnixTimeStamp, dateToUnixTimeStamp, absenceId, false);
- },
- "Nē": function () {
- messageAbsence2B_dlg.dialog("close");
- }
- }
- });
- messageAbsence3A_dlg = $("#messageAbsence3A_dlg").dialog({
- closeOnEscape: false,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 220,
- width: 300,
- modal: true,
- buttons: {
- "Aizvērt": function () {
- refreshSumColumnsData_ajax();
- messageAbsence2B_dlg.dialog("close");
- messageAbsence3A_dlg.dialog("close");
- }
- }
- });
- messageAbsence3B_dlg = $("#messageAbsence3B_dlg").dialog({
- closeOnEscape: false,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 240,
- width: 360,
- modal: true,
- buttons: {
- "Aizvērt": function () {
- refreshSumColumnsData_ajax();
- messageAbsence2A_dlg.dialog("close");
- messageAbsence2B_dlg.dialog("close");
- messageAbsence3A_dlg.dialog("close");
- messageAbsence3B_dlg.dialog("close");
- employeeAbsence_dlg.dialog("close");
- }
- }
- });
- manualInput_dlg = $("#manualInput_dlg").dialog({
- closeOnEscape: false,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 150,
- width: 283,
- modal: true,
- buttons: {
- "Labi": function () {
- let dlg = $('#manualInput_dlg');
- let structureId = dlg.find('input[name=structureId]').val();
- let sumColumnParameter = dlg.find('input[name=sumColumnParameter]').val();
- let userInput = dlg.find('input[name=sumColumnValue]').val();
- manualInputSumColumnsData_ajax(structureId, sumColumnParameter, userInput);
- manualInput_dlg.dialog("close");
- clearSumColumnsManualinput();
- },
- "Atcelt": function () {
- clearSumColumnsManualinput();
- manualInput_dlg.dialog("close");
- }
- }
- });
- factsEntry_dlg = $("#factsEntry_dlg").dialog({
- closeOnEscape: false,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 850,
- width: 1500,
- modal: true,
- buttons: {
- "Aizvērt": function () {
- factsEntry_dlg.dialog("close");
- }
- }
- });
- deleteJourSection_dlg = $("#deleteJourSection_dlg").dialog({
- closeOnEscape: false,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 200,
- width: 500,
- modal: true,
- buttons: {
- "Jā": function () {
- var dlg = $('#deleteJourSection_dlg');
- var updateType = dlg.find('input[name=action]').val();
- var sectionId = dlg.find('input[name=refStructureId]').val();
- requestUpdateJournalStructure_ajax(updateType, sectionId, 0);
- deleteJourSection_dlg.dialog("close");
- },
- "Atcelt": function () {
- deleteJourSection_dlg.dialog("close");
- }
- }
- });
- dragWorker_dlg = $("#dragWorker_dlg").dialog({
- closeOnEscape: false,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 200,
- width: 230,
- modal: true,
- buttons: {
- "Labi": function () {
- var dlg = $('#dragWorker_dlg');
- var taskId_target = dlg.find('input[name=taskId_target]').val();
- var taskId_source = dlg.find('input[name=taskId_source]').val();
- var bidirect = false;
- var target = scheduler.getEvent(taskId_target);
- var source = scheduler.getEvent(taskId_source);
- confirmTitle = "Apstiprināt pārvietošanu";
- if (document.getElementById('exchange').checked) {
- bidirect = true;
- confirmText = `Vai tiešām samainīt vietām`;
- confirmText += `<br>${source.EmplName} ${source.EmplSurname}, ${source.AxEmplId}, ${new Date(source.DateTimeStart).ddmmyyyy()}, ${source.WorkplacePath}`;
- confirmText += `<br>ar`;
- confirmText += `<br>${target.EmplName} ${target.EmplSurname}, ${target.AxEmplId}, ${new Date(target.DateTimeStart).ddmmyyyy()}, ${target.WorkplacePath}?`;
- dlg.find('input[name=bidirect]').val(bidirect);
- }
- if (document.getElementById('replace').checked) {
- dlg.find('input[name=bidirect]').val(bidirect);
- confirmText = `Vai tiešām aizvietot`;
- confirmText += `<br>${target.EmplName} ${target.EmplSurname}, ${target.AxEmplId}, ${new Date(target.DateTimeStart).ddmmyyyy()}, ${target.WorkplacePath}`;
- confirmText += `<br>ar`;
- confirmText += `<br>${source.EmplName} ${source.EmplSurname}, ${source.AxEmplId}, ${new Date(source.DateTimeStart).ddmmyyyy()}, ${source.WorkplacePath}?`;
- }
- if ((document.getElementById('replace').checked) && ($('#replace').prop('disabled'))) {
- dlg.find('input[name=bidirect]').val(bidirect);
- confirmText = `Vai tiešām mainīt`;
- confirmText += `<br>${source.EmplName} ${source.EmplSurname}, ${source.AxEmplId}, ${new Date(source.DateTimeStart).ddmmyyyy()}, ${source.WorkplacePath}`;
- confirmText += `<br>uz`;
- confirmText += `<br>${new Date(target.DateTimeStart).ddmmyyyy()}, ${target.WorkplacePath}?`;
- }
- inputInfoForConfirmDlg(confirmTitle, confirmText);
- wtEmplSchedMove_ajax(taskId_source, taskId_target, bidirect, true);
- dragWorker_dlg.dialog("close");
- },
- "Atcelt": function () {
- resetFields_DragOrWorker_dlg();
- clearAndLoadSchedulingData_ajax();
- dragWorker_dlg.dialog("close");
- }
- }
- });
- confirm_dlg = $("#confirm_dlg").dialog({
- closeOnEscape: false,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 260,
- width: 730,
- modal: true,
- buttons: {
- "Labi": function () {
- var dlg = $('#dragWorker_dlg');
- var taskId_target = dlg.find('input[name=taskId_target]').val();
- var taskId_source = dlg.find('input[name=taskId_source]').val();
- var bidirect = dlg.find('input[name=bidirect]').val();
- wtEmplSchedMove_ajax(taskId_source, taskId_target, bidirect, false);
- let sumColumnsCount = localStorage.getItem('countHeaders');
- //if (sumColumnsCount && sumColumnsCount > 0) {
- // refreshSumColumnsData_ajax();
- //}
- //clearAndLoadSchedulingData_ajax();
- resetFields_DragOrWorker_dlg();
- confirm_dlg.dialog("close");
- },
- "Atcelt": function () {
- $("#confirm_dlg .info p").remove();
- confirm_dlg.dialog("close");
- clearAndLoadSchedulingData_ajax();
- resetFields_DragOrWorker_dlg();
- }
- }
- });
- error_dlg = $("#error_dlg").dialog({
- closeOnEscape: false,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 260,
- width: 730,
- modal: true,
- buttons: {
- "Labi": function () {
- clearAndLoadSchedulingData_ajax();
- $("#error_dlg .info p").remove();
- error_dlg.dialog("close");
- }
- }
- });
- deleteWorkplaceOrWorker_dlg = $("#deleteWorkplaceOrWorker_dlg").dialog({
- closeOnEscape: false,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- height: 200,
- width: 500,
- modal: true,
- buttons: {
- "Jā": function () {
- var dlg = $('#deleteWorkplaceOrWorker_dlg');
- var callerTaskId = dlg.find('input[name=callerTaskId]').val();
- var period = dlg.find('input[name=period]').val();
- var action = dlg.find('input[name=action]').val();
- var includeSiblings = dlg.find('input[name=includeSiblings]').val();
- deleteTasks_ajax(callerTaskId, period, action, includeSiblings);
- deleteWorkplaceOrWorker_dlg.dialog("close");
- },
- "Atcelt": function () {
- deleteWorkplaceOrWorker_dlg.dialog("close");
- }
- }
- });
- journalStatusChange_dlg = $("#journalStatusChange_dlg").dialog({
- closeOnEscape: false,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
- },
- autoOpen: false,
- minHeight: 200,
- width: 500,
- modal: true,
- title: 'Žurnāla statusa maiņas rezultāts',
- buttons: {
- "Labi": function () {
- journalStatusChange_dlg.dialog("close");
- }
- }
- });
- });
- _EditEmployeeWorkingTimeDlg.cshtml
- <div id="editEmployeeWorkingTime_dlg" title="Edit employee working time">
- <div class="datums">
- <label class="" for="datums">Datums:</label>
- <input type="text" name="datums" value="00:00" class="text ui-widget-content">
- </div>
- <div class="edit-time">
- <label class="" for="timeFrom">Laiks No:</label>
- <input type="text" name="timeFrom" value="00:00" class="text ui-widget-content time-input">
- <label class="" for="timeTo">Līdz:</label>
- <input type="text" name="timeTo" value="00:00" class="text ui-widget-content time-input">
- </div>
- <input type="hidden" name="wtTaskId" />
- </div>
- <div id="editEmployeeWorkingTimeFail_dlg">
- </div>
- Show.chtml
- <div id="schedulerView" style="display:none">
- <div class="clear header-scheduler-info">
- <div class="header-scheduler-journalInfo">
- <label> <span class="bold">@(App_Localization.Labels.JournalNumber): </span> @Model.AxJournalId </label><a href="/Journal/Select">@(App_Localization.Labels.SwitchJournal)</a>
- <label class="clear"><span class="bold">@(App_Localization.Labels.Period): </span>@Model.AxPeriodId </label>
- <label class="clear"><span class="bold">@(App_Localization.Labels.StdCalendarHours): </span>@Model.AxStdCalendarHours</label>
- <label class="clear"><span class="bold">@(App_Localization.Labels.JournalStatus): </span><span id="axJournalStatusId">@Model.AxJournalStatusId</span> - <span id="axJournalStatusName">@Model.AxJournalStatusName </span></label>
- </div>
- <div class="header-scheduler-taskInfo">
- <label></label>
- </div>
- </div>
- <div style="height:800px;width:100%;margin:0 auto;display:none" id="schedulerWrapper">
- @Html.Raw(Model.Scheduler.Render())
- </div>
- <div style="height:800px;width:100%;margin:0 auto;display:none" id="schedulerWrapper2">
- @Html.Raw(ViewBag.schedViewModel2.Scheduler.Render())
- </div>
- <link href="~/Content/libraries-overriding.css" rel="stylesheet" />
- @Html.Partial("_ManualEmplSchedDlg")
- @Html.Partial("_DragAndDropDlg")
- @Html.Partial("_FactsEntryDlg")
- @Html.Partial("_ManualWorkingTimeSchedDlg")
- @Html.Partial("_EditWorkingTimeDlg")
- @Html.Partial("_JournalStructureUpdDlg")
- @Html.Partial("_SumColumnDlg")
- @Html.Partial("_EmployeeAbsenceDialog")
- @Html.Partial("_EditEmployeeWorkingTimeDlg")
- <div>
- <input type="hidden" id="load-page" value="false" />
- <input type="hidden" id="freeze-scheduler" value="true" />
- </div>
- <input type="hidden" name="_AxJournalId" value="@Model.AxJournalId" />
- <input type="hidden" name="_EmplId" value="@Model.EmplId" />
- </div>
- @Html.Partial("_CustomSchedulerHeader")
- <div id="layoutView" style="height:760px;width:100%"></div>
- @Scripts.Render("~/bundles/dhtmlxlayout")
- @Scripts.Render("~/bundles/dropdownmenus")
- <script type="text/javascript">
- AppLabels.Employee = '@(App_Localization.Labels.Employee)';
- </script>
- Layout
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Darbavietu plānošana</title>
- <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Promise"></script>
- @Styles.Render("~/Content/css")
- @Scripts.Render("~/bundles/jquery")
- <script>
- $.browser = {};
- (function () {
- jQuery.browser.msie = false;
- jQuery.browser.version = 0;
- if (navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
- jQuery.browser.msie = true;
- jQuery.browser.version = RegExp.$1;
- }
- })();
- </script>
- @Scripts.Render("~/bundles/jqueryui")
- @Scripts.Render("~/bundles/jqueryext")
- <script>
- if (!window.AppLabels) {
- window.AppLabels = {};
- }
- var dataTablesLangJson_lv = {
- "infoEmpty": "Nav ierakstu",
- "emptyTable": "Nav datu tabulā",
- "zeroRecords": "Nav ierakstu, kas atbilst meklēšanas kritērijam",
- "info": "_START_ līdz _END_ no _TOTAL_ ierakstiem",
- "infoEmpty": "0 līdz 0 no 0 ierakstiem",
- "search": "Meklēt:",
- "paginate": {
- "first": "Pirmais",
- "last": "Pēdējais",
- "next": "Nākamais",
- "previous": "Iepriekšējais"
- },
- "lengthMenu": "Rādīt _MENU_ ierakstus"
- };
- jQuery(function ($) {
- $.datepicker.regional['lv'] = {
- closeText: 'Aizvērt',
- prevText: 'Iepr.',
- nextText: 'Nāk.',
- currentText: 'šodien',
- monthNames: ['Janvāris', 'Februāris', 'Marts', 'Aprīlis', 'Maijs', 'Jūnijs',
- 'Jūlijs', 'Augusts', 'Septembris', 'Oktobris', 'Novembris', 'Decembris'],
- monthNamesShort: ['Jan', 'Feb.', 'Mar', 'Apr', 'Mai', 'Jūn',
- 'Jūl.', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'],
- dayNames: ['Svētdiena', 'Pirmdiena', 'Otrdiena', 'Trešdiena', 'Ceturtdiena', 'Piektdiena', 'Sestdiena'],
- dayNamesShort: ['Svētd.', 'Pirmd.', 'Otrd.', 'Trešd.', 'Ceturtd.', 'Piektd.', 'Sestd.'],
- dayNamesMin: ['Sv', 'P', 'O', 'T', 'C', 'Pk', 'S'],
- weekHeader: 'Ned.',
- dateFormat: 'dd.mm.yy',
- firstDay: 1,
- isRTL: false,
- showMonthAfterYear: false,
- yearSuffix: ''
- };
- $.datepicker.setDefaults($.datepicker.regional['lv']);
- });
- </script>
- @Scripts.Render("~/bundles/scheduler")
- </head>
- <body class="body">
- <div class="header">
- <div class="header-login">
- <p>Sveiki, <span class="bold">@User.Identity.Name</span>!</p>
- </div>
- <div class="header-title">
- <h1>DLP > Darba vietu un laika plānošana</h1>
- </div>
- </div>
- <div class="container body-content">
- @RenderBody()
- </div>
- @RenderSection("scripts", required: false)
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement