diff --git a/src/components/SpecialOrderDetailsModal.module.css b/src/components/SpecialOrderDetailsModal.module.css index 480febb..6474f63 100644 --- a/src/components/SpecialOrderDetailsModal.module.css +++ b/src/components/SpecialOrderDetailsModal.module.css @@ -64,6 +64,30 @@ gap: 12px; } +.section { + display: flex; + flex-direction: column; + gap: 12px; + padding: 14px 12px; + border-radius: var(--radius-sm); + border: 1px solid rgba(143, 65, 12, 0.1); + background: rgba(255, 250, 250, 0.45); +} + +.sectionTitle { + margin: 0; + font-size: 0.84rem; + font-weight: 600; + color: var(--brown); +} + +.branchMeta { + margin: 0; + font-size: 0.84rem; + line-height: 1.7; + color: var(--text-secondary); +} + .empty { margin: 0; font-size: 0.9rem; diff --git a/src/components/SpecialOrderDetailsModal.tsx b/src/components/SpecialOrderDetailsModal.tsx index e7aaca0..9af495c 100644 --- a/src/components/SpecialOrderDetailsModal.tsx +++ b/src/components/SpecialOrderDetailsModal.tsx @@ -30,6 +30,22 @@ function formatDateTime(iso: string) { }).format(date) } +function formatJalaliDate(iso: string | null) { + if (!iso) return '—' + const date = new Date(iso) + if (Number.isNaN(date.getTime())) return '—' + return new Intl.DateTimeFormat('fa-IR-u-ca-persian', { + year: 'numeric', + month: 'long', + day: 'numeric', + }).format(date) +} + +function displayText(value: string | null | undefined) { + const trimmed = value?.trim() + return trimmed ? trimmed : '—' +} + export function SpecialOrderDetailsModal({ open, order, @@ -56,6 +72,12 @@ export function SpecialOrderDetailsModal({ const images = order.images.map((item) => item.url) const userName = formatUserName(order.user) || order.user.name + const branchLabel = + order.branchName || + order.branch?.name || + (order.branch + ? `${order.branch.name} — ${order.branch.district}` + : '') return ( <> @@ -91,22 +113,24 @@ export function SpecialOrderDetailsModal({
-
- نام -

{order.name}

-
-
+
+ کد سفارش +

+ {order.code || `BL-S-${order.number}`} +

+
دسته‌بندی

{specialOrderCategoryLabel[order.category]}

-
- تاریخ و ساعت -

{formatDateTime(order.createdAt)}

-
+
+ +
+ زمان ثبت +

{formatDateTime(order.createdAt)}

@@ -116,12 +140,118 @@ export function SpecialOrderDetailsModal({

-
- توضیحات -

- {order.description.trim() || '—'} -

-
+
+

۱. اطلاعات سفارش

+
+ مناسبت سفارش +

{displayText(order.name)}

+
+
+
+ تاریخ موردنیاز +

+ {formatJalaliDate(order.neededDate)} +

+
+
+ ساعت دریافت +

+ {displayText(order.receiveTime)} +

+
+
+
+ +
+

۲. اندازه کیک

+
+ تعداد نفرات +

+ {order.servings != null + ? order.servings.toLocaleString('fa-IR') + : '—'} +

+
+
+ +
+

۳. طعم کیک

+
+
+ طعم اسفنج +

+ {displayText(order.cakeFlavor)} +

+
+
+ فیلینگ / مغزی +

+ {displayText(order.filling)} +

+
+
+
+ روکش کیک +

{displayText(order.coating)}

+
+
+ +
+

۴. نوشته و تزئینات

+
+ متن روی کیک +

{displayText(order.cakeText)}

+
+
+ تزئینات خاص +

+ {displayText(order.decorations)} +

+
+
+ +
+

۵. سبک طراحی

+
+ سبک +

+ {displayText(order.designStyle)} +

+
+
+ +
+

۶. اطلاعات دریافت

+
+
+ نحوه دریافت +

+ {order.deliveryTypeLabel || + (order.deliveryType === 'pickup' + ? 'دریافت حضوری' + : order.deliveryType === 'shipping' + ? 'ارسال با پیک' + : '—')} +

+
+
+ شعبه +

{displayText(branchLabel)}

+
+
+ {order.branch ? ( +

+ {order.branch.district} — {order.branch.address} +

+ ) : null} +
+ + {order.description.trim() ? ( +
+ توضیحات +

{order.description}

+
+ ) : null}
تصاویر diff --git a/src/lib/specialOrdersApi.ts b/src/lib/specialOrdersApi.ts index ae1b8fb..131200e 100644 --- a/src/lib/specialOrdersApi.ts +++ b/src/lib/specialOrdersApi.ts @@ -1,6 +1,7 @@ import { apiRequest } from './api' export type SpecialOrderCategory = 'specialCake' | 'specialPastry' +export type SpecialOrderDeliveryType = 'pickup' | 'shipping' export type SpecialOrderImage = { id?: string @@ -19,12 +20,36 @@ export type SpecialOrderUser = { name: string } +export type SpecialOrderBranch = { + id: string + name: string + district: string + address: string +} + export type SpecialOrder = { id: string + number: number + code: string userId: string category: SpecialOrderCategory name: string description: string + neededDate: string | null + receiveTime: string + servings: number | null + cakeFlavor: string + filling: string + baloutSuggestedCombo: boolean + coating: string + designStyle: string + cakeText: string + decorations: string + deliveryType: SpecialOrderDeliveryType | null + deliveryTypeLabel: string | null + branchId: string | null + branchName: string + branch: SpecialOrderBranch | null createdAt: string updatedAt: string images: SpecialOrderImage[] diff --git a/src/pages/SpecialOrdersPage.tsx b/src/pages/SpecialOrdersPage.tsx index d6b2acc..1645bdc 100644 --- a/src/pages/SpecialOrdersPage.tsx +++ b/src/pages/SpecialOrdersPage.tsx @@ -252,6 +252,9 @@ export function SpecialOrdersPage() {
  • {item.name} + + {item.code || `BL-S-${item.number}`} + {specialOrderCategoryLabel[item.category]}