From 81c43dc3dc478937a72e134b4149e09e376445e0 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Tue, 23 May 2023 12:42:32 +0800 Subject: [PATCH] fix transaction RM1 semasa loading --- .../includes/bayaran/pembayaransag.blade.php | 39 ++++--------------- 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/resources/views/includes/bayaran/pembayaransag.blade.php b/resources/views/includes/bayaran/pembayaransag.blade.php index 8017e83..c431e98 100644 --- a/resources/views/includes/bayaran/pembayaransag.blade.php +++ b/resources/views/includes/bayaran/pembayaransag.blade.php @@ -86,7 +86,9 @@ @php $upahtawarruq = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/upahtawarruq/'. $bayar['kodcaw'] . '/' . $bayar['norujukan'])->json(); + $upahtawarruq = floatval(str_replace(',','',$upahtawarruq)); $totalupahasal = $totalupahasal + $upahtawarruq; + @endphp - + @@ -242,7 +244,7 @@ $("select[name=sltbayaran]").change(function(e) { let selected = $('option:selected', this).attr('value'); let jenis = $(this).data('jenis'); - let upah = parseFloat($(this).data('upah').replace(",","")); + let upah = $(this).data('upah'); let taglel = $(this).data('taglel'); if (selected === 'fixed') { @@ -263,7 +265,7 @@ $("input[name=txtbayaranarrahn]").change(function(e) { - let upah = parseFloat($(this).data('upah').replace(",","")); + let upah = $(this).data('upah'); let pinjaman = $(this).data('pinjaman'); let jenis = $(this).data('jenis'); let nm = $(this).data('nm'); @@ -292,44 +294,17 @@ }); - function cleanPaymentInput(paymentValue){ - let removeAllCommaFromPaymentValue = (paymentValue) => { - return paymentValue.replaceAll(',', ''); - } - - let removeAllDotExceptForLastFromPaymentValue = (paymentValue) => { - let lastIndexOfDot = paymentValue.lastIndexOf('.'); - let first_portion_value = paymentValue.slice(0, lastIndexOfDot); - let second_portion_value = paymentValue.slice(lastIndexOfDot); - - first_portion_value = first_portion_value.replaceAll('.', ''); - - paymentValue = String(first_portion_value) + String(second_portion_value); - - return paymentValue; - } - - let cleanedPaymentValue = removeAllCommaFromPaymentValue(paymentValue); - - cleanedPaymentValue = removeAllDotExceptForLastFromPaymentValue(cleanedPaymentValue); - - return cleanedPaymentValue; - - } $("input[name=txtbayarantawarruq]").change(function(e) { // $("input[name=txtbayarantawarruq]").click(function(e) { - let upah = parseFloat($(this).data('upah').replace(",","")); + let upah = $(this).data('upah'); let bakipinjam = $(this).data('bakipjm'); let jenis = $(this).data('jenis'); let nm = $(this).data('nm'); let taglel = $(this).data('taglel'); - let bayar = cleanPaymentInput(this.value) - bayar = Number(bayar); - - $("input[name=txtbayarantawarruq]").val(bayar.toFixed(2)) + let bayar = Number(this.value) let errorlebih = (bakipinjam - (nm * 0.1) + upah);