|
|
|
@ -182,56 +182,56 @@ var dp = gantt.createDataProcessor(function (entity, action, data, id) {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
data['geom'] = geom.find(obj => obj.activity_id == id)?.geom; |
|
|
|
|
// let existingEntity = localStorage.getItem('batchEntity');
|
|
|
|
|
// if (existingEntity) {
|
|
|
|
|
// existingEntity = JSON.parse(existingEntity);
|
|
|
|
|
// // Now batchEntity is an object containing your data, and you can access its properties like batchEntity.entity and batchEntity.data
|
|
|
|
|
// }
|
|
|
|
|
// let batchEntity = {
|
|
|
|
|
// entity: entity,
|
|
|
|
|
// data: data
|
|
|
|
|
// };
|
|
|
|
|
// let toBeSet = []
|
|
|
|
|
// if (existingEntity) {
|
|
|
|
|
// toBeSet = [...existingEntity, batchEntity]
|
|
|
|
|
// } else {
|
|
|
|
|
// toBeSet = [batchEntity]
|
|
|
|
|
// }
|
|
|
|
|
// localStorage.setItem('batchEntity', JSON.stringify(toBeSet));
|
|
|
|
|
$("body").addClass("loading"); |
|
|
|
|
return gantt.ajax.put({ |
|
|
|
|
headers: { |
|
|
|
|
"Content-Type": "application/json", |
|
|
|
|
"Authorization": `Bearer ${token}` |
|
|
|
|
}, |
|
|
|
|
url: base_url + entity + "/" + id, |
|
|
|
|
data: JSON.stringify(data) |
|
|
|
|
}).then(function (response) { |
|
|
|
|
$("body").removeClass("loading"); |
|
|
|
|
if (entity == "task") { |
|
|
|
|
let parent = data.parent; |
|
|
|
|
let responseText = JSON.parse(response.responseText) |
|
|
|
|
let resData = responseText |
|
|
|
|
let updateBobot = resData.update_bobot || false |
|
|
|
|
if (updateBobot) { |
|
|
|
|
if (parent && parent > 0) { |
|
|
|
|
updateActivity(parent); |
|
|
|
|
} |
|
|
|
|
} else if (parent && parent > 0) { |
|
|
|
|
updateActivity(parent); |
|
|
|
|
} |
|
|
|
|
if (!parent) { |
|
|
|
|
refresData(); |
|
|
|
|
let existingEntity = localStorage.getItem('batchEntity'); |
|
|
|
|
if (existingEntity) { |
|
|
|
|
existingEntity = JSON.parse(existingEntity); |
|
|
|
|
// Now batchEntity is an object containing your data, and you can access its properties like batchEntity.entity and batchEntity.data
|
|
|
|
|
} |
|
|
|
|
let batchEntity = { |
|
|
|
|
entity: entity, |
|
|
|
|
data: data |
|
|
|
|
}; |
|
|
|
|
let toBeSet = [] |
|
|
|
|
if (existingEntity) { |
|
|
|
|
toBeSet = [...existingEntity, batchEntity] |
|
|
|
|
} else { |
|
|
|
|
toBeSet = [batchEntity] |
|
|
|
|
} |
|
|
|
|
}).catch(function (error) { |
|
|
|
|
$("body").removeClass("loading"); |
|
|
|
|
gantt.alert({ |
|
|
|
|
title: "Peringatan", |
|
|
|
|
type: "alert-error", |
|
|
|
|
text: "Update activity gagal" |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
localStorage.setItem('batchEntity', JSON.stringify(toBeSet)); |
|
|
|
|
// $("body").addClass("loading");
|
|
|
|
|
// return gantt.ajax.put({
|
|
|
|
|
// headers: {
|
|
|
|
|
// "Content-Type": "application/json",
|
|
|
|
|
// "Authorization": `Bearer ${token}`
|
|
|
|
|
// },
|
|
|
|
|
// url: base_url + entity + "/" + id,
|
|
|
|
|
// data: JSON.stringify(data)
|
|
|
|
|
// }).then(function (response) {
|
|
|
|
|
// $("body").removeClass("loading");
|
|
|
|
|
// if (entity == "task") {
|
|
|
|
|
// let parent = data.parent;
|
|
|
|
|
// let responseText = JSON.parse(response.responseText)
|
|
|
|
|
// let resData = responseText
|
|
|
|
|
// let updateBobot = resData.update_bobot || false
|
|
|
|
|
// if (updateBobot) {
|
|
|
|
|
// if (parent && parent > 0) {
|
|
|
|
|
// updateActivity(parent);
|
|
|
|
|
// }
|
|
|
|
|
// } else if (parent && parent > 0) {
|
|
|
|
|
// updateActivity(parent);
|
|
|
|
|
// }
|
|
|
|
|
// if (!parent) {
|
|
|
|
|
// refresData();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }).catch(function (error) {
|
|
|
|
|
// $("body").removeClass("loading");
|
|
|
|
|
// gantt.alert({
|
|
|
|
|
// title: "Peringatan",
|
|
|
|
|
// type: "alert-error",
|
|
|
|
|
// text: "Update activity gagal"
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
case "delete": |
|
|
|
|