Browse Source

implement decimal

pull/1/head
Yusuf 2 years ago
parent
commit
2d3809bc94
  1. 53
      src/function/function.js
  2. 4
      src/function/ganttConfig.js
  3. 2
      src/function/materialResource.js
  4. 6
      src/function/reportActivity.js

53
src/function/function.js

@ -46,11 +46,8 @@ gantt.config.editor_types.costPlanningEditor = {
placeholder.innerHTML = html; placeholder.innerHTML = html;
}, },
hide: function () { hide: function () {
// can be empty since we don't have anything to clean up after the editor
// is detached
}, },
set_value: function (value, id, column, node) { set_value: function (value, id, column, node) {
// console.log("cek value", value)
getInput(node).value = value; getInput(node).value = value;
}, },
get_value: function (id, column, node) { get_value: function (id, column, node) {
@ -58,7 +55,6 @@ gantt.config.editor_types.costPlanningEditor = {
}, },
is_changed: function (value, id, column, node) { is_changed: function (value, id, column, node) {
var currentValue = this.get_value(id, column, node); var currentValue = this.get_value(id, column, node);
// console.log("check is changed", currentValue)
return value !== currentValue; return value !== currentValue;
}, },
is_valid: function (value, id, column, node) { is_valid: function (value, id, column, node) {
@ -89,11 +85,8 @@ gantt.config.editor_types.progressCustom = {
placeholder.innerHTML = html; placeholder.innerHTML = html;
}, },
hide: function () { hide: function () {
// can be empty since we don't have anything to clean up after the editor
// is detached
}, },
set_value: function (value, id, column, node) { set_value: function (value, id, column, node) {
// console.log("cek get value", value)
value = value*100 value = value*100
getInput(node).value = value; getInput(node).value = value;
}, },
@ -129,19 +122,11 @@ function initializationProject(){
url: `${base_url}project/edit/${projectId}`, url: `${base_url}project/edit/${projectId}`,
type:"GET", type:"GET",
success: function (result) { success: function (result) {
// console.log("check replaceAll", replaceAll('1.000.000', ".", ""))
// console.log("cek data update", result);
let data = result.data; let data = result.data;
// let startProyek = moment(data.mulai_proyek).format("YYYY-MM-DD")
// let endProyek = moment(data.akhir_proyek).format("YYYY-MM-DD")
// gantt.config.start_date = new Date(startProyek);
// gantt.config.end_date = new Date(endProyek);
// gantt.render();
let projectName = data.nama; let projectName = data.nama;
$("#project-name-header").html(projectName); $("#project-name-header").html(projectName);
}, },
error: function (data) { error: function (data) {
// console.log("cek data update", data);
actionHappen = false; actionHappen = false;
} }
}); });
@ -164,17 +149,9 @@ function getSatuan(){
satuanList.push(satuan) satuanList.push(satuan)
}); });
if(satuanList.length > 0){ if(satuanList.length > 0){
// console.log("cek satuan list", satuanList)
gantt.updateCollection("satuan", satuanList); gantt.updateCollection("satuan", satuanList);
gantt.refreshData(); gantt.refreshData();
gantt.render(); gantt.render();
// let setServer = gantt.serverList("satuan", satuanList);
// if(setServer){
// console.log("cek setServer satuan list", setServer);
// gantt.refreshData();
// gantt.render();
// }
} }
}, },
error: function (data) { error: function (data) {
@ -189,7 +166,6 @@ function updateActivity(id)
url: `${base_url}task/get-update/${id}`, url: `${base_url}task/get-update/${id}`,
type:"GET", type:"GET",
success: function (result) { success: function (result) {
// console.log("cek data update", result);
let data = result.data; let data = result.data;
gantt.getTask(id).assign_hr = data.assign_hr; gantt.getTask(id).assign_hr = data.assign_hr;
gantt.getTask(id).assign_material = data.assign_material; gantt.getTask(id).assign_material = data.assign_material;
@ -252,15 +228,6 @@ function formatDate(params){
return today; return today;
} }
// function loopEachTask(conditi){
// console.log("cek loopEachTask", conditi)
// gantt.eachTask(function(task){
// task.$open = conditi;
// console.log("cek eachTask")
// });
// gantt.render();
// }
function roundToTwo(num) { function roundToTwo(num) {
return +(Math.round(num + "e+2") + "e-2"); return +(Math.round(num + "e+2") + "e-2");
} }
@ -272,7 +239,6 @@ function initialProperty()
type:"GET", type:"GET",
success: function (result) { success: function (result) {
let data = result.data; let data = result.data;
// console.log("cek data", data);
if(data.status && data.status=="not have"){ if(data.status && data.status=="not have"){
toggleCollapseTasks(); toggleCollapseTasks();
}else{ }else{
@ -296,21 +262,7 @@ function initialProperty()
} }
if(data.task_open){ if(data.task_open){
// console.log("cek collapse")
// toggleCollapseTasks();
// toggleCollapseTasks();
// loopEachTask(true)
// gantt.batchUpdate(function () {
// var tasks = gantt.getTaskByTime();
// console.log("cek eachTask", tasks);
// for(var i = 0; i < tasks.length; i++){
// var task = tasks[i];
// task.$open = true;
// }
// });
// console.log("cek eachTask");
gantt.eachTask(function(task){ gantt.eachTask(function(task){
// console.log("cek eachTask 2")
task.$open = true; task.$open = true;
}); });
toggleTasks = "Collapse"; toggleTasks = "Collapse";
@ -342,7 +294,6 @@ function initializationColumn()
}else if(data.status=="not have access"){ }else if(data.status=="not have access"){
}else{ }else{
// console.log("data show hide", data);
setUpForShowHideColumn(data); setUpForShowHideColumn(data);
} }
}, },
@ -511,7 +462,6 @@ function setUpForShowHideColumn(data)
configColumn[val.column_name] = val.show configColumn[val.column_name] = val.show
}); });
// console.log("check set up", configColumn);
gantt.config.columns = createColumnsConfig(configColumn); gantt.config.columns = createColumnsConfig(configColumn);
gantt.render(); gantt.render();
@ -547,10 +497,8 @@ function updateProperty(payload){
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);
} }
}); });
} }
@ -561,7 +509,6 @@ function costPlanningChange(e){
value = replaceAll(value, ".", "") value = replaceAll(value, ".", "")
value = replaceAll(value, ",", ".") value = replaceAll(value, ",", ".")
let newValue = formatRupiah(value); let newValue = formatRupiah(value);
// console.log("cek newValue", newValue);
$(e).val(newValue) $(e).val(newValue)
} }

