Files
CKB/app/Enums/MutationStatus.php

67 lines
1.9 KiB
PHP
Executable File

<?php
namespace App\Enums;
enum MutationStatus: string
{
case PENDING = 'pending';
case SENT = 'sent';
case RECEIVED = 'received';
case APPROVED = 'approved';
case REJECTED = 'rejected';
case COMPLETED = 'completed';
case CANCELLED = 'cancelled';
public function label(): string
{
return match($this) {
self::PENDING => 'Menunggu Konfirmasi',
self::SENT => 'Terkirim ke Dealer',
self::RECEIVED => 'Diterima Dealer',
self::APPROVED => 'Disetujui',
self::REJECTED => 'Ditolak',
self::COMPLETED => 'Selesai',
self::CANCELLED => 'Dibatalkan',
};
}
public function color(): string
{
return match($this) {
self::PENDING => 'warning',
self::SENT => 'primary',
self::RECEIVED => 'info',
self::APPROVED => 'brand',
self::REJECTED => 'danger',
self::COMPLETED => 'success',
self::CANCELLED => 'secondary',
};
}
public function textColorClass(): string
{
return match($this->color()) {
'success' => 'text-success',
'warning' => 'text-warning',
'danger' => 'text-danger',
'info' => 'text-info',
'primary' => 'text-primary',
'brand' => 'text-primary',
'secondary' => 'text-muted',
default => 'text-dark'
};
}
public static function getOptions(): array
{
return [
self::PENDING->value => self::PENDING->label(),
self::SENT->value => self::SENT->label(),
self::RECEIVED->value => self::RECEIVED->label(),
self::APPROVED->value => self::APPROVED->label(),
self::REJECTED->value => self::REJECTED->label(),
self::COMPLETED->value => self::COMPLETED->label(),
self::CANCELLED->value => self::CANCELLED->label(),
];
}
}