ldc-supportweb/app/Enums/TicketStatus.php

88 lines
2.1 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()
2023-04-11 12:28:00 +00:00
* @method static self takenInAccount()
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-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,
2023-04-11 12:28:00 +00:00
'takenInAccount' => 3,
'waiting' => 4,
'waitingValidation' => 5,
'recette' => 6,
'production' => 7,
'archived' => 8,
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'),
2023-04-11 12:28:00 +00:00
'takenInAccount' => trans('Pris en compte'),
2023-04-06 08:54:23 +00:00
'waiting' => trans('En attente de réponse'),
'waitingValidation' => trans('En attente de validation'),
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',
2023-04-11 12:28:00 +00:00
'takenInAccount' => 'text-info',
2022-05-25 12:00:20 +02:00
'waiting' => 'text-white bg-danger',
'waitingValidation' => 'text-warning bg-danger',
'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
}