diff --git a/app/Http/Controllers/GadaianController.php b/app/Http/Controllers/GadaianController.php index beb0518..7feb8bb 100644 --- a/app/Http/Controllers/GadaianController.php +++ b/app/Http/Controllers/GadaianController.php @@ -334,7 +334,7 @@ class GadaianController extends Controller public function resitansurans($id) { - + $auth_user = Auth::user(); $totaltransaction = 0; $transaction = Http::get(config('api.url') . '/api/transaction/one/'. $id)->json(); @@ -349,8 +349,14 @@ class GadaianController extends Controller // if(sizeof($customers_info) != 0) // $customers_info = $customers_info[0]; + $wakil = Http::get(config('api.url') . '/api/getwakil/' . $auth_user['cawangan'] . '/code/' . $penebusan['nowakil'])->json(); - return view('print.resitansuran',compact('transaction','gadai','customers_info')); + // dd($wakil); + if(sizeof($wakil) != 0) + $wakil = $wakil[0]; + + + return view('print.resitansuran',compact('transaction','gadai','customers_info','wakil')); } public function resitbelumansurans($id) diff --git a/app/Http/Controllers/KhazanahController.php b/app/Http/Controllers/KhazanahController.php index 01f2679..3e51ed9 100644 --- a/app/Http/Controllers/KhazanahController.php +++ b/app/Http/Controllers/KhazanahController.php @@ -670,7 +670,7 @@ class KhazanahController extends Controller $updatelulus = Http::put(config('api.url') . '/api/UpdateKelulusan/' . $auth_user['cawangan'] . '/' . $norujukan,[ "pengesahan" => "operasi", 'siri' => $request->siri, - 'namaoperasi' => $request->namaoperasi + "namakhazanah" => $request->namakhazanah ])->json(); }else{ @@ -679,7 +679,7 @@ class KhazanahController extends Controller "pengesahan" => "operasi", 'siri' => $request->siri, "pembatalan" => "batal", - 'namaoperasi' => $request->namaoperasi + "namakhazanah" => $request->namakhazanah ])->json(); event(new NotifikasiKelulusan($norujukan,"batal",$request->siri,$request->komenkelulusan,$request->teller)); diff --git a/resources/views/customers/info.blade.php b/resources/views/customers/info.blade.php index 429fb95..f35f38c 100644 --- a/resources/views/customers/info.blade.php +++ b/resources/views/customers/info.blade.php @@ -493,188 +493,209 @@ $.ajax({ method:'get', - url: api_url + '/api/polis/get/', + url: api_url + '/api/check/serah/lelong', datatype:'json', data:{ 'kodcaw': "{{ $cawangan_info['kodcaw'] }}", 'norujukan': norujukan }, success:function(data){ + if(data == 0){ + - var count = Object.keys(data).length; - - if(count > 0) - { - if(data[0].tebus === 0) - { - const swalWithBootstrapButtons = Swal.mixin({ - customClass: { - confirmButton: 'btn btn-success', - cancelButton: 'btn btn-danger mr-1' - }, - buttonsStyling: false - }); - - swalWithBootstrapButtons.fire({ - title: 'Dapatkan Pengesahan Khazanah', - text: "Surat Akuan Gadaian Hilang!", - icon: 'info', - showCancelButton: true, - confirmButtonText: 'Hantar', - cancelButtonText: 'Batal', - reverseButtons: true - }).then((result) => { - if (result.isConfirmed) { - - let komen = "Surat Akuan Gadaian Hilang|" + '-' + "|" + '-' + "|" + '-' + "| Tambah Pinjaman"; - let teller = "{{ Auth::user()->name }}"; - - 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 - }) - let siricreated = 0; - $.ajax({ - method:'post', - url: "{{ route('khazanah.createkelulusan') }}", - data: { - "_token": "{{ csrf_token() }}", - "norujukan" : norujukan, - "komen" : komen, - "jumpinjam" : '0.00', - "teller" : teller - }, - success:function(data){ - siricreated = data; - }, - error: function(xhr, status, error) { - var err = eval("(" + xhr.responseText + ")"); - alert(xhr.responseText); - } - }); - - var pusher = new Pusher("{{ env('PUSHER_APP_KEY') }}", { - cluster: 'ap1', - encrypted: true - }); - - var channel = pusher.subscribe('notice-kelulusan'); - channel.bind('my-kelulusan', function(data) { - - - if(data.norujukan == norujukan && data.siri == siricreated && data.teller == teller) - { - if(data.kelulusan == 'lulus') - { - Swal.fire({ - icon: 'success', - title: 'Telah Disahkan' - }).then(function(){ - $.ajax({ - method:'put', - url: api_url + '/api/polis/put/', - data: { - 'kodcaw': "{{ $cawangan_info['kodcaw'] }}", - 'norujukan': norujukan, - 'tebus' : 1 - }, - success:function(data){ - location.reload(); - - }, - error: function(xhr, status, error) { - var err = eval("(" + xhr.responseText + ")"); - alert(xhr.responseText); - } - }); - }); - - } - else if(data.kelulusan == 'batal') - { - Swal.fire({ - icon: 'warning', - title: 'Telah Dibatalkan', - text: `Komen : ${data.komen}` - }).then(function(){ - return false; - }); - } - } - - }); - - - } - else if (result.dismiss === Swal.DismissReason.cancel) { - swalWithBootstrapButtons.fire( - 'Gagal', - 'Gagal mendapatkan kelulusan khazanah', - 'error' - ) - } - }); - } - else - { - $.ajax({ - method:'get', - url: api_url + '/api/check/serah/gadai', - datatype:'json', - data:{ - 'kodcaw': "{{ $cawangan_info['kodcaw'] }}", - 'norujukan': norujukan - }, - success:function(data){ - if(data == 'true'){ - window.location = urlpenebusan; - }else if(data == 'false'){ - Swal.fire({ - icon: 'error', - title: 'Amaran', - text: 'Gadaian Belum Scan Barcode' - }); - } - } - }); - } - - - - }else{ $.ajax({ method:'get', - url: api_url + '/api/check/serah/gadai', + url: api_url + '/api/polis/get/', datatype:'json', data:{ 'kodcaw': "{{ $cawangan_info['kodcaw'] }}", 'norujukan': norujukan }, success:function(data){ - if(data == 'true'){ - window.location = urlpenebusan; - }else if(data == 'false'){ - Swal.fire({ - icon: 'error', - title: 'Amaran', - text: 'Gadaian Belum Scan Barcode' - }); + + var count = Object.keys(data).length; + + if(count > 0) + { + if(data[0].tebus === 0) + { + const swalWithBootstrapButtons = Swal.mixin({ + customClass: { + confirmButton: 'btn btn-success', + cancelButton: 'btn btn-danger mr-1' + }, + buttonsStyling: false + }); + + swalWithBootstrapButtons.fire({ + title: 'Dapatkan Pengesahan Khazanah', + text: "Surat Akuan Gadaian Hilang!", + icon: 'info', + showCancelButton: true, + confirmButtonText: 'Hantar', + cancelButtonText: 'Batal', + reverseButtons: true + }).then((result) => { + if (result.isConfirmed) { + + let komen = "Surat Akuan Gadaian Hilang|" + '-' + "|" + '-' + "|" + '-' + "| Tambah Pinjaman"; + let teller = "{{ Auth::user()->name }}"; + + 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 + }) + let siricreated = 0; + $.ajax({ + method:'post', + url: "{{ route('khazanah.createkelulusan') }}", + data: { + "_token": "{{ csrf_token() }}", + "norujukan" : norujukan, + "komen" : komen, + "jumpinjam" : '0.00', + "teller" : teller + }, + success:function(data){ + siricreated = data; + }, + error: function(xhr, status, error) { + var err = eval("(" + xhr.responseText + ")"); + alert(xhr.responseText); + } + }); + + var pusher = new Pusher("{{ env('PUSHER_APP_KEY') }}", { + cluster: 'ap1', + encrypted: true + }); + + var channel = pusher.subscribe('notice-kelulusan'); + channel.bind('my-kelulusan', function(data) { + + + if(data.norujukan == norujukan && data.siri == siricreated && data.teller == teller) + { + if(data.kelulusan == 'lulus') + { + Swal.fire({ + icon: 'success', + title: 'Telah Disahkan' + }).then(function(){ + $.ajax({ + method:'put', + url: api_url + '/api/polis/put/', + data: { + 'kodcaw': "{{ $cawangan_info['kodcaw'] }}", + 'norujukan': norujukan, + 'tebus' : 1 + }, + success:function(data){ + location.reload(); + + }, + error: function(xhr, status, error) { + var err = eval("(" + xhr.responseText + ")"); + alert(xhr.responseText); + } + }); + }); + + } + else if(data.kelulusan == 'batal') + { + Swal.fire({ + icon: 'warning', + title: 'Telah Dibatalkan', + text: `Komen : ${data.komen}` + }).then(function(){ + return false; + }); + } + } + + }); + + + } + else if (result.dismiss === Swal.DismissReason.cancel) { + swalWithBootstrapButtons.fire( + 'Gagal', + 'Gagal mendapatkan kelulusan khazanah', + 'error' + ) + } + }); + } + else + { + $.ajax({ + method:'get', + url: api_url + '/api/check/serah/gadai', + datatype:'json', + data:{ + 'kodcaw': "{{ $cawangan_info['kodcaw'] }}", + 'norujukan': norujukan + }, + success:function(data){ + if(data == 'true'){ + window.location = urlpenebusan; + }else if(data == 'false'){ + Swal.fire({ + icon: 'error', + title: 'Amaran', + text: 'Gadaian Belum Scan Barcode' + }); + } + } + }); + } + + + + }else{ + $.ajax({ + method:'get', + url: api_url + '/api/check/serah/gadai', + datatype:'json', + data:{ + 'kodcaw': "{{ $cawangan_info['kodcaw'] }}", + 'norujukan': norujukan + }, + success:function(data){ + if(data == 'true'){ + window.location = urlpenebusan; + }else if(data == 'false'){ + Swal.fire({ + icon: 'error', + title: 'Amaran', + text: 'Gadaian Belum Scan Barcode' + }); + } + } + }); } } - }); + }); + + + }else if(data == 1){ + Swal.fire({ + icon: 'error', + title: 'Amaran', + text: 'Gadaian Sedang Dilelong..' + }); } } - }); - - + }); }