fix handle error and add note for shippings receive approve and reject mutations

This commit is contained in:
2025-06-13 14:19:12 +07:00
parent b2bfd666a7
commit 2f5eff9e63
28 changed files with 13055 additions and 154 deletions

View File

@@ -37,4 +37,31 @@ enum MutationStatus: string
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(),
];
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Enums;
enum OpnameStatus: string
{
case DRAFT = 'draft';
case PENDING = 'pending';
case APPROVED = 'approved';
case REJECTED = 'rejected';
public function label(): string
{
return match($this) {
self::DRAFT => 'Draft',
self::PENDING => 'Menunggu Persetujuan',
self::APPROVED => 'Disetujui',
self::REJECTED => 'Ditolak',
};
}
public function color(): string
{
return match($this) {
self::DRAFT => 'warning',
self::PENDING => 'info',
self::APPROVED => 'success',
self::REJECTED => 'danger',
};
}
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::DRAFT->value => self::DRAFT->label(),
self::PENDING->value => self::PENDING->label(),
self::APPROVED->value => self::APPROVED->label(),
self::REJECTED->value => self::REJECTED->label(),
];
}
}