ldc-supportweb/app/Enums/TicketStatus.php
2022-05-25 12:00:20 +02:00

107 lines
2.9 KiB
PHP

<?php
namespace App\Enums;
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 waiting()
* @method static self waitingValidation()
* @method static self processed()
* @method static self recette()
* @method static self production()
* @method static self archived()
*/
class TicketStatus extends BaseEnumRoutable
{
/**
* Enum values
*
* @return array
*/
protected static function values(): array
{
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,
];
}
/**
* Enum labels
*
* @return array
*/
protected static function labels(): array
{
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é'),
'recette' => trans('En recettage'),
'production' => trans('En production'),
'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);
}
}