diff --git a/app/Enums/TicketStatus.php b/app/Enums/TicketStatus.php index 2a1077d..80528a4 100644 --- a/app/Enums/TicketStatus.php +++ b/app/Enums/TicketStatus.php @@ -8,8 +8,9 @@ use Kwaadpepper\Enum\BaseEnum; * @method static self new() * @method static self inprogress() * @method static self processed() - * @method static self archived() + * @method static self recette() * @method static self production() + * @method static self archived() */ class TicketStatus extends BaseEnum { @@ -19,8 +20,9 @@ class TicketStatus extends BaseEnum 'new' => 1, 'inprogress' => 2, 'processed' => 3, - 'archived' => 4, - 'production' => 5 + 'recette' => 4, + 'production' => 5, + 'archived' => 9, ]; } @@ -30,8 +32,9 @@ class TicketStatus extends BaseEnum 'new' => trans('Nouveau'), 'inprogress' => trans('En cours'), 'processed' => trans('Traité'), - 'archived' => trans('Archivé'), + 'recette' => trans('En recettage'), 'production' => trans('En production'), + 'archived' => trans('Archivé'), ]; } } diff --git a/database/migrations/2021_04_21_132132_update_tickets_status_with_enum_status.php b/database/migrations/2021_04_21_132132_update_tickets_status_with_enum_status.php new file mode 100644 index 0000000..d677530 --- /dev/null +++ b/database/migrations/2021_04_21_132132_update_tickets_status_with_enum_status.php @@ -0,0 +1,33 @@ +get() as $ticket) { + $ticket->status = TicketStatus::archived(); + $ticket->save(); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/resources/views/ticket/index.blade.php b/resources/views/ticket/index.blade.php index d45c9b6..de2610b 100644 --- a/resources/views/ticket/index.blade.php +++ b/resources/views/ticket/index.blade.php @@ -69,7 +69,15 @@ {{ Carbon\Carbon::parse($ticket->created_at)->format('d/m/Y à H:i') }} {{ $ticket->user->name }} - {{ $ticket->status->label }} + @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; + @endphp + {{ $ticket->status->label }} {{-- Modal du ticket --}}