Browse Source

Add formatting

pull/1/head
Wahyu Ramadhan 1 year ago
parent
commit
c65569b86c
  1. 36
      edit-mode/function/reportActivity.js

36
edit-mode/function/reportActivity.js

@ -23,9 +23,9 @@ function resetFormAddRaMaterial() {
} }
var qtyActual = document.getElementById('volume_pekerjaan_material'); var qtyActual = document.getElementById('volume_pekerjaan_material');
qtyActual.addEventListener('keyup', function (e) { qtyActual.addEventListener('keyup', function (e) {
qtyActual.value = formatRibuanInput(this.value); qtyActual.value = formatRibuanInput(this.value);
}); });
$(document).ready(function () { $(document).ready(function () {
@ -73,9 +73,9 @@ $(document).ready(function () {
} }
}); });
var tableRa = $("#table_report").on('xhr.dt', function(e, settings, json, xhr){ var tableRa = $("#table_report").on('xhr.dt', function (e, settings, json, xhr) {
$('#report-activity-information-status').attr("class", ""); $('#report-activity-information-status').attr("class", "");
if(json?.data?.length > 0) { if (json?.data?.length > 0) {
let firstData = json.data[0]; let firstData = json.data[0];
const statusReport = firstData.status_activity; const statusReport = firstData.status_activity;
let reportStartDate = firstData.start_activity ?? "-"; let reportStartDate = firstData.start_activity ?? "-";
@ -84,19 +84,19 @@ $(document).ready(function () {
reportFinishDate = reportFinishDate.split(" ")[0]; reportFinishDate = reportFinishDate.split(" ")[0];
if(statusReport == 'on-progress') { if (statusReport == 'on-progress') {
$('#report-activity-information-status').attr("class", "badge badge-warning"); $('#report-activity-information-status').attr("class", "badge badge-warning");
} else if(statusReport == 'done') { } else if (statusReport == 'done') {
$('#report-activity-information-status').attr("class", "badge badge-success"); $('#report-activity-information-status').attr("class", "badge badge-success");
} else if(statusReport == 'open') { } else if (statusReport == 'open') {
$('#report-activity-information-status').attr("class", "badge badge-primary"); $('#report-activity-information-status').attr("class", "badge badge-primary");
} }
if(moment(reportStartDate, "YYYY-MM-DD",true).isValid()){ if (moment(reportStartDate, "YYYY-MM-DD", true).isValid()) {
reportStartDate = moment(reportStartDate, "YYYY-MM-DD").format("DD-MM-YYYY"); reportStartDate = moment(reportStartDate, "YYYY-MM-DD").format("DD-MM-YYYY");
} }
if(moment(reportFinishDate, "YYYY-MM-DD",true).isValid()){ if (moment(reportFinishDate, "YYYY-MM-DD", true).isValid()) {
reportFinishDate = moment(reportFinishDate, "YYYY-MM-DD").format("DD-MM-YYYY"); reportFinishDate = moment(reportFinishDate, "YYYY-MM-DD").format("DD-MM-YYYY");
} }
@ -125,11 +125,13 @@ $(document).ready(function () {
}, },
"columns": [ "columns": [
{ data: 'material_name', name: 'material_name' }, { data: 'material_name', name: 'material_name' },
{ data: 'type', name: 'type', render: function(data, type){ {
if(data == 'expense') data: 'type', name: 'type', render: function (data, type) {
if (data == 'expense')
return "Overhead" return "Overhead"
return "Material" return "Material"
}}, }
},
{ {
data: 'qty_planning', render: function (data, type) { data: 'qty_planning', render: function (data, type) {
return data ? formatRupiah(data) : '-' return data ? formatRupiah(data) : '-'
@ -137,7 +139,7 @@ $(document).ready(function () {
}, },
{ {
data: 'qty_sum', render: function (data, type) { data: 'qty_sum', render: function (data, type) {
if(data == "-"){ if (data == "-") {
return data return data
} }
return data ? formatRupiah(data) : '-' return data ? formatRupiah(data) : '-'
@ -201,7 +203,7 @@ $(document).ready(function () {
} }
}, },
"columns": [ "columns": [
{ data: 'material_name', name: 'material_name'}, { data: 'material_name', name: 'material_name' },
{ {
data: 'qty_planning', render: function (data, type) { data: 'qty_planning', render: function (data, type) {
return data ? formatRupiah(parseInt(data)) : '-' return data ? formatRupiah(parseInt(data)) : '-'
@ -486,11 +488,11 @@ $(document).ready(function () {
let id = $(this).data('id'); let id = $(this).data('id');
$.ajax({ $.ajax({
url: `${base_url}image/${id}/report_activity`, url: `${base_url}image/${id}/report_activity`,
type:"GET", type: "GET",
success: function (result) { success: function (result) {
let data = result.data; let data = result.data;
if (!data) { if (!data) {
gantt.alert({type: "error", text: "Failed to get report image"}); gantt.alert({ type: "error", text: "Failed to get report image" });
return false; return false;
} }
@ -501,7 +503,7 @@ $(document).ready(function () {
// kalo gambarnya banyak belum di handle... // kalo gambarnya banyak belum di handle...
}, },
error: function (data) { error: function (data) {
gantt.alert({type: "error", text: "Failed to get report image"}); gantt.alert({ type: "error", text: "Failed to get report image" });
} }
}); });
}); });

Loading…
Cancel
Save