Browse Source

Fix duration

pull/1/head
Wahyu Ramadhan 1 year ago
parent
commit
160de4b0aa
  1. 7
      edit-mode/function/ganttEvent.js
  2. 11
      edit-mode/function/restActivityLink.js
  3. 16
      view-mode/function/overlaySCurve.js
  4. 13
      view-mode/index.html

7
edit-mode/function/ganttEvent.js

@ -53,6 +53,13 @@ gantt.attachEvent("onBeforeTaskUpdate", function(id,new_item){
} }
progress = progress/100; progress = progress/100;
new_item['progress'] = progress; 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){ gantt.attachEvent("onAfterTaskDrag", function(id, mode, e){

11
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`; data['start_date'] = `${data.start_date}+07`;
let endDate = moment(data.end_date, "YYYY-MM-DD"); let endDate = moment(data.end_date, "YYYY-MM-DD");
data['end_date'] = endDate.format("YYYY-MM-DD")+" 23:59:59+07"; 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){ if(data && data.parent){
data['parent_id'] = data.parent; data['parent_id'] = data.parent;
} }
} }
data['version_gantt_id'] = ganttId; data['version_gantt_id'] = ganttId;
data['duration'] += 1;
return gantt.ajax.post({ return gantt.ajax.post({
headers: { headers: {
"Content-Type": "application/json", "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"; // data['start_date'] = startDate.format("YYYY-MM-DD")+" 00:00:00+07";
let endDate = moment(data.end_date, "YYYY-MM-DD"); let endDate = moment(data.end_date, "YYYY-MM-DD");
data['end_date'] = endDate.format("YYYY-MM-DD")+" 23:59:59+07"; 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){ if(startDate > endDate){
gantt.alert({ gantt.alert({

16
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 + "%";
}
}}
] ]
} }
} }

13
view-mode/index.html

@ -69,6 +69,19 @@
<h6 id="project-name-header"></h6> <h6 id="project-name-header"></h6>
</div> </div>
<div class="container-action"> <div class="container-action">
<div class="btn-icon-toolbar btn-sm"><span class="icon-toolbar-separator">Zoom: </span></div>
<div class="btn-icon-toolbar text-nowrap">
<input type="radio" id="scale1" class="gantt_radio" name="scale" value="day">
<label for="scale1" class="icon-toolbar btn-icon-toolbar-label">Days</label>
</div>
<div class="btn-icon-toolbar text-nowrap">
<input type="radio" id="scale2" class="gantt_radio" name="scale" value="week">
<label for="scale2" class="icon-toolbar btn-icon-toolbar-label">Weeks</label>
</div>
<div class="btn-icon-toolbar text-nowrap">
<input type="radio" id="scale3" class="gantt_radio" name="scale" value="month">
<label for="scale3" class="icon-toolbar btn-icon-toolbar-label">Months</label>
</div>
<button title="Expand Activities" class="btn btn-sm btn-icon-toolbar" id="gantt_toggle_task_btn"><i <button title="Expand Activities" class="btn btn-sm btn-icon-toolbar" id="gantt_toggle_task_btn"><i
class="fa fa-expand-alt icon-toolbar"></i></button> class="fa fa-expand-alt icon-toolbar"></i></button>
<span class="icon-toolbar-separator">|</span> <span class="icon-toolbar-separator">|</span>

Loading…
Cancel
Save