Browse Source

view mode

pull/1/head
Muhammad Sulaiman Yusuf 2 years ago
parent
commit
744dbb953c
  1. 144
      view-mode/function/ganttConfig.js
  2. 6
      view-mode/function/holiday.js
  3. 154
      view-mode/function/humanResource.js
  4. 233
      view-mode/function/materialResource.js
  5. 284
      view-mode/function/overlaySCurve.js
  6. 422
      view-mode/function/reportActivity.js
  7. 6
      view-mode/function/toolsResource.js
  8. 311
      view-mode/index.html

144
view-mode/function/ganttConfig.js

@ -75,27 +75,19 @@ gantt.plugins({
auto_scheduling: true auto_scheduling: true
}); });
// gantt.templates.parse_date = function (date) { gantt.config.highlight_critical_path = true;
// return new Date(2019,01,01);
// };
// gantt.config.highlight_critical_path = true;
gantt.config.date_format = "%Y-%m-%d %H:%i:%s"; 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.auto_scheduling = true;
gantt.config.fit_tasks = true; gantt.config.fit_tasks = true;
if (!base_url) { if (!base_url) {
base_url = `https://api-iu.ospro.id/api/`; base_url = `https://api-iu.ospro.id/api/`;
// console.log("cek base url 2",base_url)
}else{ }else{
base_url = base_url+"/"; base_url = base_url+"/";
} }
// console.log("cek base url 3",base_url)
// gantt plugins
gantt.plugins({ gantt.plugins({
marker: true, marker: true,
fullscreen: true fullscreen: true,
overlay: true
}); });
// add today line // add today line
@ -106,21 +98,7 @@ var markerId = gantt.addMarker({
text: "Today", text: "Today",
title: dateToStr(new Date()) title: dateToStr(new Date())
}); });
gantt.getMarker(markerId); //->{css:"today", text:"Now", id:...} gantt.getMarker(markerId);
var colHeader = '<div class="gantt_grid_head_cell"><i style="margin-right:5px;" class="gantt_grid_head_cell f-blue-sky fa fa-plus icon-action-header" onclick="addWithoutParent()"></i><i class="gantt_grid_head_cell icon-action-header f-black fab fa-jira" onclick="addMilestone(null)"></i></div>',
colContent = function (task) {
var hasChild = gantt.hasChild(task.id);
var optionsContent = '<div class="align-left">';
optionsContent += '<i title="Add Activity" class="fa gantt_button_grid gantt_grid_add fa-plus icon-action f-blue-sky" onclick="clickGridButton(' + task.id + ', \'add\')"></i> ';
optionsContent += '<i title="Delete Activity" class="fa gantt_button_grid gantt_grid_delete fa-times icon-action f-red" onclick="clickGridButton(' + task.id + ', \'delete\')"></i> ';
optionsContent += '<i title="Add Milestone" class="fa gantt_button_grid gantt_grid_add fab fa-jira icon-action f-black" onclick="addMilestone('+task.id+')"></i> ';
optionsContent += !hasChild ? '<i title="Upload Document" class="fa gantt_button_grid gantt_grid_delete fa-file icon-action f-orange" onclick="clickGridButton(' + task.id + ', \'upload\')"></i> ' : '';
optionsContent += !hasChild ? '<i title="Show Comments" class="fa gantt_button_grid gantt_grid_delete fa-comment icon-action f-black" onclick="clickGridButton(' + task.id + ', \'comment\')"></i> ' : '';
optionsContent += !hasChild ? '<i title="Activity Location" class="fa fas gantt_button_grid gantt_grid_delete fa-map-marked icon-action f-green" onclick="openActivityMap(' + task.id + ')"></i> ' : '';
optionsContent += '</div>';
return (optionsContent);
};
let no = 4; // for temporary change with last id in database m_activity 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" 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 }); var linksFormatter = gantt.ext.formatters.linkFormatter({ durationFormatter: formatter });
function satuanLabel(task){ function satuanLabel(task){
@ -147,24 +123,6 @@ function satuanLabel(task){
return ""; 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: (`<div data-toggle="modal" data-target="#modal-hr">
&nbsp;&nbsp;&nbsp;
</div>`),
satuan:{type: "select", map_to: "satuan_id", options:gantt.serverList("satuan")}
}
function addWithoutParent() { function addWithoutParent() {
var task = gantt.getTaskByIndex(0); var task = gantt.getTaskByIndex(0);
@ -252,12 +210,11 @@ function createColumnsConfig(selectedColumns){
} }
var allColumns = [ 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, 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, 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, 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, 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, resize: true },
{ 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, resize: true, template: function (text) { { name: "rencana_biaya", label: "Cost Planning", align: "center", min_width: 100, resize: true, template: function (text) {
if(!text.rencana_biaya){ if(!text.rencana_biaya){
return return
@ -265,14 +222,14 @@ var allColumns = [
let rencana_biaya = text.rencana_biaya let rencana_biaya = text.rencana_biaya
return "Rp. "+ formatRupiah(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){ if(!text.biaya_actual){
return return
} }
let biaya_actual = text.biaya_actual let biaya_actual = text.biaya_actual
return "Rp. "+ formatRupiah(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"){ if(text.type=="project" || text.type=="milestone"){
return; return;
} }
@ -312,34 +269,14 @@ var allColumns = [
${html} ${html}
</div>` </div>`
} }, } },
{ 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 = `<span class="badge badge-pill badge-danger">Unassigned</span>`;
}else{
if(assign_tools.length > 0 ){
html = `<span class="text-capitalize badge badge-pill badge-primary">Assigned</span>`;
}
}
return `<div class="d-flex justify-content-center align-items-center" data-toggle="modal" data-target="#modal-tools" style="min-width:100%;height:100%;">
${html}
</div>`
} },
// { 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) { { name: "bobot_planning", label: "Bobot Activity (%)", align: "center", resize: true, min_width: 115, template: function (text) {
if(!text.bobot_planning){ if(!text.bobot_planning){
return return
} }
let bobot_planning = parseFloat(text.bobot_planning); let bobot_planning = parseFloat(text.bobot_planning);
// console.log("bobot_planning", bobot_planning);
return roundToTwo(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 let progress = text.progress
progress = progress*100 progress = progress*100
return progress; return progress;
@ -351,7 +288,7 @@ var allColumns = [
let actual = (progress*bobot) / 100 let actual = (progress*bobot) / 100
return roundToTwo(actual); return roundToTwo(actual);
}, resize: true }, }, 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) { { name: "jobs_done", label: "Volume Actual", align: "center", min_width: 100, resize: true, template: function (text) {
if(text.type=="project" || text.type=="milestone"){ if(text.type=="project" || text.type=="milestone"){
return; return;
@ -361,38 +298,12 @@ var allColumns = [
${html} ${html}
</div>` </div>`
} }, } },
{ 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 } { 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({ gantt.config.columns = createColumnsConfig({
action: true,
kode_sortname: true, kode_sortname: true,
text: true, text: true,
// planned_start: true,
// planned_end: true,
start_date: true, start_date: true,
end_date: true, end_date: true,
duration: true, duration: true,
@ -400,14 +311,11 @@ gantt.config.columns = createColumnsConfig({
cost_actual: true, cost_actual: true,
assign_hr: true, assign_hr: true,
material: true, material: true,
tools: true,
bobot_planning: true, bobot_planning: true,
progress: true, progress: true,
progress_actual: true, progress_actual: true,
jumlah_pekerjaan: true, jumlah_pekerjaan: true,
jobs_done:true, jobs_done:true,
satuan: true,
predecessor: true,
updated_by: true updated_by: true
}) })
@ -416,32 +324,13 @@ gantt.config.resize_rows = true;
gantt.config.grid_resize = true; // pro edition gantt.config.grid_resize = true; // pro edition
gantt.config.min_column_width = 50; gantt.config.min_column_width = 50;
gantt.config.scale_height = 20; gantt.config.scale_height = 20;
// gantt.config.row_height = 30;
gantt.config.order_branch = "marker"; gantt.config.order_branch = "marker";
gantt.config.order_branch_free = true; gantt.config.order_branch_free = true;
gantt.config.open_tree_initially = 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.row_height = 30;
gantt.config.task_height = 20; 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({ gantt.addTaskLayer({
renderer: { renderer: {
render: function draw_planned(task) { render: function draw_planned(task) {
@ -499,7 +388,7 @@ gantt.attachEvent("onTaskLoading", function(task){
gantt.config.autoscroll = true; gantt.config.autoscroll = true;
gantt.config.scroll_size = 30; gantt.config.scroll_size = 50;
gantt.config.layout = { gantt.config.layout = {
css: "gantt_container", css: "gantt_container",
cols: [ cols: [
@ -521,18 +410,13 @@ gantt.config.layout = {
] ]
}; };
// custom folder, file, collapse icons on activity
gantt.templates.grid_folder = function (item) { gantt.templates.grid_folder = function (item) {
// return "<div class='gantt_tree_icon gantt_folder_" + (item.$open ? "open" : "closed") + "'></div>";
return ""; return "";
}; };
gantt.templates.grid_file = function (item) { gantt.templates.grid_file = function (item) {
// return "<div class='gantt_tree_icon gantt_file'></div>";
return ""; return "";
}; };
// Set workdays
gantt.config.work_time = true; gantt.config.work_time = true;
gantt.config.duration_unit = "day"; gantt.config.duration_unit = "day";

6
view-mode/function/holiday.js

@ -22,12 +22,6 @@ $(document).ready(function () {
{data: 'date', name: 'date'}, {data: 'date', name: 'date'},
{data: 'duration', name: 'duration'}, {data: 'duration', name: 'duration'},
{data: 'description', name: 'description'}, {data: 'description', name: 'description'},
{
data: 'action',
name: 'action',
orderable: false,
searchable: false
}
] ]
}); });

154
view-mode/function/humanResource.js

@ -8,9 +8,6 @@ function resetFormAssign() {
$('#select-hr').find('option').remove(); $('#select-hr').find('option').remove();
$('#select-hr').val(""); $('#select-hr').val("");
$("#hr_role").val(""); $("#hr_role").val("");
// $("#hide-form-hr").hide();
// $("#show-form-hr").show();
// $("#form-assign-hr").hide();
$('#form-assign-hr').trigger("reset"); $('#form-assign-hr').trigger("reset");
$('#btn-assign-hr').html('Assign'); $('#btn-assign-hr').html('Assign');
$('#btn-assign-hr').prop("disabled", false); $('#btn-assign-hr').prop("disabled", false);
@ -29,29 +26,9 @@ $(document).ready(function () {
"columns": [ "columns": [
{ data: 'user_name', name: 'user_name' }, { data: 'user_name', name: 'user_name' },
{ data: 'role_name', name: 'role_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 () { $("#modal-hr").on("click", "#show-form-hr", function () {
$(this).hide(); $(this).hide();
@ -72,138 +49,7 @@ $(document).ready(function () {
$('#modal-hr').on('hide.bs.modal', function (event) { $('#modal-hr').on('hide.bs.modal', function (event) {
$("#hide-form-hr").hide(); $("#hide-form-hr").hide();
$("#show-form-hr").show(); $("#show-form-hr").show();
if (actionHappen) {
console.log("there's action change");
updateActivity(activityId);
}
resetFormAssign(); 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);
}
}
});
});
}); });

233
view-mode/function/materialResource.js

@ -9,17 +9,6 @@ function resetFormAssignMaterial() {
$('#btn-assign-material').prop("disabled", false); $('#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 () { $(document).ready(function () {
var tableMaterial = $("#table-material").DataTable({ var tableMaterial = $("#table-material").DataTable({
"processing": true, "processing": true,
@ -49,30 +38,9 @@ $(document).ready(function () {
return data ? formatDate(data) : '-' 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 () { $("#modal-material").on("click", "#show-form-material", function () {
$(this).hide(); $(this).hide();
$("#hide-form-material").show(); $("#hide-form-material").show();
@ -91,209 +59,8 @@ $(document).ready(function () {
}); });
$('#modal-material').on('hide.bs.modal', function (event) { $('#modal-material').on('hide.bs.modal', function (event) {
// $("#hide-form-material").hide();
$("#show-form-material").show(); $("#show-form-material").show();
console.log("there's before action change ", actionHappen);
if (actionHappen) {
console.log("there's action change ", actionHappen);
updateActivity(activityId);
}
resetFormAssignMaterial(); 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
}
});
$('#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,
}
return query;
},
headers: {
'Authorization': `Bearer ${token}`
},
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);
}
}
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{
// }
});
// 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);
}
}
});
});
}); });

284
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;
});

422
view-mode/function/reportActivity.js

@ -21,59 +21,8 @@ function resetFormAddRaMaterial() {
$('#btn_add_ra_material').prop("disabled", false); $('#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 () { $(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({ var tableRa = $("#table_report").DataTable({
"processing": true, "processing": true,
"serverSide": true, "serverSide": true,
@ -154,12 +103,6 @@ $(document).ready(function () {
} }
}, },
{ data: 'description', name: 'description' }, { data: 'description', name: 'description' },
{
data: 'action',
name: 'action',
orderable: true,
searchable: true
},
], ],
"order": [[1, 'asc']], "order": [[1, 'asc']],
}); });
@ -191,69 +134,6 @@ $(document).ready(function () {
] ]
}); });
$('#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) { $('#modal_report_activity').on('show.bs.modal', function (event) {
$("#report_activity_title").html(`Report Activity ${activityName}`) $("#report_activity_title").html(`Report Activity ${activityName}`)
tableRa.draw(); tableRa.draw();
@ -264,9 +144,6 @@ $(document).ready(function () {
}); });
$('#modal_report_activity').on('hide.bs.modal', function (event) { $('#modal_report_activity').on('hide.bs.modal', function (event) {
if (actionHappen) {
updateActivity(activityId);
}
resetFormAddRa(); resetFormAddRa();
}); });
@ -284,229 +161,21 @@ $(document).ready(function () {
$("#modal_report_activity_material").on("click", "#show_form_ra_material", function () { $("#modal_report_activity_material").on("click", "#show_form_ra_material", function () {
$(this).hide(); $(this).hide();
// $("#hide_form_ra_material").show();
$("#form_report_activity_material").show(); $("#form_report_activity_material").show();
}); });
$("#modal_report_activity_material").on("click", "#hide_form_ra_material", function () { $("#modal_report_activity_material").on("click", "#hide_form_ra_material", function () {
$(this).hide(); $(this).hide();
resetFormAddRaMaterial() 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 () { $("#btn-close-material").on("click", function () {
// setTimeout(() => {
$(".modal-backdrop").remove(); $(".modal-backdrop").remove();
$("#modal_report_activity_material").hide(); $("#modal_report_activity_material").hide();
$("#modal_report_activity_material").css("opacity", "0"); $("#modal_report_activity_material").css("opacity", "0");
}); });
$("#btn-back-material").on("click", function () { $("#btn-back-material").on("click", function () {
// setTimeout(() => {
// $(".modal-backdrop").remove();
$("#modal_report_activity_material").hide(); $("#modal_report_activity_material").hide();
$("#modal_report_activity_material").css("opacity", "0"); $("#modal_report_activity_material").css("opacity", "0");
$("#modal_report_activity").show(); $("#modal_report_activity").show();
@ -517,7 +186,6 @@ $(document).ready(function () {
assignMaterialId = $(this).data('id'); assignMaterialId = $(this).data('id');
materialName = $(this).data('material-name'); materialName = $(this).data('material-name');
// console.log(" okeee ",{ assignMaterialId, activityId, materialName });
$("#report_activity_material_title").html(`Report Activity Actual Material ${materialName}`) $("#report_activity_material_title").html(`Report Activity Actual Material ${materialName}`)
$("#modal_report_activity").hide(); $("#modal_report_activity").hide();
@ -527,119 +195,29 @@ $(document).ready(function () {
$("#table_activity_material_plan").hide(); $("#table_activity_material_plan").hide();
$("#table_activity_material_actual").show(); $("#table_activity_material_actual").show();
// setTimeout(() => {
$("#modal_report_activity_material").show(); $("#modal_report_activity_material").show();
$("#modal_report_activity_material").css({ $("#modal_report_activity_material").css({
'opacity': '1', 'opacity': '1',
'margin-top': '40px', 'margin-top': '40px',
}); });
tableRaMaterialActual.draw(); tableRaMaterialActual.draw();
// $(".modal-dialog .modal-lg").css({
// // 'opacity': '3',
// 'padding-top': '20px',
// });
// }, 1000);
// tableInputProgress.draw();
}); });
$("#table_report").on("click", ".btn-lihat-plan", function () { $("#table_report").on("click", ".btn-lihat-plan", function () {
assignMaterialId = $(this).data('id'); assignMaterialId = $(this).data('id');
materialName = $(this).data('material-name'); materialName = $(this).data('material-name');
// console.log(" okeee ",{ assignMaterialId, activityId, materialName });
$("#report_activity_material_title").html(`Report Activity Plan Material ${materialName}`) $("#report_activity_material_title").html(`Report Activity Plan Material ${materialName}`)
$("#modal_report_activity").hide(); $("#modal_report_activity").hide();
// $("#show_form_ra_material").hide();
$("#activity_material_plan").show(); $("#activity_material_plan").show();
$("#activity_material_actual").hide(); $("#activity_material_actual").hide();
$("#table_activity_material_plan").show(); $("#table_activity_material_plan").show();
$("#table_activity_material_actual").hide(); $("#table_activity_material_actual").hide();
// setTimeout(() => {
$("#modal_report_activity_material").show(); $("#modal_report_activity_material").show();
$("#modal_report_activity_material").css({ $("#modal_report_activity_material").css({
'opacity': '1', 'opacity': '1',
'margin-top': '40px', 'margin-top': '40px',
}); });
tableRaMaterialPlan.draw(); 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!");
}
});
});
}); });

6
view-mode/function/toolsResource.js

@ -24,12 +24,6 @@ $(document).ready(function () {
{data: 'tools_name', name: 'tools_name'}, {data: 'tools_name', name: 'tools_name'},
{data: 'qty_planning', name: 'qty_planning'}, {data: 'qty_planning', name: 'qty_planning'},
{data: 'uom', name: 'uom'}, {data: 'uom', name: 'uom'},
{
data: 'action',
name: 'action',
orderable: true,
searchable: true
},
] ]
}); });

