90 lines
3.2 KiB
JavaScript
90 lines
3.2 KiB
JavaScript
|
|
datatablePending.bootstrapTable({
|
|
url: "/dashboard/datatable/pending",
|
|
showColumns: true,
|
|
showColumnsToggleAll: true,
|
|
showRefresh: true,
|
|
sortable: true,
|
|
search: true,
|
|
searchOnEnterKey: false,
|
|
searchHighlight: true,
|
|
pagination: true,
|
|
serverSide:true,
|
|
pageSize: 10,
|
|
pageList: [10, 20, 30, 40, 50, 100, 200],
|
|
cookie: true,
|
|
cookieIdTable: "table_rma_ssc_id",
|
|
icons: {
|
|
refresh: "fas fa-sync-alt", // atau ganti ke icon lain
|
|
columns: "fas fa-th-large"
|
|
},
|
|
|
|
columns: [
|
|
{
|
|
title: "Action",
|
|
field:'order_id',
|
|
formatter: function(value, row) {
|
|
const rowData = row; // jika butuh ID atau status dari baris
|
|
return `
|
|
<div class="d-flex flex-wrap gap-2 justify-content-center">
|
|
<button class="btn btn-sm btn-success" onclick="approveOrder('${rowData.id}')">
|
|
<i class="fa fa-check me-1"></i>
|
|
</button>
|
|
|
|
${row?.status_order === "Lunas" ? '' : `
|
|
<button class="btn btn-sm btn-danger" onclick="rejectOrder('${rowData.id}')">
|
|
<i class="fa fa-times me-1"></i>
|
|
</button>
|
|
<button class="btn btn-sm btn-warning text-dark" onclick="approveProgress('${rowData.id}')">
|
|
<i class="fa fa-utensils me-1"></i>
|
|
</button>
|
|
`}
|
|
|
|
</div>
|
|
`;
|
|
},
|
|
hozAlign: "center",
|
|
headerSort: false
|
|
},
|
|
|
|
{
|
|
title: "No.Order",
|
|
field:'no_order'
|
|
},
|
|
{
|
|
title: "Pemesan",
|
|
field:'nama_pemesan',
|
|
},
|
|
{
|
|
title: "Kategori Customer",
|
|
field: 'jenis_customer'
|
|
},
|
|
{
|
|
title: "Total Harga Pesanan",
|
|
field:'total_harga',
|
|
formatter: function(value, row){
|
|
return 'Rp ' + parseInt(row.total_harga).toLocaleString('id-ID')
|
|
}
|
|
},
|
|
{
|
|
title: "Status Pembayaran",
|
|
field: 'status_order',
|
|
formatter: function(value, row) {
|
|
const status = value;
|
|
let badgeClass = 'bg-secondary';
|
|
if (status === "Belum Bayar") {
|
|
badgeClass = 'bg-warning text-dark';
|
|
} else if (status === "Menunggu Konfirmasi Pembayaran") {
|
|
badgeClass = 'bg-primary';
|
|
} else if (status === "Lunas" || status === "Sudah Bayar") {
|
|
badgeClass = 'bg-success';
|
|
}
|
|
|
|
return `<span class="badge ${badgeClass} px-3 py-1">${status}</span>`;
|
|
}
|
|
}
|
|
|
|
|
|
],
|
|
});
|