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