From c8554b3d3230cef4f96df737bd7d69f46540cc9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Wed, 25 May 2022 12:00:20 +0200 Subject: [PATCH] Make some place on tickets.index --- app/Enums/TicketStatus.php | 46 +++ app/Enums/TicketType.php | 37 +++ resources/sass/bootstrap.scss | 7 + resources/views/ticket/index.blade.php | 385 ++++++++++++------------- 4 files changed, 278 insertions(+), 197 deletions(-) diff --git a/app/Enums/TicketStatus.php b/app/Enums/TicketStatus.php index 0e6b700..d764208 100644 --- a/app/Enums/TicketStatus.php +++ b/app/Enums/TicketStatus.php @@ -21,6 +21,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable; */ class TicketStatus extends BaseEnumRoutable { + /** + * Enum values + * + * @return array + */ protected static function values(): array { return [ @@ -40,6 +45,11 @@ class TicketStatus extends BaseEnumRoutable ]; } + /** + * Enum labels + * + * @return array + */ protected static function labels(): array { return [ @@ -58,4 +68,40 @@ class TicketStatus extends BaseEnumRoutable 'archived' => trans('Archivé'), ]; } + + /** + * Enum classes + * + * @return array + */ + protected static function classes(): array + { + return [ + 'new' => 'text-danger', + 'estimateTodo' => 'text-info', + 'estimateValidated' => 'text-info', + 'estimateDone' => 'text-info', + 'toPlan' => 'text-info', + 'planned' => 'text-info', + 'inprogress' => 'text-dark', + 'waiting' => 'text-white bg-danger', + 'waitingValidation' => 'text-warning bg-danger', + 'processed' => trans('Traité'), + 'recette' => 'text-primary', + 'production' => 'text-success', + 'archived' => 'text-secondary', + ]; + } + + /** + * @param string $attribute + * @return integer|string + */ + public function __get(string $attribute) + { + if ($attribute === 'class') { + return $this->classes()[$this->getDefinition()]; + } + return parent::__get($attribute); + } } diff --git a/app/Enums/TicketType.php b/app/Enums/TicketType.php index b7fb171..3b8025c 100644 --- a/app/Enums/TicketType.php +++ b/app/Enums/TicketType.php @@ -12,6 +12,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable; */ class TicketType extends BaseEnumRoutable { + /** + * Enum values + * + * @return array + */ protected static function values(): array { return [ @@ -22,6 +27,11 @@ class TicketType extends BaseEnumRoutable ]; } + /** + * Enum labels + * + * @return array + */ protected static function labels(): array { return [ @@ -31,4 +41,31 @@ class TicketType extends BaseEnumRoutable 'newsletter' => trans('Demande newsletter') ]; } + + /** + * Enum classes + * + * @return array + */ + protected static function classes(): array + { + return [ + 'bug' => 'bg-danger', + 'evolution' => 'bg-success', + 'br' => 'bg-primary', + 'newsletter' => 'bg-warning' + ]; + } + + /** + * @param string $attribute + * @return integer|string + */ + public function __get(string $attribute) + { + if ($attribute === 'class') { + return $this->classes()[$this->getDefinition()]; + } + return parent::__get($attribute); + } } diff --git a/resources/sass/bootstrap.scss b/resources/sass/bootstrap.scss index 0b4a8f7..cde3ffe 100644 --- a/resources/sass/bootstrap.scss +++ b/resources/sass/bootstrap.scss @@ -1,3 +1,10 @@ @import 'variables'; @import '~bootstrap/scss/bootstrap'; @import 'bootswatch'; + +// OVERLOAD BOOTSTRAP +.btn-xs, .btn-group-xs > .btn { + padding: 0.1rem 0.4rem; + font-size: 0.8rem; + border-radius: 0.3rem; +} diff --git a/resources/views/ticket/index.blade.php b/resources/views/ticket/index.blade.php index b234cb9..b83876f 100644 --- a/resources/views/ticket/index.blade.php +++ b/resources/views/ticket/index.blade.php @@ -5,208 +5,199 @@ $userPr = Auth::user()->sites ?? collect([]); @endphp
-

- Gestion des tickets @if(request()->status) (Archivés) @endif -
-
-
-
- {{ __('Créer un ticket') }} - @if(session('tickets.st') == TicketStatus::archived()) - {{ __('Tickets Actifs') }} - @else - {{ __('Tickets Archivés') }} - @endif - {{ __('Réinitialiser le tri') }} -
-
- -
-
- -
-
-
-
-
-
- -
-
-
-
-
- - - -
-
-
-
-
-

