From aa688671e04b7e73b18259aa21bb7c5b653a8237 Mon Sep 17 00:00:00 2001 From: ibnu Date: Sun, 20 Aug 2023 14:34:05 +0700 Subject: [PATCH] update early --- edit-mode/function/ganttConfig.js | 40 +++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/edit-mode/function/ganttConfig.js b/edit-mode/function/ganttConfig.js index 4370aa7..104b12c 100644 --- a/edit-mode/function/ganttConfig.js +++ b/edit-mode/function/ganttConfig.js @@ -177,6 +177,8 @@ const editor = { planned_start: { type: "date", map_to: "planned_start", min: new Date(2018, 0, 1) }, planned_end: { type: "end_date", map_to: "planned_end", min: new Date(2018, 0, 1) }, planned_duration: { type: "duration", map_to: "planned_duration", min: 0, max: 365, formatter: formatter }, + // early_start: { type: "date", map_to: "planned_start", min: new Date(2018, 0, 1) }, + // early_end: { type: "end_date", map_to: "planned_start", min: new Date(2018, 0, 1) }, duration: { type: "duration", map_to: "duration", min: 0, max: 365, formatter: formatter }, cost: { type: "number", map_to: "rencana_biaya", min: 0 }, costActual: { type: "number", map_to: "biaya_actual", min: 0 }, @@ -271,6 +273,7 @@ function createColumnsConfig(selectedColumns) { } var allColumns = [ + { name: "action", label: colHeader, align: "left", min_width: 115, template: colContent, resize: true }, { name: "kode_sortname", label: "Kode / Sortname", align: "center", min_width: 120, editor: editor.kode_sortname, resize: true }, { name: "text", label: "Activity", tree: true, min_width: 150, editor: editor.text, resize: true }, @@ -281,7 +284,19 @@ var allColumns = [ } return text.planned_start; } - }, + }, + // { + // name: "early_start", label: "Early Start", align: "center", min_width: 80, editor: editor.early_start, resize: true, template: function (text) { + // let siblingId = gantt.getPrevSibling(text.id); + // if(siblingId){ + // let tempText = gantt.getTask(siblingId); + // console.log("iddd ", gantt.getTask(siblingId)); + // return moment(tempText.end_date).format('YYYY-MM-DD'); + // } + // return text.planned_start; + // } + // }, + { name: "early_start", label: "Early Start", align: "center", min_width: 80, editor: editor.early_start, resize: true }, { name: "start_date", label: "Actual Start", align: "center", min_width: 80, editor: editor.start_date, resize: true }, { name: "planned_end", label: "Baseline Finish", align: "center", min_width: 80, editor: editor.planned_end, resize: true, template: function (text) { @@ -291,7 +306,24 @@ var allColumns = [ return text.planned_end; } }, - { name: "end_date", label: "Actual Finish", align: "center", min_width: 80, editor: editor.end_date, resize: true }, + // { name: "early_end", label: "Early Finish", align: "center", min_width: 80, editor: editor.early_end, resize: true }, + // { + // name: "early_end", label: "Early Finish", align: "center", min_width: 80, editor: editor.early_end, resize: true, template: function (text) { + // let start; + // let end; + // text.planned_start ? start = text.planned_start : start = text.start_date; + // text.planned_end ? end = text.planned_end : end = text.end_date; + + // let plannedDuration = gantt.calculateDuration({ + // start_date: new Date(start), + // end_date: new Date(end) + // }) + // return moment(text.start_date).add(plannedDuration-1, 'days').format('YYYY-MM-DD'); + // // return text.planned_end; + // } + // }, + { name: "early_end", label: "Early Finish", align: "center", min_width: 80, resize: true }, + { name: "end_date", label: "Actual Finish", align: "center", min_width: 80, resize: true }, { name: "bobot_planning", label: "Bobot (%)", align: "center", editor: editor.bobot_planning, resize: true, min_width: 115, template: function (text) { @@ -517,6 +549,8 @@ let columnShows = { planned_start: false, planned_end: false, planned_duration: false, + early_start: false, + early_end: false, duration: true, rencana_biaya: true, cost_actual: true, @@ -543,6 +577,8 @@ gantt.config.columns = createColumnsConfig({ planned_start: true, planned_end: true, planned_duration: true, + early_start: true, + early_end: true, duration: true, rencana_biaya: true, cost_actual: true,