Files
online.tbbank.gov.tm-larave…/app/Repos/Order/OrderRepo.php
2024-11-23 17:47:44 +05:00

121 lines
2.6 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';
/**
* Mobile device
*/
public const MOBILE_DEVICE = 'mobile';
/**
* Default status value
*/
public static function defaultStatus(): string
{
return static::PENDING;
}
/**
* Status Values
*
* @return array<string, string>
*/
public static function statusValues(): array
{
return [
null => '-',
self::PENDING => __('Pending'),
self::REGISTER => __('Registered'),
self::PROCESSING => __('Processing'),
self::COMPLETED => __('Completed'),
self::CANCELLED => __('Cancelled'),
];
}
/**
* Tailwind
*
* @return array<string, string>
*/
public static function statusClasses(): array
{
return [
null => '-',
self::PENDING => 'warning',
self::REGISTER => 'info',
self::PROCESSING => 'info',
self::COMPLETED => 'success',
self::CANCELLED => 'danger',
];
}
/**
* Status icons
*
* @return array<string, string>
*/
public static function statusIcons(): array
{
return [
null => '-',
'success' => 'check-circle',
'info' => 'information-circle',
'primary' => 'clipboard-list',
'danger' => 'ban',
'warning' => 'exclamation-circle',
];
}
/**
* HEX Colors
*
* @return array<string, string>
*/
public static function statusColors(): array
{
return [
null => '-',
self::PENDING => '#F5573B',
self::REGISTER => '#F2CB22',
self::PROCESSING => '#8FC15D',
self::COMPLETED => '#098F56',
self::CANCELLED => '#d70206',
];
}
/**
* Formatted status for given "status"
*/
public static function statusFormatted(string $status = 'pending'): string
{
return static::statusValues()[$status] ?? __('None');
}
}