wip on loanorders

This commit is contained in:
2023-11-26 21:15:42 +05:00
parent 11ad96e5d8
commit 307f197d27
9 changed files with 300 additions and 28 deletions

View File

@@ -0,0 +1,89 @@
<?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',
];
}
/**
* 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');
}
}