feat: initial commit
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
// Persian labels ported from the legacy Laravel Order::$STS enum (henza_server
|
||||
// app/Models/Order.php) — the authoritative source, not henza_pwa's own
|
||||
// Orders.vue filter-tab labels, which used a slightly different, inconsistent
|
||||
// set (its key=0 was labeled "لغو شده"/cancelled, while the actual backend
|
||||
// model's sts=0 means "معلق"/suspended — legacy itself was inconsistent here).
|
||||
// Our OrderStatus enum cleanly separates SUSPENDED and CANCELLED, so mapped
|
||||
// directly, one label per real status.
|
||||
export const ORDER_STATUS_LABELS: Record<string, string> = {
|
||||
SUSPENDED: 'معلق',
|
||||
PLACED: 'ثبت سفارش',
|
||||
ADMIN_APPROVED: 'تایید مدیر سیستم',
|
||||
SOURCING: 'درحال تامین',
|
||||
PREPARING: 'درحال آماده سازی',
|
||||
DELIVERED_TO_AGENT: 'تحویل مسئول فروش',
|
||||
DELIVERED_TO_CUSTOMER: 'تحویل مشتری',
|
||||
CANCELLED: 'لغو شده',
|
||||
};
|
||||
|
||||
// Ported from legacy order.vue/Orders.vue's setColor() — legacy only ever
|
||||
// colored sts 1,3,4,5,6 (never sts=0 or sts=2), an existing gap preserved here
|
||||
// for the directly-analogous statuses (ADMIN_APPROVED, SUSPENDED, CANCELLED
|
||||
// stay uncolored, same as legacy's untouched sts=0/2).
|
||||
export const ORDER_STATUS_COLORS: Record<string, { font: string; background: string }> = {
|
||||
PLACED: { font: '#3B82F6', background: '#EFF6FF' },
|
||||
SOURCING: { font: '#EAB308', background: '#FEFCE8' },
|
||||
PREPARING: { font: '#F97316', background: '#FFF7ED' },
|
||||
DELIVERED_TO_AGENT: { font: '#06B6D4', background: '#ECFEFF' },
|
||||
DELIVERED_TO_CUSTOMER: { font: '#22C55E', background: '#F0FDF4' },
|
||||
};
|
||||
|
||||
// Ported from legacy Orders.vue's 4-step tracker (`steps`/`setCurrentStep`).
|
||||
// Legacy's ambiguous sts=0 (suspended vs cancelled) is resolved here since our
|
||||
// enum keeps them distinct; SUSPENDED is grouped with the first step (not yet
|
||||
// progressing), matching the spirit of legacy's grouping of early statuses.
|
||||
export const ORDER_STEPS = ['ثبت سفارش', 'آماده سازی', 'تحویل مشتری', 'لغو شده'];
|
||||
|
||||
export function orderStepIndex(status: string): number {
|
||||
switch (status) {
|
||||
case 'PLACED':
|
||||
case 'ADMIN_APPROVED':
|
||||
case 'SUSPENDED':
|
||||
return 0;
|
||||
case 'SOURCING':
|
||||
case 'PREPARING':
|
||||
return 1;
|
||||
case 'DELIVERED_TO_AGENT':
|
||||
case 'DELIVERED_TO_CUSTOMER':
|
||||
return 2;
|
||||
case 'CANCELLED':
|
||||
return 3;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user