Loading app/Http/Controllers/DivesAPI.php +8 −1 Original line number Diff line number Diff line Loading @@ -3,11 +3,18 @@ namespace App\Http\Controllers; use App\Models\DivingSession; use App\Models\User; class DivesAPI extends Controller { function getDivers($diveID): array { return DivingSession::find($diveID)->getParticipants(); $participants = User::select('*') ->join('CAR_REGISTRATION', 'CAR_REGISTRATION.US_ID', '=', 'CAR_USER.US_ID') ->join('CAR_DIVING_SESSION', 'CAR_DIVING_SESSION.DS_CODE', '=', 'CAR_REGISTRATION.DS_CODE') ->join('CAR_DIVING_LOCATION', 'CAR_DIVING_LOCATION.DL_ID', '=', 'CAR_DIVING_SESSION.DL_ID') ->where('CAR_REGISTRATION.DS_CODE', $diveID); $participants = $participants->get()->toArray(); return $participants; } } app/Http/Controllers/DivesList.php +37 −1 Original line number Diff line number Diff line Loading @@ -2,10 +2,13 @@ namespace App\Http\Controllers; use App\Models\DivingGroup; use App\Models\DivingLocation; use App\Models\DivingSession; use App\Models\Prerogative; use App\Models\User; use Error; use Illuminate\Http\Request; use Illuminate\View\View; class DivesList extends Controller Loading @@ -18,7 +21,9 @@ function index(): View ->orderBy('DS_DATE', 'asc') ->get(); $user = session()->get('user'); return view('dives', ['dives' => $dives, 'userPre' => Prerogative::find($user->PRE_CODE), 'user' => $user]); $locations = DivingLocation::all(); $levels = Prerogative::select('PRE_MAX_DEPTH')->groupby('PRE_MAX_DEPTH')->get(); return view('dives', ['dives' => $dives, 'userPre' => Prerogative::find($user->PRE_CODE), 'locations' => $locations, 'levels' => $levels]); } function show($id) { Loading @@ -43,4 +48,35 @@ function showManagementList() { ->get(); return view('dives_list_management', ['dives' => $dives]); } function filter(Request $request) { $location = $request->input('location_filter'); $creneau = $request->input('creneau_filter'); $level = $request->input('level_filter'); $date = $request->input('date_filter'); //dd($location, $creneau, $level, $date); $dives = DivingSession::select('DS_CODE', 'DS_ACTIVE', 'CAR_DIVING_SESSION.DL_ID', 'DS_DATE', 'DL_DEPTH', 'CAR_SCHEDULE', 'DL_NAME', 'DS_MAX_DEPTH') ->join('CAR_DIVING_LOCATION', 'CAR_DIVING_SESSION.DL_ID', '=', 'CAR_DIVING_LOCATION.DL_ID') ->where('DS_ACTIVE', 1); if ($location != null && $location != 'default') { $dl_id = DivingLocation::where('DL_NAME', $location)->first()->DL_ID; $dives = $dives->where('CAR_DIVING_SESSION.DL_ID', $dl_id); } if ($creneau != null && $creneau != 'default') { $dives = $dives->where('CAR_SCHEDULE', $creneau); } if ($level != null && $level != 'default') { $dives = $dives->where('DS_MAX_DEPTH', '<=', intval($level)); } if ($date != null && $date != 'default') { $dives = $dives->where('DS_DATE', '>=', $date); } $dives = $dives->orderBy('DS_DATE', 'asc')->get(); $user = session()->get('user'); $locations = DivingLocation::all(); $levels = Prerogative::select('PRE_MAX_DEPTH')->groupby('PRE_MAX_DEPTH')->get(); return view('dives', ['dives' => $dives, 'userPre' => Prerogative::find($user->PRE_CODE), 'locations' => $locations, 'levels' => $levels]); } } app/Http/Controllers/FilterDivesByDateController.php 0 → 100644 +18 −0 Original line number Diff line number Diff line <?php namespace App\Http\Controllers; use App\Models\DivingSession; use Illuminate\View\View; class DivesByDateList extends Controller { public function index($date): View { $divesByDate = DivingSession::select('DS_CODE', 'car_diving_session.DL_ID', 'DS_DATE', 'DL_DEPTH', 'CAR_SCHEDULE', 'DL_NAME') ->join('car_diving_location', 'car_diving_session.DL_ID', '=', 'car_diving_location.DL_ID') ->where('DS_DATE', $date) ->get(); return view('divesByDate', ['divesByDate' => $divesByDate]); } } No newline at end of file app/Http/Controllers/FilterDivesByDiverController.php 0 → 100644 +21 −0 Original line number Diff line number Diff line <?php namespace App\Http\Controllers; use App\Models\DivingSession; use Illuminate\View\View; class DivesByDiverList extends Controller { public function index($diver_name, $diver_firstname): View { $divesByDiver = DivingSession::select('DS_CODE', 'car_diving_session.DL_ID', 'DS_DATE', 'DL_DEPTH', 'CAR_SCHEDULE', 'DL_NAME') ->join('car_diving_location', 'car_diving_session.DL_ID', '=', 'car_diving_location.DL_ID') ->join('car_registration', 'car_diving_session.DS_CODE', '=', 'car_registration.DS_CODE') ->join('car_user', 'car_diving_session.US_ID', '=', 'car_user.US_ID') ->where('US_NAME', $diver_name) ->where('US_FIRST_NAME', $diver_firstname) ->get(); return view('divesByDiver', ['divesByDiver' => $divesByDiver]); } } No newline at end of file app/Http/Controllers/FilterDivesBySiteController.php 0 → 100644 +18 −0 Original line number Diff line number Diff line <?php namespace App\Http\Controllers; use App\Models\DivingSession; use Illuminate\View\View; class DivesBySiteList extends Controller { public function index($site): View { $divesBySite = DivingSession::select('DS_CODE', 'car_diving_session.DL_ID', 'DS_DATE', 'DL_DEPTH', 'CAR_SCHEDULE', 'DL_NAME') ->join('car_diving_location', 'car_diving_session.DL_ID', '=', 'car_diving_location.DL_ID') ->where('DL_NAME', $site) ->get(); return view('divesBySite', ['divesBySite' => $divesBySite]); } } No newline at end of file Loading
app/Http/Controllers/DivesAPI.php +8 −1 Original line number Diff line number Diff line Loading @@ -3,11 +3,18 @@ namespace App\Http\Controllers; use App\Models\DivingSession; use App\Models\User; class DivesAPI extends Controller { function getDivers($diveID): array { return DivingSession::find($diveID)->getParticipants(); $participants = User::select('*') ->join('CAR_REGISTRATION', 'CAR_REGISTRATION.US_ID', '=', 'CAR_USER.US_ID') ->join('CAR_DIVING_SESSION', 'CAR_DIVING_SESSION.DS_CODE', '=', 'CAR_REGISTRATION.DS_CODE') ->join('CAR_DIVING_LOCATION', 'CAR_DIVING_LOCATION.DL_ID', '=', 'CAR_DIVING_SESSION.DL_ID') ->where('CAR_REGISTRATION.DS_CODE', $diveID); $participants = $participants->get()->toArray(); return $participants; } }
app/Http/Controllers/DivesList.php +37 −1 Original line number Diff line number Diff line Loading @@ -2,10 +2,13 @@ namespace App\Http\Controllers; use App\Models\DivingGroup; use App\Models\DivingLocation; use App\Models\DivingSession; use App\Models\Prerogative; use App\Models\User; use Error; use Illuminate\Http\Request; use Illuminate\View\View; class DivesList extends Controller Loading @@ -18,7 +21,9 @@ function index(): View ->orderBy('DS_DATE', 'asc') ->get(); $user = session()->get('user'); return view('dives', ['dives' => $dives, 'userPre' => Prerogative::find($user->PRE_CODE), 'user' => $user]); $locations = DivingLocation::all(); $levels = Prerogative::select('PRE_MAX_DEPTH')->groupby('PRE_MAX_DEPTH')->get(); return view('dives', ['dives' => $dives, 'userPre' => Prerogative::find($user->PRE_CODE), 'locations' => $locations, 'levels' => $levels]); } function show($id) { Loading @@ -43,4 +48,35 @@ function showManagementList() { ->get(); return view('dives_list_management', ['dives' => $dives]); } function filter(Request $request) { $location = $request->input('location_filter'); $creneau = $request->input('creneau_filter'); $level = $request->input('level_filter'); $date = $request->input('date_filter'); //dd($location, $creneau, $level, $date); $dives = DivingSession::select('DS_CODE', 'DS_ACTIVE', 'CAR_DIVING_SESSION.DL_ID', 'DS_DATE', 'DL_DEPTH', 'CAR_SCHEDULE', 'DL_NAME', 'DS_MAX_DEPTH') ->join('CAR_DIVING_LOCATION', 'CAR_DIVING_SESSION.DL_ID', '=', 'CAR_DIVING_LOCATION.DL_ID') ->where('DS_ACTIVE', 1); if ($location != null && $location != 'default') { $dl_id = DivingLocation::where('DL_NAME', $location)->first()->DL_ID; $dives = $dives->where('CAR_DIVING_SESSION.DL_ID', $dl_id); } if ($creneau != null && $creneau != 'default') { $dives = $dives->where('CAR_SCHEDULE', $creneau); } if ($level != null && $level != 'default') { $dives = $dives->where('DS_MAX_DEPTH', '<=', intval($level)); } if ($date != null && $date != 'default') { $dives = $dives->where('DS_DATE', '>=', $date); } $dives = $dives->orderBy('DS_DATE', 'asc')->get(); $user = session()->get('user'); $locations = DivingLocation::all(); $levels = Prerogative::select('PRE_MAX_DEPTH')->groupby('PRE_MAX_DEPTH')->get(); return view('dives', ['dives' => $dives, 'userPre' => Prerogative::find($user->PRE_CODE), 'locations' => $locations, 'levels' => $levels]); } }
app/Http/Controllers/FilterDivesByDateController.php 0 → 100644 +18 −0 Original line number Diff line number Diff line <?php namespace App\Http\Controllers; use App\Models\DivingSession; use Illuminate\View\View; class DivesByDateList extends Controller { public function index($date): View { $divesByDate = DivingSession::select('DS_CODE', 'car_diving_session.DL_ID', 'DS_DATE', 'DL_DEPTH', 'CAR_SCHEDULE', 'DL_NAME') ->join('car_diving_location', 'car_diving_session.DL_ID', '=', 'car_diving_location.DL_ID') ->where('DS_DATE', $date) ->get(); return view('divesByDate', ['divesByDate' => $divesByDate]); } } No newline at end of file
app/Http/Controllers/FilterDivesByDiverController.php 0 → 100644 +21 −0 Original line number Diff line number Diff line <?php namespace App\Http\Controllers; use App\Models\DivingSession; use Illuminate\View\View; class DivesByDiverList extends Controller { public function index($diver_name, $diver_firstname): View { $divesByDiver = DivingSession::select('DS_CODE', 'car_diving_session.DL_ID', 'DS_DATE', 'DL_DEPTH', 'CAR_SCHEDULE', 'DL_NAME') ->join('car_diving_location', 'car_diving_session.DL_ID', '=', 'car_diving_location.DL_ID') ->join('car_registration', 'car_diving_session.DS_CODE', '=', 'car_registration.DS_CODE') ->join('car_user', 'car_diving_session.US_ID', '=', 'car_user.US_ID') ->where('US_NAME', $diver_name) ->where('US_FIRST_NAME', $diver_firstname) ->get(); return view('divesByDiver', ['divesByDiver' => $divesByDiver]); } } No newline at end of file
app/Http/Controllers/FilterDivesBySiteController.php 0 → 100644 +18 −0 Original line number Diff line number Diff line <?php namespace App\Http\Controllers; use App\Models\DivingSession; use Illuminate\View\View; class DivesBySiteList extends Controller { public function index($site): View { $divesBySite = DivingSession::select('DS_CODE', 'car_diving_session.DL_ID', 'DS_DATE', 'DL_DEPTH', 'CAR_SCHEDULE', 'DL_NAME') ->join('car_diving_location', 'car_diving_session.DL_ID', '=', 'car_diving_location.DL_ID') ->where('DL_NAME', $site) ->get(); return view('divesBySite', ['divesBySite' => $divesBySite]); } } No newline at end of file