From fc4413128d5872442095f40433e28530fad6ccca Mon Sep 17 00:00:00 2001 From: wahyu Date: Tue, 10 Oct 2023 11:09:31 +0700 Subject: [PATCH 1/2] forcing report date --- edit-mode/function/reportActivity.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/edit-mode/function/reportActivity.js b/edit-mode/function/reportActivity.js index 89d9b98..1d64488 100644 --- a/edit-mode/function/reportActivity.js +++ b/edit-mode/function/reportActivity.js @@ -430,8 +430,11 @@ $(document).ready(function () { } } - async function submitRaMaterial(formData, id) { + async function submitRaMaterial(formData, force) { try { + if (force) { + formData.append("force", force); + } const qty_actual = $("#volume_pekerjaan_material").val(); formData.set('qty', qty_actual); const result = await axiosInstance @@ -460,9 +463,22 @@ $(document).ready(function () { throw new Error("Image upload failed."); } } catch (error) { - resetFormAddRaMaterial(); $("body").removeClass("loading"); - gantt.alert("Add report activity material failed."); + if (error.response.status == 400) { + gantt.confirm({ + text: error.response.data.message, + ok: "Add", + cancel: "Cancel", + callback: function (result) { + if (result) { + submitRaMaterial(formData, true); + } + } + }); + } else { + resetFormAddRaMaterial(); + gantt.alert("Add report activity material failed."); + } } } From f93b570c03554918f3f5eca5eb4c780540eb41e8 Mon Sep 17 00:00:00 2001 From: wahyu Date: Tue, 10 Oct 2023 13:13:02 +0700 Subject: [PATCH 2/2] fix compare data --- edit-mode/function/function.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/edit-mode/function/function.js b/edit-mode/function/function.js index da0abd9..bc3426d 100644 --- a/edit-mode/function/function.js +++ b/edit-mode/function/function.js @@ -378,7 +378,8 @@ function compareData(data){ } allTasks.forEach((task, index) => { if (task.progress > 0 && task.progress < 1) { - task.end_date = moment().format('YYYY-MM-DD HH:mm:ss'); + // task.end_date = moment().format('YYYY-MM-DD HH:mm:ss'); + // task.end_date = new Date(); } if (task.start_date != data.data[index].start_date) { gantt.getTask(task.id).start_date = task.start_date;