diff --git a/edit-mode/function/function.js b/edit-mode/function/function.js index f55df91..da0abd9 100644 --- a/edit-mode/function/function.js +++ b/edit-mode/function/function.js @@ -718,6 +718,7 @@ function batchUpdate(){ $("body").removeClass("loading"); localStorage.setItem('batchEntity', ''); $("#save-activity").hide(); + $("#save-separator").hide(); sendStorage(); refresData(); }).catch(function (error) { @@ -731,6 +732,27 @@ function batchUpdate(){ }); } +function updateSchedule() { + $("body").addClass("loading"); + return gantt.ajax.get({ + headers: { + "Content-Type": "application/json", + "Authorization": `Bearer ${token}` + }, + url: base_url + "activity/update-schedule/" + ganttId + }).then(function (response) { + $("body").removeClass("loading"); + refresData(); + }).catch(function (error) { + $("body").removeClass("loading") + gantt.alert({ + title: "Peringatan", + type: "alert-error", + text: "Update activity gagal" + }); + }); +} + $(window).on('beforeunload', function(event) { let batchEntity = localStorage.getItem('batchEntity'); sendStorage(); diff --git a/edit-mode/function/ganttConfig.js b/edit-mode/function/ganttConfig.js index 00d6155..6263a9a 100644 --- a/edit-mode/function/ganttConfig.js +++ b/edit-mode/function/ganttConfig.js @@ -661,7 +661,7 @@ gantt.templates.rightside_text = function (start, end, task) { end_date: end, task: task }, 'day'); - var text = "Overdue: " + overdue + " days"; + var text = "Overdue: " + overdue + " days"; return text; } } diff --git a/edit-mode/function/ganttSettings.js b/edit-mode/function/ganttSettings.js index a6276fe..e941046 100644 --- a/edit-mode/function/ganttSettings.js +++ b/edit-mode/function/ganttSettings.js @@ -143,6 +143,14 @@ $(document).ready(function () { setSynchronize(); }); + $("#compare-data").on('click', function (event) { + compareData(ganttTask); + }); + + $("#update-schedule").on('click', function (event) { + updateSchedule(); + }); + initHolidays(); initGanttSettings(); }); diff --git a/edit-mode/function/humanResource.js b/edit-mode/function/humanResource.js index 9a8708a..85058ac 100644 --- a/edit-mode/function/humanResource.js +++ b/edit-mode/function/humanResource.js @@ -7,6 +7,8 @@ function resetFormAssign() { $('#select-hr').val(null).trigger("change"); $('#select-hr').find('option').remove(); $('#select-hr').val(""); + $("#hr-start-date").val(""); + $("#hr-end-date").val(""); $("#hr_role").val(""); // $("#hide-form-hr").hide(); // $("#show-form-hr").show(); @@ -29,6 +31,8 @@ $(document).ready(function () { "columns": [ { data: 'user_name', name: 'user_name' }, { data: 'role_name', name: 'role_name' }, + { data: 'start_date', name: 'start_date' }, + { data: 'end_date', name: 'end_date' }, { data: 'action', name: 'action', @@ -158,6 +162,8 @@ $(document).ready(function () { // var formData = new FormData(this); let users = $("#select-hr").val(); + let start_date = $("#hr-start-date").val(); + let end_date = $("#hr-end-date").val(); let user_id = []; let user_role = []; users.map((item)=>{ @@ -175,6 +181,8 @@ $(document).ready(function () { let payload = { user_id: user_id, + start_date: start_date, + end_date: end_date, role_proyek_id: user_role, version_gantt_id: ganttId, proyek_id: proyekId, diff --git a/edit-mode/function/restActivityLink.js b/edit-mode/function/restActivityLink.js index cc5ea22..011b6b6 100644 --- a/edit-mode/function/restActivityLink.js +++ b/edit-mode/function/restActivityLink.js @@ -1,6 +1,7 @@ let geom = []; let latest; let earliest; +let ganttTask; $("body").addClass("loading"); gantt.ajax.get({ url: `${base_url}activity/${ganttId}/${proyekId}/get`, @@ -13,8 +14,10 @@ gantt.ajax.get({ let batchEntity = localStorage.getItem('batchEntity'); if (!batchEntity || batchEntity == '') { $("#save-activity").hide(); + $("#save-separator").hide(); } else { $("#save-activity").show(); + $("#save-separator").show(); } let data = {}; let response = xhr.responseText; @@ -39,8 +42,8 @@ gantt.ajax.get({ }); gantt.silent(function () { // updateLinksLag(data); + ganttTask = data; gantt.parse(data); - compareData(data); getGanttOpen(); gantt.parse(data); earliest = getEarliestTaskDate(); @@ -75,8 +78,10 @@ function refresData(id) { let batchEntity = localStorage.getItem('batchEntity'); if (!batchEntity || batchEntity == '') { $("#save-activity").hide(); + $("#save-separator").hide(); } else { $("#save-activity").show(); + $("#save-separator").show(); } gantt.clearAll(); let data = {}; @@ -93,8 +98,8 @@ function refresData(id) { }); gantt.silent(function () { // updateLinksLag(data); + ganttTask = data; gantt.parse(data); - compareData(data); getGanttOpen(); gantt.parse(data); earliest = getEarliestTaskDate(); @@ -176,6 +181,11 @@ var dp = gantt.createDataProcessor(function (entity, action, data, id) { // data['start_date'] = startDate.format("YYYY-MM-DD")+" 00:00:00+07"; let endDate = moment(data.end_date, "YYYY-MM-DD"); + let configStart = moment(gantt.config.start_date); + let configEnd = moment(gantt.config.end_date); + if (startDate >= configEnd || startDate <= configStart || endDate >= configEnd || endDate <= configStart) { + // location.reload(); + } if (startDate > endDate) { gantt.alert({ title: "Peringatan", @@ -215,6 +225,7 @@ var dp = gantt.createDataProcessor(function (entity, action, data, id) { } localStorage.setItem('batchEntity', JSON.stringify(toBeSet)); $("#save-activity").show(); + $("#save-separator").show(); sendStorage(); // $("body").addClass("loading"); // return gantt.ajax.put({ diff --git a/edit-mode/index.html b/edit-mode/index.html index 096e879..fc78a60 100644 --- a/edit-mode/index.html +++ b/edit-mode/index.html @@ -89,16 +89,22 @@ | - | + | | + + | | | + + | | @@ -136,6 +142,14 @@ +
+ + +
+
+ + +
@@ -156,6 +170,8 @@ User Role + Start Date + End Date Actions