Browse Source

put activity name to material modal title

pull/1/head
Yusuf 2 years ago
parent
commit
1138694680
  1. 47
      src/function/ganttConfig.js
  2. 12
      src/function/materialResource.js

47
src/function/ganttConfig.js

@ -3,14 +3,10 @@ const readOnly = getUrlParameter("ro");
const proyekId = getUrlParameter("proyek_id");
let base_url = getUrlParameter("base_url");
// const ganttId = 14;
// const readOnly = 1;
// const proyekId = 16;
// let base_url = "https://api-iu.ospro.id/api/";
// console.log("cek base url",base_url)
let userToVersionGanttId = 0
let activityId = 0;
let actionHappen = false;
let activityName = "";
let token = getUrlParameter("token");
if (!token || token == "") {
token = `eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvYXBpLWl1Lm9zcHJvLmlkXC9hcGlcL2xvZ2luIiwiaWF0IjoxNjQ2ODA3OTA4LCJleHAiOjE2NDY4OTQzMDgsIm5iZiI6MTY0NjgwNzkwOCwianRpIjoiNmdtcEx3cjlob1JFZ0hSNSIsInN1YiI6MSwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.1xB2rvTJ6Edf7l_8jRPOmoMYnf8f59Rd8jJghJ39xps`;
@ -24,9 +20,6 @@ const axiosInstance = axios.create({
axiosInstance.interceptors.request.use(async (config) => {
try{
// In this moment, show the spinner
// showLoading();
// console.log('showLoading axios');
$("body").addClass("loading");
}
catch(e)
@ -40,9 +33,6 @@ axiosInstance.interceptors.request.use(async (config) => {
axiosInstance.interceptors.response.use(async (config) => {
try {
// In this moment, hide the spinner
// hideLoading();
// console.log('hideLoading axios');
$("body").removeClass("loading");
}
catch(e)
@ -69,14 +59,11 @@ $.ajaxSetup({
}
});
// Add remove loading class on body element depending on Ajax request status
$(document).on({
ajaxStart: function(){
// console.log('ajaxStart');
$("body").addClass("loading");
},
ajaxStop: function(){
// console.log('ajaxStop');
$("body").removeClass("loading");
}
});
@ -143,8 +130,6 @@ var formatter = gantt.ext.formatters.durationFormatter({
var progressEditor = {type: "progressCustom", map_to: "progress", min:0, max: 100};
var costPlanningEditor = {type: "costPlanningEditor", map_to: "rencana_biaya", min:0};
// var finishDateEditor = {type: "finishDateEditor", map_to: "end_date"};
// var startDateEditor = {type: "startDateEditor", map_to: "start_date"};
var linksFormatter = gantt.ext.formatters.linkFormatter({ durationFormatter: formatter });
function satuanLabel(task){
@ -163,8 +148,6 @@ function satuanLabel(task){
const editor = {
text: { type: "text", map_to: "text" },
kode_sortname: { type: "text", map_to: "kode_sortname" },
// planned_start: { type: "date", map_to: "planned_start", min: new Date(2018, 0, 1), max: new Date(2019, 0, 1) },
// planned_end: { type: "date", map_to: "planned_end", min: new Date(2018, 0, 1), max: new Date(2019, 0, 1) },
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 },
@ -268,27 +251,10 @@ function createColumnsConfig(selectedColumns){
var allColumns = [
{ name: "action", label: colHeader, align: "left", min_width: 115, template: colContent, resize: true },
// { name: "wbs", label: "WBS", align: "left", width: 50, template: gantt.getWBSCode, 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: "planned_start", label: "Planned Start", align: "center", min_width: 80, editor: editor.planned_start, resize: true },
// { name: "planned_end", label: "Planned End", align: "center", min_width: 80, editor: editor.planned_end, resize: true },
{ name: "start_date", label: "Start Date", align: "center", min_width: 80, editor: editor.start_date, resize: true },
// { name: "start_date", label: "Start Date", align: "center", min_width: 80, editor: startDateEditor, resize: true, template: function (date) {
// if(!date.start_date){
// return
// }
// let start_date = date.start_date
// return formatDate(start_date)
// } },
{ name: "end_date", label: "Finish Date", align: "center", min_width: 80, editor: editor.end_date, resize: true },
// { name: "end_date", label: "Finish Date", align: "center", min_width: 80, editor: finishDateEditor, resize: true, template: function (date) {
// if(!date.end_date){
// return
// }
// let end_date = date.end_date
// return formatDate(end_date)
// } },
{ name: "duration", label: "Duration", align: "center", min_width: 50, editor: editor.duration, resize: true },
{ name: "rencana_biaya", label: "Cost Planning", align: "center", min_width: 100, editor: costPlanningEditor, resize: true, template: function (text) {
if(!text.rencana_biaya){
@ -308,11 +274,8 @@ var allColumns = [
if(text.type=="project" || text.type=="milestone"){
return;
}
activityId = text.id;
let html = ``;
var assign_hr = text.assign_hr
// console.log("assign_hr ", text);
if(!assign_hr || !assign_hr.length){
html = `<span class="badge badge-pill badge-danger">Unassigned</span>`;
}else{
@ -324,7 +287,6 @@ var allColumns = [
});
}
}
// console.log("cek assgin hr", assign_hr);
return `<div class="d-flex justify-content-center align-items-center" data-toggle="modal" data-target="#modal-hr" style="min-width:100%;height:100%;">
${html}
</div>`
@ -334,9 +296,8 @@ var allColumns = [
if(text.type=="project" || text.type=="milestone"){
return;
}
activityId = text.id;
activityName = text.kode_sortname || text.text;
let html = ``;
// console.log("text.assign_material ", text);
var assign_material = text.assign_material
if(!assign_material || !assign_material.length){
@ -354,7 +315,6 @@ var allColumns = [
if(text.type=="project" || text.type=="milestone"){
return;
}
activityId = text.id;
let html = ``;
var assign_tools = text.assign_tools
@ -395,8 +355,7 @@ var allColumns = [
if(text.type=="project" || text.type=="milestone"){
return;
}
activityId = text.id;
let activityName = text.kode_sortname || text.text;
activityName = text.kode_sortname || text.text;
$("#report_activity_title").html(`Report Activity ${activityName}`)
let html = text.jobs_done ? text.jobs_done : 0;
return `<div class="d-flex justify-content-center align-items-center" data-toggle="modal" data-target="#modal_report_activity" style="min-width:100%;height:100%;">

12
src/function/materialResource.js

@ -4,12 +4,9 @@ function resetFormAssignMaterial() {
$('#select-material').val(null).trigger("change");
$('#select-material').find('option').remove();
$('#select-material').val("");
// $("#form-assign-material").hide();
$('#form-assign-material').trigger("reset");
$('#btn-assign-material').html('Assign');
$('#btn-assign-material').prop("disabled", false);
// $("#show-form-material").show();
// $("#hide-form-material").hide();
};
@ -19,12 +16,6 @@ var rupiah = document.getElementById('price-req-material');
});
$(document).ready(function () {
// var rupiah = document.getElementById('price-req-material');
// rupiah.addEventListener('keyup', function(e){
// rupiah.value = formatRupiah(this.value, 'Rp. ');
// });
var tableMaterial = $("#table-material").DataTable({
"processing": true,
"serverSide": true,
@ -39,10 +30,8 @@ $(document).ready(function () {
{ data: 'material_name', name: 'material_name' },
{ data: 'qty_planning', name: 'qty_planning' },
{ data: 'uom', name: 'uom' },
// {data: 'budget', name: 'budget'},
{
data: 'budget', render: function (data, type) {
// console.log({ data, type })
return data ? "Rp. " + formatRupiah(parseInt(data)) : '-'
}
},
@ -88,6 +77,7 @@ $(document).ready(function () {
});
$('#modal-material').on('show.bs.modal', function (event) {
$('#modal-material-title').html("Material Resource " + activityName);
tableMaterial.draw();
});

Loading…
Cancel
Save