diff --git a/src/components/dv/OrderDetail.tsx b/src/components/dv/OrderDetail.tsx index eaf4ad1..5f75672 100644 --- a/src/components/dv/OrderDetail.tsx +++ b/src/components/dv/OrderDetail.tsx @@ -4,7 +4,7 @@ import { ORDER_BOOKING } from '../../api/config'; import { Card } from '../reusable/Card'; import { Spinner } from '../reusable/Spinner'; import { EmptyState } from '../reusable/EmptyState'; -import { Store, User, Package, Calendar, Hash, Mail, Weight, List, MapPin } from 'lucide-react'; +import { Store, User, Package, Calendar, Hash, Weight, MapPin, ShoppingBag } from 'lucide-react'; export interface WiredDetailViewProps { instanceId: number | string; @@ -116,163 +116,169 @@ export function OrderDetail({ instanceId }: WiredDetailViewProps) { const totalKgs = extract('total_kgs_3', remainingData) || 0; return ( -
- {/* Top Section */} -
+
+ {/* Header */} +
-
Order ID
-
{String(orderId)}
-
- {String(dateOfOrder)} - Instance #{instanceId} +

Order Detail

+

#{orderId}

+
+
+ + {/* Status + Date ribbon */} +
+
+ + + {String(stateName)} + + Order ID + {String(orderId)} +
+
+ + {String(dateOfOrder)} + + + Instance #{instanceId} + +
+
+ +
+ {/* Main content */} +
+ {/* Store summary */} +
+
+
+ +
+

Store

+
+
+
+

Business

+

{String(storeName)}

+
+
+

Distributor

+

{String(distributorName)}

+
+
+

Route

+

+ {String(routeName)} ({String(routeCode)}) +

+
+
+

Store Code

+

{(storeRaw as any)?.store_code_2 || (storeRaw as any)?.store_code || '-'}

+
+
+
+ + {/* Order items */} +
+
+
+ +
+

Order Items

+ {itemsArray.length} items +
+
+ {itemsArray.map((item: any, index: number) => { + const product = item.product_name_3 || item.product_name || '-'; + const category = item.product_category_3 || item.product_category || '-'; + const sku = item.sku_code_3 || item.sku_code || item.sku || '-'; + const bags = item.bags_3 || item.bags || item.quantity || 0; + const weight = item.sku_3 || item.sku || ''; + + return ( +
+
+
+ +
+
+

{String(product)}

+
+ + {String(category)} + + + {String(sku)} +
+
+
+
+

{String(bags)} bag{Number(bags) === 1 ? "" : "s"}

+ {weight &&

SKU {String(weight)}

} +
+
+ ) + })} + {itemsArray.length === 0 && ( +
No items found in this order.
+ )} +
-
-
- Store -
-
{String(storeName)}
-
- {String(routeCode)} - {String(routeName)} -
-
- {String(distributorName)} -
-
-
- {/* Middle Stats Section */} -
-
-
- Total Bags -
-
{String(totalBags)}
-
-
-
- Total Kilograms -
-
{Number(totalKgs).toLocaleString()}
-
-
-
- Order Items -
-
{itemsArray.length}
-
-
- - {/* Bottom Section */} -
- {/* Left Table */} -
-
- - Order Items + {/* Sidebar */} +
+ {/* Totals */} +
+
+
+ +
+

Totals

-
- - - - - - - - - - - {itemsArray.map((item: any, idx: number) => { - const product = item.product_name_3 || '-'; - const category = item.product_category_3 || '-'; - const sku = item.sku_code_3 || '-'; - const bags = item.bags_3 || '0'; - const brCode = item.br_code_3 || '-'; - const weight = item.sku_3 ? `${item.sku_3} kg` : '-'; - - return ( - - - - - - - ); - })} - - - - - -
ProductCategorySKUBags
-
{String(product)}
-
BR Code {String(brCode)}
-
{String(category)} -
{String(sku)}
-
{String(weight)}
-
{String(bags)}
Total{String(totalBags)}
+
+
+ Total Bags + {String(totalBags)} +
+
+ Total Weight + {Number(totalKgs).toLocaleString()} kg +
-
+
- {/* Right Sidebar */} -
- {/* SO Card */} -
-
- Sales Officer -
-
-
- {soInitials} -
-
-
{String(soName)}
-
Sales Officer - ID {String(soId)}
-
-
-
-
-
- -
-
-
Email
-
{String(soEmail)}
-
-
-
-
- -
-
-
User ID
-
{String(soId)}
-
-
-
+ {/* Sales officer */} +
+
+
+ +
+

Sales Officer

+
+
+ {soInitials} +
+
+

{String(soName)}

+

{String(soEmail)}

+

ID: {String(soId)}

+
+
+
- {/* Order Meta */} -
-
- Order Meta -
-
-
- Instance - #{instanceId} -
-
- State - {String(stateName)} -
-
- Date of Order - {String(dateOfOrder)} -
-
+ {/* Location hint */} +
+
+
+ +
+

Location

-
+

Order placed in route {String(routeName)}.

+
+
);