Compare commits

..

3 Commits

  1. 9
      edit-mode/function/activityLocation.js
  2. 38
      edit-mode/function/expenseResource.js
  3. 18
      edit-mode/function/function.js
  4. 5
      edit-mode/function/ganttActivityComments.js
  5. 38
      edit-mode/function/ganttActivityUploadDoc.js
  6. 17
      edit-mode/function/ganttConfig.js
  7. 1035
      edit-mode/function/ganttSettings.js
  8. 2
      edit-mode/function/holiday.js
  9. 2
      edit-mode/function/humanResource.js
  10. 4
      edit-mode/function/materialResource.js
  11. 4
      edit-mode/function/milestone.js
  12. 19
      edit-mode/function/modalHumanResourceFunction.js
  13. 2
      edit-mode/function/reportActivity.js
  14. 2
      edit-mode/function/restActivityLink.js
  15. 2
      edit-mode/function/toolsResource.js
  16. 2
      edit-mode/index.html
  17. 10
      view-mode/function/activityLocation.js
  18. 8
      view-mode/function/function.js
  19. 6
      view-mode/function/ganttActivityComments.js
  20. 45
      view-mode/function/ganttActivityUploadDoc.js
  21. 1
      view-mode/function/ganttConfig.js
  22. 4
      view-mode/function/ganttEvent.js
  23. 36
      view-mode/function/ganttSettings.js
  24. 2
      view-mode/function/holiday.js
  25. 4
      view-mode/function/milestone.js
  26. 108
      view-mode/function/modalHumanResourceFunction.js
  27. 1
      view-mode/function/overlaySCurve.js
  28. 3
      view-mode/function/reportActivity.js
  29. 35
      view-mode/function/restActivityLink.js
  30. 2
      view-mode/function/toolsResource.js

9
edit-mode/function/activityLocation.js

