From a1d226f6d93c848257243968cb94690a96071b32 Mon Sep 17 00:00:00 2001 From: fifi97 Date: Sun, 18 Apr 2021 20:46:58 +0800 Subject: [PATCH] ubah wakil approved --- .../Controllers/AliranTunaiController.php | 4 +- resources/views/customers/info.blade.php | 103 ++++++++++++++++-- resources/views/modal/wakil.blade.php | 13 ++- resources/views/penebusan/index.blade.php | 28 ++--- 4 files changed, 117 insertions(+), 31 deletions(-) diff --git a/app/Http/Controllers/AliranTunaiController.php b/app/Http/Controllers/AliranTunaiController.php index bfb2351..3a66bf2 100644 --- a/app/Http/Controllers/AliranTunaiController.php +++ b/app/Http/Controllers/AliranTunaiController.php @@ -1264,7 +1264,9 @@ class AliranTunaiController extends Controller Session::put('upahsemasa', $requestupah); $requestalirantunai = Http::get(config('api.url') . '/api/GetCurrentTunai/' . $auth_user['cawangan'],['kodlaluan' => Auth::user()->name])->json(); - + $masuk = $requestalirantunai['masuk']; + $keluar = $requestalirantunai['keluar']; + $baki = $requestalirantunai['baki']; $total = floatval($baki) + floatval($requestupah); diff --git a/resources/views/customers/info.blade.php b/resources/views/customers/info.blade.php index e30e7ac..dac70c6 100644 --- a/resources/views/customers/info.blade.php +++ b/resources/views/customers/info.blade.php @@ -757,9 +757,92 @@ }); } - function daftarwakilfunction(nokp) + function daftarwakil() { - $('#nokp').val(nokp); + let nopelanggan = $('#nopelangganwakil').val(); + let nowakil = $('#nowakil').val(); + let nama = $('#namawakil').val(); + let hubungan = $('#slthubungan').val(); + let alamat = $('#alamatwakil').val(); + let telefon = $('#notelwakil').val(); + let nota = $('#notawakil').val(); + let nokp = $('#nokpwakil').val(); + let norujukan = $('#norujukanwakil').val(); + + + $.ajax({ + method:'POST', + url: "{{ route('wakil.create') }}", + data:{ + "_token": "{{ csrf_token() }}", + "nopelanggan" : nopelanggan, + "nowakil" : nowakil, + "nama" : nama, + "hubungan" : hubungan, + "alamat" : alamat, + "telefon" : telefon, + "nota" : nota, + "icno" : nokp + }, + success:function(data){ + + if(data == 1) + { + $('#WakilModal').hide(); + $('#WakilModal').modal('hide'); + nw = nowakil; + Swal.fire({ + allowOutsideClick: false, + allowEscapeKey: false, + allowEnterKey: false, + confirmButtonText: ' Baik Boss!', + icon: 'success', + title: 'Berjaya Mendaftar Wakil Pelanggan!' + }).then(function(){ + + $.ajax({ + method:'put', + url: api_url + '/api/ubahwakil/' + kodcaw, + data:{ 'nowakil' : nw, + 'norujukan' : norujukan}, + success:function(data){ + + if(data === 1) + { + Swal.fire({ + icon: 'success', + title: 'Berjaya!', + text: 'Penukaran Wakil berjaya' + }).then(async function(){ + return true; + location.reload(); + }); + }else{ + Swal.fire({ + icon: 'info', + title: 'Pemberitahuan!', + text: 'Wakil telah didaftarkan dengan IC tersebut!' + }).then(async function(){ + return true; + location.reload(); + }); + } + + } + }); + }); + } + + },error: function (request, status, error) { + console.log(request.responseText); + } + }); + } + + function daftarwakilfunction(nokp,norujukan) + { + $('#nokpwakil').val(nokp); + $('#norujukanwakil').val(norujukan); $.ajax({ method:'GET', @@ -768,9 +851,9 @@ success:function(data){ $('#WakilModal').modal(); - $('#nama').val(''); - $('#alamat').val(data['']); - $('#notel').val(data['']); + $('#namawakil').val(''); + $('#alamatwakil').val(data['']); + $('#notelwakil').val(data['']); //get first wakil $.ajax({ @@ -786,10 +869,10 @@ if(data != 'no-data') { - $('#nama').val(data['nama']); - $('#alamat').val(data['alamat1']); - $('#notel').val(data['telefon']); - $('#nopelanggan').val(data['nopelanggan']); + $('#namawakil').val(data['nama']); + $('#alamatwakil').val(data['alamat1']); + $('#notelwakil').val(data['telefon']); + $('#nopelangganwakil').val(data['nopelanggan']); } @@ -1021,7 +1104,7 @@ icon: 'info', title: 'Maklumat anda tiada dalam senarai wakil! Tekan button Daftar untuk mendaftar!' }).then(function(){ - daftarwakilfunction(amaun); + daftarwakilfunction(amaun,norujukan); }); } },error: function(xhr, status, error) { diff --git a/resources/views/modal/wakil.blade.php b/resources/views/modal/wakil.blade.php index a4e141e..5b80b00 100644 --- a/resources/views/modal/wakil.blade.php +++ b/resources/views/modal/wakil.blade.php @@ -19,14 +19,15 @@ - + +
- +
@@ -35,7 +36,7 @@
- +
@@ -45,7 +46,7 @@
- +
@@ -54,7 +55,7 @@
- +
@@ -63,7 +64,7 @@
- +
diff --git a/resources/views/penebusan/index.blade.php b/resources/views/penebusan/index.blade.php index a9032dd..67bf225 100644 --- a/resources/views/penebusan/index.blade.php +++ b/resources/views/penebusan/index.blade.php @@ -1997,14 +1997,14 @@ function daftarwakil() { - let nopelanggan = $('#nopelanggan').val(); + let nopelanggan = $('#nopelangganwakil').val(); let nowakil = $('#nowakil').val(); - let nama = $('#nama').val(); + let nama = $('#namawakil').val(); let hubungan = $('#slthubungan').val(); - let alamat = $('#alamat').val(); - let telefon = $('#notel').val(); - let nota = $('#nota').val(); - let nokp = $('#nokp').val(); + let alamat = $('#alamatwakil').val(); + let telefon = $('#notelwakil').val(); + let nota = $('#notawakil').val(); + let nokp = $('#nokpwakil').val(); $.ajax({ @@ -2052,7 +2052,7 @@ function daftarfunction(id) { - $('#nokp').val(id); + $('#nokpwakil').val(id); $.ajax({ method:'GET', @@ -2061,9 +2061,9 @@ success:function(data){ $('#WakilModal').modal(); - $('#nama').val(''); - $('#alamat').val(data['']); - $('#notel').val(data['']); + $('#namawakil').val(''); + $('#alamatwakil').val(data['']); + $('#notelwakil').val(data['']); //get first wakil $.ajax({ @@ -2079,10 +2079,10 @@ if(data != 'no-data') { - $('#nama').val(data['nama']); - $('#alamat').val(data['alamat1']); - $('#notel').val(data['telefon']); - $('#nopelanggan').val(data['nopelanggan']); + $('#namawakil').val(data['nama']); + $('#alamatwakil').val(data['alamat1']); + $('#notelwakil').val(data['telefon']); + $('#nopelangganwakil').val(data['nopelanggan']); }