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