44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
use App\Filament\Support\CheerfulNotification;
|
|
use App\Traits\Enum\WithComment;
|
|
use App\Traits\Enum\WithValue;
|
|
use Filament\Support\Contracts\HasColor;
|
|
use Filament\Support\Contracts\HasLabel;
|
|
|
|
enum DecisionAdmin: int implements HasColor, HasLabel
|
|
{
|
|
use WithComment, WithValue;
|
|
|
|
case APPROVED = 1;
|
|
case NEED_REVISION = 2;
|
|
case REJECTED = 3;
|
|
|
|
public function getLabel(): ?string
|
|
{
|
|
return match ($this) {
|
|
self::APPROVED => CheerfulNotification::getMessage('Sudah Disetujui! ✅🚀', 'Disetujui'),
|
|
self::NEED_REVISION => CheerfulNotification::getMessage('Perlu Revisi nih! ✍️🛠️', 'Perlu Revisi'),
|
|
self::REJECTED => CheerfulNotification::getMessage('Ditolak, Tetap Semangat! 🛑😔', 'Ditolak'),
|
|
};
|
|
}
|
|
|
|
public function getColor(): string|array|null
|
|
{
|
|
return match ($this) {
|
|
self::APPROVED => 'success',
|
|
self::NEED_REVISION => 'info',
|
|
self::REJECTED => 'danger',
|
|
};
|
|
}
|
|
|
|
public static function options(): array
|
|
{
|
|
return collect(self::cases())
|
|
->mapWithKeys(fn ($case) => [$case->value => $case->getLabel()])
|
|
->toArray();
|
|
}
|
|
}
|