From 852a1cf90094bb7aee7f0ad3c6dc658dcc98156b Mon Sep 17 00:00:00 2001 From: wahyu Date: Wed, 30 Aug 2023 14:36:58 +0700 Subject: [PATCH 1/2] update reset form --- edit-mode/function/expenseResource.js | 1 + edit-mode/function/materialResource.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/edit-mode/function/expenseResource.js b/edit-mode/function/expenseResource.js index 2ab9f3f..b2ece13 100644 --- a/edit-mode/function/expenseResource.js +++ b/edit-mode/function/expenseResource.js @@ -4,6 +4,7 @@ function resetFormAssignexpense() { $('#select-expense').val(null).trigger("change"); $('#select-expense').find('option').remove(); $('#select-expense').val(""); + $('#uom-req-expense').val(null).trigger('change'); $('#form-assign-expense').trigger("reset"); $('#btn-assign-expense').html('Assign'); $('#btn-assign-expense').prop("disabled", false); diff --git a/edit-mode/function/materialResource.js b/edit-mode/function/materialResource.js index 9efa127..9635d96 100644 --- a/edit-mode/function/materialResource.js +++ b/edit-mode/function/materialResource.js @@ -4,6 +4,8 @@ function resetFormAssignMaterial() { $('#select-material').val(null).trigger("change"); $('#select-material').find('option').remove(); $('#select-material').val(""); + $('#uom-req-material').val(null).trigger('change'); + $('#select-material-integration').val(null).trigger('change'); $('#form-assign-material').trigger("reset"); $('#btn-assign-material').html('Assign'); $('#btn-assign-material').prop("disabled", false); From b9b28bb1f8c3d46345063aa99c27b27c89e836de Mon Sep 17 00:00:00 2001 From: wahyu Date: Wed, 20 Sep 2023 16:51:47 +0700 Subject: [PATCH 2/2] compare rendered data with response --- edit-mode/function/function.js | 26 ++++++++++++++++++++++++++ edit-mode/function/ganttSettings.js | 6 +++++- edit-mode/function/restActivityLink.js | 2 ++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/edit-mode/function/function.js b/edit-mode/function/function.js index 7f07fef..15d5fcd 100644 --- a/edit-mode/function/function.js +++ b/edit-mode/function/function.js @@ -367,6 +367,32 @@ function setGanttOpen() { localStorage.setItem('ganttOpen', JSON.stringify(ganttOpen)); } +function compareData(data){ + expandTask(); + var allTasks = []; + var taskCount = gantt.getTaskCount(); + + for (var i = 0; i < taskCount; i++) { + var task = gantt.getTaskByIndex(i); + allTasks.push(task); + } + allTasks.forEach((task, index) => { + if (task.start_date != data.data[index].start_date) { + gantt.getTask(task.id).start_date = task.start_date; + } + if (task.end_date != data.data[index].end_date) { + gantt.getTask(task.id).end_date = task.end_date; + } + if (task.planned_start != data.data[index].planned_start) { + gantt.getTask(task.id).planned_start = task.planned_start; + } + if (task.planned_end != data.data[index].planned_end) { + gantt.getTask(task.id).planned_end = task.planned_end; + } + gantt.updateTask(task.id); + }); +} + function getGanttOpen() { let ganttOpen = localStorage.getItem('ganttOpen'); if (ganttOpen) { diff --git a/edit-mode/function/ganttSettings.js b/edit-mode/function/ganttSettings.js index 77db70c..a6276fe 100644 --- a/edit-mode/function/ganttSettings.js +++ b/edit-mode/function/ganttSettings.js @@ -350,7 +350,7 @@ function setBaseline() { }); } -async function setBaselineAPI() { +async function importUpdate() { expandTask(); var allTasks = []; var taskCount = gantt.getTaskCount(); @@ -381,6 +381,10 @@ async function setBaselineAPI() { text: "Update import gagal" }); }); +} + +async function setBaselineAPI() { + await importUpdate(); const res = await axiosInstance .get(ACTIVITY_SET_BASELINE_URL, HEADER) .then(res => res) diff --git a/edit-mode/function/restActivityLink.js b/edit-mode/function/restActivityLink.js index f484941..cc5ea22 100644 --- a/edit-mode/function/restActivityLink.js +++ b/edit-mode/function/restActivityLink.js @@ -40,6 +40,7 @@ gantt.ajax.get({ gantt.silent(function () { // updateLinksLag(data); gantt.parse(data); + compareData(data); getGanttOpen(); gantt.parse(data); earliest = getEarliestTaskDate(); @@ -93,6 +94,7 @@ function refresData(id) { gantt.silent(function () { // updateLinksLag(data); gantt.parse(data); + compareData(data); getGanttOpen(); gantt.parse(data); earliest = getEarliestTaskDate();