topnotch_website/app/Enums/OrderStatus.php

44 lines
1.1 KiB
PHP
Raw Normal View History

2024-09-03 15:15:57 -07:00
<?php
namespace App\Enums;
2024-10-10 15:15:30 -07:00
use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasIcon;
use Filament\Support\Contracts\HasLabel;
enum OrderStatus: string implements HasColor, HasIcon, HasLabel
2024-09-03 15:15:57 -07:00
{
2024-10-10 15:15:30 -07:00
case DRAFT = 'Draft';
2024-09-09 15:29:31 -07:00
case APPROVED = 'Approved';
2024-09-03 15:15:57 -07:00
case PRODUCTION = 'Production';
2024-09-09 15:29:31 -07:00
case SHIPPED = 'Shipped';
case INVOICED = 'Invoiced';
2024-10-10 15:15:30 -07:00
public function getLabel(): ?string
{
return $this->value;
}
public function getColor(): string|array|null
{
return match ($this) {
self::DRAFT => 'gray',
self::APPROVED => 'success',
self::PRODUCTION => 'primary',
self::SHIPPED => 'warning',
self::INVOICED => 'invoiced',
};
}
public function getIcon(): ?string
{
return match ($this) {
self::DRAFT => 'lucide-pencil',
self::APPROVED => 'lucide-check-check',
self::PRODUCTION => 'lucide-iteration-ccw',
self::SHIPPED => 'lucide-send',
self::INVOICED => 'lucide-credit-card',
2024-10-10 15:15:30 -07:00
};
}
2024-09-03 15:15:57 -07:00
}