From e8333090dca92e87132c66526716c31376ba8b0b Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 24 Aug 2023 09:15:55 +0700 Subject: [PATCH 1/5] Fix gantt date format --- edit-mode/function/ganttConfig.js | 35 +++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/edit-mode/function/ganttConfig.js b/edit-mode/function/ganttConfig.js index 250c8e7..00d6155 100644 --- a/edit-mode/function/ganttConfig.js +++ b/edit-mode/function/ganttConfig.js @@ -280,24 +280,41 @@ var allColumns = [ { name: "planned_start", label: "Baseline Start", align: "center", min_width: 80, editor: editor.planned_start, resize: true, template: function (text) { if (!text.planned_start) { - return text.start_date; + return moment(text.start_date).format("DD-MM-YYYY"); } - return text.planned_start; + return moment(text.planned_start).format("DD-MM-YYYY"); } }, { name: "planned_end", label: "Baseline Finish", align: "center", min_width: 80, editor: editor.planned_end, resize: true, template: function (text) { if (!text.planned_end) { - return text.end_date; + return moment(text.end_date).format("DD-MM-YYYY"); } - return text.planned_end; + return moment(text.planned_end).format("DD-MM-YYYY"); } }, - { name: "start_date", label: "Early Start", align: "center", min_width: 80, editor: editor.start_date, resize: true }, - { name: "end_date", label: "Early Finish", align: "center", min_width: 80, editor: editor.end_date, resize: true }, - - { name: "actual_start", label: "Actual Start", align: "center", min_width: 80, resize: true }, - { name: "actual_end", label: "Actual Finish", align: "center", min_width: 80, resize: true }, + { name: "start_date", label: "Early Start", align: "center", min_width: 80, editor: editor.start_date, resize: true, template: function (text) { + return moment(text.start_date).format("DD-MM-YYYY"); + } + }, + { name: "end_date", label: "Early Finish", align: "center", min_width: 80, editor: editor.end_date, resize: true, template: function (text) { + return moment(text.end_date).format("DD-MM-YYYY"); + } + }, + { name: "actual_start", label: "Actual Start", align: "center", min_width: 80, resize: true, template: function (text) { + if (!text.actual_start) { + return ''; + } + return moment(text.actual_start).format("DD-MM-YYYY"); + } + }, + { name: "actual_end", label: "Actual Finish", align: "center", min_width: 80, resize: true, template: function (text) { + if (!text.actual_end) { + return ''; + } + return moment(text.actual_end).format("DD-MM-YYYY"); + } + }, { name: "bobot_planning", label: "Bobot (%)", align: "center", editor: editor.bobot_planning, resize: true, min_width: 115, template: function (text) { let bobot = parseFloat(text.bobot_planning); From 9a016c2509e1e55593100f4a392026b9531c1e30 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 24 Aug 2023 10:41:20 +0700 Subject: [PATCH 2/5] Check link type --- edit-mode/function/function.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/edit-mode/function/function.js b/edit-mode/function/function.js index c84423e..1319ab7 100644 --- a/edit-mode/function/function.js +++ b/edit-mode/function/function.js @@ -717,7 +717,9 @@ function updateLinksLag(data) { let predecessor = data.data.find(item => item.id == link.source); if (predecessor) { let lag = gantt.calculateDuration(new Date(predecessor.end_date), new Date(task.start_date)); - link.lag = lag; + if (link.type == "0") { + link.lag = lag; + } } } }); From 440b6272f1aa19c75069ffeb96f644f9b053348d Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 24 Aug 2023 11:09:58 +0700 Subject: [PATCH 3/5] cek baseline before changing lag --- edit-mode/function/function.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edit-mode/function/function.js b/edit-mode/function/function.js index 1319ab7..7aa1542 100644 --- a/edit-mode/function/function.js +++ b/edit-mode/function/function.js @@ -717,7 +717,7 @@ function updateLinksLag(data) { let predecessor = data.data.find(item => item.id == link.source); if (predecessor) { let lag = gantt.calculateDuration(new Date(predecessor.end_date), new Date(task.start_date)); - if (link.type == "0") { + if (link.type == "0" && isBaselineSet) { link.lag = lag; } } From 41a2f0d9462a8c1d53cc6bbc518522c265336e78 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 24 Aug 2023 12:09:52 +0700 Subject: [PATCH 4/5] fix milestone dateformat --- edit-mode/function/milestone.js | 23 ++++++++++++++++------- edit-mode/index.html | 4 ++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/edit-mode/function/milestone.js b/edit-mode/function/milestone.js index 1d67187..bfd7158 100644 --- a/edit-mode/function/milestone.js +++ b/edit-mode/function/milestone.js @@ -70,7 +70,16 @@ $(document).ready(function () { $("#name_milestone").val(data.text); }); + $('#due_milestone').datepicker({ + format: 'dd-mm-yyyy', // Set the desired format + autoclose: true // Close the datepicker when a date is selected + }); + $('#deadline_milestone').datepicker({ + format: 'dd-mm-yyyy', // Set the desired format + autoclose: true // Close the datepicker when a date is selected + }); + $('#modal-material').on('show.bs.modal', function (event) { }); @@ -88,8 +97,8 @@ $(document).ready(function () { console.log("cek data form", data); let parent = data.milestone_parent; var taskId = 0; - var start = moment(data.due_date, "YYYY-MM-DD"); - var end = moment(data.deadline, "YYYY-MM-DD"); + var start = moment(data.due_date, "DD-MM-YYYY"); + var end = moment(data.deadline, "DD-MM-YYYY"); let duration = moment.duration(start.diff(end)).asDays(); let nameMilestone = data.status!="" ? data.status : data.id_milestone // console.log("cek duration", Math.abs(duration)); @@ -97,8 +106,8 @@ $(document).ready(function () { taskId = gantt.addTask({ id: Math.floor(Math.random() * 1000) + 5000, text: nameMilestone, - start_date: data.due_date, - end_date: data.deadline, + start_date: start.format("YYYY-MM-DD"), + end_date: end.format("YYYY-MM-DD"), duration: Math.abs(duration), type: "milestone", type_activity:"milestone" @@ -107,8 +116,8 @@ $(document).ready(function () { taskId = gantt.addTask({ id: Math.floor(Math.random() * 1000) + 5000, text: nameMilestone, - start_date: data.due_date, - end_date: data.deadline, + start_date: start.format("YYYY-MM-DD"), + end_date: end.format("YYYY-MM-DD"), duration: Math.abs(duration), type: "milestone", type_activity:"milestone" @@ -124,4 +133,4 @@ $(document).ready(function () { gantt.alert("Add Milestone Failed!"); } }); -}); \ No newline at end of file +}); diff --git a/edit-mode/index.html b/edit-mode/index.html index dd17be9..f488395 100644 --- a/edit-mode/index.html +++ b/edit-mode/index.html @@ -602,11 +602,11 @@
- +
- +
From 29158d911527c0768144eb7a13ecfd7fb455735a Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 24 Aug 2023 13:52:31 +0700 Subject: [PATCH 5/5] fix report activity dateformat --- edit-mode/function/reportActivity.js | 7 ++++++- edit-mode/index.html | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/edit-mode/function/reportActivity.js b/edit-mode/function/reportActivity.js index 9a98afb..0800729 100644 --- a/edit-mode/function/reportActivity.js +++ b/edit-mode/function/reportActivity.js @@ -341,10 +341,15 @@ $(document).ready(function () { }); - + $('#ra_date_material').datepicker({ + format: 'dd-mm-yyyy', // Set the desired format + autoclose: true // Close the datepicker when a date is selected + }); $("#form_report_activity_material").on("submit", function (e) { e.preventDefault(); var formData = new FormData(this); + let formattedDate = moment(formData.get("report_date"), "DD-MM-YYYY").format("YYYY-MM-DD"); + formData.set('report_date', formattedDate); formData.append("activity_id", activityId); formData.append("assign_material_id", assignMaterialId); let idRa = $("#id_ra_material").val(); diff --git a/edit-mode/index.html b/edit-mode/index.html index f488395..5e88c06 100644 --- a/edit-mode/index.html +++ b/edit-mode/index.html @@ -723,7 +723,7 @@
-