#106 Slugify enums that interact with database
This commit is contained in:
parent
dddbbb8f9b
commit
ec6ae88888
@ -8,14 +8,19 @@
|
||||
|
||||
enum InvoiceStatus: string implements HasColor, HasIcon, HasLabel
|
||||
{
|
||||
case UNPAID = 'Not paid';
|
||||
case PARTIALLY_PAID = 'Partially paid';
|
||||
case PAID = 'Paid';
|
||||
case VOID = 'Void';
|
||||
case UNPAID = 'not_paid';
|
||||
case PARTIALLY_PAID = 'partially_paid';
|
||||
case PAID = 'paid';
|
||||
case VOID = 'void';
|
||||
|
||||
public function getLabel(): ?string
|
||||
public function getLabel(): string
|
||||
{
|
||||
return $this->value;
|
||||
return match ($this) {
|
||||
self::UNPAID => 'Not paid',
|
||||
self::PARTIALLY_PAID => 'Partially paid',
|
||||
self::PAID => 'Paid',
|
||||
self::VOID => 'Void',
|
||||
};
|
||||
}
|
||||
|
||||
public function getColor(): string|array|null
|
||||
|
@ -8,16 +8,23 @@
|
||||
|
||||
enum OrderStatus: string implements HasColor, HasIcon, HasLabel
|
||||
{
|
||||
case DRAFT = 'Draft';
|
||||
case APPROVED = 'Approved';
|
||||
case PRODUCTION = 'Production';
|
||||
case SHIPPED = 'Shipped';
|
||||
case READY_FOR_INVOICE = 'Ready for Invoice';
|
||||
case INVOICED = 'Invoiced';
|
||||
case DRAFT = 'draft';
|
||||
case APPROVED = 'approved';
|
||||
case PRODUCTION = 'production';
|
||||
case SHIPPED = 'shipped';
|
||||
case READY_FOR_INVOICE = 'ready_for_invoice';
|
||||
case INVOICED = 'invoiced';
|
||||
|
||||
public function getLabel(): ?string
|
||||
public function getLabel(): string
|
||||
{
|
||||
return $this->value;
|
||||
return match ($this) {
|
||||
self::DRAFT => 'Draft',
|
||||
self::APPROVED => 'Approved',
|
||||
self::PRODUCTION => 'Production',
|
||||
self::SHIPPED => 'Shipped',
|
||||
self::READY_FOR_INVOICE => 'Ready for Invoice',
|
||||
self::INVOICED => 'Invoiced',
|
||||
};
|
||||
}
|
||||
|
||||
public function getColor(): string|array|null
|
||||
|
@ -6,14 +6,20 @@
|
||||
|
||||
enum OrderType: string implements HasLabel
|
||||
{
|
||||
case EMB = 'Embroidery';
|
||||
case SCP = 'Screen printing';
|
||||
case DTG = 'Direct-to-garment';
|
||||
case VINYL = 'Vinyl';
|
||||
case MISC = 'Misc';
|
||||
case EMB = 'embroidery';
|
||||
case SCP = 'screen_printing';
|
||||
case DTG = 'direct_to_garment';
|
||||
case VINYL = 'vinyl';
|
||||
case MISC = 'misc';
|
||||
|
||||
public function getLabel(): ?string
|
||||
public function getLabel(): string
|
||||
{
|
||||
return $this->value;
|
||||
return match ($this) {
|
||||
self::EMB => 'Embroidery',
|
||||
self::SCP => 'Screen printing',
|
||||
self::DTG => 'Direct-to-garment',
|
||||
self::VINYL => 'Vinyl',
|
||||
self::MISC => 'Misc',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,8 @@
|
||||
</div>
|
||||
|
||||
<div class="col-4 text-center">
|
||||
<div class="bg-info text-white">
|
||||
<div class="fs-4 fw-bold">{{$order->order_type->name}}</div>
|
||||
<div class="bg-info text-white flex-nowrap">
|
||||
<div class="fs-5 fw-bold">{{$order->order_type->getLabel()}}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -26,7 +26,6 @@
|
||||
Order Date:
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{{-- 2nd row of header --}}
|
||||
@ -240,4 +239,3 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user