|
|
|
@ -5,6 +5,9 @@
|
|
|
|
|
const VERSION_GANTT_EDIT_URL = `${base_url}version-gantt/edit/${ganttId}`; |
|
|
|
|
const VERSION_GANTT_UPDATE_URL = `${base_url}version-gantt/update/${ganttId}`; |
|
|
|
|
const ACTIVITY_SET_BASELINE_URL = `${base_url}project/set-baseline/${ganttId}`; |
|
|
|
|
const ACTIVITY_SET_BASELINE_ACTIVITY_URL = (id) => { |
|
|
|
|
return `${base_url}project/set-baseline-activity/${id}/${ganttId}`; |
|
|
|
|
} |
|
|
|
|
const ACTIVITY_SYNCHRONIZE_REPORT_URL = `${base_url}project/synchronize-report/${ganttId}`; |
|
|
|
|
let projectId = getUrlParameter("proyek_id"); |
|
|
|
|
var toggleTasks = "Collapse"; |
|
|
|
@ -128,7 +131,8 @@ $(document).ready(function () {
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$("#dashboard-project").on('click', function (event) { |
|
|
|
|
window.location.href = `https://project.ospro.id/#/dashboard-project/${projectId}/${ganttId}`; |
|
|
|
|
// window.location.href = `https://project.ospro.id/#/dashboard-project/${projectId}/${ganttId}`;
|
|
|
|
|
window.location.href = `http://localhost:3000/#/dashboard-project/${projectId}/${ganttId}`; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$("#gantt-baseline").on('click', function (event) { |
|
|
|
@ -358,6 +362,20 @@ function setBaseline() {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Set Baseline Activity
|
|
|
|
|
function setBaselineActivity(activity_id) { |
|
|
|
|
var box = gantt.confirm({ |
|
|
|
|
text: "Set Baseline Activity?", |
|
|
|
|
ok: "Yes", |
|
|
|
|
cancel: "No", |
|
|
|
|
callback: async function (result) { |
|
|
|
|
if (result) { |
|
|
|
|
await setBaselineActivityAPI(activity_id); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async function importUpdate() { |
|
|
|
|
expandTask(); |
|
|
|
|
var allTasks = []; |
|
|
|
@ -391,10 +409,26 @@ async function importUpdate() {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async function setBaselineActivityAPI(activity_id) { |
|
|
|
|
await importUpdate(); |
|
|
|
|
const res = await axiosInstance |
|
|
|
|
.get(ACTIVITY_SET_BASELINE_ACTIVITY_URL(activity_id), HEADER) |
|
|
|
|
.then(res => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
if (res && res.status === 200) { |
|
|
|
|
gantt.message("Set baseline activity success!"); |
|
|
|
|
window.location.reload(); |
|
|
|
|
} else { |
|
|
|
|
$("body").removeClass("loading"); |
|
|
|
|
gantt.alert({ type: "error", text: "Failed to set baseline activity" }); |
|
|
|
|
} |
|
|
|
|
gantt.render(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async function setBaselineAPI() { |
|
|
|
|
await importUpdate(); |
|
|
|
|
const res = await axiosInstance |
|
|
|
|
.get(ACTIVITY_SET_BASELINE_URL, HEADER) |
|
|
|
|
.get(ACTIVITY_SET_BASELINE_URL(activity_id), HEADER) |
|
|
|
|
.then(res => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
console.log('set baseline res', res); |
|
|
|
@ -406,6 +440,7 @@ async function setBaselineAPI() {
|
|
|
|
|
window.location.reload(); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
$("body").removeClass("loading"); |
|
|
|
|
gantt.alert({ type: "error", text: "Failed to set baseline" }); |
|
|
|
|
} |
|
|
|
|
gantt.render(); |
|
|
|
|