simedkom/app/Enums/CooperationStatus.php

49 lines
1.2 KiB
PHP

<?php
namespace App\Enums;
use App\Traits\Enum\WithComment;
use App\Traits\Enum\WithValue;
use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasLabel;
enum CooperationStatus: int implements HasColor, HasLabel
{
use WithComment, WithValue;
case PENDING = 1;
case ASSIGNMENT = 2;
case VERIFICATION = 3;
case PAYMENT = 4;
case COMPLETED = 5;
public function getLabel(): ?string
{
return match ($this) {
self::PENDING => 'Menunggu',
self::ASSIGNMENT => 'Media Order',
self::VERIFICATION => 'Verifikasi',
self::PAYMENT => 'Pembayaran',
self::COMPLETED => 'Selesai',
};
}
public function getColor(): string|array|null
{
return match ($this) {
self::PENDING => 'warning',
self::ASSIGNMENT => 'info',
self::VERIFICATION => 'primary',
self::PAYMENT => 'slate',
self::COMPLETED => 'success',
};
}
public static function options(): array
{
return collect(self::cases())
->mapWithKeys(fn ($case) => [$case->value => $case->getLabel()])
->toArray();
}
}