From 6111261e36ef158edaca506e588e1a77bd583938 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Wed, 17 Feb 2021 09:17:11 +0800 Subject: [PATCH] pendahuluan --- app/Http/Controllers/KhazanahController.php | 13 ++++++- public/js/main.js | 38 +++++++++++++++++++ resources/views/customers/info.blade.php | 3 +- .../views/khazanah/khazanahserahan.blade.php | 34 ++++++++--------- .../views/khazanah/pendahuluanserah.blade.php | 24 +++++++++++- resources/views/modal/historytebus.blade.php | 13 ++++--- resources/views/penebusan/index.blade.php | 30 ++++++++------- 7 files changed, 116 insertions(+), 39 deletions(-) diff --git a/app/Http/Controllers/KhazanahController.php b/app/Http/Controllers/KhazanahController.php index 8ff287b..32e10b7 100644 --- a/app/Http/Controllers/KhazanahController.php +++ b/app/Http/Controllers/KhazanahController.php @@ -382,7 +382,7 @@ class KhazanahController extends Controller $cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); - $kelulusan = Http::get(config('api.url') . '/api/SenaraiDahLulus/' . $auth_user['cawangan'] . '/' . $norujukan)->json(); + $kelulusan = Http::get(config('api.url') . '/api/ListLatestLulus/' . $auth_user['cawangan'] . '/' . $norujukan)->json(); if(sizeof($kelulusan) > 0) { @@ -458,11 +458,22 @@ class KhazanahController extends Controller $norujukan = $request->norujukan; + $cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); + $getsiri = Http::get(config('api.url') . '/api/ListLatestLulus/'. $auth_user['cawangan'] . '/' . $norujukan)->json(); + + if(isset($getsiri['siri'])) + { + $siri = $getsiri['siri'] + 1; + }else{ + $siri = 1; + } + $createlulus = Http::post(config('api.url') . '/api/CreateKelulusan/' . $auth_user['cawangan'] . '/' . $norujukan . '/roles/khazanah', [ 'komen' => $request->komen, 'dategadai' => $current->toDateString(), + 'siri' => $siri, 'bilgadai' => 1, 'jumpinjam' => $request->jumpinjam, 'jenistebus' => "G", diff --git a/public/js/main.js b/public/js/main.js index fb4d648..93d03c9 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -123,6 +123,42 @@ function totalkey(datakeyin) } +function totalkeyserahan(datakeyin) +{ + var idkey = $(datakeyin).attr('id'); + var valkey = $(datakeyin).val(); + var amount = 0; + + + var validate = parseFloat($('#amt').data('amaun')); + + $.each(arrayambilan, function( index, arr ){ + if(arr[0] == idkey) + { + + arrayambilan[index][1] = totalamount(idkey,valkey); + } + + amount += arr[1]; + }); + + + if(amount > validate) + { + $('#' + idkey).val(0); + Swal.fire({ + icon: 'error', + title: 'Amaran', + text: 'Jumlah Melebihi kadar', + }); + } + else + { + $('#amt').val(amount); + } + +} + function kiraan(datakeyin) { @@ -153,7 +189,9 @@ function kiraan(datakeyin) } else { + $('#amaunkiraan').val(amount); + } switch(idkey) { diff --git a/resources/views/customers/info.blade.php b/resources/views/customers/info.blade.php index bfa3fb4..ed4fadc 100644 --- a/resources/views/customers/info.blade.php +++ b/resources/views/customers/info.blade.php @@ -614,7 +614,8 @@ tebusaz['norujukan'], tebusaz['jenistebus'], tebusaz['jbg'], - tebusaz['t_tebus'] + tebusaz['t_tebus'], + 'Cetak' ]).draw(); counter = counter + 1; }); diff --git a/resources/views/khazanah/khazanahserahan.blade.php b/resources/views/khazanah/khazanahserahan.blade.php index 40f19bb..9ba06e1 100644 --- a/resources/views/khazanah/khazanahserahan.blade.php +++ b/resources/views/khazanah/khazanahserahan.blade.php @@ -69,31 +69,31 @@ RM1 - + RM20 - + RM5 - + RM50 - + RM10 - + RM100 - + @@ -129,51 +129,51 @@ RM0.01 - + RM1 - + RM0.05 - + RM5 - + RM0.10 - + RM10 - + RM0.20 - + RM20 - + RM0.50 - + RM50 - + @@ -183,7 +183,7 @@ RM100 - + diff --git a/resources/views/khazanah/pendahuluanserah.blade.php b/resources/views/khazanah/pendahuluanserah.blade.php index 8d0428c..09ac009 100644 --- a/resources/views/khazanah/pendahuluanserah.blade.php +++ b/resources/views/khazanah/pendahuluanserah.blade.php @@ -12,7 +12,7 @@
-
+ @csrf
Tarikh
@@ -347,6 +347,28 @@ $('#form-pendahuluan').trigger('submit'); } + + function validateamaun() + { + let amaun = parseFloat($('#amt').val()); + let amaunkiraan = parseFloat($('#amaunkiraan').val().replace(/[^0-9.-]+/g,"")); + + if(amaun != amaunkiraan) + { + Swal.fire( + 'Amaran', + 'Sila Cukupkan baki amaun kiraan sama dengan amaun sebenar!', + 'error' + ) + + event.preventDefault(); + return false; + }else{ + return true; + } + + } + diff --git a/resources/views/modal/historytebus.blade.php b/resources/views/modal/historytebus.blade.php index 1606d6b..6500422 100644 --- a/resources/views/modal/historytebus.blade.php +++ b/resources/views/modal/historytebus.blade.php @@ -10,14 +10,14 @@
@@ -164,7 +164,7 @@ PEMBIAYAAN ASAL(RM)
- +
@@ -241,9 +241,9 @@ PINJAMAN BARU(RM)
- +
- {{ $gadai['percentpinj']}} + {{ $gadai['percentpinj'] }}
@@ -275,6 +275,10 @@