diff --git a/app/Enums/TicketStatus.php b/app/Enums/TicketStatus.php index 80528a4..534da07 100644 --- a/app/Enums/TicketStatus.php +++ b/app/Enums/TicketStatus.php @@ -7,6 +7,7 @@ use Kwaadpepper\Enum\BaseEnum; /** * @method static self new() * @method static self inprogress() + * @method static self waiting() * @method static self processed() * @method static self recette() * @method static self production() @@ -19,9 +20,10 @@ class TicketStatus extends BaseEnum return [ 'new' => 1, 'inprogress' => 2, - 'processed' => 3, - 'recette' => 4, - 'production' => 5, + 'waiting' => 3, + 'processed' => 4, + 'recette' => 5, + 'production' => 6, 'archived' => 9, ]; } @@ -31,6 +33,7 @@ class TicketStatus extends BaseEnum return [ 'new' => trans('Nouveau'), 'inprogress' => trans('En cours'), + 'waiting' => trans('En attente'), 'processed' => trans('Traité'), 'recette' => trans('En recettage'), 'production' => trans('En production'), diff --git a/database/migrations/2021_04_21_132140_update_tickets_status_with_enum_status2.php b/database/migrations/2021_04_21_132140_update_tickets_status_with_enum_status2.php new file mode 100644 index 0000000..0143414 --- /dev/null +++ b/database/migrations/2021_04_21_132140_update_tickets_status_with_enum_status2.php @@ -0,0 +1,41 @@ +get() as $ticket) { + $ticket->status = TicketStatus::production(); + $ticket->save(); + } + foreach (Ticket::where('status', 4)->get() as $ticket) { + $ticket->status = TicketStatus::recette(); + $ticket->save(); + } + foreach (Ticket::where('status', 3)->get() as $ticket) { + $ticket->status = TicketStatus::processed(); + $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 8c80f66..6bfdee6 100644 --- a/resources/views/ticket/index.blade.php +++ b/resources/views/ticket/index.blade.php @@ -86,6 +86,7 @@ $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; @endphp {{ $ticket->status->label }}