diff --git a/app/Events/Dashboard/GadaiNotify.php b/app/Events/Dashboard/GadaiNotify.php new file mode 100644 index 0000000..890d782 --- /dev/null +++ b/app/Events/Dashboard/GadaiNotify.php @@ -0,0 +1,32 @@ +response = $response; + $this->cawangan = $cawangan; + } + + public function broadcastOn() + { + return ['gadai-notify']; + } + + public function broadcastAs() + { + return 'trigger-gadai'; + } +} \ No newline at end of file diff --git a/app/Events/Dashboard/KeuntunganNotify.php b/app/Events/Dashboard/KeuntunganNotify.php new file mode 100644 index 0000000..c093e23 --- /dev/null +++ b/app/Events/Dashboard/KeuntunganNotify.php @@ -0,0 +1,32 @@ +response = $response; + $this->cawangan = $cawangan; + } + + public function broadcastOn() + { + return ['keuntungan-notify']; + } + + public function broadcastAs() + { + return 'trigger-keuntungan'; + } +} \ No newline at end of file diff --git a/app/Events/Dashboard/PetibesiNotify.php b/app/Events/Dashboard/PetibesiNotify.php new file mode 100644 index 0000000..62ae2aa --- /dev/null +++ b/app/Events/Dashboard/PetibesiNotify.php @@ -0,0 +1,32 @@ +response = $response; + $this->cawangan = $cawangan; + } + + public function broadcastOn() + { + return ['petibesi-notify']; + } + + public function broadcastAs() + { + return 'trigger-petibesi'; + } +} \ No newline at end of file diff --git a/app/Events/Dashboard/TebusNotify.php b/app/Events/Dashboard/TebusNotify.php new file mode 100644 index 0000000..0a03792 --- /dev/null +++ b/app/Events/Dashboard/TebusNotify.php @@ -0,0 +1,32 @@ +response = $response; + $this->cawangan = $cawangan; + } + + public function broadcastOn() + { + return ['tebus-notify']; + } + + public function broadcastAs() + { + return 'trigger-tebus'; + } +} \ No newline at end of file diff --git a/app/Http/Controllers/GadaianController.php b/app/Http/Controllers/GadaianController.php index 233be33..afc24a6 100644 --- a/app/Http/Controllers/GadaianController.php +++ b/app/Http/Controllers/GadaianController.php @@ -5,6 +5,8 @@ namespace App\Http\Controllers; //Events use App\Events\StatusLiked; use App\Events\NotifikasiPembayaran; +use App\Events\Dashboard\GadaiNotify; + use Illuminate\Http\Request; use App\Services\CustomerService; @@ -184,6 +186,8 @@ class GadaianController extends Controller $this->AliranTunaiController->alirantunaiGadai($request,$auth_user['name']); + event(new GadaiNotify('lulus',$auth_user['cawangan'])); + $request->session()->forget('page_reload'); $request->session()->forget('norujukan'); return redirect()->route('customer_info'); @@ -223,6 +227,8 @@ class GadaianController extends Controller 'norujukan' => $request->norujukan_gadai ])->json(); + event(new GadaiNotify('lulus',$auth_user['cawangan'])); + $request->session()->forget('page_reload'); $request->session()->forget('norujukan'); return redirect()->route('customer_info'); diff --git a/app/Http/Controllers/KhazanahController.php b/app/Http/Controllers/KhazanahController.php index 9da73c3..827a7ba 100644 --- a/app/Http/Controllers/KhazanahController.php +++ b/app/Http/Controllers/KhazanahController.php @@ -3323,16 +3323,16 @@ class KhazanahController extends Controller $current = new Carbon(); $tarikh_cetak = $current->toDateString(); - if($request->datedenominasi == null){ + if($request->dateaudit == null){ $date = $current->toDateString(); }else{ - $split_date = explode('-', $request->datedenominasi); + $split_date = explode('-', $request->dateaudit); $date = $split_date[2] . '-' . $split_date[1] . '-' . $split_date[0]; } - $denominasi = Http::get(config('api.url'). '/api/DenominasiLaporan/' . $auth_user['cawangan'],['tarikh' => $date])->json(); + $audittrail = Http::get(config('api.url'). '/api/laporanAuditTrail/',['tarikh' => $date,'kodcaw' => Auth::user()->cawangan])->json(); - if(!$denominasi) + if(!$audittrail) { return redirect()->back()->with('errormessage', 'Tiada data pada tarikh tersebut.'); } @@ -3340,7 +3340,7 @@ class KhazanahController extends Controller $cawangan = Http::get(config('api.url').'/api/cawangan/detail/'.$auth_user['cawangan'])->json(); $cawangan_detail=$cawangan[0]; - return view('print.laporan_audittrail', compact('denominasi','cawangan_detail','tarikh_cetak','date','api_url')); + return view('print.laporan_audittrail', compact('audittrail','cawangan_detail','tarikh_cetak','date','api_url')); } diff --git a/app/Http/Controllers/PenebusanController.php b/app/Http/Controllers/PenebusanController.php index 3ec99ce..ad9c60d 100644 --- a/app/Http/Controllers/PenebusanController.php +++ b/app/Http/Controllers/PenebusanController.php @@ -2,6 +2,10 @@ namespace App\Http\Controllers; +//Events +use App\Events\Dashboard\TebusNotify; +use App\Events\Dashboard\KeuntunganNotify; + use Illuminate\Http\Request; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Auth; @@ -63,6 +67,8 @@ class PenebusanController extends Controller if($updatetebus) { return response('success'); + + event(new TebusNotify('lulus',$auth_user['cawangan'])); }else{ return response('fail'); } diff --git a/resources/views/khazanah/laporan/audittrail.blade.php b/resources/views/khazanah/laporan/audittrail.blade.php index ab108aa..37a1c4e 100644 --- a/resources/views/khazanah/laporan/audittrail.blade.php +++ b/resources/views/khazanah/laporan/audittrail.blade.php @@ -82,18 +82,14 @@