Change OrderStatus value to slug

This commit is contained in:
Nisse Lommerde 2025-02-16 23:49:15 -05:00
parent dddbbb8f9b
commit 31e69e7025

View File

@ -8,16 +8,23 @@
enum OrderStatus: string implements HasColor, HasIcon, HasLabel enum OrderStatus: string implements HasColor, HasIcon, HasLabel
{ {
case DRAFT = 'Draft'; case DRAFT = 'draft';
case APPROVED = 'Approved'; case APPROVED = 'approved';
case PRODUCTION = 'Production'; case PRODUCTION = 'production';
case SHIPPED = 'Shipped'; case SHIPPED = 'shipped';
case READY_FOR_INVOICE = 'Ready for Invoice'; case READY_FOR_INVOICE = 'ready_for_invoice';
case INVOICED = 'Invoiced'; case INVOICED = 'invoiced';
public function getLabel(): ?string public function getLabel(): string
{ {
return $this->value; return match ($this) {
self::DRAFT => 'Draft',
self::APPROVED => 'Approved',
self::PRODUCTION => 'Production',
self::SHIPPED => 'Shipped',
self::READY_FOR_INVOICE => 'Ready for Invoice',
self::INVOICED => 'Invoiced',
};
} }
public function getColor(): string|array|null public function getColor(): string|array|null