diff --git a/resources/views/customers/v2/info.blade.php b/resources/views/customers/v2/info.blade.php index 752d3e4..1789026 100644 --- a/resources/views/customers/v2/info.blade.php +++ b/resources/views/customers/v2/info.blade.php @@ -860,11 +860,9 @@ } let table_norujukan = gadai_detail["norujukan"]; - let radio_action = "onclick=checkCanChangeGadaianDetail(" + "'" + table_norujukan + "'" + ")"; - if(gadai_detail["percentpinj"] != 0) xtawarruq.row.add([ - '', + '', '' + gadai_detail['norujukan'] + '', gadai_detail['t_gadai'], tarikh_matang, @@ -905,9 +903,8 @@ } let table_norujukan = gadai_detail["norujukan"]; - let radio_action = "onclick=checkCanChangeGadaianDetail(" + "'" + table_norujukan + "'" + ")"; tablegadai.row.add([ - '', + '', '' + gadai_detail['norujukan'] + '', gadai_detail['t_gadai'], tarikh_matang, @@ -1606,9 +1603,49 @@ }); } + function ubahPembiayaanSemulaErrorHandling() + { + let selected = document.querySelector('#navtawarruqdannottawarruq input[type="radio"][name="belum"]:checked') + + let navTawarruq = document.querySelector('#nav-tawarruq'); + + // check if selected radio button in SAG Baru tab. If not SAG Baru tab. Execution will bypass the validation here and continue to next validation flow + if( ! navTawarruq.contains(selected)){ + return false; + } + + if(selected === null){ + Swal.fire({ + icon: 'error', + title: 'Amaran', + text: 'Sila pilih salah satu SAG!' + }); + + return true; + } + + let isPS = checkPS(selected.value) + + if(isPS){ + Swal.fire({ + icon: 'error', + title: 'Amaran', + text: 'Ubah Gadai Tidak Dibenarkan Untuk Gadaian Pembiayaan Semula' + }); + + return true; + } + + return false; + } function ubahfunc(e){ + let isError = ubahPembiayaanSemulaErrorHandling() + if(isError){ + return; + } + let ubahid = $('input[name="belum"]:checked').val(); let harini = new Date();harini.setHours(0, 0, 0, 0); @@ -2606,5 +2643,6 @@ } }); }); + @endsection