Handle erors on marhun service, and pembiayaan service

This commit is contained in:
Afiq Hamzah
2024-07-16 16:01:53 +08:00
parent 9c8908f9ea
commit f57f2da1c4
3 changed files with 24 additions and 13 deletions
+2 -1
View File
@@ -23,7 +23,8 @@ class MarhunService
});
};
$marhunDetailsResponse = array_map(fn($x) => array_merge([], ...$x->json()), $getMarhunDetails());
$marhunDetailsResponse = array_map(fn($x) => $x->json() == null ? [] : $x->Json(), $getMarhunDetails());
$marhunDetailsResponse = array_map(fn($x) => array_merge([], ...$x), $marhunDetailsResponse);
$formatMarhunDetailData = function ($x) {
$getMarhunTypeFullName = function ($code) {
+10 -1
View File
@@ -165,9 +165,18 @@ class PembiayaanService
};
$pembiayaanAkanDilelong = array_filter($getPembiayaanAkanDilelong(), $isCurrentDateGreaterThanEqual3DaysBeforeLelong);
$norujukanAkanDilelong = array_map(fn($x) => $x->norujukan, $pembiayaanAkanDilelong);
$pembiayaanInFasa2 = array_filter($getPembiayaanAkanDilelong(), fn($x) => $x->fasa == 2);
$setDefaultFasaIfNotAvailable = function($x){
if(! isset($x->fasa)){
$x->fasa = 1;
}
return $x;
};
$pembiayaanWithFasa = array_map($setDefaultFasaIfNotAvailable, $getPembiayaanAkanDilelong());
$pembiayaanInFasa2 = array_filter($pembiayaanWithFasa, fn($x) => $x->fasa == 2);
$norujukanInFasa2 = array_map(fn($x) => $x->norujukan, $pembiayaanInFasa2);
$getPayableUjrahBranches = fn() => Http::arrahn()->get('/api/payable-ujrah-branches')->json();
+12 -11
View File
@@ -193,10 +193,10 @@
$('#norujukan_modal').val(data.norujukan);
$('#pinjaman_modal').val(data.pinjaman);
$('#marhunModal').modal('show');
$('#tablehistorybayaran').DataTable().clear().destroy();
let table_bayaran_history = $('#tablehistorybayaran').DataTable();
$('#biasa').DataTable().clear().destroy();
let table_marhun = $('#biasa').DataTable();
@@ -207,7 +207,7 @@
`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)
});
data.marhun_details.forEach((x, index) => {
table_marhun.row.add([
index + 1,
@@ -222,20 +222,21 @@
};
document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('a.marhun-detail-link').forEach(x => x.addEventListener('click', showMarhunDetailModal))
$('#main-table').on('click', 'a.marhun-detail-link', function(e) {
showMarhunDetailModal(e)
});
});
document.querySelector('#marhunModal .modal-footer button').addEventListener('click', function(e) {
e.preventDefault();
$('#marhunModal').modal('hide');
});
});
document.querySelector('#marhunModal').addEventListener('hidden.bs.modal', function(e) {
document.querySelector('#marhunModal .modal-header a[aria-controls="pills-marhun"]').click();
});
</script>')
@endpush