Commit 1310ee76 authored by Guilhem's avatar Guilhem
Browse files

fix : not sufficiently skilled people not addable

parent c03b2974
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ public function register()
    {
        $this->renderable(function(QueryException $queryException, Request $request){
            if ($queryException->getCode()==45000)
            return response()->view('erreur-page',['message'=>$queryException->getMessage()]);
            return response()->view('error-page',['message'=>$queryException->getMessage()]);
        });
        $this->reportable(function (Throwable $e) {
            //
+17 −5
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
use App\Models\User;
use App\Models\DivingSession;
use App\Models\Registration;
use App\Models\Prerogative;
use App\Http\Controllers\ModificationDives;
use Illuminate\View\View;

@@ -12,14 +13,15 @@

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

        $adherents = User::selectRaw('US_FIRST_NAME,US_NAME,US_LICENCE_ID, CAR_USER.US_ID')
        $adherents = User::selectRaw('US_FIRST_NAME,US_NAME,US_LICENCE_ID, CAR_USER.US_ID, PRE_MAX_DEPTH')
        ->join('CAR_PREROGATIVE','CAR_PREROGATIVE.PRE_CODE','=','CAR_USER.PRE_CODE')
        ->where('CAR_PREROGATIVE.PRE_LEVEl','>=',$level)
        ->where('PRE_MAX_DEPTH', '>=', AdherentController::getMaxDepthByPrerogativeCode($pre_code))
        ->get();


        $sessionplongee = DivingSession::selectRaw('CAR_DIVING_SESSION.DS_CODE, CAR_DIVING_SESSION.DS_DATE, CAR_DIVING_LOCATION.DL_NAME, CAR_DIVING_SESSION.CAR_SCHEDULE, CAR_DIVING_SESSION.DS_LEVEL')
        ->join('CAR_DIVING_LOCATION', 'CAR_DIVING_SESSION.DL_ID', '=', 'CAR_DIVING_LOCATION.DL_ID')
        ->where('ds_code', '=', $ds_code)
@@ -32,7 +34,15 @@ static function index($ds_code, $level): View
        ]);    
    }

    static function getMaxDepthByPrerogativeCode(string $pre_code)
    {
        $query = Prerogative::selectRaw('PRE_MAX_DEPTH')
        ->where('PRE_CODE', '=', $pre_code)
        ->get();

        return $query[0]['PRE_MAX_DEPTH'];

    }



