Browse Source

Import update date

pull/1/head
Wahyu Ramadhan 2 years ago
parent
commit
48668ad1f9
  1. 10
      edit-mode/function/function.js
  2. 1
      edit-mode/function/ganttConfig.js
  3. 26
      edit-mode/function/restActivityLink.js

10
edit-mode/function/function.js

@ -599,3 +599,13 @@ function replaceAll(str, find, replace) {
}
return str
}
function expandTask(){
gantt.eachTask(function(task){
task.$open = true;
});
toggleTasks = "Collapse";
$("#gantt_toggle_task_btn").prop('title', 'Collapse Activities');
$("#gantt_toggle_task_btn").children().removeClass('fa-expand-alt');
$("#gantt_toggle_task_btn").children().addClass('fa-compress-alt');
gantt.render();
}

1
edit-mode/function/ganttConfig.js

@ -1,6 +1,7 @@
const ganttId = getUrlParameter("gantt_id");
const readOnly = getUrlParameter("ro");
const proyekId = getUrlParameter("proyek_id");
const timestamp = getUrlParameter("timestamp");
let base_url = getUrlParameter("base_url");
const base_url_image = "https://adw-api.ospro.id/assets/image/";
const adwIntegrationUrl = "https://adw-api.ospro.id/api";

26
edit-mode/function/restActivityLink.js

@ -22,6 +22,32 @@ gantt.ajax.get({
gantt.silent(function () {
gantt.parse(data);
});
if (Date.now() < timestamp) {
expandTask();
var allTasks = [];
var taskCount = gantt.getTaskCount();
for (var i = 0; i < taskCount; i++) {
var task = gantt.getTaskByIndex(i);
allTasks.push(task);
}
gantt.ajax.post({
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${token}`
},
url: `${base_url}activity/import-update`,
dataType: "json",
data: JSON.stringify(allTasks)
}).then(function(response){
let res = response.responseText
res = JSON.parse(res)
if (res) {
refresData();
}
});
}
});
function refresData(id){

Loading…
Cancel
Save