- - - - - - - - @if(Auth::user()->isAdmin()) - - @endif - - - - - - - - @if(!count($tickets)) - - - - @endif - @foreach ($tickets as $ticket) - @php - $cls = $ticket->status == TicketStatus::archived() ? 'text-secondary' : null; - $cls = (!$cls && $ticket->status == TicketStatus::new()) ? 'text-danger' : $cls; - $cls = (!$cls && $ticket->status == TicketStatus::processed()) ? 'text-info' : $cls; - $cls = (!$cls && $ticket->status == TicketStatus::recette()) ? 'text-primary' : $cls; - $cls = (!$cls && $ticket->status == TicketStatus::production()) ? 'text-success' : $cls; - $cls = (!$cls && $ticket->status == TicketStatus::inprogress()) ? 'text-dark' : $cls; - $cls = (!$cls && $ticket->status == TicketStatus::waiting()) ? 'text-white bg-danger' : $cls; - $ticketClass = 'bg-primary'; - switch($ticket->type) { - case TicketType::bug(): - $ticketClass = 'bg-danger'; - break; - case TicketType::evolution(): - $ticketClass = 'bg-success'; - break; - case TicketType::newsletter(): - $ticketClass = 'bg-warning'; - break; - } - @endphp - - - - - - @if(Auth::user()->isAdmin()) - - @endif - - - - - - @endforeach - -
- #  - @include('modules.sorter', ['colname' => 'id']) - - {{__('Type') }}  - @include('modules.sorter', ['colname' => 'type']) - {{__('Fichiers') }} - {{__('Crée le') }}  - @include('modules.sorter', ['colname' => 'created_at']) - - {{__('Assigné à') }}  - @include('modules.sorter', ['colname' => 'assigned_to']) - - {{__('Créé par') }}  - @include('modules.sorter', ['colname' => 'created_by']) - - {{__('Statut') }}  - @include('modules.sorter', ['colname' => 'status']) - {{__('Contenu') }}{{__('Actions') }}
-

{{ __('Aucun ticket') }}

-
-
- {{ $ticket->id }} @if($ticket->is_internal)🔒@endif - {{ $ticket->site->name }} -
-
- {{ $ticket->type->label }} - - @if ($ticket->file !== null) - Fichier - @endif - @if ($ticket->file2 !== null) - Fichier 2 - @endif - {{ Carbon\Carbon::parse($ticket->created_at)->format('d/m/Y à H:i') }}{{ $ticket->assignedUser ? $ticket->assignedUser->name : __('Personne') }}{{ $ticket->user ? $ticket->user->name : __('Utilisateur supprimé') }}{{ $ticket->status->label }} - {{-- Modal du ticket --}} - - - - - - {{ __('Messages') }} - @if(auth()->user()->isAdmin()) - {{ __('Modifier') }} - @endif - @can('delete', $ticket) - @if(!$ticket->status->equals(TicketStatus::archived())) -
- @method('PUT') - @csrf - -
- @endif - @endcan -
- {{ $tickets->withQueryString()->links() }} +
+
+ + + + + + @if(Auth::user()->isAdmin()) + + @endif + + + + + + + @if(!count($tickets)) + + + + @endif + @foreach ($tickets as $ticket) + + + + @if(Auth::user()->isAdmin()) + + @endif + + + + + @endforeach + +
+ #  + @include('modules.sorter', ['colname' => 'id']) + + {{__('Type') }}  + @include('modules.sorter', ['colname' => 'type']) + + {{__('Assigné à') }}  + @include('modules.sorter', ['colname' => 'assigned_to']) + + {{__('Créé par') }}  + @include('modules.sorter', ['colname' => 'created_by']) + + {{__('Le') }}  + @include('modules.sorter', ['colname' => 'created_at']) +
+

{{ __('Aucun ticket') }}

+
+
+ {{ $ticket->id }} @if($ticket->is_internal)🔒@endif + + {{ $ticket->site->name }} + {{ $ticket->status->label }} + +
+
+ {{ $ticket->type->label }} + {{ $ticket->assignedUser ? $ticket->assignedUser->name : __('Personne') }}{{ $ticket->user ? $ticket->user->name : __('Utilisateur supprimé') }}{{ Carbon\Carbon::parse($ticket->created_at)->format('d/m/Y à H:i') }} +
+
+
+ @if ($ticket->file !== null) + + @endif + @if ($ticket->file2 !== null) + + @endif + {{-- Modal du ticket --}} + + + + @if(auth()->user()->isAdmin()) + + @endif + @can('delete', $ticket) + @if(!$ticket->status->equals(TicketStatus::archived())) +
+ @method('PUT') + @csrf + +
+ @endif + @endcan +
+
+
+ + +
+ {{ $tickets->withQueryString()->links() }} +
+ + + @endsection