topnotch_website/app/Enums/InvoiceStatus.php

46 lines
1.3 KiB
PHP
Raw Normal View History

2024-11-13 23:34:53 -05:00
<?php
namespace App\Enums;
use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasIcon;
use Filament\Support\Contracts\HasLabel;
enum InvoiceStatus: string implements HasColor, HasIcon, HasLabel
{
case UNPAID = 'not_paid';
case PARTIALLY_PAID = 'partially_paid';
case PAID = 'paid';
case VOID = 'void';
2024-11-13 23:34:53 -05:00
public function getLabel(): string
2024-11-13 23:34:53 -05:00
{
return match ($this) {
self::UNPAID => 'Not paid',
self::PARTIALLY_PAID => 'Partially paid',
self::PAID => 'Paid',
self::VOID => 'Void',
};
2024-11-13 23:34:53 -05:00
}
public function getColor(): string|array|null
{
return match ($this) {
self::UNPAID => 'danger',
self::PARTIALLY_PAID => 'warning',
self::PAID => 'success',
self::VOID => 'gray'
2024-11-13 23:34:53 -05:00
};
}
public function getIcon(): ?string
{
return match ($this) {
self::UNPAID => IconEnum::UNPAID->value,
self::PARTIALLY_PAID => IconEnum::PARTIALLY_PAID->value,
self::PAID => IconEnum::PAID->value,
self::VOID => IconEnum::VOID->value,
2024-11-13 23:34:53 -05:00
};
}
}