Browse Source

Fix default column showed

pull/1/head
Wahyu Ramadhan 1 year ago
parent
commit
d56e181043
  1. 6
      edit-mode/function/function.js
  2. 35
      edit-mode/function/ganttConfig.js

6
edit-mode/function/function.js

@ -505,11 +505,7 @@ function linkLagEditor() {
} }
function addShowHideColumn() { function addShowHideColumn() {
let allColumn = []; submitShowHideColumn(columnShows);
allColumns.forEach(function (column) {
allColumn.push(column.name);
});
submitShowHideColumn(allColumn);
} }
function submitShowHideColumn(allColumn) { function submitShowHideColumn(allColumn) {

35
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) }, 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) }, 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_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 }, 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 }, duration: { type: "duration", map_to: "duration", min: 0, max: 365, formatter: formatter },
cost: { type: "number", map_to: "rencana_biaya", min: 0 }, cost: { type: "number", map_to: "rencana_biaya", min: 0 },
@ -319,7 +319,7 @@ var allColumns = [
todayDuration = 0; todayDuration = 0;
} }
progress = todayDuration/endDuration * 100 progress = todayDuration/endDuration * 100
if (progress > 100) { if (todayDuration > endDuration) {
progress = 100; progress = 100;
} }
return roundToTwo(progress); return roundToTwo(progress);
@ -332,7 +332,7 @@ var allColumns = [
return roundToTwo(progress); return roundToTwo(progress);
}, resize: true }, 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; let start;
text.planned_start ? start = text.planned_start : start = text.start_date; text.planned_start ? start = text.planned_start : start = text.start_date;
@ -501,32 +501,33 @@ var allColumns = [
]; ];
// set default to show (true) , hide (false) // set default to show (true) , hide (false)
gantt.config.columns = createColumnsConfig({ let columnShows = {
action: true, action: true,
kode_sortname: true, kode_sortname: false,
text: true, text: true,
start_date: true, start_date: true,
end_date: true, end_date: true,
planned_start: true, planned_start: false,
planned_end: true, planned_end: false,
planned_duration: true, planned_duration: false,
duration: true, duration: true,
rencana_biaya: true, rencana_biaya: true,
cost_actual: true, cost_actual: true,
assign_hr: true, assign_hr: true,
material: true, material: false,
tools: true, tools: true,
expenses: true, expenses: true,
bobot_planning: true, bobot_planning: true,
baseline_progress: true, baseline_progress: false,
progress: true, progress: true,
progress_actual: true, progress_actual: true,
jumlah_pekerjaan: true, jumlah_pekerjaan: true,
jobs_done: true, jobs_done: true,
satuan: true, satuan: false,
predecessor: true, predecessor: false,
updated_by: true updated_by: false
}) }
gantt.config.columns = createColumnsConfig(columnShows);
gantt.config.reorder_grid_columns = true; gantt.config.reorder_grid_columns = true;
gantt.config.resize_rows = 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"); var gridDateToStr = gantt.date.date_to_str("%Y-%m-%d");
gantt.templates.grid_date_format = function (date, column) { gantt.templates.grid_date_format = function (date, column) {
if (column === "end_date") { if (column === "end_date") {
return gridDateToStr(new Date(date.valueOf() - 1)); return gridDateToStr(new Date(date.valueOf() - 1));
} else if (column === "planned_end") {
return gridDateToStr(new Date(date.valueOf() - 1));
} else { } else {
return gridDateToStr(date); return gridDateToStr(date);
} }

Loading…
Cancel
Save