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