|
|
|
@ -75,14 +75,7 @@ gantt.plugins({
|
|
|
|
|
auto_scheduling: true |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// gantt.templates.parse_date = function (date) {
|
|
|
|
|
// return new Date(2019,01,01);
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// gantt.config.highlight_critical_path = true;
|
|
|
|
|
gantt.config.date_format = "%Y-%m-%d %H:%i:%s"; |
|
|
|
|
// gantt.config.date_format="%d-%m-%Y %H:%i:%s";
|
|
|
|
|
// gantt.config.date_grid="%d-%m-%Y %H:%i:%s";
|
|
|
|
|
gantt.config.auto_scheduling = true; |
|
|
|
|
gantt.config.fit_tasks = true; |
|
|
|
|
if (!base_url) { |
|
|
|
@ -150,7 +143,7 @@ const editor = {
|
|
|
|
|
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: 0, max: 365, formatter: formatter }, |
|
|
|
|
duration: { type: "duration", map_to: "duration", min: 1, 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" }, |
|
|
|
@ -177,7 +170,7 @@ function addWithoutParent() {
|
|
|
|
|
text: `New Activity`, |
|
|
|
|
start_date: start_date, |
|
|
|
|
biaya: 10000, |
|
|
|
|
duration: 7 |
|
|
|
|
duration: 1 |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
gantt.selectTask(taskId); |
|
|
|
@ -198,7 +191,7 @@ function addWithParent(id) {
|
|
|
|
|
id: no, |
|
|
|
|
text: `New Activity`, |
|
|
|
|
start_date: start_date, |
|
|
|
|
duration: 7 |
|
|
|
|
duration: 1 |
|
|
|
|
}, id); |
|
|
|
|
|
|
|
|
|
no = no + 1; |
|
|
|
@ -234,13 +227,8 @@ function clickGridButton(id, action) {
|
|
|
|
|
function createColumnsConfig(selectedColumns){ |
|
|
|
|
var newColumns = []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
allColumns.forEach(function(column){ |
|
|
|
|
// restore the action
|
|
|
|
|
if(selectedColumns[column.name]){ |
|
|
|
|
// if (column.name === 'action') {
|
|
|
|
|
// newColumns.push(column);
|
|
|
|
|
// }
|
|
|
|
|
newColumns.push(column); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -253,8 +241,17 @@ 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: "duration", label: "Duration", align: "center", min_width: 50, editor: editor.duration, resize: true }, |
|
|
|
|
{ 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){ |
|
|
|
|
return |
|
|
|
@ -387,8 +384,6 @@ gantt.config.columns = createColumnsConfig({
|
|
|
|
|
action: true, |
|
|
|
|
kode_sortname: true, |
|
|
|
|
text: true, |
|
|
|
|
// planned_start: true,
|
|
|
|
|
// planned_end: true,
|
|
|
|
|
start_date: true, |
|
|
|
|
end_date: true, |
|
|
|
|
duration: true, |
|
|
|
@ -409,34 +404,16 @@ gantt.config.columns = createColumnsConfig({
|
|
|
|
|
|
|
|
|
|
gantt.config.reorder_grid_columns = true; |
|
|
|
|
gantt.config.resize_rows = true; |
|
|
|
|
gantt.config.grid_resize = true; // pro edition
|
|
|
|
|
gantt.config.grid_resize = true; |
|
|
|
|
gantt.config.min_column_width = 50; |
|
|
|
|
gantt.config.scale_height = 20; |
|
|
|
|
// gantt.config.row_height = 30;
|
|
|
|
|
gantt.config.order_branch = "marker"; |
|
|
|
|
gantt.config.order_branch_free = true; |
|
|
|
|
gantt.config.open_tree_initially = true; |
|
|
|
|
|
|
|
|
|
// adding baseline
|
|
|
|
|
// gantt.config.bar_height = 16;
|
|
|
|
|
// gantt.config.row_height = 40;
|
|
|
|
|
|
|
|
|
|
gantt.config.row_height = 30; |
|
|
|
|
gantt.config.task_height = 20; |
|
|
|
|
|
|
|
|
|
// gantt.locale.labels.baseline_enable_button = 'Set';
|
|
|
|
|
// gantt.locale.labels.baseline_disable_button = 'Remove';
|
|
|
|
|
// gantt.config.lightbox.sections = [
|
|
|
|
|
// {name: "Activity", height: 70, map_to: "text", type: "textarea", focus: true},
|
|
|
|
|
// {name: "time", map_to: "auto", type: "duration"},
|
|
|
|
|
// {
|
|
|
|
|
// name: "baseline",
|
|
|
|
|
// map_to: {start_date: "planned_start", end_date: "planned_end"},
|
|
|
|
|
// button: true,
|
|
|
|
|
// type: "duration_optional"
|
|
|
|
|
// }
|
|
|
|
|
// ];
|
|
|
|
|
// gantt.locale.labels.section_baseline = "Planned";
|
|
|
|
|
// adding baseline display
|
|
|
|
|
gantt.addTaskLayer({ |
|
|
|
|
renderer: { |
|
|
|
@ -445,19 +422,14 @@ gantt.addTaskLayer({
|
|
|
|
|
var sizes = gantt.getTaskPosition(task, task.planned_start, task.planned_end); |
|
|
|
|
var el = document.createElement('div'); |
|
|
|
|
el.className = 'baseline'; |
|
|
|
|
// el.style.left = sizes.left + 'px';
|
|
|
|
|
// el.style.width = sizes.width + 'px';
|
|
|
|
|
// el.style.top = sizes.top + gantt.config.bar_height + 13 + 'px';
|
|
|
|
|
el.style.left = sizes.left - 6 + 'px'; |
|
|
|
|
el.style.width = sizes.width + 10+ 'px'; |
|
|
|
|
el.style.height= sizes.height + 'px'; |
|
|
|
|
// el.style.top = sizes.top + 1 + 'px';
|
|
|
|
|
el.style.top = sizes.top + 2 + 'px'; |
|
|
|
|
return el; |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
}, |
|
|
|
|
// define getRectangle in order to hook layer with the smart rendering
|
|
|
|
|
getRectangle: function(task, view){ |
|
|
|
|
if (task.planned_start && task.planned_end) { |
|
|
|
|
return gantt.getTaskPosition(task, task.planned_start, task.planned_end); |
|
|
|
@ -477,6 +449,10 @@ 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.rightside_text = function (start, end, task) { |
|
|
|
|
if (task.planned_end) { |
|
|
|
|
if (end.getTime() > task.planned_end.getTime()) { |
|
|
|
@ -519,13 +495,10 @@ gantt.config.layout = {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// custom folder, file, collapse icons on activity
|
|
|
|
|
gantt.templates.grid_folder = function (item) { |
|
|
|
|
// return "<div class='gantt_tree_icon gantt_folder_" + (item.$open ? "open" : "closed") + "'></div>";
|
|
|
|
|
return ""; |
|
|
|
|
}; |
|
|
|
|
gantt.templates.grid_file = function (item) { |
|
|
|
|
// return "<div class='gantt_tree_icon gantt_file'></div>";
|
|
|
|
|
return ""; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -636,8 +609,7 @@ for (var i = 0; i < radios.length; i++) {
|
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
// end Zoom Scale function
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
// GANTT PERFORMANCE CONFIG RECOMMENDATION
|
|
|
|
|
gantt.config.scales = [ |
|
|
|
|
{unit: "month", step: 1, format: "%F, %Y"}, |
|
|
|
@ -654,7 +626,7 @@ gantt.config.show_task_cells = false;
|
|
|
|
|
gantt.config.static_background = true; |
|
|
|
|
gantt.config.branch_loading = true; |
|
|
|
|
gantt.config.smart_scales = true; |
|
|
|
|
// gantt.config.smart_rendering = true;
|
|
|
|
|
gantt.config.smart_rendering = true; |
|
|
|
|
|
|
|
|
|
// gantt initialization
|
|
|
|
|
$(document).ready(function () { |
|
|
|
|