From bf5ae7b20899b87e949019cbcc7d8b3fae85b03c Mon Sep 17 00:00:00 2001 From: Muhammad Sulaiman Yusuf Date: Tue, 22 Nov 2022 09:29:36 +0700 Subject: [PATCH] fix header --- edit-mode/function/ganttConfig.js | 17 ++++------------- edit-mode/function/ganttEvent.js | 8 +++++--- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/edit-mode/function/ganttConfig.js b/edit-mode/function/ganttConfig.js index d34a205..05aefda 100644 --- a/edit-mode/function/ganttConfig.js +++ b/edit-mode/function/ganttConfig.js @@ -255,15 +255,6 @@ var allColumns = [ { 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 }, - // { 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){ @@ -280,7 +271,7 @@ var allColumns = [ return "Rp. "+ formatRupiah(biaya_actual) } }, { name: "assign_hr", label: "Assign To", align: "center", min_width: 150, resize: true, template: function (text) { - if(text.type=="project" || text.type=="milestone"){ + if(text.type=="project" || text.type=="milestone" || text.type=="header"){ return; } let html = ``; @@ -302,7 +293,7 @@ var allColumns = [ } }, { name: "material", label: "Material", align: "center", min_width: 150, resize: true, template: function (text) { - if(text.type=="project" || text.type=="milestone"){ + if(text.type=="project" || text.type=="milestone" || text.type=="header"){ return; } let html = ``; @@ -320,7 +311,7 @@ var allColumns = [ ` } }, { name: "tools", label: "Tools", align: "center", min_width: 150, resize: true, template: function (text) { - if(text.type=="project" || text.type=="milestone"){ + if(text.type=="project" || text.type=="milestone" || text.type=="header"){ return; } let html = ``; @@ -359,7 +350,7 @@ var allColumns = [ }, resize: true }, { name: "jumlah_pekerjaan", label: "Volume Plan", align: "center", min_width: 100, resize: true, editor:editor.job_count }, { name: "jobs_done", label: "Volume Actual", align: "center", min_width: 100, resize: true, template: function (text) { - if(text.type=="project" || text.type=="milestone"){ + if(text.type=="project" || text.type=="milestone" || text.type=="header"){ return; } let html = text.jobs_done ? text.jobs_done : 0; diff --git a/edit-mode/function/ganttEvent.js b/edit-mode/function/ganttEvent.js index ec56e18..f81e172 100644 --- a/edit-mode/function/ganttEvent.js +++ b/edit-mode/function/ganttEvent.js @@ -5,8 +5,10 @@ gantt.attachEvent("onTaskDblClick", function(id,e){ gantt.attachEvent("onAfterTaskAdd", function(id,item){ if(item.parent && gantt.hasChild()) { let parentId = item.parent; - gantt.getTask(parentId).type = "project"; - gantt.updateTask(parentId); + if(gantt.getTask(parentId).parent_id != null){ + gantt.getTask(parentId).type = "project"; + gantt.updateTask(parentId); + } } }); @@ -19,7 +21,7 @@ gantt.attachEvent("onTaskRowClick", function(id,row){ gantt.ext.inlineEditors.attachEvent("onBeforeEditStart", function(state){ let id = parseInt(state.id) let ganttData = gantt.getTask(id); - if(ganttData.type_activity && ganttData.type_activity=="header"){ + if(ganttData?.type_activity=="header"){ return false } let column = state.columnName