From 69d10975b3c1565a4cc598f9408015d1a3ed0d70 Mon Sep 17 00:00:00 2001 From: abhishek Date: Mon, 28 Sep 2026 19:34:38 +0530 Subject: [PATCH] code fix --- src/api/types.ts | 12 ++++++++++-- src/features/store-admin/OrderDetailDrawer.tsx | 18 +++++++++++------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/api/types.ts b/src/api/types.ts index b196527..1b982f6 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -560,8 +560,16 @@ export interface OrderRow { */ ordervalue?: number; orderamount?: number; - /** Cash to collect on delivery. Shown only when > 0. */ - collectionamt?: number; + /* + * `collectionamt` was declared here and read by the order drawer. It does not + * exist in Fiesta — `grep -rn "collectionamt" --include=*.go` returns nothing + * — so it showed a dash from the day it was written. Removed 2026-09-28. + * + * A type can describe a field the server has never sent, and nothing catches + * it: the optional marker makes `undefined` legal, and `?? 0` turns it into a + * plausible figure. Worth remembering before the next optional money field is + * added on the strength of a field name. + */ deliverycharge?: number; deliveryamt?: number; paymenttype?: number; diff --git a/src/features/store-admin/OrderDetailDrawer.tsx b/src/features/store-admin/OrderDetailDrawer.tsx index b9097ca..9ddbabf 100644 --- a/src/features/store-admin/OrderDetailDrawer.tsx +++ b/src/features/store-admin/OrderDetailDrawer.tsx @@ -185,19 +185,23 @@ function Sheet({ label="Value" value={value > 0 ? moneyExact(value) : detailAmount > 0 ? moneyExact(detailAmount) : '—'} /> + {/* A delivery shows what the rider is paid. An order has no second + money figure worth the space: "Cash to collect" stood here and read + `collectionamt`, which Fiesta does not have — `grep --include=*.go` + finds nothing — so it was a dash on every order ever opened. + + Nor can it be derived. Measured across 800 live orders spanning + three tenants and two regions, including 247 delivered ones, + `orders.paymenttype` is 42 on every row and `paymentstatus` is not + returned by `getorders` at all. Nothing in the data separates a cash + order from a prepaid one. */} {job ? ( - ) : ( - - )} + ) : null} {/* Counted from the lines when the row carries no count. `itemcount` and `quantity` are both routinely absent on the list read, which is what made this a dash on an order that plainly had something in it. */}