diff --git a/edit-mode/function/activityLocation.js b/edit-mode/function/activityLocation.js index 77e9c90..f6f7992 100644 --- a/edit-mode/function/activityLocation.js +++ b/edit-mode/function/activityLocation.js @@ -61,12 +61,10 @@ function openActivityMap(id) { type: "get", success: function (data) { let dataRes = data.data - // console.log("cek data", data); drawnItems.clearLayers(); if (dataRes.geom) { let datageojson = JSON.parse(dataRes.geom); currentGeoJson = datageojson - // console.log("cek data geojson", datageojson); if (datageojson.type === 'FeatureCollection') { datageojson.features.forEach(feature => { let lGeoJson = L.geoJSON(feature); @@ -91,7 +89,6 @@ function openActivityMap(id) { let latlon = layers[0].getLatLng(); let newCircle = L.circle([latlon.lat, latlon.lng], { radius: radius }); addDrawnLayer(newCircle) - // console.log("cek layers", layers[0]); } else { let lGeoJson = L.geoJson(datageojson); let layers = lGeoJson.getLayers(); @@ -138,19 +135,16 @@ $(document).ready(function () { layer = e.layer; if (type === 'marker') { let latlong = layer.getLatLng(); - // console.log("cek latlong", latlong); circLat = latlong.lat circLong = latlong.lng $("#modal_radius").modal("show"); // Do marker specific actions // let attri = layer.getAttribution(); - // console.log("cek attribute", attri); return false; } let geJson = layer.toGeoJSON(); currentGeoJson = geJson; // let lgeojson = L.geoJson(geJson) - // console.log("cek layer", layer.toGeoJSON()); // layer.bindTooltip("cek"); // Do whatever else you need to. (save to db; add to map etc) addDrawnLayer(layer); @@ -166,7 +160,6 @@ $(document).ready(function () { drawnItems.removeLayer(layer); }); updateCurrentGeoJson() - // console.log("cek layer", layer.toGeoJSON()); // Do whatever else you need to. (save to db; add to map etc) // map.addLayer(layer); @@ -183,8 +176,6 @@ $(document).ready(function () { } updateCurrentGeoJson(); }); - // console.log("cek layer", layers[0].toGeoJSON()); - // console.log("cek layer", layer.toGeoJSON()); // Do whatever else you need to. (save to db; add to map etc) // drawnControlEdit.remove(); // map.addControl(drawControl); diff --git a/edit-mode/function/expenseResource.js b/edit-mode/function/expenseResource.js index 1ede914..bf36e32 100644 --- a/edit-mode/function/expenseResource.js +++ b/edit-mode/function/expenseResource.js @@ -1,10 +1,11 @@ var expenseModal = $('#modal-expense > .modal-dialog > .modal-content'); function resetFormAssignexpense() { - $('#select-expense').val(null).trigger("change"); - $('#select-expense').find('option').remove(); - $('#select-expense').val(""); - $('#uom-req-expense').val(null).trigger('change'); + // $('#select-expense').val(null).trigger("change"); + // $('#select-expense').find('option').remove(); + // $('#select-expense').val(""); + $("#desc-expense").val(""); + $('#uom-req-expense').val("").trigger('change'); $('#form-assign-expense').trigger("reset"); $('#btn-assign-expense').html('Assign'); $('#btn-assign-expense').prop("disabled", false); @@ -88,20 +89,18 @@ $(document).ready(function () { }); $('#modal-expense').on('show.bs.modal', function (event) { - $("#desc-expense").val(activityName); + resetFormAssignexpense(); $('#modal-expense-title').html("Overhead " + activityName); $('#modal-expense-sub-title').html(`

Plan Date: ${moment(activityEarlyStart).format('DD MMMM YYYY')} - ${moment(activityEarlyFinish).format('DD MMMM YYYY')}

`); tableexpense.draw(); }); $('#modal-expense').on('hide.bs.modal', function (event) { + resetFormAssignexpense(); $("#show-form-expense").show(); - console.log("there's before action change ", actionHappen); if (actionHappen) { - console.log("there's action change ", actionHappen); updateActivity(activityId); } - resetFormAssignexpense(); }); $('#select-expense').select2({ @@ -123,7 +122,6 @@ $(document).ready(function () { processResults: function (result) { return { results: $.map(result, function (item) { - // console.log("cek item", item) return { text: item.description, id: item.id @@ -163,7 +161,7 @@ $(document).ready(function () { type: "expense", fom_date: required_date, required_date: required_date, - proyek_id: proyekId, + proyek_id: parseInt(proyekId), uom: uom, qty: formatReplaceTitikRibuan(qty_planning), price: formatReplaceTitikRibuan(price) @@ -178,7 +176,6 @@ $(document).ready(function () { if (data && data.code === 200) { material_id = data.data.id; resetFormAssignexpense(); - let payloadAssign = { proyek_id: proyekId, activity_id: activityId, @@ -195,35 +192,34 @@ $(document).ready(function () { contentType: false, success: function (data) { if (data && data.code === 200) { + resetFormAssignexpense(); actionHappen = true; gantt.alert("Data added!"); tableexpense.draw(); - resetFormAssignexpense(); - } - else { - gantt.alert({ type: "error", text: data.message }); + } else { $('#btn-assign-expense').html('Assign'); $('#btn-assign-expense').prop("disabled", false); + gantt.alert({ type: "error", text: data.message }); } }, error: function (data) { + $('#btn-assign-expense').html('Assign'); + $('#btn-assign-expense').prop("disabled", false); gantt.alert("Assign Failed, try again later!"); - resetFormAssignexpense(); } }); - } - else { - gantt.alert({ type: "error", text: data.message }); + } else { $('#btn-assign-expense').html('Assign'); $('#btn-assign-expense').prop("disabled", false); + gantt.alert({ type: "error", text: data.message }); } }, error: function (data) { + $('#btn-assign-expense').html('Assign'); + $('#btn-assign-expense').prop("disabled", false); gantt.alert("Overhead request Failed, try again later!"); - resetFormAssignexpense(); } }); - }); // delete from row diff --git a/edit-mode/function/function.js b/edit-mode/function/function.js index 74e7292..0ef13cd 100644 --- a/edit-mode/function/function.js +++ b/edit-mode/function/function.js @@ -189,11 +189,14 @@ function initializationProject() { function getSatuan() { const payload = { - "columns": [], + "orders": { + "ascending": true, + "columns": [ + 'id' + ] + } } - payload.columns.push( - { "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, - ) + $.ajax({ data: JSON.stringify(payload), url: `${base_url}satuan/search`, @@ -221,7 +224,7 @@ function getSatuan() { let newOption = new Option(option.label, option.label); $('#uom-req-material').append(newOption); }); - + $('#uom-req-expense').append(new Option('', '', true, true)); satuanList.forEach((option) => { let newOption = new Option(option.label, option.label); $('#uom-req-expense').append(newOption); @@ -647,10 +650,8 @@ function updateShowHideColumn(data) { processData: false, contentType: false, success: function (data) { - // console.log(data); }, error: function (data) { - // console.log(data); } }); } @@ -661,8 +662,6 @@ function colAjaxReq(type) { type: "GET", success: function (data) { let ganttColumnsByType = data.data; - // console.log("ini gantt field ", ganttColumnsByType); - // console.log("ini column ", gantt.config.columns); let isFound = false; x = gantt.config.columns.filter((val) => { isFound = ganttColumnsByType.find(obj => { @@ -671,7 +670,6 @@ function colAjaxReq(type) { if (isFound) return val; if (isFound == false){ - // console.log("ini gantt field !isFound ", val); } }); diff --git a/edit-mode/function/ganttActivityComments.js b/edit-mode/function/ganttActivityComments.js index 99ae770..807be73 100644 --- a/edit-mode/function/ganttActivityComments.js +++ b/edit-mode/function/ganttActivityComments.js @@ -4,7 +4,6 @@ const COMMENT_SEARCH_URL = `${base_url}comment-activity/search`; $(document).ready(function() { $(".modal_add_btn_comment").on('click', function() { - console.log('onclick add comments'); addComments(); }); $("#btn_comment_submit").on('click', function() { @@ -15,7 +14,6 @@ $(document).ready(function() { // show comments modal function showComments(id) { var task = gantt.getTaskBy('id', id); - console.log('showComments', task); var activity = task && task.length > 0 ? task[0].text : ''; $("#activity_id").val(id); $("#comments_title").text(activity); @@ -58,7 +56,6 @@ function submitComments() { data: JSON.stringify(payload) }) .done(function( msg ) { - console.log('done submit comment', msg) // gantt.message("Comment posted"); gantt.alert("Comment posted"); $("#add_comment_form").trigger("reset"); @@ -106,7 +103,6 @@ function searchComments(activity_id) { } } - console.log('searchComments payload', payload); $.ajax({ method: "POST", @@ -115,7 +111,6 @@ function searchComments(activity_id) { data: JSON.stringify(payload) }) .done(function( msg ) { - console.log('done search comment', msg) var comments = msg && msg.data; var contents = ''; if (comments.length > 0) { diff --git a/edit-mode/function/ganttActivityUploadDoc.js b/edit-mode/function/ganttActivityUploadDoc.js index ecfbc0a..07547b3 100644 --- a/edit-mode/function/ganttActivityUploadDoc.js +++ b/edit-mode/function/ganttActivityUploadDoc.js @@ -1,14 +1,13 @@ // Upload Document Activity const DOCUMENT_UPLOAD_URL = `${base_url}document-activity/upload`; -const DOCUMENT_DOWNLOAD_URL = (id, company_id) => `${base_url}document-activity/download/${id}/${company_id}`; +const DOCUMENT_DOWNLOAD_URL = (id) => `${base_url}document-activity/download/${id}`; const DOCUMENT_SEARCH_URL = `${base_url}document-activity/search`; -const DOCUMENT_DELETE_URL = (id, company_id) => `${base_url}document-activity/delete/${id}/${company_id}`; +const DOCUMENT_DELETE_URL = (id) => `${base_url}document-activity/delete/${id}`; var fileToUpload = null; $(document).ready(function() { $(".modal_add_btn_doc").on('click', function() { - console.log('onclick add document'); addDocuments(); }); @@ -23,9 +22,7 @@ $(document).ready(function() { // $("#add_doc_form").on('submit', function(e) { // // submitDocuments(); // e.preventDefault(); - // console.log(this); // var formData = new FormData(this); - // console.log('formData', formData); // $.ajax({ // method: "POST", // url: DOCUMENT_UPLOAD_URL, @@ -34,13 +31,11 @@ $(document).ready(function() { // contentType: false, // cache: false, // success: function(msg) { - // console.log('done submit comment', msg) // $("#add_doc_form").trigger("reset"); // searchDocuments(activity_id); // reload the contents // }, // error: function(xhr, status, error) { // // error handling - // console.log('error document upload', xhr, status, error); // } // }); // }); @@ -57,7 +52,6 @@ $(document).ready(function() { // show comments modal function showDocuments(id) { var task = gantt.getTaskBy('id', id); - console.log('showComments', task); var activity = task && task.length > 0 ? task[0].text : ''; $("#activity_id").val(id); $("#upload_doc_title").text(activity); @@ -96,25 +90,21 @@ async function submitDocuments() { return; } - console.log('fileToUpload', fileToUpload); 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); if(result && result.status==200){ - console.log('done upload doc', result) 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{ - console.log('failed upload'); gantt.alert({type: "error", text: "Upload Failed"}); $('#btn_doc_submit').html('Upload'); $('#btn_doc_submit').prop("disabled",false); @@ -142,7 +132,6 @@ function searchDocuments(activity_id) { "operator": "AND" } ], - // "joins": [{ "name": "m_proyek", "column_join": "proyek_id", "column_results": ["kode_sortname", "nama"] }], "orders": { "columns": [ "id" @@ -158,20 +147,7 @@ function searchDocuments(activity_id) { data: JSON.stringify(payload) }) .done(function( msg ) { - console.log('done search documents', msg) var documents = msg && msg.data; - // var contents = ''; - // if (documents.length > 0) { - // contents += '
'; - // for (var i=0; i < documents.length; i++) { - // // contents += '
'; - // // contents += '
'+comments[i].created_by+' • '+moment(comments[i].created_at).format('DD-MM-YYYY HH:mm:ss')+'
'; - // // contents += '
'+comments[i].comment+'
'; - // // contents += '
'; - - // } - // contents += '
'; - // } $("#documents_table").DataTable().destroy(); $('#documents_table').DataTable({ data: documents, @@ -191,17 +167,12 @@ function searchDocuments(activity_id) { }, ] }); - // $("#documents_list").html(contents); - }) - .fail(function(xhr, status, error) { - // error handling - console.log('error document search', status); }); } async function downloadDocument(id, name) { let result; - await fetch(DOCUMENT_DOWNLOAD_URL(id, company_id), { + await fetch(DOCUMENT_DOWNLOAD_URL(id), { headers: new Headers({ 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` @@ -243,9 +214,8 @@ async function deleteDocument(id, activity_id) { callback: async function(result){ // result is true / false; if (result) { - console.log('download document', id); const result = await axiosInstance - .delete(DOCUMENT_DELETE_URL(id, company_id)) + .delete(DOCUMENT_DELETE_URL(id)) .then(res => res) .catch((error) => error.response); diff --git a/edit-mode/function/ganttConfig.js b/edit-mode/function/ganttConfig.js index 48ab3d1..0a22727 100644 --- a/edit-mode/function/ganttConfig.js +++ b/edit-mode/function/ganttConfig.js @@ -4,7 +4,6 @@ const proyekId = getUrlParameter("proyek_id"); const timestamp = getUrlParameter("timestamp"); let base_url = getUrlParameter("base_url"); const role_name = getUrlParameter("role_name"); -const company_id = getUrlParameter("company_id"); const company_name = getUrlParameter("company_name"); const base_url_image = `https://project-api.ospro.id/assets/${company_name}/`; const ganttName = getUrlParameter("gantt_name"); @@ -295,14 +294,14 @@ var allColumns = [ editor: editor.text, resize: true, template: function (text) { - function truncateText(text, maxLength) { - if (text.length > maxLength) { - return text.substring(0, maxLength) + '...'; - } - return text; - } - const truncatedText = truncateText(text.text, 30); - return `${truncatedText}`; + // function truncateText(text, maxLength) { + // if (text.length > maxLength) { + // return text.substring(0, maxLength) + '...'; + // } + // return text; + // } + // const truncatedText = truncateText(text.text, 30); + return `${text.text}`; } }, { diff --git a/edit-mode/function/ganttSettings.js b/edit-mode/function/ganttSettings.js index f365735..3c43dfc 100644 --- a/edit-mode/function/ganttSettings.js +++ b/edit-mode/function/ganttSettings.js @@ -1,524 +1,511 @@ -// set work days - -// gantt.setWorkTime({ day:1, hours:false }); - -const VERSION_GANTT_EDIT_URL = `${base_url}version-gantt/edit/${ganttId}`; -const VERSION_GANTT_UPDATE_URL = `${base_url}version-gantt/update/${ganttId}`; -const ACTIVITY_SET_BASELINE_URL = `${base_url}project/set-baseline/${ganttId}`; -const ACTIVITY_SET_BASELINE_ACTIVITY_URL = (id) => { - return `${base_url}project/set-baseline-activity/${id}/${ganttId}`; -} -const ACTIVITY_SYNCHRONIZE_REPORT_URL = `${base_url}project/synchronize-report/${ganttId}`; -let projectId = getUrlParameter("proyek_id"); -var toggleTasks = "Collapse"; -var isBaselineSet = false; -var daysObj = [ - { - text: "Sunday", - value: "0" - }, - { - text: "Monday", - value: "1" - }, - { - text: "Tuesday", - value: "2" - }, - { - text: "Wednesday", - value: "3" - }, - { - text: "Thursday", - value: "4" - }, - { - text: "Friday", - value: "5" - }, - { - text: "Saturday", - value: "6" - } -]; -var days = [0, 1, 2, 3, 4, 5, 6]; // Sunday -> Saturday - -var selectDayOffChoices = null; - -$(document).ready(function () { - // init select multiple workdays - selectDayOffChoices = new Choices('#select_dayoff', { - removeItemButton: true, - shouldSort: false - // maxItemCount: 5, - // searchResultLimit: 5, - // renderChoiceLimit: 5 - }); - - $('#gantt_setting_btn').on('click', async function () { - const result = await axiosInstance - .get(VERSION_GANTT_EDIT_URL, HEADER) - .then(res => res) - .catch((error) => error.response); - - if (result && result.status == 200) { - if (result.data && result.data.data) { - var config_dayoff = null; - if (result.data.data.config_dayoff !== null) { - config_dayoff = result.data.data.config_dayoff; - - if (config_dayoff && config_dayoff.length > 0) { - var config_dayoff_arr = config_dayoff.split(','); - for (var i = 0; i < config_dayoff_arr.length; i++) { - var day = daysObj.find(o => parseInt(o.value) === parseInt(config_dayoff_arr[i])); - selectDayOffChoices.setChoiceByValue(day.value); - } - } - } - } - } else { - gantt.alert({ type: "error", text: "Failed to get settings. Please check your internet connection." }); - } - $('#modal_gantt_setting').modal('show'); - }); - - $('#btn_save_setting').on('click', async function () { - var holidays = []; - var dayoff = $('#select_dayoff').val(); - var costToComplete = $("#costToCompleteBox").val(); - var committedCost = $("#committedCostBox").val(); - - dayoff = dayoff.map(item => parseInt(item)); - var workdays = _.difference(days, dayoff); - - // reset the dayoff first - for (var i = 0; i < days.length; i++) { - gantt.unsetWorkTime({ day: days[i], hours: false }); - } - - if (dayoff.length > 0) { - for (var i = 0; i < dayoff.length; i++) { - gantt.setWorkTime({ day: dayoff[i], hours: false }); - } - } - - let payload = { - "config_dayoff": dayoff.join(','), - "cost_to_complete": costToComplete ? costToComplete : 0, - "committed_cost": committedCost ? committedCost : 0 - } - - const result = await axiosInstance - .put(VERSION_GANTT_UPDATE_URL, payload, HEADER) - .then(res => res) - .catch((error) => error.response); - if (result && result.status === 200) { - $('#modal_gantt_setting').modal('hide'); - gantt.message("Settings updated"); - refresData(); - } - else { - gantt.alert({ type: "error", text: "Failed to update setting" }); - } - - gantt.render(); - - }); - - $("#gantt_toggle_task_btn").on('click', function (event) { - toggleCollapseTasks(); - }); - - $("#dashboard-project").on('click', function (event) { - window.location.href = `https://si.ospro.id/#/dashboard-project/${projectId}/${ganttId}false-header`; - // window.location.href = `http://localhost:3000/#/dashboard-project/${projectId}/${ganttId}/false-header`; - }); - - $("#gantt-baseline").on('click', function (event) { - setBaseline(); - }); - - $("#save-activity").on('click', function (event) { - batchUpdate(); - }); - - $("#gantt-synchronize").on('click', function (event) { - setSynchronize(); - }); - - $("#compare-data").on('click', function (event) { - compareData(ganttTask); - }); - - $("#update-schedule").on('click', function (event) { - updateSchedule(); - }); - - initHolidays(); - initGanttSettings(); -}); - -async function initHolidays() { - let payload = { - "columns": [ - { "name": "version_gantt_id", "logic_operator": "=", "value": ganttId }, - { "name": "proyek_id", "logic_operator": "=", "value": proyekId } - ], - "joins": [], - "orders": { "columns": ["date"], "ascending": true }, - "paging": { "start": 0, "length": -1 } - } - - $.ajax({ - data: JSON.stringify(payload), - url: `${base_url}holiday/search`, - type: "POST", - success: function (result) { - let dataHolidays = result.data || [] - dataHolidays.map((val, index) => { - var a = moment(val.date); - var b = moment(a).add(val.duration, 'days'); - for (var m = moment(a); m.isBefore(b); m.add(1, 'days')) { - let holiday = new Date(m.format('YYYY-MM-DD')); - console.log("holiday", holiday); - gantt.setWorkTime({ - date: holiday, - hours: false - }); - } - }); - gantt.render(); - }, - }); -} - -async function initGanttSettings() { - $("#scale1").attr('checked', true); - - // init to gantt chart view (holidays) - const result = await axiosInstance - .get(VERSION_GANTT_EDIT_URL, HEADER) - .then(res => res) - .catch((error) => error.response); - - if (result && result.status == 200) { - var config_dayoff = result.data.data.config_dayoff; - var type_gantt = result.data.data.calculation_type; - reRenderColumns(type_gantt); - var dayoff = []; - if (config_dayoff && config_dayoff.length > 0) { - dayoff = config_dayoff.split(','); - } - - // reset the dayoff first - for (var i = 0; i < days.length; i++) { - gantt.unsetWorkTime({ day: days[i], hours: false }); - } - - if (dayoff.length > 0) { - for (var i = 0; i < dayoff.length; i++) { - gantt.setWorkTime({ day: dayoff[i], hours: false }); - } - } - // for (let index = 1; index <= 7; index++) { - // const dateToCheck = new Date(2023, 4, index); // Note: Month is 0-based, so 5 represents June - // if (gantt.isWorkTime({ date: dateToCheck, hours: false })) { - // console.log(dateToCheck.toString() + ' is work time.'); - // } else { - // console.log(dateToCheck.toString() + ' is not work time.'); - // } - // } - } -} - -function expandTask() { - console.log("check expandTask") - gantt.eachTask(function (task) { - task.$open = true; - }); - // updateProperty({task_open:true}) - toggleTasks = "Collapse"; - $("#gantt_toggle_task_btn").prop('title', 'Collapse Activities'); - $("#gantt_toggle_task_btn").children().removeClass('fa-expand-alt'); - $("#gantt_toggle_task_btn").children().addClass('fa-compress-alt'); - gantt.render(); -} - -function toggleCollapseTasks() { - // collapse task / activity - console.log('toggleCollapseTasks'); - gantt.eachTask(function (task) { - task.$open = toggleTasks == "Expand"; - }); - if (toggleTasks == "Expand") { - updateProperty({ task_open: true }) - // console.log('to collapse'); - toggleTasks = "Collapse"; - $("#gantt_toggle_task_btn").prop('title', 'Collapse Activities'); - $("#gantt_toggle_task_btn").children().removeClass('fa-expand-alt'); - $("#gantt_toggle_task_btn").children().addClass('fa-compress-alt'); // change icon to collapse - } else { - // console.log('to expand'); - updateProperty({ task_open: false }) - toggleTasks = "Expand"; - $("#gantt_toggle_task_btn").prop('title', 'Expand Activities'); - $("#gantt_toggle_task_btn").children().removeClass('fa-compress-alt'); - $("#gantt_toggle_task_btn").children().addClass('fa-expand-alt'); // change icon to expand - } - gantt.render(); - setGanttOpen(); -} - - -// Function Show / Hide Columns -function getColumnsSelection(node) { - var selectedColumns = node.querySelectorAll(":checked"); - var unselectedColumn = node.querySelectorAll('input[type="checkbox"]:not(:checked)'); - // var allSelected = node.querySelector("#check-all").prop('checked'); - // console.log("unselectedColumn", unselectedColumn) - var checkedColumns = {}; - selectedColumns.forEach(function (node) { - checkedColumns[node.name] = true; - }); - unselectedColumn.forEach(function (node) { - checkedColumns[node.name] = false; - }); - return checkedColumns; -} - -function populateColumnsDropdown(node) { - var visibleColumns = {}; - // var preventHide = ['action']; - gantt.config.columns.forEach(function (col) { - visibleColumns[col.name] = true; - }); - - var lines = []; - allColumns.forEach(function (col) { - var checked = visibleColumns[col.name] ? "checked" : ""; - // skip action to be pushed - lines.push(``); - }); - node.innerHTML = 'Show / Hide Columns
' + lines.join("
"); -} - -function getDropdownNode() { - return document.querySelector("#gantt_dropdown"); -} - -gantt.$showDropdown = function (node) { - var position = node.getBoundingClientRect(); - var dropDown = getDropdownNode(); - dropDown.style.top = position.bottom + "px"; - dropDown.style.left = position.left - 150 + "px"; - dropDown.style.display = "block"; - populateColumnsDropdown(dropDown); - - dropDown.onchange = function () { - var selection = getColumnsSelection(dropDown); - if (readOnly && parseInt(readOnly) == 0) { - updateShowHideColumn(selection) - } - gantt.config.columns = createColumnsConfig(selection); - gantt.render(); - } - - dropDown.keep = true; - setTimeout(function () { - dropDown.keep = false; - }) -} - -gantt.$hideDropdown = function () { - var dropDown = getDropdownNode(); - dropDown.style.display = "none"; -} - -window.addEventListener("click", function (event) { - if (!event.target.closest("#gantt_dropdown") && !getDropdownNode().keep) { - gantt.$hideDropdown(); - } -}); - -// End Function Show / Hide Columns - - -// Set Baseline -function setBaseline() { - var box = gantt.confirm({ - text: "Set Baseline for this gantt chart?", - ok: "Yes", - cancel: "No", - callback: async function (result) { - if (result) { - // gantt.message("Yes!"); - // send to API - await setBaselineAPI(); - } else { - // gantt.message("No..."); - } - } - }); -} - -// Set Baseline Activity -function setBaselineActivity(activity_id, name) { - var box = gantt.confirm({ - text: `Set Baseline for this activity ${name}?`, - ok: "Yes", - cancel: "No", - callback: async function (result) { - if (result) { - await setBaselineActivityAPI(activity_id); - } - } - }); -} - -async function importUpdate() { - 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"); - const response = await gantt.ajax.post({ - headers: { - "Content-Type": "application/json", - "Authorization": `Bearer ${token}` - }, - url: `${base_url}activity/import-update`, - dataType: "json", - data: JSON.stringify(allTasks) - }).then(function (response) { - $("body").removeClass("loading"); - let res = response.responseText - res = JSON.parse(res) - }).catch(function (error) { - $("body").removeClass("loading"); - gantt.alert({ - title: "Peringatan", - type: "alert-error", - text: "Update import gagal" - }); - }); -} - -async function setBaselineActivityAPI(activity_id) { - await importUpdate(); - const res = await axiosInstance - .get(ACTIVITY_SET_BASELINE_ACTIVITY_URL(activity_id), HEADER) - .then(res => res) - .catch((error) => error.response); - if (res && res.status === 200) { - gantt.message("Set baseline activity success!"); - window.location.reload(); - } else { - $("body").removeClass("loading"); - gantt.alert({ type: "error", text: "Failed to set baseline activity" }); - } - gantt.render(); -} - -async function setBaselineAPI() { - await importUpdate(); - const res = await axiosInstance - .get(ACTIVITY_SET_BASELINE_URL, HEADER) - .then(res => res) - .catch((error) => error.response); - console.log('set baseline res', res); - if (res && res.status === 200) { - // $('#modal_gantt_setting').modal('hide'); - // gantt.alert("Settings updated"); - // gantt.message(result.data.message); - gantt.message("Set baseline success!"); - window.location.reload(); - } - else { - $("body").removeClass("loading"); - gantt.alert({ type: "error", text: "Failed to set baseline" }); - } - gantt.render(); -} - -function setSynchronize() { - if (!isBaselineSet) { - // gantt.alert({ - // title:"Synchronize to Report", - // type:"alert-error", - // text:"Please set baseline before continue." - // }); - gantt.confirm({ - text: "Plase set baseline before continue.", - ok: "Set Baseline", - cancel: "Cancel", - callback: async function (result) { - if (result) { - await setBaselineAPI(); - } - } - }); - return false; - } - - var box = gantt.confirm({ - text: "Synchronize to Report Activity?", - ok: "Yes", - cancel: "No", - callback: async function (result) { - if (result) { - // gantt.message("Yes!"); - // send to API - await setSynchronizeAPI() - } else { - // gantt.message("No..."); - } - } - }); -} - -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) - .then(res => res) - .catch((error) => error.response); - - console.log('synchronize res', res); - if (res && res.status === 200) { - // $('#modal_gantt_setting').modal('hide'); - // gantt.alert("Settings updated"); - // gantt.message(result.data.message); - gantt.message("Synchronize to Report success!"); - window.location.reload(); - } - else { - gantt.alert({ type: "error", text: "Failed to Synchronize to Report" }); - } - gantt.render(); -} +// set work days + +// gantt.setWorkTime({ day:1, hours:false }); + +const VERSION_GANTT_EDIT_URL = `${base_url}version-gantt/edit/${ganttId}`; +const VERSION_GANTT_UPDATE_URL = `${base_url}version-gantt/update/${ganttId}`; +const ACTIVITY_SET_BASELINE_URL = `${base_url}project/set-baseline/${ganttId}`; +const ACTIVITY_SET_BASELINE_ACTIVITY_URL = (id) => { + return `${base_url}project/set-baseline-activity/${id}/${ganttId}`; +} +const ACTIVITY_SYNCHRONIZE_REPORT_URL = `${base_url}project/synchronize-report/${ganttId}`; +let projectId = getUrlParameter("proyek_id"); +var toggleTasks = "Collapse"; +var isBaselineSet = false; +var daysObj = [ + { + text: "Sunday", + value: "0" + }, + { + text: "Monday", + value: "1" + }, + { + text: "Tuesday", + value: "2" + }, + { + text: "Wednesday", + value: "3" + }, + { + text: "Thursday", + value: "4" + }, + { + text: "Friday", + value: "5" + }, + { + text: "Saturday", + value: "6" + } +]; +var days = [0, 1, 2, 3, 4, 5, 6]; // Sunday -> Saturday + +var selectDayOffChoices = null; + +$(document).ready(function () { + // init select multiple workdays + selectDayOffChoices = new Choices('#select_dayoff', { + removeItemButton: true, + shouldSort: false + // maxItemCount: 5, + // searchResultLimit: 5, + // renderChoiceLimit: 5 + }); + + $('#gantt_setting_btn').on('click', async function () { + const result = await axiosInstance + .get(VERSION_GANTT_EDIT_URL, HEADER) + .then(res => res) + .catch((error) => error.response); + + if (result && result.status == 200) { + if (result.data && result.data.data) { + var config_dayoff = null; + + if (result.data.data.config_dayoff !== null) { + config_dayoff = result.data.data.config_dayoff; + + if (config_dayoff && config_dayoff.length > 0) { + var config_dayoff_arr = config_dayoff.split(','); + for (var i = 0; i < config_dayoff_arr.length; i++) { + var day = daysObj.find(o => parseInt(o.value) === parseInt(config_dayoff_arr[i])); + selectDayOffChoices.setChoiceByValue(day.value); + } + } + } + } + } else { + gantt.alert({ type: "error", text: "Failed to get settings. Please check your internet connection." }); + } + $('#modal_gantt_setting').modal('show'); + }); + + $('#btn_save_setting').on('click', async function () { + var holidays = []; + var dayoff = $('#select_dayoff').val(); + var costToComplete = $("#costToCompleteBox").val(); + var committedCost = $("#committedCostBox").val(); + + dayoff = dayoff.map(item => parseInt(item)); + var workdays = _.difference(days, dayoff); + + // reset the dayoff first + for (var i = 0; i < days.length; i++) { + gantt.unsetWorkTime({ day: days[i], hours: false }); + } + + if (dayoff.length > 0) { + for (var i = 0; i < dayoff.length; i++) { + gantt.setWorkTime({ day: dayoff[i], hours: false }); + } + } + + let payload = { + "config_dayoff": dayoff.join(','), + "cost_to_complete": costToComplete ? costToComplete : 0, + "committed_cost": committedCost ? committedCost : 0 + } + + const result = await axiosInstance + .put(VERSION_GANTT_UPDATE_URL, payload, HEADER) + .then(res => res) + .catch((error) => error.response); + if (result && result.status === 200) { + $('#modal_gantt_setting').modal('hide'); + gantt.message("Settings updated"); + refresData(); + } + else { + gantt.alert({ type: "error", text: "Failed to update setting" }); + } + + gantt.render(); + + }); + $("#gantt_toggle_task_btn").on('click', function (event) { + toggleCollapseTasks(); + }); + + $("#dashboard-project").on('click', function (event) { + window.location.href = `https://si.ospro.id/#/dashboard-project/${projectId}/${ganttId}?dashboardGantt=${true}`; + // window.location.href = `http://localhost:3000/#/dashboard-project/${projectId}/${ganttId}?dashboardGantt=${true}`; + }); + + $("#gantt-baseline").on('click', function (event) { + setBaseline(); + }); + + $("#save-activity").on('click', function (event) { + batchUpdate(); + }); + + $("#gantt-synchronize").on('click', function (event) { + setSynchronize(); + }); + + $("#compare-data").on('click', function (event) { + compareData(ganttTask); + }); + + $("#update-schedule").on('click', function (event) { + updateSchedule(); + }); + + initHolidays(); + initGanttSettings(); +}); + +async function initHolidays() { + let payload = { + "columns": [ + { "name": "version_gantt_id", "logic_operator": "=", "value": ganttId }, + { "name": "proyek_id", "logic_operator": "=", "value": proyekId } + ], + "joins": [], + "orders": { "columns": ["date"], "ascending": true }, + "paging": { "start": 0, "length": -1 } + } + + $.ajax({ + data: JSON.stringify(payload), + url: `${base_url}holiday/search`, + type: "POST", + success: function (result) { + let dataHolidays = result.data || [] + dataHolidays.map((val, index) => { + var a = moment(val.date); + var b = moment(a).add(val.duration, 'days'); + for (var m = moment(a); m.isBefore(b); m.add(1, 'days')) { + let holiday = new Date(m.format('YYYY-MM-DD')); + gantt.setWorkTime({ + date: holiday, + hours: false + }); + } + }); + gantt.render(); + }, + }); +} + +async function initGanttSettings() { + $("#scale1").attr('checked', true); + + // init to gantt chart view (holidays) + const result = await axiosInstance + .get(VERSION_GANTT_EDIT_URL, HEADER) + .then(res => res) + .catch((error) => error.response); + + if (result && result.status == 200) { + var config_dayoff = result.data.data.config_dayoff; + var type_gantt = result.data.data.calculation_type; + const ganttName = result.data.data.name_version; + + document.getElementById("project-name-header").textContent = ganttName; + reRenderColumns(type_gantt); + var dayoff = []; + if (config_dayoff && config_dayoff.length > 0) { + dayoff = config_dayoff.split(','); + } + + // reset the dayoff first + for (var i = 0; i < days.length; i++) { + gantt.unsetWorkTime({ day: days[i], hours: false }); + } + + if (dayoff.length > 0) { + for (var i = 0; i < dayoff.length; i++) { + gantt.setWorkTime({ day: dayoff[i], hours: false }); + } + } + } +} + +function expandTask() { + gantt.eachTask(function (task) { + task.$open = true; + }); + // updateProperty({task_open:true}) + toggleTasks = "Collapse"; + $("#gantt_toggle_task_btn").prop('title', 'Collapse Activities'); + $("#gantt_toggle_task_btn").children().removeClass('fa-expand-alt'); + $("#gantt_toggle_task_btn").children().addClass('fa-compress-alt'); + gantt.render(); +} + +function toggleCollapseTasks() { + // collapse task / activity + gantt.eachTask(function (task) { + task.$open = toggleTasks == "Expand"; + }); + if (toggleTasks == "Expand") { + updateProperty({ task_open: true }) + toggleTasks = "Collapse"; + $("#gantt_toggle_task_btn").prop('title', 'Collapse Activities'); + $("#gantt_toggle_task_btn").children().removeClass('fa-expand-alt'); + $("#gantt_toggle_task_btn").children().addClass('fa-compress-alt'); // change icon to collapse + } else { + updateProperty({ task_open: false }) + toggleTasks = "Expand"; + $("#gantt_toggle_task_btn").prop('title', 'Expand Activities'); + $("#gantt_toggle_task_btn").children().removeClass('fa-compress-alt'); + $("#gantt_toggle_task_btn").children().addClass('fa-expand-alt'); // change icon to expand + } + gantt.render(); + setGanttOpen(); +} + + +// Function Show / Hide Columns +function getColumnsSelection(node) { + var selectedColumns = node.querySelectorAll(":checked"); + var unselectedColumn = node.querySelectorAll('input[type="checkbox"]:not(:checked)'); + // var allSelected = node.querySelector("#check-all").prop('checked'); + var checkedColumns = {}; + selectedColumns.forEach(function (node) { + checkedColumns[node.name] = true; + }); + unselectedColumn.forEach(function (node) { + checkedColumns[node.name] = false; + }); + return checkedColumns; +} + +function populateColumnsDropdown(node) { + var visibleColumns = {}; + // var preventHide = ['action']; + gantt.config.columns.forEach(function (col) { + visibleColumns[col.name] = true; + }); + + var lines = []; + allColumns.forEach(function (col) { + var checked = visibleColumns[col.name] ? "checked" : ""; + // skip action to be pushed + lines.push(``); + }); + node.innerHTML = 'Show / Hide Columns
' + lines.join("
"); +} + +function getDropdownNode() { + return document.querySelector("#gantt_dropdown"); +} + +gantt.$showDropdown = function (node) { + var position = node.getBoundingClientRect(); + var dropDown = getDropdownNode(); + dropDown.style.top = position.bottom + "px"; + dropDown.style.left = position.left - 150 + "px"; + dropDown.style.display = "block"; + populateColumnsDropdown(dropDown); + + dropDown.onchange = function () { + var selection = getColumnsSelection(dropDown); + if (readOnly && parseInt(readOnly) == 0) { + updateShowHideColumn(selection) + } + gantt.config.columns = createColumnsConfig(selection); + gantt.render(); + } + + dropDown.keep = true; + setTimeout(function () { + dropDown.keep = false; + }) +} + +gantt.$hideDropdown = function () { + var dropDown = getDropdownNode(); + dropDown.style.display = "none"; +} + +window.addEventListener("click", function (event) { + if (!event.target.closest("#gantt_dropdown") && !getDropdownNode().keep) { + gantt.$hideDropdown(); + } +}); + +// End Function Show / Hide Columns + + +// Set Baseline +function setBaseline() { + var box = gantt.confirm({ + text: "Set Baseline for this gantt chart?", + ok: "Yes", + cancel: "No", + callback: async function (result) { + if (result) { + // gantt.message("Yes!"); + // send to API + await setBaselineAPI(); + } else { + // gantt.message("No..."); + } + } + }); +} + +// Set Baseline Activity +function setBaselineActivity(activity_id, name) { + var box = gantt.confirm({ + text: `Set Baseline for this activity ${name}?`, + ok: "Yes", + cancel: "No", + callback: async function (result) { + if (result) { + await setBaselineActivityAPI(activity_id); + } + } + }); +} + +async function importUpdate() { + 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"); + const response = await gantt.ajax.post({ + headers: { + "Content-Type": "application/json", + "Authorization": `Bearer ${token}` + }, + url: `${base_url}activity/import-update`, + dataType: "json", + data: JSON.stringify(allTasks) + }).then(function (response) { + $("body").removeClass("loading"); + let res = response.responseText + res = JSON.parse(res) + }).catch(function (error) { + $("body").removeClass("loading"); + gantt.alert({ + title: "Peringatan", + type: "alert-error", + text: "Update import gagal" + }); + }); +} + +async function setBaselineActivityAPI(activity_id) { + await importUpdate(); + const res = await axiosInstance + .get(ACTIVITY_SET_BASELINE_ACTIVITY_URL(activity_id), HEADER) + .then(res => res) + .catch((error) => error.response); + if (res && res.status === 200) { + gantt.message("Set baseline activity success!"); + window.location.reload(); + } else { + $("body").removeClass("loading"); + gantt.alert({ type: "error", text: "Failed to set baseline activity" }); + } + gantt.render(); +} + +async function setBaselineAPI() { + await importUpdate(); + const res = await axiosInstance + .get(ACTIVITY_SET_BASELINE_URL, HEADER) + .then(res => res) + .catch((error) => error.response); + if (res && res.status === 200) { + // $('#modal_gantt_setting').modal('hide'); + // gantt.alert("Settings updated"); + // gantt.message(result.data.message); + gantt.message("Set baseline success!"); + window.location.reload(); + } + else { + $("body").removeClass("loading"); + gantt.alert({ type: "error", text: "Failed to set baseline" }); + } + gantt.render(); +} + +function setSynchronize() { + if (!isBaselineSet) { + // gantt.alert({ + // title:"Synchronize to Report", + // type:"alert-error", + // text:"Please set baseline before continue." + // }); + gantt.confirm({ + text: "Plase set baseline before continue.", + ok: "Set Baseline", + cancel: "Cancel", + callback: async function (result) { + if (result) { + await setBaselineAPI(); + } + } + }); + return false; + } + + var box = gantt.confirm({ + text: "Synchronize to Report Activity?", + ok: "Yes", + cancel: "No", + callback: async function (result) { + if (result) { + // gantt.message("Yes!"); + // send to API + await setSynchronizeAPI() + } else { + // gantt.message("No..."); + } + } + }); +} + +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) + .then(res => res) + .catch((error) => error.response); + + if (res && res.status === 200) { + // $('#modal_gantt_setting').modal('hide'); + // gantt.alert("Settings updated"); + // gantt.message(result.data.message); + gantt.message("Synchronize to Report success!"); + window.location.reload(); + } + else { + gantt.alert({ type: "error", text: "Failed to Synchronize to Report" }); + } + gantt.render(); +} diff --git a/edit-mode/function/holiday.js b/edit-mode/function/holiday.js index 25a266d..6275243 100644 --- a/edit-mode/function/holiday.js +++ b/edit-mode/function/holiday.js @@ -82,7 +82,6 @@ $(document).ready(function () { var b = moment(a).add(data.duration, 'days'); for (var m = moment(a); m.isBefore(b); m.add(1, 'days')) { let holiday = new Date(m.format('YYYY-MM-DD')); - // console.log("cek holiday", holiday) gantt.unsetWorkTime({ date: holiday, hours:false @@ -97,7 +96,6 @@ $(document).ready(function () { url: `${base_url}holiday/delete/${id}`, type:"DELETE", success: function (data) { - // console.log("cek data", data.data); gantt.alert("Delete Holiday Success!"); tableHoliday.draw(); if(data.data){ diff --git a/edit-mode/function/humanResource.js b/edit-mode/function/humanResource.js index e145c04..b8804fb 100644 --- a/edit-mode/function/humanResource.js +++ b/edit-mode/function/humanResource.js @@ -113,7 +113,6 @@ $(document).ready(function () { processResults: function (result) { return { results: $.map(result, function (item) { - // console.log("cek item", item) return { text: item.name, id: item.id @@ -143,7 +142,6 @@ $(document).ready(function () { processResults: function (result) { return { results: $.map(result, function (item) { - // console.log("cek item", item) return { text: item.name, id: item.id + "|" + item.proyek_role, diff --git a/edit-mode/function/materialResource.js b/edit-mode/function/materialResource.js index 4671f3e..5ecd7dc 100644 --- a/edit-mode/function/materialResource.js +++ b/edit-mode/function/materialResource.js @@ -97,9 +97,7 @@ $(document).ready(function () { $('#modal-material').on('hide.bs.modal', function (event) { // $("#hide-form-material").hide(); $("#show-form-material").show(); - console.log("there's before action change ", actionHappen); if (actionHappen) { - console.log("there's action change ", actionHappen); updateActivity(activityId); } resetFormAssignMaterial(); @@ -124,7 +122,6 @@ $(document).ready(function () { processResults: function (result) { return { results: $.map(result, function (item) { - // console.log("cek item", item) return { text: item.description, id: item.id @@ -168,7 +165,6 @@ $(document).ready(function () { results: dataIntegrasiMaterial }; }, error: function (jqXHR, textStatus, errorThrown) { - // console.log("textStatus ", textStatus); if (textStatus != "abort") { // gantt.alert(`Status: ${textStatus}`); gantt.alert(`Data Not Found`); diff --git a/edit-mode/function/milestone.js b/edit-mode/function/milestone.js index bfd7158..d0934fa 100644 --- a/edit-mode/function/milestone.js +++ b/edit-mode/function/milestone.js @@ -1,6 +1,5 @@ var milestoneModal = $('#modal-add-milestone > .modal-dialog > .modal-content'); function addMilestone(id){ - console.log("cek cek id milestone", id); if(id && id > 0){ $("#milestone_parent").val(id); } @@ -41,7 +40,6 @@ $(document).ready(function () { processResults: function (result) { return { results: $.map(result, function (item) { - // console.log("cek item", item) return { due_date:item.due_date, deadline:item.deadline, @@ -94,14 +92,12 @@ $(document).ready(function () { $('#submit-milestone').html('Add..'); $('#submit-milestone').prop("disabled",true); var data = Object.fromEntries(new FormData(this)); - console.log("cek data form", data); let parent = data.milestone_parent; var taskId = 0; var start = moment(data.due_date, "DD-MM-YYYY"); var end = moment(data.deadline, "DD-MM-YYYY"); let duration = moment.duration(start.diff(end)).asDays(); let nameMilestone = data.status!="" ? data.status : data.id_milestone - // console.log("cek duration", Math.abs(duration)); if(parent && parseInt(parent) > 0){ taskId = gantt.addTask({ id: Math.floor(Math.random() * 1000) + 5000, diff --git a/edit-mode/function/modalHumanResourceFunction.js b/edit-mode/function/modalHumanResourceFunction.js index 1d91fbf..22ba6d2 100644 --- a/edit-mode/function/modalHumanResourceFunction.js +++ b/edit-mode/function/modalHumanResourceFunction.js @@ -30,9 +30,7 @@ $(document).ready(function () { "ascending": false } } - // console.log("qry", qry) axiosInstance.post(url, payload, HEADER).then(res => { - console.log('getDataHumanResource', res) DATA_HUMAN_RESOURCE = res.data.data // arr.forEach(function (element, key) { // $('#choices-multiple-remove-button1').append(``) @@ -56,9 +54,7 @@ $(document).ready(function () { "joins": [], "orders": { "columns": ["id"], "ascending": false } } - // console.log("qry", qry) axiosInstance.post(url, payload, HEADER).then(res => { - console.log(res) DATA_ROLE_HUMAN_RESOURCE = res.data.data }); } @@ -93,7 +89,6 @@ $(document).ready(function () { // } // } // axiosInstance.post(url, payload, HEADER).then(res => { - // console.log(res) // DATA_MATERIAL_RESOURCE = res.data.data // }); // } @@ -121,7 +116,6 @@ $(document).ready(function () { // } // } // axiosInstance.post(url, payload, HEADER).then(res => { - // console.log(res) // const arr = res.data.data // DATA_TOOL_RESOURCE = res.data.data // arr.forEach(function (element, key) { @@ -134,7 +128,6 @@ $(document).ready(function () { // } $('#human-resource').on('show.bs.modal', function (event) { - // console.log("open modal human resource") getDataHumanResource() getDataRole() // getDataMaterials() @@ -149,7 +142,6 @@ $(document).ready(function () { $("#add-human-resource").on('click', function () { const num = $('#table-human-resource tr').length - console.log(num) const idx = num + 1 $('#table-human-resource').append(` @@ -182,13 +174,11 @@ $(document).ready(function () { $('#table-human-resource').on('click', '.human-resource-delete', function (event) { const idx = $(this).attr("index") - console.log(idx) $(`#row-human-resource-${idx}`).remove() }) // $("#add-material-resource").on('click', function () { // const num = $('#table-material-resource tr').length - // console.log(num) // const idx = num + 1 // $('#table-material-resource').append(` // @@ -216,13 +206,11 @@ $(document).ready(function () { // $('#table-material-resource').on('click', '#material-resource-delete', function (event) { // const idx = $(this).attr("index") - // console.log(idx) // $(`#row-material-resource-${idx}`).remove() // }) // $("#add-tool-resource").on('click', function () { // const num = $('#table-tool-resource tr').length - // console.log(num) // const idx = num + 1 // $('#table-tool-resource').append(` // @@ -250,13 +238,11 @@ $(document).ready(function () { // $('#table-tool-resource').on('click', '#tool-resource-delete', function (event) { // const idx = $(this).attr("index") - // console.log(idx) // $(`#row-tool-resource-${idx}`).remove() // }) $(".submit-human-resource").on('click', function () { - console.log('onclick submit human resource'); // addComments(); let valueHumanResource = [] const num = $('#table-human-resource tr').length @@ -269,8 +255,6 @@ $(document).ready(function () { } valueHumanResource.push(obj) } - console.log("cek value", valueHumanResource) - // let valueMaterialResource = [] // const numMaterial = $('#table-material-resource tr').length // for (let i = 0; i < numMaterial; i++) { @@ -282,7 +266,6 @@ $(document).ready(function () { // } // valueMaterialResource.push(obj) // } - // console.log(valueMaterialResource) // let valueToolResource = [] // const numTool = $('#table-tool-resource tr').length @@ -295,11 +278,9 @@ $(document).ready(function () { // } // valueToolResource.push(obj) // } - // console.log(valueToolResource) // const cost = $(`#cost-human-resource`).val() // const duration = $(`#duration-human-resource`).val() // const dateStart = $(`#date-started-human-started`).val() - // console.log({ cost, duration, dateStart }) // $("#exampleModal").modal('hide'); }); diff --git a/edit-mode/function/reportActivity.js b/edit-mode/function/reportActivity.js index 793e00a..9bb2862 100644 --- a/edit-mode/function/reportActivity.js +++ b/edit-mode/function/reportActivity.js @@ -654,7 +654,7 @@ $(document).ready(function () { function deleteRaMaterial(id) { searchReport(assignMaterialId, false); $.ajax({ - url: `${base_url}report-activity-material/delete/${id}/${company_id}`, + url: `${base_url}report-activity-material/delete/${id}`, type: "DELETE", success: function (data) { actionHappen = true; diff --git a/edit-mode/function/restActivityLink.js b/edit-mode/function/restActivityLink.js index 66e68ed..0415daa 100644 --- a/edit-mode/function/restActivityLink.js +++ b/edit-mode/function/restActivityLink.js @@ -59,8 +59,6 @@ gantt.ajax.get({ }); function refresData(id) { - console.log("refres triggered!!"); - // Store the current scroll position var scrollState = { x: gantt.getScrollState().x, diff --git a/edit-mode/function/toolsResource.js b/edit-mode/function/toolsResource.js index e0faa96..a9c5a80 100644 --- a/edit-mode/function/toolsResource.js +++ b/edit-mode/function/toolsResource.js @@ -94,7 +94,6 @@ $(document).ready(function () { processResults: function (result) { return { results: $.map(result, function (item) { - // console.log("cek item", item) return { text: item.name, id: item.id @@ -143,7 +142,6 @@ $(document).ready(function () { processData: false, contentType: false, success: function (data) { - console.log('response data', data); if (data && data.code === 200) { actionHappen = true; gantt.alert("Tools Assign Success!"); diff --git a/edit-mode/index.html b/edit-mode/index.html index 50d5732..a175110 100644 --- a/edit-mode/index.html +++ b/edit-mode/index.html @@ -67,7 +67,7 @@
-
+
Zoom:
diff --git a/view-mode/function/activityLocation.js b/view-mode/function/activityLocation.js index 742ef24..65aac17 100644 --- a/view-mode/function/activityLocation.js +++ b/view-mode/function/activityLocation.js @@ -49,12 +49,10 @@ function openActivityMap(id) type:"get", success: function (data) { let dataRes = data.data - // console.log("cek data", data); drawnItem.clearLayers(); if(dataRes.geom){ let datageojson = JSON.parse(dataRes.geom); currentGeoJson = datageojson - // console.log("cek data geojson", datageojson); if(datageojson.properties.radius){ let radius = datageojson.properties.radius let lGeoJson = L.geoJson(datageojson); @@ -62,7 +60,6 @@ function openActivityMap(id) let latlon = layers[0].getLatLng(); let newCircle = L.circle([latlon.lat,latlon.lng], {radius: radius}); drawnItem.addLayer(newCircle); - // console.log("cek layers", layers[0]); }else{ let lGeoJson = L.geoJson(datageojson); let layers = lGeoJson.getLayers(); @@ -109,19 +106,16 @@ $(document).ready(function () { layer = e.layer; if (type === 'marker') { let latlong = layer.getLatLng(); - // console.log("cek latlong", latlong); circLat = latlong.lat circLong = latlong.lng $("#modal_radius").modal("show"); // Do marker specific actions // let attri = layer.getAttribution(); - // console.log("cek attribute", attri); return false; } let geJson = layer.toGeoJSON(); currentGeoJson = geJson; // let lgeojson = L.geoJson(geJson) - // console.log("cek layer", layer.toGeoJSON()); // layer.bindTooltip("cek"); // Do whatever else you need to. (save to db; add to map etc) drawnItem.addLayer(layer); @@ -134,7 +128,6 @@ $(document).ready(function () { var type = e.layerType, layer = e.layer; - // console.log("cek layer", layer.toGeoJSON()); // Do whatever else you need to. (save to db; add to map etc) currentGeoJson = ""; drawnItem.removeLayer(layer); @@ -155,8 +148,6 @@ $(document).ready(function () { }else{ currentGeoJson = geoJson } - // console.log("cek layer", layers[0].toGeoJSON()); - // console.log("cek layer", layer.toGeoJSON()); // Do whatever else you need to. (save to db; add to map etc) // drawnItem.removeLayer(layer); // drawnControlEdit.remove(); @@ -234,7 +225,6 @@ function submitCircle(radius) let geojsoncircle = circle.toGeoJSON(); geojsoncircle.properties.radius = radius currentGeoJson = geojsoncircle - // console.log("geojsoncircle", geojsoncircle); drawnItem.addLayer(circle); drawControl.remove(); map.addControl(drawnControlEdit); diff --git a/view-mode/function/function.js b/view-mode/function/function.js index 4dac918..c0db38c 100644 --- a/view-mode/function/function.js +++ b/view-mode/function/function.js @@ -485,13 +485,7 @@ function updateShowHideColumn(data) url: `${base_url}gantt-show-hide/update/${ganttId}`, type: "POST", processData: false, - contentType: false, - success: function (data) { - console.log(data); - }, - error: function (data) { - console.log(data); - } + contentType: false }); } diff --git a/view-mode/function/ganttActivityComments.js b/view-mode/function/ganttActivityComments.js index 99ae770..888f8ae 100644 --- a/view-mode/function/ganttActivityComments.js +++ b/view-mode/function/ganttActivityComments.js @@ -4,7 +4,6 @@ const COMMENT_SEARCH_URL = `${base_url}comment-activity/search`; $(document).ready(function() { $(".modal_add_btn_comment").on('click', function() { - console.log('onclick add comments'); addComments(); }); $("#btn_comment_submit").on('click', function() { @@ -15,7 +14,6 @@ $(document).ready(function() { // show comments modal function showComments(id) { var task = gantt.getTaskBy('id', id); - console.log('showComments', task); var activity = task && task.length > 0 ? task[0].text : ''; $("#activity_id").val(id); $("#comments_title").text(activity); @@ -58,7 +56,6 @@ function submitComments() { data: JSON.stringify(payload) }) .done(function( msg ) { - console.log('done submit comment', msg) // gantt.message("Comment posted"); gantt.alert("Comment posted"); $("#add_comment_form").trigger("reset"); @@ -106,8 +103,6 @@ function searchComments(activity_id) { } } - console.log('searchComments payload', payload); - $.ajax({ method: "POST", url: COMMENT_SEARCH_URL, @@ -115,7 +110,6 @@ function searchComments(activity_id) { data: JSON.stringify(payload) }) .done(function( msg ) { - console.log('done search comment', msg) var comments = msg && msg.data; var contents = ''; if (comments.length > 0) { diff --git a/view-mode/function/ganttActivityUploadDoc.js b/view-mode/function/ganttActivityUploadDoc.js index 0490d4e..6563dd5 100644 --- a/view-mode/function/ganttActivityUploadDoc.js +++ b/view-mode/function/ganttActivityUploadDoc.js @@ -1,14 +1,13 @@ // Upload Document Activity const DOCUMENT_UPLOAD_URL = `${base_url}document-activity/upload`; -const DOCUMENT_DOWNLOAD_URL = (id, company_id) => `${base_url}document-activity/download/${id}/${company_id}`; +const DOCUMENT_DOWNLOAD_URL = (id) => `${base_url}document-activity/download/${id}`; const DOCUMENT_SEARCH_URL = `${base_url}document-activity/search`; -const DOCUMENT_DELETE_URL = (id, company_id) => `${base_url}document-activity/delete/${id}/${company_id}`; +const DOCUMENT_DELETE_URL = (id) => `${base_url}document-activity/delete/${id}`; var fileToUpload = null; $(document).ready(function() { $(".modal_add_btn_doc").on('click', function() { - console.log('onclick add document'); addDocuments(); }); @@ -20,31 +19,6 @@ $(document).ready(function() { fileToUpload = e.target.files[0]; }); - // $("#add_doc_form").on('submit', function(e) { - // // submitDocuments(); - // e.preventDefault(); - // console.log(this); - // var formData = new FormData(this); - // console.log('formData', formData); - // $.ajax({ - // method: "POST", - // url: DOCUMENT_UPLOAD_URL, - // data: formData, - // processData: false, - // contentType: false, - // cache: false, - // success: function(msg) { - // console.log('done submit comment', msg) - // $("#add_doc_form").trigger("reset"); - // searchDocuments(activity_id); // reload the contents - // }, - // error: function(xhr, status, error) { - // // error handling - // console.log('error document upload', xhr, status, error); - // } - // }); - // }); - $("#btn_doc_reset").on('click', function() { // $("#add_doc_form").trigger("reset"); }) @@ -57,7 +31,6 @@ $(document).ready(function() { // show comments modal function showDocuments(id) { var task = gantt.getTaskBy('id', id); - console.log('showComments', task); var activity = task && task.length > 0 ? task[0].text : ''; $("#activity_id").val(id); $("#upload_doc_title").text(activity); @@ -96,18 +69,15 @@ async function submitDocuments() { return; } - console.log('fileToUpload', fileToUpload); 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); if(result && result.status==200){ - console.log('done upload doc', result) gantt.alert("Upload Success"); $("#add_doc_form").trigger("reset"); $('#btn_doc_submit').html('Upload'); @@ -157,7 +127,6 @@ function searchDocuments(activity_id) { data: JSON.stringify(payload) }) .done(function( msg ) { - console.log('done search documents', msg) var documents = msg && msg.data; // var contents = ''; // if (documents.length > 0) { @@ -190,17 +159,12 @@ function searchDocuments(activity_id) { }, ] }); - // $("#documents_list").html(contents); - }) - .fail(function(xhr, status, error) { - // error handling - console.log('error document search', status); }); } async function downloadDocument(id, name) { let result; - await fetch(DOCUMENT_DOWNLOAD_URL(id, company_id), { + await fetch(DOCUMENT_DOWNLOAD_URL(id), { headers: new Headers({ 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` @@ -242,9 +206,8 @@ async function deleteDocument(id, activity_id) { callback: async function(result){ // result is true / false; if (result) { - console.log('download document', id); const result = await axiosInstance - .delete(DOCUMENT_DELETE_URL(id, company_id)) + .delete(DOCUMENT_DELETE_URL(id)) .then(res => res) .catch((error) => error.response); diff --git a/view-mode/function/ganttConfig.js b/view-mode/function/ganttConfig.js index ac37726..c2ee8fa 100644 --- a/view-mode/function/ganttConfig.js +++ b/view-mode/function/ganttConfig.js @@ -3,7 +3,6 @@ const readOnly = getUrlParameter("ro"); const proyekId = getUrlParameter("proyek_id"); let base_url = getUrlParameter("base_url"); const role_name = getUrlParameter("role_name"); -const company_id = getUrlParameter("company_id"); const adwIntegrationUrl = "https://adw-api.ospro.id/api"; let userToVersionGanttId = 0 diff --git a/view-mode/function/ganttEvent.js b/view-mode/function/ganttEvent.js index 64aabb7..bcc816b 100644 --- a/view-mode/function/ganttEvent.js +++ b/view-mode/function/ganttEvent.js @@ -19,7 +19,6 @@ gantt.attachEvent("onTaskRowClick", function(id,row){ gantt.ext.inlineEditors.attachEvent("onBeforeEditStart", function(state){ let id = parseInt(state.id) let ganttData = gantt.getTask(id); - // console.log("cek ganttData", ganttData); if(ganttData.type_activity && ganttData.type_activity=="header"){ return false } @@ -32,13 +31,11 @@ gantt.ext.inlineEditors.attachEvent("onBeforeEditStart", function(state){ } if(column=="cost_actual"){ - // let ganttData = gantt.getTask(id); let progress = ganttData.progress ? ganttData.progress : 0 if(progress <= 0){ return false } } - // console.log("cek state", state); return true }); @@ -64,7 +61,6 @@ gantt.attachEvent("onBeforeTaskUpdate", function(id,new_item){ gantt.attachEvent("onBeforeLinkAdd", function(id,link){ //any custom logic here - // console.log("cek link", link); let source = link.source; let target = link.target; let parents = gantt.getParent(source); diff --git a/view-mode/function/ganttSettings.js b/view-mode/function/ganttSettings.js index 6188f82..98511e0 100644 --- a/view-mode/function/ganttSettings.js +++ b/view-mode/function/ganttSettings.js @@ -47,9 +47,6 @@ $(document).ready(function() { selectDayOffChoices = new Choices('#select_dayoff', { removeItemButton: true, shouldSort: false - // maxItemCount: 5, - // searchResultLimit: 5, - // renderChoiceLimit: 5 }); $('#gantt_setting_btn').on('click', async function() { @@ -57,13 +54,9 @@ $(document).ready(function() { .get(VERSION_GANTT_EDIT_URL, HEADER) .then(res => res) .catch((error) => error.response); - - // console.log("get version gantt result", result) - if(result && result.status==200){ if (result.data && result.data.data) { var config_dayoff = null; - // console.log('result.data.data.config_dayoff', result.data.data.config_dayoff) if (result.data.data.config_dayoff !== null) { config_dayoff = result.data.data.config_dayoff; @@ -72,17 +65,13 @@ $(document).ready(function() { for (var i=0; i < config_dayoff_arr.length; i++) { var day = daysObj.find(o => parseInt(o.value) === parseInt(config_dayoff_arr[i])); // $('#select_dayoff option[value='+day.value+']').prop("selected", true); - // console.log('day', day); selectDayOffChoices.setChoiceByValue(day.value); } } } } }else{ - // closeDialog('failed upload') - console.log('failed get version gantt'); gantt.alert({type: "error", text: "Failed to get settings. Please check your internet connection."}); - // alert('Upload failed'); } $('#modal_gantt_setting').modal('show'); }); @@ -103,16 +92,7 @@ $(document).ready(function() { // } var holidays = []; var dayoff = $('#select_dayoff').val(); - // console.log('dayoff', dayoff); - // if (dayoff.length < 1) return alert('Please add a day off'); - dayoff = dayoff.map(item => parseInt(item)); - // console.log('dayoff after', dayoff); - var workdays = _.difference(days, dayoff); - // console.log('workdays', workdays); - - // getCurrentWorkdays(); - // reset the dayoff first for (var i=0; i < days.length; i++) { gantt.unsetWorkTime({day: days[i], hours: false}); @@ -134,8 +114,6 @@ $(document).ready(function() { // } // } - // console.log('dayoff.length', dayoff.length); - if (dayoff.length > 0) { for (var i=0; i < dayoff.length; i++) { gantt.setWorkTime({ day:dayoff[i], hours:false }); @@ -152,13 +130,10 @@ $(document).ready(function() { let payload = { "config_dayoff": dayoff.join(',') } - // console.log('payload', payload); - // console.log('HEADER', HEADER); const result = await axiosInstance .put(VERSION_GANTT_UPDATE_URL, payload, HEADER) .then(res => res) .catch((error) => error.response); - // console.log("update settings result", result) if (result && result.status === 200) { $('#modal_gantt_setting').modal('hide'); // gantt.alert("Settings updated"); @@ -208,7 +183,6 @@ async function initHolidays(){ url: `${base_url}holiday/search`, type: "POST", success: function (result) { - // console.log("cek data", result.data); let dataHolidays = result.data || [] dataHolidays.map((val, index) => { // let day = moment(val.date).format("YYYY-MM-DD"); @@ -216,7 +190,6 @@ async function initHolidays(){ var b = moment(a).add(val.duration, 'days'); for (var m = moment(a); m.isBefore(b); m.add(1, 'days')) { let holiday = new Date(m.format('YYYY-MM-DD')); - // console.log("cek holiday", holiday) gantt.setWorkTime({ date: holiday, hours: false @@ -237,7 +210,6 @@ async function initHolidays(){ } async function initGanttSettings() { - console.log('initGanttSettings'); // if zoom is day $("#scale3").attr('checked', true); // toggleCollapseTasks(); @@ -270,7 +242,6 @@ async function initGanttSettings() { } function expandTask(){ - console.log("check expandTask") gantt.eachTask(function(task){ task.$open = true; }); @@ -284,19 +255,16 @@ function expandTask(){ function toggleCollapseTasks() { // collapse task / activity - console.log('toggleCollapseTasks'); gantt.eachTask(function(task){ task.$open = toggleTasks == "Expand"; }); if (toggleTasks == "Expand") { updateProperty({task_open:true}) - // console.log('to collapse'); toggleTasks = "Collapse"; $("#gantt_toggle_task_btn").prop('title', 'Collapse Activities'); $("#gantt_toggle_task_btn").children().removeClass('fa-expand-alt'); $("#gantt_toggle_task_btn").children().addClass('fa-compress-alt'); // change icon to collapse } else { - // console.log('to expand'); updateProperty({task_open:false}) toggleTasks = "Expand"; $("#gantt_toggle_task_btn").prop('title', 'Expand Activities'); @@ -312,7 +280,6 @@ function getColumnsSelection(node){ var selectedColumns = node.querySelectorAll(":checked"); var unselectedColumn = node.querySelectorAll('input[type="checkbox"]:not(:checked)'); // var allSelected = node.querySelector("#check-all").prop('checked'); - // console.log("unselectedColumn", unselectedColumn) var checkedColumns = {}; selectedColumns.forEach(function(node){ checkedColumns[node.name] = true; @@ -320,7 +287,6 @@ function getColumnsSelection(node){ unselectedColumn.forEach(function(node){ checkedColumns[node.name] = false; }); - // console.log("checkedColumns", checkedColumns) return checkedColumns; } @@ -404,7 +370,6 @@ async function setBaselineAPI() { .get(ACTIVITY_SET_BASELINE_URL, HEADER) .then(res => res) .catch((error) => error.response); - console.log('set baseline res', res); if (res && res.status === 200) { // $('#modal_gantt_setting').modal('hide'); // gantt.alert("Settings updated"); @@ -460,7 +425,6 @@ async function setSynchronizeAPI() { .then(res => res) .catch((error) => error.response); - console.log('synchronize res', res); if (res && res.status === 200) { // $('#modal_gantt_setting').modal('hide'); // gantt.alert("Settings updated"); diff --git a/view-mode/function/holiday.js b/view-mode/function/holiday.js index d93cea4..bf95cda 100644 --- a/view-mode/function/holiday.js +++ b/view-mode/function/holiday.js @@ -76,7 +76,6 @@ $(document).ready(function () { var b = moment(a).add(data.duration, 'days'); for (var m = moment(a); m.isBefore(b); m.add(1, 'days')) { let holiday = new Date(m.format('YYYY-MM-DD')); - // console.log("cek holiday", holiday) gantt.unsetWorkTime({ date: holiday, hours:false @@ -91,7 +90,6 @@ $(document).ready(function () { url: `${base_url}holiday/delete/${id}`, type:"DELETE", success: function (data) { - // console.log("cek data", data.data); gantt.alert("Delete Holiday Success!"); tableHoliday.draw(); if(data.data){ diff --git a/view-mode/function/milestone.js b/view-mode/function/milestone.js index 1d67187..9fce2cf 100644 --- a/view-mode/function/milestone.js +++ b/view-mode/function/milestone.js @@ -1,6 +1,5 @@ var milestoneModal = $('#modal-add-milestone > .modal-dialog > .modal-content'); function addMilestone(id){ - console.log("cek cek id milestone", id); if(id && id > 0){ $("#milestone_parent").val(id); } @@ -41,7 +40,6 @@ $(document).ready(function () { processResults: function (result) { return { results: $.map(result, function (item) { - // console.log("cek item", item) return { due_date:item.due_date, deadline:item.deadline, @@ -85,14 +83,12 @@ $(document).ready(function () { $('#submit-milestone').html('Add..'); $('#submit-milestone').prop("disabled",true); var data = Object.fromEntries(new FormData(this)); - console.log("cek data form", data); let parent = data.milestone_parent; var taskId = 0; var start = moment(data.due_date, "YYYY-MM-DD"); var end = moment(data.deadline, "YYYY-MM-DD"); let duration = moment.duration(start.diff(end)).asDays(); let nameMilestone = data.status!="" ? data.status : data.id_milestone - // console.log("cek duration", Math.abs(duration)); if(parent && parseInt(parent) > 0){ taskId = gantt.addTask({ id: Math.floor(Math.random() * 1000) + 5000, diff --git a/view-mode/function/modalHumanResourceFunction.js b/view-mode/function/modalHumanResourceFunction.js index 1d91fbf..c77660b 100644 --- a/view-mode/function/modalHumanResourceFunction.js +++ b/view-mode/function/modalHumanResourceFunction.js @@ -5,9 +5,6 @@ $(document).ready(function () { let DATA_ROLE_HUMAN_RESOURCE = [] let DATA_HUMAN_RESOURCE = [] - let forbiddenHuman = [] - // let DATA_MATERIAL_RESOURCE = [] - // let DATA_TOOL_RESOURCE = [] function getDataHumanResource() { const url = `${base_url}human-resource/search` const payload = { @@ -15,14 +12,6 @@ $(document).ready(function () { "start": 1, "length": -1 }, - "columns": [ - // { - // "name": "proyek_id", - // "logic_operator": "like", - // "value": search, - // "operator": "AND" - // }, - ], "orders": { "columns": [ "id" @@ -30,19 +19,8 @@ $(document).ready(function () { "ascending": false } } - // console.log("qry", qry) axiosInstance.post(url, payload, HEADER).then(res => { - console.log('getDataHumanResource', res) DATA_HUMAN_RESOURCE = res.data.data - // arr.forEach(function (element, key) { - // $('#choices-multiple-remove-button1').append(``) - // }); - // var multipleCancelButton = new Choices('#choices-multiple-remove-button1', { - // removeItemButton: true, - // // maxItemCount: 5, - // // searchResultLimit: 5, - // // renderChoiceLimit: 5 - // }); }); } @@ -56,89 +34,14 @@ $(document).ready(function () { "joins": [], "orders": { "columns": ["id"], "ascending": false } } - // console.log("qry", qry) axiosInstance.post(url, payload, HEADER).then(res => { - console.log(res) DATA_ROLE_HUMAN_RESOURCE = res.data.data }); } - // getDataHumanResource() - - // function getDataMaterials() { - // const url = `${base_url}request-material/search` - // const payload = { - // "paging": { - // "start": 0, - // "length": -1 - // }, - // "columns": [ - // { - // "name": "proyek_id", - // "logic_operator": "=", - // "value": "6", - // "operator": "AND" - // }, - // { - // "name": "status", - // "logic_operator": "=", - // "value": "receipt to site", - // "operator": "AND" - // } - // ], - // "orders": { - // "columns": [ - // "id" - // ], - // "ascending": false - // } - // } - // axiosInstance.post(url, payload, HEADER).then(res => { - // console.log(res) - // DATA_MATERIAL_RESOURCE = res.data.data - // }); - // } - - // function getDataTools() { - // const url = `${base_url}req-tools/search` - // const payload = { - // "paging": { - // "start": 0, - // "length": -1 - // }, - // "columns": [ - // { - // "name": "status", - // "logic_operator": "=", - // "value": "receipt to site", - // "operator": "AND" - // } - // ], - // "orders": { - // "columns": [ - // "id" - // ], - // "ascending": false - // } - // } - // axiosInstance.post(url, payload, HEADER).then(res => { - // console.log(res) - // const arr = res.data.data - // DATA_TOOL_RESOURCE = res.data.data - // arr.forEach(function (element, key) { - // $('#choices-multiple-remove-button3').append(``) - // }); - // var multipleCancelButton = new Choices('#choices-multiple-remove-button3', { - // removeItemButton: true - // }); - // }); - // } $('#human-resource').on('show.bs.modal', function (event) { - // console.log("open modal human resource") getDataHumanResource() getDataRole() - // getDataMaterials() - // getDataTools() }); $('#human-resource').on('hide.bs.modal', function (event) { @@ -149,7 +52,6 @@ $(document).ready(function () { $("#add-human-resource").on('click', function () { const num = $('#table-human-resource tr').length - console.log(num) const idx = num + 1 $('#table-human-resource').append(` @@ -182,13 +84,11 @@ $(document).ready(function () { $('#table-human-resource').on('click', '.human-resource-delete', function (event) { const idx = $(this).attr("index") - console.log(idx) $(`#row-human-resource-${idx}`).remove() }) // $("#add-material-resource").on('click', function () { // const num = $('#table-material-resource tr').length - // console.log(num) // const idx = num + 1 // $('#table-material-resource').append(` // @@ -216,13 +116,11 @@ $(document).ready(function () { // $('#table-material-resource').on('click', '#material-resource-delete', function (event) { // const idx = $(this).attr("index") - // console.log(idx) // $(`#row-material-resource-${idx}`).remove() // }) // $("#add-tool-resource").on('click', function () { // const num = $('#table-tool-resource tr').length - // console.log(num) // const idx = num + 1 // $('#table-tool-resource').append(` // @@ -250,13 +148,11 @@ $(document).ready(function () { // $('#table-tool-resource').on('click', '#tool-resource-delete', function (event) { // const idx = $(this).attr("index") - // console.log(idx) // $(`#row-tool-resource-${idx}`).remove() // }) $(".submit-human-resource").on('click', function () { - console.log('onclick submit human resource'); // addComments(); let valueHumanResource = [] const num = $('#table-human-resource tr').length @@ -269,7 +165,6 @@ $(document).ready(function () { } valueHumanResource.push(obj) } - console.log("cek value", valueHumanResource) // let valueMaterialResource = [] // const numMaterial = $('#table-material-resource tr').length @@ -282,7 +177,6 @@ $(document).ready(function () { // } // valueMaterialResource.push(obj) // } - // console.log(valueMaterialResource) // let valueToolResource = [] // const numTool = $('#table-tool-resource tr').length @@ -295,11 +189,9 @@ $(document).ready(function () { // } // valueToolResource.push(obj) // } - // console.log(valueToolResource) // const cost = $(`#cost-human-resource`).val() // const duration = $(`#duration-human-resource`).val() // const dateStart = $(`#date-started-human-started`).val() - // console.log({ cost, duration, dateStart }) // $("#exampleModal").modal('hide'); }); diff --git a/view-mode/function/overlaySCurve.js b/view-mode/function/overlaySCurve.js index 0f28b21..e030a87 100644 --- a/view-mode/function/overlaySCurve.js +++ b/view-mode/function/overlaySCurve.js @@ -98,7 +98,6 @@ function getChartScaleRange() { function getProgressLine() { // As long as the progress data length is same with chart scale range (period) then it's fine. getSCurveData(); - // console.log("apa ", return_first); var cumulativePlannedDurations = return_first.data[0].data.percentagePlan; var cumulativeRealDurations = return_first.data[0].data.percentageReal; cumulativeRealDurations[cumulativeRealDurations.length - 1] = Math.ceil(cumulativeRealDurations[cumulativeRealDurations.length - 1]); diff --git a/view-mode/function/reportActivity.js b/view-mode/function/reportActivity.js index ab7d6ea..66f8737 100644 --- a/view-mode/function/reportActivity.js +++ b/view-mode/function/reportActivity.js @@ -50,19 +50,16 @@ $(document).ready(function () { { data: 'uom', name: 'uom' }, { data: 'start_activity', render: function (data, type) { - console.log("start", data) return data ? formatDate(data) : '-' } }, { data: 'finish_activity', render: function (data, type) { - console.log("finish", data) return data ? formatDate(data) : '-' } }, { data: 'status_activity', render: function (data, type) { - console.log("status", data) const val = !data ? '-' : data == "done" ? `${data}` : data == "open" ? `${data}` : diff --git a/view-mode/function/restActivityLink.js b/view-mode/function/restActivityLink.js index 06a6b18..a5f65e1 100644 --- a/view-mode/function/restActivityLink.js +++ b/view-mode/function/restActivityLink.js @@ -5,7 +5,6 @@ window.parent.postMessage({ action: 'getUrl' }, '*'); window.addEventListener('message', function(event) { if (event.data && event.data.action === 'sendUrl') { const parentUrl = event.data.url; - // Split the remaining path by "/" parts = parentUrl.split("/"); } @@ -24,13 +23,10 @@ gantt.ajax.get({ data['links'] = obj.data.links; // check if baseline has been set if (data.data && data.data.length > 0) { - console.log('baseline', data.data[0].planned_start); if (data.data[0].planned_start !== null && data.data[0].planned_end !== null) { - console.log('baseline set'); isBaselineSet = true; } else { - console.log('baseline has not been set'); isBaselineSet = false; } } @@ -58,7 +54,6 @@ function refresData(id){ let obj = JSON.parse(response); data['data'] = obj.data.data; data['links'] = obj.data.links; - // console.log("data parse wrong", data); if(!parts[7]){ gantt.silent(function () { gantt.parse(data); @@ -104,21 +99,17 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) { }).then(function(response){ let res = response.responseText res = JSON.parse(res) - // console.log("cek response", res) if(entity=="link"){ gantt.changeLinkId(id, res.tid); }else if(entity=="task"){ gantt.changeTaskId(id, res.tid); } - // refresData(); }); break; case "update": if(entity=="task"){ data['start_date'] = moment(data.start_date).format("YYYY-MM-DD HH:mm:ss+07"); data['end_date'] = moment(data.end_date).format("YYYY-MM-DD HH:mm:ss+07"); - // data['planned_start'] = moment(data.planned_start).format("YYYY-MM-DD HH:mm:ss+07"); - // data['planned_end'] = moment(data.planned_end).format("YYYY-MM-DD HH:mm:ss+07"); if(data && data.parent){ data['parent_id'] = data.parent; @@ -130,9 +121,6 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) { } }); } - // console.log("cek data update", data) - // let dataProgress = parseInt(data.progress) - // dataProgress = dataProgress/100 return gantt.ajax.put({ headers: { "Content-Type": "application/json", @@ -145,7 +133,6 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) { let parent = data.parent; let responseText = JSON.parse(response.responseText) let resData = responseText - // console.log("dataRes", resData); let updateBobot = resData.update_bobot || false if(updateBobot){ refresData(id); @@ -154,25 +141,11 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) { updateActivity(parent); } } - // console.log("data", data); - // refresData(); - // if(resData && resData.rencana_biaya){ - // if(data.rencana_biaya != resData.rencana_biaya){ - // // gantt.getTask(id).bobot_planning = resData.bobot_planning; - // // gantt.updateTask(id); - - // }else{ - // if(parent && parent > 0){ - // updateActivity(parent); - // } - // } - // } } }); break; case "delete": - // console.log("cek data", data) return gantt.ajax.del({ headers: { "Authorization": `Bearer ${token}` @@ -193,14 +166,8 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) { } } } - // console.log("cek data delete", data) } - // let res = response.responseText - // res = JSON.parse(res) - // console.log("cek response", res) - - // refresData(); }); - break; + break; } }); diff --git a/view-mode/function/toolsResource.js b/view-mode/function/toolsResource.js index c734e16..27ee51b 100644 --- a/view-mode/function/toolsResource.js +++ b/view-mode/function/toolsResource.js @@ -88,7 +88,6 @@ $(document).ready(function () { processResults: function (result) { return { results: $.map(result, function (item) { - // console.log("cek item", item) return { text: item.name, id: item.id @@ -137,7 +136,6 @@ $(document).ready(function () { processData: false, contentType: false, success: function (data) { - console.log('response data', data); if (data && data.code === 200) { actionHappen = true; gantt.alert("Tools Assign Success!");