Browse Source

Merge pull request 'upload 2023-10-16' (#51) from staging into master

Reviewed-on: ordo/adw-gantt#51
pull/1/head
farhantock 1 year ago
parent
commit
0b321dd885
  1. 31
      edit-mode/function/expenseResource.js
  2. 61
      edit-mode/function/function.js
  3. 21
      edit-mode/function/ganttSettings.js
  4. 1
      edit-mode/function/reportActivity.js

31
edit-mode/function/expenseResource.js

@ -75,37 +75,6 @@ $(document).ready(function () {
});
}
function searchReport(id) {
var payload = {
"columns": [
{
"name": "assign_material_id",
"logic_operator": "=",
"value": id,
"operator": "AND"
}
],
// "joins": [{ "name": "m_proyek", "column_join": "proyek_id", "column_results": ["kode_sortname", "nama"] }],
}
$.ajax({
data: JSON.stringify(payload),
url: `${base_url}report-activity-material/search`,
type: "POST",
success: function (data) {
data.data.forEach(element => {
let activityId = element.activity_id;
let task = gantt.getTask(activityId);
task.actual_start = null;
task.actual_end = null;
});
actionHappen = true;
},
error: function (data) {
// gantt.alert("Failed to get the data.");
}
});
}
$("#modal-expense").on("click", "#show-form-expense", function () {
$(this).hide();
$("#hide-form-expense").show();

61
edit-mode/function/function.js

@ -14,6 +14,46 @@ function getUrlParameter(sParam) {
return false;
};
function searchReport(id, updateActual = true) {
var payload = {
"columns": [
{
"name": "assign_material_id",
"logic_operator": "=",
"value": id,
"operator": "AND"
}
],
// "joins": [{ "name": "m_proyek", "column_join": "proyek_id", "column_results": ["kode_sortname", "nama"] }],
}
$.ajax({
data: JSON.stringify(payload),
url: `${base_url}report-activity-material/search`,
type: "POST",
success: function (data) {
if (updateActual) {
data.data.forEach(element => {
let activityId = element.activity_id;
let task = gantt.getTask(activityId);
task.actual_start = null;
task.actual_end = null;
});
} else {
if (data.data.length == 1) {
let activityId = data.data[0].activity_id;
let task = gantt.getTask(activityId);
task.actual_start = null;
task.actual_end = null;
}
}
actionHappen = true;
},
error: function (data) {
// gantt.alert("Failed to get the data.");
}
});
}
const formatNumber = (angka) => {
var number_string = angka.replace(/[^,\d]/g, '').toString(),
split = number_string.split(','),
@ -733,27 +773,6 @@ function batchUpdate(){
});
}
function updateSchedule() {
$("body").addClass("loading");
return gantt.ajax.get({
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${token}`
},
url: base_url + "activity/update-schedule/" + ganttId
}).then(function (response) {
$("body").removeClass("loading");
refresData();
}).catch(function (error) {
$("body").removeClass("loading")
gantt.alert({
title: "Peringatan",
type: "alert-error",
text: "Update activity gagal"
});
});
}
$(window).on('beforeunload', function(event) {
let batchEntity = localStorage.getItem('batchEntity');
sendStorage();

21
edit-mode/function/ganttSettings.js

@ -447,6 +447,27 @@ function setSynchronize() {
});
}
function updateSchedule() {
$("body").addClass("loading");
return gantt.ajax.get({
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${token}`
},
url: base_url + "activity/update-schedule/" + ganttId
}).then(function (response) {
$("body").removeClass("loading");
window.location.reload();
}).catch(function (error) {
$("body").removeClass("loading")
gantt.alert({
title: "Peringatan",
type: "alert-error",
text: "Update activity gagal"
});
});
}
async function setSynchronizeAPI() {
const res = await axiosInstance
.get(ACTIVITY_SYNCHRONIZE_REPORT_URL, HEADER)

1
edit-mode/function/reportActivity.js

@ -654,6 +654,7 @@ $(document).ready(function () {
}
function deleteRaMaterial(id) {
searchReport(assignMaterialId, false);
$.ajax({
url: `${base_url}report-activity-material/delete/${id}`,
type: "DELETE",

Loading…
Cancel
Save