diff --git a/edit-mode/function/ganttActivityUploadDoc.js b/edit-mode/function/ganttActivityUploadDoc.js index a8fa46e..e88db40 100644 --- a/edit-mode/function/ganttActivityUploadDoc.js +++ b/edit-mode/function/ganttActivityUploadDoc.js @@ -1,8 +1,8 @@ // Upload Document Activity const DOCUMENT_UPLOAD_URL = `${base_url}document-activity/upload`; -const DOCUMENT_DOWNLOAD_URL = (id) => `${base_url}document-activity/download/${id}`; +const DOCUMENT_DOWNLOAD_URL = (id) => `${base_url}document-activity/download/${id}/${company_id}`; const DOCUMENT_SEARCH_URL = `${base_url}document-activity/search`; -const DOCUMENT_DELETE_URL = (id) => `${base_url}document-activity/delete/${id}`; +const DOCUMENT_DELETE_URL = (id, company_id) => `${base_url}document-activity/delete/${id}/${company_id}`; var fileToUpload = null; @@ -100,35 +100,27 @@ async function submitDocuments() { var formData = new FormData; formData.append('activity_id', activity_id); formData.append('dokumen', files); - + formData.append('company_id',company_id); if (activity_id !== '' && dokumen !== '') { const result = await axiosInstance .post(DOCUMENT_UPLOAD_URL, formData) .then(res => res) .catch((error) => error.response); - - console.log("result", result) - if(result && result.status==200){ console.log('done upload doc', result) - // gantt.message("Upload success"); gantt.alert("Upload Success"); $("#add_doc_form").trigger("reset"); $('#btn_doc_submit').html('Upload'); $('#btn_doc_submit').prop("disabled",false); searchDocuments(activity_id); // reload the contents }else{ - // closeDialog('failed upload') console.log('failed upload'); - // alert('Upload failed'); - // gantt.message({type:"error", text:"Upload Failed"}); gantt.alert({type: "error", text: "Upload Failed"}); $('#btn_doc_submit').html('Upload'); $('#btn_doc_submit').prop("disabled",false); } } else { - // alert('Please input the comment'); gantt.alert("Please insert the document file"); $('#btn_doc_submit').html('Upload'); $('#btn_doc_submit').prop("disabled",false); @@ -209,7 +201,7 @@ function searchDocuments(activity_id) { async function downloadDocument(id, name) { let result; - await fetch(DOCUMENT_DOWNLOAD_URL(id), { + await fetch(DOCUMENT_DOWNLOAD_URL(id, company_id), { headers: new Headers({ 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` @@ -253,7 +245,7 @@ async function deleteDocument(id, activity_id) { if (result) { console.log('download document', id); const result = await axiosInstance - .delete(DOCUMENT_DELETE_URL(id)) + .delete(DOCUMENT_DELETE_URL(id, company_id)) .then(res => res) .catch((error) => error.response); diff --git a/edit-mode/function/ganttConfig.js b/edit-mode/function/ganttConfig.js index b2d1d6d..9654313 100644 --- a/edit-mode/function/ganttConfig.js +++ b/edit-mode/function/ganttConfig.js @@ -114,13 +114,13 @@ var colHeader = '
'; - optionsContent += ' '; - optionsContent += ' '; - optionsContent += ' '; - optionsContent += !hasChild ? ' ' : ''; - optionsContent += !hasChild ? ' ' : ''; - optionsContent += !hasChild ? ' ' : ''; + optionsContent += ' '; + optionsContent += ' '; + optionsContent += ' '; + optionsContent += ' '; + optionsContent += !hasChild ? ' ' : ''; + optionsContent += !hasChild ? ' ' : ''; + optionsContent += !hasChild ? ' ' : ''; optionsContent += '
'; return (optionsContent); }; @@ -238,7 +238,7 @@ function addWithParent(id) { no = no + 1; } -function clickGridButton(id, action) { +function clickGridButton(id, name, action) { switch (action) { case "edit": gantt.showLightbox(id); @@ -257,7 +257,7 @@ function clickGridButton(id, action) { }); break; case "set-baseline-activity": - setBaselineActivity(id); + setBaselineActivity(id, name); break; case "upload": showDocuments(id); @@ -347,10 +347,7 @@ var allColumns = [ { name: "bobot_planning", label: "Bobot (%)", align: "center", editor: editor.bobot_planning, resize: true, min_width: 115, template: function (text) { let bobot = parseFloat(text.bobot_planning); - console.log("bobot roundToTwo ", roundToTwo(bobot)); - console.log("bobot toFixed ", bobot.toFixed(2)); if (bobot.toFixed(2) > 100) { - gantt.alert("Bobot tidak boleh lebih dari 100%!"); return; } @@ -512,9 +509,6 @@ var allColumns = [ name: "progress_actual", label: "Total Actual Progress (%)", align: "center", min_width: 150, template: function (text) { let progress = text.progress progress = progress * 100 - - console.log("progress roundToTwo ", roundToTwo(progress)); - console.log("progress toFixed ", progress.toFixed(2)); if (progress.toFixed(2) > 100) { gantt.alert("Progress tidak boleh lebih dari 100%!"); return; diff --git a/edit-mode/function/ganttSettings.js b/edit-mode/function/ganttSettings.js index ba25d0d..5104100 100644 --- a/edit-mode/function/ganttSettings.js +++ b/edit-mode/function/ganttSettings.js @@ -347,7 +347,7 @@ window.addEventListener("click", function (event) { // Set Baseline function setBaseline() { var box = gantt.confirm({ - text: "Set Baseline?", + text: "Set Baseline for this gantt chart?", ok: "Yes", cancel: "No", callback: async function (result) { @@ -363,9 +363,9 @@ function setBaseline() { } // Set Baseline Activity -function setBaselineActivity(activity_id) { +function setBaselineActivity(activity_id, name) { var box = gantt.confirm({ - text: "Set Baseline Activity?", + text: `Set Baseline for this activity ${name}?`, ok: "Yes", cancel: "No", callback: async function (result) { @@ -428,7 +428,7 @@ async function setBaselineActivityAPI(activity_id) { async function setBaselineAPI() { await importUpdate(); const res = await axiosInstance - .get(ACTIVITY_SET_BASELINE_URL(activity_id), HEADER) + .get(ACTIVITY_SET_BASELINE_URL, HEADER) .then(res => res) .catch((error) => error.response); console.log('set baseline res', res); diff --git a/view-mode/function/ganttActivityUploadDoc.js b/view-mode/function/ganttActivityUploadDoc.js index a8fa46e..06706e9 100644 --- a/view-mode/function/ganttActivityUploadDoc.js +++ b/view-mode/function/ganttActivityUploadDoc.js @@ -1,8 +1,8 @@ // Upload Document Activity const DOCUMENT_UPLOAD_URL = `${base_url}document-activity/upload`; -const DOCUMENT_DOWNLOAD_URL = (id) => `${base_url}document-activity/download/${id}`; +const DOCUMENT_DOWNLOAD_URL = (id) => `${base_url}document-activity/download/${id}/${company_id}`; const DOCUMENT_SEARCH_URL = `${base_url}document-activity/search`; -const DOCUMENT_DELETE_URL = (id) => `${base_url}document-activity/delete/${id}`; +const DOCUMENT_DELETE_URL = (id, company_id) => `${base_url}document-activity/delete/${id}/${company_id}`; var fileToUpload = null; @@ -100,35 +100,26 @@ async function submitDocuments() { var formData = new FormData; formData.append('activity_id', activity_id); formData.append('dokumen', files); - + formData.append('company_id',company_id); if (activity_id !== '' && dokumen !== '') { const result = await axiosInstance .post(DOCUMENT_UPLOAD_URL, formData) .then(res => res) .catch((error) => error.response); - - console.log("result", result) - if(result && result.status==200){ console.log('done upload doc', result) - // gantt.message("Upload success"); gantt.alert("Upload Success"); $("#add_doc_form").trigger("reset"); $('#btn_doc_submit').html('Upload'); $('#btn_doc_submit').prop("disabled",false); searchDocuments(activity_id); // reload the contents }else{ - // closeDialog('failed upload') - console.log('failed upload'); - // alert('Upload failed'); - // gantt.message({type:"error", text:"Upload Failed"}); gantt.alert({type: "error", text: "Upload Failed"}); $('#btn_doc_submit').html('Upload'); $('#btn_doc_submit').prop("disabled",false); } } else { - // alert('Please input the comment'); gantt.alert("Please insert the document file"); $('#btn_doc_submit').html('Upload'); $('#btn_doc_submit').prop("disabled",false); @@ -209,7 +200,7 @@ function searchDocuments(activity_id) { async function downloadDocument(id, name) { let result; - await fetch(DOCUMENT_DOWNLOAD_URL(id), { + await fetch(DOCUMENT_DOWNLOAD_URL(id, company_id), { headers: new Headers({ 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` @@ -253,7 +244,7 @@ async function deleteDocument(id, activity_id) { if (result) { console.log('download document', id); const result = await axiosInstance - .delete(DOCUMENT_DELETE_URL(id)) + .delete(DOCUMENT_DELETE_URL(id, company_id)) .then(res => res) .catch((error) => error.response); diff --git a/view-mode/function/ganttSettings.js b/view-mode/function/ganttSettings.js index 3872a95..6188f82 100644 --- a/view-mode/function/ganttSettings.js +++ b/view-mode/function/ganttSettings.js @@ -384,7 +384,7 @@ window.addEventListener("click", function(event){ // Set Baseline function setBaseline() { var box = gantt.confirm({ - text: "Set Baseline?", + text: "Set Baseline for this gantt chart?", ok:"Yes", cancel:"No", callback: async function(result){