Loading app/Http/Controllers/DivingNumberController.php +16 −9 Original line number Diff line number Diff line <?php namespace App\Http\Controllers; use Illuminate\Support\Facades\Auth; use App\Models\DivingNumberModel; use DateTime; use Illuminate\Support\Facades\Auth; use Illuminate\Http\Request; use Illuminate\View\View; Loading @@ -11,26 +11,33 @@ class DivingNumberController extends Controller { public function index(): View { if (session()->has('user')) { $userId = session('user')->US_ID; // Récupérer l'ID de l'utilisateur connecté // Faire quelque chose avec l'utilisateur ou son ID } else { $userId = NULL; } $dateDives = DivingNumberModel::join('car_registration', 'car_user.us_id', '=', 'car_registration.us_id') ->join('car_diving_session','car_registration.ds_code','=','car_diving_session.ds_code') ->where('car_user.US_ID',3) ->join('car_diving_location','car_diving_session.dl_id','=','car_diving_location.dl_id') ->join('car_role_attribution','car_user.us_id','=','car_role_attribution.Us_id') ->join('car_role','car_role_attribution.rol_code','=','car_role.rol_code') ->where('car_user.US_ID',$userId) ->get(); $user = Auth::user(); if ($user) { $userId = $user->US_ID; }else{ $userId = 1; } $dives = 99; $usersCount = DivingNumberModel::join('car_registration', 'car_user.us_id', '=', 'car_registration.us_id') ->join('car_diving_group', function ($dg) { $dg->on('car_registration.ds_code', '=', 'car_diving_group.ds_code') ->on('car_registration.dg_number', '=', 'car_diving_group.dg_number'); }) ->join('car_diving_session','car_registration.ds_code','=','car_diving_session.ds_code') ->where('car_diving_session.ds_date','>=',date("Y").'-00-00') ->where('car_user.US_ID', $userId) ->orderBy('ds_date','desc') ->count(); $usersCount = 99 - $usersCount ; Loading resources/views/components/header.blade.php +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ </div> <ul class="py-2" aria-labelledby="user-menu-button"> <li> <a href="#" class="block px-4 py-2 text-sm hover:bg-gray-600 text-gray-200 hover:text-white">Historique de mes plongées</a> <a href="{{route('divings')}}" class="block px-4 py-2 text-sm hover:bg-gray-600 text-gray-200 hover:text-white">Historique de mes plongées</a> </li> <li> <a href="{{ route('logout') }}" class="block px-4 py-2 text-sm hover:bg-gray-600 text-gray-200 hover:text-white">Se déconnecter</a> Loading resources/views/dashboard.blade.php +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ <x-page-title>Tableau de bord</x-page-title> <h2 class="text-2xl font-semibold text-gray-800">Bonjour {{ session('user')->US_FIRST_NAME . " " . session('user')->US_NAME . "," }}</h2> <div class="flex flex-row justify-evenly mt-10"> <x-square-button bgColor="bg-[#e37373]" textColor="text-black" textSubtitle="Mes plongées" link="#"> <x-square-button bgColor="bg-[#e37373]" textColor="text-black" textSubtitle="Mes plongées" link="{{ route('divings')}}"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-12 h-12"> <path stroke-linecap="round" stroke-linejoin="round" d="M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0ZM3.75 12h.007v.008H3.75V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm-.375 5.25h.007v.008H3.75v-.008Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z" /> </svg> Loading resources/views/diveractivities.blade.php +10 −5 Original line number Diff line number Diff line <x-layout> <x-page-title>Historique des plongées</x-page-title> @if(!session()->has('user')) Vous devez être connecté pour accéder à cette page. @else <x-page-title>Historique des plongées de {{ session('user')->US_FIRST_NAME . " " . session('user')->US_NAME }}</x-page-title> <div class="shadow-md max-w-full w-1/3 rounded-lg overflow-hidden border-2 mx-auto"> <table class="text-sm text-left text-gray-500 w-full"> <thead class="text-xs text-gray-700 uppercase bg-gray-50"> Loading @@ -19,20 +22,22 @@ <table class="text-sm text-left text-gray-500 w-full"> <thead class="text-xs text-gray-700 uppercase bg-gray-50"> <tr> <th scope="col" class="px-6 py-3">Nom</th> <th scope="col" class="px-6 py-3">Prénom</th> <th scope="col" class="px-6 py-3">Lieu</th> <th scope="col" class="px-6 py-3">Date</th> <th scope="col" class="px-6 py-3">Rôle</th> </tr> </thead> <tbody> @foreach($dates as $date) <tr class="odd:bg-white even:bg-gray-50 border-b"> <td class="px-6 py-4">{{ $date->US_NAME }}</td> <td class="px-6 py-4">{{ $date->US_FIRST_NAME }}</td> <td class="px-6 py-4">{{ $date->DL_NAME }}</td> <td class="px-6 py-4">{{ $date->DS_DATE }}</td> <td class="px-6 py-4">{{ $date->ROL_LABEL }}</td> </tr> @endforeach </tbody> </table> </div> @endif </x-layout> routes/web.php +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ Route::get('/session/{ds_code}', [DiversBySession::class,'getDiversBySession']); Route::get('/divings', [DivingNumberController::class, 'index']); Route::get('/divings', [DivingNumberController::class, 'index'])->name('divings'); Route::get('/alldivings', [DivingNumberController::class, 'allIndex']); Loading Loading
app/Http/Controllers/DivingNumberController.php +16 −9 Original line number Diff line number Diff line <?php namespace App\Http\Controllers; use Illuminate\Support\Facades\Auth; use App\Models\DivingNumberModel; use DateTime; use Illuminate\Support\Facades\Auth; use Illuminate\Http\Request; use Illuminate\View\View; Loading @@ -11,26 +11,33 @@ class DivingNumberController extends Controller { public function index(): View { if (session()->has('user')) { $userId = session('user')->US_ID; // Récupérer l'ID de l'utilisateur connecté // Faire quelque chose avec l'utilisateur ou son ID } else { $userId = NULL; } $dateDives = DivingNumberModel::join('car_registration', 'car_user.us_id', '=', 'car_registration.us_id') ->join('car_diving_session','car_registration.ds_code','=','car_diving_session.ds_code') ->where('car_user.US_ID',3) ->join('car_diving_location','car_diving_session.dl_id','=','car_diving_location.dl_id') ->join('car_role_attribution','car_user.us_id','=','car_role_attribution.Us_id') ->join('car_role','car_role_attribution.rol_code','=','car_role.rol_code') ->where('car_user.US_ID',$userId) ->get(); $user = Auth::user(); if ($user) { $userId = $user->US_ID; }else{ $userId = 1; } $dives = 99; $usersCount = DivingNumberModel::join('car_registration', 'car_user.us_id', '=', 'car_registration.us_id') ->join('car_diving_group', function ($dg) { $dg->on('car_registration.ds_code', '=', 'car_diving_group.ds_code') ->on('car_registration.dg_number', '=', 'car_diving_group.dg_number'); }) ->join('car_diving_session','car_registration.ds_code','=','car_diving_session.ds_code') ->where('car_diving_session.ds_date','>=',date("Y").'-00-00') ->where('car_user.US_ID', $userId) ->orderBy('ds_date','desc') ->count(); $usersCount = 99 - $usersCount ; Loading
resources/views/components/header.blade.php +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ </div> <ul class="py-2" aria-labelledby="user-menu-button"> <li> <a href="#" class="block px-4 py-2 text-sm hover:bg-gray-600 text-gray-200 hover:text-white">Historique de mes plongées</a> <a href="{{route('divings')}}" class="block px-4 py-2 text-sm hover:bg-gray-600 text-gray-200 hover:text-white">Historique de mes plongées</a> </li> <li> <a href="{{ route('logout') }}" class="block px-4 py-2 text-sm hover:bg-gray-600 text-gray-200 hover:text-white">Se déconnecter</a> Loading
resources/views/dashboard.blade.php +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ <x-page-title>Tableau de bord</x-page-title> <h2 class="text-2xl font-semibold text-gray-800">Bonjour {{ session('user')->US_FIRST_NAME . " " . session('user')->US_NAME . "," }}</h2> <div class="flex flex-row justify-evenly mt-10"> <x-square-button bgColor="bg-[#e37373]" textColor="text-black" textSubtitle="Mes plongées" link="#"> <x-square-button bgColor="bg-[#e37373]" textColor="text-black" textSubtitle="Mes plongées" link="{{ route('divings')}}"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-12 h-12"> <path stroke-linecap="round" stroke-linejoin="round" d="M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0ZM3.75 12h.007v.008H3.75V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm-.375 5.25h.007v.008H3.75v-.008Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z" /> </svg> Loading
resources/views/diveractivities.blade.php +10 −5 Original line number Diff line number Diff line <x-layout> <x-page-title>Historique des plongées</x-page-title> @if(!session()->has('user')) Vous devez être connecté pour accéder à cette page. @else <x-page-title>Historique des plongées de {{ session('user')->US_FIRST_NAME . " " . session('user')->US_NAME }}</x-page-title> <div class="shadow-md max-w-full w-1/3 rounded-lg overflow-hidden border-2 mx-auto"> <table class="text-sm text-left text-gray-500 w-full"> <thead class="text-xs text-gray-700 uppercase bg-gray-50"> Loading @@ -19,20 +22,22 @@ <table class="text-sm text-left text-gray-500 w-full"> <thead class="text-xs text-gray-700 uppercase bg-gray-50"> <tr> <th scope="col" class="px-6 py-3">Nom</th> <th scope="col" class="px-6 py-3">Prénom</th> <th scope="col" class="px-6 py-3">Lieu</th> <th scope="col" class="px-6 py-3">Date</th> <th scope="col" class="px-6 py-3">Rôle</th> </tr> </thead> <tbody> @foreach($dates as $date) <tr class="odd:bg-white even:bg-gray-50 border-b"> <td class="px-6 py-4">{{ $date->US_NAME }}</td> <td class="px-6 py-4">{{ $date->US_FIRST_NAME }}</td> <td class="px-6 py-4">{{ $date->DL_NAME }}</td> <td class="px-6 py-4">{{ $date->DS_DATE }}</td> <td class="px-6 py-4">{{ $date->ROL_LABEL }}</td> </tr> @endforeach </tbody> </table> </div> @endif </x-layout>
routes/web.php +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ Route::get('/session/{ds_code}', [DiversBySession::class,'getDiversBySession']); Route::get('/divings', [DivingNumberController::class, 'index']); Route::get('/divings', [DivingNumberController::class, 'index'])->name('divings'); Route::get('/alldivings', [DivingNumberController::class, 'allIndex']); Loading