@@ -565,7 +565,7 @@
marhun_detail['harga'],
status_tag_permata,
marhun_detail['berat_batu_permata'],
- "
"
+ "
"
]).draw();
counter = counter + 1;
});
@@ -1433,22 +1433,24 @@
buttonsStyling: false
});
- swalWithBootstrapButtons.fire({
- title: 'Dapatkan Pengesahan Khazanah',
- text: "Tetapan margin melebihi " + pinjaman_teller + "% untuk Khazanah!",
- icon: 'info',
- showCancelButton: true,
- confirmButtonText: 'Hantar',
- cancelButtonText: 'Batal',
- reverseButtons: true
- }).then((result) => {
- if (result.isConfirmed) {
+ swalWithBootstrapButtons.fire({
+ title: 'Dapatkan Pengesahan Khazanah',
+ text: "Tetapan Margin Melebihi Limit Maksima Teller!",
+ icon: 'info',
+ showCancelButton: true,
+ confirmButtonText: 'Hantar',
+ cancelButtonText: 'Batal',
+ reverseButtons: true
+ }).then((result) => {
+ if (result.isConfirmed) {
- let norujukan = $('#norujukan').val();
- let nm = parseFloat($('#total_nilai_marhun').val().replace(/[^0-9.-]+/g,""));let ber = $('#total_berat').val();let marg = $('.span-pinjaman').text();
- let status = "Pembiayaan Melebihi Margin " + pinjaman_teller + "%";
- let jumpinjam = $('#pinjaman').val();
- let teller = "{{ Auth::user()->name }}";
+ let norujukan = $('#norujukan').val();
+ let nm = parseFloat($('#total_nilai_marhun').val().replace(/[^0-9.-]+/g, ""));
+ let ber = $('#total_berat').val();
+ let marg = $('.span-pinjaman').text();
+ let status = "Tetapan Margin Melebihi Limit Maksima Teller: " + pinjaman_teller + "%";
+ let jumpinjam = $('#pinjaman').val();
+ let teller = "{{ Auth::user()->name }}";
Swal.fire({
title: 'Tunggu Pengesahan Daripada Khazanah.',
@@ -1606,20 +1608,117 @@
let marhun = $(e).closest('tr').children('td:eq(1)').text();let selectedrow = $(e).closest('tr');let recnozz = tablemarhun.row(selectedrow).data();
let norujuk = $('#norujukan').val();
+ $.ajax({
+ method: 'put',
+ url: '{{ route("gadai.editmarhun") }}',
+ data: {
+ "_token": "{{ csrf_token() }}",
+ "norujukan": norujuk,
+ "recno": recnozz[1],
+ "teller": "{{ Auth::user()->name }}"
+ },
+ success: function(data) {
+ location.reload();
+ },
+ error: function(xhr, status, error) {
+ var err = eval("(" + xhr.responseText + ")");
+ alert(xhr.responseText);
+ }
+ });
+ }
+
+ function viewmarhun(e){
+ let selectedrow = $(e).closest('tr');
+ let recno = tablemarhun.row(selectedrow).data();
+ let nm = recno[3];
+ let karat = recno[4];
+ let berat = recno[5];
+ let harga = recno[8];
+ let nota = recno[7];
+ let kuantiti = recno[6];
+ let jenismarhun = recno[2];
+ let beratpermata = recno[10];
+
+
+
+ // Call API to get specific MaxMutuEmas data by karat
$.ajax({
- method: 'put',
- url: '{{ route("gadai.editmarhun") }}',
- data: {
- "_token": "{{ csrf_token() }}",
- "norujukan" : norujuk,
- "recno" : recnozz[1],
- "teller": "{{ Auth::user()->name }}"
+ url: '{{ config("api.url") }}/api/maxmutuemas/specific',
+ type: 'GET',
+ data: { karat: karat,nilaimarhun: nm },
+ success: function(response) {
+ let marginInfo = '';
+ let marginTable = '';
+ if (response && response.karat) {
+ marginTable = `
+
+
+ | Maklumat Margin |
+
+
+ | Margin Teller | ${response.teller}% |
+ | Margin PC | ${response.pc}% |
+ | Nilai Marhun Teller | ${parseFloat(response.maxteller).toLocaleString('en-MY', {minimumFractionDigits: 2, maximumFractionDigits: 2})} |
+ | Nilai Marhun PC | ${parseFloat(response.maxpc).toLocaleString('en-MY', {minimumFractionDigits: 2, maximumFractionDigits: 2})} |
+
+
+ `;
+ }
+
+ let details = `
+
+
+ | Maklumat Marhun |
+
+
+ | Jenis Marhun | ${jenismarhun} |
+ | Nilai Marhun Asal | ${nm} |
+ | Karat | ${karat} |
+ | Berat | ${berat}g |
+ | Harga | RM${harga} |
+
+
+ ${marginTable}
+ `;
+
+ Swal.fire({
+ title: 'Maklumat Marhun & Margin',
+ html: details,
+ icon: 'info',
+ confirmButtonText: 'OK',
+ width: '600px'
+ });
},
- success:function(data){
- location.reload();
- },error: function(xhr, status, error) {
- var err = eval("(" + xhr.responseText + ")");
- alert(xhr.responseText);
+ error: function(xhr) {
+ // If API call fails, show basic marhun info only
+ let details = `
+
+
+ | Maklumat Marhun |
+
+
+ | Jenis Marhun | ${jenismarhun} |
+ | Nama | ${nm} |
+ | Karat | ${karat} |
+ | Berat | ${berat}g |
+ | Kuantiti | ${kuantiti} |
+ | Harga | RM${harga} |
+ | Nota | ${nota} |
+ | Berat Batu Permata | ${beratpermata}g |
+
+
+
+ Maklumat margin tidak tersedia
+
+ `;
+
+ Swal.fire({
+ title: 'Maklumat Marhun',
+ html: details,
+ icon: 'info',
+ confirmButtonText: 'OK',
+ width: '600px'
+ });
}
});
}