Browse Source

Fix set baseline

pull/1/head
Wahyu Ramadhan 1 year ago
parent
commit
c16bdba85d
  1. 5
      edit-mode/function/function.js
  2. 30
      edit-mode/function/ganttSettings.js
  3. 35
      edit-mode/function/restActivityLink.js

5
edit-mode/function/function.js

@ -383,6 +383,11 @@ function getGanttOpen() {
} }
$(document).ready(function () { $(document).ready(function () {
$("#gantt_here").on("scroll", function () {
var container = $(this);
var scrollPositionX = container.scrollLeft();
});
$("#critalPathBox").on("change", function () { $("#critalPathBox").on("change", function () {
let checked = $(this).is(":checked"); let checked = $(this).is(":checked");
if (checked) { if (checked) {

30
edit-mode/function/ganttSettings.js

@ -351,6 +351,36 @@ function setBaseline() {
} }
async function setBaselineAPI() { 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 const res = await axiosInstance
.get(ACTIVITY_SET_BASELINE_URL, HEADER) .get(ACTIVITY_SET_BASELINE_URL, HEADER)
.then(res => res) .then(res => res)

35
edit-mode/function/restActivityLink.js

@ -34,41 +34,6 @@ gantt.ajax.get({
getGanttOpen(); getGanttOpen();
gantt.parse(data); 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);
}
$("body").addClass("loading");
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)
if (res) {
refresData();
}
}).catch(function (error) {
$("body").removeClass("loading");
gantt.alert({
title: "Peringatan",
type: "alert-error",
text: "Update import gagal"
});
});
}
}).catch(function (error) { }).catch(function (error) {
$("body").removeClass("loading"); $("body").removeClass("loading");
gantt.alert({ gantt.alert({

Loading…
Cancel
Save