|
|
|
@ -138,12 +138,25 @@ function satuanLabel(task){
|
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// use the default editor custom for end_date, but override set_value/get_value methods
|
|
|
|
|
var dateEditor = gantt.config.editor_types.date; |
|
|
|
|
gantt.config.editor_types.end_date = gantt.mixin({ |
|
|
|
|
set_value: function(value, id, column, node){ |
|
|
|
|
var correctedValue = gantt.date.add(value, -1, "day"); |
|
|
|
|
return dateEditor.set_value.apply(this, [correctedValue, id, column, node]); |
|
|
|
|
}, |
|
|
|
|
get_value: function(id, column, node) { |
|
|
|
|
var selectedValue = dateEditor.get_value.apply(this, [id, column, node]); |
|
|
|
|
return gantt.date.add(selectedValue, 1, "day"); |
|
|
|
|
}, |
|
|
|
|
}, dateEditor); |
|
|
|
|
|
|
|
|
|
const editor = { |
|
|
|
|
text: { type: "text", map_to: "text" }, |
|
|
|
|
kode_sortname: { type: "text", map_to: "kode_sortname" }, |
|
|
|
|
start_date: { type: "date", map_to: "start_date", min: new Date(2018, 0, 1) }, |
|
|
|
|
end_date: { type: "date", map_to: "end_date", min: new Date(2018, 0, 1) }, |
|
|
|
|
duration: { type: "duration", map_to: "duration", min: 1, 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 }, |
|
|
|
|
costActual: { type: "number", map_to: "biaya_actual", min: 0 }, |
|
|
|
|
status: { type: "text", map_to: "status" }, |
|
|
|
@ -241,16 +254,15 @@ var allColumns = [
|
|
|
|
|
{ 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: "start_date", label: "Start Date", align: "center", min_width: 80, editor: editor.start_date, resize: true }, |
|
|
|
|
// { name: "end_date", label: "Finish Date", align: "center", min_width: 80, editor: editor.end_date, resize: true, template: function(task){
|
|
|
|
|
// var gridDateToStr = gantt.date.date_to_str("%Y-%m-%d");
|
|
|
|
|
// if (task.type == gantt.config.types.milestone) {
|
|
|
|
|
// return ''
|
|
|
|
|
// }
|
|
|
|
|
// else {
|
|
|
|
|
// return gridDateToStr(new Date(task.end_date.valueOf() - 1));
|
|
|
|
|
// }
|
|
|
|
|
// }},
|
|
|
|
|
{ name: "end_date", label: "Finish Date", 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, template: function(task){ |
|
|
|
|
var gridDateToStr = gantt.date.date_to_str("%Y-%m-%d"); |
|
|
|
|
if (task.type == gantt.config.types.milestone) { |
|
|
|
|
return '' |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
return gridDateToStr(new Date(task.end_date.valueOf() - 1)); |
|
|
|
|
} |
|
|
|
|
}}, |
|
|
|
|
{ name: "duration", label: "Duration", align: "center", min_width: 50, resize: true }, |
|
|
|
|
{ name: "rencana_biaya", label: "Cost Planning", align: "center", min_width: 100, resize: true, template: function (text) { |
|
|
|
|
if(!text.rencana_biaya){ |
|
|
|
@ -449,9 +461,9 @@ 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));
|
|
|
|
|
// };
|
|
|
|
|
gantt.templates.task_end_date = function(date){ |
|
|
|
|
return gantt.templates.task_date(new Date(date.valueOf() - 1)); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
gantt.templates.rightside_text = function (start, end, task) { |
|
|
|
|
if (task.planned_end) { |
|
|
|
|