From e3af6100ecb2b60ff9b6ce8bfdd573b69442a514 Mon Sep 17 00:00:00 2001 From: DeepnaPooja Date: Tue, 29 Sep 2026 17:38:39 +0530 Subject: [PATCH] fix --- .../operations/loading/new/page.tsx | 136 +++++++++++++++++- 1 file changed, 133 insertions(+), 3 deletions(-) diff --git a/distribution_fe/app/(dashboard)/operations/loading/new/page.tsx b/distribution_fe/app/(dashboard)/operations/loading/new/page.tsx index c3ebb7e..64fb407 100644 --- a/distribution_fe/app/(dashboard)/operations/loading/new/page.tsx +++ b/distribution_fe/app/(dashboard)/operations/loading/new/page.tsx @@ -3,7 +3,7 @@ import { Fragment, Suspense, useEffect, useMemo, useRef, useState } from 'react' import { useRouter, useSearchParams } from 'next/navigation' import { HugeiconsIcon } from '@hugeicons/react' -import { ArrowLeft01Icon, ViewIcon } from '@hugeicons/core-free-icons' +import { ArrowLeft01Icon, ViewIcon, PencilEdit01Icon } from '@hugeicons/core-free-icons' import { Dialog, DialogContent, @@ -405,6 +405,17 @@ function LoadingSheetForm() { return Array.from(map.values()).sort((a, b) => a.itemName.localeCompare(b.itemName)) }, [selectedRows, lines, manualItems, itemsList]) + const reviewShopGroups = useMemo(() => { + const map = new Map() + for (const row of selectedRows) { + const line = lines[row.shopPOItemId] + const g = map.get(row.storeId) ?? { storeId: row.storeId, storeName: row.storeName, rows: [] } + g.rows.push({ row, line }) + map.set(row.storeId, g) + } + return Array.from(map.values()).sort((a, b) => a.storeName.localeCompare(b.storeName)) + }, [selectedRows, lines]) + const stockOverview = useMemo(() => { const map = new Map() for (const row of rows) { @@ -1038,11 +1049,130 @@ function LoadingSheetForm() { )} {step === 5 && ( -
+
+
+
+

Route & Warehouse

+ +
+
+
+
Region
+
{regionsList.find((r) => r.id === regionId)?.name ?? 'All regions'}
+
+
+
Route
+
{routesList.find((r) => r.id === routeId)?.routeName ?? '—'}
+
+
+
Shop filter
+
{storesList.find((s) => s.id === storeId)?.storeName ?? 'All shops'}
+
+
+
Warehouse
+
{warehousesList.find((w) => w.id === warehouseId)?.name ?? '—'}
+
+
+
+ +
+
+

Ride & Assignment

+ +
+
+
+
Ride (vehicle)
+
+ {(() => { + const r = ridesList.find((r) => r.id === rideId) + return r ? `${r.vehicleNumberPlate} — ${r.driverFullName}` : '—' + })()} +
+
+
+
Populated by
+
{usersList.find((u) => u.id === populatedByUserId)?.fullName ?? '—'}
+
+
+
+ +
+
+

Items from Shop POs

+ +
+ {reviewShopGroups.length === 0 ? ( +

No Shop PO items selected.

+ ) : ( +
+ {reviewShopGroups.map((group) => ( +
+
{group.storeName}
+ + + {group.rows.map(({ row, line }) => ( + + + + + + + {line.extras.filter((e) => e.warehouseId && e.quantity > 0).map((extra, idx) => ( + + + + + + ))} + + ))} + +
{row.itemName} + {warehousesList.find((w) => w.id === warehouseId)?.name} + {line.quantity}
— top-up + {warehousesList.find((w) => w.id === extra.warehouseId)?.name} + {extra.quantity}
+
+ ))} +
+ )} +
+ +
+
+

Additional Items

+ +
+ {manualItems.length === 0 ? ( +

No additional items.

+ ) : ( + + + {manualItems.map((m) => ( + + + + + + ))} + +
{itemsList.find((i) => i.id === m.itemId)?.name ?? '—'}{warehousesList.find((w) => w.id === m.warehouseId)?.name ?? '—'}{m.quantity}
+ )} +
+

Loading Sheet Summary

- {selectedRows.length} item{selectedRows.length === 1 ? '' : 's'} selected. + {selectedRows.length} item{selectedRows.length === 1 ? '' : 's'} from Shop POs, {manualItems.length} additional item{manualItems.length === 1 ? '' : 's'}.

-- 2.52.0