diff --git a/process/.agents/skills/up-code-generate/SKILL.md b/process/.agents/skills/up-code-generate/SKILL.md index 00a9dc6..3fe2a5c 100644 --- a/process/.agents/skills/up-code-generate/SKILL.md +++ b/process/.agents/skills/up-code-generate/SKILL.md @@ -55,7 +55,7 @@ Rules (apply to every story): 4. Enforce tenant isolation and authorization per the architecture spike's validated pattern. 5. Update `iteration_surface_matrix.md` with implementation status and verification evidence. In `traceability_graph.md`, transition requirement status to **`Implemented (Domain/Schema)`** upon code and unit test completion. DO NOT mark requirements as `Delivered` at this stage; `Delivered (E2E Verified)` is reserved for Gate 14.1 closure after all delivery surfaces, migrations, and dual QA assets pass. 6. Do not place secrets, live tokens, or production credentials in code, fixtures, logs, or commits. -7. **Strict Anti-Placeholder Rule:** Stub functions, mock controllers where real database logic was specified, and zero-coverage test stubs are strictly forbidden. All code must implement genuine business logic. +7. **Strict Anti-Placeholder Rule:** Stub functions, mock controllers where real database logic was specified, and zero-coverage test stubs are strictly forbidden. All code must implement genuine business logic. Every web portal/screen declared in `iteration_surface_matrix.md` must have a physical, genuine frontend view implementation (`.tsx`/`.vue`) on disk wired via typed API clients and registered in the application router. Ghost screens or unimplemented UI placeholders cannot be marked as `Delivered (E2E Verified)` and will fail Gate 14.1 check `G14-013`. 8. **Automated Test Coverage Budgets:** Ensure code meets the thresholds configured in `tech-profile.yaml`: - Backend Domain & FSMs: **≥95.0%** statement and branch coverage. - Integration Adapters: **≥90.0%** against Wave 0 sandboxes. diff --git a/process/.agents/skills/up-test-model-generate/SKILL.md b/process/.agents/skills/up-test-model-generate/SKILL.md index 0c19954..5868591 100644 --- a/process/.agents/skills/up-test-model-generate/SKILL.md +++ b/process/.agents/skills/up-test-model-generate/SKILL.md @@ -42,7 +42,7 @@ For every `STORY-xxx` in the current iteration: **Manual Testing Guide & 21-Sheet Excel Workbook:** For every iteration, Stage 12 MUST produce TWO complementary manual QA deliverables: 1. Markdown walkthrough guide: `project_sdlc/07_test_design/manual_qa/iteration-NN/MANUAL_TESTING_GUIDE.md` (preconditions, steps, disposable personas, expected results). -2. 21-sheet, 30-column Excel Manual QA Workbook: `project_sdlc/07_test_design/manual_qa/workbooks/IterationNN__Complete_Manual_Testcases.xlsx`, compiled deterministically using `scripts/generate_manual_qa_workbook.py`. The workbook MUST be densely populated with **$\ge 20$ concrete test cases** spanning the 16 test categories. Zero-row or empty template workbooks violate the anti-placeholder rule and fail Gate 14.1 with Critical errors. +2. 21-sheet, 30-column Excel Manual QA Workbook: `project_sdlc/07_test_design/manual_qa/workbooks/IterationNN__Complete_Manual_Testcases.xlsx`, compiled deterministically using `scripts/generate_manual_qa_workbook.py`. The workbook MUST be densely populated with **$\ge 20$ concrete test cases** spanning the 16 test categories, and MUST achieve **$\ge 80\%$ semantic alignment** directly targeting this iteration's specific in-scope Use Cases, Stories, and FRs. Copying identical boilerplate test cases across workbooks is strictly prohibited and fails Gate 14.1 with Critical error `G14-014`. Zero-row or empty template workbooks violate the anti-placeholder rule and fail Gate 14.1 with Critical error `G14-007`. **Test Idempotency & Disposable Personas:** Automated browser (Playwright) and API tests MUST enforce test idempotency — tests MUST NOT mutate shared global records. Use disposable personas or isolated database fixtures. diff --git a/process/.agents/skills/up-traceability-gate/SKILL.md b/process/.agents/skills/up-traceability-gate/SKILL.md index 7289dd1..67cd6b4 100644 --- a/process/.agents/skills/up-traceability-gate/SKILL.md +++ b/process/.agents/skills/up-traceability-gate/SKILL.md @@ -69,17 +69,17 @@ FAIL (do not proceed) if any Critical issue exists: 1. Requirement mapped across all applicable delivery surfaces in `iteration_surface_matrix.md`. 2. API documented; database migration present; integration adapter verified. 3. Tests passing: unit + API integration + real-runtime tests via `scripts/run_tests.sh`. - 4. Browser-E2E evidence for all web portals/views in scope. + 4. Frontend surface physical existence on disk: Every declared portal/screen in `iteration_surface_matrix.md` marked as `Delivered (E2E Verified)` has a corresponding physical `.tsx` component under `project_code/frontend/src/` and is registered in the router (`App.tsx`) (`G14-013`). 5. Explicit Unit/Smoke/Usability applicability decisions recorded. - 6. Required QA deliverables exist and meet **semantic density**: + 6. Required QA deliverables exist and meet **semantic density & alignment**: - `project_sdlc/07_test_design/manual_qa/iteration-NN/MANUAL_TESTING_GUIDE.md` present. - - 21-sheet Excel QA Workbook (`IterationNN__Complete_Manual_Testcases.xlsx`) compiled and densely populated with **$\ge 20$ concrete test cases** (zero-row/stub templates are strictly blocked with Critical errors). - 7. Bruno API Collections: Git-versioned `.bru` requests present under `project_code/docs/api/bruno/` for every declared API endpoint in the surface matrix. - 8. Functional Test Models: `07_test_design/functional_test_cases/TC-xxx.md` files verified across all 4 mandatory dimensions: Happy Path, Boundary/Edge, Negative/Security, and FSM Invariant. + - 21-sheet Excel QA Workbook (`IterationNN__Complete_Manual_Testcases.xlsx`) compiled and densely populated with **$\ge 20$ concrete test cases** (`G14-007`), achieving **$\ge 80\%$ semantic alignment** targeting the iteration's specific in-scope Use Cases without boilerplate copying across iterations (`G14-014`). + 7. Bruno API Collections: Git-versioned `.bru` requests present under `project_code/docs/api/bruno/` for every declared API endpoint in the surface matrix (`G14-008`). + 8. Functional Test Models: `07_test_design/functional_test_cases/TC-xxx.md` files verified across all 4 mandatory dimensions: Happy Path, Boundary/Edge, Negative/Security, and FSM Invariant (`G14-009`, `G14-010`). 9. Multi-path automated code and branch coverage meets or exceeds configured tier budgets (e.g. **≥95.0%** for domain FSMs, **≥90.0%** for adapters, **≥80.0%** for frontend components). 10. Cumulative regression suite passes via `scripts/run_tests.sh --scope iteration-NN`. -FAIL if any story lacks passing tests, automated test coverage does not meet configured thresholds, regression tests fail, QA workbooks have < 20 test cases, Bruno collections are missing, or delivery surfaces are unowned. +FAIL if any story lacks passing tests, automated test coverage does not meet configured thresholds, regression tests fail, QA workbooks have < 20 test cases, QA workbooks fail semantic alignment (< 80%), declared UI surfaces lack physical implementation on disk, Bruno collections are missing, or delivery surfaces are unowned. **Requirement Status Lifecycle:** - While stories and code are being implemented: status is `In Construction` or `Implemented (Domain/Schema)`. diff --git a/process/AI_Native_Unified_Process_v1.md b/process/AI_Native_Unified_Process_v1.md index f73afe4..9d9d3b2 100644 --- a/process/AI_Native_Unified_Process_v1.md +++ b/process/AI_Native_Unified_Process_v1.md @@ -125,7 +125,7 @@ Cross-cutting governance IDs: `DEC-xxx` (decision), `AMB-xxx` (ambiguity), `ASM- - **Frontend UI Components:** **≥80.0%** component branch coverage + mandatory Playwright browser-E2E test suites for all primary user journeys. Every user story must be tested across at least four dimensions: Happy Path, Alternate & Boundary/Edge Cases, Negative/Validation Failures, and FSM Invariant/Concurrency flows. 9. **Deterministic Gate Verification:** Quality Gates 5.1, 9.1, and 14.1 MUST be executed and verified via `scripts/verify_traceability_gates.py`. AI agents cannot self-certify gate closure without clean CLI validation evidence. -10. **Strict Anti-Placeholder & Semantic Density Enforcement (Gate 14.1):** An iteration cannot close and requirements cannot transition to 'Delivered' on the basis of empty templates, stub test suites, or zero-row workbooks. Gate 14.1 deterministically inspects Excel workbooks for a minimum density of $\ge 20$ test cases across test categories, verifies `.bru` collections in `docs/api/bruno/` for all declared API surfaces, and asserts 4-dimension coverage (Happy Path, Boundary/Edge, Negative/Security, FSM Invariant) in `07_test_design/functional_test_cases/`. Missing workbooks, zero-row workbooks, or missing Bruno collections are blocking Critical findings. +10. **Strict Anti-Placeholder & Semantic Density Enforcement (Gate 14.1):** An iteration cannot close and requirements cannot transition to 'Delivered' on the basis of empty templates, stub test suites, or zero-row workbooks. Gate 14.1 deterministically inspects Excel workbooks for a minimum density of $\ge 20$ test cases across test categories (`G14-007`), asserts $\ge 80\%$ semantic alignment targeting the iteration's in-scope Use Cases without stale boilerplate copying (`G14-014`), verifies physical disk existence of genuine frontend components (`.tsx`/`.vue`) in `project_code/frontend/src/` and registration in application routing for all declared UI surfaces (`G14-013`), verifies `.bru` collections in `project_code/docs/api/bruno/` for all declared API surfaces (`G14-008`), and asserts 4-dimension coverage (Happy Path, Boundary/Edge, Negative/Security, FSM Invariant) in `07_test_design/functional_test_cases/` (`G14-009`, `G14-010`). Missing workbooks, zero-row workbooks, misaligned QA workbooks, missing UI components, or missing Bruno collections are blocking Critical findings. 11. **Granular Requirement Status Progression:** Requirements in `traceability_graph.md` must strictly follow the progression: `Baselined` → `In Construction` → `Implemented (Domain/Schema)` → `Delivered (E2E Verified)`. Jumping directly from `Baselined` to `Delivered` without completing all delivery surfaces, live database migrations, UI wiring, and dual QA verification is strictly prohibited. 12. **Automated Test Execution Binding:** Passing automated tests via `scripts/run_tests.sh --scope ` is mandatory for Gate 14.1 closure. Tests must achieve configured coverage thresholds and pass without regression. @@ -355,7 +355,7 @@ Process adjustments follow their own dedicated meta-governance lifecycle, tracke | **Gate 5.1** | Stage 6 (Risk Ranking) | Zero UC with no FR; zero FR with invalid `parent_uc`. | `python3 scripts/verify_traceability_gates.py --gate 5.1` | | **Gate 9.1** | Construction | Zero FR without SRS + HLD + LLD linkage. | `python3 scripts/verify_traceability_gates.py --gate 9.1` | | **QG-E** | Construction (Stage 10) | Architecture baseline validated; Gates 5.1 and 9.1 both pass. | `@gatekeeper` | -| **Gate 14.1** | Next Iteration / Transition | Every STORY has a passing TC; explicit Unit/Smoke/Usability applicability decisions; automated coverage meets tiered budget ($\ge 95\%$ domain, $\ge 90\%$ adapter, $\ge 80\%$ frontend); cumulative regression suite passes; all delivery surfaces evidenced; real browser QA validated; required QA deliverables present (Manual Testing Guide and 21-sheet Excel workbook with $\ge 20$ dense test cases); Bruno `.bru` collections present for all declared APIs; 4 test dimensions verified; parallel lanes integrated cleanly. | `python3 scripts/verify_traceability_gates.py --gate 14.1 --iteration iteration-NN [--run-tests]` | +| **Gate 14.1** | Next Iteration / Transition | Every STORY has a passing TC; explicit Unit/Smoke/Usability applicability decisions; automated coverage meets tiered budget ($\ge 95\%$ domain, $\ge 90\%$ adapter, $\ge 80\%$ frontend); cumulative regression suite passes; all delivery surfaces evidenced; declared UI screens have physical `.tsx`/`.vue` implementations on disk in `project_code/frontend/src/` registered in routing (`G14-013`); required QA deliverables present (Manual Testing Guide and 21-sheet Excel workbook with $\ge 20$ dense test cases, $\ge 80\%$ semantic alignment to in-scope UCs without cross-iteration boilerplate copying, `G14-007`, `G14-014`); Bruno `.bru` collections present for all declared APIs (`G14-008`); 4 test dimensions verified (`G14-009`, `G14-010`); parallel lanes integrated cleanly. | `python3 scripts/verify_traceability_gates.py --gate 14.1 --iteration iteration-NN [--run-tests]` | | **QG-T** | Production Deployment | UAT passed; production readiness checklist passed; traceability graph 100% Delivered-or-Deferred-with-CR. | `@gatekeeper` | --- @@ -370,7 +370,8 @@ Process adjustments follow their own dedicated meta-governance lifecycle, tracke | **v1.3** | 2026-10-03 | **Multi-Stack & Frappe Framework Integration (`PCR-003`):** (1) Created ready-reference `tech-profile-presets.md` covering Frappe, Django, Spring Boot, FastAPI, and NestJS; (2) Upgraded `scripts/run_tests.sh` with multi-framework test runner dispatch (`bench run-tests`, `mvn/gradle`, `pytest`); (3) Updated `up-code-generate`, `up-arch-risk-spike`, and `up-wireframe-spec` with Frappe DocType schema generation, `bench migrate` synchronization, site-based multi-tenancy, and Frappe Desk screen conventions; (4) Segregated Process Change Requests (`PCR-xxx`) into `process_change_register.md` to prevent ID collisions with product changes (`CR-xxx`). | | **v1.4** | 2026-10-10 | **Gate 14.1 Semantic Density & Anti-Superficiality Hardening (`PCR-005`):** (1) Hardened `scripts/verify_traceability_gates.py` to enforce semantic density on 21-sheet Excel workbooks ($\ge 20$ populated test cases), blocking zero-row/stub templates with `Critical` exit codes; (2) Added mandatory Bruno API collection check asserting git-versioned `.bru` requests in `docs/api/bruno/` for all declared API surfaces; (3) Added 4-dimension functional test model verification (Happy Path, Boundary/Edge, Negative/Security, FSM Invariant); (4) Bound automated test execution (`--run-tests` hook) to Gate 14.1 closure; (5) Enforced granular requirement lifecycle states (`Baselined` → `In Construction` → `Implemented (Domain/Schema)` → `Delivered (E2E Verified)`); (6) Upgraded `scripts/generate_manual_qa_workbook.py` with dual-engine execution (openpyxl + zero-dependency zipfile/XML) and auto-population; (7) Injected binding anti-placeholder and anti-superficiality rules into `AGENTS.md`. | | **v1.6** | 2026-10-13 | **Top-Level 3-Directory Architecture & Customer Isolation (`PCR-007`):** (1) Formalized 3-tier top-level project layout separating universal process framework (`process/`), internal project engineering artifacts (`project_sdlc/`), and customer-deliverable codebase (`project_code/`); (2) Isolated customer deliverables into `project_code/` with self-contained Bruno API collections (`project_code/docs/api/bruno/`) and operational runbooks, eliminating external symlinks; (3) Updated `up-project-bootstrap` and `init-new-project.sh` to initialize clean scaffolding with empty `project_code/` (.gitkeep); (4) Enforced just-in-time directory auto-creation across all skills and strict 100% root-relative path hygiene. | -| **v1.7+** | (Future) | Process adjustments approved via `PCR-xxx` (Trigger Type `Process-Adjustment`) are version-bumped and recorded here per §8.8. | +| **v1.7** | 2026-10-16 | **Gate 14.1 Anti-Ghost-Surface & QA Alignment Hardening (`PCR-011`):** (1) Hardened `scripts/verify_traceability_gates.py` with check `G14-013` enforcing physical disk existence of genuine frontend components (`.tsx`/`.vue`) in `project_code/frontend/src/` and application route mapping for all UI delivery surfaces marked `Delivered (E2E Verified)`; (2) Added check `G14-014` enforcing $\ge 80\%$ semantic alignment of manual QA workbooks against iteration in-scope Use Cases, strictly blocking copy-paste boilerplate across workbooks; (3) Hardened `up-code-generate`, `up-test-model-generate`, and `up-traceability-gate` skills with binding physical surface existence and semantic QA rules; (4) Added complete operational frontend screen coverage and sales demo dataset seeding engine with reversible teardown. | +| **v1.8+** | (Future) | Process adjustments approved via `PCR-xxx` (Trigger Type `Process-Adjustment`) are version-bumped and recorded here per §8.8. | diff --git a/process/process_change_register.md b/process/process_change_register.md index 672a376..7822b9f 100644 --- a/process/process_change_register.md +++ b/process/process_change_register.md @@ -36,6 +36,8 @@ This guarantees: | `PCR-008` | Process-Adjustment | Process Architect / Framework Lead | 2026-10-13 | Framework Documentation Alignment & Root Agent Symlink Consolidation | Renamed `process/02_Skills_Usage_Guide.md` to `process/Skills_GUIDE.md` for consistent casing and naming convention. Consolidated all agent framework guides (`AGENTS.md`, `CLAUDE.md`, `GEMINI.md`) inside `process/` as the single canonical source of truth, linking root files via relative symlinks to ensure git-subtree synchronization and seamless multi-platform AI assistant discovery. Aligned `process/README.md` and root `README.md` with the 3-directory top-level architecture and updated `init-new-project.sh` to scaffold all agent symlinks automatically. | `process/Skills_GUIDE.md`, `process/AGENTS.md`, `process/CLAUDE.md`, `process/GEMINI.md`, `process/README.md`, `README.md`, `process/scripts/init-new-project.sh`, `process/process_change_register.md` | Documentation hygiene and agent framework single-source-of-truth consolidation | Approved | Closed | | `PCR-009` | Process-Adjustment | Process Architect / Project Governance Lead | 2026-10-13 | Root Layout Hygiene & Transcripts Encapsulation under `project_sdlc/prompts/` | Eliminated root `prompts` convenience symlink in favor of exclusive placement under `project_sdlc/prompts/`. Updated process specification, scaffolding script (`init-new-project.sh`), bootstrap skill (`up-project-bootstrap`), process `AGENTS.md` instructions, and repository documentation to reference `project_sdlc/prompts/` directly via root-relative paths. Preserves a pristine repository root containing only the 3 primary directories (`process/`, `project_sdlc/`, `project_code/`) and essential agent entrypoint symlinks. | `process/AI_Native_Unified_Process_v1.md`, `process/scripts/init-new-project.sh`, `process/.agents/skills/up-project-bootstrap/SKILL.md`, `process/AGENTS.md`, `process/README.md`, `README.md`, `process/process_change_register.md` | Root hygiene and strict project_sdlc encapsulation | Approved | Closed | | `PCR-010` | Process-Adjustment | Process Architect / Engineering Lead | 2026-10-13 | Complete Path Modernization Across Framework Guides, Presets, Templates & Skills | Audited and modernized all remaining legacy path references (`04_generated_documentation/`, `05_implementation_workspace/`, `01_BRD/`, `02_legacy_source_code/`, `00_prompts/`) across `process/framework_guides/` (Frappe App-Centric guide), `process/templates/` (`tech-profile-presets.md`, `tech-profile.template.yaml`), `process/Skills_GUIDE.md`, and all 19 canonical agent skills (`process/.agents/skills/*/SKILL.md`). Replaced legacy paths with canonical root-relative paths under `project_sdlc/` and `project_code/`, ensuring 100% path alignment with the 3-directory top-level architecture. | `process/framework_guides/frappe_app_centric_development_guide.md`, `process/templates/tech-profile-presets.md`, `process/templates/tech-profile.template.yaml`, `process/Skills_GUIDE.md`, `process/.agents/skills/*/SKILL.md`, `process/scripts/generate_manual_qa_workbook.py`, `process/process_change_register.md` | Complete framework path consistency and eradication of legacy directory references | Approved | Closed | +| `PCR-011` | Process-Adjustment | Quality Assurance Architect / Process Lead | 2026-10-16 | Gate 14.1 Anti-Ghost-Surface & QA Alignment Hardening | Hardened Gate 14.1 and construction skills against superficial completion: (1) Added rule `G14-013` to `scripts/verify_traceability_gates.py` enforcing physical disk existence of genuine frontend components (`.tsx`/`.vue`) in `project_code/frontend/src/` and application route mapping for all UI delivery surfaces marked `Delivered (E2E Verified)`; (2) Added rule `G14-014` enforcing $\ge 80\%$ semantic alignment of manual QA workbooks against iteration in-scope Use Cases, strictly blocking copy-paste boilerplate across workbooks; (3) Hardened `up-code-generate`, `up-test-model-generate`, and `up-traceability-gate` skills with binding physical surface existence and semantic QA rules; (4) Added complete operational frontend screen coverage and sales demo dataset seeding engine with reversible teardown. | `process/AI_Native_Unified_Process_v1.md`, `scripts/verify_traceability_gates.py`, `process/.agents/skills/up-code-generate/SKILL.md`, `process/.agents/skills/up-test-model-generate/SKILL.md`, `process/.agents/skills/up-traceability-gate/SKILL.md`, `process/process_change_register.md` | UP-AI v1.7 bump; Gate 14.1 anti-ghost surface validation and QA workbook semantic alignment | Approved | Closed | + diff --git a/project_code/frontend/src/App.tsx b/project_code/frontend/src/App.tsx index 3b1af9d..a326ee7 100644 --- a/project_code/frontend/src/App.tsx +++ b/project_code/frontend/src/App.tsx @@ -10,6 +10,14 @@ import { TenantMembersView } from './features/tenant/TenantMembersView'; import { AuditLogView } from './features/tenant/AuditLogView'; import { MarketDeskView } from './features/market/MarketDeskView'; import { SaudaProcurementView } from './features/procurement/SaudaProcurementView'; +import { GateEntryView } from './features/receiving/GateEntryView'; +import { QualityLabView } from './features/quality/QualityLabView'; +import { StockLedgerView } from './features/inventory/StockLedgerView'; +import { SalesOrderView } from './features/sales/SalesOrderView'; +import { DispatchBoardView } from './features/logistics/DispatchBoardView'; +import { FinanceLedgerView } from './features/finance/FinanceLedgerView'; +import { ExecutiveDashboardView } from './features/reporting/ExecutiveDashboardView'; +import { MasterDataView } from './features/admin/MasterDataView'; import { Shield, Building2, @@ -19,10 +27,97 @@ import { Layers, TrendingUp, ShoppingCart, - UserCheck + UserCheck, + Truck, + FlaskConical, + Warehouse, + FileSpreadsheet, + Send, + DollarSign, + BarChart3, + Database } from 'lucide-react'; -export type TabId = 'market' | 'procurement' | 'members' | 'tenants' | 'audit' | 'sessions'; +export type TabId = + | 'market' + | 'procurement' + | 'receiving' + | 'quality' + | 'inventory' + | 'sales' + | 'logistics' + | 'finance' + | 'dashboard' + | 'admin' + | 'members' + | 'tenants' + | 'audit' + | 'sessions'; + +/** + * Surface Route Mapping Registry. + * Explicitly associates URL routes from the SDLC Delivery Surface Matrix + * with their active frontend operational components. + */ +export const APP_ROUTE_SURFACE_MAP: Record = { + // Iteration 03 / UC-002: Mandi Market Desk + '/market/observations': 'market', + '/market/rates/latest': 'market', + '/market-desk/trends': 'dashboard', + + // Iteration 03 / UC-004: Inward Receiving & Gate Entry + '/receiving/gate-entry': 'receiving', + '/receiving/gate-entry/{id}': 'receiving', + '/receiving/weighbridge': 'receiving', + '/receiving/grn': 'receiving', + '/receiving/grn/{id}': 'receiving', + '/inventory/lots': 'receiving', + + // Iteration 03 / UC-005 & UC-006: Quality Lab & Lot Governance + '/quality/inspection/new': 'quality', + '/quality/inspection/{id}': 'quality', + '/quality/lots/{id}': 'quality', + '/quality/settlement/{id}': 'quality', + '/quality/lots/{lot_id}/certificate': 'quality', + + // Iteration 04 / UC-007: Warehouse Inventory + '/inventory/ledger': 'inventory', + '/inventory/capacity': 'inventory', + '/inventory/transfers': 'inventory', + + // Iteration 04 / UC-008: Sales Contracts + '/sales/orders': 'sales', + '/sales/orders/new': 'sales', + '/sales/orders/{id}': 'sales', + + // Iteration 04 / UC-009 & UC-010: Outbound Logistics & Fleet + '/logistics/dispatch-board': 'logistics', + '/logistics/weighbridge': 'logistics', + '/logistics/bilty/{id}': 'logistics', + '/logistics/pod': 'logistics', + '/logistics/fleet': 'logistics', + + // Iteration 05 / UC-011, UC-012, UC-013: Finance Settlement + '/finance/receivables': 'finance', + '/finance/receivables/exposure': 'finance', + '/finance/receivables/locks': 'finance', + '/finance/receipts': 'finance', + '/finance/receipts/new': 'finance', + '/finance/payables': 'finance', + '/finance/expenses': 'finance', + '/finance/expenses/new': 'finance', + + // Iteration 06 / UC-003, UC-014, UC-015: Executive Dashboard & Alerts + '/dashboard': 'dashboard', + '/alerts': 'dashboard', + '/reporting/trends': 'dashboard', + + // Iteration 07 / UC-016, UC-020, UC-026: Master Data & Policies + '/admin/master-data/commodities': 'admin', + '/admin/master-data/counterparties': 'admin', + '/admin/support/grants': 'admin', + '/admin/policies': 'admin', +}; interface NavItemConfig { id: TabId; @@ -61,6 +156,104 @@ const ALL_NAV_ITEMS: NavItemConfig[] = [ 'Accounts Executive' ], }, + { + id: 'receiving', + label: 'Gate & Receiving', + icon: Truck, + allowedRoles: [ + 'Mandi Buyer', + 'Purchase Manager', + 'Partner / MD', + 'Tenant Administrator', + 'Procurement Officer', + 'Quality Officer', + 'Warehouse Clerk' + ], + }, + { + id: 'quality', + label: 'Quality Lab Assay', + icon: FlaskConical, + allowedRoles: [ + 'Quality Officer', + 'Quality Inspector', + 'Lab Chemist', + 'Purchase Manager', + 'Partner / MD', + 'Tenant Administrator' + ], + }, + { + id: 'inventory', + label: 'Stock Ledger', + icon: Warehouse, + allowedRoles: [ + 'Warehouse Clerk', + 'Purchase Manager', + 'Partner / MD', + 'Tenant Administrator', + 'Desk Trader', + 'Accounts Executive' + ], + }, + { + id: 'sales', + label: 'Sales Contracts', + icon: FileSpreadsheet, + allowedRoles: [ + 'Sales Executive', + 'Sales Manager', + 'Desk Trader', + 'Partner / MD', + 'Tenant Administrator', + 'Accounts Executive' + ], + }, + { + id: 'logistics', + label: 'Dispatch & Fleet', + icon: Send, + allowedRoles: [ + 'Warehouse Clerk', + 'Sales Executive', + 'Sales Manager', + 'Partner / MD', + 'Tenant Administrator' + ], + }, + { + id: 'finance', + label: 'Finance Settlement', + icon: DollarSign, + allowedRoles: [ + 'Accounts Executive', + 'Partner / MD', + 'Tenant Administrator', + 'Sales Manager' + ], + }, + { + id: 'dashboard', + label: 'Executive Control', + icon: BarChart3, + allowedRoles: [ + 'Partner / MD', + 'Tenant Administrator', + 'Purchase Manager', + 'Sales Manager', + 'Accounts Executive' + ], + }, + { + id: 'admin', + label: 'Master Administration', + icon: Database, + allowedRoles: [ + 'Tenant Administrator', + 'Partner / MD', + 'System Administrator' + ], + }, { id: 'members', label: 'Tenant Members', @@ -88,16 +281,28 @@ const ALL_NAV_ITEMS: NavItemConfig[] = [ ]; const resolveDefaultTab = (roles: string[]): TabId => { - if (roles.includes('Mandi Buyer') || roles.includes('Purchase Manager') || roles.includes('Partner / MD')) { + if (roles.includes('Partner / MD') || roles.includes('Tenant Administrator')) { + return 'dashboard'; + } + if (roles.includes('Mandi Buyer') || roles.includes('Purchase Manager')) { return 'market'; } - if (roles.includes('Tenant Administrator')) { - return 'members'; + if (roles.includes('Sales Executive') || roles.includes('Sales Manager')) { + return 'sales'; + } + if (roles.includes('Accounts Executive')) { + return 'finance'; + } + if (roles.includes('Quality Officer') || roles.includes('Lab Chemist')) { + return 'quality'; + } + if (roles.includes('Warehouse Clerk')) { + return 'receiving'; } if (roles.includes('System Administrator')) { return 'tenants'; } - return 'sessions'; + return 'market'; }; export const App: React.FC = () => { @@ -173,7 +378,7 @@ export const App: React.FC = () => { {/* Role-Gated Navigation Items */} -