diff --git a/app/Enums/TicketStatus.php b/app/Enums/TicketStatus.php index d764208..12f478e 100644 --- a/app/Enums/TicketStatus.php +++ b/app/Enums/TicketStatus.php @@ -7,14 +7,9 @@ use Kwaadpepper\Enum\BaseEnumRoutable; /** * @method static self new() * @method static self estimateTodo() - * @method static self estimateValidated() - * @method static self estimateDone() - * @method static self toPlan() - * @method static self planned() - * @method static self inprogress() + * @method static self takenInAccount() * @method static self waiting() * @method static self waitingValidation() - * @method static self processed() * @method static self recette() * @method static self production() * @method static self archived() @@ -31,17 +26,12 @@ class TicketStatus extends BaseEnumRoutable return [ 'new' => 1, 'estimateTodo' => 2, - 'estimateValidated' => 3, - 'toPlan' => 4, - 'planned' => 5, - 'inprogress' => 7, - 'waiting' => 9, - 'processed' => 10, - 'recette' => 12, - 'production' => 13, - 'archived' => 15, - 'estimateDone' => 16, - 'waitingValidation' => 17, + 'takenInAccount' => 3, + 'waiting' => 4, + 'waitingValidation' => 5, + 'recette' => 6, + 'production' => 7, + 'archived' => 8, ]; } @@ -55,14 +45,9 @@ class TicketStatus extends BaseEnumRoutable return [ 'new' => trans('Nouveau'), 'estimateTodo' => trans('Devis à faire'), - 'estimateValidated' => trans('Devis validé'), - 'estimateDone' => trans('Devis réalisé'), - 'toPlan' => trans('À planifier'), - 'planned' => trans('Planifié'), - 'inprogress' => trans('En cours'), - 'waiting' => trans('En attente'), - 'waitingValidation' => trans('En attente validation'), - 'processed' => trans('Traité'), + 'takenInAccount' => trans('Pris en compte'), + 'waiting' => trans('En attente de réponse'), + 'waitingValidation' => trans('En attente de validation'), 'recette' => trans('En recettage'), 'production' => trans('En production'), 'archived' => trans('Archivé'), @@ -79,14 +64,9 @@ class TicketStatus extends BaseEnumRoutable return [ 'new' => 'text-danger', 'estimateTodo' => 'text-info', - 'estimateValidated' => 'text-info', - 'estimateDone' => 'text-info', - 'toPlan' => 'text-info', - 'planned' => 'text-info', - 'inprogress' => 'text-dark', + 'takenInAccount' => 'text-info', 'waiting' => 'text-white bg-danger', 'waitingValidation' => 'text-warning bg-danger', - 'processed' => trans('Traité'), 'recette' => 'text-primary', 'production' => 'text-success', 'archived' => 'text-secondary', diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index a477dd0..efa4c3d 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -44,12 +44,10 @@ class Controller extends BaseController [ TicketStatus::new(), TicketStatus::estimateTodo(), - TicketStatus::estimateValidated(), - TicketStatus::toPlan(), - TicketStatus::planned(), TicketStatus::waiting(), TicketStatus::production(), - TicketStatus::archived() + TicketStatus::archived(), + TicketStatus::takenInAccount() ] ); diff --git a/app/Http/Controllers/Credit/EstimationController.php b/app/Http/Controllers/Credit/EstimationController.php index 73083cf..4a66963 100644 --- a/app/Http/Controllers/Credit/EstimationController.php +++ b/app/Http/Controllers/Credit/EstimationController.php @@ -77,7 +77,7 @@ class EstimationController extends Controller /** @var \App\Models\Credit\Estimation */ $estimation = $ticket->estimation; if ($request->answer) { - $ticket->status = TicketStatus::toPlan(); + $ticket->status = TicketStatus::takenInAccount(); $estimation->status = EstimationStatus::accepted(); } else { $ticket->status = TicketStatus::archived(); diff --git a/app/Models/Ticket.php b/app/Models/Ticket.php index a415e11..dba2071 100644 --- a/app/Models/Ticket.php +++ b/app/Models/Ticket.php @@ -63,8 +63,10 @@ class Ticket extends Model protected static function booted() { static::creating(function (Ticket $ticket) { - // If evolution force the ticket status on estimateTodo. - if ($ticket->type->equals(TicketType::evolution())) { + // If bug force the ticket status on new. All the others are estimateTodo. + if ($ticket->type->equals(TicketType::bug())) { + $ticket->status = TicketStatus::new(); + } else { $ticket->status = TicketStatus::estimateTodo(); } }); diff --git a/database/migrations/2023_04_06_101917_change_tickets_status.php b/database/migrations/2023_04_06_101917_change_tickets_status.php new file mode 100644 index 0000000..5b2aa0d --- /dev/null +++ b/database/migrations/2023_04_06_101917_change_tickets_status.php @@ -0,0 +1,49 @@ +update(['status' => 3]); + Ticket::where('status', 9) + ->update(['status' => 4]); + Ticket::where('status', 17) + ->update(['status' => 5]); + Ticket::where('status', 12) + ->update(['status' => 6]); + Ticket::where('status', 13) + ->update(['status' => 7]); + Ticket::where('status', 15) + ->update(['status' => 8]); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Ticket::where('status', 3) + ->update(['status' => 10]); + Ticket::where('status', 4) + ->update(['status' => 9]); + Ticket::where('status', 5) + ->update(['status' => 17]); + Ticket::where('status', 6) + ->update(['status' => 12]); + Ticket::where('status', 7) + ->update(['status' => 13]); + Ticket::where('status', 8) + ->update(['status' => 15]); + } +}