@@ -51,12 +61,14 @@ static function addUserToDive($ds_code, $us_id): View



    static function searchByName($ds_code, $level, Request $request){
    static function searchByName($ds_code, $pre_code, Request $request){

        $nom = $request['nom'];
        $prenom = $request['prenom'];

        $request = User::selectRaw('US_FIRST_NAME,US_NAME,US_LICENCE_ID, CAR_USER.US_ID')
        $request = User::selectRaw('US_FIRST_NAME,US_NAME,US_LICENCE_ID, CAR_USER.US_ID, PRE_MAX_DEPTH')
        ->join('CAR_PREROGATIVE','CAR_PREROGATIVE.PRE_CODE','=','CAR_USER.PRE_CODE')
        ->where('PRE_MAX_DEPTH', '>=', AdherentController::getMaxDepthByPrerogativeCode($pre_code))
        ->where('US_NAME', 'LIKE', "%".$nom."%")
        ->where('US_FIRST_NAME', 'LIKE', "%".$prenom."%")
        ->get();
+5 −5
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ static function sessionContainsDirector($ds_code){

    function index(): View {

        $request = DivingSession::selectRaw('DS_CODE, DS_DATE, CAR_SCHEDULE, DL_DEPTH, DL_NAME')
        $request = DivingSession::selectRaw('DS_CODE, DS_DATE, CAR_SCHEDULE, DL_DEPTH, DL_NAME, CAR_DIVING_SESSION.PRE_CODE')
        ->join('CAR_DIVING_LOCATION','CAR_DIVING_SESSION.DL_ID', '=', 'CAR_DIVING_LOCATION.DL_ID')
        ->where('CAR_DIVING_SESSION.DS_ACTIVE', '=', 1)
        ->get();
@@ -67,7 +67,7 @@ static function removalOfAMemberFromASession(string $ds_code, int $us_id){

    static function modificationMembers(string $ds_code){

        $pilote_temp = DivingSession::selectRaw('US_FIRST_NAME,US_NAME,US_LICENCE_ID, CAR_USER.US_ID')
        $pilote_temp = DivingSession::selectRaw('US_FIRST_NAME,US_NAME,US_LICENCE_ID, CAR_USER.US_ID, CAR_DIVING_SESSION.PRE_CODE')
        ->join('CAR_USER','CAR_DIVING_SESSION.US_ID','=','CAR_USER.US_ID')
        ->where('CAR_DIVING_SESSION.DS_CODE', '=', $ds_code)
        ->get();
@@ -81,7 +81,7 @@ static function modificationMembers(string $ds_code){
            'ROL_LABEL' => "Pilote"
        ];

        $securite_temp = DivingSession::selectRaw('US_FIRST_NAME,US_NAME,US_LICENCE_ID, CAR_USER.US_ID')
        $securite_temp = DivingSession::selectRaw('US_FIRST_NAME,US_NAME,US_LICENCE_ID, CAR_USER.US_ID, CAR_DIVING_SESSION.PRE_CODE')
        ->join('CAR_USER','CAR_DIVING_SESSION.US_ID_CAR_SECURE','=','CAR_USER.US_ID')
        ->where('CAR_DIVING_SESSION.DS_CODE', '=', $ds_code)
        ->get();
@@ -94,7 +94,7 @@ static function modificationMembers(string $ds_code){
            'ROL_LABEL' => "Sécurité de surface"
        ];

        $directeur_temp = DivingSession::selectRaw('US_FIRST_NAME,US_NAME,US_LICENCE_ID, CAR_USER.US_ID')
        $directeur_temp = DivingSession::selectRaw('US_FIRST_NAME,US_NAME,US_LICENCE_ID, CAR_USER.US_ID, CAR_DIVING_SESSION.PRE_CODE')
        ->join('CAR_USER','CAR_DIVING_SESSION.US_ID_CAR_DIRECT','=','CAR_USER.US_ID')
        ->where('CAR_DIVING_SESSION.DS_CODE', '=', $ds_code)
        ->get();
@@ -125,7 +125,7 @@ static function modificationMembers(string $ds_code){
            array_push($adherents, $plongeur);
        }

        $sessionplongee = DivingSession::selectRaw('CAR_DIVING_SESSION.DS_CODE, CAR_DIVING_SESSION.DS_DATE, CAR_DIVING_LOCATION.DL_NAME, CAR_DIVING_SESSION.CAR_SCHEDULE, CAR_DIVING_SESSION.DS_LEVEL')
        $sessionplongee = DivingSession::selectRaw('CAR_DIVING_SESSION.DS_CODE, CAR_DIVING_SESSION.DS_DATE, CAR_DIVING_LOCATION.DL_NAME, CAR_DIVING_SESSION.CAR_SCHEDULE, CAR_DIVING_SESSION.DS_LEVEL, CAR_DIVING_SESSION.PRE_CODE')
        ->join('CAR_DIVING_LOCATION', 'CAR_DIVING_SESSION.DL_ID', '=', 'CAR_DIVING_LOCATION.DL_ID')
        ->where('DS_CODE', '=', $ds_code)
        ->get();
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@
    <div>
    </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['DS_CODE']}}/ajoutadherent/{{$sessionplongee['DS_LEVEL']}}" class="text-blue-500 underline">
        <a href="/modificationdives/members/{{$sessionplongee['DS_CODE']}}/ajoutadherent/{{$sessionplongee['PRE_CODE']}}" class="text-blue-500 underline">
            <x-button color="red" colorHover="hover:bg-green-800">
                Ajouter un plongeur
            </x-button>
+3 −3
Original line number Diff line number Diff line
@@ -241,13 +241,13 @@



Route::get('/modificationdives/members/{ds_code}/ajoutadherent/{level}', function($ds_code, $level){
    return AdherentController::index($ds_code, $level);
Route::get('/modificationdives/members/{ds_code}/ajoutadherent/{pre_code}', function($ds_code, $pre_code){
    return AdherentController::index($ds_code, $pre_code);
});

Route::post('/modificationdives/members/{ds_code}/ajoutadherent/{us_id}', function($ds_code, $us_id){
    return AdherentController::addUserToDive($ds_code, $us_id);
});

Route::get('/modificationdives/members/{ds_code}/ajoutadherent/{level}', [AdherentController::class, 'searchByName']);
Route::get('/modificationdives/members/{ds_code}/ajoutadherent/{pre_code}', [AdherentController::class, 'searchByName']);
>>>>>>> creation-adherent-sur-creneau-de-plongee