dashboard

This commit is contained in:
afiq
2021-12-01 08:06:56 +08:00
parent db9f0fb113
commit c2bf670590
10 changed files with 87 additions and 2 deletions
Vendored
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace App\Events\Dashboard;
use Illuminate\Queue\SerializesModels;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class KomoditiNotify implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $response;
public $cawangan;
public function __construct($response,$cawangan)
{
$this->response = $response;
$this->cawangan = $cawangan;
}
public function broadcastOn()
{
return ['komoditi-notify'];
}
public function broadcastAs()
{
return 'trigger-komoditi';
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace App\Events\Dashboard;
use Illuminate\Queue\SerializesModels;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class PelangganNotify implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $response;
public $cawangan;
public function __construct($response,$cawangan)
{
$this->response = $response;
$this->cawangan = $cawangan;
}
public function broadcastOn()
{
return ['pelanggan-notify'];
}
public function broadcastAs()
{
return 'trigger-pelanggan';
}
}
@@ -118,7 +118,7 @@ class LoginController extends Controller
return response()->json([
'success' => false,
'message' => 'Invalid Email or Password',
], 401);
], 200);
}
}
@@ -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] );
}
@@ -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']));
}
}
@@ -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');
}
});
}
</script>
@endsection
+3 -1
View File
@@ -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']);
Route::get('admin/poskod',['as'=>'admin.poskod','uses'=>'HomeController@poskod']);
Route::get('pembeliannotifykomuditi',['as'=>'beli.notifyKomoditi','uses'=>'OperasiController@notifyKomoditi'])->middleware('auth','operasi');