Browse Source

Fix column

pull/1/head
Wahyu Ramadhan 1 year ago
parent
commit
2b33ee9068
  1. 70
      edit-mode/function/ganttConfig.js

70
edit-mode/function/ganttConfig.js

@ -124,6 +124,7 @@ var formatter = gantt.ext.formatters.durationFormatter({
}); });
var progressEditor = { type: "progressCustom", map_to: "progress", min: 0, max: 100 }; var progressEditor = { type: "progressCustom", map_to: "progress", min: 0, max: 100 };
var baselineProgressEditor = { type: "baselineProgressCustom", map_to: "baseline_progress", min: 0, max: 100 };
var costPlanningEditor = { type: "costPlanningEditor", map_to: "rencana_biaya", min: 0 }; var costPlanningEditor = { type: "costPlanningEditor", map_to: "rencana_biaya", min: 0 };
var linksFormatter = gantt.ext.formatters.linkFormatter({ durationFormatter: formatter }); var linksFormatter = gantt.ext.formatters.linkFormatter({ durationFormatter: formatter });
@ -268,23 +269,62 @@ var allColumns = [
{ name: "kode_sortname", label: "Kode / Sortname", align: "center", min_width: 120, editor: editor.kode_sortname, 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 }, { name: "text", label: "Activity", tree: true, min_width: 150, editor: editor.text, resize: true },
{ {
name: "planned_start", label: "Planned Start", align: "center", min_width: 80, editor: editor.planned_start, resize: true, template: function (text) { name: "planned_start", label: "Baseline Start", align: "center", min_width: 80, editor: editor.planned_start, resize: true, template: function (text) {
if (!text.planned_start) { if (!text.planned_start) {
return text.start_date; return text.start_date;
} }
return text.planned_start; return text.planned_start;
} }
}, },
{ name: "start_date", label: "Actual Start", align: "center", min_width: 80, editor: editor.start_date, resize: true },
{ {
name: "planned_end", label: "Planned Finish", align: "center", min_width: 80, editor: editor.planned_end, resize: true, template: function (text) { name: "planned_end", label: "Baseline Finish", align: "center", min_width: 80, editor: editor.planned_end, resize: true, template: function (text) {
if (!text.planned_end) { if (!text.planned_end) {
return text.end_date; return text.end_date;
} }
return text.planned_end; return text.planned_end;
} }
}, },
{ name: "start_date", label: "Start Date", align: "center", min_width: 80, editor: editor.start_date, resize: true }, { name: "end_date", label: "Actual Finish", align: "center", min_width: 80, editor: editor.end_date, resize: true },
{ name: "end_date", label: "Finish Date", align: "center", min_width: 80, editor: editor.end_date, resize: true },
{
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);
if (bobot.toFixed(2) > 100) {
gantt.alert("Bobot tidak boleh lebih dari 100%!");
return;
}
if (!text.bobot_planning) {
return
}
let bobot_planning = parseFloat(text.bobot_planning);
return roundToTwo(bobot_planning);
}
},
{
name: "baseline_progress", label: "Baseline Progress (%)", align: "center", editor: baselineProgressEditor, min_width: 125, template: function (text) {
let today = new Date();
let start = new Date(text.planned_start) || new Date(text.start_date);
let end = new Date(text.planned_end) || new Date(text.end_date);
let todayDuration = gantt.calculateDuration({
start_date: start,
end_date: today
})
let endDuration = gantt.calculateDuration({
start_date: start,
end_date: end
})
progress = todayDuration/endDuration * 100
return roundToTwo(progress);
}, resize: true
},
{
name: "progress", label: "Actual Progress (%)", align: "center", editor: progressEditor, min_width: 125, template: function (text) {
let progress = text.progress
progress = progress * 100
return roundToTwo(progress);
}, resize: true
},
{ name: "duration", label: "Duration (Day)", align: "center", min_width: 50, resize: true, editor: editor.duration }, { name: "duration", label: "Duration (Day)", align: "center", min_width: 50, resize: true, editor: editor.duration },
{ {
name: "rencana_biaya", label: "Cost Planning", align: "right", min_width: 100, resize: true, template: function (text) { name: "rencana_biaya", label: "Cost Planning", align: "right", min_width: 100, resize: true, template: function (text) {
@ -388,27 +428,6 @@ var allColumns = [
} }
}, },
// { name: "status", label: "Status", align: "center", editor: editor.status, resize: true }, // { name: "status", label: "Status", align: "center", editor: editor.status, resize: true },
{
name: "bobot_planning", label: "Bobot Activity (%)", align: "center", editor: editor.bobot_planning, resize: true, min_width: 115, template: function (text) {
let bobot = parseFloat(text.bobot_planning);
if (bobot.toFixed(2) > 100) {
gantt.alert("Bobot tidak boleh lebih dari 100%!");
return;
}
if (!text.bobot_planning) {
return
}
let bobot_planning = parseFloat(text.bobot_planning);
return roundToTwo(bobot_planning);
}
},
{
name: "progress", label: "Actual Progress (%)", align: "center", editor: progressEditor, min_width: 125, template: function (text) {
let progress = text.progress
progress = progress * 100
return roundToTwo(progress);
}, resize: true
},
{ {
name: "progress_actual", label: "Total Actual Progress (%)", align: "center", min_width: 150, template: function (text) { name: "progress_actual", label: "Total Actual Progress (%)", align: "center", min_width: 150, template: function (text) {
let progress = text.progress let progress = text.progress
@ -481,6 +500,7 @@ gantt.config.columns = createColumnsConfig({
tools: true, tools: true,
expenses: true, expenses: true,
bobot_planning: true, bobot_planning: true,
baseline_progress: true,
progress: true, progress: true,
progress_actual: true, progress_actual: true,
jumlah_pekerjaan: true, jumlah_pekerjaan: true,

Loading…
Cancel
Save