Commit ed029a14 authored by LucBUTGH's avatar LucBUTGH
Browse files

feat: add divers in diving session

parent 2e01c115
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
<?php

namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\View\View;


use Illuminate\Http\Request;

class AdherentController extends Controller
{
    static function index($level): View
    {

        $adherents = User::selectRaw('US_FIRST_NAME,US_NAME,US_LICENCE_ID')
        ->join('car_prerogative','car_prerogative.pre_code','=','car_user.pre_code')
        ->where('car_prerogative.pre_level','>=',$level)
        ->get();

        return view('adherents', ['adherents' => $adherents]);    
    }
}
+10 −1
Original line number Diff line number Diff line
@@ -35,9 +35,10 @@ static function removalOfAMemberFromASession(string $ds_code, int $us_id){

    static function modificationMembers(string $ds_code){

        $members = DivingSession::selectRaw('car_diving_session.DS_CODE, car_user.US_ID, car_user.us_name, car_user.us_first_name, car_role_attribution.ROL_CODE, car_user.US_SUB_DATE')
        $members = DivingSession::selectRaw('car_prerogative.pre_level, car_diving_session.DS_CODE, car_user.US_ID, car_user.us_name, car_user.us_first_name, car_role_attribution.ROL_CODE, car_user.US_SUB_DATE')
        ->join('car_registration', 'car_diving_session.DS_CODE', '=', 'car_registration.DS_CODE')
        ->join('car_user', 'car_registration.US_ID', '=', 'car_user.US_ID')
        ->join('car_prerogative','car_diving_session.pre_code','=','car_prerogative.pre_code')
        ->join('car_role_attribution', 'car_user.US_ID', '=', 'car_role_attribution.US_ID')
        ->where('car_diving_session.ds_code', '=', $ds_code)
        ->get();
@@ -54,10 +55,18 @@ static function modificationMembers(string $ds_code){
        ->where('ds_code', '=', $ds_code)
        ->get();

        $level = DivingSession::selectRaw('car_prerogative.pre_level')
        ->join('car_registration', 'car_diving_session.DS_CODE', '=', 'car_registration.DS_CODE')
        ->join('car_user', 'car_registration.US_ID', '=', 'car_user.US_ID')
        ->join('car_prerogative','car_diving_session.pre_code','=','car_prerogative.pre_code')
        ->join('car_role_attribution', 'car_user.US_ID', '=', 'car_role_attribution.US_ID')
        ->where('car_diving_session.ds_code', '=', $ds_code)
        ->get();

        return view('modification_members_of_session', [
            'persons' => $members,
            'sessionplongee' => $sessionplongee,
            'level' => $level,
        ]);
    }
}
+25 −0
Original line number Diff line number Diff line
<x-layout>
    <link rel="stylesheet" href="/css/drop-down.css">
    <x-page-title>Ajouter des adhérents</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">
                <tr>
                    <th scope="col" class="px-6 py-4">Prénom</th>
                    <th scope="col" class="px-6 py-4">Nom</th>
                    <th scope="col" class="px-6 py-4">N° Licence</th>
                </tr>
            </thead>
            <tbody>
                @foreach($adherents as $adherent)
                    <tr class="odd:bg-white even:bg-gray-50 border-b">
                        <td class="px-6 py-4">{{ $adherent->US_NAME }}</td>
                        <td class="px-6 py-4">{{ $adherent->US_FIRST_NAME }}</td>
                        <td class="px-6 py-4">{{ $adherent->US_LICENCE_ID }}</td>

                    </tr>
                @endforeach
            </tbody>
        </table>
    </div>
</x-layout>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@
        </table>
    </div>
    <div class="mt-3 shadow-md max-w-fit w-1/6 mx-left rounded-lg overflow-hidden border-2">
        <a href='/modificationdives/members/{{$sessionplongee[0]['DS_CODE']}}'>
        <a href="/adherents/{{$level}}" class="text-blue-500 underline">
            <x-button color="red" colorHover="hover:bg-green-800">
                Ajouter un adhérent
            </x-button>
+5 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
use App\Http\Controllers\DivesList;
use App\Http\Controllers\HomepageController;
use App\Models\DivingSession;
use App\Http\Controllers\AdherentController;
use App\Http\Controllers\DivingSignUpController;
use App\Http\Controllers\DiveSessionCreation;
use App\Http\Controllers\DiveSessionUpdate;
@@ -111,3 +112,7 @@
Route::post('modificationdives/members/{ds_code}/deletion/{us_id}', function($ds_code, $us_id){
     return ModificationDives::removalOfAMemberFromASession($ds_code, $us_id);
});

Route::get('/adherents/{level}', function($level){
    return AdherentController::index($level);
});
 No newline at end of file