Browse Source

update

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

38
edit-mode/function/expenseResource.js

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

18
edit-mode/function/function.js

@ -189,11 +189,14 @@ function initializationProject() {
function getSatuan() { function getSatuan() {
const payload = { const payload = {
"columns": [], "orders": {
"ascending": true,
"columns": [
'id'
]
}
} }
payload.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
)
$.ajax({ $.ajax({
data: JSON.stringify(payload), data: JSON.stringify(payload),
url: `${base_url}satuan/search`, url: `${base_url}satuan/search`,
@ -221,7 +224,7 @@ function getSatuan() {
let newOption = new Option(option.label, option.label); let newOption = new Option(option.label, option.label);
$('#uom-req-material').append(newOption); $('#uom-req-material').append(newOption);
}); });
$('#uom-req-expense').append(new Option('', '', true, true));
satuanList.forEach((option) => { satuanList.forEach((option) => {
let newOption = new Option(option.label, option.label); let newOption = new Option(option.label, option.label);
$('#uom-req-expense').append(newOption); $('#uom-req-expense').append(newOption);
@ -647,10 +650,8 @@ function updateShowHideColumn(data) {
processData: false, processData: false,
contentType: false, contentType: false,
success: function (data) { success: function (data) {
// console.log(data);
}, },
error: function (data) { error: function (data) {
// console.log(data);
} }
}); });
} }
@ -661,8 +662,6 @@ function colAjaxReq(type) {
type: "GET", type: "GET",
success: function (data) { success: function (data) {
let ganttColumnsByType = data.data; let ganttColumnsByType = data.data;
// console.log("ini gantt field ", ganttColumnsByType);
// console.log("ini column ", gantt.config.columns);
let isFound = false; let isFound = false;
x = gantt.config.columns.filter((val) => { x = gantt.config.columns.filter((val) => {
isFound = ganttColumnsByType.find(obj => { isFound = ganttColumnsByType.find(obj => {
@ -671,7 +670,6 @@ function colAjaxReq(type) {
if (isFound) if (isFound)
return val; return val;
if (isFound == false){ 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() { $(document).ready(function() {
$(".modal_add_btn_comment").on('click', function() { $(".modal_add_btn_comment").on('click', function() {
console.log('onclick add comments');
addComments(); addComments();
}); });
$("#btn_comment_submit").on('click', function() { $("#btn_comment_submit").on('click', function() {
@ -15,7 +14,6 @@ $(document).ready(function() {
// show comments modal // show comments modal
function showComments(id) { function showComments(id) {
var task = gantt.getTaskBy('id', id); var task = gantt.getTaskBy('id', id);
console.log('showComments', task);
var activity = task && task.length > 0 ? task[0].text : ''; var activity = task && task.length > 0 ? task[0].text : '';
$("#activity_id").val(id); $("#activity_id").val(id);
$("#comments_title").text(activity); $("#comments_title").text(activity);
@ -58,7 +56,6 @@ function submitComments() {
data: JSON.stringify(payload) data: JSON.stringify(payload)
}) })
.done(function( msg ) { .done(function( msg ) {
console.log('done submit comment', msg)
// gantt.message("Comment posted"); // gantt.message("Comment posted");
gantt.alert("Comment posted"); gantt.alert("Comment posted");
$("#add_comment_form").trigger("reset"); $("#add_comment_form").trigger("reset");
@ -106,7 +103,6 @@ function searchComments(activity_id) {
} }
} }
console.log('searchComments payload', payload);
$.ajax({ $.ajax({
method: "POST", method: "POST",
@ -115,7 +111,6 @@ function searchComments(activity_id) {
data: JSON.stringify(payload) data: JSON.stringify(payload)
}) })
.done(function( msg ) { .done(function( msg ) {
console.log('done search comment', msg)
var comments = msg && msg.data; var comments = msg && msg.data;
var contents = ''; var contents = '';
if (comments.length > 0) { if (comments.length > 0) {

38
edit-mode/function/ganttActivityUploadDoc.js

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

17
edit-mode/function/ganttConfig.js

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

32
edit-mode/function/ganttSettings.js

@ -65,6 +65,7 @@ $(document).ready(function () {
if (result && result.status == 200) { if (result && result.status == 200) {
if (result.data && result.data.data) { if (result.data && result.data.data) {
var config_dayoff = null; var config_dayoff = null;
if (result.data.data.config_dayoff !== null) { if (result.data.data.config_dayoff !== null) {
config_dayoff = result.data.data.config_dayoff; config_dayoff = result.data.data.config_dayoff;
@ -125,14 +126,13 @@ $(document).ready(function () {
gantt.render(); gantt.render();
}); });
$("#gantt_toggle_task_btn").on('click', function (event) { $("#gantt_toggle_task_btn").on('click', function (event) {
toggleCollapseTasks(); toggleCollapseTasks();
}); });
$("#dashboard-project").on('click', function (event) { $("#dashboard-project").on('click', function (event) {
window.location.href = `https://si.ospro.id/#/dashboard-project/${projectId}/${ganttId}/false-header`; window.location.href = `https://si.ospro.id/#/dashboard-project/${projectId}/${ganttId}?dashboardGantt=${true}`;
// window.location.href = `http://localhost:3000/#/dashboard-project/${projectId}/${ganttId}/false-header`; // window.location.href = `http://localhost:3000/#/dashboard-project/${projectId}/${ganttId}?dashboardGantt=${true}`;
}); });
$("#gantt-baseline").on('click', function (event) { $("#gantt-baseline").on('click', function (event) {
@ -181,7 +181,6 @@ async function initHolidays() {
var b = moment(a).add(val.duration, 'days'); var b = moment(a).add(val.duration, 'days');
for (var m = moment(a); m.isBefore(b); m.add(1, 'days')) { for (var m = moment(a); m.isBefore(b); m.add(1, 'days')) {
let holiday = new Date(m.format('YYYY-MM-DD')); let holiday = new Date(m.format('YYYY-MM-DD'));
console.log("holiday", holiday);
gantt.setWorkTime({ gantt.setWorkTime({
date: holiday, date: holiday,
hours: false hours: false
@ -197,6 +196,7 @@ async function initGanttSettings() {
$("#scale1").attr('checked', true); $("#scale1").attr('checked', true);
// init to gantt chart view (holidays) // init to gantt chart view (holidays)
B
const result = await axiosInstance const result = await axiosInstance
.get(VERSION_GANTT_EDIT_URL, HEADER) .get(VERSION_GANTT_EDIT_URL, HEADER)
.then(res => res) .then(res => res)
@ -205,6 +205,9 @@ async function initGanttSettings() {
if (result && result.status == 200) { if (result && result.status == 200) {
var config_dayoff = result.data.data.config_dayoff; var config_dayoff = result.data.data.config_dayoff;
var type_gantt = result.data.data.calculation_type; var type_gantt = result.data.data.calculation_type;
const ganttName = result.data.data.name_version;
document.getElementById("project-name-header").textContent = ganttName;
reRenderColumns(type_gantt); reRenderColumns(type_gantt);
var dayoff = []; var dayoff = [];
if (config_dayoff && config_dayoff.length > 0) { if (config_dayoff && config_dayoff.length > 0) {
@ -221,19 +224,11 @@ async function initGanttSettings() {
gantt.setWorkTime({ day: dayoff[i], hours: false }); gantt.setWorkTime({ day: dayoff[i], hours: false });
} }
} }
// for (let index = 1; index <= 7; index++) {
// const dateToCheck = new Date(2023, 4, index); // Note: Month is 0-based, so 5 represents June
// if (gantt.isWorkTime({ date: dateToCheck, hours: false })) {
// console.log(dateToCheck.toString() + ' is work time.');
// } else {
// console.log(dateToCheck.toString() + ' is not work time.');
// }
// }
} }
} }
B
function expandTask() { function expandTask() {
console.log("check expandTask")
gantt.eachTask(function (task) { gantt.eachTask(function (task) {
task.$open = true; task.$open = true;
}); });
@ -241,28 +236,27 @@ function expandTask() {
toggleTasks = "Collapse"; toggleTasks = "Collapse";
$("#gantt_toggle_task_btn").prop('title', 'Collapse Activities'); $("#gantt_toggle_task_btn").prop('title', 'Collapse Activities');
$("#gantt_toggle_task_btn").children().removeClass('fa-expand-alt'); $("#gantt_toggle_task_btn").children().removeClass('fa-expand-alt');
B
$("#gantt_toggle_task_btn").children().addClass('fa-compress-alt'); $("#gantt_toggle_task_btn").children().addClass('fa-compress-alt');
gantt.render(); gantt.render();
} }
function toggleCollapseTasks() { function toggleCollapseTasks() {
// collapse task / activity // collapse task / activity
console.log('toggleCollapseTasks');
gantt.eachTask(function (task) { gantt.eachTask(function (task) {
task.$open = toggleTasks == "Expand"; task.$open = toggleTasks == "Expand";
}); });
if (toggleTasks == "Expand") { if (toggleTasks == "Expand") {
updateProperty({ task_open: true }) updateProperty({ task_open: true })
// console.log('to collapse');
toggleTasks = "Collapse"; toggleTasks = "Collapse";
$("#gantt_toggle_task_btn").prop('title', 'Collapse Activities'); $("#gantt_toggle_task_btn").prop('title', 'Collapse Activities');
$("#gantt_toggle_task_btn").children().removeClass('fa-expand-alt'); $("#gantt_toggle_task_btn").children().removeClass('fa-expand-alt');
$("#gantt_toggle_task_btn").children().addClass('fa-compress-alt'); // change icon to collapse $("#gantt_toggle_task_btn").children().addClass('fa-compress-alt'); // change icon to collapse
} else { } else {
// console.log('to expand');
updateProperty({ task_open: false }) updateProperty({ task_open: false })
toggleTasks = "Expand"; toggleTasks = "Expand";
$("#gantt_toggle_task_btn").prop('title', 'Expand Activities'); $("#gantt_toggle_task_btn").prop('title', 'Expand Activities');
B
$("#gantt_toggle_task_btn").children().removeClass('fa-compress-alt'); $("#gantt_toggle_task_btn").children().removeClass('fa-compress-alt');
$("#gantt_toggle_task_btn").children().addClass('fa-expand-alt'); // change icon to expand $("#gantt_toggle_task_btn").children().addClass('fa-expand-alt'); // change icon to expand
} }
@ -272,11 +266,12 @@ function toggleCollapseTasks() {
// Function Show / Hide Columns // Function Show / Hide Columns
B
function getColumnsSelection(node) { function getColumnsSelection(node) {
var selectedColumns = node.querySelectorAll(":checked"); var selectedColumns = node.querySelectorAll(":checked");
var unselectedColumn = node.querySelectorAll('input[type="checkbox"]:not(:checked)'); var unselectedColumn = node.querySelectorAll('input[type="checkbox"]:not(:checked)');
// B
// var allSelected = node.querySelector("#check-all").prop('checked'); // var allSelected = node.querySelector("#check-all").prop('checked');
// console.log("unselectedColumn", unselectedColumn)
var checkedColumns = {}; var checkedColumns = {};
selectedColumns.forEach(function (node) { selectedColumns.forEach(function (node) {
checkedColumns[node.name] = true; checkedColumns[node.name] = true;
@ -431,7 +426,6 @@ async function setBaselineAPI() {
.get(ACTIVITY_SET_BASELINE_URL, HEADER) .get(ACTIVITY_SET_BASELINE_URL, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
console.log('set baseline res', res);
if (res && res.status === 200) { if (res && res.status === 200) {
// $('#modal_gantt_setting').modal('hide'); // $('#modal_gantt_setting').modal('hide');
// gantt.alert("Settings updated"); // gantt.alert("Settings updated");
@ -509,7 +503,6 @@ async function setSynchronizeAPI() {
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
console.log('synchronize res', res);
if (res && res.status === 200) { if (res && res.status === 200) {
// $('#modal_gantt_setting').modal('hide'); // $('#modal_gantt_setting').modal('hide');
// gantt.alert("Settings updated"); // gantt.alert("Settings updated");
@ -522,3 +515,4 @@ async function setSynchronizeAPI() {
} }
gantt.render(); gantt.render();
} }

2
edit-mode/function/holiday.js

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

2
edit-mode/function/humanResource.js

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

4
edit-mode/function/milestone.js

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

19
edit-mode/function/modalHumanResourceFunction.js

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

2
edit-mode/function/reportActivity.js

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

2
edit-mode/function/restActivityLink.js

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

2
edit-mode/function/toolsResource.js

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

2
edit-mode/index.html

@ -67,7 +67,7 @@
<div class="loading-overlay"></div> <div class="loading-overlay"></div>
<div class="container-header"> <div class="container-header">
<div class="container-project"> <div class="container-project">
<h6 id="project-name-header"></h6> <h6 id="project-name-header" style="margin-left: 10px;"></h6>
</div> </div>
<div class="container-action"> <div class="container-action">
<div class="btn-icon-toolbar btn-sm"><span class="icon-toolbar-separator">Zoom: </span></div> <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", type:"get",
success: function (data) { success: function (data) {
let dataRes = data.data let dataRes = data.data
// console.log("cek data", data);
drawnItem.clearLayers(); drawnItem.clearLayers();
if(dataRes.geom){ if(dataRes.geom){
let datageojson = JSON.parse(dataRes.geom); let datageojson = JSON.parse(dataRes.geom);
currentGeoJson = datageojson currentGeoJson = datageojson
// console.log("cek data geojson", datageojson);
if(datageojson.properties.radius){ if(datageojson.properties.radius){
let radius = datageojson.properties.radius let radius = datageojson.properties.radius
let lGeoJson = L.geoJson(datageojson); let lGeoJson = L.geoJson(datageojson);
@ -62,7 +60,6 @@ function openActivityMap(id)
let latlon = layers[0].getLatLng(); let latlon = layers[0].getLatLng();
let newCircle = L.circle([latlon.lat,latlon.lng], {radius: radius}); let newCircle = L.circle([latlon.lat,latlon.lng], {radius: radius});
drawnItem.addLayer(newCircle); drawnItem.addLayer(newCircle);
// console.log("cek layers", layers[0]);
}else{ }else{
let lGeoJson = L.geoJson(datageojson); let lGeoJson = L.geoJson(datageojson);
let layers = lGeoJson.getLayers(); let layers = lGeoJson.getLayers();
@ -109,19 +106,16 @@ $(document).ready(function () {
layer = e.layer; layer = e.layer;
if (type === 'marker') { if (type === 'marker') {
let latlong = layer.getLatLng(); let latlong = layer.getLatLng();
// console.log("cek latlong", latlong);
circLat = latlong.lat circLat = latlong.lat
circLong = latlong.lng circLong = latlong.lng
$("#modal_radius").modal("show"); $("#modal_radius").modal("show");
// Do marker specific actions // Do marker specific actions
// let attri = layer.getAttribution(); // let attri = layer.getAttribution();
// console.log("cek attribute", attri);
return false; return false;
} }
let geJson = layer.toGeoJSON(); let geJson = layer.toGeoJSON();
currentGeoJson = geJson; currentGeoJson = geJson;
// let lgeojson = L.geoJson(geJson) // let lgeojson = L.geoJson(geJson)
// console.log("cek layer", layer.toGeoJSON());
// layer.bindTooltip("cek"); // layer.bindTooltip("cek");
// Do whatever else you need to. (save to db; add to map etc) // Do whatever else you need to. (save to db; add to map etc)
drawnItem.addLayer(layer); drawnItem.addLayer(layer);
@ -134,7 +128,6 @@ $(document).ready(function () {
var type = e.layerType, var type = e.layerType,
layer = e.layer; layer = e.layer;
// console.log("cek layer", layer.toGeoJSON());
// Do whatever else you need to. (save to db; add to map etc) // Do whatever else you need to. (save to db; add to map etc)
currentGeoJson = ""; currentGeoJson = "";
drawnItem.removeLayer(layer); drawnItem.removeLayer(layer);
@ -155,8 +148,6 @@ $(document).ready(function () {
}else{ }else{
currentGeoJson = geoJson 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) // Do whatever else you need to. (save to db; add to map etc)
// drawnItem.removeLayer(layer); // drawnItem.removeLayer(layer);
// drawnControlEdit.remove(); // drawnControlEdit.remove();
@ -234,7 +225,6 @@ function submitCircle(radius)
let geojsoncircle = circle.toGeoJSON(); let geojsoncircle = circle.toGeoJSON();
geojsoncircle.properties.radius = radius geojsoncircle.properties.radius = radius
currentGeoJson = geojsoncircle currentGeoJson = geojsoncircle
// console.log("geojsoncircle", geojsoncircle);
drawnItem.addLayer(circle); drawnItem.addLayer(circle);
drawControl.remove(); drawControl.remove();
map.addControl(drawnControlEdit); map.addControl(drawnControlEdit);

8
view-mode/function/function.js

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

6
view-mode/function/ganttActivityComments.js

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

45
view-mode/function/ganttActivityUploadDoc.js

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

1
view-mode/function/ganttConfig.js

@ -3,7 +3,6 @@ const readOnly = getUrlParameter("ro");
const proyekId = getUrlParameter("proyek_id"); const proyekId = getUrlParameter("proyek_id");
let base_url = getUrlParameter("base_url"); let base_url = getUrlParameter("base_url");
const role_name = getUrlParameter("role_name"); const role_name = getUrlParameter("role_name");
const company_id = getUrlParameter("company_id");
const adwIntegrationUrl = "https://adw-api.ospro.id/api"; const adwIntegrationUrl = "https://adw-api.ospro.id/api";
let userToVersionGanttId = 0 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){ gantt.ext.inlineEditors.attachEvent("onBeforeEditStart", function(state){
let id = parseInt(state.id) let id = parseInt(state.id)
let ganttData = gantt.getTask(id); let ganttData = gantt.getTask(id);
// console.log("cek ganttData", ganttData);
if(ganttData.type_activity && ganttData.type_activity=="header"){ if(ganttData.type_activity && ganttData.type_activity=="header"){
return false return false
} }
@ -32,13 +31,11 @@ gantt.ext.inlineEditors.attachEvent("onBeforeEditStart", function(state){
} }
if(column=="cost_actual"){ if(column=="cost_actual"){
// let ganttData = gantt.getTask(id);
let progress = ganttData.progress ? ganttData.progress : 0 let progress = ganttData.progress ? ganttData.progress : 0
if(progress <= 0){ if(progress <= 0){
return false return false
} }
} }
// console.log("cek state", state);
return true return true
}); });
@ -64,7 +61,6 @@ gantt.attachEvent("onBeforeTaskUpdate", function(id,new_item){
gantt.attachEvent("onBeforeLinkAdd", function(id,link){ gantt.attachEvent("onBeforeLinkAdd", function(id,link){
//any custom logic here //any custom logic here
// console.log("cek link", link);
let source = link.source; let source = link.source;
let target = link.target; let target = link.target;
let parents = gantt.getParent(source); let parents = gantt.getParent(source);

36
view-mode/function/ganttSettings.js

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

4
view-mode/function/milestone.js

@ -1,6 +1,5 @@
var milestoneModal = $('#modal-add-milestone > .modal-dialog > .modal-content'); var milestoneModal = $('#modal-add-milestone > .modal-dialog > .modal-content');
function addMilestone(id){ function addMilestone(id){
console.log("cek cek id milestone", id);
if(id && id > 0){ if(id && id > 0){
$("#milestone_parent").val(id); $("#milestone_parent").val(id);
} }
@ -41,7 +40,6 @@ $(document).ready(function () {
processResults: function (result) { processResults: function (result) {
return { return {
results: $.map(result, function (item) { results: $.map(result, function (item) {
// console.log("cek item", item)
return { return {
due_date:item.due_date, due_date:item.due_date,
deadline:item.deadline, deadline:item.deadline,
@ -85,14 +83,12 @@ $(document).ready(function () {
$('#submit-milestone').html('Add..'); $('#submit-milestone').html('Add..');
$('#submit-milestone').prop("disabled",true); $('#submit-milestone').prop("disabled",true);
var data = Object.fromEntries(new FormData(this)); var data = Object.fromEntries(new FormData(this));
console.log("cek data form", data);
let parent = data.milestone_parent; let parent = data.milestone_parent;
var taskId = 0; var taskId = 0;
var start = moment(data.due_date, "YYYY-MM-DD"); var start = moment(data.due_date, "YYYY-MM-DD");
var end = moment(data.deadline, "YYYY-MM-DD"); var end = moment(data.deadline, "YYYY-MM-DD");
let duration = moment.duration(start.diff(end)).asDays(); let duration = moment.duration(start.diff(end)).asDays();
let nameMilestone = data.status!="" ? data.status : data.id_milestone let nameMilestone = data.status!="" ? data.status : data.id_milestone
// console.log("cek duration", Math.abs(duration));
if(parent && parseInt(parent) > 0){ if(parent && parseInt(parent) > 0){
taskId = gantt.addTask({ taskId = gantt.addTask({
id: Math.floor(Math.random() * 1000) + 5000, 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_ROLE_HUMAN_RESOURCE = []
let DATA_HUMAN_RESOURCE = [] let DATA_HUMAN_RESOURCE = []
let forbiddenHuman = []
// let DATA_MATERIAL_RESOURCE = []
// let DATA_TOOL_RESOURCE = []
function getDataHumanResource() { function getDataHumanResource() {
const url = `${base_url}human-resource/search` const url = `${base_url}human-resource/search`
const payload = { const payload = {
@ -15,14 +12,6 @@ $(document).ready(function () {
"start": 1, "start": 1,
"length": -1 "length": -1
}, },
"columns": [
// {
// "name": "proyek_id",
// "logic_operator": "like",
// "value": search,
// "operator": "AND"
// },
],
"orders": { "orders": {
"columns": [ "columns": [
"id" "id"
@ -30,19 +19,8 @@ $(document).ready(function () {
"ascending": false "ascending": false
} }
} }
// console.log("qry", qry)
axiosInstance.post(url, payload, HEADER).then(res => { axiosInstance.post(url, payload, HEADER).then(res => {
console.log('getDataHumanResource', res)
DATA_HUMAN_RESOURCE = res.data.data 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": [], "joins": [],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
// console.log("qry", qry)
axiosInstance.post(url, payload, HEADER).then(res => { axiosInstance.post(url, payload, HEADER).then(res => {
console.log(res)
DATA_ROLE_HUMAN_RESOURCE = res.data.data 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) { $('#human-resource').on('show.bs.modal', function (event) {
// console.log("open modal human resource")
getDataHumanResource() getDataHumanResource()
getDataRole() getDataRole()
// getDataMaterials()
// getDataTools()
}); });
$('#human-resource').on('hide.bs.modal', function (event) { $('#human-resource').on('hide.bs.modal', function (event) {
@ -149,7 +52,6 @@ $(document).ready(function () {
$("#add-human-resource").on('click', function () { $("#add-human-resource").on('click', function () {
const num = $('#table-human-resource tr').length const num = $('#table-human-resource tr').length
console.log(num)
const idx = num + 1 const idx = num + 1
$('#table-human-resource').append(` $('#table-human-resource').append(`
<tr id="row-human-resource-${idx}"> <tr id="row-human-resource-${idx}">
@ -182,13 +84,11 @@ $(document).ready(function () {
$('#table-human-resource').on('click', '.human-resource-delete', function (event) { $('#table-human-resource').on('click', '.human-resource-delete', function (event) {
const idx = $(this).attr("index") const idx = $(this).attr("index")
console.log(idx)
$(`#row-human-resource-${idx}`).remove() $(`#row-human-resource-${idx}`).remove()
}) })
// $("#add-material-resource").on('click', function () { // $("#add-material-resource").on('click', function () {
// const num = $('#table-material-resource tr').length // const num = $('#table-material-resource tr').length
// console.log(num)
// const idx = num + 1 // const idx = num + 1
// $('#table-material-resource').append(` // $('#table-material-resource').append(`
// <tr id="row-material-resource-${idx}"> // <tr id="row-material-resource-${idx}">
@ -216,13 +116,11 @@ $(document).ready(function () {
// $('#table-material-resource').on('click', '#material-resource-delete', function (event) { // $('#table-material-resource').on('click', '#material-resource-delete', function (event) {
// const idx = $(this).attr("index") // const idx = $(this).attr("index")
// console.log(idx)
// $(`#row-material-resource-${idx}`).remove() // $(`#row-material-resource-${idx}`).remove()
// }) // })
// $("#add-tool-resource").on('click', function () { // $("#add-tool-resource").on('click', function () {
// const num = $('#table-tool-resource tr').length // const num = $('#table-tool-resource tr').length
// console.log(num)
// const idx = num + 1 // const idx = num + 1
// $('#table-tool-resource').append(` // $('#table-tool-resource').append(`
// <tr id="row-tool-resource-${idx}"> // <tr id="row-tool-resource-${idx}">
@ -250,13 +148,11 @@ $(document).ready(function () {
// $('#table-tool-resource').on('click', '#tool-resource-delete', function (event) { // $('#table-tool-resource').on('click', '#tool-resource-delete', function (event) {
// const idx = $(this).attr("index") // const idx = $(this).attr("index")
// console.log(idx)
// $(`#row-tool-resource-${idx}`).remove() // $(`#row-tool-resource-${idx}`).remove()
// }) // })
$(".submit-human-resource").on('click', function () { $(".submit-human-resource").on('click', function () {
console.log('onclick submit human resource');
// addComments(); // addComments();
let valueHumanResource = [] let valueHumanResource = []
const num = $('#table-human-resource tr').length const num = $('#table-human-resource tr').length
@ -269,7 +165,6 @@ $(document).ready(function () {
} }
valueHumanResource.push(obj) valueHumanResource.push(obj)
} }
console.log("cek value", valueHumanResource)
// let valueMaterialResource = [] // let valueMaterialResource = []
// const numMaterial = $('#table-material-resource tr').length // const numMaterial = $('#table-material-resource tr').length
@ -282,7 +177,6 @@ $(document).ready(function () {
// } // }
// valueMaterialResource.push(obj) // valueMaterialResource.push(obj)
// } // }
// console.log(valueMaterialResource)
// let valueToolResource = [] // let valueToolResource = []
// const numTool = $('#table-tool-resource tr').length // const numTool = $('#table-tool-resource tr').length
@ -295,11 +189,9 @@ $(document).ready(function () {
// } // }
// valueToolResource.push(obj) // valueToolResource.push(obj)
// } // }
// console.log(valueToolResource)
// const cost = $(`#cost-human-resource`).val() // const cost = $(`#cost-human-resource`).val()
// const duration = $(`#duration-human-resource`).val() // const duration = $(`#duration-human-resource`).val()
// const dateStart = $(`#date-started-human-started`).val() // const dateStart = $(`#date-started-human-started`).val()
// console.log({ cost, duration, dateStart })
// $("#exampleModal").modal('hide'); // $("#exampleModal").modal('hide');
}); });

1
view-mode/function/overlaySCurve.js

@ -98,7 +98,6 @@ function getChartScaleRange() {
function getProgressLine() { function getProgressLine() {
// As long as the progress data length is same with chart scale range (period) then it's fine. // As long as the progress data length is same with chart scale range (period) then it's fine.
getSCurveData(); getSCurveData();
// console.log("apa ", return_first);
var cumulativePlannedDurations = return_first.data[0].data.percentagePlan; var cumulativePlannedDurations = return_first.data[0].data.percentagePlan;
var cumulativeRealDurations = return_first.data[0].data.percentageReal; var cumulativeRealDurations = return_first.data[0].data.percentageReal;
cumulativeRealDurations[cumulativeRealDurations.length - 1] = Math.ceil(cumulativeRealDurations[cumulativeRealDurations.length - 1]); 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: 'uom', name: 'uom' },
{ {
data: 'start_activity', render: function (data, type) { data: 'start_activity', render: function (data, type) {
console.log("start", data)
return data ? formatDate(data) : '-' return data ? formatDate(data) : '-'
} }
}, },
{ {
data: 'finish_activity', render: function (data, type) { data: 'finish_activity', render: function (data, type) {
console.log("finish", data)
return data ? formatDate(data) : '-' return data ? formatDate(data) : '-'
} }
}, },
{ {
data: 'status_activity', render: function (data, type) { data: 'status_activity', render: function (data, type) {
console.log("status", data)
const val = !data ? '-' : const val = !data ? '-' :
data == "done" ? `<span class="badge badge-success">${data}</span>` : data == "done" ? `<span class="badge badge-success">${data}</span>` :
data == "open" ? `<span class="badge badge-primary">${data}</span>` : data == "open" ? `<span class="badge badge-primary">${data}</span>` :

33
view-mode/function/restActivityLink.js

@ -5,7 +5,6 @@ window.parent.postMessage({ action: 'getUrl' }, '*');
window.addEventListener('message', function(event) { window.addEventListener('message', function(event) {
if (event.data && event.data.action === 'sendUrl') { if (event.data && event.data.action === 'sendUrl') {
const parentUrl = event.data.url; const parentUrl = event.data.url;
// Split the remaining path by "/" // Split the remaining path by "/"
parts = parentUrl.split("/"); parts = parentUrl.split("/");
} }
@ -24,13 +23,10 @@ gantt.ajax.get({
data['links'] = obj.data.links; data['links'] = obj.data.links;
// check if baseline has been set // check if baseline has been set
if (data.data && data.data.length > 0) { 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) { if (data.data[0].planned_start !== null && data.data[0].planned_end !== null) {
console.log('baseline set');
isBaselineSet = true; isBaselineSet = true;
} }
else { else {
console.log('baseline has not been set');
isBaselineSet = false; isBaselineSet = false;
} }
} }
@ -58,7 +54,6 @@ function refresData(id){
let obj = JSON.parse(response); let obj = JSON.parse(response);
data['data'] = obj.data.data; data['data'] = obj.data.data;
data['links'] = obj.data.links; data['links'] = obj.data.links;
// console.log("data parse wrong", data);
if(!parts[7]){ if(!parts[7]){
gantt.silent(function () { gantt.silent(function () {
gantt.parse(data); gantt.parse(data);
@ -104,21 +99,17 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) {
}).then(function(response){ }).then(function(response){
let res = response.responseText let res = response.responseText
res = JSON.parse(res) res = JSON.parse(res)
// console.log("cek response", res)
if(entity=="link"){ if(entity=="link"){
gantt.changeLinkId(id, res.tid); gantt.changeLinkId(id, res.tid);
}else if(entity=="task"){ }else if(entity=="task"){
gantt.changeTaskId(id, res.tid); gantt.changeTaskId(id, res.tid);
} }
// refresData();
}); });
break; break;
case "update": case "update":
if(entity=="task"){ if(entity=="task"){
data['start_date'] = moment(data.start_date).format("YYYY-MM-DD HH:mm:ss+07"); 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['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){ if(data && data.parent){
data['parent_id'] = 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({ return gantt.ajax.put({
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -145,7 +133,6 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) {
let parent = data.parent; let parent = data.parent;
let responseText = JSON.parse(response.responseText) let responseText = JSON.parse(response.responseText)
let resData = responseText let resData = responseText
// console.log("dataRes", resData);
let updateBobot = resData.update_bobot || false let updateBobot = resData.update_bobot || false
if(updateBobot){ if(updateBobot){
refresData(id); refresData(id);
@ -154,25 +141,11 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) {
updateActivity(parent); 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; break;
case "delete": case "delete":
// console.log("cek data", data)
return gantt.ajax.del({ return gantt.ajax.del({
headers: { headers: {
"Authorization": `Bearer ${token}` "Authorization": `Bearer ${token}`
@ -193,13 +166,7 @@ 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) { processResults: function (result) {
return { return {
results: $.map(result, function (item) { results: $.map(result, function (item) {
// console.log("cek item", item)
return { return {
text: item.name, text: item.name,
id: item.id id: item.id
@ -137,7 +136,6 @@ $(document).ready(function () {
processData: false, processData: false,
contentType: false, contentType: false,
success: function (data) { success: function (data) {
console.log('response data', data);
if (data && data.code === 200) { if (data && data.code === 200) {
actionHappen = true; actionHappen = true;
gantt.alert("Tools Assign Success!"); gantt.alert("Tools Assign Success!");

Loading…
Cancel
Save