From 8ec68e891329dc930710ff967216df220c0c02b1 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Fri, 1 Nov 2024 09:30:38 +0800 Subject: [PATCH 1/9] first commit for kaunter in fixing cash deposit --- app/Events/PendahuluanSerahan.php | 4 +- app/Http/Controllers/KhazanahController.php | 174 ++++-------------- public/js/main.js | 23 ++- .../views/khazanah/pendahuluan.blade.php | 6 +- 4 files changed, 61 insertions(+), 146 deletions(-) diff --git a/app/Events/PendahuluanSerahan.php b/app/Events/PendahuluanSerahan.php index b6ca1ff..71ba288 100644 --- a/app/Events/PendahuluanSerahan.php +++ b/app/Events/PendahuluanSerahan.php @@ -14,10 +14,12 @@ class PendahuluanSerahan implements ShouldBroadcast public $pengesahan; public $cawangan; public $kodlaluan; + public $jenis; - public function __construct($pengesahan,$cawangan,$kodlaluan) + public function __construct($pengesahan,$jenis,$cawangan,$kodlaluan) { $this->pengesahan = $pengesahan; + $this->jenis = $jenis; $this->cawangan = $cawangan; $this->kodlaluan = $kodlaluan; } diff --git a/app/Http/Controllers/KhazanahController.php b/app/Http/Controllers/KhazanahController.php index 16838c9..c288fa2 100644 --- a/app/Http/Controllers/KhazanahController.php +++ b/app/Http/Controllers/KhazanahController.php @@ -1156,7 +1156,7 @@ class KhazanahController extends Controller ]); - event(new PendahuluanSerahan("Lulus",$auth_user['cawangan'],$request->teller)); + event(new PendahuluanSerahan("Lulus","pendahuluan",$auth_user['cawangan'],$request->teller)); $updaterequest=Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/requestTeller/update/'. $auth_user['cawangan'],[ 'kodlaluan' => $request->teller, @@ -1236,7 +1236,7 @@ class KhazanahController extends Controller ]); - event(new PendahuluanSerahan("Lulus",$auth_user['cawangan'],$request->teller)); + event(new PendahuluanSerahan("Lulus","serahan",$auth_user['cawangan'],$request->teller)); $updaterequest=Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/requestTeller/update/'. $auth_user['cawangan'],[ 'kodlaluan' => $request->teller, @@ -1247,144 +1247,41 @@ class KhazanahController extends Controller return redirect()->route('khazanah.serahan'); } - public function kemaskiniPendahuluan(Request $request) //Daftar Pendahuluan kepada Kaunter + public function kemaskiniPendahuluan(Request $request) { - // return $this->denominasicalculationpendahuluan($request); + $auth_user = Auth::user(); + $api_url = config('api.url'); + $peti_besi_terkini=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/VaultController/'.$auth_user['cawangan'])->json(); - $auth_user = Auth::user(); - $api_url = config('api.url'); - $peti_besi_terkini=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/VaultController/'.$auth_user['cawangan'])->json(); + if(sizeof($peti_besi_terkini) == 0) + { + $peti_besi_terkini=Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/daftarVault/'.$auth_user['cawangan'])->json(); + $baki_awal = $peti_besi_terkini["bakiakhir"]; + } + else + { + $baki_awal = $peti_besi_terkini[0]["bakiakhir"]; + } - if(sizeof($peti_besi_terkini) == 0) - { - $peti_besi_terkini=Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/daftarVault/'.$auth_user['cawangan'])->json(); - $baki_awal=$peti_besi_terkini["bakiakhir"]; - } - else - { - $baki_awal=$peti_besi_terkini[0]["bakiakhir"]; - } + $amount = $request->amt; - $amount = $request->amt; + if($amount > $baki_awal){ + return redirect()->route('khazanah.pendahulu')->with('message', 'Jumlah yang dipinta melebihi baki dalam peti besi!.'); + } + else{ + $response_data = $request->except('_token'); + $test = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/test/updatetunai/'.$auth_user['cawangan'],$response_data)->json(); + + if($test == 'success'){ + event(new PendahuluanSerahan("Lulus","pendahuluan",$auth_user['cawangan'],$request->teller)); + return redirect()->route('khazanah.pendahulu'); + }else{ + return redirect()->route('khazanah.pendahulu')->with('error','Permohonan tidak berjaya! Permohonan Semula perlu melebihi 1 minit.'); + } + } - if($amount>$baki_awal) - { - //WI ERROR MESSAGE SKIT - // dd($baki_awal); - return redirect()->route('khazanah.serahan')->with('message', 'Jumlah yang dipinta melebihi baki dalam peti besi!.'); - } - else - { - - $tarikh=$request->tarikh; - $kodlaluan=$request->teller; - $tambah=$request->amt; - $kurang=0.0; - $nota=$request->nota; - $kodcaw=$auth_user['cawangan']; - - $addTunai=Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/add/addTunai/'.$auth_user['cawangan'],[ - 'kodcaw'=>$kodcaw, - 'kodlaluan'=>$kodlaluan, - 'tambah'=>$tambah, - 'kurang'=>$kurang, - 'nota'=>$nota - ]); - - $getTunai=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/GetCurrentTunai/'.$auth_user['cawangan'],['kodlaluan' => $kodlaluan])->json(); - - if(sizeof($getTunai) == 0) - { - dd($getTunai); - } - else - { - $bakiawal=0;$masuk=0;$yuran=0;$keluar=0;$baki=0;$tmbh=0;$kurang=0; - - $BakiAkhirT=0;$BakiAwalT=0;$tambahT=0; - - $getTunai2=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/GetCurrentTunai/'.$auth_user['cawangan'],['kodlaluan' => $kodlaluan])->json(); - $bakiAwal=$getTunai2['bakiawal']; - $keluar=$getTunai2['keluar']; - $baki=$getTunai2['baki']; - $kurangT=$getTunai2['kurang']; - $tam=$getTunai2['tambah']; - $masukT=$getTunai2['masuk']; - - if($bakiAwal==0) - { - $BakiAwalT=0; - } - else - { - $BakiAwalT=$bakiAwal; - } - - $tambahT=$tambah + $tam; - - $kurang=$kurangT; - $keluarT = $keluar; - // $bakiAkhirT= $bakiAwal + $tambahT + $masukT - $keluarT - $kurang; - $bakiAkhirT = $baki + $tambah; - - $updateTunai=Http::withOptions(['verify' => config('app.api_verify')])->put( config('api.url').'/api/updateTunai/'.$auth_user['cawangan'], [ - 'kodlaluan'=>$kodlaluan, - 'tambah'=>$tambahT, - 'kurang'=>$kurang, - 'bakiakhir'=>$bakiAkhirT - ]); - - $latestVault=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/VaultController/'.$auth_user['cawangan'])->json(); - $masukV=$latestVault[0]['masuk']; - $keluarV=$latestVault[0]['keluar']; - $pendahuluanV=$latestVault[0]['pendahuluan']; - $serahanV=$latestVault[0]['serahan']; - $bakiAwalV=$latestVault[0]['bakiawal']; - $totpanjar = $latestVault[0]['totpanjar']; - - // return; - // dd($tambahT); - // $keluarV=$tambahT; - $keluarV = $tambah + $keluarV; - - $GetLatestBakiTunai=Http::withOptions(['verify' => config('app.api_verify')])->get( config('api.url').'/api/getLatestBaki/'.$auth_user['cawangan'])->json(); - - $bakiTerkini=$GetLatestBakiTunai; - $bakiAkhirV=$bakiAwalV - $keluarV + $masukV + $pendahuluanV - $serahanV - $totpanjar; - // $bakiEOD=$bakiAkhirV+$GetLatestBakiTunai; //try test - $bakiEOD = $bakiAkhirV; - - // dd($bakiEOD); - // $createTempVault=Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/daftarVault/'.$auth_user['cawangan']); - - // dd($bakiAkhirV); - //get temporary latest vault/ petibesi - - - - $updateVault=Http::withOptions(['verify' => config('app.api_verify')])->put( config('api.url').'/api/UpdateVault/'.$auth_user['cawangan'],[ - - 'masuk'=>$masukV, - 'keluar'=>$keluarV, - 'bakiawal'=>$bakiAwalV, - 'bakiakhir'=>$bakiAkhirV, - 'bakieod'=>$bakiEOD - - ]); - - //-----PROCESS SELESAI----------------------------------- - //display final result - - return $this->denominasicalculationpendahuluan($request); - //dd($updateVault); - - - } //endif - - } //end - - } //End + } public function KemaskiniSerahan(Request $request) { @@ -1397,11 +1294,6 @@ class KhazanahController extends Controller if(sizeof($peti_besi_terkini) == 0) { $peti_besi_terkini=Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/daftarVault/'.$auth_user['cawangan'])->json(); - $baki_awal=$peti_besi_terkini["bakiakhir"]; - } - else - { - $baki_awal=$peti_besi_terkini[0]["bakiakhir"]; } $amount = $request->amt; @@ -3232,12 +3124,12 @@ class KhazanahController extends Controller $nombor = $request->no; $kodlaluan = $request->kodlaluan; - $updatebatal = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/requestTeller/batal/'.$kodcaw,[ + Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/requestTeller/batal/'.$kodcaw,[ 'no'=>$nombor, 'kodlaluan'=>$kodlaluan ]); - event(new PendahuluanSerahan("Batal",$auth_user['cawangan'],$kodlaluan)); + event(new PendahuluanSerahan("Batal","all",$auth_user['cawangan'],$kodlaluan)); return response('Berjaya'); } diff --git a/public/js/main.js b/public/js/main.js index e1620b1..a4fb40b 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -465,7 +465,8 @@ async function openuptambahdanserah(e) var channel = pusher.subscribe('pendahuluanserahan-notice'); channel.bind('penserahan-event', function(data) { - if(data.pengesahan === 'Lulus' && data.cawangan == kodcaw && data.kodlaluan == teller) + console.log(data); + if(data.pengesahan === 'Lulus' && data.jenis == 'pendahuluan' && data.cawangan == kodcaw && data.kodlaluan == teller) { Swal.fire({ icon: 'success', @@ -474,7 +475,7 @@ async function openuptambahdanserah(e) }).then(function(){ location.reload(); }); - }else{ + }else if(data.pengesahan == 'Batal' && data.jenis == 'all' && data.cawangan == kodcaw && data.kodlaluan == teller){ Swal.fire({ icon: 'error', title: 'Tambah Pendahuluan', @@ -482,6 +483,14 @@ async function openuptambahdanserah(e) }).then(function(){ location.reload(); }); + }else{ + Swal.fire({ + icon: 'error', + title: 'Tambah Pendahuluan', + text: 'Tambah Pendahuluan tidak berjaya!' + }).then(function(){ + location.reload(); + }); } @@ -630,7 +639,7 @@ function tambahdanserahanfunc(e) channel.bind('penserahan-event', function(data) { // let message = JSON.stringify(data); - if(data.pengesahan === 'Lulus' && data.cawangan == kodcaw && data.kodlaluan == teller) + if(data.pengesahan === 'Lulus' && data.jenis == 'serahan' && data.cawangan == kodcaw && data.kodlaluan == teller) { Swal.fire({ icon: 'success', @@ -640,6 +649,14 @@ function tambahdanserahanfunc(e) window.open(laporanroute, '_blank'); location.reload(); }); + }else if(data.pengesahan == 'Batal' && data.jenis == 'all' && data.cawangan == kodcaw && data.kodlaluan == teller){ + Swal.fire({ + icon: 'error', + title: 'Serahan Modal', + text: 'Serahan modal tidak diluluskan!' + }).then(function(){ + location.reload(); + }); }else{ Swal.fire({ icon: 'error', diff --git a/resources/views/khazanah/pendahuluan.blade.php b/resources/views/khazanah/pendahuluan.blade.php index 634b216..21b9472 100644 --- a/resources/views/khazanah/pendahuluan.blade.php +++ b/resources/views/khazanah/pendahuluan.blade.php @@ -16,7 +16,11 @@
- + @if (session('error')) +
+ {{ session('error') }} +
+ @endif
From f3020b33c59b4bae6f5fd75c3eddf649b4af42e4 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Mon, 4 Nov 2024 01:18:29 +0800 Subject: [PATCH 2/9] addded notification --- app/Events/Teller/NotifyDeposit.php | 34 +++++ .../Controllers/EventTriggerController.php | 20 +++ app/Http/Controllers/KhazanahController.php | 144 ++---------------- public/css/main.css | 19 +++ public/js/Class/SubscribePusher.js | 16 ++ public/js/main.js | 19 +++ public/js/notification.js | 75 +++++++++ .../views/homepage/khazanah/home.blade.php | 1 + resources/views/khazanah/menu.blade.php | 4 +- resources/views/layouts/app.blade.php | 4 + routes/web.php | 4 + 11 files changed, 204 insertions(+), 136 deletions(-) create mode 100644 app/Events/Teller/NotifyDeposit.php create mode 100644 app/Http/Controllers/EventTriggerController.php create mode 100644 public/js/Class/SubscribePusher.js create mode 100644 public/js/notification.js diff --git a/app/Events/Teller/NotifyDeposit.php b/app/Events/Teller/NotifyDeposit.php new file mode 100644 index 0000000..a10bc46 --- /dev/null +++ b/app/Events/Teller/NotifyDeposit.php @@ -0,0 +1,34 @@ +jenis = $jenis; + $this->cawangan = $cawangan; + $this->kodlaluan = $kodlaluan; + } + + public function broadcastOn() + { + return ['notify-deposit']; + } + + public function broadcastAs() + { + return 'deposit-event'; + } +} \ No newline at end of file diff --git a/app/Http/Controllers/EventTriggerController.php b/app/Http/Controllers/EventTriggerController.php new file mode 100644 index 0000000..37803d3 --- /dev/null +++ b/app/Http/Controllers/EventTriggerController.php @@ -0,0 +1,20 @@ +middleware('auth'); + } + + public function TellerCash(){ + event(new NotifyDeposit("pendahuluan",Auth::user()->cawangan,Auth::user()->name)); + } + + +} diff --git a/app/Http/Controllers/KhazanahController.php b/app/Http/Controllers/KhazanahController.php index c288fa2..5d2f2d3 100644 --- a/app/Http/Controllers/KhazanahController.php +++ b/app/Http/Controllers/KhazanahController.php @@ -1295,140 +1295,16 @@ class KhazanahController extends Controller { $peti_besi_terkini=Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/daftarVault/'.$auth_user['cawangan'])->json(); } - - $amount = $request->amt; - - $tarikh=$request->tarikh; - $kodlaluan=$request->teller; - - $kurang=$request->amt; - $nota=$request->nota; - $kodcaw=$auth_user['cawangan']; - $tambahT = 0; - $kurangvault = $request->amt; - - $addTunai=Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/add/addTunai/'.$auth_user['cawangan'],[ - 'kodcaw'=>$kodcaw, - 'kodlaluan'=>$kodlaluan, - 'tambah'=>$tambahT, - 'kurang'=>$kurang, - 'nota'=>$nota]); - - $getTunai=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/GetCurrentTunai/'.$auth_user['cawangan'],['kodlaluan' => $kodlaluan])->json(); - - if(sizeof($getTunai) == 0) - { - // dd($getTunai); - } - else - { - $getTunai2=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/GetCurrentTunai/'.$auth_user['cawangan'],['kodlaluan' => $kodlaluan])->json(); - $bakiAwalT=$getTunai2['bakiawal']; - $keluarT=$getTunai2['keluar']; - $baki=$getTunai2['baki']; - $tambahT=$getTunai2['tambah']; - $kurangT=$getTunai2['kurang']; - $masukT=$getTunai2['masuk']; - - $serahanakhir = $kurang; - $tambah_T=0;$kurang_T=0;$baki_AwalT=0.0; - - if($tambahT==0) - $tambah_T=0; - - else - $tambah_T=$tambahT; - - - if($kurangT==0) - $kurang_T=$kurang; - - else - { - $kurang=$kurang+$kurangT; - $kurang_T=$kurang; - } - - if($bakiAwalT==0) - $baki_AwalT=0; - - else - $baki_AwalT=$bakiAwalT; - - //$bakiAkhirT=$baki_AwalT+$tambah_T+$masukT-$keluarT-$kurang_T; //untuk kegunaan urgent - $bakiAkhirT = $baki - $serahanakhir; - - $updateTunai=Http::withOptions(['verify' => config('app.api_verify')])->put( config('api.url').'/api/updateTunai/'.$auth_user['cawangan'], [ - 'kodlaluan'=>$kodlaluan, - 'tambah'=>$tambah_T, - 'kurang'=>$kurang_T, - 'bakiakhir'=>$bakiAkhirT - ]); - - - $latestVault=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/VaultController/'.$auth_user['cawangan'])->json(); - - $masukV=$latestVault[0]['masuk']; - $keluarV=$latestVault[0]['keluar']; - $pendahuluanV=$latestVault[0]['pendahuluan']; - $serahanV=$latestVault[0]['serahan']; - $bakiAwalV=$latestVault[0]['bakiawal']; - $totpanjar = $latestVault[0]['totpanjar']; - - - $masuk_V = 0;$pendahuluan_V = 0;$keluar_V = 0;$serahan_V = 0; - - if($masukV == 0) - { - $masuk_V = 0 + $kurangvault; - } - else - { - $masuk_V = $masukV + $kurangvault; - } - - if($keluarV == 0) - $keluar_V = 0; - - else - $keluar_V=$keluarV; - - - if($pendahuluanV == 0) - $pendahuluan_V = 0; - - else - $pendahuluan_V = $pendahuluanV; - - - if($serahanV == 0) - $serahan_V = 0; - - else - $serahan_V = $serahanV; - - } - - $GetLatestBakiTunai=Http::withOptions(['verify' => config('app.api_verify')])->get( config('api.url').'/api/getLatestBaki/'.$auth_user['cawangan'])->json(); - $sumBaki=$GetLatestBakiTunai; - - - $bakiAkhirV = $bakiAwalV - $keluar_V + $masuk_V + $pendahuluan_V - $serahan_V - $totpanjar; - - $BakiEOD=$bakiAkhirV; - //$BakiEOD=$bakiAkhirV+$sumBaki; - - $updateVault=Http::withOptions(['verify' => config('app.api_verify')])->put( config('api.url').'/api/UpdateVault/'.$auth_user['cawangan'],[ - 'masuk'=>$masuk_V, - 'keluar'=>$keluar_V, - 'bakiawal'=>$bakiAwalV, - 'bakiakhir'=>$bakiAkhirV, - 'bakieod'=>$BakiEOD - ]); - - //--FINAL RESULT...KENA RIDERECT KE PAGE SEBELUMNYA.. - - return $this->denominasicalculationserahan($request); + $response_data = $request->except('_token'); + $test = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/test/serahantunai/'.$auth_user['cawangan'],$response_data)->json(); + + if($test == 'success'){ + event(new PendahuluanSerahan("Lulus","serahan",$auth_user['cawangan'],$request->teller)); + return redirect()->route('khazanah.serahan'); + }else{ + return redirect()->route('khazanah.serahan')->with('error','Permohonan tidak berjaya! Permohonan Semula perlu melebihi 1 minit.'); + } + } diff --git a/public/css/main.css b/public/css/main.css index 7c3b343..5baef76 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -94,3 +94,22 @@ span#basic-hargaemas { padding: 5px 10px; text-align: center; } + + @keyframes heartbeat { + 0% { + transform: scale(1); + } + 30% { + transform: scale(1.2); + } + 60% { + transform: scale(1); + } + 100% { + transform: scale(1); + } +} + +.heartbeat { + animation: heartbeat 1s infinite; +} diff --git a/public/js/Class/SubscribePusher.js b/public/js/Class/SubscribePusher.js new file mode 100644 index 0000000..7778361 --- /dev/null +++ b/public/js/Class/SubscribePusher.js @@ -0,0 +1,16 @@ +class SubscribePusher { + constructor(subscribe, event, apikey) { + this.subscribe = subscribe; + this.event = event; + this.apikey = apikey; + } + + channel_subscribe() { + let channel = pusher.subscribe(this.subscribe); + channel.bind(this.event, function(data){ + callback(data); + }); + } +} + +export default SubscribePusher; \ No newline at end of file diff --git a/public/js/main.js b/public/js/main.js index a4fb40b..d40633b 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -434,6 +434,17 @@ async function openuptambahdanserah(e) } else { + $.ajax({ + method: "GET", + url: "{{ route('event.tellercash') }}", + success:function(data){ + console.log('successfull trigger'); + }, + error: function(xhRequest, ajaxOptions, thrownError){ + console.log(xhRequest,thrownError); + } + }) + $.ajax({ method:"POST", url: api_url + '/api/requestTeller/' + kodcaw, @@ -589,6 +600,14 @@ function tambahdanserahanfunc(e) if(id == "serahanmodal") { + $.ajax({ + method: "GET", + url: "{{ route('event.tellercash') }}", + success:function(data){ + console.log('successfull trigger'); + } + }) + $.ajax({ method:"POST", url: api_url + '/api/requestTeller/' + kodcaw, diff --git a/public/js/notification.js b/public/js/notification.js new file mode 100644 index 0000000..c585000 --- /dev/null +++ b/public/js/notification.js @@ -0,0 +1,75 @@ +import NotifyKhazanah from './Class/SubscribePusher.js'; + +let channel = 'notify-deposit'; +let event = 'deposit-event'; +let apikey = "{{ env('PUSHER_APP_KEY') }}"; +let api = "{{ config('api.url') }}"; +let kodcaw = "{{ Auth::user()->kodcaw }}"; + +let requestApi = (url, method, datarequest, callback) => { + $.ajax({ + method: method, + url: url, + data: datarequest, + success: function(data) { + callback(data); + }, + error: function(xhRequest, ajaxOptions, thrownError) { + console.error("Request failed:", xhRequest, thrownError); + } + }); +}; + +let triggerPage = () =>{ + const notify = new NotifyKhazanah(channel,event,apikey); + notify.channel_subscribe((data) => { + console.log(data); + + const currentPath = window.location.pathname; + + if (currentPath === "/home") { + notify_main(); + } else if (currentPath === "/menu") { + notify_khazanah_main(); + }else if(currentPath === '/pendahuluan'){ + notify_pendahuluan(); + }else if(currentPath === '/serahan'){ + notify_serahan(); + } + + }); +} + +let notify_main = () =>{ + const button = document.getElementById("btn-khazanah"); + + if(!button){ + return; + } + + button.classList.add('btn-danger'); + button.classList.add('heartbeat'); +} + +let notify_khazanah_main = () =>{ + requestApi(api + '/api/requestTeller/get/' + kodcaw,"GET",{}, (response) =>{ + let countModal = 0; + let countSerahan = 0; + + response.forEach((req) => { + if (req.modal !== 0) { + countModal++; + } else if (req.serahan !== 0) { + countSerahan++; + } + }); + }); +} + +let notify_pendahuluan = () =>{ + +} + +let notify_serahan = () =>{ + +} diff --git a/resources/views/homepage/khazanah/home.blade.php b/resources/views/homepage/khazanah/home.blade.php index bcb1270..66578f8 100644 --- a/resources/views/homepage/khazanah/home.blade.php +++ b/resources/views/homepage/khazanah/home.blade.php @@ -255,6 +255,7 @@
diff --git a/resources/views/khazanah/menu.blade.php b/resources/views/khazanah/menu.blade.php index dfa8713..95c8a11 100644 --- a/resources/views/khazanah/menu.blade.php +++ b/resources/views/khazanah/menu.blade.php @@ -18,9 +18,9 @@ Penyelesaian Pem. {{ count($listserah) }} - Pendahuluan {{ $countmodal }} + Pendahuluan {{ $countmodal }} - Serahan {{ $countserahan }} + Serahan {{ $countserahan }}
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 4d974ac..f01e6e3 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -49,6 +49,10 @@ {{-- Pusher --}} + @if(Auth::user()->role_harian == 'khazanah') + + @endif + @endif From dae6ba55a6c15094d10af971a3ae09b3fc11b43c Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Wed, 6 Nov 2024 19:44:08 +0800 Subject: [PATCH 4/9] fix perubatan --- app/Http/Controllers/KhazanahController.php | 14 ++++---- app/Http/Controllers/PerubatanController.php | 27 ++++++++++++++ ...6_000000_add_users_perubatanasal_table.php | 35 +++++++++++++++++++ .../views/homepage/operasi/home.blade.php | 1 + .../views/operasi/perubatan/index.blade.php | 34 ++++++++++++++++++ routes/web.php | 3 ++ 6 files changed, 107 insertions(+), 7 deletions(-) create mode 100644 app/Http/Controllers/PerubatanController.php create mode 100644 database/migrations/2024_11_06_000000_add_users_perubatanasal_table.php create mode 100644 resources/views/operasi/perubatan/index.blade.php diff --git a/app/Http/Controllers/KhazanahController.php b/app/Http/Controllers/KhazanahController.php index 6eb13d0..c82629a 100644 --- a/app/Http/Controllers/KhazanahController.php +++ b/app/Http/Controllers/KhazanahController.php @@ -770,21 +770,21 @@ class KhazanahController extends Controller $request->merge(['kodlaluan' => $auth_user['name']]); $data_request = $request->except('_token'); - dd($data_request); - $updatepanjar = Http::withOptions(['verify' => config('app.api_verify')])->post( config('api.url') .'/api/test/createpanjar/'. $auth_user['cawangan'],$data_request)->json(); + $updatepanjar = Http::withOptions(['verify' => config('app.api_verify')])->post( config('api.url') .'/api/test/deletepanjar/'. $auth_user['cawangan'],$data_request)->json(); + if($updatepanjar['result'] == 'success') { - if($denopanjar['jenis'] === 'perubatan') + if($updatepanjar['jenis'] === 'perubatan') { - $listUser = User::where('name','=',$senaraipanjar['tuntutoleh'])->get(); + $listUser = User::where('name','=',$updatepanjar['tuntutoleh'])->get(); - $totalsebenar = floatval($listUser[0]->perubatan) + floatval($denopanjar['serahan']); + // $totalsebenar = floatval($listUser[0]->perubatan) + floatval($denopanjar['serahan']); $overrideuser = User::where('cawangan','=',$auth_user['cawangan']) - ->where('name','=',$senaraipanjar['tuntutoleh']) + ->where('name','=',$updatepanjar['tuntutoleh']) ->update(array( - 'perubatan' => $bakiperubatan + 'perubatan' => $updatepanjar['bakiperubatan'] )); } diff --git a/app/Http/Controllers/PerubatanController.php b/app/Http/Controllers/PerubatanController.php new file mode 100644 index 0000000..3c896f0 --- /dev/null +++ b/app/Http/Controllers/PerubatanController.php @@ -0,0 +1,27 @@ +middleware('auth'); + } + + public function index(){ + $api_url = config('api.url'); + $auth_user = Auth::user(); + $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); + + $paginate = User::paginate(5); + + return view('operasi.perubatan.index',compact('cawangan_info','api_url','auth_user','paginate')); + + } +} diff --git a/database/migrations/2024_11_06_000000_add_users_perubatanasal_table.php b/database/migrations/2024_11_06_000000_add_users_perubatanasal_table.php new file mode 100644 index 0000000..2dc1c89 --- /dev/null +++ b/database/migrations/2024_11_06_000000_add_users_perubatanasal_table.php @@ -0,0 +1,35 @@ +decimal('perubatan_asal', 11, 2); + } + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + // public function down() + // { + // Schema::dropIfExists('users'); + // } +} diff --git a/resources/views/homepage/operasi/home.blade.php b/resources/views/homepage/operasi/home.blade.php index a4135e9..a86275b 100644 --- a/resources/views/homepage/operasi/home.blade.php +++ b/resources/views/homepage/operasi/home.blade.php @@ -18,6 +18,7 @@ Kakitangan Parameter Komoditi + Perubatan diff --git a/resources/views/operasi/perubatan/index.blade.php b/resources/views/operasi/perubatan/index.blade.php new file mode 100644 index 0000000..d8459f5 --- /dev/null +++ b/resources/views/operasi/perubatan/index.blade.php @@ -0,0 +1,34 @@ +@extends('layouts.app_operasi') + +@section('content') +
+
+
+
+ + + +
+ @foreach($paginate as $page) +
+

{{ $page->name }}

+

{{ $page->perubatan }}

+

{{ $page->perubatan_asal }}

+
+ @endforeach + + + +
+
+
+
+
+@endsection diff --git a/routes/web.php b/routes/web.php index 9a312fc..5d56b03 100644 --- a/routes/web.php +++ b/routes/web.php @@ -475,4 +475,7 @@ Route::get('supports/driver/mykad-reader/download',['as'=>'mykadreader.driver.do Route::get('/event/tellercash',['as'=>'event.tellercash','uses'=>'EventTriggerController@TellerCash'])->middleware('auth'); +/* Perubatan */ +Route::get('/perubatan',['as'=>'perubatan','uses'=>'PerubatanController@index'])->middleware('auth','operasi'); + From adc62b2ba2b20b2057152e9358d9bcf29e5b5d53 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Thu, 7 Nov 2024 01:16:32 +0800 Subject: [PATCH 5/9] add scaffold for perubatan --- app/Http/Controllers/PerubatanController.php | 19 ++++ public/js/perubatan.js | 17 +++ .../views/operasi/perubatan/index.blade.php | 46 ++++++-- .../vendor/pagination/bootstrap-4.blade.php | 47 ++++++++ .../views/vendor/pagination/default.blade.php | 46 ++++++++ .../vendor/pagination/semantic-ui.blade.php | 36 +++++++ .../pagination/simple-bootstrap-4.blade.php | 27 +++++ .../pagination/simple-default.blade.php | 19 ++++ .../pagination/simple-tailwind.blade.php | 25 +++++ .../vendor/pagination/tailwind.blade.php | 102 ++++++++++++++++++ routes/web.php | 1 + 11 files changed, 378 insertions(+), 7 deletions(-) create mode 100644 public/js/perubatan.js create mode 100644 resources/views/vendor/pagination/bootstrap-4.blade.php create mode 100644 resources/views/vendor/pagination/default.blade.php create mode 100644 resources/views/vendor/pagination/semantic-ui.blade.php create mode 100644 resources/views/vendor/pagination/simple-bootstrap-4.blade.php create mode 100644 resources/views/vendor/pagination/simple-default.blade.php create mode 100644 resources/views/vendor/pagination/simple-tailwind.blade.php create mode 100644 resources/views/vendor/pagination/tailwind.blade.php diff --git a/app/Http/Controllers/PerubatanController.php b/app/Http/Controllers/PerubatanController.php index 3c896f0..ac50416 100644 --- a/app/Http/Controllers/PerubatanController.php +++ b/app/Http/Controllers/PerubatanController.php @@ -24,4 +24,23 @@ class PerubatanController extends Controller return view('operasi.perubatan.index',compact('cawangan_info','api_url','auth_user','paginate')); } + + public function search(Request $request){ + $api_url = config('api.url'); + $auth_user = Auth::user(); + $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); + + + $search = $request->input('search'); + + $query = User::query(); + + if ($search) { + $query->where('name', 'LIKE', "%{$search}%"); + } + $paginate = $query->paginate(5); + $paginate->appends($request->all()); + + return view('operasi.perubatan.index',compact('cawangan_info','api_url','auth_user','paginate')); + } } diff --git a/public/js/perubatan.js b/public/js/perubatan.js new file mode 100644 index 0000000..c78ddd3 --- /dev/null +++ b/public/js/perubatan.js @@ -0,0 +1,17 @@ +let editfunc = () => { + document.getElementById('editButton').style.display = 'none'; + document.getElementById('saveButton').style.display = 'block'; + document.getElementById('cancelButton').style.display = 'block'; +} + +let savefunc = () => { + document.getElementById('editButton').style.display = 'block'; + document.getElementById('saveButton').style.display = 'none'; + document.getElementById('cancelButton').style.display = 'none'; +} + +let cancelfunc = () => { + document.getElementById('editButton').style.display = 'block'; + document.getElementById('saveButton').style.display = 'none'; + document.getElementById('cancelButton').style.display = 'none'; +} \ No newline at end of file diff --git a/resources/views/operasi/perubatan/index.blade.php b/resources/views/operasi/perubatan/index.blade.php index d8459f5..eca0334 100644 --- a/resources/views/operasi/perubatan/index.blade.php +++ b/resources/views/operasi/perubatan/index.blade.php @@ -14,15 +14,46 @@
- @foreach($paginate as $page) -
-

{{ $page->name }}

-

{{ $page->perubatan }}

-

{{ $page->perubatan_asal }}

+
+
+ + +
+ + + + + + + + + + + + + @foreach($paginate as $page) + + + + + + + + @endforeach + +
#NamaBaki PerubatanPerubatanTindakan
{{ ($paginate->currentPage() - 1) * $paginate->perPage() + $loop->index + 1 }}{{ $page->name }}{{ $page->perubatan }} + {{ $page->perubatan_asal }} + + + Edit +
+ Save + Cancel +
+
- @endforeach -
+ @endsection diff --git a/resources/views/vendor/pagination/bootstrap-4.blade.php b/resources/views/vendor/pagination/bootstrap-4.blade.php new file mode 100644 index 0000000..0b4defb --- /dev/null +++ b/resources/views/vendor/pagination/bootstrap-4.blade.php @@ -0,0 +1,47 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/resources/views/vendor/pagination/default.blade.php b/resources/views/vendor/pagination/default.blade.php new file mode 100644 index 0000000..0db70b5 --- /dev/null +++ b/resources/views/vendor/pagination/default.blade.php @@ -0,0 +1,46 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/resources/views/vendor/pagination/semantic-ui.blade.php b/resources/views/vendor/pagination/semantic-ui.blade.php new file mode 100644 index 0000000..ef0dbb1 --- /dev/null +++ b/resources/views/vendor/pagination/semantic-ui.blade.php @@ -0,0 +1,36 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/resources/views/vendor/pagination/simple-bootstrap-4.blade.php b/resources/views/vendor/pagination/simple-bootstrap-4.blade.php new file mode 100644 index 0000000..4bb4917 --- /dev/null +++ b/resources/views/vendor/pagination/simple-bootstrap-4.blade.php @@ -0,0 +1,27 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/resources/views/vendor/pagination/simple-default.blade.php b/resources/views/vendor/pagination/simple-default.blade.php new file mode 100644 index 0000000..36bdbc1 --- /dev/null +++ b/resources/views/vendor/pagination/simple-default.blade.php @@ -0,0 +1,19 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/resources/views/vendor/pagination/simple-tailwind.blade.php b/resources/views/vendor/pagination/simple-tailwind.blade.php new file mode 100644 index 0000000..1c5e52f --- /dev/null +++ b/resources/views/vendor/pagination/simple-tailwind.blade.php @@ -0,0 +1,25 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/resources/views/vendor/pagination/tailwind.blade.php b/resources/views/vendor/pagination/tailwind.blade.php new file mode 100644 index 0000000..4b92aab --- /dev/null +++ b/resources/views/vendor/pagination/tailwind.blade.php @@ -0,0 +1,102 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/routes/web.php b/routes/web.php index 5d56b03..64560a4 100644 --- a/routes/web.php +++ b/routes/web.php @@ -477,5 +477,6 @@ Route::get('/event/tellercash',['as'=>'event.tellercash','uses'=>'EventTriggerCo /* Perubatan */ Route::get('/perubatan',['as'=>'perubatan','uses'=>'PerubatanController@index'])->middleware('auth','operasi'); +Route::get('/perubatan/search',['as'=>'perubatan.search','uses'=>'PerubatanController@search'])->middleware('auth','operasi'); From 4c113cb0521696573f11f2f7c7c8c32ded07d096 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Thu, 7 Nov 2024 16:27:59 +0800 Subject: [PATCH 6/9] add function in perubatan.js --- app/Http/Controllers/KhazanahController.php | 15 ++--- public/js/perubatan.js | 57 +++++++++++++++---- .../views/operasi/perubatan/index.blade.php | 13 +++-- 3 files changed, 60 insertions(+), 25 deletions(-) diff --git a/app/Http/Controllers/KhazanahController.php b/app/Http/Controllers/KhazanahController.php index c82629a..b5b1eaf 100644 --- a/app/Http/Controllers/KhazanahController.php +++ b/app/Http/Controllers/KhazanahController.php @@ -745,11 +745,11 @@ class KhazanahController extends Controller if($request->jenismodal === 'perubatan') { $listUser=User::where('name','=',$request->tuntutan)->get(); - // $totalsebenar = floatval($listUser[0]->perubatan) - floatval($request->bayaran); - $overrideuser = User::where('cawangan','=',$auth_user['cawangan']) + $totalsebenar = floatval($listUser[0]->perubatan_asal) - floatval($updatepanjar['bakiperubatan']); + User::where('cawangan','=',$auth_user['cawangan']) ->where('name','=',$request->tuntutan) ->update(array( - 'perubatan' => $updatepanjar['bakiperubatan'] + 'perubatan' => $totalsebenar )); } @@ -777,14 +777,15 @@ class KhazanahController extends Controller { if($updatepanjar['jenis'] === 'perubatan') { - $listUser = User::where('name','=',$updatepanjar['tuntutoleh'])->get(); + $listUser = User::where('name','=',$updatepanjar['tuntutoleh'])->first(); + $listUser = optional($listUser)->toArray(); - // $totalsebenar = floatval($listUser[0]->perubatan) + floatval($denopanjar['serahan']); + $totalsebenar = floatval($listUser['perubatan_asal']) + $updatepanjar['bakiperubatan']; - $overrideuser = User::where('cawangan','=',$auth_user['cawangan']) + User::where('cawangan','=',$auth_user['cawangan']) ->where('name','=',$updatepanjar['tuntutoleh']) ->update(array( - 'perubatan' => $updatepanjar['bakiperubatan'] + 'perubatan' => $totalsebenar )); } diff --git a/public/js/perubatan.js b/public/js/perubatan.js index c78ddd3..761280a 100644 --- a/public/js/perubatan.js +++ b/public/js/perubatan.js @@ -1,17 +1,50 @@ -let editfunc = () => { - document.getElementById('editButton').style.display = 'none'; - document.getElementById('saveButton').style.display = 'block'; - document.getElementById('cancelButton').style.display = 'block'; +let editfunc = (pageid) => { + let editbtn = document.getElementById('divedit-' + pageid); + let divbtn = document.getElementById('div-' + pageid); + let inputbtn = document.getElementById('input-' + pageid); + + if(editbtn.classList.contains('d-block')){ + editbtn.classList.remove('d-block'); + editbtn.classList.add('d-none'); + } + + if(divbtn.classList.contains('d-none')){ + divbtn.classList.remove('d-none'); + divbtn.classList.add('d-block'); + } + inputbtn.disabled = false; + } -let savefunc = () => { - document.getElementById('editButton').style.display = 'block'; - document.getElementById('saveButton').style.display = 'none'; - document.getElementById('cancelButton').style.display = 'none'; +let savefunc = (pageid) => { + // let editbtn = document.getElementById('editButton-' + pageid); + // let divbtn = document.getElementById('div-' + pageid); + + // if(editbtn.classList.contains('d-block')){ + // editbtn.classList.remove('d-block'); + // editbtn.classList.add('d-none'); + // } + + // if(divbtn.classList.contains('d-none')){ + // divbtn.classList.remove('d-none'); + // divbtn.classList.add('d-block'); + // } } -let cancelfunc = () => { - document.getElementById('editButton').style.display = 'block'; - document.getElementById('saveButton').style.display = 'none'; - document.getElementById('cancelButton').style.display = 'none'; +let cancelfunc = (pageid) => { + let editbtn = document.getElementById('divedit-' + pageid); + let divbtn = document.getElementById('div-' + pageid); + let inputbtn = document.getElementById('input-' + pageid); + + if(editbtn.classList.contains('d-none')){ + editbtn.classList.remove('d-none'); + editbtn.classList.add('d-block'); + } + + if(divbtn.classList.contains('d-block')){ + divbtn.classList.remove('d-block'); + divbtn.classList.add('d-none'); + } + + inputbtn.disabled = true; } \ No newline at end of file diff --git a/resources/views/operasi/perubatan/index.blade.php b/resources/views/operasi/perubatan/index.blade.php index eca0334..fb5b131 100644 --- a/resources/views/operasi/perubatan/index.blade.php +++ b/resources/views/operasi/perubatan/index.blade.php @@ -37,14 +37,15 @@ {{ $page->name }} {{ $page->perubatan }} - {{ $page->perubatan_asal }} - + - Edit -
- Save - Cancel +
+ Edit +
+
+ Save + Cancel
From c4388321aaa7ec205f197e630b0f84ef1ba2dc21 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Fri, 8 Nov 2024 22:00:17 +0800 Subject: [PATCH 7/9] finished notification --- .../Controllers/AliranTunaiController.php | 53 ++ app/Http/Controllers/KhazanahController.php | 10 +- public/js/Class/SubscribePusher.js | 8 +- public/js/main.js | 4 +- public/js/notification.js | 85 ++- resources/views/aliran_tunai/index.blade.php | 10 + .../laporan/laporanrekodteller.blade.php | 546 ++++++++++++++++++ resources/views/layouts/app.blade.php | 7 +- routes/web.php | 1 + 9 files changed, 688 insertions(+), 36 deletions(-) create mode 100644 resources/views/aliran_tunai/laporan/laporanrekodteller.blade.php diff --git a/app/Http/Controllers/AliranTunaiController.php b/app/Http/Controllers/AliranTunaiController.php index b31b784..2e0d19d 100644 --- a/app/Http/Controllers/AliranTunaiController.php +++ b/app/Http/Controllers/AliranTunaiController.php @@ -624,5 +624,58 @@ class AliranTunaiController extends Controller return view('aliran_tunai.laporan.laporanalirantunai',compact('tarikh_cetak','cawangan_info','cawangan','api_url','cawangan_detail','addtunai','alirantunai','teller')); } + public function LaporanTunaiTeller(Request $request){ + + + $auth_user = Auth::user(); + $api_url = config('api.url'); + + $current = Carbon::now(); + $current = new Carbon(); + + $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); + $cawangan=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/cawangan/detail/'.$auth_user['cawangan'])->json(); + $cawangan_detail=$cawangan[0]; + + $tarikh_cetak = $current->toDateString(); + + $array_requestteller = []; + //wang Syilling Initialize + $rekodsen1 = 0; $rekodsen5 = 0; $rekodsen10 = 0; + $rekodsen20 = 0; $rekodsen50 = 0; + + //Wang Ringgit Initialize + $rekodring1 = 0; $rekodring5 = 0; $rekodring10 = 0; + $rekodring20 = 0; $rekodring50 = 0; $rekodring100 = 0; + + $requestteller = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/requestTeller/getrekod/'.$auth_user['cawangan'],["teller" => Auth::user()->name,"recno" => $request->recno ])->json(); + if($requestteller[0]['modal'] != 0){ + $jenisserah = 'pendahuluan'; + }else{ + $jenisserah = 'serahan'; + } + + foreach($requestteller as $index => $reqtel) + { + $rekodsen1 += $reqtel['txtsen1']; + $rekodsen5 += $reqtel['txtsen5']; + $rekodsen10 += $reqtel['txtsen10']; + $rekodsen20 += $reqtel['txtsen20']; + $rekodsen50 += $reqtel['txtsen50']; + + $rekodring1 += $reqtel['txtring1']; + $rekodring5 += $reqtel['txtring5']; + $rekodring10 += $reqtel['txtring10']; + $rekodring20 += $reqtel['txtring20']; + $rekodring50 += $reqtel['txtring50']; + $rekodring100 += $reqtel['txtring100']; + } + + array_push($array_requestteller,[ "rekodsen1" => $rekodsen1,"rekodsen5" => $rekodsen5,"rekodsen10" => $rekodsen10,"rekodsen20" => $rekodsen20,"rekodsen50" => $rekodsen50 + ,"rekodring1" => $rekodring1,"rekodring5" => $rekodring5,"rekodring10" => $rekodring10,"rekodring20" => $rekodring20,"rekodring50" => $rekodring50,"rekodring100" => $rekodring100]); + + return view('aliran_tunai.laporan.laporanrekodteller',compact('tarikh_cetak','cawangan_info','cawangan','api_url','cawangan_detail','array_requestteller','jenisserah')); + } + } diff --git a/app/Http/Controllers/KhazanahController.php b/app/Http/Controllers/KhazanahController.php index b5b1eaf..d8ac351 100644 --- a/app/Http/Controllers/KhazanahController.php +++ b/app/Http/Controllers/KhazanahController.php @@ -28,6 +28,7 @@ use Carbon\Carbon; use PDF; use DateTime; use App\Helper; +use Log; class KhazanahController extends Controller { @@ -744,8 +745,9 @@ class KhazanahController extends Controller { if($request->jenismodal === 'perubatan') { - $listUser=User::where('name','=',$request->tuntutan)->get(); - $totalsebenar = floatval($listUser[0]->perubatan_asal) - floatval($updatepanjar['bakiperubatan']); + $listUser = User::where('name','=',$request->tuntutan)->first(); + $listUser = optional($listUser)->toArray(); + $totalsebenar = floatval($listUser['perubatan_asal']) - floatval($updatepanjar['totalperubatan']); User::where('cawangan','=',$auth_user['cawangan']) ->where('name','=',$request->tuntutan) ->update(array( @@ -779,9 +781,7 @@ class KhazanahController extends Controller { $listUser = User::where('name','=',$updatepanjar['tuntutoleh'])->first(); $listUser = optional($listUser)->toArray(); - - $totalsebenar = floatval($listUser['perubatan_asal']) + $updatepanjar['bakiperubatan']; - + $totalsebenar = floatval($listUser['perubatan_asal']) - floatval($updatepanjar['totalperubatan']); User::where('cawangan','=',$auth_user['cawangan']) ->where('name','=',$updatepanjar['tuntutoleh']) ->update(array( diff --git a/public/js/Class/SubscribePusher.js b/public/js/Class/SubscribePusher.js index 7778361..ec27795 100644 --- a/public/js/Class/SubscribePusher.js +++ b/public/js/Class/SubscribePusher.js @@ -3,14 +3,18 @@ class SubscribePusher { this.subscribe = subscribe; this.event = event; this.apikey = apikey; + this.pusher = new Pusher(this.apikey, { + cluster: 'ap1', // Replace 'your_cluster' with the actual cluster of your Pusher app + }); } - channel_subscribe() { - let channel = pusher.subscribe(this.subscribe); + channel_subscribe(callback) { + let channel = this.pusher.subscribe(this.subscribe); channel.bind(this.event, function(data){ callback(data); }); } } + export default SubscribePusher; \ No newline at end of file diff --git a/public/js/main.js b/public/js/main.js index d40633b..32041b6 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -436,7 +436,7 @@ async function openuptambahdanserah(e) { $.ajax({ method: "GET", - url: "{{ route('event.tellercash') }}", + url: event_tellercash, success:function(data){ console.log('successfull trigger'); }, @@ -602,7 +602,7 @@ function tambahdanserahanfunc(e) $.ajax({ method: "GET", - url: "{{ route('event.tellercash') }}", + url: event_tellercash, success:function(data){ console.log('successfull trigger'); } diff --git a/public/js/notification.js b/public/js/notification.js index c585000..5655959 100644 --- a/public/js/notification.js +++ b/public/js/notification.js @@ -1,10 +1,40 @@ import NotifyKhazanah from './Class/SubscribePusher.js'; - let channel = 'notify-deposit'; let event = 'deposit-event'; -let apikey = "{{ env('PUSHER_APP_KEY') }}"; -let api = "{{ config('api.url') }}"; -let kodcaw = "{{ Auth::user()->kodcaw }}"; +let apikey = window.apikey; + +const Toast = Swal.mixin({ + toast: true, + position: 'top-end', + showConfirmButton: false, + timer: 5000, + timerProgressBar: true, + didOpen: (toast) => { + toast.addEventListener('mouseenter', Swal.stopTimer) + toast.addEventListener('mouseleave', Swal.resumeTimer) + } +}) + +const notify = new NotifyKhazanah(channel,event,apikey); +notify.channel_subscribe((data) => { + console.log(data); + Toast.fire({ + icon: 'info', + title: 'Permohonan Kelulusan Wang Tunai Teller!' + }); + const currentPath = window.location.pathname; + + if (currentPath === "/home") { + notify_main(); + } else if (currentPath === "/menu") { + notify_khazanah_main(); + }else if(currentPath === '/pendahuluan'){ + notify_pendahuluan(); + }else if(currentPath === '/serahan'){ + notify_serahan(); + } + +}); let requestApi = (url, method, datarequest, callback) => { $.ajax({ @@ -20,25 +50,6 @@ let requestApi = (url, method, datarequest, callback) => { }); }; -let triggerPage = () =>{ - const notify = new NotifyKhazanah(channel,event,apikey); - notify.channel_subscribe((data) => { - console.log(data); - - const currentPath = window.location.pathname; - - if (currentPath === "/home") { - notify_main(); - } else if (currentPath === "/menu") { - notify_khazanah_main(); - }else if(currentPath === '/pendahuluan'){ - notify_pendahuluan(); - }else if(currentPath === '/serahan'){ - notify_serahan(); - } - - }); -} let notify_main = () =>{ const button = document.getElementById("btn-khazanah"); @@ -52,7 +63,7 @@ let notify_main = () =>{ } let notify_khazanah_main = () =>{ - requestApi(api + '/api/requestTeller/get/' + kodcaw,"GET",{}, (response) =>{ + requestApi(window.api + '/api/requestTeller/get/' + window.kodcaw,"GET",{}, (response) =>{ let countModal = 0; let countSerahan = 0; @@ -63,13 +74,35 @@ let notify_khazanah_main = () =>{ countSerahan++; } }); + + let btn_serahan = document.getElementById('btn-ser'); + let btn_pendahuluan = document.getElementById('btn-pend'); + let span_element_ser = btn_serahan.querySelector('span'); + let span_element_pend = btn_pendahuluan.querySelector('span'); + + if(!btn_serahan.classList.contains('btn-danger') && countSerahan > 0){ + btn_serahan.classList.add('btn-danger'); + span_element_ser.innerText = countSerahan; + } + + if(!btn_pendahuluan.classList.contains('btn-danger') && countModal > 0){ + btn_pendahuluan.classList.add('btn-danger'); + span_element_pend.innerText = countModal; + } + }); } let notify_pendahuluan = () =>{ - + timer_reload(); } let notify_serahan = () =>{ - + timer_reload(); +} + +let timer_reload = () =>{ + setTimeout(() => { + window.location.reload(); + }, 3000); } diff --git a/resources/views/aliran_tunai/index.blade.php b/resources/views/aliran_tunai/index.blade.php index a8dedd0..b19e2ea 100644 --- a/resources/views/aliran_tunai/index.blade.php +++ b/resources/views/aliran_tunai/index.blade.php @@ -214,6 +214,7 @@ Debit (RM) Kredit (RM) Nota + Tindakan @@ -225,6 +226,7 @@ {{ number_format($at['tambah'],2) }} {{ number_format($at['kurang'],2) }} {{ $at['nota'] }} + @endforeach @endif @@ -602,8 +604,16 @@ }); } + function rekodprint(recno){ + + let urlroute = '{{ route("laporan.tunaiteller") }}'; + urlroute += '?recno=' + encodeURIComponent(recno); + window.open(urlroute, '_blank'); + } + let pusherenv = "{{ env('PUSHER_APP_KEY') }}"; let laporanroute = "{{ route('laporan.serahantellerberkala') }}"; + let event_tellercash = "{{ route('event.tellercash') }}"; @endsection diff --git a/resources/views/aliran_tunai/laporan/laporanrekodteller.blade.php b/resources/views/aliran_tunai/laporan/laporanrekodteller.blade.php new file mode 100644 index 0000000..5ed231c --- /dev/null +++ b/resources/views/aliran_tunai/laporan/laporanrekodteller.blade.php @@ -0,0 +1,546 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
Laporan Pemeriksaan Wang Peti Besi (Cash Box)
+ + + + + +
+ + + + +
ID {{ (Auth::user()->name) ? Auth::user()->name : ''}} Jenis {{ strtoupper($jenisserah) }}
Tarikh Laporan {{ $tarikh_cetak }} Tarikh Cetak {{ $tarikh_cetak }}
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RMKUANTITIJUMLAH (RM)
RM100{{ $array_requestteller[0]['rekodring100'] }}@php $totalsemua = 0; $total = ($array_requestteller[0]['rekodring100'] * 100); $totalsemua += $total; echo number_format($total,2); @endphp
RM 50{{ $array_requestteller[0]['rekodring50'] }}@php $total = ($array_requestteller[0]['rekodring50'] * 50); $totalsemua += $total; echo number_format($total,2); @endphp
RM 20{{ $array_requestteller[0]['rekodring20'] }}@php $total = ($array_requestteller[0]['rekodring20'] * 20); $totalsemua += $total; echo number_format($total,2); @endphp
RM 10{{ $array_requestteller[0]['rekodring10'] }}@php $total = ($array_requestteller[0]['rekodring10'] * 10); $totalsemua += $total; echo number_format($total,2); @endphp
RM 5{{ $array_requestteller[0]['rekodring5'] }}@php $total = ($array_requestteller[0]['rekodring5'] * 5); $totalsemua += $total; echo number_format($total,2); @endphp
RM 1.00{{ $array_requestteller[0]['rekodring1'] }}@php $total = ($array_requestteller[0]['rekodring1'] * 1); $totalsemua += $total; echo number_format($total,2); @endphp
RM 0.50{{ $array_requestteller[0]['rekodsen50'] }}@php $total = ($array_requestteller[0]['rekodsen50'] * 0.5); $totalsemua += $total; echo number_format($total,2); @endphp
RM 0.20{{ $array_requestteller[0]['rekodsen20'] }}@php $total = ($array_requestteller[0]['rekodsen20'] * 0.2); $totalsemua += $total; echo number_format($total,2); @endphp
RM0.10{{ $array_requestteller[0]['rekodsen10'] }}@php $total = ($array_requestteller[0]['rekodsen10'] * 0.1); $totalsemua += $total; echo number_format($total,2); @endphp
RM 0.05{{ $array_requestteller[0]['rekodsen5'] }}@php $total = ($array_requestteller[0]['rekodsen5'] * 0.05); $totalsemua += $total; echo number_format($total,2); @endphp
RM 0.01{{ $array_requestteller[0]['rekodsen1'] }}@php $total = ($array_requestteller[0]['rekodsen1'] * 0.01); $totalsemua += $total; echo number_format($total,2); @endphp
JUMLAH (RM){{ number_format($totalsemua,2) }}
+ +
CATATAN:
@if($jenisserah == 'pendahuluan') + Pendahuluan daripada peti besi + @else + Serahan kepada peti besi + @endif + ialah sebanyak RM {{ number_format($totalsemua,2) }} +
+
+ + + + + + + + + + + + + + + + +
.................................................................. ..................................................................
DI SEMAK DI SAHKAN
+ \ No newline at end of file diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index f01e6e3..cc68dc2 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -49,7 +49,12 @@ {{-- Pusher --}} - @if(Auth::user()->role_harian == 'khazanah') + @if(Auth::user()->roles == 'ppc' || Auth::user()->roles == 'pc') + @endif diff --git a/routes/web.php b/routes/web.php index 64560a4..21ebbb4 100644 --- a/routes/web.php +++ b/routes/web.php @@ -87,6 +87,7 @@ Route::get('/daftar_marhun',['as'=>'daftar_marhun','uses'=>'MarhunController@ind Route::get('/penebusan/{norujukan}',['as'=>'penebusan','uses' => 'PenebusanController@index'])->middleware('auth'); Route::get('/lelongan/{norujukan}',['as'=>'lelongan','uses' => 'LelongController@index'])->middleware('auth','teller'); Route::get('/aliran_tunai','AliranTunaiController@index')->middleware('auth','teller'); +Route::get('/aliran_tunai/laporantunaiteller',['as'=>'laporan.tunaiteller','uses' => 'AliranTunaiController@LaporanTunaiTeller'])->middleware('auth','teller'); Route::get('/aliran_tunai/laporanserahan',['as'=>'laporan.serahanteller','uses' => 'AliranTunaiController@LaporanSerahan'])->middleware('auth','teller'); Route::get('/aliran_tunai/laporanserahanberkala',['as'=>'laporan.serahantellerberkala','uses' => 'AliranTunaiController@LaporanSerahanBerkala'])->middleware('auth','teller'); Route::get('/aliran_tunai/laporanalirantunai/{teller}',['as'=>'laporan.alirantunai','uses' => 'AliranTunaiController@LaporanAliranTunai'])->middleware('auth','teller'); From f59e0a4d4e495149cdd86836659fc9e9d042dd92 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Sun, 10 Nov 2024 22:31:55 +0800 Subject: [PATCH 8/9] added function operasi can edit perubatan asal --- app/Http/Controllers/KhazanahController.php | 8 ++-- app/Http/Controllers/PerubatanController.php | 20 +++++++++ public/js/perubatan.js | 45 +++++++++++++++++++ .../views/operasi/perubatan/index.blade.php | 9 ++-- routes/web.php | 3 +- 5 files changed, 76 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/KhazanahController.php b/app/Http/Controllers/KhazanahController.php index d8ac351..48eb3f6 100644 --- a/app/Http/Controllers/KhazanahController.php +++ b/app/Http/Controllers/KhazanahController.php @@ -739,7 +739,7 @@ class KhazanahController extends Controller $request->merge(['kodlaluan' => $auth_user['name']]); $data_request = $request->except('_token'); - $updatepanjar = Http::withOptions(['verify' => config('app.api_verify')])->post( config('api.url') .'/api/test/createpanjar/'. $auth_user['cawangan'],$data_request)->json(); + $updatepanjar = Http::withOptions(['verify' => config('app.api_verify')])->post( config('api.url') .'/api/panjar/createpanjar/'. $auth_user['cawangan'],$data_request)->json(); if($updatepanjar['result'] == 'success') { @@ -773,7 +773,7 @@ class KhazanahController extends Controller $request->merge(['kodlaluan' => $auth_user['name']]); $data_request = $request->except('_token'); - $updatepanjar = Http::withOptions(['verify' => config('app.api_verify')])->post( config('api.url') .'/api/test/deletepanjar/'. $auth_user['cawangan'],$data_request)->json(); + $updatepanjar = Http::withOptions(['verify' => config('app.api_verify')])->post( config('api.url') .'/api/panjar/deletepanjar/'. $auth_user['cawangan'],$data_request)->json(); if($updatepanjar['result'] == 'success') { @@ -1062,7 +1062,7 @@ class KhazanahController extends Controller } else{ $response_data = $request->except('_token'); - $test = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/test/updatetunai/'.$auth_user['cawangan'],$response_data)->json(); + $test = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/panjar/updatetunai/'.$auth_user['cawangan'],$response_data)->json(); if($test == 'success'){ event(new PendahuluanSerahan("Lulus","pendahuluan",$auth_user['cawangan'],$request->teller)); @@ -1087,7 +1087,7 @@ class KhazanahController extends Controller $peti_besi_terkini=Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/daftarVault/'.$auth_user['cawangan'])->json(); } $response_data = $request->except('_token'); - $test = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/test/serahantunai/'.$auth_user['cawangan'],$response_data)->json(); + $test = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/panjar/serahantunai/'.$auth_user['cawangan'],$response_data)->json(); if($test == 'success'){ event(new PendahuluanSerahan("Lulus","serahan",$auth_user['cawangan'],$request->teller)); diff --git a/app/Http/Controllers/PerubatanController.php b/app/Http/Controllers/PerubatanController.php index ac50416..7815f23 100644 --- a/app/Http/Controllers/PerubatanController.php +++ b/app/Http/Controllers/PerubatanController.php @@ -43,4 +43,24 @@ class PerubatanController extends Controller return view('operasi.perubatan.index',compact('cawangan_info','api_url','auth_user','paginate')); } + + public function update(Request $request){ + $api_url = config('api.url'); + $auth_user = Auth::user(); + + $user = User::where('id', $request->id)->first(); + $user = optional($user)->toArray(); + + $amount = str_replace(',', '', $request->amount); + + $total_perubatan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/panjar/getperubatan/'. $user['cawangan'],[ + 'tuntutoleh' => $user['name'] + ])->json(); + + $remaining = floatval($amount) - floatval($total_perubatan); + + $response = User::where('id', $request->id)->update(['perubatan_asal' => $amount,'perubatan' => $remaining]); + + return $response; + } } diff --git a/public/js/perubatan.js b/public/js/perubatan.js index 761280a..b48fd7a 100644 --- a/public/js/perubatan.js +++ b/public/js/perubatan.js @@ -17,6 +17,51 @@ let editfunc = (pageid) => { } let savefunc = (pageid) => { + let amount = document.getElementById("input-" + pageid); + + Swal.fire({ + title: 'Memuatkan...', + allowEscapeKey : false, + allowOutsideClick: false, + didOpen: function () { + Swal.showLoading(); + } + }); + + $.ajax({ + url : updateurl, + method : 'PUT', + data : { + "amount" : amount.value, + "id" : pageid, + "_token": $('meta[name="csrf-token"]').attr('content') + }, + success:function(response){ + if(response == 0){ + Swal.fire({ + icon: 'error', + title: 'Perubahan Nilai Perubatan Tidak Berjaya!', + }); + return false; + } + + Swal.fire({ + icon: 'success', + title: 'Perubahan Nilai Perubatan Berjaya!', + showCancelButton: false, + confirmButtonText: "Okay!", + allowEscapeKey: false, + allowOutsideClick: false + }).then((result) => { + if (result.isConfirmed) { + window.location.reload(); + } + }); + + } + }); + + // let editbtn = document.getElementById('editButton-' + pageid); // let divbtn = document.getElementById('div-' + pageid); diff --git a/resources/views/operasi/perubatan/index.blade.php b/resources/views/operasi/perubatan/index.blade.php index fb5b131..6c10a21 100644 --- a/resources/views/operasi/perubatan/index.blade.php +++ b/resources/views/operasi/perubatan/index.blade.php @@ -26,7 +26,7 @@ # Nama Baki Perubatan - Perubatan + Perubatan Tindakan @@ -35,9 +35,9 @@ {{ ($paginate->currentPage() - 1) * $paginate->perPage() + $loop->index + 1 }} {{ $page->name }} - {{ $page->perubatan }} + {{ number_format($page->perubatan,2) }} - +
@@ -63,5 +63,8 @@
+ @endsection diff --git a/routes/web.php b/routes/web.php index 21ebbb4..4639119 100644 --- a/routes/web.php +++ b/routes/web.php @@ -479,5 +479,4 @@ Route::get('/event/tellercash',['as'=>'event.tellercash','uses'=>'EventTriggerCo /* Perubatan */ Route::get('/perubatan',['as'=>'perubatan','uses'=>'PerubatanController@index'])->middleware('auth','operasi'); Route::get('/perubatan/search',['as'=>'perubatan.search','uses'=>'PerubatanController@search'])->middleware('auth','operasi'); - - +Route::put('/perubatan/update',['as'=>'perubatan.update','uses'=>'PerubatanController@update'])->middleware('auth','operasi'); From 8383bb80c2f8115230008c392b079bc474992ced Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sun, 17 Nov 2024 14:07:57 +0800 Subject: [PATCH 9/9] added rekod tunai in aliran tunai --- .../Controllers/AliranTunaiController.php | 19 + resources/views/aliran_tunai/index.blade.php | 10 + .../laporan/account_statement.blade.php | 493 ++++++++++++++++++ routes/web.php | 1 + 4 files changed, 523 insertions(+) create mode 100644 resources/views/aliran_tunai/laporan/account_statement.blade.php diff --git a/app/Http/Controllers/AliranTunaiController.php b/app/Http/Controllers/AliranTunaiController.php index 2e0d19d..32acd64 100644 --- a/app/Http/Controllers/AliranTunaiController.php +++ b/app/Http/Controllers/AliranTunaiController.php @@ -677,5 +677,24 @@ class AliranTunaiController extends Controller return view('aliran_tunai.laporan.laporanrekodteller',compact('tarikh_cetak','cawangan_info','cawangan','api_url','cawangan_detail','array_requestteller','jenisserah')); } + public function LaporanAccStatement(Request $request){ + + $auth_user = Auth::user(); + $current = Carbon::now(); + $api_url = config('api.url'); + + $tarikh_cetak = $current->toDateString(); + + $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); + $cawangan=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/cawangan/detail/'.$auth_user['cawangan'])->json(); + $cawangan_detail=$cawangan[0]; + + $tarikh = date("Y-m-d", $request->tarikh); + + $acc_statement = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/record/accountstatement/' . $auth_user['cawangan'] ,['teller' => $auth_user['name'],'tarikh' => $tarikh])->json(); + + return view('aliran_tunai.laporan.account_statement',compact('tarikh_cetak','tarikh','cawangan_info','cawangan','api_url','cawangan_detail','acc_statement')); + } + } diff --git a/resources/views/aliran_tunai/index.blade.php b/resources/views/aliran_tunai/index.blade.php index b19e2ea..d1ebd87 100644 --- a/resources/views/aliran_tunai/index.blade.php +++ b/resources/views/aliran_tunai/index.blade.php @@ -174,6 +174,7 @@ Pembiayaan Penebusan B/F + Tindakan @@ -187,6 +188,7 @@ {{ number_format($tp['keluar'],2) }} {{ number_format($tp['masuk'],2) }} {{ number_format($tp['baki'],2) }} + @endforeach @endif @@ -611,6 +613,14 @@ window.open(urlroute, '_blank'); } + function rec_acc_statement(tarikh){ + console.log(tarikh); + let urlroute = '{{ route("laporan.acc_statement" )}}'; + urlroute += '?tarikh=' + tarikh; + + window.open(urlroute, '_blank'); + } + let pusherenv = "{{ env('PUSHER_APP_KEY') }}"; let laporanroute = "{{ route('laporan.serahantellerberkala') }}"; let event_tellercash = "{{ route('event.tellercash') }}"; diff --git a/resources/views/aliran_tunai/laporan/account_statement.blade.php b/resources/views/aliran_tunai/laporan/account_statement.blade.php new file mode 100644 index 0000000..8cd75d0 --- /dev/null +++ b/resources/views/aliran_tunai/laporan/account_statement.blade.php @@ -0,0 +1,493 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
Laporan Kenyataan Akaun
+ + + + +
+ + +
ID {{ (Auth::user()->name) ? Auth::user()->name : ''}}
Tarikh Laporan {{ $tarikh }} Tarikh Cetak {{ $tarikh_cetak }}
+
+ + + + + + + + + + + + @foreach ($acc_statement as $acc) + + + + + + + @endforeach + +
TarikhDebitKreditNota
{{ $acc['tarikh'] }}{{ number_format($acc['tambah'],2) }}{{ number_format($acc['kurang'],2) }}{{ $acc['nota'] }}
+ +
+ + + + + + + + + + + + + + + + +
.................................................................. ..................................................................
DI SEMAK DI SAHKAN
+ \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 4639119..d31216d 100644 --- a/routes/web.php +++ b/routes/web.php @@ -88,6 +88,7 @@ Route::get('/penebusan/{norujukan}',['as'=>'penebusan','uses' => 'PenebusanContr Route::get('/lelongan/{norujukan}',['as'=>'lelongan','uses' => 'LelongController@index'])->middleware('auth','teller'); Route::get('/aliran_tunai','AliranTunaiController@index')->middleware('auth','teller'); Route::get('/aliran_tunai/laporantunaiteller',['as'=>'laporan.tunaiteller','uses' => 'AliranTunaiController@LaporanTunaiTeller'])->middleware('auth','teller'); +Route::get('/aliran_tunai/account_statement',['as'=>'laporan.acc_statement','uses' => 'AliranTunaiController@LaporanAccStatement'])->middleware('auth','teller'); Route::get('/aliran_tunai/laporanserahan',['as'=>'laporan.serahanteller','uses' => 'AliranTunaiController@LaporanSerahan'])->middleware('auth','teller'); Route::get('/aliran_tunai/laporanserahanberkala',['as'=>'laporan.serahantellerberkala','uses' => 'AliranTunaiController@LaporanSerahanBerkala'])->middleware('auth','teller'); Route::get('/aliran_tunai/laporanalirantunai/{teller}',['as'=>'laporan.alirantunai','uses' => 'AliranTunaiController@LaporanAliranTunai'])->middleware('auth','teller');