diff --git a/app/Http/Controllers/Admin/PermController.php b/app/Http/Controllers/Admin/PermController.php index 17b6e87..014cd3e 100644 --- a/app/Http/Controllers/Admin/PermController.php +++ b/app/Http/Controllers/Admin/PermController.php @@ -322,6 +322,16 @@ public function import() public function shotgun() { $perms = Perm::orderby('start')->get(); $user = Auth::user(); // user that make the request + if (!array_key_exists('day', Request::query())) { + return redirect(route('dashboard.perm.shotgun', ['day' => 1])); + } + $day = Request::query()['day']; + if (!$day || $day < 1 || $day > 7) { + return redirect(route('dashboard.perm.shotgun', ['day' => 1])); + } + $perms = $perms->filter(function ($perm) use ($day) { + return date('N', $perm->start) == $day; + }); foreach ($perms as $perm) { $found = false; foreach ($perm->permanenciers as $permanencier) { @@ -336,7 +346,7 @@ public function shotgun() { $perm->isOpen = $open < new \DateTime('now'); } setlocale(LC_TIME, 'fr_FR.utf8'); - return view('dashboard.perms.shotgun', compact('perms')); + return view('dashboard.perms.shotgun', compact('perms', 'day')); } public function doShotgun($id) { diff --git a/resources/views/dashboard/perms/shotgun.blade.php b/resources/views/dashboard/perms/shotgun.blade.php index 4a2d6c7..6f1af14 100644 --- a/resources/views/dashboard/perms/shotgun.blade.php +++ b/resources/views/dashboard/perms/shotgun.blade.php @@ -12,6 +12,20 @@
Rejoindre | Nom | Lieu | -Jour | Début | Fin | Permanenciers | @@ -36,7 +49,6 @@{{ $perm->type->name }} | {{ $perm->place }} | -{{ strftime('%A', $perm->start) }} | {{ date('G\\Hi', $perm->start) }} | {{ date('G\\Hi', $perm->end) }} | {{ $perm->permanenciers->count().'/'.$perm->nbr_permanenciers }} |
---|