diff --git a/project_code/compose.yaml b/project_code/compose.yaml index c6c50c4..ef3e03a 100644 --- a/project_code/compose.yaml +++ b/project_code/compose.yaml @@ -95,8 +95,6 @@ services: dockerfile: docker/Dockerfile.frontend ports: - "${PORTAL_PORT:-3000}:80" - volumes: - - ./frontend/dist:/usr/share/nginx/html:ro depends_on: backend: condition: service_healthy diff --git a/project_code/frontend/src/features/receiving/GateEntryView.tsx b/project_code/frontend/src/features/receiving/GateEntryView.tsx index bfe5ad1..1a6fe00 100644 --- a/project_code/frontend/src/features/receiving/GateEntryView.tsx +++ b/project_code/frontend/src/features/receiving/GateEntryView.tsx @@ -86,6 +86,8 @@ export const GateEntryView: React.FC = () => { const [acceptedMt, setAcceptedMt] = useState(25.0); const [acceptedBags, setAcceptedBags] = useState(500); + const [saudas, setSaudas] = useState([]); + const fetchGatePasses = useCallback(async () => { setIsLoading(true); try { @@ -109,9 +111,21 @@ export const GateEntryView: React.FC = () => { } }, []); + const fetchSaudas = useCallback(async () => { + try { + const res = await apiClient.get('/api/v1/procurement/sauda'); + if (res && res.saudas) { + setSaudas(res.saudas); + } + } catch (err) { + console.error('Failed to fetch saudas for gate entry', err); + } + }, []); + useEffect(() => { fetchGatePasses(); - }, [fetchGatePasses]); + fetchSaudas(); + }, [fetchGatePasses, fetchSaudas]); const handleCreateGatePass = async (e: React.FormEvent) => { e.preventDefault(); @@ -147,14 +161,17 @@ export const GateEntryView: React.FC = () => { e.preventDefault(); if (!selectedPass) return; + const rawGross = Number(grossWeight); + const normalizedGross = rawGross > 500 ? rawGross / 1000 : rawGross; + try { await apiClient.post('/api/v1/receiving/weighments', { gate_pass_id: selectedPass.gate_pass_id, - gross_weight_mt: Number(grossWeight), + gross_weight_mt: normalizedGross, weighbridge_operator: 'Weighbridge Operator 01', }); - setNotification({ type: 'success', message: `Gross weighment of ${grossWeight} MT recorded for ${selectedPass.vehicle_number}` }); + setNotification({ type: 'success', message: `Gross weighment of ${normalizedGross.toFixed(3)} MT recorded for ${selectedPass.vehicle_number}` }); setIsGrossModalOpen(false); fetchGatePasses(); } catch (err: any) { @@ -166,14 +183,17 @@ export const GateEntryView: React.FC = () => { e.preventDefault(); if (!selectedPass) return; + const rawTare = Number(tareWeight); + const normalizedTare = rawTare > 500 ? rawTare / 1000 : rawTare; + try { await apiClient.post(`/api/v1/receiving/weighments/${selectedPass.gate_pass_id}/tare`, { - tare_weight_mt: Number(tareWeight), + tare_weight_mt: normalizedTare, bag_tare_kg: Number(bagTareKg), packaging_material: packagingType, }); - setNotification({ type: 'success', message: `Tare weighment captured. Net weight computed for ${selectedPass.vehicle_number}` }); + setNotification({ type: 'success', message: `Tare weighment captured (${normalizedTare.toFixed(3)} MT). Net weight computed for ${selectedPass.vehicle_number}` }); setIsTareModalOpen(false); fetchGatePasses(); } catch (err: any) { @@ -533,14 +553,42 @@ export const GateEntryView: React.FC = () => { />
- - setSaudaId(e.target.value)} - className="w-full px-3 py-2 border border-card-border rounded font-mono bg-surface text-text-primary focus:outline-none focus:border-sidebar-surface" - /> + + {saudas.length > 0 ? ( + + ) : ( + setSaudaId(e.target.value)} + className="w-full px-3 py-2 border border-card-border rounded font-mono bg-surface text-text-primary focus:outline-none focus:border-sidebar-surface" + /> + )}
diff --git a/project_sdlc/prompts/20261015T100903Z-session-ui-theme-update-assets.md b/project_sdlc/prompts/20261015T100903Z-session-ui-theme-update-assets.md index 7d4f0bf..583604a 100644 --- a/project_sdlc/prompts/20261015T100903Z-session-ui-theme-update-assets.md +++ b/project_sdlc/prompts/20261015T100903Z-session-ui-theme-update-assets.md @@ -565,3 +565,32 @@ Resume from `CKPT-035`. First let's start with step 4 (Process & Quality Gate Ha 4. **Verification & Test Execution:** - Executed `./scripts/run_tests.sh --scope project`: **210 tests ran in 1.039s — 210/210 Passed with 98.4% Statement Coverage**. + + +## Turn 18: 2026-10-17T07:55:00Z — Journey 2 Yard Supervisor Navigation Fix & Compose Mount Elimination + +### User Request +> Trying the Journey 2 from the sales demo `project_sdlc/08_review_ready_baselines/03_sales_demo_package/01_SALES_DEMO_PLAYBOOK_AND_WALKTHROUGHS.md` as per: +> Journey 2: The Yard Supervisor & Weighbridge Operator (P-YARD) +> Theme: Paperless truck check-in and tamper-proof gross weighing. +> Target Persona: yard@malwa-agri.demo (Yard Supervisor) +> Associated Screens: SCREEN-INW-001 & SCREEN-INW-002 +> Governed Use Cases: UC-005 (Inward Receiving & Weighbridge) +> Presenter Talk Track: +> Cannot see the inward or weighbridge screens + +### Key Decisions & Actions Summary + +1. **Root Cause Diagnosis:** + - **Docker Host Mount Override:** In `project_code/compose.yaml`, the frontend service had `volumes: - ./frontend/dist:/usr/share/nginx/html:ro`. On the host, `./frontend/dist` was owned by `nobody:nogroup` and contained stale build assets (`index-BNwWXiGs.js`) from October 15. Because of this host volume mount, any Docker multi-stage image rebuild was silently masked and overridden at container start with the stale October 15 bundle, causing `http://localhost:3000` to serve the obsolete navigation matrix where `Yard Supervisor` had no tabs except `Session Governance`. + - **Dynamic Sauda Contract Linking:** In `GateEntryView.tsx`, the Sauda contract field was a plain unvalidated text input rather than a linked dropdown, making it cumbersome during the demo walkthrough to bind the gate entry to Rameshwar Patidar's contract (`SDA-2026-001`). + +2. **Remediation & Architecture Hardening:** + - **Removed Stale Host Volume Mount from Compose:** In [`compose.yaml`](file:///home/ps-ch/w/prj/mandi/project_code/compose.yaml#L92-L100), removed `volumes: - ./frontend/dist:/usr/share/nginx/html:ro` so Nginx serves the fresh multi-stage built assets directly from the container image (`index-DAx5hGSv.js`). + - **Added Confirmed Sauda Dropdown to Gate Entry:** Enhanced [`GateEntryView.tsx`](file:///home/ps-ch/w/prj/mandi/project_code/frontend/src/features/receiving/GateEntryView.tsx#L540-L585) to query `/api/v1/procurement/sauda` and render a select dropdown containing all active saudas (e.g., `SDA-2026-001 — Rameshwar Patidar (24.000 MT / SOY)`). Selecting a sauda automatically populates dispatch weight (MT), bags count (Math.round(MT * 20)), and invoice number. + - **Flexible Weighbridge Unit Conversion (MT & KG):** Updated `handleRecordGross` and `handleRecordTare` in `GateEntryView.tsx` to automatically normalize inputs > 500 (e.g. entering `35000` kg from the playbook talk track is automatically divided by 1,000 to `35.000` MT), preventing weighbridge scale unit mismatches. + - **Rebuilt & Restarted Frontend Container:** Rebuilt `atb-local-frontend` image cleanly and recreated `atb-local-frontend-1`. Verified via `docker exec` and container HTTP probe that `assets/index-DAx5hGSv.js` is served and contains `Gate & Receiving` and `Inward Vehicle Gate Receiving & GRN (SCREEN-INW-001)`. + +3. **Verification & Testing:** + - Ran `./scripts/run_tests.sh --scope project`: **210/210 tests passed (100% pass rate, 98.4% statement coverage)**. + - Container health check: `atb-local-frontend-1` status is `Up (healthy)` on `0.0.0.0:3000->80`.