From 059f8b912dc98c7ffe820b7d7a03cc7480b1f02b Mon Sep 17 00:00:00 2001 From: wahyu Date: Mon, 16 Oct 2023 08:13:31 +0700 Subject: [PATCH] adjust actual date after deleting report --- edit-mode/function/function.js | 23 ++++++++++++++++------- edit-mode/function/reportActivity.js | 1 + 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/edit-mode/function/function.js b/edit-mode/function/function.js index 717c306..c91369b 100644 --- a/edit-mode/function/function.js +++ b/edit-mode/function/function.js @@ -14,7 +14,7 @@ function getUrlParameter(sParam) { return false; }; - function searchReport(id) { + function searchReport(id, updateActual = true) { var payload = { "columns": [ { @@ -31,12 +31,21 @@ function getUrlParameter(sParam) { url: `${base_url}report-activity-material/search`, type: "POST", success: function (data) { - data.data.forEach(element => { - let activityId = element.activity_id; - let task = gantt.getTask(activityId); - task.actual_start = null; - task.actual_end = null; - }); + if (updateActual) { + data.data.forEach(element => { + let activityId = element.activity_id; + let task = gantt.getTask(activityId); + task.actual_start = null; + task.actual_end = null; + }); + } else { + if (data.data.length == 1) { + let activityId = data.data[0].activity_id; + let task = gantt.getTask(activityId); + task.actual_start = null; + task.actual_end = null; + } + } actionHappen = true; }, error: function (data) { diff --git a/edit-mode/function/reportActivity.js b/edit-mode/function/reportActivity.js index 29cc50b..e9d58aa 100644 --- a/edit-mode/function/reportActivity.js +++ b/edit-mode/function/reportActivity.js @@ -654,6 +654,7 @@ $(document).ready(function () { } function deleteRaMaterial(id) { + searchReport(assignMaterialId, false); $.ajax({ url: `${base_url}report-activity-material/delete/${id}`, type: "DELETE",