104 lines
2.2 KiB
PHP
104 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Repos\Order;
|
|
|
|
class OrderRepo
|
|
{
|
|
/**
|
|
* Pending orders are brand new orders that have not been processed yet.
|
|
*/
|
|
public const PENDING = 'pending';
|
|
|
|
/**
|
|
* Orders that has been registered..
|
|
*/
|
|
public const REGISTER = 'register';
|
|
|
|
/**
|
|
* Orders that has been registered..
|
|
*/
|
|
public const PROCESSING = 'processing';
|
|
|
|
/**
|
|
* Orders fulfilled completely.
|
|
*/
|
|
public const COMPLETED = 'completed';
|
|
|
|
/**
|
|
* Order that has been cancelled.
|
|
*/
|
|
public const CANCELLED = 'cancelled';
|
|
|
|
/**
|
|
* Default status value
|
|
*/
|
|
public static function defaultStatus(): string
|
|
{
|
|
return static::PENDING;
|
|
}
|
|
|
|
/**
|
|
* Status Values
|
|
*/
|
|
public static function statusValues(): array
|
|
{
|
|
return [
|
|
self::PENDING => __('Pending'),
|
|
self::REGISTER => __('Registered'),
|
|
self::PROCESSING => __('Processing'),
|
|
self::COMPLETED => __('Completed'),
|
|
self::CANCELLED => __('Cancelled'),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Tailwind
|
|
*/
|
|
public static function statusClasses(): array
|
|
{
|
|
return [
|
|
self::PENDING => 'warning',
|
|
self::REGISTER => 'info',
|
|
self::PROCESSING => 'primary',
|
|
self::COMPLETED => 'success',
|
|
self::CANCELLED => 'danger',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Status icons
|
|
*/
|
|
public static function statusIcons(): array
|
|
{
|
|
return [
|
|
'success' => 'check-circle',
|
|
'info' => 'information-circle',
|
|
'primary' => 'clipboard-list',
|
|
'danger' => 'ban',
|
|
'warning' => 'exclamation-circle',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* HEX Colors
|
|
*/
|
|
public static function statusColors(): array
|
|
{
|
|
return [
|
|
self::PENDING => '#F5573B',
|
|
self::REGISTER => '#F2CB22',
|
|
self::PROCESSING => '#098F56',
|
|
self::COMPLETED => '#8FC15D',
|
|
self::CANCELLED => '#d70206',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Formatted status for given "status"
|
|
*/
|
|
public static function statusFormatted(string $status = 'pending'): string
|
|
{
|
|
return static::values()[$status] ?? __('None');
|
|
}
|
|
}
|