@ -61,12 +61,10 @@ function openActivityMap(id) {
type: "get",
success: function (data) {
let dataRes = data.data
// console.log("cek data", data);
drawnItems.clearLayers();
if (dataRes.geom) {
let datageojson = JSON.parse(dataRes.geom);
currentGeoJson = datageojson
// console.log("cek data geojson", datageojson);
if (datageojson.type === 'FeatureCollection') {
datageojson.features.forEach(feature => {
let lGeoJson = L.geoJSON(feature);
@ -91,7 +89,6 @@ function openActivityMap(id) {
let latlon = layers[0].getLatLng();
let newCircle = L.circle([latlon.lat, latlon.lng], { radius: radius });
addDrawnLayer(newCircle)
// console.log("cek layers", layers[0]);
} else {
let lGeoJson = L.geoJson(datageojson);
let layers = lGeoJson.getLayers();
@ -138,19 +135,16 @@ $(document).ready(function () {
layer = e.layer;
if (type === 'marker') {
let latlong = layer.getLatLng();
// console.log("cek latlong", latlong);
circLat = latlong.lat
circLong = latlong.lng
$("#modal_radius").modal("show");
// Do marker specific actions
// let attri = layer.getAttribution();
// console.log("cek attribute", attri);
return false;
}
let geJson = layer.toGeoJSON();
currentGeoJson = geJson;
// let lgeojson = L.geoJson(geJson)
// console.log("cek layer", layer.toGeoJSON());
// layer.bindTooltip("cek");
// Do whatever else you need to. (save to db; add to map etc)
addDrawnLayer(layer);
@ -166,7 +160,6 @@ $(document).ready(function () {
drawnItems.removeLayer(layer);
});
updateCurrentGeoJson()
// console.log("cek layer", layer.toGeoJSON());
// Do whatever else you need to. (save to db; add to map etc)
// map.addLayer(layer);
@ -183,8 +176,6 @@ $(document).ready(function () {
}
updateCurrentGeoJson();
});
// console.log("cek layer", layers[0].toGeoJSON());
// console.log("cek layer", layer.toGeoJSON());
// Do whatever else you need to. (save to db; add to map etc)
// drawnControlEdit.remove();
// map.addControl(drawControl);

38
edit-mode/function/expenseResource.js

@ -1,10 +1,11 @@
var expenseModal = $('#modal-expense > .modal-dialog > .modal-content');
function resetFormAssignexpense() {
$('#select-expense').val(null).trigger("change");
$('#select-expense').find('option').remove();
$('#select-expense').val("");
$('#uom-req-expense').val(null).trigger('change');
// $('#select-expense').val(null).trigger("change");
// $('#select-expense').find('option').remove();
// $('#select-expense').val("");
$("#desc-expense").val("");
$('#uom-req-expense').val("").trigger('change');
$('#form-assign-expense').trigger("reset");
$('#btn-assign-expense').html('Assign');
$('#btn-assign-expense').prop("disabled", false);
@ -88,20 +89,18 @@ $(document).ready(function () {
});
$('#modal-expense').on('show.bs.modal', function (event) {
$("#desc-expense").val(activityName);
resetFormAssignexpense();
$('#modal-expense-title').html("Overhead " + activityName);
$('#modal-expense-sub-title').html(`<p style="font-size: 12px; color: #747474">Plan Date: ${moment(activityEarlyStart).format('DD MMMM YYYY')} - ${moment(activityEarlyFinish).format('DD MMMM YYYY')}</p>`);
tableexpense.draw();
});
$('#modal-expense').on('hide.bs.modal', function (event) {
resetFormAssignexpense();
$("#show-form-expense").show();
console.log("there's before action change ", actionHappen);
if (actionHappen) {
console.log("there's action change ", actionHappen);
updateActivity(activityId);
}
resetFormAssignexpense();
});
$('#select-expense').select2({
@ -123,7 +122,6 @@ $(document).ready(function () {
processResults: function (result) {
return {
results: $.map(result, function (item) {
// console.log("cek item", item)
return {
text: item.description,
id: item.id
@ -163,7 +161,7 @@ $(document).ready(function () {
type: "expense",
fom_date: required_date,
required_date: required_date,
proyek_id: proyekId,
proyek_id: parseInt(proyekId),
uom: uom,
qty: formatReplaceTitikRibuan(qty_planning),
price: formatReplaceTitikRibuan(price)
@ -178,7 +176,6 @@ $(document).ready(function () {
if (data && data.code === 200) {
material_id = data.data.id;
resetFormAssignexpense();
let payloadAssign = {
proyek_id: proyekId,
activity_id: activityId,
@ -195,35 +192,34 @@ $(document).ready(function () {
contentType: false,
success: function (data) {
if (data && data.code === 200) {
resetFormAssignexpense();
actionHappen = true;
gantt.alert("Data added!");
tableexpense.draw();
resetFormAssignexpense();
}
else {
gantt.alert({ type: "error", text: data.message });
} else {
$('#btn-assign-expense').html('Assign');
$('#btn-assign-expense').prop("disabled", false);
gantt.alert({ type: "error", text: data.message });
}
},
error: function (data) {
$('#btn-assign-expense').html('Assign');
$('#btn-assign-expense').prop("disabled", false);
gantt.alert("Assign Failed, try again later!");
resetFormAssignexpense();
}
});
}
else {
gantt.alert({ type: "error", text: data.message });
} else {
$('#btn-assign-expense').html('Assign');
$('#btn-assign-expense').prop("disabled", false);
gantt.alert({ type: "error", text: data.message });
}
},
error: function (data) {
$('#btn-assign-expense').html('Assign');
$('#btn-assign-expense').prop("disabled", false);
gantt.alert("Overhead request Failed, try again later!");
resetFormAssignexpense();
}
});
});
// delete from row

18
edit-mode/function/function.js

@ -189,11 +189,14 @@ function initializationProject() {
function getSatuan() {
const payload = {
"columns": [],
"orders": {
"ascending": true,
"columns": [
'id'
]
}
}
payload.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
)
$.ajax({
data: JSON.stringify(payload),
url: `${base_url}satuan/search`,
@ -221,7 +224,7 @@ function getSatuan() {
let newOption = new Option(option.label, option.label);
$('#uom-req-material').append(newOption);
});
$('#uom-req-expense').append(new Option('', '', true, true));
satuanList.forEach((option) => {
let newOption = new Option(option.label, option.label);
$('#uom-req-expense').append(newOption);
@ -647,10 +650,8 @@ function updateShowHideColumn(data) {
processData: false,
contentType: false,
success: function (data) {
// console.log(data);
},
error: function (data) {
// console.log(data);
}
});
}
@ -661,8 +662,6 @@ function colAjaxReq(type) {
type: "GET",
success: function (data) {
let ganttColumnsByType = data.data;
// console.log("ini gantt field ", ganttColumnsByType);
// console.log("ini column ", gantt.config.columns);
let isFound = false;
x = gantt.config.columns.filter((val) => {
isFound = ganttColumnsByType.find(obj => {
@ -671,7 +670,6 @@ function colAjaxReq(type) {
if (isFound)
return val;
if (isFound == false){
// console.log("ini gantt field !isFound ", val);
}
});

5
edit-mode/function/ganttActivityComments.js

@ -4,7 +4,6 @@ const COMMENT_SEARCH_URL = `${base_url}comment-activity/search`;
$(document).ready(function() {
$(".modal_add_btn_comment").on('click', function() {
console.log('onclick add comments');
addComments();
});
$("#btn_comment_submit").on('click', function() {
@ -15,7 +14,6 @@ $(document).ready(function() {
// show comments modal
function showComments(id) {
var task = gantt.getTaskBy('id', id);
console.log('showComments', task);
var activity = task && task.length > 0 ? task[0].text : '';
$("#activity_id").val(id);
$("#comments_title").text(activity);
@ -58,7 +56,6 @@ function submitComments() {
data: JSON.stringify(payload)
})
.done(function( msg ) {
console.log('done submit comment', msg)
// gantt.message("Comment posted");
gantt.alert("Comment posted");
$("#add_comment_form").trigger("reset");
@ -106,7 +103,6 @@ function searchComments(activity_id) {
}
}
console.log('searchComments payload', payload);
$.ajax({
method: "POST",
@ -115,7 +111,6 @@ function searchComments(activity_id) {
data: JSON.stringify(payload)
})
.done(function( msg ) {
console.log('done search comment', msg)
var comments = msg && msg.data;
var contents = '';
if (comments.length > 0) {

38
edit-mode/function/ganttActivityUploadDoc.js

@ -1,14 +1,13 @@
// Upload Document Activity
const DOCUMENT_UPLOAD_URL = `${base_url}document-activity/upload`;
const DOCUMENT_DOWNLOAD_URL = (id, company_id) => `${base_url}document-activity/download/${id}/${company_id}`;
const DOCUMENT_DOWNLOAD_URL = (id) => `${base_url}document-activity/download/${id}`;
const DOCUMENT_SEARCH_URL = `${base_url}document-activity/search`;
const DOCUMENT_DELETE_URL = (id, company_id) => `${base_url}document-activity/delete/${id}/${company_id}`;
const DOCUMENT_DELETE_URL = (id) => `${base_url}document-activity/delete/${id}`;
var fileToUpload = null;
$(document).ready(function() {
$(".modal_add_btn_doc").on('click', function() {
console.log('onclick add document');
addDocuments();
});
@ -23,9 +22,7 @@ $(document).ready(function() {
// $("#add_doc_form").on('submit', function(e) {
// // submitDocuments();
// e.preventDefault();
// console.log(this);
// var formData = new FormData(this);
// console.log('formData', formData);
// $.ajax({
// method: "POST",
// url: DOCUMENT_UPLOAD_URL,
@ -34,13 +31,11 @@ $(document).ready(function() {
// contentType: false,
// cache: false,
// success: function(msg) {
// console.log('done submit comment', msg)
// $("#add_doc_form").trigger("reset");
// searchDocuments(activity_id); // reload the contents
// },
// error: function(xhr, status, error) {
// // error handling
// console.log('error document upload', xhr, status, error);
// }
// });
// });
@ -57,7 +52,6 @@ $(document).ready(function() {
// show comments modal
function showDocuments(id) {
var task = gantt.getTaskBy('id', id);
console.log('showComments', task);
var activity = task && task.length > 0 ? task[0].text : '';
$("#activity_id").val(id);
$("#upload_doc_title").text(activity);
@ -96,25 +90,21 @@ async function submitDocuments() {
return;
}
console.log('fileToUpload', fileToUpload);
var formData = new FormData;
formData.append('activity_id', activity_id);
formData.append('dokumen', files);
formData.append('company_id',company_id);
if (activity_id !== '' && dokumen !== '') {
const result = await axiosInstance
.post(DOCUMENT_UPLOAD_URL, formData)
.then(res => res)
.catch((error) => error.response);
if(result && result.status==200){
console.log('done upload doc', result)
gantt.alert("Upload Success");
$("#add_doc_form").trigger("reset");
$('#btn_doc_submit').html('Upload');
$('#btn_doc_submit').prop("disabled",false);
searchDocuments(activity_id); // reload the contents
}else{
console.log('failed upload');
gantt.alert({type: "error", text: "Upload Failed"});
$('#btn_doc_submit').html('Upload');
$('#btn_doc_submit').prop("disabled",false);
@ -142,7 +132,6 @@ function searchDocuments(activity_id) {
"operator": "AND"
}
],
// "joins": [{ "name": "m_proyek", "column_join": "proyek_id", "column_results": ["kode_sortname", "nama"] }],
"orders": {
"columns": [
"id"
@ -158,20 +147,7 @@ function searchDocuments(activity_id) {
data: JSON.stringify(payload)
})
.done(function( msg ) {
console.log('done search documents', msg)
var documents = msg && msg.data;
// var contents = '';
// if (documents.length > 0) {
// contents += '<div>';
// for (var i=0; i < documents.length; i++) {
// // contents += '<div class="comment-section">';
// // contents += '<div class="comment-detail">'+comments[i].created_by+' &bull; '+moment(comments[i].created_at).format('DD-MM-YYYY HH:mm:ss')+'</div>';
// // contents += '<div class="comment-text">'+comments[i].comment+'</div>';
// // contents += '</div>';
// }
// contents += '</div>';
// }
$("#documents_table").DataTable().destroy();
$('#documents_table').DataTable({
data: documents,
@ -191,17 +167,12 @@ function searchDocuments(activity_id) {
},
]
});
// $("#documents_list").html(contents);
})
.fail(function(xhr, status, error) {
// error handling
console.log('error document search', status);
});
}
async function downloadDocument(id, name) {
let result;
await fetch(DOCUMENT_DOWNLOAD_URL(id, company_id), {
await fetch(DOCUMENT_DOWNLOAD_URL(id), {
headers: new Headers({
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
@ -243,9 +214,8 @@ async function deleteDocument(id, activity_id) {
callback: async function(result){
// result is true / false;
if (result) {
console.log('download document', id);
const result = await axiosInstance
.delete(DOCUMENT_DELETE_URL(id, company_id))
.delete(DOCUMENT_DELETE_URL(id))
.then(res => res)
.catch((error) => error.response);

17
edit-mode/function/ganttConfig.js

@ -4,7 +4,6 @@ const proyekId = getUrlParameter("proyek_id");
const timestamp = getUrlParameter("timestamp");
let base_url = getUrlParameter("base_url");
const role_name = getUrlParameter("role_name");
const company_id = getUrlParameter("company_id");
const company_name = getUrlParameter("company_name");
const base_url_image = `https://project-api.ospro.id/assets/${company_name}/`;
const ganttName = getUrlParameter("gantt_name");
@ -295,14 +294,14 @@ var allColumns = [
editor: editor.text,
resize: true,
template: function (text) {
function truncateText(text, maxLength) {
if (text.length > maxLength) {
return text.substring(0, maxLength) + '...';
}
return text;
}
const truncatedText = truncateText(text.text, 30);
return `<span title="${text.text}">${truncatedText}</span>`;
// function truncateText(text, maxLength) {
// if (text.length > maxLength) {
// return text.substring(0, maxLength) + '...';
// }
// return text;
// }
// const truncatedText = truncateText(text.text, 30);
return `<span title="${text.text}">${text.text}</span>`;
}
},
{

1035
edit-mode/function/ganttSettings.js

File diff suppressed because it is too large Load Diff

2
edit-mode/function/holiday.js

@ -82,7 +82,6 @@ $(document).ready(function () {
var b = moment(a).add(data.duration, 'days');
for (var m = moment(a); m.isBefore(b); m.add(1, 'days')) {
let holiday = new Date(m.format('YYYY-MM-DD'));
// console.log("cek holiday", holiday)
gantt.unsetWorkTime({
date: holiday,
hours:false
@ -97,7 +96,6 @@ $(document).ready(function () {
url: `${base_url}holiday/delete/${id}`,
type:"DELETE",
success: function (data) {
// console.log("cek data", data.data);
gantt.alert("Delete Holiday Success!");
tableHoliday.draw();
if(data.data){

2
edit-mode/function/humanResource.js

@ -113,7 +113,6 @@ $(document).ready(function () {
processResults: function (result) {
return {
results: $.map(result, function (item) {
// console.log("cek item", item)
return {
text: item.name,
id: item.id
@ -143,7 +142,6 @@ $(document).ready(function () {
processResults: function (result) {
return {
results: $.map(result, function (item) {
// console.log("cek item", item)
return {
text: item.name,
id: item.id + "|" + item.proyek_role,

4
edit-mode/function/materialResource.js

@ -97,9 +97,7 @@ $(document).ready(function () {
$('#modal-material').on('hide.bs.modal', function (event) {
// $("#hide-form-material").hide();
$("#show-form-material").show();
console.log("there's before action change ", actionHappen);
if (actionHappen) {
console.log("there's action change ", actionHappen);
updateActivity(activityId);
}
resetFormAssignMaterial();
@ -124,7 +122,6 @@ $(document).ready(function () {
processResults: function (result) {
return {
results: $.map(result, function (item) {
// console.log("cek item", item)
return {
text: item.description,
id: item.id
@ -168,7 +165,6 @@ $(document).ready(function () {
results: dataIntegrasiMaterial
};
}, error: function (jqXHR, textStatus, errorThrown) {
// console.log("textStatus ", textStatus);
if (textStatus != "abort") {
// gantt.alert(`Status: ${textStatus}`);
gantt.alert(`Data Not Found`);

4
edit-mode/function/milestone.js

@ -1,6 +1,5 @@
var milestoneModal = $('#modal-add-milestone > .modal-dialog > .modal-content');
function addMilestone(id){
console.log("cek cek id milestone", id);
if(id && id > 0){
$("#milestone_parent").val(id);
}
@ -41,7 +40,6 @@ $(document).ready(function () {
processResults: function (result) {
return {
results: $.map(result, function (item) {
// console.log("cek item", item)
return {
due_date:item.due_date,
deadline:item.deadline,
@ -94,14 +92,12 @@ $(document).ready(function () {
$('#submit-milestone').html('Add..');
$('#submit-milestone').prop("disabled",true);
var data = Object.fromEntries(new FormData(this));
console.log("cek data form", data);
let parent = data.milestone_parent;
var taskId = 0;
var start = moment(data.due_date, "DD-MM-YYYY");
var end = moment(data.deadline, "DD-MM-YYYY");
let duration = moment.duration(start.diff(end)).asDays();
let nameMilestone = data.status!="" ? data.status : data.id_milestone
// console.log("cek duration", Math.abs(duration));
if(parent && parseInt(parent) > 0){
taskId = gantt.addTask({
id: Math.floor(Math.random() * 1000) + 5000,

19
edit-mode/function/modalHumanResourceFunction.js

@ -30,9 +30,7 @@ $(document).ready(function () {
"ascending": false
}
}
// console.log("qry", qry)
axiosInstance.post(url, payload, HEADER).then(res => {
console.log('getDataHumanResource', res)
DATA_HUMAN_RESOURCE = res.data.data
// arr.forEach(function (element, key) {
// $('#choices-multiple-remove-button1').append(`<option value="${element.id}">${element.name}</option>`)
@ -56,9 +54,7 @@ $(document).ready(function () {
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
// console.log("qry", qry)
axiosInstance.post(url, payload, HEADER).then(res => {
console.log(res)
DATA_ROLE_HUMAN_RESOURCE = res.data.data
});
}
@ -93,7 +89,6 @@ $(document).ready(function () {
// }
// }
// axiosInstance.post(url, payload, HEADER).then(res => {
// console.log(res)
// DATA_MATERIAL_RESOURCE = res.data.data
// });
// }
@ -121,7 +116,6 @@ $(document).ready(function () {
// }
// }
// axiosInstance.post(url, payload, HEADER).then(res => {
// console.log(res)
// const arr = res.data.data
// DATA_TOOL_RESOURCE = res.data.data
// arr.forEach(function (element, key) {
@ -134,7 +128,6 @@ $(document).ready(function () {
// }
$('#human-resource').on('show.bs.modal', function (event) {
// console.log("open modal human resource")
getDataHumanResource()
getDataRole()
// getDataMaterials()
@ -149,7 +142,6 @@ $(document).ready(function () {
$("#add-human-resource").on('click', function () {
const num = $('#table-human-resource tr').length
console.log(num)
const idx = num + 1
$('#table-human-resource').append(`
<tr id="row-human-resource-${idx}">
@ -182,13 +174,11 @@ $(document).ready(function () {
$('#table-human-resource').on('click', '.human-resource-delete', function (event) {
const idx = $(this).attr("index")
console.log(idx)
$(`#row-human-resource-${idx}`).remove()
})
// $("#add-material-resource").on('click', function () {
// const num = $('#table-material-resource tr').length
// console.log(num)
// const idx = num + 1
// $('#table-material-resource').append(`
// <tr id="row-material-resource-${idx}">
@ -216,13 +206,11 @@ $(document).ready(function () {
// $('#table-material-resource').on('click', '#material-resource-delete', function (event) {
// const idx = $(this).attr("index")
// console.log(idx)
// $(`#row-material-resource-${idx}`).remove()
// })
// $("#add-tool-resource").on('click', function () {
// const num = $('#table-tool-resource tr').length
// console.log(num)
// const idx = num + 1
// $('#table-tool-resource').append(`
// <tr id="row-tool-resource-${idx}">
@ -250,13 +238,11 @@ $(document).ready(function () {
// $('#table-tool-resource').on('click', '#tool-resource-delete', function (event) {
// const idx = $(this).attr("index")
// console.log(idx)
// $(`#row-tool-resource-${idx}`).remove()
// })
$(".submit-human-resource").on('click', function () {
console.log('onclick submit human resource');
// addComments();
let valueHumanResource = []
const num = $('#table-human-resource tr').length
@ -269,8 +255,6 @@ $(document).ready(function () {
}
valueHumanResource.push(obj)
}
console.log("cek value", valueHumanResource)
// let valueMaterialResource = []
// const numMaterial = $('#table-material-resource tr').length
// for (let i = 0; i < numMaterial; i++) {
@ -282,7 +266,6 @@ $(document).ready(function () {
// }
// valueMaterialResource.push(obj)
// }
// console.log(valueMaterialResource)
// let valueToolResource = []
// const numTool = $('#table-tool-resource tr').length
@ -295,11 +278,9 @@ $(document).ready(function () {
// }
// valueToolResource.push(obj)
// }
// console.log(valueToolResource)
// const cost = $(`#cost-human-resource`).val()
// const duration = $(`#duration-human-resource`).val()
// const dateStart = $(`#date-started-human-started`).val()
// console.log({ cost, duration, dateStart })
// $("#exampleModal").modal('hide');
});

2
edit-mode/function/reportActivity.js

@ -654,7 +654,7 @@ $(document).ready(function () {
function deleteRaMaterial(id) {
searchReport(assignMaterialId, false);
$.ajax({
url: `${base_url}report-activity-material/delete/${id}/${company_id}`,
url: `${base_url}report-activity-material/delete/${id}`,
type: "DELETE",
success: function (data) {
actionHappen = true;

2
edit-mode/function/restActivityLink.js

@ -59,8 +59,6 @@ gantt.ajax.get({
});
function refresData(id) {
console.log("refres triggered!!");
// Store the current scroll position
var scrollState = {
x: gantt.getScrollState().x,

2
edit-mode/function/toolsResource.js

@ -94,7 +94,6 @@ $(document).ready(function () {
processResults: function (result) {
return {
results: $.map(result, function (item) {
// console.log("cek item", item)
return {
text: item.name,
id: item.id
@ -143,7 +142,6 @@ $(document).ready(function () {
processData: false,
contentType: false,
success: function (data) {
console.log('response data', data);
if (data && data.code === 200) {
actionHappen = true;
gantt.alert("Tools Assign Success!");

2
edit-mode/index.html

@ -67,7 +67,7 @@
<div class="loading-overlay"></div>
<div class="container-header">
<div class="container-project">
<h6 id="project-name-header"></h6>
<h6 id="project-name-header" style="margin-left: 10px;"></h6>
</div>
<div class="container-action">
<div class="btn-icon-toolbar btn-sm"><span class="icon-toolbar-separator">Zoom: </span></div>

10
view-mode/function/activityLocation.js

@ -49,12 +49,10 @@ function openActivityMap(id)
type:"get",
success: function (data) {
let dataRes = data.data
// console.log("cek data", data);
drawnItem.clearLayers();
if(dataRes.geom){
let datageojson = JSON.parse(dataRes.geom);
currentGeoJson = datageojson
// console.log("cek data geojson", datageojson);
if(datageojson.properties.radius){
let radius = datageojson.properties.radius
let lGeoJson = L.geoJson(datageojson);
@ -62,7 +60,6 @@ function openActivityMap(id)
let latlon = layers[0].getLatLng();
let newCircle = L.circle([latlon.lat,latlon.lng], {radius: radius});
drawnItem.addLayer(newCircle);
// console.log("cek layers", layers[0]);
}else{
let lGeoJson = L.geoJson(datageojson);
let layers = lGeoJson.getLayers();
@ -109,19 +106,16 @@ $(document).ready(function () {
layer = e.layer;
if (type === 'marker') {
let latlong = layer.getLatLng();
// console.log("cek latlong", latlong);
circLat = latlong.lat
circLong = latlong.lng
$("#modal_radius").modal("show");
// Do marker specific actions
// let attri = layer.getAttribution();
// console.log("cek attribute", attri);
return false;
}
let geJson = layer.toGeoJSON();
currentGeoJson = geJson;
// let lgeojson = L.geoJson(geJson)
// console.log("cek layer", layer.toGeoJSON());
// layer.bindTooltip("cek");
// Do whatever else you need to. (save to db; add to map etc)
drawnItem.addLayer(layer);
@ -134,7 +128,6 @@ $(document).ready(function () {
var type = e.layerType,
layer = e.layer;
// console.log("cek layer", layer.toGeoJSON());
// Do whatever else you need to. (save to db; add to map etc)
currentGeoJson = "";
drawnItem.removeLayer(layer);
@ -155,8 +148,6 @@ $(document).ready(function () {
}else{
currentGeoJson = geoJson
}
// console.log("cek layer", layers[0].toGeoJSON());
// console.log("cek layer", layer.toGeoJSON());
// Do whatever else you need to. (save to db; add to map etc)
// drawnItem.removeLayer(layer);
// drawnControlEdit.remove();
@ -234,7 +225,6 @@ function submitCircle(radius)
let geojsoncircle = circle.toGeoJSON();
geojsoncircle.properties.radius = radius
currentGeoJson = geojsoncircle
// console.log("geojsoncircle", geojsoncircle);
drawnItem.addLayer(circle);
drawControl.remove();
map.addControl(drawnControlEdit);

8
view-mode/function/function.js

@ -485,13 +485,7 @@ function updateShowHideColumn(data)
url: `${base_url}gantt-show-hide/update/${ganttId}`,
type: "POST",
processData: false,
contentType: false,
success: function (data) {
console.log(data);
},
error: function (data) {
console.log(data);
}
contentType: false
});
}

6
view-mode/function/ganttActivityComments.js

@ -4,7 +4,6 @@ const COMMENT_SEARCH_URL = `${base_url}comment-activity/search`;
$(document).ready(function() {
$(".modal_add_btn_comment").on('click', function() {
console.log('onclick add comments');
addComments();
});
$("#btn_comment_submit").on('click', function() {
@ -15,7 +14,6 @@ $(document).ready(function() {
// show comments modal
function showComments(id) {
var task = gantt.getTaskBy('id', id);
console.log('showComments', task);
var activity = task && task.length > 0 ? task[0].text : '';
$("#activity_id").val(id);
$("#comments_title").text(activity);
@ -58,7 +56,6 @@ function submitComments() {
data: JSON.stringify(payload)
})
.done(function( msg ) {
console.log('done submit comment', msg)
// gantt.message("Comment posted");
gantt.alert("Comment posted");
$("#add_comment_form").trigger("reset");
@ -106,8 +103,6 @@ function searchComments(activity_id) {
}
}
console.log('searchComments payload', payload);
$.ajax({
method: "POST",
url: COMMENT_SEARCH_URL,
@ -115,7 +110,6 @@ function searchComments(activity_id) {
data: JSON.stringify(payload)
})
.done(function( msg ) {
console.log('done search comment', msg)
var comments = msg && msg.data;
var contents = '';
if (comments.length > 0) {

45
view-mode/function/ganttActivityUploadDoc.js

@ -1,14 +1,13 @@
// Upload Document Activity
const DOCUMENT_UPLOAD_URL = `${base_url}document-activity/upload`;
const DOCUMENT_DOWNLOAD_URL = (id, company_id) => `${base_url}document-activity/download/${id}/${company_id}`;
const DOCUMENT_DOWNLOAD_URL = (id) => `${base_url}document-activity/download/${id}`;
const DOCUMENT_SEARCH_URL = `${base_url}document-activity/search`;
const DOCUMENT_DELETE_URL = (id, company_id) => `${base_url}document-activity/delete/${id}/${company_id}`;
const DOCUMENT_DELETE_URL = (id) => `${base_url}document-activity/delete/${id}`;
var fileToUpload = null;
$(document).ready(function() {
$(".modal_add_btn_doc").on('click', function() {
console.log('onclick add document');
addDocuments();
});
@ -20,31 +19,6 @@ $(document).ready(function() {
fileToUpload = e.target.files[0];
});
// $("#add_doc_form").on('submit', function(e) {
// // submitDocuments();
// e.preventDefault();
// console.log(this);
// var formData = new FormData(this);
// console.log('formData', formData);
// $.ajax({
// method: "POST",
// url: DOCUMENT_UPLOAD_URL,
// data: formData,
// processData: false,
// contentType: false,
// cache: false,
// success: function(msg) {
// console.log('done submit comment', msg)
// $("#add_doc_form").trigger("reset");
// searchDocuments(activity_id); // reload the contents
// },
// error: function(xhr, status, error) {
// // error handling
// console.log('error document upload', xhr, status, error);
// }
// });
// });
$("#btn_doc_reset").on('click', function() {
// $("#add_doc_form").trigger("reset");
})
@ -57,7 +31,6 @@ $(document).ready(function() {
// show comments modal
function showDocuments(id) {
var task = gantt.getTaskBy('id', id);
console.log('showComments', task);
var activity = task && task.length > 0 ? task[0].text : '';
$("#activity_id").val(id);
$("#upload_doc_title").text(activity);
@ -96,18 +69,15 @@ async function submitDocuments() {
return;
}
console.log('fileToUpload', fileToUpload);
var formData = new FormData;
formData.append('activity_id', activity_id);
formData.append('dokumen', files);
formData.append('company_id',company_id);
if (activity_id !== '' && dokumen !== '') {
const result = await axiosInstance
.post(DOCUMENT_UPLOAD_URL, formData)
.then(res => res)
.catch((error) => error.response);
if(result && result.status==200){
console.log('done upload doc', result)
gantt.alert("Upload Success");
$("#add_doc_form").trigger("reset");
$('#btn_doc_submit').html('Upload');
@ -157,7 +127,6 @@ function searchDocuments(activity_id) {
data: JSON.stringify(payload)
})
.done(function( msg ) {
console.log('done search documents', msg)
var documents = msg && msg.data;
// var contents = '';
// if (documents.length > 0) {
@ -190,17 +159,12 @@ function searchDocuments(activity_id) {
},
]
});
// $("#documents_list").html(contents);
})
.fail(function(xhr, status, error) {
// error handling
console.log('error document search', status);
});
}
async function downloadDocument(id, name) {
let result;
await fetch(DOCUMENT_DOWNLOAD_URL(id, company_id), {
await fetch(DOCUMENT_DOWNLOAD_URL(id), {
headers: new Headers({
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
@ -242,9 +206,8 @@ async function deleteDocument(id, activity_id) {
callback: async function(result){
// result is true / false;
if (result) {
console.log('download document', id);
const result = await axiosInstance
.delete(DOCUMENT_DELETE_URL(id, company_id))
.delete(DOCUMENT_DELETE_URL(id))
.then(res => res)
.catch((error) => error.response);

1
view-mode/function/ganttConfig.js

@ -3,7 +3,6 @@ const readOnly = getUrlParameter("ro");
const proyekId = getUrlParameter("proyek_id");
let base_url = getUrlParameter("base_url");
const role_name = getUrlParameter("role_name");
const company_id = getUrlParameter("company_id");
const adwIntegrationUrl = "https://adw-api.ospro.id/api";
let userToVersionGanttId = 0

4
view-mode/function/ganttEvent.js

@ -19,7 +19,6 @@ gantt.attachEvent("onTaskRowClick", function(id,row){
gantt.ext.inlineEditors.attachEvent("onBeforeEditStart", function(state){
let id = parseInt(state.id)
let ganttData = gantt.getTask(id);
// console.log("cek ganttData", ganttData);
if(ganttData.type_activity && ganttData.type_activity=="header"){
return false
}
@ -32,13 +31,11 @@ gantt.ext.inlineEditors.attachEvent("onBeforeEditStart", function(state){
}
if(column=="cost_actual"){
// let ganttData = gantt.getTask(id);
let progress = ganttData.progress ? ganttData.progress : 0
if(progress <= 0){
return false
}
}
// console.log("cek state", state);
return true
});
@ -64,7 +61,6 @@ gantt.attachEvent("onBeforeTaskUpdate", function(id,new_item){
gantt.attachEvent("onBeforeLinkAdd", function(id,link){
//any custom logic here
// console.log("cek link", link);
let source = link.source;
let target = link.target;
let parents = gantt.getParent(source);

36
view-mode/function/ganttSettings.js

@ -47,9 +47,6 @@ $(document).ready(function() {
selectDayOffChoices = new Choices('#select_dayoff', {
removeItemButton: true,
shouldSort: false
// maxItemCount: 5,
// searchResultLimit: 5,
// renderChoiceLimit: 5
});
$('#gantt_setting_btn').on('click', async function() {
@ -57,13 +54,9 @@ $(document).ready(function() {
.get(VERSION_GANTT_EDIT_URL, HEADER)
.then(res => res)
.catch((error) => error.response);
// console.log("get version gantt result", result)
if(result && result.status==200){
if (result.data && result.data.data) {
var config_dayoff = null;
// console.log('result.data.data.config_dayoff', result.data.data.config_dayoff)
if (result.data.data.config_dayoff !== null) {
config_dayoff = result.data.data.config_dayoff;
@ -72,17 +65,13 @@ $(document).ready(function() {
for (var i=0; i < config_dayoff_arr.length; i++) {
var day = daysObj.find(o => parseInt(o.value) === parseInt(config_dayoff_arr[i]));
// $('#select_dayoff option[value='+day.value+']').prop("selected", true);
// console.log('day', day);
selectDayOffChoices.setChoiceByValue(day.value);
}
}
}
}
}else{
// closeDialog('failed upload')
console.log('failed get version gantt');
gantt.alert({type: "error", text: "Failed to get settings. Please check your internet connection."});
// alert('Upload failed');
}
$('#modal_gantt_setting').modal('show');
});
@ -103,16 +92,7 @@ $(document).ready(function() {
// }
var holidays = [];
var dayoff = $('#select_dayoff').val();
// console.log('dayoff', dayoff);
// if (dayoff.length < 1) return alert('Please add a day off');
dayoff = dayoff.map(item => parseInt(item));
// console.log('dayoff after', dayoff);
var workdays = _.difference(days, dayoff);
// console.log('workdays', workdays);
// getCurrentWorkdays();
// reset the dayoff first
for (var i=0; i < days.length; i++) {
gantt.unsetWorkTime({day: days[i], hours: false});
@ -134,8 +114,6 @@ $(document).ready(function() {
// }
// }
// console.log('dayoff.length', dayoff.length);
if (dayoff.length > 0) {
for (var i=0; i < dayoff.length; i++) {
gantt.setWorkTime({ day:dayoff[i], hours:false });
@ -152,13 +130,10 @@ $(document).ready(function() {
let payload = {
"config_dayoff": dayoff.join(',')
}
// console.log('payload', payload);
// console.log('HEADER', HEADER);
const result = await axiosInstance
.put(VERSION_GANTT_UPDATE_URL, payload, HEADER)
.then(res => res)
.catch((error) => error.response);
// console.log("update settings result", result)
if (result && result.status === 200) {
$('#modal_gantt_setting').modal('hide');
// gantt.alert("Settings updated");
@ -208,7 +183,6 @@ async function initHolidays(){
url: `${base_url}holiday/search`,
type: "POST",
success: function (result) {
// console.log("cek data", result.data);
let dataHolidays = result.data || []
dataHolidays.map((val, index) => {
// let day = moment(val.date).format("YYYY-MM-DD");
@ -216,7 +190,6 @@ async function initHolidays(){
var b = moment(a).add(val.duration, 'days');
for (var m = moment(a); m.isBefore(b); m.add(1, 'days')) {
let holiday = new Date(m.format('YYYY-MM-DD'));
// console.log("cek holiday", holiday)
gantt.setWorkTime({
date: holiday,
hours: false
@ -237,7 +210,6 @@ async function initHolidays(){
}
async function initGanttSettings() {
console.log('initGanttSettings');
// if zoom is day
$("#scale3").attr('checked', true);
// toggleCollapseTasks();
@ -270,7 +242,6 @@ async function initGanttSettings() {
}
function expandTask(){
console.log("check expandTask")
gantt.eachTask(function(task){
task.$open = true;
});
@ -284,19 +255,16 @@ function expandTask(){
function toggleCollapseTasks() {
// collapse task / activity
console.log('toggleCollapseTasks');
gantt.eachTask(function(task){
task.$open = toggleTasks == "Expand";
});
if (toggleTasks == "Expand") {
updateProperty({task_open:true})
// console.log('to collapse');
toggleTasks = "Collapse";
$("#gantt_toggle_task_btn").prop('title', 'Collapse Activities');
$("#gantt_toggle_task_btn").children().removeClass('fa-expand-alt');
$("#gantt_toggle_task_btn").children().addClass('fa-compress-alt'); // change icon to collapse
} else {
// console.log('to expand');
updateProperty({task_open:false})
toggleTasks = "Expand";
$("#gantt_toggle_task_btn").prop('title', 'Expand Activities');
@ -312,7 +280,6 @@ function getColumnsSelection(node){
var selectedColumns = node.querySelectorAll(":checked");
var unselectedColumn = node.querySelectorAll('input[type="checkbox"]:not(:checked)');
// var allSelected = node.querySelector("#check-all").prop('checked');
// console.log("unselectedColumn", unselectedColumn)
var checkedColumns = {};
selectedColumns.forEach(function(node){
checkedColumns[node.name] = true;
@ -320,7 +287,6 @@ function getColumnsSelection(node){
unselectedColumn.forEach(function(node){
checkedColumns[node.name] = false;
});
// console.log("checkedColumns", checkedColumns)
return checkedColumns;
}
@ -404,7 +370,6 @@ async function setBaselineAPI() {
.get(ACTIVITY_SET_BASELINE_URL, HEADER)
.then(res => res)
.catch((error) => error.response);
console.log('set baseline res', res);
if (res && res.status === 200) {
// $('#modal_gantt_setting').modal('hide');
// gantt.alert("Settings updated");
@ -460,7 +425,6 @@ async function setSynchronizeAPI() {
.then(res => res)
.catch((error) => error.response);
console.log('synchronize res', res);
if (res && res.status === 200) {
// $('#modal_gantt_setting').modal('hide');
// gantt.alert("Settings updated");

2
view-mode/function/holiday.js

@ -76,7 +76,6 @@ $(document).ready(function () {
var b = moment(a).add(data.duration, 'days');
for (var m = moment(a); m.isBefore(b); m.add(1, 'days')) {
let holiday = new Date(m.format('YYYY-MM-DD'));
// console.log("cek holiday", holiday)
gantt.unsetWorkTime({
date: holiday,
hours:false
@ -91,7 +90,6 @@ $(document).ready(function () {
url: `${base_url}holiday/delete/${id}`,
type:"DELETE",
success: function (data) {
// console.log("cek data", data.data);
gantt.alert("Delete Holiday Success!");
tableHoliday.draw();
if(data.data){

4
view-mode/function/milestone.js

@ -1,6 +1,5 @@
var milestoneModal = $('#modal-add-milestone > .modal-dialog > .modal-content');
function addMilestone(id){
console.log("cek cek id milestone", id);
if(id && id > 0){
$("#milestone_parent").val(id);
}
@ -41,7 +40,6 @@ $(document).ready(function () {
processResults: function (result) {
return {
results: $.map(result, function (item) {
// console.log("cek item", item)
return {
due_date:item.due_date,
deadline:item.deadline,
@ -85,14 +83,12 @@ $(document).ready(function () {
$('#submit-milestone').html('Add..');
$('#submit-milestone').prop("disabled",true);
var data = Object.fromEntries(new FormData(this));
console.log("cek data form", data);
let parent = data.milestone_parent;
var taskId = 0;
var start = moment(data.due_date, "YYYY-MM-DD");
var end = moment(data.deadline, "YYYY-MM-DD");
let duration = moment.duration(start.diff(end)).asDays();
let nameMilestone = data.status!="" ? data.status : data.id_milestone
// console.log("cek duration", Math.abs(duration));
if(parent && parseInt(parent) > 0){
taskId = gantt.addTask({
id: Math.floor(Math.random() * 1000) + 5000,

108
view-mode/function/modalHumanResourceFunction.js

@ -5,9 +5,6 @@ $(document).ready(function () {
let DATA_ROLE_HUMAN_RESOURCE = []
let DATA_HUMAN_RESOURCE = []
let forbiddenHuman = []
// let DATA_MATERIAL_RESOURCE = []
// let DATA_TOOL_RESOURCE = []
function getDataHumanResource() {
const url = `${base_url}human-resource/search`
const payload = {
@ -15,14 +12,6 @@ $(document).ready(function () {
"start": 1,
"length": -1
},
"columns": [
// {
// "name": "proyek_id",
// "logic_operator": "like",
// "value": search,
// "operator": "AND"
// },
],
"orders": {
"columns": [
"id"
@ -30,19 +19,8 @@ $(document).ready(function () {
"ascending": false
}
}
// console.log("qry", qry)
axiosInstance.post(url, payload, HEADER).then(res => {
console.log('getDataHumanResource', res)
DATA_HUMAN_RESOURCE = res.data.data
// arr.forEach(function (element, key) {
// $('#choices-multiple-remove-button1').append(`<option value="${element.id}">${element.name}</option>`)
// });
// var multipleCancelButton = new Choices('#choices-multiple-remove-button1', {
// removeItemButton: true,
// // maxItemCount: 5,
// // searchResultLimit: 5,
// // renderChoiceLimit: 5
// });
});
}
@ -56,89 +34,14 @@ $(document).ready(function () {
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
// console.log("qry", qry)
axiosInstance.post(url, payload, HEADER).then(res => {
console.log(res)
DATA_ROLE_HUMAN_RESOURCE = res.data.data
});
}
// getDataHumanResource()
// function getDataMaterials() {
// const url = `${base_url}request-material/search`
// const payload = {
// "paging": {
// "start": 0,
// "length": -1
// },
// "columns": [
// {
// "name": "proyek_id",
// "logic_operator": "=",
// "value": "6",
// "operator": "AND"
// },
// {
// "name": "status",
// "logic_operator": "=",
// "value": "receipt to site",
// "operator": "AND"
// }
// ],
// "orders": {
// "columns": [
// "id"
// ],
// "ascending": false
// }
// }
// axiosInstance.post(url, payload, HEADER).then(res => {
// console.log(res)
// DATA_MATERIAL_RESOURCE = res.data.data
// });
// }
// function getDataTools() {
// const url = `${base_url}req-tools/search`
// const payload = {
// "paging": {
// "start": 0,
// "length": -1
// },
// "columns": [
// {
// "name": "status",
// "logic_operator": "=",
// "value": "receipt to site",
// "operator": "AND"
// }
// ],
// "orders": {
// "columns": [
// "id"
// ],
// "ascending": false
// }
// }
// axiosInstance.post(url, payload, HEADER).then(res => {
// console.log(res)
// const arr = res.data.data
// DATA_TOOL_RESOURCE = res.data.data
// arr.forEach(function (element, key) {
// $('#choices-multiple-remove-button3').append(`<option value="${element.id}">${element.name}</option>`)
// });
// var multipleCancelButton = new Choices('#choices-multiple-remove-button3', {
// removeItemButton: true
// });
// });
// }
$('#human-resource').on('show.bs.modal', function (event) {
// console.log("open modal human resource")
getDataHumanResource()
getDataRole()
// getDataMaterials()
// getDataTools()
});
$('#human-resource').on('hide.bs.modal', function (event) {
@ -149,7 +52,6 @@ $(document).ready(function () {
$("#add-human-resource").on('click', function () {
const num = $('#table-human-resource tr').length
console.log(num)
const idx = num + 1
$('#table-human-resource').append(`
<tr id="row-human-resource-${idx}">
@ -182,13 +84,11 @@ $(document).ready(function () {
$('#table-human-resource').on('click', '.human-resource-delete', function (event) {
const idx = $(this).attr("index")
console.log(idx)
$(`#row-human-resource-${idx}`).remove()
})
// $("#add-material-resource").on('click', function () {
// const num = $('#table-material-resource tr').length
// console.log(num)
// const idx = num + 1
// $('#table-material-resource').append(`
// <tr id="row-material-resource-${idx}">
@ -216,13 +116,11 @@ $(document).ready(function () {
// $('#table-material-resource').on('click', '#material-resource-delete', function (event) {
// const idx = $(this).attr("index")
// console.log(idx)
// $(`#row-material-resource-${idx}`).remove()
// })
// $("#add-tool-resource").on('click', function () {
// const num = $('#table-tool-resource tr').length
// console.log(num)
// const idx = num + 1
// $('#table-tool-resource').append(`
// <tr id="row-tool-resource-${idx}">
@ -250,13 +148,11 @@ $(document).ready(function () {
// $('#table-tool-resource').on('click', '#tool-resource-delete', function (event) {
// const idx = $(this).attr("index")
// console.log(idx)
// $(`#row-tool-resource-${idx}`).remove()
// })
$(".submit-human-resource").on('click', function () {
console.log('onclick submit human resource');
// addComments();
let valueHumanResource = []
const num = $('#table-human-resource tr').length
@ -269,7 +165,6 @@ $(document).ready(function () {
}
valueHumanResource.push(obj)
}
console.log("cek value", valueHumanResource)
// let valueMaterialResource = []
// const numMaterial = $('#table-material-resource tr').length
@ -282,7 +177,6 @@ $(document).ready(function () {
// }
// valueMaterialResource.push(obj)
// }
// console.log(valueMaterialResource)
// let valueToolResource = []
// const numTool = $('#table-tool-resource tr').length
@ -295,11 +189,9 @@ $(document).ready(function () {
// }
// valueToolResource.push(obj)
// }
// console.log(valueToolResource)
// const cost = $(`#cost-human-resource`).val()
// const duration = $(`#duration-human-resource`).val()
// const dateStart = $(`#date-started-human-started`).val()
// console.log({ cost, duration, dateStart })
// $("#exampleModal").modal('hide');
});

1
view-mode/function/overlaySCurve.js

@ -98,7 +98,6 @@ function getChartScaleRange() {
function getProgressLine() {
// As long as the progress data length is same with chart scale range (period) then it's fine.
getSCurveData();
// console.log("apa ", return_first);
var cumulativePlannedDurations = return_first.data[0].data.percentagePlan;
var cumulativeRealDurations = return_first.data[0].data.percentageReal;
cumulativeRealDurations[cumulativeRealDurations.length - 1] = Math.ceil(cumulativeRealDurations[cumulativeRealDurations.length - 1]);

3
view-mode/function/reportActivity.js

@ -50,19 +50,16 @@ $(document).ready(function () {
{ data: 'uom', name: 'uom' },
{
data: 'start_activity', render: function (data, type) {
console.log("start", data)
return data ? formatDate(data) : '-'
}
},
{
data: 'finish_activity', render: function (data, type) {
console.log("finish", data)
return data ? formatDate(data) : '-'
}
},
{
data: 'status_activity', render: function (data, type) {
console.log("status", data)
const val = !data ? '-' :
data == "done" ? `<span class="badge badge-success">${data}</span>` :
data == "open" ? `<span class="badge badge-primary">${data}</span>` :

35
view-mode/function/restActivityLink.js

@ -5,7 +5,6 @@ window.parent.postMessage({ action: 'getUrl' }, '*');
window.addEventListener('message', function(event) {
if (event.data && event.data.action === 'sendUrl') {
const parentUrl = event.data.url;
// Split the remaining path by "/"
parts = parentUrl.split("/");
}
@ -24,13 +23,10 @@ gantt.ajax.get({
data['links'] = obj.data.links;
// check if baseline has been set
if (data.data && data.data.length > 0) {
console.log('baseline', data.data[0].planned_start);
if (data.data[0].planned_start !== null && data.data[0].planned_end !== null) {
console.log('baseline set');
isBaselineSet = true;
}
else {
console.log('baseline has not been set');
isBaselineSet = false;
}
}
@ -58,7 +54,6 @@ function refresData(id){
let obj = JSON.parse(response);
data['data'] = obj.data.data;
data['links'] = obj.data.links;
// console.log("data parse wrong", data);
if(!parts[7]){
gantt.silent(function () {
gantt.parse(data);
@ -104,21 +99,17 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) {
}).then(function(response){
let res = response.responseText
res = JSON.parse(res)
// console.log("cek response", res)
if(entity=="link"){
gantt.changeLinkId(id, res.tid);
}else if(entity=="task"){
gantt.changeTaskId(id, res.tid);
}
// refresData();
});
break;
case "update":
if(entity=="task"){
data['start_date'] = moment(data.start_date).format("YYYY-MM-DD HH:mm:ss+07");
data['end_date'] = moment(data.end_date).format("YYYY-MM-DD HH:mm:ss+07");
// data['planned_start'] = moment(data.planned_start).format("YYYY-MM-DD HH:mm:ss+07");
// data['planned_end'] = moment(data.planned_end).format("YYYY-MM-DD HH:mm:ss+07");
if(data && data.parent){
data['parent_id'] = data.parent;
@ -130,9 +121,6 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) {
}
});
}
// console.log("cek data update", data)
// let dataProgress = parseInt(data.progress)
// dataProgress = dataProgress/100
return gantt.ajax.put({
headers: {
"Content-Type": "application/json",
@ -145,7 +133,6 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) {
let parent = data.parent;
let responseText = JSON.parse(response.responseText)
let resData = responseText
// console.log("dataRes", resData);
let updateBobot = resData.update_bobot || false
if(updateBobot){
refresData(id);
@ -154,25 +141,11 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) {
updateActivity(parent);
}
}
// console.log("data", data);
// refresData();
// if(resData && resData.rencana_biaya){
// if(data.rencana_biaya != resData.rencana_biaya){
// // gantt.getTask(id).bobot_planning = resData.bobot_planning;
// // gantt.updateTask(id);
// }else{
// if(parent && parent > 0){
// updateActivity(parent);
// }
// }
// }
}
});
break;
case "delete":
// console.log("cek data", data)
return gantt.ajax.del({
headers: {
"Authorization": `Bearer ${token}`
@ -193,14 +166,8 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) {
}
}
}
// console.log("cek data delete", data)
}
// let res = response.responseText
// res = JSON.parse(res)
// console.log("cek response", res)
// refresData();
});
break;
break;
}
});

2
view-mode/function/toolsResource.js

@ -88,7 +88,6 @@ $(document).ready(function () {
processResults: function (result) {
return {
results: $.map(result, function (item) {
// console.log("cek item", item)
return {
text: item.name,
id: item.id
@ -137,7 +136,6 @@ $(document).ready(function () {
processData: false,
contentType: false,
success: function (data) {
console.log('response data', data);
if (data && data.code === 200) {
actionHappen = true;
gantt.alert("Tools Assign Success!");

Loading…
Cancel
Save