diff --git a/.DS_Store b/.DS_Store index 6bde683..5680452 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/app/.DS_Store b/app/.DS_Store new file mode 100644 index 0000000..137b520 Binary files /dev/null and b/app/.DS_Store differ diff --git a/app/Events/.DS_Store b/app/Events/.DS_Store new file mode 100644 index 0000000..e3f07ce Binary files /dev/null and b/app/Events/.DS_Store differ diff --git a/app/Events/Dashboard/KomoditiNotify.php b/app/Events/Dashboard/KomoditiNotify.php new file mode 100644 index 0000000..29be14d --- /dev/null +++ b/app/Events/Dashboard/KomoditiNotify.php @@ -0,0 +1,32 @@ +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