4
src/function/ganttConfig.js

@ -261,14 +261,14 @@ var allColumns = [
return return
} }
let rencana_biaya = text.rencana_biaya let rencana_biaya = text.rencana_biaya
return "Rp. "+ formatRupiah(parseInt(rencana_biaya)) return "Rp. "+ formatRupiah(rencana_biaya)
} }, } },
{ name: "cost_actual", label: "Cost Actual", align: "center", min_width: 100, editor: editor.costActual, resize: true, template: function (text) { { name: "cost_actual", label: "Cost Actual", align: "center", min_width: 100, editor: editor.costActual, resize: true, template: function (text) {
if(!text.biaya_actual){ if(!text.biaya_actual){
return return
} }
let biaya_actual = text.biaya_actual let biaya_actual = text.biaya_actual
return "Rp. "+ formatRupiah(parseInt(biaya_actual)) return "Rp. "+ formatRupiah(biaya_actual)
} }, } },
{ name: "assign_hr", label: "Assign To", align: "center", min_width: 150, resize: true, template: function (text) { { name: "assign_hr", label: "Assign To", align: "center", min_width: 150, resize: true, template: function (text) {
if(text.type=="project" || text.type=="milestone"){ if(text.type=="project" || text.type=="milestone"){

2
src/function/materialResource.js

@ -32,7 +32,7 @@ $(document).ready(function () {
{ data: 'uom', name: 'uom' }, { data: 'uom', name: 'uom' },
{ {
data: 'budget', render: function (data, type) { data: 'budget', render: function (data, type) {
return data ? "Rp. " + formatRupiah(parseInt(data)) : '-' return data ? "Rp. " + formatRupiah(data) : '-'
} }
}, },
{ {

6
src/function/reportActivity.js

@ -89,7 +89,10 @@ $(document).ready(function () {
}, },
{ {
data: 'qty_sum', render: function (data, type) { data: 'qty_sum', render: function (data, type) {
return data ? formatRupiah(parseInt(data)) : '-' if(data == "-"){
return data
}
return data ? formatRupiah(data) : '-'
} }
}, },
{ data: 'uom', name: 'uom' }, { data: 'uom', name: 'uom' },
@ -264,7 +267,6 @@ $(document).ready(function () {
$(this).hide(); $(this).hide();
$("#hide_form_ra").show(); $("#hide_form_ra").show();
$("#form_report_activity").show(); $("#form_report_activity").show();
console.log("oke form_report_activity");
}); });
$("#modal_report_activity").on("click", "#hide_form_ra", function () { $("#modal_report_activity").on("click", "#hide_form_ra", function () {

Loading…
Cancel
Save