From 9b8d3bdcb5330e39c3405101c9d3d768b977f0a9 Mon Sep 17 00:00:00 2001 From: Teddy Roncin Date: Mon, 28 Aug 2023 18:52:03 +0200 Subject: [PATCH 1/4] changed the displaying of the time --- resources/views/dashboard/perms/shotgun.blade.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/views/dashboard/perms/shotgun.blade.php b/resources/views/dashboard/perms/shotgun.blade.php index bdafeac..4a2d6c7 100644 --- a/resources/views/dashboard/perms/shotgun.blade.php +++ b/resources/views/dashboard/perms/shotgun.blade.php @@ -21,8 +21,8 @@ Nom Lieu Jour - Heure - Durée + Début + Fin Permanenciers Description Points @@ -31,14 +31,14 @@
- +
{{ $perm->type->name }} {{ $perm->place }} - {{ date('l', $perm->start) }} + {{ strftime('%A', $perm->start) }} {{ date('G\\Hi', $perm->start) }} - {{ gmdate('G\\Hi', $perm->end - $perm->start) }} + {{ date('G\\Hi', $perm->end) }} {{ $perm->permanenciers->count().'/'.$perm->nbr_permanenciers }} {{ $perm->description }} {{ $perm->type->points }} From 6fe5740c572c3b578d8a49a1ae7423748fe304f1 Mon Sep 17 00:00:00 2001 From: Teddy Roncin Date: Mon, 28 Aug 2023 21:20:42 +0200 Subject: [PATCH 2/4] Added a page to see the perms you took --- app/Http/Controllers/Admin/PermController.php | 12 ++++- .../views/dashboard/perms/shotguned.blade.php | 51 +++++++++++++++++++ resources/views/layouts/dashboard.blade.php | 3 +- routes/web.php | 3 +- 4 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 resources/views/dashboard/perms/shotguned.blade.php diff --git a/app/Http/Controllers/Admin/PermController.php b/app/Http/Controllers/Admin/PermController.php index 763bad8..3e74569 100644 --- a/app/Http/Controllers/Admin/PermController.php +++ b/app/Http/Controllers/Admin/PermController.php @@ -339,7 +339,7 @@ public function shotgun() { } public function doShotgun($id) { - $redirection = redirect(route('perm.shotgun')); + $redirection = redirect(route('dashboard.perm.shotgun')); $user = Auth::user(); $perm = Perm::find($id); if ($user->is_newcomer) { @@ -385,7 +385,7 @@ public function doShotgun($id) { } public function doUnshotgun($id) { - $redirection = redirect(route('perm.shotgun')); + $redirection = redirect(route('dashboard.perm.shotgun')); $user = Auth::user(); $perm = Perm::find($id); $found = false; @@ -411,4 +411,12 @@ public function doUnshotgun($id) { $perm->permanenciers()->detach($user->id); return $redirection->withSuccess('Tu as bien quitté la perm.'); } + + public function shotgunedList() { + $user = Auth::user(); + $perms = Perm::join('perm_users', 'perm_users.perm_id', '=', 'perms.id') + ->where('user_id', '=', $user->id) + ->where('respo', '=', 0)->get(); + return view('dashboard.perms.shotguned', compact('perms')); + } } diff --git a/resources/views/dashboard/perms/shotguned.blade.php b/resources/views/dashboard/perms/shotguned.blade.php new file mode 100644 index 0000000..7b74166 --- /dev/null +++ b/resources/views/dashboard/perms/shotguned.blade.php @@ -0,0 +1,51 @@ +@extends('layouts.dashboard') + +@section('title') + Permanences que tu as prises +@endsection + +@section('smalltitle') + Liste des permanences que tu as prises. +@endsection + +@section('content') +
+

Liste de tes permanences

+
+
+
+ + + + + + + + + + + + + + @foreach ($perms as $perm) + + + + + + + + + + + + @endforeach + +
NomLieuDateDébutFinPermanenciersDescriptionPointsQuitter
{{ $perm->type->name }}{{ $perm->place }}{{ date('j/n/y', $perm->start) }}{{ date('G\\Hi', $perm->start) }}{{ date('G\\Hi', $perm->end) }}{{ $perm->permanenciers->count().'/'.$perm->nbr_permanenciers }}{{ $perm->description }}{{ $perm->type->points }} +
+ +
+
+
+
+@endsection diff --git a/resources/views/layouts/dashboard.blade.php b/resources/views/layouts/dashboard.blade.php index d0a646b..2c40735 100755 --- a/resources/views/layouts/dashboard.blade.php +++ b/resources/views/layouts/dashboard.blade.php @@ -82,7 +82,8 @@
  • Liste des permanences
  • Types de permanences
  • @endif -
  • Shotgun des permanences
  • +
  • Shotgun des permanences
  • +
  • Liste de tes perms
  • @if (Auth::user()->isAdmin()) diff --git a/routes/web.php b/routes/web.php index 27075f9..77ac339 100644 --- a/routes/web.php +++ b/routes/web.php @@ -116,7 +116,8 @@ // Perm model's route (for all users) Route::group(['middleware' => 'authorize:volunteer'], function () { - Route::get('/perm/shotgun', ['as' => 'perm.shotgun', 'uses' => 'Admin\PermController@shotgun']); + Route::get('/perm/shotgun', ['as' => 'dashboard.perm.shotgun', 'uses' => 'Admin\PermController@shotgun']); + Route::get('/perm/shotgun/list', ['as' => 'dashboard.perm.shotgun.list', 'uses' => 'Admin\PermController@shotgunedList']); Route::post('/perm/shotgun/{id}', ['uses' => 'Admin\PermController@doShotgun']); Route::post('/perm/unshotgun/{id}', ['uses' => 'Admin\PermController@doUnshotgun']); }); From 9163dd7037d924540d32e0ee7a26835f9b885b52 Mon Sep 17 00:00:00 2001 From: Teddy Roncin Date: Tue, 29 Aug 2023 12:34:31 +0200 Subject: [PATCH 3/4] days are now displayed in french --- app/Http/Controllers/Admin/PermController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Http/Controllers/Admin/PermController.php b/app/Http/Controllers/Admin/PermController.php index 3e74569..17b6e87 100644 --- a/app/Http/Controllers/Admin/PermController.php +++ b/app/Http/Controllers/Admin/PermController.php @@ -335,6 +335,7 @@ public function shotgun() { $open->setTimestamp($perm->open); $perm->isOpen = $open < new \DateTime('now'); } + setlocale(LC_TIME, 'fr_FR.utf8'); return view('dashboard.perms.shotgun', compact('perms')); } From 89adccde7f8dfe1c102811c15df62213cf669049 Mon Sep 17 00:00:00 2001 From: Teddy Roncin Date: Tue, 29 Aug 2023 13:30:00 +0200 Subject: [PATCH 4/4] Added tabs to display perms per day --- app/Http/Controllers/Admin/PermController.php | 12 +++++++++++- .../views/dashboard/perms/shotgun.blade.php | 16 ++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) 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 @@

    Shotgun des permanences

    +
    @@ -20,7 +34,6 @@ - @@ -36,7 +49,6 @@ -
    Rejoindre Nom LieuJour Début Fin Permanenciers {{ $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 }}