Commit 9708e3e1 authored by LucBUTGH's avatar LucBUTGH
Browse files

Merge branch 'numberdives'

parents 0495d516 fafc5124
Loading
Loading
Loading
Loading
+20 −11
Original line number Diff line number Diff line
@@ -11,21 +11,29 @@ 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
        if(session()->has('user')){
            $user = session('user');
            $userId = session('user')->US_ID;
        }else{
            $userId = NULL;
            $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')
        ->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)
        $dateDivesBefore = 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')
        ->join('car_diving_location','car_diving_session.DL_ID','=','car_diving_location.DL_ID')
        ->where('car_user.US_ID',$userId)
        ->where('CAR_DIVING_SESSION.DS_DATE','<',now())
        ->get();

        $dateDivesAfter = 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')
        ->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_DIVING_SESSION.DS_DATE','>=',now())
        ->where('car_user.US_ID',$userId)
        ->get();


@@ -41,7 +49,8 @@ public function index(): View
            ->count();
        $usersCount = 99 - $usersCount ;

        return view('diveractivities', compact('usersCount'), ['dates' => $dateDives]);
        return view('diveractivities', compact('usersCount'), ['datesB' => $dateDivesBefore,
                                                                'datesA' => $dateDivesAfter]);
    }

    public function allIndex(Request $request): View
+1 −0
Original line number Diff line number Diff line
<h2 class="mb-6 font-bold md:text-5xl lg:text-3xl underline underline-offset-8">{{ $slot }}</h2>
+28 −5
Original line number Diff line number Diff line
@@ -2,7 +2,8 @@
    @if(!session()->has('user'))
        Vous devez être connecté pour accéder à cette page.
    @else
    <x-page-title hrSize="70%">Historique des plongées de {{ session('user')->US_FIRST_NAME . " " . session('user')->US_NAME }}</x-page-title>
        <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">
@@ -18,6 +19,7 @@
            </table>
        </div>

        <x-page-subtitle> A venir </x-page-subtitle>
        <div class="mt-10 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">
@@ -28,12 +30,33 @@
                    </tr>
                </thead>
                <tbody>
                @foreach($dates as $date)
                    @foreach($datesA as $dateA)
                        <tr class="odd:bg-white even:bg-gray-50 border-b">
                    <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>
                            <td class="px-6 py-4">{{ $dateA->DL_NAME }}</td>
                            <td class="px-6 py-4">{{ $dateA->DS_DATE }}</td>
                            <td class="px-6 py-4">{{ $dateA->ROL_LABEL }}</td>
                        </tr>
                    @endforeach
                </tbody>
            </table>
        </div>

        <x-page-subtitle> Ayant eu lieu </x-page-subtitle>
        <div class="mt-10 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">
                    <tr>
                        <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($datesB as $dateB)
                        <tr class="odd:bg-white even:bg-gray-50 border-b">
                            <td class="px-6 py-4">{{ $dateB->DL_NAME }}</td>
                            <td class="px-6 py-4">{{ $dateB->DS_DATE }}</td>
                            <td class="px-6 py-4">{{ $dateB->ROL_LABEL }}</td>
                        </tr>
                    @endforeach
                </tbody>