diff --git a/src/modules/restaurant/types/restaurant.ts b/src/modules/restaurant/types/restaurant.ts index 87a61cf..d7044b8 100644 --- a/src/modules/restaurant/types/restaurant.ts +++ b/src/modules/restaurant/types/restaurant.ts @@ -233,6 +233,34 @@ export const KNOWN_ORDER_STATUSES = [ export type KnownOrderStatus = (typeof KNOWN_ORDER_STATUSES)[number] export type OrderStatus = string +/** + * Customer-facing labels for order statuses. The extension's raw + * status names are operational ('paid' / 'accepted' / 'ready') but + * customers prefer human-friendly framing ('Order received' / + * 'Cooking' / 'Ready for pickup'). + * + * Future statuses from aiolabs/restaurant#4 (kitchen workflow) — + * 'preparing', 'plating', 'at_pass', 'in_service', etc — can land + * here as they arrive. Unknown values fall through to the raw + * status string titlecased. + */ +export const FRIENDLY_ORDER_STATUS: Record = { + pending: 'Awaiting payment', + paid: 'Order received', + accepted: 'Cooking', + ready: 'Ready for pickup', + completed: 'Served', + canceled: 'Canceled', + refunded: 'Refunded', +} + +export function friendlyOrderStatus(status: OrderStatus): string { + if (status in FRIENDLY_ORDER_STATUS) return FRIENDLY_ORDER_STATUS[status] + // Unknown status — titlecase the raw key as a graceful fallback. + if (!status) return '' + return status.charAt(0).toUpperCase() + status.slice(1).replace(/_/g, ' ') +} + export interface Order { id: string restaurant_id: string diff --git a/src/modules/restaurant/views/CheckoutPage.vue b/src/modules/restaurant/views/CheckoutPage.vue index d9f47e5..096ee85 100644 --- a/src/modules/restaurant/views/CheckoutPage.vue +++ b/src/modules/restaurant/views/CheckoutPage.vue @@ -46,6 +46,7 @@ import { Separator } from '@/components/ui/separator' import OrderInvoiceCard from '../components/OrderInvoiceCard.vue' import { useCartStore } from '../stores/cart' import { useCheckout, type PlacedOrder } from '../composables/useCheckout' +import { friendlyOrderStatus } from '../types/restaurant' import { injectService, tryInjectService, @@ -383,7 +384,7 @@ function buildOrderInvoice(p: PlacedOrder) { :variant="isPaid(placed.order.id) ? 'default' : 'outline'" class="text-xs" > - {{ statusOf(placed.order.id) }} + {{ friendlyOrderStatus(statusOf(placed.order.id)) }} {

- {{ order.status }} + {{ friendlyOrderStatus(order.status) }} @@ -161,13 +162,25 @@ const timeline = computed(() => { /> - Payment received + Order received - The kitchen is on it. + Payment confirmed — the kitchen will start preparing it + shortly. + + + + + + Cooking + + Your food is being made. @@ -176,12 +189,21 @@ const timeline = computed(() => { class="mb-4 border-amber-500/40" > - Ready + Ready for pickup Pick up at the counter. + + + Served + Enjoy! Thanks for ordering. + + Items