topnotch_website/app/Enums/InvoiceStatus.php

46 lines
1.3 KiB
PHP

<?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';
public function getLabel(): string
{
return match ($this) {
self::UNPAID => 'Not paid',
self::PARTIALLY_PAID => 'Partially paid',
self::PAID => 'Paid',
self::VOID => 'Void',
};
}
public function getColor(): string|array|null
{
return match ($this) {
self::UNPAID => 'danger',
self::PARTIALLY_PAID => 'warning',
self::PAID => 'success',
self::VOID => 'gray'
};
}
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,
};
}
}