diff --git a/view-mode/function/ganttConfig.js b/view-mode/function/ganttConfig.js index 90130ae..6beba62 100644 --- a/view-mode/function/ganttConfig.js +++ b/view-mode/function/ganttConfig.js @@ -75,27 +75,19 @@ gantt.plugins({ auto_scheduling: true }); -// gantt.templates.parse_date = function (date) { -// return new Date(2019,01,01); -// }; - -// gantt.config.highlight_critical_path = true; +gantt.config.highlight_critical_path = true; gantt.config.date_format = "%Y-%m-%d %H:%i:%s"; -// gantt.config.date_format="%d-%m-%Y %H:%i:%s"; -// gantt.config.date_grid="%d-%m-%Y %H:%i:%s"; gantt.config.auto_scheduling = true; gantt.config.fit_tasks = true; if (!base_url) { base_url = `https://api-iu.ospro.id/api/`; - // console.log("cek base url 2",base_url) }else{ base_url = base_url+"/"; } -// console.log("cek base url 3",base_url) -// gantt plugins gantt.plugins({ marker: true, - fullscreen: true + fullscreen: true, + overlay: true }); // add today line @@ -106,21 +98,7 @@ var markerId = gantt.addMarker({ text: "Today", title: dateToStr(new Date()) }); -gantt.getMarker(markerId); //->{css:"today", text:"Now", id:...} - -var colHeader = '
', - colContent = function (task) { - var hasChild = gantt.hasChild(task.id); - var optionsContent = '
'; - optionsContent += ' '; - optionsContent += ' '; - optionsContent += ' '; - optionsContent += !hasChild ? ' ' : ''; - optionsContent += !hasChild ? ' ' : ''; - optionsContent += !hasChild ? ' ' : ''; - optionsContent += '
'; - return (optionsContent); - }; +gantt.getMarker(markerId); let no = 4; // for temporary change with last id in database m_activity @@ -130,8 +108,6 @@ var formatter = gantt.ext.formatters.durationFormatter({ format: "auto" }); -var progressEditor = {type: "progressCustom", map_to: "progress", min:0, max: 100}; -var costPlanningEditor = {type: "costPlanningEditor", map_to: "rencana_biaya", min:0}; var linksFormatter = gantt.ext.formatters.linkFormatter({ durationFormatter: formatter }); function satuanLabel(task){ @@ -147,24 +123,6 @@ function satuanLabel(task){ return ""; } -const editor = { - text: { type: "text", map_to: "text" }, - kode_sortname: { type: "text", map_to: "kode_sortname" }, - start_date: { type: "date", map_to: "start_date", min: new Date(2018, 0, 1) }, - end_date: { type: "date", map_to: "end_date", min: new Date(2018, 0, 1) }, - duration: { type: "duration", map_to: "duration", min: 0, max: 365, formatter: formatter }, - cost: { type: "number", map_to: "rencana_biaya", min: 0 }, - costActual: { type: "number", map_to: "biaya_actual", min: 0 }, - status: { type: "text", map_to: "status" }, - job_count: { type: "number", map_to: "jumlah_pekerjaan", min: 0 }, - job_unit: { type: "text", map_to: "satuan", min: 0 }, - bobot_planning:{ type: "number", map_to: "bobot_planning", min: 0 }, - human_resource: (`
-     -
`), - satuan:{type: "select", map_to: "satuan_id", options:gantt.serverList("satuan")} -} - function addWithoutParent() { var task = gantt.getTaskByIndex(0); @@ -252,12 +210,11 @@ function createColumnsConfig(selectedColumns){ } var allColumns = [ - { name: "action", label: colHeader, align: "left", min_width: 115, template: colContent, resize: true }, - { name: "kode_sortname", label: "Kode / Sortname",align: "center", min_width: 120, editor: editor.kode_sortname, resize: true }, - { name: "text", label: "Activity", tree: true, min_width: 150, editor: editor.text, resize: true }, - { name: "start_date", label: "Start Date", align: "center", min_width: 80, editor: editor.start_date, resize: true }, - { name: "end_date", label: "Finish Date", align: "center", min_width: 80, editor: editor.end_date, resize: true }, - { name: "duration", label: "Duration", align: "center", min_width: 50, editor: editor.duration, resize: true }, + { name: "kode_sortname", label: "Kode / Sortname",align: "center", min_width: 120, resize: true }, + { name: "text", label: "Activity", tree: true, min_width: 150, resize: true }, + { name: "start_date", label: "Start Date", align: "center", min_width: 80, resize: true }, + { name: "end_date", label: "Finish Date", align: "center", min_width: 80, resize: true }, + { name: "duration", label: "Duration", align: "center", min_width: 50, resize: true }, { name: "rencana_biaya", label: "Cost Planning", align: "center", min_width: 100, resize: true, template: function (text) { if(!text.rencana_biaya){ return @@ -265,14 +222,14 @@ var allColumns = [ let rencana_biaya = text.rencana_biaya return "Rp. "+ formatRupiah(rencana_biaya) } }, - { name: "cost_actual", label: "Cost Actual", align: "center", min_width: 100, resize: true, template: function (text) { + { name: "cost_actual", label: "Cost Actual", align: "center", min_width: 100, template: function (text) { if(!text.biaya_actual){ return } let biaya_actual = text.biaya_actual return "Rp. "+ formatRupiah(biaya_actual) } }, - { name: "assign_hr", label: "Assign To", align: "center", min_width: 150, resize: true, template: function (text) { + { name: "assign_hr", label: "Assign To", align: "center", min_width: 150, template: function (text) { if(text.type=="project" || text.type=="milestone"){ return; } @@ -312,34 +269,14 @@ var allColumns = [ ${html} ` } }, - { name: "tools", label: "Tools", align: "center", min_width: 150, resize: true, template: function (text) { - if(text.type=="project" || text.type=="milestone"){ - return; - } - let html = ``; - var assign_tools = text.assign_tools - - if(!assign_tools || !assign_tools.length){ - // html = `Unassigned`; - }else{ - if(assign_tools.length > 0 ){ - html = `Assigned`; - } - } - return `
- ${html} -
` - } }, - // { name: "status", label: "Status", align: "center", editor: editor.status, resize: true }, { name: "bobot_planning", label: "Bobot Activity (%)", align: "center", resize: true, min_width: 115, template: function (text) { if(!text.bobot_planning){ return } let bobot_planning = parseFloat(text.bobot_planning); - // console.log("bobot_planning", bobot_planning); return roundToTwo(bobot_planning); } }, - { name: "progress", label: "Actual Progress (%)", align: "center", editor: progressEditor, min_width: 125, template: function (text) { + { name: "progress", label: "Actual Progress (%)", align: "center", min_width: 125, template: function (text) { let progress = text.progress progress = progress*100 return progress; @@ -351,7 +288,7 @@ var allColumns = [ let actual = (progress*bobot) / 100 return roundToTwo(actual); }, resize: true }, - { name: "jumlah_pekerjaan", label: "Volume Plan", align: "center", min_width: 100, resize: true, editor:editor.job_count }, + { name: "jumlah_pekerjaan", label: "Volume Plan", align: "center", min_width: 100, resize: true}, { name: "jobs_done", label: "Volume Actual", align: "center", min_width: 100, resize: true, template: function (text) { if(text.type=="project" || text.type=="milestone"){ return; @@ -361,38 +298,12 @@ var allColumns = [ ${html} ` } }, - { name: "satuan", label: "UOM", align: "center", min_width: 100, resize: true, editor:editor.satuan, template: satuanLabel }, - { - name: "predecessor", label: "Predecessor", align: "center", min_width: 100, template: function (text) { - let links = text.$target - let dataRes = ``; - let no = 0; - if (links.length > 0) { - links.map((val, index) => { - if (no > 0) { - dataRes += `, `; - } - let link = gantt.getLink(val); - let type = getCodeLinkByType(link.type); - let source = link.source; - var wbs_code = gantt.getWBSCode(gantt.getTask(source)); - dataRes += wbs_code + type; - no = no + 1; - }); - } - return dataRes; - }, resize: true - }, { name: "updated_by", label: "Last Updated By", align: "center", min_width: 100, resize: true } ]; -// set default to show (true) , hide (false) gantt.config.columns = createColumnsConfig({ - action: true, kode_sortname: true, text: true, - // planned_start: true, - // planned_end: true, start_date: true, end_date: true, duration: true, @@ -400,14 +311,11 @@ gantt.config.columns = createColumnsConfig({ cost_actual: true, assign_hr: true, material: true, - tools: true, bobot_planning: true, progress: true, progress_actual: true, jumlah_pekerjaan: true, jobs_done:true, - satuan: true, - predecessor: true, updated_by: true }) @@ -416,32 +324,13 @@ gantt.config.resize_rows = true; gantt.config.grid_resize = true; // pro edition gantt.config.min_column_width = 50; gantt.config.scale_height = 20; -// gantt.config.row_height = 30; gantt.config.order_branch = "marker"; gantt.config.order_branch_free = true; gantt.config.open_tree_initially = true; -// adding baseline -// gantt.config.bar_height = 16; -// gantt.config.row_height = 40; - gantt.config.row_height = 30; gantt.config.task_height = 20; -// gantt.locale.labels.baseline_enable_button = 'Set'; -// gantt.locale.labels.baseline_disable_button = 'Remove'; -// gantt.config.lightbox.sections = [ -// {name: "Activity", height: 70, map_to: "text", type: "textarea", focus: true}, -// {name: "time", map_to: "auto", type: "duration"}, -// { -// name: "baseline", -// map_to: {start_date: "planned_start", end_date: "planned_end"}, -// button: true, -// type: "duration_optional" -// } -// ]; -// gantt.locale.labels.section_baseline = "Planned"; -// adding baseline display gantt.addTaskLayer({ renderer: { render: function draw_planned(task) { @@ -499,7 +388,7 @@ gantt.attachEvent("onTaskLoading", function(task){ gantt.config.autoscroll = true; -gantt.config.scroll_size = 30; +gantt.config.scroll_size = 50; gantt.config.layout = { css: "gantt_container", cols: [ @@ -521,18 +410,13 @@ gantt.config.layout = { ] }; - -// custom folder, file, collapse icons on activity gantt.templates.grid_folder = function (item) { - // return "
"; return ""; }; gantt.templates.grid_file = function (item) { - // return "
"; return ""; }; -// Set workdays gantt.config.work_time = true; gantt.config.duration_unit = "day"; @@ -643,15 +527,15 @@ for (var i = 0; i < radios.length; i++) { // // GANTT PERFORMANCE CONFIG RECOMMENDATION gantt.config.scales = [ - {unit: "month", step: 1, format: "%F, %Y"}, - {unit: "week", step: 1, format: function (date) { - return "Week #" + gantt.date.getWeek(date); - }}, - {unit: "day", step: 1, format: "%D", css: function(date) { - if(!gantt.isWorkTime({ date: date, unit: "day"})){ - return "weekend" - } - }} + {unit: "month", step: 1, format: "%F, %Y"}, + {unit: "week", step: 1, format: function (date) { + return "Week #" + gantt.date.getWeek(date); + }}, + {unit: "day", step: 1, format: "%D", css: function(date) { + if(!gantt.isWorkTime({ date: date, unit: "day"})){ + return "weekend" + } + }} ]; gantt.config.show_task_cells = false; gantt.config.static_background = true; diff --git a/view-mode/function/holiday.js b/view-mode/function/holiday.js index 25a266d..d93cea4 100644 --- a/view-mode/function/holiday.js +++ b/view-mode/function/holiday.js @@ -22,12 +22,6 @@ $(document).ready(function () { {data: 'date', name: 'date'}, {data: 'duration', name: 'duration'}, {data: 'description', name: 'description'}, - { - data: 'action', - name: 'action', - orderable: false, - searchable: false - } ] }); @@ -79,12 +73,12 @@ $(document).ready(function () { function unsetHolidays(data){ var a = moment(data.date); - var b = moment(a).add(data.duration, 'days'); + 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, + date: holiday, hours:false }); } @@ -114,7 +108,7 @@ $(document).ready(function () { let id = $(this).data('id'); gantt.confirm({ text: "Holiday will be deleted from gantt, continue?", - ok:"Delete", + ok:"Delete", cancel:"Cancel", callback: function(result){ if(result){ @@ -123,4 +117,4 @@ $(document).ready(function () { } }); }); -}); \ No newline at end of file +}); diff --git a/view-mode/function/humanResource.js b/view-mode/function/humanResource.js index d9bca06..3b0bea7 100644 --- a/view-mode/function/humanResource.js +++ b/view-mode/function/humanResource.js @@ -1,209 +1,55 @@ var hrModal = $('#modal-hr > .modal-dialog > .modal-content'); function resetFormAssign() { - $('#select-role-hr').val(null).trigger("change"); - $('#select-role-hr').find('option').remove(); - $('#select-role-hr').val(""); - $('#select-hr').val(null).trigger("change"); - $('#select-hr').find('option').remove(); - $('#select-hr').val(""); - $("#hr_role").val(""); - // $("#hide-form-hr").hide(); - // $("#show-form-hr").show(); - // $("#form-assign-hr").hide(); - $('#form-assign-hr').trigger("reset"); - $('#btn-assign-hr').html('Assign'); - $('#btn-assign-hr').prop("disabled", false); + $('#select-role-hr').val(null).trigger("change"); + $('#select-role-hr').find('option').remove(); + $('#select-role-hr').val(""); + $('#select-hr').val(null).trigger("change"); + $('#select-hr').find('option').remove(); + $('#select-hr').val(""); + $("#hr_role").val(""); + $('#form-assign-hr').trigger("reset"); + $('#btn-assign-hr').html('Assign'); + $('#btn-assign-hr').prop("disabled", false); }; $(document).ready(function () { - var tableHr = $("#table-hr").DataTable({ - "processing": true, - "serverSide": true, - "ajax": { - "url": `${base_url}user-to-activity/datatables`, - "data": function (d) { - d.idact = activityId; - } - }, - "columns": [ - { data: 'user_name', name: 'user_name' }, - { data: 'role_name', name: 'role_name' }, - { - data: 'action', - name: 'action', - orderable: true, - searchable: true - }, - ] - }); - - function deleteHrAssign(id) { - $.ajax({ - url: `${base_url}user-to-activity/delete/${id}`, - type: "DELETE", - success: function (data) { - actionHappen = true; - gantt.alert("Delete Human Resource Assign Success!"); - tableHr.draw(); - }, - error: function (data) { - gantt.alert("Delete Human Resource Assign Failed, try again later!"); - } - }); - } - - $("#modal-hr").on("click", "#show-form-hr", function () { - $(this).hide(); - $("#hide-form-hr").show(); - $("#form-assign-hr").show(); - }); - - $("#modal-hr").on("click", "#hide-form-hr", function () { - $(this).hide(); - resetFormAssign() - $("#show-form-hr").show(); - }); - - $('#modal-hr').on('show.bs.modal', function (event) { - tableHr.draw(); - }); - - $('#modal-hr').on('hide.bs.modal', function (event) { - $("#hide-form-hr").hide(); - $("#show-form-hr").show(); - if (actionHappen) { - console.log("there's action change"); - updateActivity(activityId); - } - resetFormAssign(); - }); - - $('#select-role-hr').select2({ - dropdownParent: hrModal, - placeholder: 'Pilih human resource role', - allowClear: true, - ajax: { - url: `${base_url}project-role/select`, - dataType: 'json', - data: function (params) { - var query = { - search: params.term, - type: 'public', - } - return query; - }, - processResults: function (result) { - return { - results: $.map(result, function (item) { - // console.log("cek item", item) - return { - text: item.name, - id: item.id - } - }) - }; - }, - cache: false - } - }); - $('#select-hr').select2({ - dropdownParent: hrModal, - placeholder: 'Pilih human resource', - allowClear: true, - ajax: { - url: `${base_url}human-resource/select`, - dataType: 'json', - data: function (params) { - var query = { - search: params.term, - type: 'public', - idact: activityId, - idProyek: proyekId - } - return query; - }, - processResults: function (result) { - return { - results: $.map(result, function (item) { - // console.log("cek item", item) - return { - text: item.name, - id: item.id, - proyek_role: item.proyek_role - } - }) - }; - }, - cache: false - } - }); - - $('#select-hr').on('select2:select', function (e) { - console.log('select event', e.params.data); - let param_data = e.params.data; - if (param_data && param_data.proyek_role) { - let proyek_role = param_data.proyek_role - $("#hr_role").val(proyek_role); - } - - }); - - - $("#form-assign-hr").on('submit', function (e) { - e.preventDefault(); - - $('#btn-assign-hr').html('Assign...'); - $('#btn-assign-hr').prop("disabled", true); - - // var formData = new FormData(this); - let user_id = $("#select-hr").val(); - let user_role = $("#hr_role").val(); - if (!user_id || user_id < 0) { - gantt.alert("Please choose user to assign!"); - $('#btn-assign-hr').html('Assign'); - $('#btn-assign-hr').prop("disabled", false); - return false - } - - - let payload = { - user_id: user_id, - role_proyek_id: user_role, - version_gantt_id: ganttId, - proyek_id: proyekId, - activity_id: activityId - } - $.ajax({ - data: JSON.stringify(payload), - url: `${base_url}user-to-activity/add`, - type: "POST", - processData: false, - contentType: false, - success: function (data) { - actionHappen = true; - resetFormAssign(); - tableHr.draw(); - gantt.alert("Human Resource Assign Success!"); - }, - error: function (data) { - resetFormAssign(); - gantt.alert("Human Resource Assign Failed, try again later!"); - } - }); - }); - - $("#table-hr").on("click", ".btn-hr-delete", function () { - let id = $(this).data('id'); - var box = gantt.confirm({ - text: "Human resource will be deleted from activity, continue?", - ok: "Delete", - cancel: "Cancel", - callback: function (result) { - if (result) { - deleteHrAssign(id); - } - } - }); - }); -}); \ No newline at end of file + var tableHr = $("#table-hr").DataTable({ + "processing": true, + "serverSide": true, + "ajax": { + "url": `${base_url}user-to-activity/datatables`, + "data": function (d) { + d.idact = activityId; + } + }, + "columns": [ + { data: 'user_name', name: 'user_name' }, + { data: 'role_name', name: 'role_name' }, + ] + }); + + + $("#modal-hr").on("click", "#show-form-hr", function () { + $(this).hide(); + $("#hide-form-hr").show(); + $("#form-assign-hr").show(); + }); + + $("#modal-hr").on("click", "#hide-form-hr", function () { + $(this).hide(); + resetFormAssign() + $("#show-form-hr").show(); + }); + + $('#modal-hr').on('show.bs.modal', function (event) { + tableHr.draw(); + }); + + $('#modal-hr').on('hide.bs.modal', function (event) { + $("#hide-form-hr").hide(); + $("#show-form-hr").show(); + resetFormAssign(); + }); + +}); diff --git a/view-mode/function/materialResource.js b/view-mode/function/materialResource.js index 4314080..c43d7a1 100644 --- a/view-mode/function/materialResource.js +++ b/view-mode/function/materialResource.js @@ -1,299 +1,66 @@ var materialModal = $('#modal-material > .modal-dialog > .modal-content'); function resetFormAssignMaterial() { - $('#select-material').val(null).trigger("change"); - $('#select-material').find('option').remove(); - $('#select-material').val(""); - $('#form-assign-material').trigger("reset"); - $('#btn-assign-material').html('Assign'); - $('#btn-assign-material').prop("disabled", false); + $('#select-material').val(null).trigger("change"); + $('#select-material').find('option').remove(); + $('#select-material').val(""); + $('#form-assign-material').trigger("reset"); + $('#btn-assign-material').html('Assign'); + $('#btn-assign-material').prop("disabled", false); }; - -var rupiah = document.getElementById('price-req-material'); - rupiah.addEventListener('keyup', function (e) { - rupiah.value = formatRibuanInput(this.value); - }); - -var qty = document.getElementById('qty-req-material'); - qty.addEventListener('keyup', function (e) { - qty.value = formatRibuanInput(this.value); - }); - $(document).ready(function () { - var tableMaterial = $("#table-material").DataTable({ - "processing": true, - "serverSide": true, - "ajax": { - "url": `${base_url}assign-material/datatables`, - "data": function (d) { - d.idact = activityId; - } - }, - "columns": [ - - { data: 'material_name', name: 'material_name' }, - { - data: 'qty_planning', render: function (data, type) { - return data ? formatRupiah(data) : '-' - } - }, - { data: 'uom', name: 'uom' }, - { - data: 'budget', render: function (data, type) { - return data ? "Rp. " + formatRupiah(data) : '-' - } - }, - { - data: 'plan_date', render: function (data, type) { - return data ? formatDate(data) : '-' - } - }, - { - data: 'action', - name: 'action', - orderable: true, - searchable: true - }, - ] - }); - - function deleteMaterialAssign(id) { - $.ajax({ - url: `${base_url}assign-material/delete/${id}`, - type: "DELETE", - success: function (data) { - actionHappen = true; - gantt.alert("Delete Material Assign Success!"); - tableMaterial.draw(); - }, - error: function (data) { - gantt.alert("Delete Material Assign Failed, try again later!"); - } - }); - } - - $("#modal-material").on("click", "#show-form-material", function () { - $(this).hide(); - $("#hide-form-material").show(); - $("#form-assign-material").show(); - }); - - $("#modal-material").on("click", "#hide-form-material", function () { - $(this).hide(); - resetFormAssignMaterial() - $("#show-form-material").show(); - }); - - $('#modal-material').on('show.bs.modal', function (event) { - $('#modal-material-title').html("Material Resource " + activityName); - tableMaterial.draw(); - }); - - $('#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(); - }); - - $('#select-material').select2({ - dropdownParent: materialModal, - placeholder: 'Pilih material resource', - allowClear: true, - ajax: { - url: `${base_url}material-resource/select`, - dataType: 'json', - data: function (params) { - var query = { - search: params.term, - type: 'public', - idProyek: proyekId, - idact: activityId - } - return query; - }, - processResults: function (result) { - return { - results: $.map(result, function (item) { - // console.log("cek item", item) - return { - text: item.description, - id: item.id - } - }) - }; - }, - cache: false - } - }); + var tableMaterial = $("#table-material").DataTable({ + "processing": true, + "serverSide": true, + "ajax": { + "url": `${base_url}assign-material/datatables`, + "data": function (d) { + d.idact = activityId; + } + }, + "columns": [ - $('#select-material-integration').select2({ - dropdownParent: materialModal, - placeholder: 'Pilih material', - allowClear: true, - ajax: { - url: `${adwIntegrationUrl}/request-material/get-material-integration`, - type: "get", - delay: 1000, - data: function (params) { - var query = { - 'name': params.term, + { data: 'material_name', name: 'material_name' }, + { + data: 'qty_planning', render: function (data, type) { + return data ? formatRupiah(data) : '-' } - return query; }, - headers: { - 'Authorization': `Bearer ${token}` + { data: 'uom', name: 'uom' }, + { + data: 'budget', render: function (data, type) { + return data ? "Rp. " + formatRupiah(data) : '-' + } }, - processResults: function (data) { - var dataIntegrasiMaterial = []; - if (data.data) { - for(var i = 0; i < data.data.length; i++){ - var newData = { - id: data.data[i].description, - text: data.data[i].description, - } - dataIntegrasiMaterial.push(newData); - } + { + data: 'plan_date', render: function (data, type) { + return data ? formatDate(data) : '-' } - return { - results: dataIntegrasiMaterial - }; - } - } - }); - - $("#form-assign-material").on('submit', function (e) { - e.preventDefault(); - - $('#btn-assign-material').html('Assign...'); - $('#btn-assign-material').prop("disabled", true); - - // /request-material/add - let desc_req_material = $("#select-material-integration").val(); - let required_date = $("#required-date-req-material").val(); - let plan_date = $("#required-date-plan-material").val(); - let uom = $("#uom-req-material").val(); - let price = $("#price-req-material").val(); - let qty_planning = $("#qty-req-material").val(); - let material_id = null; - - let payload = { - description: desc_req_material, - fom_date: required_date, - required_date: required_date, - proyek_id: proyekId, - uom: uom, - qty: formatReplaceTitikRibuan(qty_planning), - price: formatReplaceTitikRibuan(price) - } - $.ajax({ - data: JSON.stringify(payload), - url: `${base_url}request-material/add`, - type: "POST", - processData: false, - contentType: false, - success: function (data) { - if (data && data.code === 200) { - material_id = data.data.id; - // actionHappen = true; - // gantt.alert("Material Request Success!"); - // tableMaterial.draw(); - resetFormAssignMaterial(); - - let payloadAssign = { - proyek_id: proyekId, - activity_id: activityId, - material_id: material_id, - qty_planning: qty_planning, - plan_date: plan_date - // budget: budget - } - $.ajax({ - data: JSON.stringify(payloadAssign), - url: `${base_url}assign-material/add`, - type: "POST", - processData: false, - contentType: false, - success: function (data) { - if (data && data.code === 200) { - actionHappen = true; - gantt.alert("Material Assign Success!"); - tableMaterial.draw(); - resetFormAssignMaterial(); - } - else { - gantt.alert({ type: "error", text: data.message }); - $('#btn-assign-material').html('Assign'); - $('#btn-assign-material').prop("disabled", false); - } - }, - error: function (data) { - gantt.alert("Material Assign Failed, try again later!"); - resetFormAssignMaterial(); - } - }); - } - else { - gantt.alert({ type: "error", text: data.message }); - $('#btn-assign-material').html('Assign'); - $('#btn-assign-material').prop("disabled", false); - } - }, - error: function (data) { - gantt.alert("Material Request Failed, try again later!"); - resetFormAssignMaterial(); - } - }); - - // let material_id = $("#select-material").val(); - - // if (!material_id || material_id < 0) { - // gantt.alert("Please choose material to assign!"); - // $('#btn-assign-material').html('Assign'); - // $('#btn-assign-material').prop("disabled", false); - // return false - // } - - // if (!qty_planning || qty_planning < 0) { - // gantt.alert("Please input qty material!"); - // $('#btn-assign-material').html('Assign'); - // $('#btn-assign-material').prop("disabled", false); - // return false - // } - - // if(!budget || budget < 0){ - // gantt.alert("Please input price per-unit!"); - // $('#btn-assign-material').html('Assign'); - // $('#btn-assign-material').prop("disabled",false); - // return false - // } - - // if(material_id === null){ - // gantt.alert("Material Assign Failed, try again later!"); - // resetFormAssignMaterial(); - // }else{ - - // } - - }); + }, + ] + }); + + $("#modal-material").on("click", "#show-form-material", function () { + $(this).hide(); + $("#hide-form-material").show(); + $("#form-assign-material").show(); + }); + + $("#modal-material").on("click", "#hide-form-material", function () { + $(this).hide(); + resetFormAssignMaterial() + $("#show-form-material").show(); + }); + + $('#modal-material').on('show.bs.modal', function (event) { + $('#modal-material-title').html("Material Resource " + activityName); + tableMaterial.draw(); + }); + + $('#modal-material').on('hide.bs.modal', function (event) { + $("#show-form-material").show(); + resetFormAssignMaterial(); + }); - // delete from row - $("#table-material").on("click", ".btn-material-delete", function () { - let id = $(this).data('id'); - var box = gantt.confirm({ - text: "Material resource will be deleted from activity, continue?", - ok: "Delete", - cancel: "Cancel", - callback: function (result) { - if (result) { - deleteMaterialAssign(id); - } - } - }); - }); }); diff --git a/view-mode/function/overlaySCurve.js b/view-mode/function/overlaySCurve.js new file mode 100644 index 0000000..76e6c14 --- /dev/null +++ b/view-mode/function/overlaySCurve.js @@ -0,0 +1,284 @@ +var overlayControl = gantt.ext.overlay; +var today = new Date(); + +function toggleOverlay() { + if(overlayControl.isOverlayVisible(lineOverlay)){ + gantt.config.readonly = false; + overlayControl.hideOverlay(lineOverlay); + gantt.$root.classList.remove("overlay_visible"); + }else{ + gantt.config.readonly = true; + overlayControl.showOverlay(lineOverlay); + gantt.$root.classList.add("overlay_visible"); + } +} + +function getChartScaleRange(){ + var tasksRange = gantt.getSubtaskDates(); + var cells = []; + var scale = gantt.getScale(); + if(!tasksRange.start_date){ + return scale.trace_x; + } + + scale.trace_x.forEach(function(date){ + if(date >= tasksRange.start_date && date <= tasksRange.end_date){ + cells.push(date); + } + }); + return cells; +} + +function getProgressLine(){ + var tasks = gantt.getTaskByTime(); + var scale = gantt.getScale(); + var step = scale.unit; + + var timegrid = {}; + + var totalDuration = 0; + + gantt.eachTask(function(task){ + if(gantt.isSummaryTask(task)){ + return; + } + if(!task.duration){ + return; + } + + var currDate = gantt.date[scale.unit + "_start"](new Date(task.start_date)); + + while (currDate < task.end_date) { + var date = currDate; + currDate = gantt.date.add(currDate, 1, step); + + if (!gantt.isWorkTime({date: date, task: task, unit: step})) { + continue; + } + + var timestamp = currDate.valueOf(); + if (!timegrid[timestamp]){ + timegrid[timestamp] = { + planned: 0, + real: 0 + }; + } + timegrid[timestamp].planned += 1; + if (date <= today){ + timegrid[timestamp].real += 1 * (task.progress || 0); + } + totalDuration += 1; + } + + }); + + var cumulativePlannedDurations = []; + var cumulativeRealDurations = []; + var cumulativePredictedDurations = [] + var totalPlanned = 0; + var totalReal = 0; + + var chartScale = getChartScaleRange(); + var dailyRealProgress = -1; + var totalPredictedProgress = 0; + for(var i = 0; i < chartScale.length; i++){ + start = new Date(chartScale[i]); + end = gantt.date.add(start, 1, step); + var cell = timegrid[start.valueOf()] || {planned:0, real:0}; + totalPlanned = cell.planned + totalPlanned; + cumulativePlannedDurations.push(totalPlanned); + + if(start <= today) { + totalReal = (cell.real||0) + totalReal; + cumulativeRealDurations.push(totalReal); + cumulativePredictedDurations.push(null); + } else { + if(dailyRealProgress < 0){ + dailyRealProgress = totalReal / cumulativeRealDurations.length; + totalPredictedProgress = totalReal; + cumulativePredictedDurations.pop(); + cumulativePredictedDurations.push(totalPredictedProgress); + } + totalPredictedProgress += dailyRealProgress; + cumulativePredictedDurations.push(totalPredictedProgress); + } + } + + for(var i = 0; i < cumulativePlannedDurations.length; i++){ + cumulativePlannedDurations[i] = Math.round(cumulativePlannedDurations[i] / totalPlanned * 100); + if(cumulativeRealDurations[i] !== undefined){ + cumulativeRealDurations[i] = Math.round(cumulativeRealDurations[i] / totalPlanned * 100); + } + + if(cumulativePredictedDurations[i] !== null){ + cumulativePredictedDurations[i] = Math.round(cumulativePredictedDurations[i] / totalPlanned * 100); + } + } + return {planned: cumulativePlannedDurations, real: cumulativeRealDurations, predicted: cumulativePredictedDurations}; +} + +function getScalePaddings(){ + var scale = gantt.getScale(); + var dataRange = gantt.getSubtaskDates(); + + var chartScale = getChartScaleRange(); + var newWidth = scale.col_width; + var padding = { + left:0, + right:0 + }; + + if(dataRange.start_date){ + var yScaleLabelsWidth = 48; + // fine tune values in order to align chart with the scale range + padding.left = gantt.posFromDate(dataRange.start_date) - yScaleLabelsWidth; + padding.right = scale.full_width - gantt.posFromDate(dataRange.end_date) - yScaleLabelsWidth; + padding.top = gantt.config.row_height - 12; + padding.bottom = gantt.config.row_height - 12; + } + return padding; +} + +var myChart; +var lineOverlay = overlayControl.addOverlay(function(container) { + + var scaleLabels = []; + + var chartScale = getChartScaleRange(); + + chartScale.forEach(function(date){ + scaleLabels.push(dateToStr(date)); + }); + + var values = getProgressLine(); + + var canvas = document.createElement("canvas"); + container.appendChild(canvas); + canvas.style.height = container.offsetHeight + "px"; + canvas.style.width = container.offsetWidth + "px"; + + var ctx = canvas.getContext("2d"); + if(myChart){ + myChart.destroy(); + } + myChart = new Chart(ctx, { + type: "line", + data: { + datasets: [ + { + label: "Planned progress", + backgroundColor: "#001eff", + borderColor: "#001eff", + data: values.planned, + fill: false, + cubicInterpolationMode: 'monotone' + }, + { + label: "Real progress", + backgroundColor: "#ff5454", + borderColor: "#ff5454", + data: values.real, + fill: false, + cubicInterpolationMode: 'monotone' + } + , + { + label: "Real progress (predicted)", + backgroundColor: "#ff5454", + borderColor: "#ff5454", + data: values.predicted, + borderDash: [5, 10], + fill: false, + cubicInterpolationMode: 'monotone' + } + ] + }, + options: { + responsive: true, + maintainAspectRatio: false, + layout: { + padding: getScalePaddings() + }, + onResize: function(chart, newSize) { + var dataRange = gantt.getSubtaskDates(); + if(dataRange.start_date){ + // align chart with the scale range + chart.options.layout.padding = getScalePaddings(); + } + }, + legend: { + display: false + }, + tooltips: { + mode: "index", + intersect: false, + callbacks: { + label: function(tooltipItem, data) { + var dataset = data.datasets[tooltipItem.datasetIndex]; + return dataset.label + ": " + dataset.data[tooltipItem.index] + "%"; + } + } + }, + hover: { + mode: "nearest", + intersect: true + }, + scales: { + xAxes: [{ + labels: scaleLabels, + gridLines:{ + display: false + }, + ticks: { + display: false + } + }, + { + position:"top", + labels: scaleLabels, + gridLines:{ + display: false + }, + ticks: { + display: false + } + } + ], + yAxes: [{ + display: true, + gridLines: { + display:false + }, + ticks: { + display: true, + min: 0, + max: 100, + stepSize: 10, + callback: function(current) { + if (current > 100) {return "";} + return current + "%"; + } + } + }, + { + display: true, + position: "right", + gridLines: { + display:false + }, + ticks: { + display: true, + min: 0, + max: 100, + stepSize: 10, + callback: function(current) { + if (current > 100) {return "";} + return current + "%"; + } + }} + ] + } + } + }); + return canvas; +}); diff --git a/view-mode/function/reportActivity.js b/view-mode/function/reportActivity.js index eeec2b4..3c9088d 100644 --- a/view-mode/function/reportActivity.js +++ b/view-mode/function/reportActivity.js @@ -21,59 +21,8 @@ function resetFormAddRaMaterial() { $('#btn_add_ra_material').prop("disabled", false); } -var qtyActual = document.getElementById('volume_pekerjaan_material'); - qtyActual.addEventListener('keyup', function (e) { - qtyActual.value = formatRibuanInput(this.value); - }); - $(document).ready(function () { - $("#table_report tbody").on("click", ".btn-update-status", function () { - idStatus = $(this).data('id'); - var dataRow = tableRa.row($(this).parents('tr')).data(); - // var data_row = table.row( $(this).parents('tr') ).data() - console.log("data row", dataRow) - - let nameMaterial = $(this).data('material-name'); - let start = moment(dataRow.start_activity).format("YYYY-MM-DD"); - let end = moment(dataRow.finish_activity).format("YYYY-MM-DD"); - $("#ra_date_start_activity").val(start) - $("#ra_date_end_activity").val(end) - $("#ra_select_status").val(dataRow.status_activity) - - if (dataRow.status_activity == 'done') { - $('#ra_date_end_activity').prop('disabled', false); - } else { - $('#ra_date_end_activity').prop('disabled', true); - } - - $(".text-update-status").html(`Update Status Report Activity Material ${nameMaterial}`) - $("#form_report_activity").show(); - }); - - $("#btn-cancel-status").on("click", function () { - resetFormAddRa() - }); - $("#ra_select_status").on("change", function () { - let val = $(this).val() - console.log(val) - if (val == 'done') { - $('#ra_date_end_activity').prop('disabled', false); - } else { - $('#ra_date_end_activity').prop('disabled', true); - } - }); - - $("#ra_date_end_activity").on("change", function () { - let valEnd = $(this).val() - let valStart = $('#ra_date_start_activity').val() - - const compDate = moment(valEnd).isBefore(moment(valStart)) - if (compDate) { - gantt.alert("End Activity Date cannot be lower than Start Activity Date"); - } - }); - var tableRa = $("#table_report").DataTable({ "processing": true, "serverSide": true, @@ -142,9 +91,9 @@ $(document).ready(function () { } }, "columns": [ - { data: 'human_resource', name: 'human_resource' }, + { data: 'human_resource', name: 'human_resource' }, { - data: 'report_date', render: function (data, type) { + data: 'report_date', render: function (data, type) { return data ? formatDate(data) : '-' } }, @@ -154,12 +103,6 @@ $(document).ready(function () { } }, { data: 'description', name: 'description' }, - { - data: 'action', - name: 'action', - orderable: true, - searchable: true - }, ], "order": [[1, 'asc']], }); @@ -184,75 +127,12 @@ $(document).ready(function () { }, { data: 'uom', name: 'uom' }, { - data: 'plan_date', render: function (data, type) { + data: 'plan_date', render: function (data, type) { return data ? formatDate(data) : '-' } }, ] }); - - - $('#select_ra_hr').select2({ - dropdownParent: rAModal, - placeholder: 'Pilih human resource', - allowClear: true, - ajax: { - url: `${base_url}user-to-proyek/select`, - dataType: 'json', - data: function (params) { - var query = { - search: params.term, - type: 'public', - idProyek: proyekId, - idact: activityId - } - return query; - }, - processResults: function (result) { - return { - results: $.map(result, function (item) { - // console.log("cek item", item) - return { - text: item.name, - id: item.id, - } - }) - }; - }, - cache: false - } - }); - - $('#select_ra_hr_material').select2({ - dropdownParent: rAmaterialModal, - placeholder: 'Pilih human resource', - allowClear: true, - ajax: { - url: `${base_url}user-to-proyek/select`, - dataType: 'json', - data: function (params) { - var query = { - search: params.term, - type: 'public', - idProyek: proyekId, - idact: activityId - } - return query; - }, - processResults: function (result) { - return { - results: $.map(result, function (item) { - // console.log("cek item", item) - return { - text: item.name, - id: item.id, - } - }) - }; - }, - cache: false - } - }); $('#modal_report_activity').on('show.bs.modal', function (event) { $("#report_activity_title").html(`Report Activity ${activityName}`) @@ -264,9 +144,6 @@ $(document).ready(function () { }); $('#modal_report_activity').on('hide.bs.modal', function (event) { - if (actionHappen) { - updateActivity(activityId); - } resetFormAddRa(); }); @@ -284,229 +161,21 @@ $(document).ready(function () { $("#modal_report_activity_material").on("click", "#show_form_ra_material", function () { $(this).hide(); - // $("#hide_form_ra_material").show(); $("#form_report_activity_material").show(); }); $("#modal_report_activity_material").on("click", "#hide_form_ra_material", function () { $(this).hide(); resetFormAddRaMaterial() - // $("#show_form_ra_material").show(); - }); - - // $("#form_report_activity").on("submit", function (e) { - // e.preventDefault(); - // var formData = new FormData(this); - // formData.append("activity_id", activityId); - // formData.append("gantt", true); - // let idRa = $("#id_ra").val(); - // actionHappen = true; - // if (idRa && idRa != "") { - // $('#btn_add_ra').html('Updating..'); - // $('#btn_add_ra').prop("disabled", true); - // formData.append("_method", "PUT"); - // updateRa(formData, idRa); - // } else { - // $('#btn_add_ra').html('Adding..'); - // $('#btn_add_ra').prop("disabled", true); - // submitRa(formData); - // } - // }); - - $("#form_report_activity").on("submit", function (e) { - e.preventDefault(); - console.log("submit status") - - let valEnd = $('#ra_date_end_activity').val() - let valStart = $('#ra_date_start_activity').val() - let valStatus = $('#ra_select_status').val() - - const compDate = moment(valEnd).isBefore(moment(valStart)) - console.log({ valEnd, valStart, compDate }) - - if (valStatus == 'done' && compDate) { - gantt.alert("End Activity Date cannot be lower than Start Activity Date"); - - } else { - var formData = new FormData(this); - // formData.append("assign_material_id", idStatus); - formData.append("activity_id", activityId); - actionHappen = true; - - $('#btn_add_ra').html('Updating..'); - $('#btn_add_ra').prop("disabled", true); - submitStatus(formData); - - // if (idRa && idRa != "") { - // $('#btn_add_ra').html('Updating..'); - // $('#btn_add_ra').prop("disabled", true); - // formData.append("_method", "PUT"); - // updateRa(formData, idRa); - // } else { - // $('#btn_add_ra').html('Adding..'); - // $('#btn_add_ra').prop("disabled", true); - // submitStatus(formData, idStatus); - // } - } - - - }); - - $("#form_report_activity_material").on("submit", function (e) { - e.preventDefault(); - var formData = new FormData(this); - formData.append("activity_id", activityId); - // formData.append("assign_material_id", assignMaterialId) - // formData.append("gantt", true); - console.log("test nih ", formData); - let idRa = $("#id_ra_material").val(); - actionHappen = true; - if (idRa && idRa != "") { - $('#btn_add_ra_material').html('Updating..'); - $('#btn_add_ra_material').prop("disabled", true); - formData.append("_method", "PUT"); - updateRaMaterial(formData, idRa); - } else { - $('#btn_add_ra_material').html('Adding..'); - $('#btn_add_ra_material').prop("disabled", true); - submitRaMaterial(formData); - } - }); - - async function submitStatus(formData) { - const result = await axiosInstance - .post(`${base_url}report-activity-material/update-status`, formData) - .then(res => res) - .catch((error) => error.response); - - // console.log("cek result", result); - - if (result && result.data.code == 200) { - gantt.alert("Update Status report activity Success!"); - resetFormAddRa(); - $(".text-update-status").hide() - tableRa.draw(); - } else { - resetFormAddRa(); - $(".text-update-status").hide() - gantt.alert("Update Status activity failed, try again later!"); - } - } - - async function submitRa(formData) { - const result = await axiosInstance - .post(`${base_url}report-activity/add`, formData) - .then(res => res) - .catch((error) => error.response); - - // console.log("cek result", result); - - if (result && result.status == 200) { - gantt.alert("Add report activity Success!"); - resetFormAddRa(); - tableRa.draw(); - } else { - resetFormAddRa(); - gantt.alert("Add report activity failed, try again later!"); - } - } - - async function updateRa(formData, id) { - const result = await axiosInstance - .post(`${base_url}report-activity/update/${id}`, formData) - .then(res => res) - .catch((error) => error.response); - - // console.log("cek result", result); - - if (result && result.status == 200) { - gantt.alert("Edit report activity Success!"); - resetFormAddRa(); - tableRa.draw(); - } else { - resetFormAddRa(); - gantt.alert("Edit report activity failed, try again later!"); - } - } - - async function submitRaMaterial(formData) { - let qty_actual = $("#volume_pekerjaan_material").val(); - formData.set('qty', qty_actual); - const result = await axiosInstance - .post(`${base_url}report-activity-material/add`, formData) - .then(res => res) - .catch((error) => error.response); - - // console.log("cek result", result); - - if (result && result.status == 200) { - gantt.alert("Add report activity material Success!"); - resetFormAddRaMaterial(); - tableRaMaterialActual.draw(); - } else { - resetFormAddRaMaterial(); - gantt.alert("Add report activity material failed, try again later!"); - } - } - - async function updateRaMaterial(formData, id) { - const result = await axiosInstance - .post(`${base_url}report-activity-material/update/${id}`, formData) - .then(res => res) - .catch((error) => error.response); - - // console.log("cek result", result); - - if (result && result.status == 200) { - gantt.alert("Edit report activity Success!"); - resetFormAddRaMaterial(); - tableRaMaterialActual.draw(); - } else { - resetFormAddRaMaterial(); - gantt.alert("Edit report activity failed, try again later!"); - } - } - - $("#table_report").on("click", ".btn_report_delete", function () { - let id = $(this).data('id'); - var box = gantt.confirm({ - text: "Report activity will be deleted from activity, continue?", - ok: "Delete", - cancel: "Cancel", - callback: function (result) { - if (result) { - deleteRa(id); - } - } - }); - }); - - $("#table_activity_material_actual").on("click", ".btn-ram-delete", function () { - let id = $(this).data('id'); - var box = gantt.confirm({ - text: "Report activity material will be deleted from activity material, continue?", - ok: "Delete", - cancel: "Cancel", - callback: function (result) { - if (result) { - deleteRaMaterial(id); - } - } - }); }); $("#btn-close-material").on("click", function () { - - // setTimeout(() => { $(".modal-backdrop").remove(); $("#modal_report_activity_material").hide(); $("#modal_report_activity_material").css("opacity", "0"); }); $("#btn-back-material").on("click", function () { - - // setTimeout(() => { - // $(".modal-backdrop").remove(); $("#modal_report_activity_material").hide(); $("#modal_report_activity_material").css("opacity", "0"); $("#modal_report_activity").show(); @@ -517,129 +186,38 @@ $(document).ready(function () { assignMaterialId = $(this).data('id'); materialName = $(this).data('material-name'); - // console.log(" okeee ",{ assignMaterialId, activityId, materialName }); $("#report_activity_material_title").html(`Report Activity Actual Material ${materialName}`) $("#modal_report_activity").hide(); - + $("#form_report_activity_material").show(); $("#activity_material_plan").hide(); $("#activity_material_actual").show(); $("#table_activity_material_plan").hide(); $("#table_activity_material_actual").show(); - // setTimeout(() => { $("#modal_report_activity_material").show(); $("#modal_report_activity_material").css({ 'opacity': '1', 'margin-top': '40px', }); tableRaMaterialActual.draw(); - - // $(".modal-dialog .modal-lg").css({ - // // 'opacity': '3', - // 'padding-top': '20px', - // }); - - // }, 1000); - - // tableInputProgress.draw(); }); $("#table_report").on("click", ".btn-lihat-plan", function () { assignMaterialId = $(this).data('id'); materialName = $(this).data('material-name'); - // console.log(" okeee ",{ assignMaterialId, activityId, materialName }); $("#report_activity_material_title").html(`Report Activity Plan Material ${materialName}`) $("#modal_report_activity").hide(); - // $("#show_form_ra_material").hide(); $("#activity_material_plan").show(); $("#activity_material_actual").hide(); $("#table_activity_material_plan").show(); $("#table_activity_material_actual").hide(); - - // setTimeout(() => { $("#modal_report_activity_material").show(); $("#modal_report_activity_material").css({ 'opacity': '1', 'margin-top': '40px', }); tableRaMaterialPlan.draw(); - - // $(".modal-dialog .modal-lg").css({ - // // 'opacity': '3', - // 'padding-top': '20px', - // }); - - // }, 1000); - - // tableInputProgress.draw(); }); - function deleteRa(id) { - $.ajax({ - url: `${base_url}report-activity/delete/${id}`, - type: "DELETE", - success: function (data) { - actionHappen = true; - gantt.alert("Delete Report Activity Success!"); - tableRa.draw(); - }, - error: function (data) { - gantt.alert("Delete Report Activity Failed, try again later!"); - } - }); - } - - function deleteRaMaterial(id) { - $.ajax({ - url: `${base_url}report-activity-material/delete/${id}`, - type: "DELETE", - success: function (data) { - actionHappen = true; - gantt.alert("Delete Report Activity Material Success!"); - tableRaMaterialActual.draw(); - }, - error: function (data) { - gantt.alert("Delete Report Activity Material Failed, try again later!"); - } - }); - } - - $("#table_report").on("click", ".btn_report_edit", function () { - let id = $(this).data('id'); - $("#id_ra").val(id); - // console.log("cek edit id", id); - $.ajax({ - url: `${base_url}report-activity/edit/${id}`, - type: "get", - success: function (data) { - console.log("data", data); - if (data && data.code == 200) { - let dataRes = data.data - // console.log("dataRes", dataRes); - $('#btn_add_ra').html('Edit'); - var newOption = new Option(dataRes.user_name, dataRes.user_id, true, true); - $('#select_ra_hr').append(newOption).trigger('change'); - let reportDate = moment(dataRes.report_date).format("YYYY-MM-DD"); - // console.log("reportDate", reportDate); - $("#ra_date").val(reportDate); - $("#volume_pekerjaan").val(dataRes.job_count_report); - $("#ra_description").val(dataRes.description); - $("#show_form_ra").hide(); - $("#hide_form_ra").show(); - $("#form_report_activity").show(); - } else { - resetFormAddRa(); - gantt.alert("Edit Report Activity Failed, try again later!"); - } - // actionHappen = true; - // gantt.alert("Delete Report Activity Success!"); - // tableRa.draw(); - }, - error: function (data) { - resetFormAddRa(); - gantt.alert("Edit Report Activity Failed, try again later!"); - } - }); - }); -}); \ No newline at end of file +}); diff --git a/view-mode/function/toolsResource.js b/view-mode/function/toolsResource.js index 3b7adce..7da7aa2 100644 --- a/view-mode/function/toolsResource.js +++ b/view-mode/function/toolsResource.js @@ -24,12 +24,6 @@ $(document).ready(function () { {data: 'tools_name', name: 'tools_name'}, {data: 'qty_planning', name: 'qty_planning'}, {data: 'uom', name: 'uom'}, - { - data: 'action', - name: 'action', - orderable: true, - searchable: true - }, ] }); @@ -154,7 +148,7 @@ $(document).ready(function () { $('#btn-assign-tools').html('Assign'); $('#btn-assign-tools').prop("disabled",false); } - + resetFormAssignTools(); }, error: function (data) { @@ -169,7 +163,7 @@ $(document).ready(function () { let id = $(this).data('id'); var box = gantt.confirm({ text: "Tools resource will be deleted from activity, continue?", - ok:"Delete", + ok:"Delete", cancel:"Cancel", callback: function(result){ if(result){ @@ -178,4 +172,4 @@ $(document).ready(function () { } }); }); -}); \ No newline at end of file +}); diff --git a/view-mode/index.html b/view-mode/index.html index b291a4d..038f175 100644 --- a/view-mode/index.html +++ b/view-mode/index.html @@ -98,6 +98,9 @@ | + + | @@ -112,44 +115,13 @@