|
|
@ -1,4 +1,5 @@ |
|
|
|
let geom = []; |
|
|
|
let geom = []; |
|
|
|
|
|
|
|
$("body").addClass("loading"); |
|
|
|
gantt.ajax.get({ |
|
|
|
gantt.ajax.get({ |
|
|
|
url: `${base_url}activity/${ganttId}/${proyekId}/get`, |
|
|
|
url: `${base_url}activity/${ganttId}/${proyekId}/get`, |
|
|
|
headers: { |
|
|
|
headers: { |
|
|
@ -6,6 +7,7 @@ gantt.ajax.get({ |
|
|
|
"Authorization": `Bearer ${token}` |
|
|
|
"Authorization": `Bearer ${token}` |
|
|
|
} |
|
|
|
} |
|
|
|
}).then(function (xhr) { |
|
|
|
}).then(function (xhr) { |
|
|
|
|
|
|
|
$("body").removeClass("loading"); |
|
|
|
let data = {}; |
|
|
|
let data = {}; |
|
|
|
let response = xhr.responseText; |
|
|
|
let response = xhr.responseText; |
|
|
|
let obj = JSON.parse(response); |
|
|
|
let obj = JSON.parse(response); |
|
|
@ -30,8 +32,19 @@ gantt.ajax.get({ |
|
|
|
gantt.silent(function () { |
|
|
|
gantt.silent(function () { |
|
|
|
gantt.parse(data); |
|
|
|
gantt.parse(data); |
|
|
|
getGanttOpen(); |
|
|
|
getGanttOpen(); |
|
|
|
|
|
|
|
gantt.parse(data); |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (Date.now() < timestamp) { |
|
|
|
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({ |
|
|
|
gantt.ajax.post({ |
|
|
|
headers: { |
|
|
|
headers: { |
|
|
|
"Content-Type": "application/json", |
|
|
|
"Content-Type": "application/json", |
|
|
@ -41,13 +54,28 @@ gantt.ajax.get({ |
|
|
|
dataType: "json", |
|
|
|
dataType: "json", |
|
|
|
data: JSON.stringify(allTasks) |
|
|
|
data: JSON.stringify(allTasks) |
|
|
|
}).then(function (response) { |
|
|
|
}).then(function (response) { |
|
|
|
|
|
|
|
$("body").removeClass("loading"); |
|
|
|
let res = response.responseText |
|
|
|
let res = response.responseText |
|
|
|
res = JSON.parse(res) |
|
|
|
res = JSON.parse(res) |
|
|
|
if (res) { |
|
|
|
if (res) { |
|
|
|
refresData(); |
|
|
|
refresData(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}).catch(function (error) { |
|
|
|
|
|
|
|
$("body").removeClass("loading"); |
|
|
|
|
|
|
|
gantt.alert({ |
|
|
|
|
|
|
|
title: "Peringatan", |
|
|
|
|
|
|
|
type: "alert-error", |
|
|
|
|
|
|
|
text: "Update import gagal" |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}).catch(function (error) { |
|
|
|
|
|
|
|
$("body").removeClass("loading"); |
|
|
|
|
|
|
|
gantt.alert({ |
|
|
|
|
|
|
|
title: "Peringatan", |
|
|
|
|
|
|
|
type: "alert-error", |
|
|
|
|
|
|
|
text: "Get activity gagal" |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
function refresData(id) { |
|
|
|
function refresData(id) { |
|
|
@ -127,6 +155,7 @@ var dp = gantt.createDataProcessor(function (entity, action, data, id) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
data['version_gantt_id'] = ganttId; |
|
|
|
data['version_gantt_id'] = ganttId; |
|
|
|
|
|
|
|
$("body").addClass("loading"); |
|
|
|
return gantt.ajax.post({ |
|
|
|
return gantt.ajax.post({ |
|
|
|
headers: { |
|
|
|
headers: { |
|
|
|
"Content-Type": "application/json", |
|
|
|
"Content-Type": "application/json", |
|
|
@ -135,6 +164,7 @@ var dp = gantt.createDataProcessor(function (entity, action, data, id) { |
|
|
|
url: base_url + entity, |
|
|
|
url: base_url + entity, |
|
|
|
data: JSON.stringify(data) |
|
|
|
data: JSON.stringify(data) |
|
|
|
}).then(function (response) { |
|
|
|
}).then(function (response) { |
|
|
|
|
|
|
|
$("body").removeClass("loading"); |
|
|
|
let res = response.responseText |
|
|
|
let res = response.responseText |
|
|
|
res = JSON.parse(res) |
|
|
|
res = JSON.parse(res) |
|
|
|
if (entity == "link") { |
|
|
|
if (entity == "link") { |
|
|
@ -142,6 +172,13 @@ var dp = gantt.createDataProcessor(function (entity, action, data, id) { |
|
|
|
} else if (entity == "task") { |
|
|
|
} else if (entity == "task") { |
|
|
|
gantt.changeTaskId(id, res.tid); |
|
|
|
gantt.changeTaskId(id, res.tid); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}).catch(function (error) { |
|
|
|
|
|
|
|
$("body").removeClass("loading"); |
|
|
|
|
|
|
|
gantt.alert({ |
|
|
|
|
|
|
|
title: "Peringatan", |
|
|
|
|
|
|
|
type: "alert-error", |
|
|
|
|
|
|
|
text: "Add activity gagal" |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "update": |
|
|
|
case "update": |
|
|
@ -223,12 +260,14 @@ var dp = gantt.createDataProcessor(function (entity, action, data, id) { |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case "delete": |
|
|
|
case "delete": |
|
|
|
|
|
|
|
$("body").addClass("loading"); |
|
|
|
return gantt.ajax.del({ |
|
|
|
return gantt.ajax.del({ |
|
|
|
headers: { |
|
|
|
headers: { |
|
|
|
"Authorization": `Bearer ${token}` |
|
|
|
"Authorization": `Bearer ${token}` |
|
|
|
}, |
|
|
|
}, |
|
|
|
url: base_url + entity + "/" + id |
|
|
|
url: base_url + entity + "/" + id |
|
|
|
}).then(function (response) { |
|
|
|
}).then(function (response) { |
|
|
|
|
|
|
|
$("body").removeClass("loading"); |
|
|
|
if (entity == "task") { |
|
|
|
if (entity == "task") { |
|
|
|
let parent = data.parent; |
|
|
|
let parent = data.parent; |
|
|
|
if (parent && parent > 0) { |
|
|
|
if (parent && parent > 0) { |
|
|
@ -244,6 +283,13 @@ var dp = gantt.createDataProcessor(function (entity, action, data, id) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}).catch(function (error) { |
|
|
|
|
|
|
|
$("body").removeClass("loading"); |
|
|
|
|
|
|
|
gantt.alert({ |
|
|
|
|
|
|
|
title: "Peringatan", |
|
|
|
|
|
|
|
type: "alert-error", |
|
|
|
|
|
|
|
text: "Update activity gagal" |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|