|
|
|
@ -351,6 +351,36 @@ function setBaseline() {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async function setBaselineAPI() { |
|
|
|
|
expandTask(); |
|
|
|
|
var allTasks = []; |
|
|
|
|
var taskCount = gantt.getTaskCount(); |
|
|
|
|
|
|
|
|
|
for (var i = 0; i < taskCount; i++) { |
|
|
|
|
var task = gantt.getTaskByIndex(i); |
|
|
|
|
allTasks.push(task); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$("body").addClass("loading"); |
|
|
|
|
const response = await 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) { |
|
|
|
|
$("body").removeClass("loading"); |
|
|
|
|
let res = response.responseText |
|
|
|
|
res = JSON.parse(res) |
|
|
|
|
}).catch(function (error) { |
|
|
|
|
$("body").removeClass("loading"); |
|
|
|
|
gantt.alert({ |
|
|
|
|
title: "Peringatan", |
|
|
|
|
type: "alert-error", |
|
|
|
|
text: "Update import gagal" |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
const res = await axiosInstance |
|
|
|
|
.get(ACTIVITY_SET_BASELINE_URL, HEADER) |
|
|
|
|
.then(res => res) |
|
|
|
|