diff --git a/edit-mode/function/function.js b/edit-mode/function/function.js index b7c1425..2e7aa28 100644 --- a/edit-mode/function/function.js +++ b/edit-mode/function/function.js @@ -505,11 +505,7 @@ function linkLagEditor() { } function addShowHideColumn() { - let allColumn = []; - allColumns.forEach(function (column) { - allColumn.push(column.name); - }); - submitShowHideColumn(allColumn); + submitShowHideColumn(columnShows); } function submitShowHideColumn(allColumn) { diff --git a/edit-mode/function/ganttConfig.js b/edit-mode/function/ganttConfig.js index d6333c1..922c9b5 100644 --- a/edit-mode/function/ganttConfig.js +++ b/edit-mode/function/ganttConfig.js @@ -170,7 +170,7 @@ const editor = { start_date: { type: "date", map_to: "start_date", min: new Date(2018, 0, 1) }, end_date: { type: "end_date", map_to: "end_date", min: new Date(2018, 0, 1) }, planned_start: { type: "date", map_to: "planned_start", min: new Date(2018, 0, 1) }, - planned_end: { type: "date", map_to: "planned_end", 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 }, duration: { type: "duration", map_to: "duration", min: 0, max: 365, formatter: formatter }, cost: { type: "number", map_to: "rencana_biaya", min: 0 }, @@ -319,7 +319,7 @@ var allColumns = [ todayDuration = 0; } progress = todayDuration/endDuration * 100 - if (progress > 100) { + if (todayDuration > endDuration) { progress = 100; } return roundToTwo(progress); @@ -332,7 +332,7 @@ var allColumns = [ return roundToTwo(progress); }, resize: true }, - { name: "planned_duration", label: "Planned Duration (Day)", align: "center", min_width: 50, resize: true, editor: editor.duration, template: function (text) { + { name: "planned_duration", label: "Baseline Duration (Day)", align: "center", min_width: 50, resize: true, editor: editor.duration, template: function (text) { let start; text.planned_start ? start = text.planned_start : start = text.start_date; @@ -501,32 +501,33 @@ var allColumns = [ ]; // set default to show (true) , hide (false) -gantt.config.columns = createColumnsConfig({ +let columnShows = { action: true, - kode_sortname: true, + kode_sortname: false, text: true, start_date: true, end_date: true, - planned_start: true, - planned_end: true, - planned_duration: true, + planned_start: false, + planned_end: false, + planned_duration: false, duration: true, rencana_biaya: true, cost_actual: true, assign_hr: true, - material: true, + material: false, tools: true, expenses: true, bobot_planning: true, - baseline_progress: true, + baseline_progress: false, progress: true, progress_actual: true, jumlah_pekerjaan: true, jobs_done: true, - satuan: true, - predecessor: true, - updated_by: true -}) + satuan: false, + predecessor: false, + updated_by: false +} +gantt.config.columns = createColumnsConfig(columnShows); gantt.config.reorder_grid_columns = true; gantt.config.resize_rows = true; @@ -576,14 +577,12 @@ gantt.templates.task_class = function (start, end, task) { } }; -gantt.templates.task_end_date = function (date) { - return gantt.templates.task_date(new Date(date.valueOf() - 1)); -}; - var gridDateToStr = gantt.date.date_to_str("%Y-%m-%d"); gantt.templates.grid_date_format = function (date, column) { if (column === "end_date") { return gridDateToStr(new Date(date.valueOf() - 1)); + } else if (column === "planned_end") { + return gridDateToStr(new Date(date.valueOf() - 1)); } else { return gridDateToStr(date); }