added resit for v3 and make it not allowed if it open other norujukan from other nokp
This commit is contained in:
@@ -208,28 +208,18 @@
|
||||
|
||||
@push('additional_js_scripts')
|
||||
<script>
|
||||
const showMarhunDetailModal = async function(event,tagsyarikat) {
|
||||
|
||||
const showMarhunDetailModal = async function (event, tagsyarikat) {
|
||||
event.preventDefault();
|
||||
|
||||
// document.getElementById('marhunLoader').style.display = 'flex';
|
||||
const norujukan = event.target.innerHTML;
|
||||
try {
|
||||
const data = await fetch('/api/pembiayaan-modal-data/' + norujukan + "/" + tagsyarikat)
|
||||
.then(x => x.json())
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
const loader = document.getElementById('load-arrahn');
|
||||
loader.classList.add('d-none');
|
||||
throw error;
|
||||
});
|
||||
|
||||
const loader = document.getElementById('load-arrahn');
|
||||
loader.classList.add('d-none');
|
||||
|
||||
const formatter = new Intl.NumberFormat('en-US', {
|
||||
minimumFractionDigits: 2
|
||||
});
|
||||
loader.classList.remove('d-none');
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/pembiayaan-modal-data/${norujukan}/${tagsyarikat}`);
|
||||
const data = await response.json();
|
||||
|
||||
const formatter = new Intl.NumberFormat('en-US', { minimumFractionDigits: 2 });
|
||||
|
||||
$('#pembiayaan').text('RM' + formatter.format(data.gadaianDetails.pinjaman));
|
||||
$('#bpembiayaan').text('RM' + formatter.format(data.gadaianDetails.bakipjm));
|
||||
@@ -246,21 +236,20 @@
|
||||
$('#pinjaman_modal').val(data.gadaianDetails.pinjaman);
|
||||
$('#marhunModal').modal('show');
|
||||
|
||||
const table_bayaran_history = $('#tablehistorybayaran').DataTable();
|
||||
const table_marhun = $('#biasa').DataTable();
|
||||
|
||||
$('#tablehistorybayaran').DataTable().clear().destroy();
|
||||
let table_bayaran_history = $('#tablehistorybayaran').DataTable();
|
||||
|
||||
$('#biasa').DataTable().clear().destroy();
|
||||
let table_marhun = $('#biasa').DataTable();
|
||||
|
||||
table_bayaran_history.clear();
|
||||
data.bayaranHistoryDetails.forEach((x, index) => {
|
||||
table_bayaran_history.row.add([
|
||||
index + 1,
|
||||
x.created_at,
|
||||
`RM ${x.duit_masuk} <a target='_blank' href="${x.resit_ansuran_link}" class='btn btn-info btn-sm'><span class='fas fa-print'></span></a>`,
|
||||
]).draw(false)
|
||||
`RM ${x.duit_masuk} <a target='_blank' href="${x.resit_ansuran_link}" class='btn btn-info btn-sm'><span class='fas fa-print'></span></a>`,
|
||||
]);
|
||||
});
|
||||
table_bayaran_history.draw();
|
||||
|
||||
table_marhun.clear();
|
||||
data.marhunDetails.forEach((x, index) => {
|
||||
table_marhun.row.add([
|
||||
index + 1,
|
||||
@@ -268,22 +257,14 @@
|
||||
x.berat,
|
||||
x.karat,
|
||||
`RM ${formatter.format(x.n_marhun)}`,
|
||||
x.nota
|
||||
]).draw(false)
|
||||
x.nota,
|
||||
]);
|
||||
});
|
||||
|
||||
// document.getElementById('marhunLoader').style.display = 'none';
|
||||
// const loader = document.getElementById('load-arrahn');
|
||||
loader.classList.add('d-none');
|
||||
|
||||
|
||||
table_marhun.draw();
|
||||
} catch (error) {
|
||||
const loader = document.getElementById('load-arrahn');
|
||||
console.error('Error fetching data:', error);
|
||||
// Hide loader in case of error
|
||||
// document.getElementById('marhunLoader').style.display = 'none';
|
||||
loader.classList.add('d-none');
|
||||
|
||||
} finally {
|
||||
loader.classList.add('d-none');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user