Browse Source

bugfix comma cost plan

pull/1/head
Muhammad Sulaiman Yusuf 2 years ago
parent
commit
0a89f4c796
  1. 6
      edit-mode/function/ganttConfig.js
  2. 9
      edit-mode/function/ganttEvent.js

6
edit-mode/function/ganttConfig.js

@ -87,11 +87,9 @@ gantt.config.auto_scheduling = true;
gantt.config.fit_tasks = true; gantt.config.fit_tasks = true;
if (!base_url) { if (!base_url) {
base_url = `https://api-iu.ospro.id/api/`; base_url = `https://api-iu.ospro.id/api/`;
// console.log("cek base url 2",base_url)
}else{ }else{
base_url = base_url+"/"; base_url = base_url+"/";
} }
// console.log("cek base url 3",base_url)
// gantt plugins // gantt plugins
gantt.plugins({ gantt.plugins({
marker: true, marker: true,
@ -258,9 +256,6 @@ var allColumns = [
{ 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: "duration", label: "Duration", align: "center", min_width: 50, editor: editor.duration, resize: true }, { name: "duration", label: "Duration", align: "center", min_width: 50, editor: editor.duration, 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.id == 2085 || text.id == 2089){
console.log("text", text);
}
if(!text.rencana_biaya){ if(!text.rencana_biaya){
return return
} }
@ -338,7 +333,6 @@ var allColumns = [
return return
} }
let bobot_planning = parseFloat(text.bobot_planning); let bobot_planning = parseFloat(text.bobot_planning);
// console.log("bobot_planning", bobot_planning);
return roundToTwo(bobot_planning); return roundToTwo(bobot_planning);
} }, } },
{ name: "progress", label: "Actual Progress (%)", align: "center", editor: progressEditor, min_width: 125, template: function (text) { { name: "progress", label: "Actual Progress (%)", align: "center", editor: progressEditor, min_width: 125, template: function (text) {

9
edit-mode/function/ganttEvent.js

@ -23,7 +23,6 @@ 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);
// console.log("cek ganttData", ganttData);
if(ganttData.type_activity && ganttData.type_activity=="header"){ if(ganttData.type_activity && ganttData.type_activity=="header"){
return false return false
} }
@ -36,13 +35,11 @@ gantt.ext.inlineEditors.attachEvent("onBeforeEditStart", function(state){
} }
if(column=="cost_actual"){ if(column=="cost_actual"){
// let ganttData = gantt.getTask(id);
let progress = ganttData.progress ? ganttData.progress : 0 let progress = ganttData.progress ? ganttData.progress : 0
if(progress <= 0){ if(progress <= 0){
return false return false
} }
} }
// console.log("cek state", state);
return true return true
}); });
@ -57,18 +54,12 @@ gantt.attachEvent("onBeforeTaskUpdate", function(id,new_item){
progress = progress*100 progress = progress*100
} }
progress = progress/100; progress = progress/100;
// format cost planning
let costPlanning = new_item.rencana_biaya;
costPlanning = replaceAll(costPlanning, ".", "");
costPlanning = replaceAll(costPlanning, ",", ".");
new_item['rencana_biaya'] = costPlanning;
new_item['progress'] = progress; new_item['progress'] = progress;
}); });
gantt.attachEvent("onBeforeLinkAdd", function(id,link){ gantt.attachEvent("onBeforeLinkAdd", function(id,link){
//any custom logic here //any custom logic here
// console.log("cek link", link);
let source = link.source; let source = link.source;
let target = link.target; let target = link.target;
let parents = gantt.getParent(source); let parents = gantt.getParent(source);

Loading…
Cancel
Save