Updated the DESIGN.md

This commit is contained in:
Prashant Shendre 2026-10-15 15:34:12 +05:30
parent 1b16dfdbf5
commit c9883df3da
1 changed files with 188 additions and 513 deletions

View File

@ -1,538 +1,213 @@
---
id: DESIGN
version: 1.1.0
status: Reviewed
last_cr: CR-001
name: AgriTrade Mercantile
colors:
surface: '#f9f9f6'
surface-dim: '#dadad7'
surface-bright: '#f9f9f6'
surface-container-lowest: '#ffffff'
surface-container-low: '#f4f4f1'
surface-container: '#eeeeeb'
surface-container-high: '#e8e8e5'
surface-container-highest: '#e2e3e0'
on-surface: '#1a1c1b'
on-surface-variant: '#434845'
inverse-surface: '#2f312f'
inverse-on-surface: '#f1f1ee'
outline: '#737875'
outline-variant: '#c3c8c4'
surface-tint: '#55615c'
primary: '#030b08'
on-primary: '#ffffff'
primary-container: '#18231f'
on-primary-container: '#7f8b85'
inverse-primary: '#bdc9c3'
secondary: '#865300'
on-secondary: '#ffffff'
secondary-container: '#feb55a'
on-secondary-container: '#734700'
tertiary: '#120705'
on-tertiary: '#ffffff'
tertiary-container: '#2c1d1b'
on-tertiary-container: '#9a8380'
error: '#ba1a1a'
on-error: '#ffffff'
error-container: '#ffdad6'
on-error-container: '#93000a'
primary-fixed: '#d9e5df'
primary-fixed-dim: '#bdc9c3'
on-primary-fixed: '#131e1a'
on-primary-fixed-variant: '#3e4945'
secondary-fixed: '#ffddb8'
secondary-fixed-dim: '#ffb961'
on-secondary-fixed: '#2b1700'
on-secondary-fixed-variant: '#663e00'
tertiary-fixed: '#f8dcd9'
tertiary-fixed-dim: '#dbc1bd'
on-tertiary-fixed: '#261816'
on-tertiary-fixed-variant: '#554240'
background: '#f9f9f6'
on-background: '#1a1c1b'
surface-variant: '#e2e3e0'
sidebar-surface: '#162A22'
sidebar-surface-active: '#2A4237'
card-surface: '#FFFFFF'
card-border: '#E8E6DF'
text-primary: '#1C1E1D'
text-muted: '#78716C'
status-normal-bg: '#EAF5ED'
status-normal-text: '#2D6A4F'
status-watch-bg: '#FDF6E7'
status-watch-text: '#926A1D'
accent-ochre: '#C89332'
typography:
headline-xl:
fontFamily: Inter
fontSize: 2rem
fontWeight: '700'
lineHeight: 2.5rem
letterSpacing: -0.02em
headline-lg:
fontFamily: Inter
fontSize: 1.5rem
fontWeight: '600'
lineHeight: 2rem
letterSpacing: -0.015em
headline-md:
fontFamily: Inter
fontSize: 1.25rem
fontWeight: '600'
lineHeight: 1.75rem
letterSpacing: -0.01em
headline-sm:
fontFamily: Inter
fontSize: 1.125rem
fontWeight: '600'
lineHeight: 1.5rem
body-lg:
fontFamily: Inter
fontSize: 1rem
fontWeight: '400'
lineHeight: 1.5rem
body-md:
fontFamily: Inter
fontSize: 0.875rem
fontWeight: '400'
lineHeight: 1.25rem
body-sm:
fontFamily: Inter
fontSize: 0.75rem
fontWeight: '400'
lineHeight: 1rem
label-uppercase:
fontFamily: Inter
fontSize: 0.6875rem
fontWeight: '600'
lineHeight: 0.875rem
letterSpacing: 0.06em
metric-mono-lg:
fontFamily: JetBrains Mono
fontSize: 1.125rem
fontWeight: '500'
lineHeight: 1.5rem
metric-mono-md:
fontFamily: JetBrains Mono
fontSize: 0.875rem
fontWeight: '500'
lineHeight: 1.25rem
metric-mono-sm:
fontFamily: JetBrains Mono
fontSize: 0.75rem
fontWeight: '400'
lineHeight: 1rem
rounded:
sm: 0.125rem
DEFAULT: 0.25rem
md: 0.375rem
lg: 0.5rem
xl: 0.75rem
full: 9999px
spacing:
gutter: 1rem
gutter-compact: 0.5rem
margin: 1.5rem
margin-mobile: 0.75rem
space-xs: 0.25rem
space-sm: 0.5rem
space-md: 0.75rem
space-lg: 1rem
space-xl: 1.5rem
space-xxl: 2rem
---
# Design.md — IndiaAgriTrade (RamDayal Agri Commodities) Wholesale Trading Desk
## Brand & Style
A comprehensive UI/UX, Component Architecture, and Visual Design Specification for building the **IndiaAgriTrade RamDayal BackOffice & Wholesale Trading Desk** using **Vue 3 (Composition API / <script setup>)** and **Tailwind CSS**.
This design system serves high-volume wholesale dry-agricultural trading, logistics tracking, and back-office settlement operations. The brand identity fuses deep mercantile tradition with modern computational efficiency. The UI communicates stability, rigorous accountability, and instantaneous legibility across dense transactional ledgers.
---
The aesthetic philosophy draws on **Tactile Corporate Minimalism** tailored for data density. Crisp off-white stone backdrops eliminate glare during extended trading shifts, balanced by an authoritative, grounded deep pine green structural shell. Visual hierarchy relies on razor-thin stone borders, deliberate monospace numerical breakouts, and disciplined ochre-amber highlights for status indicators rather than decorative distraction.
## 1. Executive Summary & Domain Architecture
## Colors
### 1.1 Business Context
**IndiaAgriTrade (RamDayal)** represents an enterprise-grade wholesale agricultural commodity trading and back-office desk operating across major Indian Mandis (APMC markets), grain corridors, oilseed hubs, and pulse processing centers.
The palette balances mercantile tradition and tactical operational ergonomics:
- **Primary (`#18231F`) & Sidebar Base (`#162A22`)**: Authoritative deep forest pine greens establish the system frame, framing trade workspaces with stable anchoring. Active navigation elements sit in elevated pine green (`#2A4237`).
- **Secondary (`#DF9B42`) & Accent Ochre (`#C89332`)**: Warm harvest amber and rich ochre reflect bulk grain, pulses, and oilseed commodities. Applied strictly to critical alerts, entity badges, active filter tabs, and left callout borders.
- **Neutral Base (`#F7F7F4`) & Cards (`#FFFFFF`)**: A warm stone foundation reduces eye strain under fluorescent trading floor environments. Content cards pop forward via clean milk-white panels framed with precision borders (`#E8E6DF`).
- **Semantic Ledger Tags**: Functional green status (`#EAF5ED` surface / `#2D6A4F` ink) indicates settled contracts or healthy stock levels. Watch status (`#FDF6E7` surface / `#926A1D` ink) denotes pending inspections, delayed rail manifests, or margin limits.
Key functional pillars:
1. **Trading Desk / Live Mandi Book**: Real-time bid/ask order book across spot Mandi contracts, futures arbitrage, forward booking (Wheat, Chana, Mustard, Soyabean, Paddy/Basmati, Cotton, Maize, Tur/Arhar).
2. **Trader Blotter & Position Management**: Net physical exposure (metric tons), warehouse stock receipts (WSR/e-NWR), and daily MTM (Mark-to-Market) P&L.
3. **Mandi Settlement & Procurement (APMC)**: Farmer/FPO/Arhatiya settlement, mandi cess, loading/unloading (Hamali), moisture and foreign matter deduction (Karda/Quality Assay).
4. **Logistics & Dispatch Tracking**: Rake movements, fleet truck dispatches, e-Way bills, gate-in/gate-out weighbridge sync.
5. **Quality Assay & Lab Inspection**: Lab certificates, moisture %, admixture %, damaged grain %, protein/oil content, Fair Average Quality (FAQ) standards.
6. **Financial Ledger & Khata (Vyapar Bahi)**: GST compliant invoices, TDS (194Q / 206C), trader advance vouchers, credit aging, payment netting.
## Typography
---
The type hierarchy prioritizes high information density and numerical scanning precision:
- **Headlines & Interface Text**: Executed in **Inter** with tight tracking to maximize horizontal real estate. Headings use semi-bold weights with dark charcoal ink (`#1C1E1D`), avoiding harsh pitch blacks.
- **Tabular Data & Measurements**: Metric quantities (metric tonnes, quintals, bag counts, moisture percentages, settlement prices) render strictly in **JetBrains Mono** with tabular lining figures to ensure vertical decimal alignment across ledgers.
- **Section Headers & Field Keys**: Set in `label-uppercase` using uppercase casing with widened tracking (`0.06em`) and muted stone ink (`#78716C`) to partition sub-tables without heavy horizontal rules.
## 2. Brand Identity & Visual Design System
## Layout & Spacing
### 2.1 Color Palette (Tailwind Tokens)
Designed specifically for high-density agricultural trade execution — combining earthy reliability with financial clarity.
The layout model is an asymmetric fluid grid structured around a fixed **240px persistent dark pine navigation drawer** on the left and an expansive multi-column operational canvas on the right.
```javascript
// tailwind.config.js theme extension
module.exports = {
theme: {
extend: {
colors: {
// Agri Brand Greens (Growth, Agriculture, APMC Trust)
agri: {
50: '#f0fdf4',
100: '#dcfce7',
200: '#bbf7d0',
500: '#15803d',
600: '#166534',
700: '#14532d',
800: '#0f3f22',
900: '#0a2a17',
},
// Grain / Earth Warm Neutrals (Wheat, Mustard, Mandi)
grain: {
50: '#fffbeb',
100: '#fef3c7',
200: '#fde68a',
400: '#f59e0b',
600: '#d97706',
700: '#b45309',
900: '#78350f',
},
// Trading Finance Semantic Signals
trade: {
bid: '#059669', // Buy / Green
bidBg: '#ecfdf5',
ask: '#dc2626', // Sell / Red
askBg: '#fef2f2',
neutral: '#475569',
hold: '#d97706',
arbitrage: '#6366f1'
},
// High-Density Data Backgrounds & Surfaces
surface: {
base: '#f8fafc',
card: '#ffffff',
subtle: '#f1f5f9',
border: '#e2e8f0',
darkBg: '#0f172a',
darkCard: '#1e293b',
darkBorder: '#334155'
}
}
}
}
}
```
- **Grid Architecture**: 12-column dynamic grid with standard `1rem` gutters, collapsing to an ultra-dense `0.5rem` gutter configuration for back-office execution ledgers and commodity ticker grids.
- **Spacing Rhythm**: Spacing scales in tight 4px increments (`0.25rem` to `2rem`). Padding within tabular rows remains compressed (`space-xs` vertical, `space-sm` horizontal) to display at least 18 rows above the fold on standard desktop terminals.
- **Breakpoints**:
- `Desktop (>= 1280px)`: Full persistent sidebar with multi-panel ledger views and side drawer inspections.
- `Tablet (768px - 1279px)`: Sidebar collapses to 64px icon rail; main grid shifts to 8 columns.
- `Mobile (< 768px)`: Sidebar converts to a full-screen bottom-sheet overlay; tabular grids convert into stacked commodity contract cards.
### 2.2 Typography
- **Primary Interface Font**: `Inter` or `Plus Jakarta Sans` for clean tabular numbers and compact labeling.
- **Numbers & Rates**: Monospaced font family `JetBrains Mono` or tabular numerals (`tabular-nums font-mono`) for rates per quintal (₹/Qtl), weights (MT), and ledger figures.
- **Scale**:
- Micro Badges: `text-[10px] font-semibold tracking-wider uppercase`
- Compact Data Table: `text-xs leading-4 font-normal text-slate-700`
- Table Headers & Metric Labels: `text-[11px] font-bold text-slate-500 uppercase tracking-wide`
- Primary Field Values: `text-sm font-semibold text-slate-900 font-mono tabular-nums`
- Large Trading Figures / P&L: `text-xl md:text-2xl font-bold font-mono tracking-tight`
## Elevation & Depth
### 2.3 Layout Structure & Grid
- **Global Frame**:
- Persistent Header: Mandi clock (IST / Market Open/Close countdown), global ticker marquee (Wheat, Chana, Mustard, Soyabean, Paddy rates), quick search (`CMD+K`), active terminal profile ("RamDayal Traders - Indore Hub").
- Left Collapsible Navigation: Categorized into **Trading Desk**, **Procurement & Mandi**, **Warehouse & Logistics**, **Lab & Quality Assay**, **Financials & Ledgers**, and **Reports & Compliance**.
- Responsive Viewport: Fluid responsive container (`max-w-7xl mx-auto px-4 sm:px-6 lg:px-8`) with dense mode toggles for dual-monitor trading screens or mobile responsive drawer.
This system avoids floating, high-blur shadows, relying instead on **low-contrast architectural outlines and crisp structural contrast**:
---
- **Card Baselines**: Trading ticket containers and ledger modules sit flat on the warm stone background (`#F7F7F4`), bounded by 1px solid borders (`#E8E6DF`) with zero ambient shadow.
- **Structural Elevation**: Deep forest pine (`#162A22`) delivers visual depth by anchoring the frame, while pure white surfaces (`#FFFFFF`) advance to form clear working panels.
- **Interactive Layers & Overlays**: Quick-entry trade dialogs, commodity dropdowns, and fly-out dispatch drawers use subtle, tinted boundary depth: `box-shadow: 0 4px 16px -2px rgba(22, 42, 34, 0.08), 0 1px 2px 0 rgba(22, 42, 34, 0.04)` wrapped in a 1px solid boundary (`#E8E6DF`).
- **Amber Indicators**: Critical callouts utilize a solid 3px left border accent in `#C89332` on a soft amber wash (`#FDF6E7`) to project priority without vertical displacement.
## 3. Site Map & Detailed Page Blueprints
## Shapes
### Page 1: Trading Desk & Live Mandi Terminal (`/trading-desk`)
*The command center for live commodity deals, bids, offers, and broker communications.*
- **Header Metric Strip**:
- Today's Turnover (₹ Cr & MT)
- Open Contract Value
- Net Physical Inventory (MT across Indore, Kota, Bikaner, Akola, Hapur warehouses)
- Realized Day MTM (₹ Lacs)
- **Live Commodity Ticker & APMC Board**:
- Commodity tabs: Chana Desi, Wheat Sharbati/Mill Quality, Mustard Seed (42% Oil), Soyabean Yellow, Tur Maharashtra, Basmati 1121 Pusa.
- Metrics: Spot Mandi Price (₹/Qtl), Day Change (₹ & %), Daily Arrivals (Bags/Boras), Major Mandi comparisons (e.g., Indore vs. Akola vs. Latur).
- **Quick Order Entry (Sauda Slip)**:
- Deal Type: Spot Buy (Kharid) / Spot Sell (Bikri) / Forward Sauda / Delivery Contract.
- Fields: Counterparty (Vyapari/Mill/Arhatiya), Mandi/Location, Commodity & Grade, Quantity (Qtl/MT), Rate (₹/Qtl), Delivery Terms (Ex-Mandi, FOR Mill, Loaded on Truck), Payment Terms (CAD, Advance, 7-day Khata).
- **Active Blotter (Sauda Book)**:
- Real-time list of deals executed today with statuses: `Confirmed`, `Awaiting Gate-In`, `Under Quality Assay`, `Settled`.
The interface embraces a precise, disciplined shape language suited for technical workflow software.
### Page 2: APMC Mandi Procurement & Farmer/Arhatiya Settlement (`/procurement-apmc`)
*Back-office management of mandi auction lots, weigh slips, and karda deductions.*
- **Auction Lot Intake**:
- Farmer / Arhatiya Code & Name, APMC Lot ID.
- Weighbridge Gross / Tare / Net Weight (Dharam Kanta Sync).
- **Quality & Deduction Calculation Engine**:
- Moisture Deduction (`Moisture % > 12%` automatic formula trigger).
- Foreign Matter / Admixture (`Dust/Stone %` deduction).
- Damaged/Discolored Seed Deduction (Karda rulebook).
- Net Billable Weight calculation.
- **Mandi Charges & Expense Slip**:
- APMC Mandi Fee / Cess (e.g., 1.5%), Krishi Kalyan Cess, Labour/Hamali Charges (₹/bag), Stitching/Bagging charges (Bardana charges).
- **Settlement Vouchers (J-Form / K-Form Generation)**:
- Instant generation and printing of standardized Mandi J-Form receipt with QR code verification.
A unified low roundedness level (`roundedness: 1`, base `0.25rem` / `4px`) is strictly maintained for cards, form inputs, segmented control segments, table containers, and buttons to preserve clean linear alignments across dense grids.
### Page 3: Warehouse & Stock Receipts (e-NWR) (`/warehouse-inventory`)
*Physical stock oversight across owned godowns, CWC/SWC warehouses, and cold storages.*
- **Facility Overview Matrix**:
- Total Capacity vs Occupied (Metric Tons & Bags).
- Storage locations: Indore Central Godown, Kota Grain Silo, Bikaner Mustard Depot, Latur Pulse Facility.
- **Batch & Stack Management (Chhatta / Stack Cards)**:
- Commodity, Variety, Crop Year (e.g., Rabi 2024), Fumigation Status, Insurance Expiry.
- Electronic Negotiable Warehouse Receipt (e-NWR / WDRA) tracking for pledged bank credit limits.
- **Stock Movement Log**:
- Gate-In (Inward from Mandi/Farmer), Gate-Out (Outward dispatch to Flour/Oil Mills), Internal Stack Transfers.
Status pill badges and trader user avatars represent the sole exception, utilizing full pill geometry (`9999px`) to immediately distinguish contextual metadata and account identity from clickable interactive elements.
### Page 4: Quality Assay & Laboratory Certification (`/quality-assay`)
*Inspection workflows for trade verification and dispute resolution.*
- **Sample Testing Workflow**:
- Sample Barcode ID, Commodity Lot link, Inspector Name, Inspection Date.
- **Parameter Analysis Form & Sliders**:
- Moisture Content (`%`), Oil Content (`%` for Mustard/Soybean), Protein (`%` for Wheat/Chana), Foreign Matter (`%`), Immature/Shriveled Grain (`%`), Weeviled/Damaged (`%`).
- **Grade Classification**:
- Auto-categorization: `Super Premium (Sharbati)`, `Grade A (FAQ)`, `Grade B (Feed Quality)`, `Rejection Criteria Exceeded`.
- **Assay Certificate Export**:
- Direct PDF/Print preview with digital stamp and trade reference.
## Components
### Page 5: Logistics, Fleet & E-Way Bill Dispatch (`/logistics-dispatch`)
*Transit execution between warehouses, processing plants, and port rakes.*
- **Dispatch Scheduling**:
- Truck Number, Driver Mobile, Transporter Name, Bilty (LR) Number.
- Rake Allocation (Goods Train wagon dispatch for bulk grain movements).
- **Compliance Integration**:
- E-Way Bill Number, E-Invoice IRN, Validity Countdown, Destination Geo-fencing.
- **Live Transit Status**:
- Route checkpoint tracking: Loaded -> Weighbridge Verified -> In-Transit -> Gate-In at Mill -> Unloaded & Weight Reconciled.
### Buttons
- **Primary Action (Execute / Confirm Settlement)**: Solid forest pine background (`#162A22`) with pure white text, 4px border radius, and `space-sm` vertical / `space-md` horizontal padding. Hover shifts to `#2A4237`.
- **Secondary Action (Export / Print Weighbridge Slip)**: Pure white background, 1px border in `#E8E6DF`, dark charcoal text (`#1C1E1D`). Hover: `#F5F4EF`.
- **Ochre Accent Button (Urgent Release / Margin Call)**: Warm ochre background (`#C89332`) with white text and sharp 4px geometry.
### Page 6: Financial Ledger & Counterparty Khata (Vyapar Bahi) (`/financials-khata`)
*Agricultural mercantile accounting, commission agent balances, and tax compliance.*
- **Counterparty Directory & Aging**:
- Millers, Wholesalers, Arhatiyas, Transporters, Bardana Suppliers.
- Credit Limit, Current Balance (Debit/Credit ₹), Aging Brackets (0-15d, 16-30d, 31-60d, 60d+).
- **Voucher Entry**:
- Payment Advice, Receipt, Commission (Dalali) Note, Interest Calculation for overdue payment terms.
- **Tax & Compliance Sub-Module**:
- Section 194Q TDS on purchase of goods (>₹50 Lakhs threshold monitor).
- TCS under 206C(1H), GST E-Invoicing status.
### Status Pill Tags
- **Normal / Cleared**: Background `#EAF5ED`, text `#2D6A4F`, fully rounded pill (`9999px`), padding `2px 8px`, typography `label-uppercase`.
- **Watch / Pending**: Background `#FDF6E7`, text `#926A1D`, fully rounded pill (`9999px`), padding `2px 8px`, typography `label-uppercase`.
---
### Input Fields & Selectors
- Background `#FFFFFF` surrounded by 1px solid `#E8E6DF`, 4px radius.
- Active focus state: 1px border `#162A22` with a 2px outer outline tint of `#DF9B42` (20% opacity).
- Numerical input fields feature embedded trailing units (`QTL`, `MT`, `₹/KG`) in `metric-mono-sm` stone gray ink.
## 4. Vue 3 Architecture & State Management
### Trading Ledger Cards & Tables
- **Cards**: Surface `#FFFFFF`, border 1px `#E8E6DF`, 4px radius, header padded with `space-md`.
- **Table Headers**: Sticky headers with `#F7F7F4` background, 1px solid bottom border (`#E8E6DF`), uppercase Inter typography (`0.6875rem`, weight 600, color `#78716C`).
- **Table Cells**: Monospace alignment for quantities, moisture readings, and rupee valuations. Alternating row zebra striping is rejected in favor of a subtle row hover fill (`#F9F9F6`).
### 4.1 Component Tree & File Organization
```
src/
├── assets/
│ └── css/
│ └── tailwind.css
├── components/
│ ├── common/
│ │ ├── BaseBadge.vue
│ │ ├── BaseButton.vue
│ │ ├── BaseCard.vue
│ │ ├── BaseInput.vue
│ │ ├── BaseSelect.vue
│ │ ├── BaseModal.vue
│ │ ├── MetricTile.vue
│ │ └── TabularNumber.vue
│ ├── layout/
│ │ ├── AppHeader.vue
│ │ ├── AppSidebar.vue
│ │ ├── MandiTickerMarquee.vue
│ │ └── QuickActionFloatingBar.vue
│ ├── trading/
│ │ ├── SaudaEntryModal.vue
│ │ ├── LiveMandiPriceGrid.vue
│ │ ├── BlotterTable.vue
│ │ └── CommodityRateChart.vue
│ ├── procurement/
│ │ ├── WeighbridgeCalculator.vue
│ │ ├── QualityDeductionPanel.vue
│ │ └── JFormReceiptModal.vue
│ ├── warehouse/
│ │ ├── StackCardGrid.vue
│ │ └── StockTransferDialog.vue
│ └── financials/
│ ├── KhataSummaryCard.vue
│ └── LedgerTransactionTable.vue
├── composables/
│ ├── useMandiTicker.js // Real-time rates & calculations
│ ├── useTradeBlotter.js // Sauda entries, filtering, MTM
│ ├── useAssayCalculator.js // Karda, moisture & deduction math
│ └── useCurrencyFormatter.js // Indian number system (Lakhs/Crores)
├── stores/
│ ├── useAuthStore.js
│ ├── useMarketDataStore.js
│ └── useTradingDeskStore.js
├── router/
│ └── index.js
└── views/
├── TradingDeskView.vue
├── ProcurementView.vue
├── WarehouseView.vue
├── QualityAssayView.vue
├── LogisticsView.vue
└── FinancialsKhataView.vue
```
### 4.2 Reusable Composables Example
#### A. Indian Currency & Agricultural Metric Formatter (`useAgriFormatters.js`)
```javascript
export function useAgriFormatters() {
// Formats to Indian Rupee notation (₹ 1,25,000)
const formatINR = (value) => {
if (value === null || value === undefined) return '₹0';
return new Intl.NumberFormat('en-IN', {
style: 'currency',
currency: 'INR',
maximumFractionDigits: 0
}).format(value);
};
// Formats rate per quintal (₹ 2,450 / Qtl)
const formatRatePerQtl = (rate) => {
return `${formatINR(rate)}/Qtl`;
};
// Formats weight in Metric Tons and Bags (50kg std)
const formatWeight = (tons) => {
const bags = Math.round((tons * 1000) / 50);
return `${tons.toLocaleString('en-IN')} MT (${bags.toLocaleString('en-IN')} Bags)`;
};
return { formatINR, formatRatePerQtl, formatWeight };
}
```
#### B. Mandi Deduction & Karda Calculation (`useAssayCalculator.js`)
```javascript
export function useAssayCalculator() {
const calculateNetPayable = ({ grossWeight, tareWeight, ratePerQtl, moisturePct, foreignMatterPct, mandiCessPct = 1.5 }) => {
const rawNetWeightKg = grossWeight - tareWeight;
// Standard tolerances: Moisture 12%, Foreign Matter 1%
const excessMoisture = Math.max(0, moisturePct - 12);
const excessForeign = Math.max(0, foreignMatterPct - 1);
const deductionPct = excessMoisture + excessForeign;
const deductionKg = (rawNetWeightKg * deductionPct) / 100;
const billableWeightKg = rawNetWeightKg - deductionKg;
const billableQtl = billableWeightKg / 100;
const grossCommodityAmount = billableQtl * ratePerQtl;
const mandiCess = (grossCommodityAmount * mandiCessPct) / 100;
const netPayable = grossCommodityAmount - mandiCess;
return {
rawNetWeightKg,
deductionKg,
billableWeightKg,
billableQtl,
grossCommodityAmount,
mandiCess,
netPayable
};
};
return { calculateNetPayable };
}
```
---
## 5. UI Component Specifications & Code Templates (Vue 3 + Tailwind)
### 5.1 Trading Metric Card Component (`MetricTile.vue`)
```vue
<script setup>
defineProps({
title: String,
value: [String, Number],
subtitle: String,
trend: Number, // positive or negative
iconBg: { type: String, default: 'bg-agri-50 text-agri-700' }
});
</script>
<template>
<div class="bg-white rounded-xl border border-slate-200 p-4 shadow-sm hover:shadow transition-shadow">
<div class="flex items-center justify-between">
<span class="text-xs font-semibold uppercase tracking-wider text-slate-500">{{ title }}</span>
<div v-if="trend !== undefined" :class="[
'flex items-center text-xs font-mono font-medium px-2 py-0.5 rounded-full',
trend >= 0 ? 'bg-emerald-50 text-emerald-700' : 'bg-rose-50 text-rose-700'
]">
<span>{{ trend >= 0 ? '▲ +' : '▼ ' }}{{ trend }}%</span>
</div>
</div>
<div class="mt-2 flex items-baseline gap-2">
<div class="text-2xl font-bold font-mono tracking-tight text-slate-900">{{ value }}</div>
</div>
<div v-if="subtitle" class="mt-1 text-xs text-slate-500 font-medium">{{ subtitle }}</div>
</div>
</template>
```
### 5.2 Live Mandi Commodity Ticker (`MandiTickerMarquee.vue`)
```vue
<script setup>
const tickerItems = [
{ commodity: 'Chana Desi (Indore)', rate: 5850, change: 45, unit: '₹/Qtl' },
{ commodity: 'Wheat Sharbati (Sehore)', rate: 3620, change: -15, unit: '₹/Qtl' },
{ commodity: 'Mustard 42% (Kota)', rate: 5410, change: 80, unit: '₹/Qtl' },
{ commodity: 'Soyabean Yellow (Ujjain)', rate: 4680, change: 10, unit: '₹/Qtl' },
{ commodity: 'Tur Maharashtra (Akola)', rate: 10250, change: -110, unit: '₹/Qtl' },
{ commodity: 'Basmati 1121 Paddy (Karnal)', rate: 4200, change: 25, unit: '₹/Qtl' }
];
</script>
<template>
<div class="bg-slate-900 border-b border-slate-800 text-slate-200 py-1.5 px-4 overflow-hidden">
<div class="flex items-center gap-6 overflow-x-auto no-scrollbar whitespace-nowrap text-xs">
<div class="flex items-center gap-1.5 font-bold text-amber-400 uppercase tracking-wider text-[11px] shrink-0">
<span class="relative flex h-2 w-2">
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"></span>
<span class="relative inline-flex rounded-full h-2 w-2 bg-emerald-500"></span>
</span>
Live Mandi Rates
</div>
<div class="flex items-center gap-6">
<div
v-for="item in tickerItems"
:key="item.commodity"
class="flex items-center gap-2 border-r border-slate-700/80 pr-6"
>
<span class="font-medium text-slate-300">{{ item.commodity }}</span>
<span class="font-mono font-bold text-white tabular-nums">₹{{ item.rate.toLocaleString('en-IN') }}</span>
<span
:class="item.change >= 0 ? 'text-emerald-400' : 'text-rose-400'"
class="font-mono text-[11px] font-semibold tabular-nums"
>
{{ item.change >= 0 ? '+' : '' }}{{ item.change }}
</span>
</div>
</div>
</div>
</div>
</template>
```
### 5.3 Sauda Entry Form Dialog (`SaudaSlipModal.vue`)
```vue
<script setup>
import { reactive } from 'vue';
const props = defineProps({
isOpen: Boolean
});
const emit = defineEmits(['close', 'submit']);
const form = reactive({
dealType: 'BUY',
commodity: 'Chana Desi',
mandi: 'Indore Mandi',
counterparty: '',
quantityMt: 50,
ratePerQtl: 5850,
deliveryTerms: 'EX_MANDI',
paymentDays: 7
});
const calculateTotal = () => {
const qtl = form.quantityMt * 10;
return qtl * form.ratePerQtl;
};
</script>
<template>
<div v-if="isOpen" class="fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-900/60 backdrop-blur-sm">
<div class="bg-white rounded-2xl shadow-2xl max-w-lg w-full border border-slate-200 overflow-hidden">
<div class="bg-agri-700 text-white px-6 py-4 flex items-center justify-between">
<div>
<h3 class="font-bold text-lg">New Sauda Slip (Trade Booking)</h3>
<p class="text-xs text-agri-100">RamDayal Wholesale Trading Desk</p>
</div>
<button @click="emit('close')" class="text-agri-200 hover:text-white text-xl leading-none">&times;</button>
</div>
<form @submit.prevent="emit('submit', { ...form, totalAmount: calculateTotal() })" class="p-6 space-y-4">
<!-- Deal Type Toggle -->
<div class="grid grid-cols-2 gap-2 p-1 bg-slate-100 rounded-lg">
<button
type="button"
@click="form.dealType = 'BUY'"
:class="form.dealType === 'BUY' ? 'bg-emerald-600 text-white shadow' : 'text-slate-600'"
class="py-2 text-xs font-bold uppercase rounded-md transition"
>
Kharid (Buy)
</button>
<button
type="button"
@click="form.dealType = 'SELL'"
:class="form.dealType === 'SELL' ? 'bg-rose-600 text-white shadow' : 'text-slate-600'"
class="py-2 text-xs font-bold uppercase rounded-md transition"
>
Bikri (Sell)
</button>
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-xs font-bold uppercase text-slate-500 mb-1">Commodity</label>
<select v-model="form.commodity" class="w-full text-sm border-slate-200 rounded-lg focus:ring-agri-600">
<option>Chana Desi</option>
<option>Wheat Sharbati</option>
<option>Mustard Seed</option>
<option>Soyabean Yellow</option>
<option>Tur Whole</option>
</select>
</div>
<div>
<label class="block text-xs font-bold uppercase text-slate-500 mb-1">Mandi / Hub</label>
<select v-model="form.mandi" class="w-full text-sm border-slate-200 rounded-lg">
<option>Indore Mandi</option>
<option>Kota APMC</option>
<option>Bikaner Grain Market</option>
<option>Akola APMC</option>
</select>
</div>
</div>
<div>
<label class="block text-xs font-bold uppercase text-slate-500 mb-1">Counterparty (Vyapari / Mill)</label>
<input
v-model="form.counterparty"
placeholder="e.g. Shrinath Agro Industries, Ujjain"
class="w-full text-sm border-slate-200 rounded-lg"
required
/>
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-xs font-bold uppercase text-slate-500 mb-1">Quantity (MT)</label>
<input type="number" v-model.number="form.quantityMt" class="w-full font-mono text-sm border-slate-200 rounded-lg" />
<span class="text-[11px] text-slate-400">{{ form.quantityMt * 10 }} Quintals ({{ form.quantityMt * 20 }} Bags)</span>
</div>
<div>
<label class="block text-xs font-bold uppercase text-slate-500 mb-1">Rate (₹ / Qtl)</label>
<input type="number" v-model.number="form.ratePerQtl" class="w-full font-mono text-sm border-slate-200 rounded-lg" />
</div>
</div>
<!-- Real-time calculation badge -->
<div class="bg-amber-50 border border-amber-200 rounded-xl p-3 flex justify-between items-center">
<span class="text-xs font-semibold text-amber-900">Total Contract Value:</span>
<span class="text-base font-bold font-mono text-amber-950">₹ {{ calculateTotal().toLocaleString('en-IN') }}</span>
</div>
<div class="pt-2 flex justify-end gap-3">
<button type="button" @click="emit('close')" class="px-4 py-2 border border-slate-200 text-xs font-semibold text-slate-600 rounded-lg">Cancel</button>
<button type="submit" class="px-6 py-2 bg-agri-600 hover:bg-agri-700 text-xs font-bold text-white rounded-lg shadow">Confirm Sauda</button>
</div>
</form>
</div>
</div>
</template>
```
---
## 6. Responsive Strategy & Mobile Mandi Trader UX
Agricultural trading operators frequently shift between desktop multi-column screens at the trading desk and smartphone screens while in the field at APMC yards or godowns.
1. **Card-Based Row Collapsing**:
- On desktop, view dense data grids (`table` layout with 10+ columns: Sauda No, Time, Commodity, Counterparty, Qty, Rate, Total, Status, Action).
- On mobile (`< 768px`), automatically collapse tables into high-contrast swipeable cards showing Commodity badge, Net Qtl, Rate in large mono font, and quick call/WhatsApp buttons for counterparties.
2. **Offline Resilience & Touch Targets**:
- Touch targets for trade execution buttons ≥ 44px × 44px.
- PWA ready design with local cache for mandi price sheets when network in rural APMC yards drops.
3. **Hindi / Bilingual Terminology Support**:
- Labels pair formal English with conversational Mandi Hindi terms (e.g., *Kharid/Buy*, *Bikri/Sell*, *Bora/Bag*, *Bardana/Packaging*, *Karda/Deduction*, *Hamali/Labor*).
---
## 7. Implementation Roadmap & Quickstart
```bash
# 1. Initialize Vue 3 project with Vite & Tailwind CSS
npm create vite@latest india-agri-trade -- --template vue
cd india-agri-trade
npm install -D tailwindcss postcss autoprefixer @tailwindcss/forms
npx tailwindcss init -p
# 2. Key recommended libraries
npm install pinia vue-router lucide-vue-next
```
This specification provides the full architectural, functional, and aesthetic blueprint to implement the **IndiaAgriTrade RamDayal BackOffice & Wholesale Trading Desk** in Vue 3 with Tailwind CSS.
## CR-001 — Authentication UI Boundary
This design specification does not define the UC-001 login, authorization-denial, or logout screens and flows. The `useAuthStore.js` project-tree reference is not a screen or session contract. Those portal routes and states remain pending the UC-001 wireframe specification; tenant selection and membership screens belong to UC-019. Do not infer token lifetime, signing algorithm, revocation mechanism, or cross-tenant role behavior from this document.
### Alert & Callout Badges
- Surface `#FDF6E7` with a crisp 3px solid left accent border in `#C89332`. Interior text blends a bold Inter body headline with monospace contract identifiers.