diff --git a/edit-mode/function/ganttEvent.js b/edit-mode/function/ganttEvent.js index b37debd..d334658 100644 --- a/edit-mode/function/ganttEvent.js +++ b/edit-mode/function/ganttEvent.js @@ -53,6 +53,13 @@ gantt.attachEvent("onBeforeTaskUpdate", function(id,new_item){ } progress = progress/100; new_item['progress'] = progress; + new_item['start_date'].setHours(0,0,0); + new_item['end_date'].setHours(23,59,59); + let newDuration = gantt.calculateDuration({ + start_date: new_item['start_date'], + end_date: new_item['end_date'] + }) + new_item['duration'] = newDuration; }); gantt.attachEvent("onAfterTaskDrag", function(id, mode, e){ diff --git a/edit-mode/function/restActivityLink.js b/edit-mode/function/restActivityLink.js index 25d60cb..087f8e1 100644 --- a/edit-mode/function/restActivityLink.js +++ b/edit-mode/function/restActivityLink.js @@ -63,13 +63,17 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) { data['start_date'] = `${data.start_date}+07`; let endDate = moment(data.end_date, "YYYY-MM-DD"); data['end_date'] = endDate.format("YYYY-MM-DD")+" 23:59:59+07"; + let newDuration = gantt.calculateDuration({ + start_date: new Date(data['start_date']), + end_date: new Date(data['end_date']) + }) + data['duration'] = newDuration; if(data && data.parent){ data['parent_id'] = data.parent; } } data['version_gantt_id'] = ganttId; - data['duration'] += 1; return gantt.ajax.post({ headers: { "Content-Type": "application/json", @@ -94,6 +98,11 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) { // data['start_date'] = startDate.format("YYYY-MM-DD")+" 00:00:00+07"; let endDate = moment(data.end_date, "YYYY-MM-DD"); data['end_date'] = endDate.format("YYYY-MM-DD")+" 23:59:59+07"; + let newDuration = gantt.calculateDuration({ + start_date: new Date(data['start_date']), + end_date: new Date(data['end_date']) + }) + data['duration'] = newDuration; if(startDate > endDate){ gantt.alert({ diff --git a/view-mode/function/overlaySCurve.js b/view-mode/function/overlaySCurve.js index c7cc3dc..513d3ee 100644 --- a/view-mode/function/overlaySCurve.js +++ b/view-mode/function/overlaySCurve.js @@ -196,22 +196,6 @@ var lineOverlay = overlayControl.addOverlay(function(container) { } } }, - { - display: true, - position: "right", - gridLines: { - display:false - }, - ticks: { - display: true, - min: 0, - max: 100, - stepSize: 10, - callback: function(current) { - if (current > 100) {return "";} - return current + "%"; - } - }} ] } } diff --git a/view-mode/index.html b/view-mode/index.html index 0a09ee4..8600e81 100644 --- a/view-mode/index.html +++ b/view-mode/index.html @@ -69,6 +69,19 @@
+
Zoom:
+
+ + +
+
+ + +
+
+ + +
|