From 92caaec73911deb9fbb3f72fd1eedb717bb67c88 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Tue, 16 Feb 2021 09:59:37 +0800 Subject: [PATCH] fix aliran tunai dan kelulusan --- app/Events/PendahuluanSerahan.php | 30 +++++++ app/Http/Controllers/KhazanahController.php | 24 +++++- public/js/main.js | 73 ++++++++++++++--- resources/views/gadaian/index.blade.php | 28 +++++-- .../views/homepage/khazanah/home.blade.php | 23 +++++- resources/views/khazanah/kelulusan.blade.php | 6 +- .../views/khazanah/khazanahserahan.blade.php | 81 ++++++++++++++----- .../views/khazanah/pendahuluanserah.blade.php | 41 +++++++++- 8 files changed, 260 insertions(+), 46 deletions(-) create mode 100644 app/Events/PendahuluanSerahan.php diff --git a/app/Events/PendahuluanSerahan.php b/app/Events/PendahuluanSerahan.php new file mode 100644 index 0000000..bfdd4a6 --- /dev/null +++ b/app/Events/PendahuluanSerahan.php @@ -0,0 +1,30 @@ +cawangan = $pengesahan; + } + + public function broadcastOn() + { + return ['pendahuluanserahan-notice']; + } + + public function broadcastAs() + { + return 'penserahan-event'; + } +} \ No newline at end of file diff --git a/app/Http/Controllers/KhazanahController.php b/app/Http/Controllers/KhazanahController.php index b2676cf..8ff287b 100644 --- a/app/Http/Controllers/KhazanahController.php +++ b/app/Http/Controllers/KhazanahController.php @@ -6,6 +6,7 @@ namespace App\Http\Controllers; use App\Events\StatusLiked; use App\Events\NotifikasiPembayaran; use App\Events\OperasiNotice; +use App\Events\PendahuluanSerahan; use App\User; @@ -416,10 +417,22 @@ class KhazanahController extends Controller else { if($pelulus == 'khazanah') - { - $updatelulus = Http::put(config('api.url') . '/api/UpdateKelulusan/' . $auth_user['cawangan'] . '/' . $norujukan,[ - "pengesahan" => "khazanah" - ])->json(); + { + if($request->pembatalan == null) + { + + $updatelulus = Http::put(config('api.url') . '/api/UpdateKelulusan/' . $auth_user['cawangan'] . '/' . $norujukan,[ + "pengesahan" => "khazanah" + ])->json(); + + }else{ + + $updatelulus = Http::put(config('api.url') . '/api/UpdateKelulusan/' . $auth_user['cawangan'] . '/' . $norujukan,[ + "pengesahan" => "khazanah", + "pembatalan" => "batal" + ])->json(); + + } } else { @@ -690,6 +703,7 @@ class KhazanahController extends Controller ]); + event(new PendahuluanSerahan("Lulus")); $updaterequest=Http::put(config('api.url').'/api/requestTeller/update/'. $auth_user['cawangan'],[ 'kodlaluan' => $request->teller, @@ -769,6 +783,8 @@ class KhazanahController extends Controller ]); + event(new PendahuluanSerahan("Lulus")); + $updaterequest=Http::put(config('api.url').'/api/requestTeller/update/'. $auth_user['cawangan'],[ 'kodlaluan' => $request->teller, 'no' => $request->no diff --git a/public/js/main.js b/public/js/main.js index fa3168b..90f7103 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -265,11 +265,39 @@ async function openuptambahdanserah(e) }, success:function(data) { + Swal.fire({ - icon: 'success', - title: 'Tambah Pendahuluan', - text: 'Tambah Pendahuluan berjaya dipohon!' - }) + title: 'Tunggu Pengesahan Daripada Khazanah.', + icon: 'info', + width: 600, + padding: '3em', + background: '#fffff', + showCancelButton: false, + showConfirmButton: false, + allowOutsideClick: false, + allowEscapeKey: false, + allowEnterKey: false + }) + + var pusher = new Pusher('26b0ec2f297f94b7aa9b', { + cluster: 'ap1', + encrypted: true + }); + + var channel = pusher.subscribe('pendahuluanserahan-notice'); + channel.bind('penserahan-event', function(data) { + // let message = JSON.stringify(data); + + Swal.fire({ + icon: 'success', + title: 'Tambah Pendahuluan', + text: 'Tambah Pendahuluan berjaya dipohon!' + }).then(function(){ + location.reload(); + }); + + }); + }, error: function(xhRequest, ajaxOptions, thrownError){ console.log(xhRequest); @@ -372,11 +400,38 @@ function tambahdanserahanfunc(e) }, success:function(data) { - Swal.fire({ - icon: 'success', - title: 'Serahan Modal', - text: 'Serahan modal berjaya dipohon!' - }) + Swal.fire({ + title: 'Tunggu Pengesahan Daripada Khazanah.', + icon: 'info', + width: 600, + padding: '3em', + background: '#fffff', + showCancelButton: false, + showConfirmButton: false, + allowOutsideClick: false, + allowEscapeKey: false, + allowEnterKey: false + }) + + var pusher = new Pusher('26b0ec2f297f94b7aa9b', { + cluster: 'ap1', + encrypted: true + }); + + var channel = pusher.subscribe('pendahuluanserahan-notice'); + channel.bind('penserahan-event', function(data) { + // let message = JSON.stringify(data); + + Swal.fire({ + icon: 'success', + title: 'Serahan Modal', + text: 'Serahan modal berjaya dipohon!' + }).then(function(){ + location.reload(); + }); + + }); + $('#denominasiModal').modal('hide'); }, error: function(xhRequest, ajaxOptions, thrownError){ diff --git a/resources/views/gadaian/index.blade.php b/resources/views/gadaian/index.blade.php index cde1383..75641c0 100644 --- a/resources/views/gadaian/index.blade.php +++ b/resources/views/gadaian/index.blade.php @@ -891,16 +891,32 @@ if(data != '') { clearInterval(timerInterval); - Swal.fire({ + + if(data == 'batal') + { + Swal.fire({ + icon: 'warning', + title: 'Telah Dibatalkan' + }).then(function(){ + $("#terima_gadai").prop('disabled', false); + return false; + + }); + + }else{ + + Swal.fire({ icon: 'success', title: 'Telah Disahkan' - }).then(function(){ + }).then(function(){ - $(func).attr("onSubmit","return true;"); - $(func).submit(); - return true; + $(func).attr("onSubmit","return true;"); + $(func).submit(); + return true; - }); + }); + + } } },error: function(xhr, status, error) { diff --git a/resources/views/homepage/khazanah/home.blade.php b/resources/views/homepage/khazanah/home.blade.php index f99b07d..dc717d9 100644 --- a/resources/views/homepage/khazanah/home.blade.php +++ b/resources/views/homepage/khazanah/home.blade.php @@ -18,7 +18,7 @@ Kakitangan
- Kelulusan + Kelulusan
Unjuran @@ -57,4 +57,25 @@
+ @endsection diff --git a/resources/views/khazanah/kelulusan.blade.php b/resources/views/khazanah/kelulusan.blade.php index 62d8b7f..944fbda 100644 --- a/resources/views/khazanah/kelulusan.blade.php +++ b/resources/views/khazanah/kelulusan.blade.php @@ -44,7 +44,7 @@ {{ $k['berat'] }} {{ $k['margin'] }} - + @endforeach @foreach($kelulusanmohonid as $index=>$km) @@ -151,13 +151,15 @@ { let norujukan = $(e).data('norujukan'); let pelulus = $(e).data('pelulus'); + $.ajax({ method:'put', url: "{{ route('khazanah.updatekelulusan') }}", data: { "_token": "{{ csrf_token() }}", "norujukan" : norujukan, - "pelulus" : pelulus + "pelulus" : pelulus, + "pembatalan" : "batal" }, success:function(data){ console.log(data); diff --git a/resources/views/khazanah/khazanahserahan.blade.php b/resources/views/khazanah/khazanahserahan.blade.php index 98d6229..40f19bb 100644 --- a/resources/views/khazanah/khazanahserahan.blade.php +++ b/resources/views/khazanah/khazanahserahan.blade.php @@ -8,7 +8,7 @@
-
{{ __('Pendahuluan Wang Peti Besi') }}
+
{{ __('Serahan Wang Peti Besi') }}
@@ -18,16 +18,16 @@
Tarikh
Teller ID
-
+
Amaun (RM)
-
+
Nota
-
+

@@ -36,7 +36,7 @@
- + Batal
@@ -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 - + @@ -299,6 +299,43 @@