311
view-mode/index.html

@ -98,6 +98,9 @@
<button title="Expand Activities" class="btn btn-sm btn-icon-toolbar" id="gantt_toggle_task_btn"><i <button title="Expand Activities" class="btn btn-sm btn-icon-toolbar" id="gantt_toggle_task_btn"><i
class="fa fa-expand-alt icon-toolbar"></i></button> class="fa fa-expand-alt icon-toolbar"></i></button>
<span class="icon-toolbar-separator">|</span> <span class="icon-toolbar-separator">|</span>
<button id="scurve_button" title="Display S-Curve" class="btn btn-sm btn-icon-toolbar" onclick="toggleOverlay()" value="Toggle Progress Line">
<i class="fa icon-toolbar fa-chart-line"></i></button>
<span class="icon-toolbar-separator">|</span>
<button id="fullscreen_button" title="Full Screen" class="btn btn-sm btn-icon-toolbar"> <button id="fullscreen_button" title="Full Screen" class="btn btn-sm btn-icon-toolbar">
<i class="fa icon-toolbar fa-expand"></i></button> <i class="fa icon-toolbar fa-expand"></i></button>
</div> </div>
@ -112,44 +115,13 @@
<div class="modal-content"> <div class="modal-content">
<div class="modal-header d-flex flex-row justify-content-between" style="width: 100%;"> <div class="modal-header d-flex flex-row justify-content-between" style="width: 100%;">
<h5 class="modal-title" id="exampleModalLabel">Human Resource</h5> <h5 class="modal-title" id="exampleModalLabel">Human Resource</h5>
<div>
<!-- <button id="show-form-hr" type="button" class="btn btn-primary btn-sm"><i class="fa fa-plus"
aria-hidden="true"></i></button>
<button id="hide-form-hr" type="button" class="elm-hide btn btn-primary btn-sm"><i class="fa fa-chevron-up"
aria-hidden="true"></i></button> -->
<!-- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button> -->
</div>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form id="form-assign-hr">
<div class="form-row">
<div class="col-md-10 form-group">
<label>Human Resource</label>
<select id="select-hr" name="user_id" class="form-control form-control-sm" style="width:100%;"></select>
</div>
<div class="col-md-2 form-group">
<button style="margin-top: 31px;" id="btn-assign-hr" type="submit"
class="btn btn-sm btn-primary">Assign</button>
</div>
<input type="hidden" id=hr_role />
<!-- <div class="col-md-6 form-group">
<label>Project Role Resource</label>
<select id="select-role-hr" name="role_proyek_id" class="form-control form-control-sm" style="width:100%;"></select>
</div> -->
</div>
<!-- <div class="text-right">
<button id="btn-assign-hr" type="submit" class="btn btn-sm btn-primary">Assign</button>
</div> -->
<hr />
</form>
<table id="table-hr" class="table table-sm" style="width: 100%;"> <table id="table-hr" class="table table-sm" style="width: 100%;">
<thead> <thead>
<tr> <tr>
<th scope="col">User</th> <th scope="col">User</th>
<th scope="col">Role</th> <th scope="col">Role</th>
<th scope="col">Actions</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -173,32 +145,15 @@
<button title="Add Comment" type="button" class="btn btn-primary btn-sm modal_add_btn_comment"> <button title="Add Comment" type="button" class="btn btn-primary btn-sm modal_add_btn_comment">
<span aria-hidden="true"><i class="fa fa-plus"></i></span> <span aria-hidden="true"><i class="fa fa-plus"></i></span>
</button> </button>
<!-- <button title="close" type="button" class="btn btn-xs" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true"><i class="fa fa-times"></i></span>
</button> -->
</div> </div>
</div> </div>
<div class="modal-body" id="modal_comments_body"> <div class="modal-body" id="modal_comments_body">
<div>
<form id="add_comment_form">
<input type="hidden" id="activity_id" name="activity_id" />
<div class="form-group">
<label for="comment"><b>Add comment</b></label>
<textarea class="form-control" id="comment" name="comment" rows="3"></textarea>
</div>
<div class="text-right">
<button type="button" class="btn btn-sm btn-primary" id="btn_comment_submit">Submit</button>
</div>
<hr />
</form>
</div>
<div id="comments_list"> <div id="comments_list">
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">Close</button>
<!-- <button type="button" class="btn btn-primary">Save changes</button> -->
</div> </div>
</div> </div>
</div> </div>
@ -217,20 +172,6 @@
</div> </div>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div>
<form id="add_doc_form">
<input type="hidden" id="activity_id" name="activity_id" />
<div class="form-group">
<label for="dokumen"><b>Add document</b></label>
<input type="file" class="form-control" name="dokumen" id="dokumen" />
</div>
<div class="text-right">
<!-- <button type="button" class="btn btn-sm btn-warning text-white" id="btn_doc_reset">Reset</button> -->
<button type="button" class="btn btn-sm btn-primary" id="btn_doc_submit">Upload</button>
</div>
<hr />
</form>
</div>
<div id="documents_list"> <div id="documents_list">
<table id="documents_table"> <table id="documents_table">
<thead> <thead>
@ -244,7 +185,6 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@ -260,48 +200,8 @@
<div class="modal-content"> <div class="modal-content">
<div class="modal-header d-flex flex-row justify-content-between" style="width: 100%;"> <div class="modal-header d-flex flex-row justify-content-between" style="width: 100%;">
<h5 class="modal-title" id="modal-material-title">Material Resource</h5> <h5 class="modal-title" id="modal-material-title">Material Resource</h5>
<div>
</div>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form id="form-assign-material">
<div class="form-row">
<div class="col-md-2 form-group">
<label>Description</label>
<select id="select-material-integration" name="descriptionReqMaterial" class="form-control form-control-sm"
style="width:100%;"></select>
</div>
<div class="col-md-2 form-group">
<label>Price (IDR)</label>
<input type="text" id="price-req-material" name="priceReqMaterial"
class="form-control form-control-sm" />
</div>
<div class="col-md-2 form-group">
<label>QTY</label>
<input type="text" id="qty-req-material" name="qtyReqMaterial"
class="form-control form-control-sm" />
</div>
<div class="col-md-1 form-group">
<label>UOM</label>
<input type="text" id="uom-req-material" name="uomReqMaterial" class="form-control form-control-sm" />
</div>
<div class="col-md-2 form-group">
<label>Expected arrival date</label>
<input type="date" id="required-date-req-material" name="requiredDateReqMaterial"
class="form-control form-control-sm" />
</div>
<div class="col-md-2 form-group">
<label>Will be used at</label>
<input type="date" id="required-date-plan-material" name="requiredDatePlanMaterial"
class="form-control form-control-sm" />
</div>
<div class="col-md-1 form-group">
<button style="margin-top: 31px;" id="btn-assign-material" type="submit"
class="btn btn-sm btn-primary">Assign</button>
</div>
</div>
<hr />
</form>
<table id="table-material" class="table table-sm" style="width: 100%;"> <table id="table-material" class="table table-sm" style="width: 100%;">
<thead> <thead>
<tr> <tr>
@ -310,7 +210,6 @@
<th scope="col">UOM</th> <th scope="col">UOM</th>
<th scope="col">Price</th> <th scope="col">Price</th>
<th scope="col">Planning Date</th> <th scope="col">Planning Date</th>
<th scope="col">Actions</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -330,39 +229,14 @@
<div class="modal-content"> <div class="modal-content">
<div class="modal-header d-flex flex-row justify-content-between" style="width: 100%;"> <div class="modal-header d-flex flex-row justify-content-between" style="width: 100%;">
<h5 class="modal-title" id="exampleModalLabel">Tools Resource</h5> <h5 class="modal-title" id="exampleModalLabel">Tools Resource</h5>
<div>
<!-- <button id="show-form-tools" type="button" class="btn btn-primary btn-sm"><i class="fa fa-plus"
aria-hidden="true"></i></button>
<button id="hide-form-tools" type="button" class="elm-hide btn btn-primary btn-sm"><i
class="fa fa-chevron-up" aria-hidden="true"></i></button> -->
</div>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form id="form-assign-tools">
<div class="form-row">
<div class="col-md-5 form-group">
<label>Tools Resource</label>
<select id="select-tools" name="tools_id" class="form-control form-control-sm"
style="width:100%;"></select>
</div>
<div class="col-md-5 form-group">
<label>QTY</label>
<input type="number" id="select-tools-qty" name="qty" class="form-control form-control-sm" />
</div>
<div class="col-md-2 form-group">
<button style="margin-top: 31px;" id="btn-assign-tools" type="submit"
class="btn btn-sm btn-primary">Assign</button>
</div>
</div>
<hr />
</form>
<table id="table-tools" class="table table-sm" style="width: 100%;"> <table id="table-tools" class="table table-sm" style="width: 100%;">
<thead> <thead>
<tr> <tr>
<th scope="col">Tools Name</th> <th scope="col">Tools Name</th>
<th scope="col">QTY</th> <th scope="col">QTY</th>
<th scope="col">UOM</th> <th scope="col">UOM</th>
<th scope="col">Actions</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -405,23 +279,6 @@
</ul> </ul>
<div class="tab-content" id="myTabContent"> <div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active pt-1" id="days-off" role="tabpanel" aria-labelledby="days-off-tab"> <div class="tab-pane fade show active pt-1" id="days-off" role="tabpanel" aria-labelledby="days-off-tab">
<div>
<form id="modal_gantt_setting_form">
<div class="form-group">
<label><b>Set Days Off</b></label>
<select name="select_dayoff[]" id="select_dayoff" class="form-control" placeholder="Select Days"
multiple>
<option value="0">Sunday</option>
<option value="1">Monday</option>
<option value="2">Tuesday</option>
<option value="3">Wednesday</option>
<option value="4">Thursday</option>
<option value="5">Friday</option>
<option value="6">Saturday</option>
</select>
</div>
</form>
</div>
<div> <div>
<div class="d-flex justify-content-between pr-1 pl-1 mb-1" style="width: 100%;"> <div class="d-flex justify-content-between pr-1 pl-1 mb-1" style="width: 100%;">
<h6><b>Set Holidays</b></h6> <h6><b>Set Holidays</b></h6>
@ -429,35 +286,12 @@
<button id="hide-holiday" class="btn btn-sm btn-primary elm-hide"><i <button id="hide-holiday" class="btn btn-sm btn-primary elm-hide"><i
class="fa fa-chevron-up"></i></button> class="fa fa-chevron-up"></i></button>
</div> </div>
<form class="mb-1 elm-hide" id="form_holiday">
<div class="form-row">
<div class="col-md-3 form-group">
<label>Date</label>
<input id="date_holiday" required type="date" name="date" class="form-control form-control-sm" />
</div>
<div class="col-md-3 form-group">
<label>Duration</label>
<input id="duration_holiday" required type="number" name="duration"
class="form-control form-control-sm" value="1" />
</div>
<div class="col-md-6 form-group">
<label>Description</label>
<textarea id="desc_holiday" type="text" name="description" class="form-control form-control-sm"
placeholder="Cuti bersama tahun baru.."></textarea>
</div>
</div>
<div class="text-right">
<button id="btn_add_holiday" type="submit" class="btn btn-sm btn-primary">Add Holiday</button>
</div>
<hr />
</form>
<table style="width: 100%;" class="table table-sm" id="table_holiday"> <table style="width: 100%;" class="table table-sm" id="table_holiday">
<thead> <thead>
<tr> <tr>
<th>Date</th> <th>Date</th>
<th>Duration</th> <th>Duration</th>
<th>Description</th> <th>Description</th>
<th>Action</th>
</tr> </tr>
</thead> </thead>
</table> </table>
@ -491,47 +325,6 @@
</div> </div>
</div> </div>
<!-- modal gantt milestone -->
<div class="modal fade" id="modal-add-milestone" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Add Milestone</h5>
<div class="modal-actions">
<button title="close" type="button" class="btn btn-xs" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true"><i class="fa fa-times"></i></span>
</button>
</div>
</div>
<form id="form-milestone">
<div class="modal-body">
<input type="hidden" id="milestone_parent" name="milestone_parent" />
<input type="hidden" id="name_milestone" name="status" />
<div class="form-group">
<label>Milestone Name</label>
<select id="select-milestone" name="id_milestone" class="form-control form-control-sm"
style="width:100%;"></select>
<!-- <input type="text" name="name" class="form-control form-control-sm" placeholder="Build 1.." /> -->
</div>
<div class="form-row">
<div class="col-md-6 form-group">
<label>Due Date</label>
<input id="due_milestone" type="date" name="due_date" class="form-control form-control-sm" />
</div>
<div class="col-md-6 form-group">
<label>Deadline</label>
<input id="deadline_milestone" type="date" name="deadline" class="form-control form-control-sm" />
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-sm btn-primary" id="submit-milestone">Add</button>
</div>
</form>
</div>
</div>
</div>
<!-- modal gantt laporan activity new --> <!-- modal gantt laporan activity new -->
<div class="modal fade" id="modal_report_activity" tabindex="-1" role="dialog"> <div class="modal fade" id="modal_report_activity" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document"> <div class="modal-dialog modal-lg" role="document">
@ -542,47 +335,9 @@
<button id="show_form_ra" type="button" class="success btn btn-success btn-sm btn-update-status" <button id="show_form_ra" type="button" class="success btn btn-success btn-sm btn-update-status"
data-toggle="tooltip" title="Input Update Status" data-placement="top" aria-hidden="true"><i data-toggle="tooltip" title="Input Update Status" data-placement="top" aria-hidden="true"><i
class="fa fa-cog" aria-hidden="true"></i></button> class="fa fa-cog" aria-hidden="true"></i></button>
<!-- <button id="hide_form_ra" type="button" class="elm-hide btn btn-primary btn-sm"><i class="fa fa-chevron-up"
aria-hidden="true"></i></button> -->
</div> </div>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form class="elm-hide" id="form_report_activity">
<h6 class="text-update-status"></h6>
<input type="hidden" id="id_ra" />
<div class="form-row">
<div class="col-md-4 form-group">
<label>Status</label>
<!-- <input type="date" id="ra_date" name="report_date" class="form-control form-control-sm" required /> -->
<select class="form-control" name="status_activity" id="ra_select_status">
<option value="">Select Status --</option>
<option value="open">Open</option>
<option value="on-progress">On Progress</option>
<option value="done">Done</option>
</select>
</div>
<div class="col-md-4 form-group">
<label>Start Activity Date</label>
<input type="date" id="ra_date_start_activity" name="start_activity"
class="form-control form-control-sm" />
</div>
<div class="col-md-4 form-group">
<label>End Activity Date</label>
<input type="date" id="ra_date_end_activity" name="finish_activity"
class="form-control form-control-sm" />
</div>
</div>
<div class="text-right">
<button type="button" class="btn btn-sm btn-info btn-cancel-status" data-dismiss="modal"
aria-label="Close">Cancel</button>
<button type="submit" class="btn btn-sm btn-secondary">Save</button>
</div>
<hr />
</form>
<div class="table-responsive"> <div class="table-responsive">
<table id="table_report" class="table table-sm" style="width: 100%;"> <table id="table_report" class="table table-sm" style="width: 100%;">
<thead> <thead>
@ -618,54 +373,7 @@
<h5 class="modal-title" id="report_activity_material_title">Report Activity Material</h5> <h5 class="modal-title" id="report_activity_material_title">Report Activity Material</h5>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form class="mb-1 elm-hide" id="form_report_activity_material">
<input type="hidden" id="id_ra_material" />
<div class="form-row">
<div class="col-md-2 form-group">
<label>Human Resource</label>
<select id="select_ra_hr_material" name="user_id" class="form-control form-control-sm"
style="width:100%;" required></select>
</div>
<div class="col-md-2 form-group">
<label>Report Date</label>
<input type="date" id="ra_date_material" name="report_date" class="form-control form-control-sm"
required />
</div>
<div class="col-md-2 form-group">
<label>Volume Aktual</label>
<input type="text" id="volume_pekerjaan_material" name="qty"
class="form-control form-control-sm" />
</div>
<div class="col-md-2 form-group">
<label>Foto</label>
<input type="file" id="foto_ra_material" name="files" class="form-control form-control-sm" />
</div>
<div class="col-md-4 form-group">
<label>Deskripsi</label>
<textarea id="ra_description_material" class="form-control form-control-sm" name="description"
required></textarea>
</div>
</div>
<div class="text-right">
<button id="btn_add_ra_material" type="submit" class="btn btn-sm btn-primary" row="1">Add</button>
</div>
<hr />
</form>
<!-- for plan -->
<div class="table-responsive" id="activity_material_plan"> <div class="table-responsive" id="activity_material_plan">
<!-- <table id="table_activity_material" class="table table-sm" style="width: 100%;">
<thead>
<tr>
<th scope="col">Human Resource</th>
<th scope="col">Report Date</th>
<th scope="col">Volume Pekerjaan</th>
<th scope="col">Deskripsi</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
</tbody>
</table> -->
<table id="table_activity_material_plan" class="table table-sm" style="width: 100%;"> <table id="table_activity_material_plan" class="table table-sm" style="width: 100%;">
<thead> <thead>
<tr> <tr>
@ -689,7 +397,6 @@
<th scope="col">Report Date</th> <th scope="col">Report Date</th>
<th scope="col">Volume Pekerjaan</th> <th scope="col">Volume Pekerjaan</th>
<th scope="col">Deskripsi</th> <th scope="col">Deskripsi</th>
<th scope="col">Actions</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -732,12 +439,6 @@
<h5 class="modal-title" id="report_activity_location">Set Buffer Radius</h5> <h5 class="modal-title" id="report_activity_location">Set Buffer Radius</h5>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form>
<div class="form-group">
<label>Radius (Meter)</label>
<input id="buffer_radius" type="number" class="form-control form-control-sm" min="1" />
</div>
</form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal" aria-label="Close">Cancel</button> <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal" aria-label="Close">Cancel</button>
@ -778,6 +479,11 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js" <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js"
integrity="sha512-ozq8xQKq6urvuU6jNgkfqAmT7jKN2XumbrX1JiB3TnF7tI48DPI4Gy1GXKD/V3EExgAs1V+pRO7vwtS1LHg0Gw==" integrity="sha512-ozq8xQKq6urvuU6jNgkfqAmT7jKN2XumbrX1JiB3TnF7tI48DPI4Gy1GXKD/V3EExgAs1V+pRO7vwtS1LHg0Gw=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script> crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.9.1/chart.min.js" -->
<!-- integrity="sha512-ElRFoEQdI5Ht6kZvyzXhYG9NqjtkmlkfYk0wr6wHxU9JEHakS7UJZNeml5ALk+8IKlU6jDgMabC3vkumRokgJA==" -->
<!-- crossorigin="anonymous" -->
<!-- referrerpolicy="no-referrer"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.min.js?v=7.1.12"></script>
<script src="../assets/js/moment.min.js"></script> <script src="../assets/js/moment.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/underscore@latest/underscore-umd-min.js"></script> <script src="https://cdn.jsdelivr.net/npm/underscore@latest/underscore-umd-min.js"></script>
<script src="function/function.js"></script> <script src="function/function.js"></script>
@ -790,6 +496,7 @@
<script src="function/humanResource.js"></script> <script src="function/humanResource.js"></script>
<script src="function/toolsResource.js"></script> <script src="function/toolsResource.js"></script>
<script src="function/materialResource.js"></script> <script src="function/materialResource.js"></script>
<script src="function/overlaySCurve.js"></script>
<script src="function/milestone.js"></script> <script src="function/milestone.js"></script>
<script src="function/holiday.js"></script> <script src="function/holiday.js"></script>
<script src="function/reportActivity.js"></script> <script src="function/reportActivity.js"></script>

Loading…
Cancel
Save