From c2bf670590a339dabd2c9a3f9929a5547d88e775 Mon Sep 17 00:00:00 2001 From: afiq Date: Wed, 1 Dec 2021 08:06:56 +0800 Subject: [PATCH] dashboard --- .DS_Store | Bin 8196 -> 8196 bytes app/.DS_Store | Bin 0 -> 6148 bytes app/Events/.DS_Store | Bin 0 -> 6148 bytes app/Events/Dashboard/KomoditiNotify.php | 32 ++++++++++++++++++ app/Events/Dashboard/PelangganNotify.php | 32 ++++++++++++++++++ app/Http/Controllers/Auth/LoginController.php | 2 +- app/Http/Controllers/CustomersController.php | 2 ++ app/Http/Controllers/OperasiController.php | 7 ++++ .../views/operasi/komuditi/index.blade.php | 10 ++++++ routes/web.php | 4 ++- 10 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 app/.DS_Store create mode 100644 app/Events/.DS_Store create mode 100644 app/Events/Dashboard/KomoditiNotify.php create mode 100644 app/Events/Dashboard/PelangganNotify.php diff --git a/.DS_Store b/.DS_Store index 6bde6833edaf6deb4e461dd7a2ca9a0a00e17ab4..5680452aab60563dacc1ec3b41ea1312a83c902e 100644 GIT binary patch delta 142 zcmZp1XmQx!E}*n6sURn_xWvHV8Y2@k3o9Et2L}f?M{ICLetB?7Vo7PS)8s~BZ!bS}XS9R*{fS{;RIOCtjv1q&17+FDKyQDuGWp!n>Z+`Rk_1~6b`gwPDUP#Q*c bZWa;z%r>z>Y%{yWHS5Z-O8rWBzE6^{#E3)WUq@e*qL0!H+pQWFw17-EVe&b~7Jje;8wYFbj_uYcs|iXowt@6@uoKu9^)-zhi&E~khw^*E>bVR?m?1;sA zuiFu4$NlB9>FgdHUR;e|l2@tT42>KZ*RpM~gm+LX70tb=Oq6^Adzn+l5)uQ%05L!e ztRn;VG;mt$SUlBC3=ji9GJyMofQIN=EDY+c13J7uqrZWO0y@4W5QRn8Vqp+GAl#$^ znpAF|7~G_TUD!C+VqwsvGp<*LdF;yNZQVmD>``CHNAY=_ zNm8*?!IOxcfytN5&xU+iG6?{P_Bh%Dr~!b3N?3BS`9jD~x*#QMAr$%>At(r72vL|X zM6=;9GC+IhLI-y(gFbxPzibdDDn##VI7s4b)M&hkQn|9Sy5=}e)w%WiD)&dhXq>f! z;WdpeluE)`KL{`5Uf!*3oT_vb#A$D+6XK|cAvafX8mYXk#%Yx4T;Dhx*LAzKt;yu@ zpe|d@X};8fA;L<response = $response; + $this->cawangan = $cawangan; + } + + public function broadcastOn() + { + return ['komoditi-notify']; + } + + public function broadcastAs() + { + return 'trigger-komoditi'; + } +} \ No newline at end of file diff --git a/app/Events/Dashboard/PelangganNotify.php b/app/Events/Dashboard/PelangganNotify.php new file mode 100644 index 0000000..6790daf --- /dev/null +++ b/app/Events/Dashboard/PelangganNotify.php @@ -0,0 +1,32 @@ +response = $response; + $this->cawangan = $cawangan; + } + + public function broadcastOn() + { + return ['pelanggan-notify']; + } + + public function broadcastAs() + { + return 'trigger-pelanggan'; + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index b54f825..1c20f12 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -118,7 +118,7 @@ class LoginController extends Controller return response()->json([ 'success' => false, 'message' => 'Invalid Email or Password', - ], 401); + ], 200); } } diff --git a/app/Http/Controllers/CustomersController.php b/app/Http/Controllers/CustomersController.php index 8424db8..e10d27a 100644 --- a/app/Http/Controllers/CustomersController.php +++ b/app/Http/Controllers/CustomersController.php @@ -13,6 +13,7 @@ use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Auth; use Twilio\Rest\Client; use App\Komoditi; +use App\Events\Dashboard\PelangganNotify; use Carbon\Carbon; @@ -204,6 +205,7 @@ class CustomersController extends Controller ]); Session::put('customer_info',$customer_info); + event(new PelangganNotify('lulus',$auth_user['cawangan'])); return redirect()->route('customer_info')->with( ['customer_info' => $customer_info] ); } diff --git a/app/Http/Controllers/OperasiController.php b/app/Http/Controllers/OperasiController.php index d535646..ce6ad94 100644 --- a/app/Http/Controllers/OperasiController.php +++ b/app/Http/Controllers/OperasiController.php @@ -7,6 +7,7 @@ namespace App\Http\Controllers; use App\Events\OperasiNotice; use App\Events\StatusLiked; use App\Events\NotifikasiKelulusan; +use App\Events\Dashboard\KomoditiNotify; use Illuminate\Support\Facades\Auth; use Illuminate\Http\Request; @@ -234,4 +235,10 @@ class OperasiController extends Controller return view('operasi.rekodtelahlulus',compact('cawangan_info','api_url','arraykelulusan')); } + + public function notifyKomoditi() + { + $auth_user = Auth::user(); + event(new KomoditiNotify('lulus',$auth_user['cawangan'])); + } } diff --git a/resources/views/operasi/komuditi/index.blade.php b/resources/views/operasi/komuditi/index.blade.php index 5008fd8..0fe9fad 100644 --- a/resources/views/operasi/komuditi/index.blade.php +++ b/resources/views/operasi/komuditi/index.blade.php @@ -414,9 +414,19 @@ text: 'Pendahuluan Unit Komuditi Berjaya' }); $('#pembelian_modal').modal('hide'); + komoditiNotify(); } }); }); + function komoditiNotify(){ + $.ajax({ + method:'get', + url: "{{ route('beli.notifyKomoditi') }}", + success:function(data){ + console.log('berjaya'); + } + }); + } @endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 050bbf3..c41d3c6 100644 --- a/routes/web.php +++ b/routes/web.php @@ -317,4 +317,6 @@ Route::get('admin/kakitangan/resetcredentials',['as'=>'admin.kakitangan.resetcre Route::get('admin/pelanggan',['as'=>'admin.pelanggan','uses'=>'KhazanahController@index'])->middleware('auth','admin'); Route::get('admin/customer_info',['as'=>'admin.customer_info','uses'=>'KhazanahController@infoAdmin'])->middleware('auth','admin'); Route::get('admin/searchpelanggan',['as'=>'admin.searchpelanggan','uses'=>'KhazanahController@searchAdmin'])->middleware('auth','admin'); -Route::get('admin/poskod',['as'=>'admin.poskod','uses'=>'HomeController@poskod']); \ No newline at end of file +Route::get('admin/poskod',['as'=>'admin.poskod','uses'=>'HomeController@poskod']); + +Route::get('pembeliannotifykomuditi',['as'=>'beli.notifyKomoditi','uses'=>'OperasiController@notifyKomoditi'])->middleware('auth','operasi'); \ No newline at end of file