|
|
|
@ -74,7 +74,38 @@ $(document).ready(function () {
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
var tableRa = $("#table_report").DataTable({ |
|
|
|
|
var tableRa = $("#table_report").on('xhr.dt', function(e, settings, json, xhr){ |
|
|
|
|
$('#report-activity-information-status').attr("class", ""); |
|
|
|
|
if(json?.data?.length > 0) { |
|
|
|
|
let firstData = json.data[0]; |
|
|
|
|
const statusReport = firstData.status_activity; |
|
|
|
|
let reportStartDate = firstData.start_activity ?? "-"; |
|
|
|
|
reportStartDate = reportStartDate.split(" ")[0]; |
|
|
|
|
let reportFinishDate = firstData.finish_activity ?? "-"; |
|
|
|
|
reportFinishDate = reportFinishDate.split(" ")[0]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(statusReport == 'on-progress') { |
|
|
|
|
$('#report-activity-information-status').attr("class", "badge badge-warning"); |
|
|
|
|
} else if(statusReport == 'done') { |
|
|
|
|
$('#report-activity-information-status').attr("class", "badge badge-success"); |
|
|
|
|
} else if(statusReport == 'open') { |
|
|
|
|
$('#report-activity-information-status').attr("class", "badge badge-primary"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(moment(reportStartDate, "YYYY-MM-DD",true).isValid()){ |
|
|
|
|
reportStartDate = moment(reportStartDate, "YYYY-MM-DD").format("DD-MM-YYYY"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(moment(reportFinishDate, "YYYY-MM-DD",true).isValid()){ |
|
|
|
|
reportFinishDate = moment(reportFinishDate, "YYYY-MM-DD").format("DD-MM-YYYY"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$("#report-activity-information-status").text(statusReport ?? "-"); |
|
|
|
|
$("#report-activity-information-start").text(reportStartDate); |
|
|
|
|
$("#report-activity-information-end").text(reportFinishDate); |
|
|
|
|
} |
|
|
|
|
}).DataTable({ |
|
|
|
|
"processing": true, |
|
|
|
|
"serverSide": true, |
|
|
|
|
"ajax": { |
|
|
|
@ -87,6 +118,7 @@ $(document).ready(function () {
|
|
|
|
|
{ data: 'material_name', name: 'material_name' }, |
|
|
|
|
{ |
|
|
|
|
data: 'qty_planning', render: function (data, type) { |
|
|
|
|
console.log("render", [data, type]); |
|
|
|
|
return data ? formatRupiah(data) : '-' |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -99,28 +131,22 @@ $(document).ready(function () {
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
{ data: 'uom', name: 'uom' }, |
|
|
|
|
{ |
|
|
|
|
data: 'start_activity', render: function (data, type) { |
|
|
|
|
console.log("start", data) |
|
|
|
|
return data ? formatDate(data) : '-' |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
data: 'finish_activity', render: function (data, type) { |
|
|
|
|
console.log("finish", data) |
|
|
|
|
return data ? formatDate(data) : '-' |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
data: 'status_activity', render: function (data, type) { |
|
|
|
|
console.log("status", data) |
|
|
|
|
const val = !data ? '-' : |
|
|
|
|
data == "done" ? `<span class="badge badge-success">${data}</span>` : |
|
|
|
|
data == "open" ? `<span class="badge badge-primary">${data}</span>` : |
|
|
|
|
`<span class="badge badge-warning">${data}</span>` |
|
|
|
|
return val |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// {
|
|
|
|
|
// data: 'start_activity', render: function (data, type) {
|
|
|
|
|
// return data ? formatDate(data) : '-'
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// data: 'finish_activity', render: function (data, type) {
|
|
|
|
|
// return data ? formatDate(data) : '-'
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// data: 'status_activity', render: function (data, type) {
|
|
|
|
|
// console.log("status", data)
|
|
|
|
|
// return val
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
{ |
|
|
|
|
data: 'action', |
|
|
|
|
name: 'action', |
|
|
|
@ -130,6 +156,7 @@ $(document).ready(function () {
|
|
|
|
|
] |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tableRaMaterialActual = $("#table_activity_material_actual").DataTable({ |
|
|
|
|
"processing": true, |
|
|
|
|
"serverSide": true, |
|
|
|
|