# 🔵 Finance Module — FleetView Layout Clone + Enum Fix Blueprint **Date:** 2026-07-26 **Author:** Architect Mode **Status:** Pending Code Mode Execution **Priority:** MEDIUM — Layout fix and enum data repair --- ## STEP 1: THE WORKING LAYOUT — FleetView Analysis **Route:** `/organization/:org_id/vehicles` **Component:** [`FleetView.vue`](frontend_app/src/views/vehicles/FleetView.vue) wrapped in [`OrganizationLayout.vue`](frontend_app/src/layouts/OrganizationLayout.vue) ### FleetView.vue DOM Hierarchy (Key Elements) ```html

{{ title }}

{{ subtitle }}

``` ### OrganizationLayout.vue Role [`OrganizationLayout.vue`](frontend_app/src/layouts/OrganizationLayout.vue) provides: - `BaseHeader` with company name + hamburger menu - `main class="relative z-10"` → `` - **NO background** — the child view (`FleetView`) provides its own ### FinanceLayout.vue Current State [`FinanceLayout.vue`](frontend_app/src/layouts/FinanceLayout.vue) provides: - `BaseHeader` with `HeaderLogo` + `LanguageSwitcher` + `HeaderProfile` - **ALREADY HAS background** — `fixed inset-0 z-0` + `bg-[url('@/assets/garage-bg.png')]` + dark overlay `bg-black/30` - `main class="relative z-10"` → `` ### Critical Difference: FinanceLayout vs OrganizationLayout | Property | OrganizationLayout | FinanceLayout | |----------|-------------------|---------------| | Background | ❌ None (child provides) | ✅ Already provides `garage-bg.png` | | Dark overlay | ❌ None | ✅ Already provides `bg-black/30` | | Header | Company name + hamburger | Logo + lang switcher + profile | | `main` class | `relative z-10` | `relative z-10` | **Conclusion:** Since `FinanceLayout` already provides the background + overlay, the child views should NOT duplicate them. The fix is to make `FinanceMainView.vue` use the **same inner container pattern** as `FleetView` (line 12: `relative z-10 mx-auto max-w-7xl px-4 py-8 sm:px-6 lg:px-8`) but SKIP the background/overlay divs (which are in FinanceLayout). ### What's Currently Wrong with FinanceMainView Current structure (after previous fixes): ```html
...header...
...cards...
``` Problems: 1. **`justify-end min-h-[85vh]`** — This is the DashboardView pattern (bottom-aligned). FleetView uses `py-8` (top-aligned). The finance cards should be top-aligned with proper padding. 2. **`lg:grid-cols-5`** — Dashboard uses 5-column for its 5 cards. Finance has 4 cards. Should use whatever fits well. 3. No `relative` on outer wrapper — needed for z-index context. --- ## STEP 2: THE FIX — Clone FleetView Inner Structure For [`FinanceMainView.vue`](frontend_app/src/views/FinanceMainView.vue): ```html ``` **Key changes:** 1. Outer wrapper: `
` (replaces `flex flex-col justify-end min-h-[85vh] pb-8`) 2. Content container: `
` — exact clone of FleetView:12 3. Header stays nested inside the `mx-auto` container 4. Grid: `lg:grid-cols-4` instead of `lg:grid-cols-5` (4 cards instead of 5) 5. NO background divs (FinanceLayout provides them) ### Same fix for other 3 finance views [`FinanceWalletsView.vue`](frontend_app/src/views/FinanceWalletsView.vue), [`FinancePackagesView.vue`](frontend_app/src/views/FinancePackagesView.vue), [`FinanceTransactionsView.vue`](frontend_app/src/views/FinanceTransactionsView.vue) — each needs the same structural fix: remove `flex flex-col justify-start min-h-[85vh] py-8` wrapper and replace with `relative min-h-screen` + `relative z-10 mx-auto max-w-7xl px-4 py-8 sm:px-6 lg:px-8`. --- ## STEP 3: LEDGER_STATUS ENUM FIX ### 3A: The Enum Definition [`audit.py`](backend/app/models/system/audit.py:70-75): ```python class LedgerStatus(str, enum.Enum): PENDING = "PENDING" SUCCESS = "SUCCESS" FAILED = "FAILED" REFUNDED = "REFUNDED" REFUND = "REFUND" ``` ### 3B: The Seed Script (BROKEN) [`seed_financial_ledger.py:20`](backend/scripts/seed_financial_ledger.py:20): ```python DB_STATUSES = ["pending", "completed", "failed", "cancelled"] ``` Mapping to valid enum values: | Seed value | Valid Enum | Reason | |-----------|-----------|--------| | `pending` → | `PENDING` | Case fix only | | `completed` → | `SUCCESS` | Closest semantic match (completed payment = success) | | `failed` → | `FAILED` | Case fix only | | `cancelled` → | `REFUNDED` | Cancelled payments are typically refunded | ### 3C: Fix Plan **Fix A — Seed script:** ```python DB_STATUSES = ["PENDING", "SUCCESS", "FAILED", "REFUNDED"] ``` **Fix B — Database cleanup SQL:** ```sql UPDATE audit.financial_ledger SET status = 'PENDING' WHERE status::text = 'pending'; UPDATE audit.financial_ledger SET status = 'SUCCESS' WHERE status::text = 'completed'; UPDATE audit.financial_ledger SET status = 'FAILED' WHERE status::text = 'failed'; UPDATE audit.financial_ledger SET status = 'REFUNDED' WHERE status::text = 'cancelled'; ``` --- ## STEP 4: CODE MODE HAND-OFF — Task List ### Task 1: Restructure FinanceMainView layout (FleetView clone) **File:** [`frontend_app/src/views/FinanceMainView.vue`](frontend_app/src/views/FinanceMainView.vue) Replace the entire `