Browse Source

fix header

pull/1/head
Muhammad Sulaiman Yusuf 2 years ago
parent
commit
bf5ae7b208
  1. 17
      edit-mode/function/ganttConfig.js
  2. 8
      edit-mode/function/ganttEvent.js

17
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: "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: "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 },
// { 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: "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) { { name: "rencana_biaya", label: "Cost Planning", align: "center", min_width: 100, resize: true, template: function (text) {
if(!text.rencana_biaya){ if(!text.rencana_biaya){
@ -280,7 +271,7 @@ var allColumns = [
return "Rp. "+ formatRupiah(biaya_actual) return "Rp. "+ formatRupiah(biaya_actual)
} }, } },
{ name: "assign_hr", label: "Assign To", align: "center", min_width: 150, resize: true, template: function (text) { { 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; return;
} }
let html = ``; let html = ``;
@ -302,7 +293,7 @@ var allColumns = [
} }
}, },
{ name: "material", label: "Material", align: "center", min_width: 150, resize: true, template: function (text) { { 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; return;
} }
let html = ``; let html = ``;
@ -320,7 +311,7 @@ var allColumns = [
</div>` </div>`
} }, } },
{ name: "tools", label: "Tools", align: "center", min_width: 150, resize: true, template: function (text) { { 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; return;
} }
let html = ``; let html = ``;
@ -359,7 +350,7 @@ var allColumns = [
}, resize: true }, }, resize: true },
{ name: "jumlah_pekerjaan", label: "Volume Plan", align: "center", min_width: 100, resize: true, editor:editor.job_count }, { 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) { { 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; return;
} }
let html = text.jobs_done ? text.jobs_done : 0; let html = text.jobs_done ? text.jobs_done : 0;

8
edit-mode/function/ganttEvent.js

@ -5,8 +5,10 @@ gantt.attachEvent("onTaskDblClick", function(id,e){
gantt.attachEvent("onAfterTaskAdd", function(id,item){ gantt.attachEvent("onAfterTaskAdd", function(id,item){
if(item.parent && gantt.hasChild()) { if(item.parent && gantt.hasChild()) {
let parentId = item.parent; let parentId = item.parent;
gantt.getTask(parentId).type = "project"; if(gantt.getTask(parentId).parent_id != null){
gantt.updateTask(parentId); 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){ gantt.ext.inlineEditors.attachEvent("onBeforeEditStart", function(state){
let id = parseInt(state.id) let id = parseInt(state.id)
let ganttData = gantt.getTask(id); let ganttData = gantt.getTask(id);
if(ganttData.type_activity && ganttData.type_activity=="header"){ if(ganttData?.type_activity=="header"){
return false return false
} }
let column = state.columnName let column = state.columnName

Loading…
Cancel
Save