Loading app/Http/Controllers/DiveSessionUpdate.php +6 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ use App\Models\DivingSession; use Illuminate\Http\Request; use App\Models\Boat; class DiveSessionUpdate extends Controller { Loading @@ -12,6 +13,11 @@ public static function update($request, $id) { $dv = DivingSession::where('DS_CODE', $id)->first(); if(intval($dv->DS_MAX_DIVERS) > Boat::find($request->boat)->BO_NUMBER_OF_SEATS) { return "Le nombre de plongeurs est supérieur au nombre de places du bateau"; } $dv->US_ID = $request->pilot; $dv->DL_ID = $request->location; $dv->BO_ID = $request->boat; Loading app/Http/Controllers/DivingNumberController.php +18 −14 Original line number Diff line number Diff line Loading @@ -11,37 +11,41 @@ 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') $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(); $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') ->where('CAR_USER.us_id', $userId) ->whereYear('CAR_DIVING_SESSION.ds_date', '=', now()->year) ->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 Loading public/js/create_div.jsdeleted 100644 → 0 +0 −23 Original line number Diff line number Diff line document.addEventListener('DOMContentLoaded', function () { function checkButtons() { var deleteButtons = document.querySelectorAll('.clickableRed'); var historiqueContainer = document.getElementById('Historique'); var DiverImage = document.getElementById('imageDiver'); if (deleteButtons.length > 0) { historiqueContainer.style.display = 'block'; DiverImage.style.display = 'none'; } else { historiqueContainer.style.display = 'none'; DiverImage.style.display = 'block'; } } checkButtons(); document.addEventListener('click', function (event) { if (event.target.classList.contains('clickableRed')) { setTimeout(checkButtons, 100); } }); }); No newline at end of file public/js/create_dive.js 0 → 100644 +7 −0 Original line number Diff line number Diff line document.addEventListener('DOMContentLoaded', function () { var currentDate = new Date(); var maxDate = new Date(currentDate.getFullYear(), 11, 1); var formattedMaxDate = maxDate.toISOString().split('T')[0]; var dayInput = document.getElementById('dayInput'); dayInput.max = formattedMaxDate; }); resources/views/components/page-subtitle.blade.php 0 → 100644 +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> Loading
app/Http/Controllers/DiveSessionUpdate.php +6 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ use App\Models\DivingSession; use Illuminate\Http\Request; use App\Models\Boat; class DiveSessionUpdate extends Controller { Loading @@ -12,6 +13,11 @@ public static function update($request, $id) { $dv = DivingSession::where('DS_CODE', $id)->first(); if(intval($dv->DS_MAX_DIVERS) > Boat::find($request->boat)->BO_NUMBER_OF_SEATS) { return "Le nombre de plongeurs est supérieur au nombre de places du bateau"; } $dv->US_ID = $request->pilot; $dv->DL_ID = $request->location; $dv->BO_ID = $request->boat; Loading
app/Http/Controllers/DivingNumberController.php +18 −14 Original line number Diff line number Diff line Loading @@ -11,37 +11,41 @@ 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') $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(); $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') ->where('CAR_USER.us_id', $userId) ->whereYear('CAR_DIVING_SESSION.ds_date', '=', now()->year) ->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 Loading
public/js/create_div.jsdeleted 100644 → 0 +0 −23 Original line number Diff line number Diff line document.addEventListener('DOMContentLoaded', function () { function checkButtons() { var deleteButtons = document.querySelectorAll('.clickableRed'); var historiqueContainer = document.getElementById('Historique'); var DiverImage = document.getElementById('imageDiver'); if (deleteButtons.length > 0) { historiqueContainer.style.display = 'block'; DiverImage.style.display = 'none'; } else { historiqueContainer.style.display = 'none'; DiverImage.style.display = 'block'; } } checkButtons(); document.addEventListener('click', function (event) { if (event.target.classList.contains('clickableRed')) { setTimeout(checkButtons, 100); } }); }); No newline at end of file
public/js/create_dive.js 0 → 100644 +7 −0 Original line number Diff line number Diff line document.addEventListener('DOMContentLoaded', function () { var currentDate = new Date(); var maxDate = new Date(currentDate.getFullYear(), 11, 1); var formattedMaxDate = maxDate.toISOString().split('T')[0]; var dayInput = document.getElementById('dayInput'); dayInput.max = formattedMaxDate; });
resources/views/components/page-subtitle.blade.php 0 → 100644 +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>