ldc-supportweb/app/Enums/TicketStatus.php

108 lines
2.9 KiB
PHP
Raw Permalink Normal View History

2021-04-18 20:31:07 +02:00
<?php
namespace App\Enums;
use Kwaadpepper\Enum\BaseEnumRoutable;
2021-04-18 20:31:07 +02:00
/**
* @method static self new()
2021-05-21 14:31:36 +02:00
* @method static self estimateTodo()
* @method static self estimateValidated()
2021-12-09 11:38:33 +01:00
* @method static self estimateDone()
2021-05-21 14:31:36 +02:00
* @method static self toPlan()
* @method static self planned()
2021-04-18 20:31:07 +02:00
* @method static self inprogress()
2021-04-21 15:30:46 +02:00
* @method static self waiting()
2021-12-09 11:38:33 +01:00
* @method static self waitingValidation()
2021-04-18 20:31:07 +02:00
* @method static self processed()
2021-04-21 13:34:23 +02:00
* @method static self recette()
2021-04-21 11:24:29 +02:00
* @method static self production()
2021-04-21 13:34:23 +02:00
* @method static self archived()
2021-04-18 20:31:07 +02:00
*/
class TicketStatus extends BaseEnumRoutable
2021-04-18 20:31:07 +02:00
{
2022-05-25 12:00:20 +02:00
/**
* Enum values
*
* @return array
*/
2021-04-18 20:31:07 +02:00
protected static function values(): array
{
return [
'new' => 1,
2021-05-21 14:31:36 +02:00
'estimateTodo' => 2,
'estimateValidated' => 3,
'toPlan' => 4,
'planned' => 5,
'inprogress' => 7,
'waiting' => 9,
'processed' => 10,
'recette' => 12,
'production' => 13,
'archived' => 15,
2021-12-09 11:38:33 +01:00
'estimateDone' => 16,
'waitingValidation' => 17,
2021-04-18 20:31:07 +02:00
];
}
2022-05-25 12:00:20 +02:00
/**
* Enum labels
*
* @return array
*/
2021-04-18 20:31:07 +02:00
protected static function labels(): array
{
return [
'new' => trans('Nouveau'),
2021-05-21 14:31:36 +02:00
'estimateTodo' => trans('Devis à faire'),
'estimateValidated' => trans('Devis validé'),
2021-12-09 11:38:33 +01:00
'estimateDone' => trans('Devis réalisé'),
2021-05-21 14:31:36 +02:00
'toPlan' => trans('À planifier'),
'planned' => trans('Planifié'),
2021-04-18 20:31:07 +02:00
'inprogress' => trans('En cours'),
2021-04-21 15:30:46 +02:00
'waiting' => trans('En attente'),
2021-12-09 11:38:33 +01:00
'waitingValidation' => trans('En attente validation'),
2021-04-18 20:31:07 +02:00
'processed' => trans('Traité'),
2021-04-21 13:34:23 +02:00
'recette' => trans('En recettage'),
2021-04-21 11:24:29 +02:00
'production' => trans('En production'),
2021-04-21 13:34:23 +02:00
'archived' => trans('Archivé'),
2021-04-18 20:31:07 +02:00
];
}
2022-05-25 12:00:20 +02:00
/**
* 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);
}
2021-04-18 20:31:07 +02:00
}