diff --git a/edit-mode/function/activityLocation.js b/edit-mode/function/activityLocation.js
index 77e9c90..f6f7992 100644
--- a/edit-mode/function/activityLocation.js
+++ b/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);
diff --git a/edit-mode/function/expenseResource.js b/edit-mode/function/expenseResource.js
index 1ede914..bf36e32 100644
--- a/edit-mode/function/expenseResource.js
+++ b/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(`
Plan Date: ${moment(activityEarlyStart).format('DD MMMM YYYY')} - ${moment(activityEarlyFinish).format('DD MMMM YYYY')}
`);
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
diff --git a/edit-mode/function/function.js b/edit-mode/function/function.js
index 74e7292..0ef13cd 100644
--- a/edit-mode/function/function.js
+++ b/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);
}
});
diff --git a/edit-mode/function/ganttActivityComments.js b/edit-mode/function/ganttActivityComments.js
index 99ae770..807be73 100644
--- a/edit-mode/function/ganttActivityComments.js
+++ b/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) {
diff --git a/edit-mode/function/ganttActivityUploadDoc.js b/edit-mode/function/ganttActivityUploadDoc.js
index ecfbc0a..07547b3 100644
--- a/edit-mode/function/ganttActivityUploadDoc.js
+++ b/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 += '';
- // for (var i=0; i < documents.length; i++) {
- // // contents += '';
-
- // }
- // contents += '
';
- // }
$("#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);
diff --git a/edit-mode/function/ganttConfig.js b/edit-mode/function/ganttConfig.js
index 48ab3d1..0a22727 100644
--- a/edit-mode/function/ganttConfig.js
+++ b/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 `${truncatedText}`;
+ // function truncateText(text, maxLength) {
+ // if (text.length > maxLength) {
+ // return text.substring(0, maxLength) + '...';
+ // }
+ // return text;
+ // }
+ // const truncatedText = truncateText(text.text, 30);
+ return `${text.text}`;
}
},
{
diff --git a/edit-mode/function/ganttSettings.js b/edit-mode/function/ganttSettings.js
index f365735..3c43dfc 100644
--- a/edit-mode/function/ganttSettings.js
+++ b/edit-mode/function/ganttSettings.js
@@ -1,524 +1,511 @@
-// set work days
-
-// gantt.setWorkTime({ day:1, hours:false });
-
-const VERSION_GANTT_EDIT_URL = `${base_url}version-gantt/edit/${ganttId}`;
-const VERSION_GANTT_UPDATE_URL = `${base_url}version-gantt/update/${ganttId}`;
-const ACTIVITY_SET_BASELINE_URL = `${base_url}project/set-baseline/${ganttId}`;
-const ACTIVITY_SET_BASELINE_ACTIVITY_URL = (id) => {
- return `${base_url}project/set-baseline-activity/${id}/${ganttId}`;
-}
-const ACTIVITY_SYNCHRONIZE_REPORT_URL = `${base_url}project/synchronize-report/${ganttId}`;
-let projectId = getUrlParameter("proyek_id");
-var toggleTasks = "Collapse";
-var isBaselineSet = false;
-var daysObj = [
- {
- text: "Sunday",
- value: "0"
- },
- {
- text: "Monday",
- value: "1"
- },
- {
- text: "Tuesday",
- value: "2"
- },
- {
- text: "Wednesday",
- value: "3"
- },
- {
- text: "Thursday",
- value: "4"
- },
- {
- text: "Friday",
- value: "5"
- },
- {
- text: "Saturday",
- value: "6"
- }
-];
-var days = [0, 1, 2, 3, 4, 5, 6]; // Sunday -> Saturday
-
-var selectDayOffChoices = null;
-
-$(document).ready(function () {
- // init select multiple workdays
- selectDayOffChoices = new Choices('#select_dayoff', {
- removeItemButton: true,
- shouldSort: false
- // maxItemCount: 5,
- // searchResultLimit: 5,
- // renderChoiceLimit: 5
- });
-
- $('#gantt_setting_btn').on('click', async function () {
- const result = await axiosInstance
- .get(VERSION_GANTT_EDIT_URL, HEADER)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.status == 200) {
- if (result.data && result.data.data) {
- var config_dayoff = null;
- if (result.data.data.config_dayoff !== null) {
- config_dayoff = result.data.data.config_dayoff;
-
- if (config_dayoff && config_dayoff.length > 0) {
- var config_dayoff_arr = config_dayoff.split(',');
- for (var i = 0; i < config_dayoff_arr.length; i++) {
- var day = daysObj.find(o => parseInt(o.value) === parseInt(config_dayoff_arr[i]));
- selectDayOffChoices.setChoiceByValue(day.value);
- }
- }
- }
- }
- } else {
- gantt.alert({ type: "error", text: "Failed to get settings. Please check your internet connection." });
- }
- $('#modal_gantt_setting').modal('show');
- });
-
- $('#btn_save_setting').on('click', async function () {
- var holidays = [];
- var dayoff = $('#select_dayoff').val();
- var costToComplete = $("#costToCompleteBox").val();
- var committedCost = $("#committedCostBox").val();
-
- dayoff = dayoff.map(item => parseInt(item));
- var workdays = _.difference(days, dayoff);
-
- // reset the dayoff first
- for (var i = 0; i < days.length; i++) {
- gantt.unsetWorkTime({ day: days[i], hours: false });
- }
-
- if (dayoff.length > 0) {
- for (var i = 0; i < dayoff.length; i++) {
- gantt.setWorkTime({ day: dayoff[i], hours: false });
- }
- }
-
- let payload = {
- "config_dayoff": dayoff.join(','),
- "cost_to_complete": costToComplete ? costToComplete : 0,
- "committed_cost": committedCost ? committedCost : 0
- }
-
- const result = await axiosInstance
- .put(VERSION_GANTT_UPDATE_URL, payload, HEADER)
- .then(res => res)
- .catch((error) => error.response);
- if (result && result.status === 200) {
- $('#modal_gantt_setting').modal('hide');
- gantt.message("Settings updated");
- refresData();
- }
- else {
- gantt.alert({ type: "error", text: "Failed to update setting" });
- }
-
- gantt.render();
-
- });
-
- $("#gantt_toggle_task_btn").on('click', function (event) {
- toggleCollapseTasks();
- });
-
- $("#dashboard-project").on('click', function (event) {
- window.location.href = `https://si.ospro.id/#/dashboard-project/${projectId}/${ganttId}false-header`;
- // window.location.href = `http://localhost:3000/#/dashboard-project/${projectId}/${ganttId}/false-header`;
- });
-
- $("#gantt-baseline").on('click', function (event) {
- setBaseline();
- });
-
- $("#save-activity").on('click', function (event) {
- batchUpdate();
- });
-
- $("#gantt-synchronize").on('click', function (event) {
- setSynchronize();
- });
-
- $("#compare-data").on('click', function (event) {
- compareData(ganttTask);
- });
-
- $("#update-schedule").on('click', function (event) {
- updateSchedule();
- });
-
- initHolidays();
- initGanttSettings();
-});
-
-async function initHolidays() {
- let payload = {
- "columns": [
- { "name": "version_gantt_id", "logic_operator": "=", "value": ganttId },
- { "name": "proyek_id", "logic_operator": "=", "value": proyekId }
- ],
- "joins": [],
- "orders": { "columns": ["date"], "ascending": true },
- "paging": { "start": 0, "length": -1 }
- }
-
- $.ajax({
- data: JSON.stringify(payload),
- url: `${base_url}holiday/search`,
- type: "POST",
- success: function (result) {
- let dataHolidays = result.data || []
- dataHolidays.map((val, index) => {
- var a = moment(val.date);
- 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("holiday", holiday);
- gantt.setWorkTime({
- date: holiday,
- hours: false
- });
- }
- });
- gantt.render();
- },
- });
-}
-
-async function initGanttSettings() {
- $("#scale1").attr('checked', true);
-
- // init to gantt chart view (holidays)
- const result = await axiosInstance
- .get(VERSION_GANTT_EDIT_URL, HEADER)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.status == 200) {
- var config_dayoff = result.data.data.config_dayoff;
- var type_gantt = result.data.data.calculation_type;
- reRenderColumns(type_gantt);
- var dayoff = [];
- if (config_dayoff && config_dayoff.length > 0) {
- dayoff = config_dayoff.split(',');
- }
-
- // reset the dayoff first
- for (var i = 0; i < days.length; i++) {
- gantt.unsetWorkTime({ day: days[i], hours: false });
- }
-
- if (dayoff.length > 0) {
- for (var i = 0; i < dayoff.length; i++) {
- 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.');
- // }
- // }
- }
-}
-
-function expandTask() {
- console.log("check expandTask")
- gantt.eachTask(function (task) {
- task.$open = true;
- });
- // updateProperty({task_open:true})
- 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');
- gantt.render();
-}
-
-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');
- $("#gantt_toggle_task_btn").children().removeClass('fa-compress-alt');
- $("#gantt_toggle_task_btn").children().addClass('fa-expand-alt'); // change icon to expand
- }
- gantt.render();
- setGanttOpen();
-}
-
-
-// Function Show / Hide Columns
-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;
- });
- unselectedColumn.forEach(function (node) {
- checkedColumns[node.name] = false;
- });
- return checkedColumns;
-}
-
-function populateColumnsDropdown(node) {
- var visibleColumns = {};
- // var preventHide = ['action'];
- gantt.config.columns.forEach(function (col) {
- visibleColumns[col.name] = true;
- });
-
- var lines = [];
- allColumns.forEach(function (col) {
- var checked = visibleColumns[col.name] ? "checked" : "";
- // skip action to be pushed
- lines.push(``);
- });
- node.innerHTML = 'Show / Hide Columns
' + lines.join("
");
-}
-
-function getDropdownNode() {
- return document.querySelector("#gantt_dropdown");
-}
-
-gantt.$showDropdown = function (node) {
- var position = node.getBoundingClientRect();
- var dropDown = getDropdownNode();
- dropDown.style.top = position.bottom + "px";
- dropDown.style.left = position.left - 150 + "px";
- dropDown.style.display = "block";
- populateColumnsDropdown(dropDown);
-
- dropDown.onchange = function () {
- var selection = getColumnsSelection(dropDown);
- if (readOnly && parseInt(readOnly) == 0) {
- updateShowHideColumn(selection)
- }
- gantt.config.columns = createColumnsConfig(selection);
- gantt.render();
- }
-
- dropDown.keep = true;
- setTimeout(function () {
- dropDown.keep = false;
- })
-}
-
-gantt.$hideDropdown = function () {
- var dropDown = getDropdownNode();
- dropDown.style.display = "none";
-}
-
-window.addEventListener("click", function (event) {
- if (!event.target.closest("#gantt_dropdown") && !getDropdownNode().keep) {
- gantt.$hideDropdown();
- }
-});
-
-// End Function Show / Hide Columns
-
-
-// Set Baseline
-function setBaseline() {
- var box = gantt.confirm({
- text: "Set Baseline for this gantt chart?",
- ok: "Yes",
- cancel: "No",
- callback: async function (result) {
- if (result) {
- // gantt.message("Yes!");
- // send to API
- await setBaselineAPI();
- } else {
- // gantt.message("No...");
- }
- }
- });
-}
-
-// Set Baseline Activity
-function setBaselineActivity(activity_id, name) {
- var box = gantt.confirm({
- text: `Set Baseline for this activity ${name}?`,
- ok: "Yes",
- cancel: "No",
- callback: async function (result) {
- if (result) {
- await setBaselineActivityAPI(activity_id);
- }
- }
- });
-}
-
-async function importUpdate() {
- expandTask();
- var allTasks = [];
- var taskCount = gantt.getTaskCount();
-
- for (var i = 0; i < taskCount; i++) {
- var task = gantt.getTaskByIndex(i);
- allTasks.push(task);
- }
-
- $("body").addClass("loading");
- const response = await gantt.ajax.post({
- headers: {
- "Content-Type": "application/json",
- "Authorization": `Bearer ${token}`
- },
- url: `${base_url}activity/import-update`,
- dataType: "json",
- data: JSON.stringify(allTasks)
- }).then(function (response) {
- $("body").removeClass("loading");
- let res = response.responseText
- res = JSON.parse(res)
- }).catch(function (error) {
- $("body").removeClass("loading");
- gantt.alert({
- title: "Peringatan",
- type: "alert-error",
- text: "Update import gagal"
- });
- });
-}
-
-async function setBaselineActivityAPI(activity_id) {
- await importUpdate();
- const res = await axiosInstance
- .get(ACTIVITY_SET_BASELINE_ACTIVITY_URL(activity_id), HEADER)
- .then(res => res)
- .catch((error) => error.response);
- if (res && res.status === 200) {
- gantt.message("Set baseline activity success!");
- window.location.reload();
- } else {
- $("body").removeClass("loading");
- gantt.alert({ type: "error", text: "Failed to set baseline activity" });
- }
- gantt.render();
-}
-
-async function setBaselineAPI() {
- await importUpdate();
- const res = await axiosInstance
- .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");
- // gantt.message(result.data.message);
- gantt.message("Set baseline success!");
- window.location.reload();
- }
- else {
- $("body").removeClass("loading");
- gantt.alert({ type: "error", text: "Failed to set baseline" });
- }
- gantt.render();
-}
-
-function setSynchronize() {
- if (!isBaselineSet) {
- // gantt.alert({
- // title:"Synchronize to Report",
- // type:"alert-error",
- // text:"Please set baseline before continue."
- // });
- gantt.confirm({
- text: "Plase set baseline before continue.",
- ok: "Set Baseline",
- cancel: "Cancel",
- callback: async function (result) {
- if (result) {
- await setBaselineAPI();
- }
- }
- });
- return false;
- }
-
- var box = gantt.confirm({
- text: "Synchronize to Report Activity?",
- ok: "Yes",
- cancel: "No",
- callback: async function (result) {
- if (result) {
- // gantt.message("Yes!");
- // send to API
- await setSynchronizeAPI()
- } else {
- // gantt.message("No...");
- }
- }
- });
-}
-
-function updateSchedule() {
- $("body").addClass("loading");
- return gantt.ajax.get({
- headers: {
- "Content-Type": "application/json",
- "Authorization": `Bearer ${token}`
- },
- url: base_url + "activity/update-schedule/" + ganttId
- }).then(function (response) {
- $("body").removeClass("loading");
- window.location.reload();
- }).catch(function (error) {
- $("body").removeClass("loading")
- gantt.alert({
- title: "Peringatan",
- type: "alert-error",
- text: "Update activity gagal"
- });
- });
-}
-
-async function setSynchronizeAPI() {
- const res = await axiosInstance
- .get(ACTIVITY_SYNCHRONIZE_REPORT_URL, HEADER)
- .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");
- // gantt.message(result.data.message);
- gantt.message("Synchronize to Report success!");
- window.location.reload();
- }
- else {
- gantt.alert({ type: "error", text: "Failed to Synchronize to Report" });
- }
- gantt.render();
-}
+// set work days
+
+// gantt.setWorkTime({ day:1, hours:false });
+
+const VERSION_GANTT_EDIT_URL = `${base_url}version-gantt/edit/${ganttId}`;
+const VERSION_GANTT_UPDATE_URL = `${base_url}version-gantt/update/${ganttId}`;
+const ACTIVITY_SET_BASELINE_URL = `${base_url}project/set-baseline/${ganttId}`;
+const ACTIVITY_SET_BASELINE_ACTIVITY_URL = (id) => {
+ return `${base_url}project/set-baseline-activity/${id}/${ganttId}`;
+}
+const ACTIVITY_SYNCHRONIZE_REPORT_URL = `${base_url}project/synchronize-report/${ganttId}`;
+let projectId = getUrlParameter("proyek_id");
+var toggleTasks = "Collapse";
+var isBaselineSet = false;
+var daysObj = [
+ {
+ text: "Sunday",
+ value: "0"
+ },
+ {
+ text: "Monday",
+ value: "1"
+ },
+ {
+ text: "Tuesday",
+ value: "2"
+ },
+ {
+ text: "Wednesday",
+ value: "3"
+ },
+ {
+ text: "Thursday",
+ value: "4"
+ },
+ {
+ text: "Friday",
+ value: "5"
+ },
+ {
+ text: "Saturday",
+ value: "6"
+ }
+];
+var days = [0, 1, 2, 3, 4, 5, 6]; // Sunday -> Saturday
+
+var selectDayOffChoices = null;
+
+$(document).ready(function () {
+ // init select multiple workdays
+ selectDayOffChoices = new Choices('#select_dayoff', {
+ removeItemButton: true,
+ shouldSort: false
+ // maxItemCount: 5,
+ // searchResultLimit: 5,
+ // renderChoiceLimit: 5
+ });
+
+ $('#gantt_setting_btn').on('click', async function () {
+ const result = await axiosInstance
+ .get(VERSION_GANTT_EDIT_URL, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.status == 200) {
+ if (result.data && result.data.data) {
+ var config_dayoff = null;
+
+ if (result.data.data.config_dayoff !== null) {
+ config_dayoff = result.data.data.config_dayoff;
+
+ if (config_dayoff && config_dayoff.length > 0) {
+ var config_dayoff_arr = config_dayoff.split(',');
+ for (var i = 0; i < config_dayoff_arr.length; i++) {
+ var day = daysObj.find(o => parseInt(o.value) === parseInt(config_dayoff_arr[i]));
+ selectDayOffChoices.setChoiceByValue(day.value);
+ }
+ }
+ }
+ }
+ } else {
+ gantt.alert({ type: "error", text: "Failed to get settings. Please check your internet connection." });
+ }
+ $('#modal_gantt_setting').modal('show');
+ });
+
+ $('#btn_save_setting').on('click', async function () {
+ var holidays = [];
+ var dayoff = $('#select_dayoff').val();
+ var costToComplete = $("#costToCompleteBox").val();
+ var committedCost = $("#committedCostBox").val();
+
+ dayoff = dayoff.map(item => parseInt(item));
+ var workdays = _.difference(days, dayoff);
+
+ // reset the dayoff first
+ for (var i = 0; i < days.length; i++) {
+ gantt.unsetWorkTime({ day: days[i], hours: false });
+ }
+
+ if (dayoff.length > 0) {
+ for (var i = 0; i < dayoff.length; i++) {
+ gantt.setWorkTime({ day: dayoff[i], hours: false });
+ }
+ }
+
+ let payload = {
+ "config_dayoff": dayoff.join(','),
+ "cost_to_complete": costToComplete ? costToComplete : 0,
+ "committed_cost": committedCost ? committedCost : 0
+ }
+
+ const result = await axiosInstance
+ .put(VERSION_GANTT_UPDATE_URL, payload, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+ if (result && result.status === 200) {
+ $('#modal_gantt_setting').modal('hide');
+ gantt.message("Settings updated");
+ refresData();
+ }
+ else {
+ gantt.alert({ type: "error", text: "Failed to update setting" });
+ }
+
+ gantt.render();
+
+ });
+ $("#gantt_toggle_task_btn").on('click', function (event) {
+ toggleCollapseTasks();
+ });
+
+ $("#dashboard-project").on('click', function (event) {
+ window.location.href = `https://si.ospro.id/#/dashboard-project/${projectId}/${ganttId}?dashboardGantt=${true}`;
+ // window.location.href = `http://localhost:3000/#/dashboard-project/${projectId}/${ganttId}?dashboardGantt=${true}`;
+ });
+
+ $("#gantt-baseline").on('click', function (event) {
+ setBaseline();
+ });
+
+ $("#save-activity").on('click', function (event) {
+ batchUpdate();
+ });
+
+ $("#gantt-synchronize").on('click', function (event) {
+ setSynchronize();
+ });
+
+ $("#compare-data").on('click', function (event) {
+ compareData(ganttTask);
+ });
+
+ $("#update-schedule").on('click', function (event) {
+ updateSchedule();
+ });
+
+ initHolidays();
+ initGanttSettings();
+});
+
+async function initHolidays() {
+ let payload = {
+ "columns": [
+ { "name": "version_gantt_id", "logic_operator": "=", "value": ganttId },
+ { "name": "proyek_id", "logic_operator": "=", "value": proyekId }
+ ],
+ "joins": [],
+ "orders": { "columns": ["date"], "ascending": true },
+ "paging": { "start": 0, "length": -1 }
+ }
+
+ $.ajax({
+ data: JSON.stringify(payload),
+ url: `${base_url}holiday/search`,
+ type: "POST",
+ success: function (result) {
+ let dataHolidays = result.data || []
+ dataHolidays.map((val, index) => {
+ var a = moment(val.date);
+ 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'));
+ gantt.setWorkTime({
+ date: holiday,
+ hours: false
+ });
+ }
+ });
+ gantt.render();
+ },
+ });
+}
+
+async function initGanttSettings() {
+ $("#scale1").attr('checked', true);
+
+ // init to gantt chart view (holidays)
+ const result = await axiosInstance
+ .get(VERSION_GANTT_EDIT_URL, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.status == 200) {
+ var config_dayoff = result.data.data.config_dayoff;
+ 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);
+ var dayoff = [];
+ if (config_dayoff && config_dayoff.length > 0) {
+ dayoff = config_dayoff.split(',');
+ }
+
+ // reset the dayoff first
+ for (var i = 0; i < days.length; i++) {
+ gantt.unsetWorkTime({ day: days[i], hours: false });
+ }
+
+ if (dayoff.length > 0) {
+ for (var i = 0; i < dayoff.length; i++) {
+ gantt.setWorkTime({ day: dayoff[i], hours: false });
+ }
+ }
+ }
+}
+
+function expandTask() {
+ gantt.eachTask(function (task) {
+ task.$open = true;
+ });
+ // updateProperty({task_open:true})
+ 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');
+ gantt.render();
+}
+
+function toggleCollapseTasks() {
+ // collapse task / activity
+ gantt.eachTask(function (task) {
+ task.$open = toggleTasks == "Expand";
+ });
+ if (toggleTasks == "Expand") {
+ updateProperty({ task_open: true })
+ 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 {
+ updateProperty({ task_open: false })
+ toggleTasks = "Expand";
+ $("#gantt_toggle_task_btn").prop('title', 'Expand Activities');
+ $("#gantt_toggle_task_btn").children().removeClass('fa-compress-alt');
+ $("#gantt_toggle_task_btn").children().addClass('fa-expand-alt'); // change icon to expand
+ }
+ gantt.render();
+ setGanttOpen();
+}
+
+
+// Function Show / Hide Columns
+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');
+ var checkedColumns = {};
+ selectedColumns.forEach(function (node) {
+ checkedColumns[node.name] = true;
+ });
+ unselectedColumn.forEach(function (node) {
+ checkedColumns[node.name] = false;
+ });
+ return checkedColumns;
+}
+
+function populateColumnsDropdown(node) {
+ var visibleColumns = {};
+ // var preventHide = ['action'];
+ gantt.config.columns.forEach(function (col) {
+ visibleColumns[col.name] = true;
+ });
+
+ var lines = [];
+ allColumns.forEach(function (col) {
+ var checked = visibleColumns[col.name] ? "checked" : "";
+ // skip action to be pushed
+ lines.push(``);
+ });
+ node.innerHTML = 'Show / Hide Columns
' + lines.join("
");
+}
+
+function getDropdownNode() {
+ return document.querySelector("#gantt_dropdown");
+}
+
+gantt.$showDropdown = function (node) {
+ var position = node.getBoundingClientRect();
+ var dropDown = getDropdownNode();
+ dropDown.style.top = position.bottom + "px";
+ dropDown.style.left = position.left - 150 + "px";
+ dropDown.style.display = "block";
+ populateColumnsDropdown(dropDown);
+
+ dropDown.onchange = function () {
+ var selection = getColumnsSelection(dropDown);
+ if (readOnly && parseInt(readOnly) == 0) {
+ updateShowHideColumn(selection)
+ }
+ gantt.config.columns = createColumnsConfig(selection);
+ gantt.render();
+ }
+
+ dropDown.keep = true;
+ setTimeout(function () {
+ dropDown.keep = false;
+ })
+}
+
+gantt.$hideDropdown = function () {
+ var dropDown = getDropdownNode();
+ dropDown.style.display = "none";
+}
+
+window.addEventListener("click", function (event) {
+ if (!event.target.closest("#gantt_dropdown") && !getDropdownNode().keep) {
+ gantt.$hideDropdown();
+ }
+});
+
+// End Function Show / Hide Columns
+
+
+// Set Baseline
+function setBaseline() {
+ var box = gantt.confirm({
+ text: "Set Baseline for this gantt chart?",
+ ok: "Yes",
+ cancel: "No",
+ callback: async function (result) {
+ if (result) {
+ // gantt.message("Yes!");
+ // send to API
+ await setBaselineAPI();
+ } else {
+ // gantt.message("No...");
+ }
+ }
+ });
+}
+
+// Set Baseline Activity
+function setBaselineActivity(activity_id, name) {
+ var box = gantt.confirm({
+ text: `Set Baseline for this activity ${name}?`,
+ ok: "Yes",
+ cancel: "No",
+ callback: async function (result) {
+ if (result) {
+ await setBaselineActivityAPI(activity_id);
+ }
+ }
+ });
+}
+
+async function importUpdate() {
+ expandTask();
+ var allTasks = [];
+ var taskCount = gantt.getTaskCount();
+
+ for (var i = 0; i < taskCount; i++) {
+ var task = gantt.getTaskByIndex(i);
+ allTasks.push(task);
+ }
+
+ $("body").addClass("loading");
+ const response = await gantt.ajax.post({
+ headers: {
+ "Content-Type": "application/json",
+ "Authorization": `Bearer ${token}`
+ },
+ url: `${base_url}activity/import-update`,
+ dataType: "json",
+ data: JSON.stringify(allTasks)
+ }).then(function (response) {
+ $("body").removeClass("loading");
+ let res = response.responseText
+ res = JSON.parse(res)
+ }).catch(function (error) {
+ $("body").removeClass("loading");
+ gantt.alert({
+ title: "Peringatan",
+ type: "alert-error",
+ text: "Update import gagal"
+ });
+ });
+}
+
+async function setBaselineActivityAPI(activity_id) {
+ await importUpdate();
+ const res = await axiosInstance
+ .get(ACTIVITY_SET_BASELINE_ACTIVITY_URL(activity_id), HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+ if (res && res.status === 200) {
+ gantt.message("Set baseline activity success!");
+ window.location.reload();
+ } else {
+ $("body").removeClass("loading");
+ gantt.alert({ type: "error", text: "Failed to set baseline activity" });
+ }
+ gantt.render();
+}
+
+async function setBaselineAPI() {
+ await importUpdate();
+ const res = await axiosInstance
+ .get(ACTIVITY_SET_BASELINE_URL, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+ if (res && res.status === 200) {
+ // $('#modal_gantt_setting').modal('hide');
+ // gantt.alert("Settings updated");
+ // gantt.message(result.data.message);
+ gantt.message("Set baseline success!");
+ window.location.reload();
+ }
+ else {
+ $("body").removeClass("loading");
+ gantt.alert({ type: "error", text: "Failed to set baseline" });
+ }
+ gantt.render();
+}
+
+function setSynchronize() {
+ if (!isBaselineSet) {
+ // gantt.alert({
+ // title:"Synchronize to Report",
+ // type:"alert-error",
+ // text:"Please set baseline before continue."
+ // });
+ gantt.confirm({
+ text: "Plase set baseline before continue.",
+ ok: "Set Baseline",
+ cancel: "Cancel",
+ callback: async function (result) {
+ if (result) {
+ await setBaselineAPI();
+ }
+ }
+ });
+ return false;
+ }
+
+ var box = gantt.confirm({
+ text: "Synchronize to Report Activity?",
+ ok: "Yes",
+ cancel: "No",
+ callback: async function (result) {
+ if (result) {
+ // gantt.message("Yes!");
+ // send to API
+ await setSynchronizeAPI()
+ } else {
+ // gantt.message("No...");
+ }
+ }
+ });
+}
+
+function updateSchedule() {
+ $("body").addClass("loading");
+ return gantt.ajax.get({
+ headers: {
+ "Content-Type": "application/json",
+ "Authorization": `Bearer ${token}`
+ },
+ url: base_url + "activity/update-schedule/" + ganttId
+ }).then(function (response) {
+ $("body").removeClass("loading");
+ window.location.reload();
+ }).catch(function (error) {
+ $("body").removeClass("loading")
+ gantt.alert({
+ title: "Peringatan",
+ type: "alert-error",
+ text: "Update activity gagal"
+ });
+ });
+}
+
+async function setSynchronizeAPI() {
+ const res = await axiosInstance
+ .get(ACTIVITY_SYNCHRONIZE_REPORT_URL, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (res && res.status === 200) {
+ // $('#modal_gantt_setting').modal('hide');
+ // gantt.alert("Settings updated");
+ // gantt.message(result.data.message);
+ gantt.message("Synchronize to Report success!");
+ window.location.reload();
+ }
+ else {
+ gantt.alert({ type: "error", text: "Failed to Synchronize to Report" });
+ }
+ gantt.render();
+}
diff --git a/edit-mode/function/holiday.js b/edit-mode/function/holiday.js
index 25a266d..6275243 100644
--- a/edit-mode/function/holiday.js
+++ b/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){
diff --git a/edit-mode/function/humanResource.js b/edit-mode/function/humanResource.js
index e145c04..b8804fb 100644
--- a/edit-mode/function/humanResource.js
+++ b/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,
diff --git a/edit-mode/function/materialResource.js b/edit-mode/function/materialResource.js
index 4671f3e..5ecd7dc 100644
--- a/edit-mode/function/materialResource.js
+++ b/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`);
diff --git a/edit-mode/function/milestone.js b/edit-mode/function/milestone.js
index bfd7158..d0934fa 100644
--- a/edit-mode/function/milestone.js
+++ b/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,
diff --git a/edit-mode/function/modalHumanResourceFunction.js b/edit-mode/function/modalHumanResourceFunction.js
index 1d91fbf..22ba6d2 100644
--- a/edit-mode/function/modalHumanResourceFunction.js
+++ b/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(``)
@@ -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(`
@@ -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(`
//
@@ -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(`
//
@@ -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');
});
diff --git a/edit-mode/function/reportActivity.js b/edit-mode/function/reportActivity.js
index 793e00a..9bb2862 100644
--- a/edit-mode/function/reportActivity.js
+++ b/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;
diff --git a/edit-mode/function/restActivityLink.js b/edit-mode/function/restActivityLink.js
index 66e68ed..0415daa 100644
--- a/edit-mode/function/restActivityLink.js
+++ b/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,
diff --git a/edit-mode/function/toolsResource.js b/edit-mode/function/toolsResource.js
index e0faa96..a9c5a80 100644
--- a/edit-mode/function/toolsResource.js
+++ b/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!");
diff --git a/edit-mode/index.html b/edit-mode/index.html
index 50d5732..a175110 100644
--- a/edit-mode/index.html
+++ b/edit-mode/index.html
@@ -67,7 +67,7 @@