Compare commits
No commits in common. "0ecd1cd05833e9e4a3dcf9698c35722722f64e6a" and "1b16dfdbf53c33d258ef8237248ba5e8ac05ddba" have entirely different histories.
0ecd1cd058
...
1b16dfdbf5
|
|
@ -5,13 +5,10 @@
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Agriculture Trading Backoffice (ATB)</title>
|
<title>Agriculture Trading Backoffice (ATB)</title>
|
||||||
<!-- AgriTrade Mercantile Fonts: Inter & JetBrains Mono -->
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
|
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-surface text-on-surface font-sans antialiased selection:bg-secondary-container selection:text-on-surface">
|
<body class="bg-gray-50 text-gray-900 font-sans antialiased">
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
export default {
|
|
||||||
plugins: {
|
|
||||||
tailwindcss: {},
|
|
||||||
autoprefixer: {},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -3,11 +3,11 @@ import { authStore } from './stores/authStore';
|
||||||
import { tenantStore } from './stores/tenantStore';
|
import { tenantStore } from './stores/tenantStore';
|
||||||
import { LoginView } from './features/auth/LoginView';
|
import { LoginView } from './features/auth/LoginView';
|
||||||
import { SessionView } from './features/auth/SessionView';
|
import { SessionView } from './features/auth/SessionView';
|
||||||
|
import { AccessDeniedView } from './features/auth/AccessDeniedView';
|
||||||
import { HeaderTenantSwitcher } from './features/tenant/HeaderTenantSwitcher';
|
import { HeaderTenantSwitcher } from './features/tenant/HeaderTenantSwitcher';
|
||||||
import { PlatformTenantsView } from './features/tenant/PlatformTenantsView';
|
import { PlatformTenantsView } from './features/tenant/PlatformTenantsView';
|
||||||
import { TenantMembersView } from './features/tenant/TenantMembersView';
|
import { TenantMembersView } from './features/tenant/TenantMembersView';
|
||||||
import { AuditLogView } from './features/tenant/AuditLogView';
|
import { AuditLogView } from './features/tenant/AuditLogView';
|
||||||
import { Shield, Building2, Users, FileText, LogOut, Layers } from 'lucide-react';
|
|
||||||
|
|
||||||
export const App: React.FC = () => {
|
export const App: React.FC = () => {
|
||||||
const [activeTab, setActiveTab] = useState<'sessions' | 'tenants' | 'members' | 'audit'>('sessions');
|
const [activeTab, setActiveTab] = useState<'sessions' | 'tenants' | 'members' | 'audit'>('sessions');
|
||||||
|
|
@ -23,110 +23,74 @@ export const App: React.FC = () => {
|
||||||
return <LoginView />;
|
return <LoginView />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const navItems = [
|
|
||||||
{ id: 'sessions' as const, label: 'Session Governance', icon: Shield },
|
|
||||||
{ id: 'tenants' as const, label: 'Platform Tenants', icon: Building2 },
|
|
||||||
{ id: 'members' as const, label: 'Tenant Members', icon: Users },
|
|
||||||
{ id: 'audit' as const, label: 'Security Audit', icon: FileText },
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-surface flex text-on-surface font-sans">
|
<div className="min-h-screen bg-gray-50 flex flex-col font-sans">
|
||||||
{/* 240px Persistent Dark Pine Navigation Drawer per DESIGN.md */}
|
<header className="bg-white border-b border-gray-200 px-6 py-3 flex items-center justify-between shadow-sm">
|
||||||
<aside className="w-60 bg-sidebar-surface text-white flex-shrink-0 flex flex-col justify-between border-r border-sidebar-active select-none">
|
<div className="flex items-center space-x-6">
|
||||||
<div>
|
<div className="flex items-center space-x-2">
|
||||||
{/* Brand Header */}
|
<span className="text-xl font-bold tracking-tight text-emerald-800">ATB Mandi Desk</span>
|
||||||
<div className="p-5 border-b border-sidebar-active flex items-center space-x-3">
|
<span className="text-xs bg-emerald-100 text-emerald-800 px-2 py-0.5 rounded-full font-medium">v1.0.0</span>
|
||||||
<div className="w-8 h-8 rounded bg-sidebar-active flex items-center justify-center text-accent-ochre">
|
|
||||||
<Layers className="w-5 h-5" />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div className="text-sm font-bold tracking-tight text-white flex items-center gap-1.5">
|
|
||||||
<span>AgriTrade</span>
|
|
||||||
<span className="text-[10px] font-mono uppercase bg-sidebar-active text-accent-ochre px-1.5 py-0.2 rounded">ATB</span>
|
|
||||||
</div>
|
|
||||||
<p className="text-[11px] text-gray-400 font-mono">Tactile Mercantile Desk</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<nav className="flex space-x-2">
|
||||||
{/* Navigation Items */}
|
<button
|
||||||
<nav className="p-3 space-y-1">
|
onClick={() => setActiveTab('sessions')}
|
||||||
<div className="px-3 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-gray-400 font-mono">
|
className={`px-3 py-1.5 text-sm font-medium rounded-md ${
|
||||||
Operational Portals
|
activeTab === 'sessions' ? 'bg-emerald-50 text-emerald-700' : 'text-gray-600 hover:text-gray-900'
|
||||||
</div>
|
}`}
|
||||||
{navItems.map((item) => {
|
>
|
||||||
const Icon = item.icon;
|
Session Governance
|
||||||
const isActive = activeTab === item.id;
|
</button>
|
||||||
return (
|
<button
|
||||||
<button
|
onClick={() => setActiveTab('tenants')}
|
||||||
key={item.id}
|
className={`px-3 py-1.5 text-sm font-medium rounded-md ${
|
||||||
onClick={() => setActiveTab(item.id)}
|
activeTab === 'tenants' ? 'bg-emerald-50 text-emerald-700' : 'text-gray-600 hover:text-gray-900'
|
||||||
className={`w-full flex items-center space-x-3 px-3 py-2 rounded text-xs font-medium transition duration-150 ${
|
}`}
|
||||||
isActive
|
>
|
||||||
? 'bg-sidebar-active text-white border-l-2 border-accent-ochre shadow-none font-semibold'
|
Platform Tenants
|
||||||
: 'text-gray-300 hover:bg-sidebar-active/60 hover:text-white'
|
</button>
|
||||||
}`}
|
<button
|
||||||
>
|
onClick={() => setActiveTab('members')}
|
||||||
<Icon className={`w-4 h-4 ${isActive ? 'text-accent-ochre' : 'text-gray-400'}`} />
|
className={`px-3 py-1.5 text-sm font-medium rounded-md ${
|
||||||
<span>{item.label}</span>
|
activeTab === 'members' ? 'bg-emerald-50 text-emerald-700' : 'text-gray-600 hover:text-gray-900'
|
||||||
</button>
|
}`}
|
||||||
);
|
>
|
||||||
})}
|
Tenant Members
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={() => setActiveTab('audit')}
|
||||||
|
className={`px-3 py-1.5 text-sm font-medium rounded-md ${
|
||||||
|
activeTab === 'audit' ? 'bg-emerald-50 text-emerald-700' : 'text-gray-600 hover:text-gray-900'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
Security Audit
|
||||||
|
</button>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex items-center space-x-4">
|
||||||
{/* Drawer Bottom Context & Logout */}
|
<HeaderTenantSwitcher />
|
||||||
<div className="p-4 border-t border-sidebar-active space-y-3">
|
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
authStore.logout();
|
authStore.logout();
|
||||||
tenantStore.clearTenant();
|
tenantStore.clearTenant();
|
||||||
}}
|
}}
|
||||||
className="w-full flex items-center justify-center space-x-2 px-3 py-2 text-xs font-medium text-gray-300 hover:text-white hover:bg-sidebar-active/80 rounded transition border border-sidebar-active"
|
className="text-xs text-red-600 hover:text-red-800 font-medium px-2 py-1 rounded border border-red-200 hover:bg-red-50"
|
||||||
>
|
>
|
||||||
<LogOut className="w-3.5 h-3.5 text-gray-400" />
|
Logout
|
||||||
<span>Sign Out</span>
|
|
||||||
</button>
|
</button>
|
||||||
<div className="text-[10px] text-gray-400 text-center font-mono">
|
|
||||||
UP-AI v1.5 Standard Desk
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</header>
|
||||||
|
|
||||||
{/* Main Operational Canvas */}
|
<main className="flex-1 p-6 max-w-7xl w-full mx-auto">
|
||||||
<div className="flex-1 flex flex-col min-w-0">
|
{activeTab === 'sessions' && <SessionView />}
|
||||||
{/* Top Control Bar */}
|
{activeTab === 'tenants' && <PlatformTenantsView />}
|
||||||
<header className="bg-card-surface border-b border-card-border px-8 py-3.5 flex items-center justify-between sticky top-0 z-10 shadow-none">
|
{activeTab === 'members' && <TenantMembersView />}
|
||||||
<div className="flex items-center space-x-3">
|
{activeTab === 'audit' && <AuditLogView />}
|
||||||
<h1 className="text-base font-semibold text-text-primary capitalize tracking-tight">
|
</main>
|
||||||
{activeTab === 'sessions' && 'Session & Token Governance'}
|
|
||||||
{activeTab === 'tenants' && 'Platform Trading Tenants'}
|
|
||||||
{activeTab === 'members' && 'Tenant Membership & Role Matrix'}
|
|
||||||
{activeTab === 'audit' && 'Security Audit Trail & Mutations'}
|
|
||||||
</h1>
|
|
||||||
<span className="text-xs text-text-muted">|</span>
|
|
||||||
<span className="text-xs font-mono text-text-muted uppercase">240px Asymmetric Canvas</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex items-center space-x-4">
|
<footer className="bg-white border-t border-gray-200 px-6 py-3 text-xs text-gray-500 text-center">
|
||||||
<HeaderTenantSwitcher />
|
Agriculture Trading Backoffice (ATB) © 2026. Built with AI-Native Unified Process (UP-AI v1.5).
|
||||||
</div>
|
</footer>
|
||||||
</header>
|
|
||||||
|
|
||||||
{/* View Content */}
|
|
||||||
<main className="flex-1 p-8 max-w-7xl w-full mx-auto">
|
|
||||||
{activeTab === 'sessions' && <SessionView />}
|
|
||||||
{activeTab === 'tenants' && <PlatformTenantsView />}
|
|
||||||
{activeTab === 'members' && <TenantMembersView />}
|
|
||||||
{activeTab === 'audit' && <AuditLogView />}
|
|
||||||
</main>
|
|
||||||
|
|
||||||
{/* Footer */}
|
|
||||||
<footer className="bg-card-surface border-t border-card-border px-8 py-3 text-xs text-text-muted flex justify-between items-center">
|
|
||||||
<span>Agriculture Trading Backoffice (ATB) © 2026. Tactile Corporate Minimalism.</span>
|
|
||||||
<span className="font-mono text-[11px]">DESIGN.md Tokenized</span>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
||||||
variant?: 'primary' | 'secondary' | 'accent' | 'danger';
|
|
||||||
size?: 'sm' | 'md' | 'lg';
|
|
||||||
}
|
|
||||||
|
|
||||||
export const Button: React.FC<ButtonProps> = ({
|
|
||||||
children,
|
|
||||||
variant = 'primary',
|
|
||||||
size = 'md',
|
|
||||||
className = '',
|
|
||||||
disabled,
|
|
||||||
...props
|
|
||||||
}) => {
|
|
||||||
const baseStyles = 'inline-flex items-center justify-center font-medium transition duration-150 rounded disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none focus:ring-2 focus:ring-offset-1';
|
|
||||||
|
|
||||||
const sizeStyles = {
|
|
||||||
sm: 'text-xs px-2.5 py-1.5',
|
|
||||||
md: 'text-sm px-4 py-2',
|
|
||||||
lg: 'text-base px-5 py-2.5',
|
|
||||||
};
|
|
||||||
|
|
||||||
const variantStyles = {
|
|
||||||
primary: 'bg-sidebar-surface hover:bg-sidebar-active text-white focus:ring-sidebar-active shadow-none',
|
|
||||||
secondary: 'bg-white hover:bg-surface-low text-text-primary border border-card-border focus:ring-card-border shadow-none',
|
|
||||||
accent: 'bg-accent-ochre hover:brightness-95 text-white focus:ring-accent-ochre shadow-none font-semibold',
|
|
||||||
danger: 'bg-error hover:bg-red-800 text-white focus:ring-error shadow-none',
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<button
|
|
||||||
className={`${baseStyles} ${sizeStyles[size]} ${variantStyles[variant]} ${className}`}
|
|
||||||
disabled={disabled}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</button>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
||||||
title?: string;
|
|
||||||
subtitle?: string;
|
|
||||||
action?: React.ReactNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const Card: React.FC<CardProps> = ({
|
|
||||||
title,
|
|
||||||
subtitle,
|
|
||||||
action,
|
|
||||||
children,
|
|
||||||
className = '',
|
|
||||||
...props
|
|
||||||
}) => {
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={`bg-card-surface border border-card-border rounded shadow-none ${className}`}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
{(title || action) && (
|
|
||||||
<div className="px-6 py-4 border-b border-card-border flex items-center justify-between">
|
|
||||||
<div>
|
|
||||||
{title && <h3 className="text-base font-semibold text-text-primary tracking-tight">{title}</h3>}
|
|
||||||
{subtitle && <p className="text-xs text-text-muted mt-0.5">{subtitle}</p>}
|
|
||||||
</div>
|
|
||||||
{action && <div>{action}</div>}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div className="p-6">{children}</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
||||||
label?: string;
|
|
||||||
unit?: string;
|
|
||||||
error?: string;
|
|
||||||
helperText?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const Input: React.FC<InputProps> = ({
|
|
||||||
label,
|
|
||||||
unit,
|
|
||||||
error,
|
|
||||||
helperText,
|
|
||||||
id,
|
|
||||||
className = '',
|
|
||||||
...props
|
|
||||||
}) => {
|
|
||||||
const inputId = id || (label ? label.toLowerCase().replace(/\s+/g, '-') : undefined);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="w-full">
|
|
||||||
{label && (
|
|
||||||
<label htmlFor={inputId} className="block text-xs font-semibold uppercase tracking-wider text-text-muted mb-1.5">
|
|
||||||
{label}
|
|
||||||
</label>
|
|
||||||
)}
|
|
||||||
<div className="relative rounded">
|
|
||||||
<input
|
|
||||||
id={inputId}
|
|
||||||
className={`w-full bg-white text-text-primary border ${
|
|
||||||
error ? 'border-error' : 'border-card-border'
|
|
||||||
} rounded px-3 py-2 text-sm focus:outline-none focus:border-sidebar-surface focus:ring-2 focus:ring-secondary-amber/20 transition ${
|
|
||||||
unit ? 'pr-14 font-mono' : ''
|
|
||||||
} ${className}`}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
{unit && (
|
|
||||||
<div className="absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none">
|
|
||||||
<span className="font-mono text-xs text-text-muted">{unit}</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
{error && <p className="mt-1 text-xs text-error font-medium">{error}</p>}
|
|
||||||
{helperText && !error && <p className="mt-1 text-xs text-text-muted">{helperText}</p>}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
export interface StatusPillProps {
|
|
||||||
status: 'normal' | 'cleared' | 'watch' | 'pending' | 'danger' | 'error' | 'neutral';
|
|
||||||
label: string;
|
|
||||||
className?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const StatusPill: React.FC<StatusPillProps> = ({ status, label, className = '' }) => {
|
|
||||||
const getStyles = () => {
|
|
||||||
switch (status) {
|
|
||||||
case 'normal':
|
|
||||||
case 'cleared':
|
|
||||||
return 'bg-status-normal-bg text-status-normal-text border-transparent';
|
|
||||||
case 'watch':
|
|
||||||
case 'pending':
|
|
||||||
return 'bg-status-watch-bg text-status-watch-text border-transparent';
|
|
||||||
case 'danger':
|
|
||||||
case 'error':
|
|
||||||
return 'bg-error-container text-error border-transparent';
|
|
||||||
case 'neutral':
|
|
||||||
default:
|
|
||||||
return 'bg-surface-container text-text-muted border-card-border';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<span
|
|
||||||
className={`inline-flex items-center px-2 py-0.5 rounded-full text-[0.6875rem] font-semibold tracking-wider uppercase border ${getStyles()} ${className}`}
|
|
||||||
>
|
|
||||||
{label}
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
@ -1,67 +1,60 @@
|
||||||
/**
|
/**
|
||||||
* SCREEN-AUTH-002: Role Authorization & Access Denial View.
|
* SCREEN-AUTH-002: Role Authorization & Access Denial View.
|
||||||
*
|
*
|
||||||
* Fulfills FR-AUTH-002 & SCREEN-AUTH-002.md (rebaselined under CR-002).
|
* Fulfills FR-AUTH-002 & SCREEN-AUTH-002.md.
|
||||||
* Styled per DESIGN.md: AgriTrade Mercantile (Tactile Corporate Minimalism).
|
|
||||||
*/
|
*/
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { authStore } from '../../stores/authStore';
|
import { authStore } from '../../stores/authStore';
|
||||||
import { Card } from '../../components/ui/Card';
|
|
||||||
import { Button } from '../../components/ui/Button';
|
|
||||||
import { ShieldAlert, ArrowLeft, LogOut } from 'lucide-react';
|
|
||||||
|
|
||||||
export const AccessDeniedView: React.FC = () => {
|
export const AccessDeniedView: React.FC = () => {
|
||||||
const user = authStore.getState().user;
|
const user = authStore.getState().user;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen flex items-center justify-center bg-surface text-on-surface p-4 font-sans">
|
<div className="min-h-screen flex items-center justify-center bg-slate-900 text-slate-100 p-4">
|
||||||
<div className="max-w-lg w-full bg-card-surface border border-card-border rounded p-8 shadow-none text-center">
|
<div className="max-w-lg w-full bg-slate-800 rounded-xl shadow-2xl p-8 border border-rose-500/30 text-center">
|
||||||
<div className="inline-flex items-center justify-center w-12 h-12 rounded bg-error-container text-error mb-4">
|
<div className="inline-flex items-center justify-center w-16 h-16 rounded-full bg-rose-500/10 text-rose-400 mb-6">
|
||||||
<ShieldAlert className="w-6 h-6" />
|
<svg className="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
||||||
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1 className="text-xl font-bold tracking-tight text-text-primary mb-1">403 — Authorization Boundary Enforced</h1>
|
<h1 className="text-3xl font-extrabold text-white mb-2">403 — Access Denied</h1>
|
||||||
<p className="text-text-muted text-xs mb-6 font-mono">
|
<p className="text-slate-400 text-sm mb-6">
|
||||||
Security policy prevents access to this screen or business action under your active role claims.
|
You do not have the required role permissions to access this screen or perform this business action.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="bg-surface-low rounded p-4 mb-6 text-left border border-card-border space-y-2">
|
<div className="bg-slate-900/60 rounded-lg p-4 mb-6 text-left border border-slate-700/60">
|
||||||
<div className="text-[10px] uppercase font-semibold text-text-muted font-mono tracking-wider">
|
<div className="text-xs uppercase font-semibold text-slate-400 mb-2">Security Enforcement Context</div>
|
||||||
Security Enforcement Context
|
<div className="text-sm text-slate-300">
|
||||||
|
<span className="text-slate-400">Authenticated User:</span> {user?.email || 'Anonymous'}
|
||||||
</div>
|
</div>
|
||||||
<div className="text-xs text-text-primary flex justify-between">
|
<div className="text-sm text-slate-300">
|
||||||
<span className="text-text-muted">Authenticated Identity:</span>
|
<span className="text-slate-400">Assigned Roles:</span>{' '}
|
||||||
<span className="font-mono font-medium">{user?.email || 'Anonymous'}</span>
|
<span className="text-emerald-400 font-medium">
|
||||||
</div>
|
|
||||||
<div className="text-xs text-text-primary flex justify-between">
|
|
||||||
<span className="text-text-muted">Assigned Roles:</span>
|
|
||||||
<span className="font-mono font-semibold text-accent-ochre">
|
|
||||||
{user?.roles?.length ? user.roles.join(', ') : 'None'}
|
{user?.roles?.length ? user.roles.join(', ') : 'None'}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-[11px] text-text-muted mt-3 pt-3 border-t border-card-border font-mono">
|
<div className="text-xs text-amber-400/90 mt-3 pt-3 border-t border-slate-800">
|
||||||
Mandatory Segregation of Duties (BRD-FR-040): Quality Officers cannot edit prices; Yard Supervisors cannot confirm sales; Sales Executives cannot override credit locks.
|
Mandatory Segregation of Duties (BRD-FR-040): Quality Officers cannot edit prices; Yard Supervisors cannot confirm sales; Sales Executives cannot override credit locks.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex space-x-3 justify-center">
|
<div className="flex space-x-3 justify-center">
|
||||||
<a href="/">
|
<a
|
||||||
<Button variant="primary" size="sm" className="flex items-center space-x-1 font-mono">
|
href="/"
|
||||||
<ArrowLeft className="w-3.5 h-3.5 mr-1" />
|
className="py-2.5 px-5 rounded-lg bg-emerald-600 hover:bg-emerald-500 text-white font-medium text-sm transition-colors"
|
||||||
<span>Return to Workspace</span>
|
|
||||||
</Button>
|
|
||||||
</a>
|
|
||||||
<Button
|
|
||||||
variant="secondary"
|
|
||||||
size="sm"
|
|
||||||
onClick={() => authStore.logout()}
|
|
||||||
className="flex items-center space-x-1 font-mono"
|
|
||||||
>
|
>
|
||||||
<LogOut className="w-3.5 h-3.5 mr-1" />
|
Return to Dashboard
|
||||||
<span>Switch Account</span>
|
</a>
|
||||||
</Button>
|
<button
|
||||||
|
onClick={() => authStore.logout()}
|
||||||
|
className="py-2.5 px-5 rounded-lg bg-slate-700 hover:bg-slate-600 text-slate-200 font-medium text-sm transition-colors"
|
||||||
|
>
|
||||||
|
Switch Account
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,9 @@
|
||||||
* OIDC Callback View Handler.
|
* OIDC Callback View Handler.
|
||||||
*
|
*
|
||||||
* Fulfills FR-AUTH-001 PKCE token exchange on callback.
|
* Fulfills FR-AUTH-001 PKCE token exchange on callback.
|
||||||
* Styled per DESIGN.md: AgriTrade Mercantile (Tactile Corporate Minimalism).
|
|
||||||
*/
|
*/
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { authStore } from '../../stores/authStore';
|
import { authStore } from '../../stores/authStore';
|
||||||
import { Button } from '../../components/ui/Button';
|
|
||||||
|
|
||||||
export const CallbackView: React.FC = () => {
|
export const CallbackView: React.FC = () => {
|
||||||
const [status, setStatus] = useState<string>('Completing authentication...');
|
const [status, setStatus] = useState<string>('Completing authentication...');
|
||||||
|
|
@ -32,7 +30,7 @@ export const CallbackView: React.FC = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setStatus('Exchanging authorization code with IdP...');
|
setStatus('Exchanging authorization code...');
|
||||||
const tokenEndpoint = `${process.env.VITE_KEYCLOAK_URL || 'http://localhost:8080'}/realms/${process.env.VITE_KEYCLOAK_REALM || 'atb-realm'}/protocol/openid-connect/token`;
|
const tokenEndpoint = `${process.env.VITE_KEYCLOAK_URL || 'http://localhost:8080'}/realms/${process.env.VITE_KEYCLOAK_REALM || 'atb-realm'}/protocol/openid-connect/token`;
|
||||||
|
|
||||||
const bodyParams = new URLSearchParams({
|
const bodyParams = new URLSearchParams({
|
||||||
|
|
@ -63,28 +61,22 @@ export const CallbackView: React.FC = () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!sessionResp.ok) {
|
if (!sessionResp.ok) {
|
||||||
throw new Error('Failed to validate session token with application server.');
|
throw new Error('Failed to initialize application session with backend.');
|
||||||
}
|
}
|
||||||
|
|
||||||
const sessionData = await sessionResp.json();
|
const sessionData = await sessionResp.json();
|
||||||
|
|
||||||
// Save session in zustand store
|
|
||||||
authStore.setSession(accessToken, {
|
authStore.setSession(accessToken, {
|
||||||
sub: sessionData.subject,
|
sub: sessionData.subject,
|
||||||
email: sessionData.email || 'user@trading.com',
|
email: sessionData.email,
|
||||||
name: sessionData.name || 'Trader',
|
name: sessionData.name,
|
||||||
roles: sessionData.roles || [],
|
roles: sessionData.roles || [],
|
||||||
tenant_id: sessionData.tenant_id,
|
tenant_id: sessionData.tenant_id,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Clean up PKCE storage
|
|
||||||
sessionStorage.removeItem('pkce_code_verifier');
|
|
||||||
sessionStorage.removeItem('oauth_state');
|
|
||||||
|
|
||||||
// Redirect to dashboard
|
// Redirect to dashboard
|
||||||
window.location.href = '/';
|
window.location.href = '/';
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
setError(err.message || 'Authentication failed unexpectedly.');
|
setError(err.message || 'Authentication callback failed.');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -92,25 +84,27 @@ export const CallbackView: React.FC = () => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen flex items-center justify-center bg-surface text-on-surface p-4 font-sans">
|
<div className="min-h-screen flex items-center justify-center bg-slate-900 text-slate-100 p-4">
|
||||||
<div className="max-w-md w-full bg-card-surface rounded border border-card-border p-8 shadow-none text-center">
|
<div className="max-w-md w-full bg-slate-800 rounded-xl p-8 border border-slate-700 text-center">
|
||||||
{error ? (
|
{error ? (
|
||||||
<div>
|
<div>
|
||||||
<div className="text-error font-semibold mb-2">Authentication Failed</div>
|
<div className="text-rose-400 font-semibold mb-2">Authentication Failed</div>
|
||||||
<p className="text-xs text-text-muted mb-6 font-mono">{error}</p>
|
<p className="text-sm text-slate-300 mb-6">{error}</p>
|
||||||
<a href="/login">
|
<a
|
||||||
<Button variant="primary" size="sm" className="font-mono">
|
href="/login"
|
||||||
Return to Login
|
className="inline-block py-2 px-4 rounded bg-emerald-600 hover:bg-emerald-500 text-white text-sm"
|
||||||
</Button>
|
>
|
||||||
|
Return to Login
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
<div className="animate-spin rounded-full h-8 w-8 border-2 border-sidebar-surface border-t-accent-ochre mx-auto mb-4"></div>
|
<div className="animate-spin rounded-full h-10 w-10 border-b-2 border-emerald-500 mx-auto mb-4"></div>
|
||||||
<p className="text-xs text-text-primary font-mono">{status}</p>
|
<p className="text-sm text-slate-300">{status}</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* SCREEN-AUTH-001: Trading Portal Login & OIDC Callback View.
|
* SCREEN-AUTH-001: Trading Portal Login & OIDC Callback View.
|
||||||
*
|
*
|
||||||
* Fulfills FR-AUTH-001 & SCREEN-AUTH-001.md (rebaselined under CR-002).
|
* Fulfills FR-AUTH-001 & SCREEN-AUTH-001.md.
|
||||||
* Styled per DESIGN.md: AgriTrade Mercantile (Tactile Corporate Minimalism).
|
|
||||||
*/
|
*/
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { authStore } from '../../stores/authStore';
|
import { authStore } from '../../stores/authStore';
|
||||||
import { Button } from '../../components/ui/Button';
|
|
||||||
import { Card } from '../../components/ui/Card';
|
|
||||||
import { ShieldCheck, LogIn, ChevronRight } from 'lucide-react';
|
|
||||||
|
|
||||||
export const LoginView: React.FC = () => {
|
export const LoginView: React.FC = () => {
|
||||||
const [selectedPersona, setSelectedPersona] = useState<string>('buyer@alpha.com');
|
const [selectedPersona, setSelectedPersona] = useState<string>('buyer@alpha.com');
|
||||||
|
|
@ -74,6 +70,13 @@ export const LoginView: React.FC = () => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
setErrorMessage(null);
|
setErrorMessage(null);
|
||||||
try {
|
try {
|
||||||
|
// Direct offline deterministic mock login
|
||||||
|
const res = await fetch(`http://localhost:8000/api/v1/auth/session`, {
|
||||||
|
headers: {
|
||||||
|
'Authorization': `Bearer mock_jwt_for_${selectedPersona}`
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Set session directly in mock development mode
|
||||||
authStore.setSession(`mock_token_${selectedPersona}`, {
|
authStore.setSession(`mock_token_${selectedPersona}`, {
|
||||||
sub: `usr_${selectedPersona}`,
|
sub: `usr_${selectedPersona}`,
|
||||||
email: selectedPersona,
|
email: selectedPersona,
|
||||||
|
|
@ -93,78 +96,70 @@ export const LoginView: React.FC = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen flex items-center justify-center bg-surface text-on-surface p-4 font-sans">
|
<div className="min-h-screen flex items-center justify-center bg-slate-900 text-slate-100 p-4">
|
||||||
<div className="max-w-md w-full">
|
<div className="max-w-md w-full bg-slate-800 rounded-xl shadow-2xl p-8 border border-slate-700">
|
||||||
{/* Main Card with AgriTrade Mercantile tactile styling */}
|
<div className="text-center mb-8">
|
||||||
<div className="bg-card-surface border border-card-border rounded p-8 shadow-none">
|
<div className="inline-flex items-center justify-center w-16 h-16 rounded-full bg-emerald-500/10 text-emerald-400 mb-4 font-bold text-2xl">
|
||||||
{/* Header */}
|
ATB
|
||||||
<div className="text-center mb-8">
|
</div>
|
||||||
<div className="inline-flex items-center justify-center w-12 h-12 rounded bg-sidebar-surface text-accent-ochre mb-3 shadow-none">
|
<h1 className="text-2xl font-bold tracking-tight text-white">Agriculture Trading Backoffice</h1>
|
||||||
<ShieldCheck className="w-6 h-6" />
|
<p className="text-sm text-slate-400 mt-2">Sign in to your trading desk account</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{errorMessage && (
|
||||||
|
<div className="mb-6 p-4 rounded-lg bg-rose-500/10 border border-rose-500/20 text-rose-400 text-sm">
|
||||||
|
{errorMessage}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="space-y-4">
|
||||||
|
<button
|
||||||
|
onClick={handleKeycloakLogin}
|
||||||
|
disabled={isLoading}
|
||||||
|
className="w-full py-3 px-4 rounded-lg bg-emerald-600 hover:bg-emerald-500 text-white font-medium shadow-md transition-colors flex items-center justify-center space-x-2 disabled:opacity-50"
|
||||||
|
>
|
||||||
|
<span>{isLoading ? 'Redirecting...' : 'Sign In with Keycloak SSO'}</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div className="relative my-6">
|
||||||
|
<div className="absolute inset-0 flex items-center">
|
||||||
|
<div className="w-full border-t border-slate-700"></div>
|
||||||
|
</div>
|
||||||
|
<div className="relative flex justify-center text-xs uppercase">
|
||||||
|
<span className="bg-slate-800 px-2 text-slate-400">Offline Sandbox / Dev Mode</span>
|
||||||
</div>
|
</div>
|
||||||
<h1 className="text-xl font-bold tracking-tight text-text-primary">AgriTrade Mercantile</h1>
|
|
||||||
<p className="text-xs text-text-muted mt-1 uppercase tracking-wider font-mono">Wholesale Trading & Backoffice Desk</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{errorMessage && (
|
<div className="space-y-3">
|
||||||
<div className="mb-6 p-3 rounded bg-status-watch-bg border-l-[3px] border-accent-ochre text-status-watch-text text-xs font-mono">
|
<label className="block text-xs font-medium text-slate-400">Select Test Persona:</label>
|
||||||
{errorMessage}
|
<select
|
||||||
</div>
|
value={selectedPersona}
|
||||||
)}
|
onChange={(e) => setSelectedPersona(e.target.value)}
|
||||||
|
className="w-full py-2.5 px-3 rounded-lg bg-slate-900 border border-slate-700 text-slate-200 text-sm focus:outline-none focus:border-emerald-500"
|
||||||
<div className="space-y-4">
|
|
||||||
<Button
|
|
||||||
variant="primary"
|
|
||||||
onClick={handleKeycloakLogin}
|
|
||||||
disabled={isLoading}
|
|
||||||
className="w-full py-2.5 flex items-center justify-center space-x-2 text-sm font-semibold tracking-wide"
|
|
||||||
>
|
>
|
||||||
<LogIn className="w-4 h-4 text-accent-ochre mr-1" />
|
<option value="buyer@alpha.com">Ramesh Kumar — Mandi Buyer</option>
|
||||||
<span>{isLoading ? 'Redirecting to OIDC...' : 'Sign In with Enterprise ID (Keycloak)'}</span>
|
<option value="qc@alpha.com">Ananya Sharma — Quality Officer (SoD Restriced)</option>
|
||||||
</Button>
|
<option value="yard@alpha.com">Vikram Singh — Yard Supervisor (SoD Restricted)</option>
|
||||||
|
<option value="sales@alpha.com">Rohit Verma — Sales Executive (SoD Restricted)</option>
|
||||||
|
<option value="finance@alpha.com">Kavita Joshi — Accounts Executive</option>
|
||||||
|
<option value="admin@alpha.com">Alpha Admin — Tenant Administrator</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
<div className="relative my-6">
|
<button
|
||||||
<div className="absolute inset-0 flex items-center">
|
onClick={handleDevMockLogin}
|
||||||
<div className="w-full border-t border-card-border"></div>
|
disabled={isLoading}
|
||||||
</div>
|
className="w-full py-2.5 px-4 rounded-lg bg-slate-700 hover:bg-slate-600 text-slate-200 text-sm font-medium transition-colors"
|
||||||
<div className="relative flex justify-center text-[10px] uppercase tracking-wider font-mono">
|
>
|
||||||
<span className="bg-card-surface px-2 text-text-muted">Development Sandbox Mode</span>
|
Mock Authenticate (Offline)
|
||||||
</div>
|
</button>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="space-y-3">
|
|
||||||
<label className="block text-[11px] font-semibold uppercase tracking-wider text-text-muted font-mono">
|
|
||||||
Select Test Persona:
|
|
||||||
</label>
|
|
||||||
<select
|
|
||||||
value={selectedPersona}
|
|
||||||
onChange={(e) => setSelectedPersona(e.target.value)}
|
|
||||||
className="w-full py-2 px-3 rounded bg-white border border-card-border text-text-primary text-xs focus:outline-none focus:border-sidebar-surface focus:ring-2 focus:ring-secondary-amber/20 font-mono transition"
|
|
||||||
>
|
|
||||||
<option value="buyer@alpha.com">Ramesh Kumar — Mandi Buyer</option>
|
|
||||||
<option value="qc@alpha.com">Ananya Sharma — Quality Officer (SoD Restricted)</option>
|
|
||||||
<option value="yard@alpha.com">Vikram Singh — Yard Supervisor (SoD Restricted)</option>
|
|
||||||
<option value="sales@alpha.com">Rohit Verma — Sales Executive (SoD Restricted)</option>
|
|
||||||
<option value="finance@alpha.com">Kavita Joshi — Accounts Executive</option>
|
|
||||||
<option value="admin@alpha.com">Alpha Admin — Tenant Administrator</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
variant="secondary"
|
|
||||||
onClick={handleDevMockLogin}
|
|
||||||
disabled={isLoading}
|
|
||||||
className="w-full py-2 text-xs font-mono"
|
|
||||||
>
|
|
||||||
Mock Authenticate (Deterministic Offline)
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="mt-8 pt-4 border-t border-card-border text-center text-[11px] text-text-muted font-mono">
|
<div className="mt-8 text-center text-xs text-slate-500">
|
||||||
Secure Multi-Tenant Context • UP-AI v1.5 Standard
|
(C) 2026 Agriculture Trading Backoffice. Multi-Tenant Enterprise Trading.
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,11 @@
|
||||||
/**
|
/**
|
||||||
* SCREEN-AUTH-003: Active Session Management & Logout View.
|
* SCREEN-AUTH-003: Active Session Management & Logout View.
|
||||||
*
|
*
|
||||||
* Fulfills FR-AUTH-003 & SCREEN-AUTH-003.md (rebaselined under CR-002).
|
* Fulfills FR-AUTH-003 & SCREEN-AUTH-003.md.
|
||||||
* Styled per DESIGN.md: AgriTrade Mercantile (Tactile Corporate Minimalism).
|
|
||||||
*/
|
*/
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { authStore } from '../../stores/authStore';
|
import { authStore } from '../../stores/authStore';
|
||||||
import { apiClient } from '../../services/api';
|
import { apiClient } from '../../services/api';
|
||||||
import { Card } from '../../components/ui/Card';
|
|
||||||
import { Button } from '../../components/ui/Button';
|
|
||||||
import { StatusPill } from '../../components/ui/StatusPill';
|
|
||||||
import { LogOut, ShieldCheck, KeyRound } from 'lucide-react';
|
|
||||||
|
|
||||||
export const SessionView: React.FC = () => {
|
export const SessionView: React.FC = () => {
|
||||||
const [isLoggingOut, setIsLoggingOut] = useState<boolean>(false);
|
const [isLoggingOut, setIsLoggingOut] = useState<boolean>(false);
|
||||||
|
|
@ -32,75 +27,68 @@ export const SessionView: React.FC = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="max-w-3xl mx-auto space-y-6">
|
<div className="max-w-2xl mx-auto p-6 bg-slate-800 rounded-xl border border-slate-700 text-slate-100 shadow-xl">
|
||||||
<Card
|
<div className="border-b border-slate-700 pb-4 mb-6">
|
||||||
title="Active Session & Token Governance"
|
<h2 className="text-xl font-bold text-white">Active Session & Account Security</h2>
|
||||||
subtitle="OIDC PKCE authentication token status and cryptographic subject claims (FR-AUTH-003)"
|
<p className="text-sm text-slate-400 mt-1">
|
||||||
action={
|
Review your current OIDC session details and terminate the session when finished.
|
||||||
<StatusPill status="normal" label="Session Active" />
|
</p>
|
||||||
}
|
</div>
|
||||||
>
|
|
||||||
{message && (
|
|
||||||
<div className="mb-4 p-3 rounded bg-status-normal-bg text-status-normal-text border border-status-normal-text/20 text-xs font-mono">
|
|
||||||
{message}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className="divide-y divide-card-border mb-6">
|
{message && (
|
||||||
<div className="flex justify-between items-center py-3">
|
<div className="mb-4 p-3 rounded bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 text-sm">
|
||||||
<span className="text-xs font-semibold uppercase tracking-wider text-text-muted font-mono">Subject Identifier (`sub`):</span>
|
{message}
|
||||||
<span className="text-xs font-mono font-medium text-text-primary bg-surface-container px-2 py-0.5 rounded">{user?.sub || 'usr_buyer@alpha.com'}</span>
|
</div>
|
||||||
</div>
|
)}
|
||||||
|
|
||||||
<div className="flex justify-between items-center py-3">
|
<div className="space-y-4 mb-8">
|
||||||
<span className="text-xs font-semibold uppercase tracking-wider text-text-muted font-mono">Email Address:</span>
|
<div className="flex justify-between items-center py-2 border-b border-slate-700/60">
|
||||||
<span className="text-xs font-medium text-text-primary">{user?.email || 'buyer@alpha.com'}</span>
|
<span className="text-sm text-slate-400">Subject Identifier (`sub`):</span>
|
||||||
</div>
|
<span className="text-sm font-mono text-emerald-400">{user?.sub || 'N/A'}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-between items-center py-3">
|
<div className="flex justify-between items-center py-2 border-b border-slate-700/60">
|
||||||
<span className="text-xs font-semibold uppercase tracking-wider text-text-muted font-mono">Tenant Context:</span>
|
<span className="text-sm text-slate-400">Email Address:</span>
|
||||||
<span className="text-xs font-mono text-text-primary">{user?.tenant_id || 'tenant-alpha'}</span>
|
<span className="text-sm text-slate-200">{user?.email || 'N/A'}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="py-3">
|
<div className="flex justify-between items-center py-2 border-b border-slate-700/60">
|
||||||
<span className="text-xs font-semibold uppercase tracking-wider text-text-muted font-mono block mb-2">Effective RBAC Roles:</span>
|
<span className="text-sm text-slate-400">Tenant Context:</span>
|
||||||
<div className="flex flex-wrap gap-2">
|
<span className="text-sm text-slate-200">{user?.tenant_id || 'tenant-alpha'}</span>
|
||||||
{user?.roles?.map((role) => (
|
</div>
|
||||||
<span
|
|
||||||
key={role}
|
|
||||||
className="px-2.5 py-0.5 rounded-full text-[11px] font-mono font-medium bg-surface-container text-text-primary border border-card-border"
|
|
||||||
>
|
|
||||||
{role}
|
|
||||||
</span>
|
|
||||||
)) || <span className="text-xs text-text-muted font-mono">None</span>}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex justify-between items-center py-3">
|
<div className="py-2 border-b border-slate-700/60">
|
||||||
<span className="text-xs font-semibold uppercase tracking-wider text-text-muted font-mono">Cryptographic Verification:</span>
|
<span className="text-sm text-slate-400 block mb-2">Assigned Roles:</span>
|
||||||
<span className="inline-flex items-center text-xs font-mono text-status-normal-text">
|
<div className="flex flex-wrap gap-2">
|
||||||
<ShieldCheck className="w-3.5 h-3.5 mr-1" />
|
{user?.roles?.map((role) => (
|
||||||
Verified S256 PKCE Code Challenge
|
<span
|
||||||
</span>
|
key={role}
|
||||||
|
className="px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-300 border border-emerald-500/20"
|
||||||
|
>
|
||||||
|
{role}
|
||||||
|
</span>
|
||||||
|
)) || <span className="text-xs text-slate-500">None</span>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="pt-4 border-t border-card-border flex justify-between items-center">
|
<div className="flex justify-between items-center py-2">
|
||||||
<p className="text-[11px] text-text-muted font-mono">
|
<span className="text-sm text-slate-400">Session Status:</span>
|
||||||
Session revocation invalidates tokens immediately across trading desk endpoints.
|
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-semibold bg-emerald-500/20 text-emerald-400">
|
||||||
</p>
|
● Active
|
||||||
<Button
|
</span>
|
||||||
variant="danger"
|
|
||||||
size="sm"
|
|
||||||
onClick={handleLogout}
|
|
||||||
disabled={isLoggingOut}
|
|
||||||
className="flex items-center space-x-1.5 font-mono"
|
|
||||||
>
|
|
||||||
<LogOut className="w-3.5 h-3.5 mr-1" />
|
|
||||||
<span>{isLoggingOut ? 'Revoking...' : 'Terminate Session'}</span>
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</div>
|
||||||
|
|
||||||
|
<div className="pt-4 border-t border-slate-700 flex justify-end">
|
||||||
|
<button
|
||||||
|
onClick={handleLogout}
|
||||||
|
disabled={isLoggingOut}
|
||||||
|
className="py-2.5 px-5 rounded-lg bg-rose-600 hover:bg-rose-500 text-white font-medium text-sm transition-colors disabled:opacity-50 flex items-center space-x-2"
|
||||||
|
>
|
||||||
|
<span>{isLoggingOut ? 'Ending Session...' : 'Log Out of Current Session'}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,12 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { tenantStore } from '../../stores/tenantStore';
|
import { tenantStore } from '../../stores/tenantStore';
|
||||||
import { apiClient } from '../../services/api';
|
import { apiClient } from '../../services/api';
|
||||||
import { StatusPill } from '../../components/ui/StatusPill';
|
|
||||||
import { Button } from '../../components/ui/Button';
|
|
||||||
import { FileText, Code2, Eye } from 'lucide-react';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Immutable Transaction Audit Log Viewer Screen.
|
* Immutable Transaction Audit Log Viewer Screen.
|
||||||
*
|
*
|
||||||
* Fulfills FR-TENANTSECURITYAUDIT-003 (UC-017 / SCREEN-TENANT-004).
|
* Fulfills FR-TENANTSECURITYAUDIT-003 (UC-017 / SCREEN-TENANT-004).
|
||||||
* Styled per DESIGN.md: AgriTrade Mercantile (Tactile Corporate Minimalism).
|
* Provides read-only inspection of governed mutations and field-level diffs within the active tenant boundary.
|
||||||
*/
|
*/
|
||||||
export interface AuditEvent {
|
export interface AuditEvent {
|
||||||
audit_id: string;
|
audit_id: string;
|
||||||
|
|
@ -60,119 +57,119 @@ export const AuditLogView: React.FC = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getActionStatus = (action: string): 'normal' | 'watch' | 'danger' | 'neutral' => {
|
const getActionBadgeColor = (action: string) => {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case 'CREATE': return 'normal';
|
case 'CREATE': return 'bg-green-100 text-green-800';
|
||||||
case 'UPDATE': return 'watch';
|
case 'UPDATE': return 'bg-blue-100 text-blue-800';
|
||||||
case 'DELETE': return 'danger';
|
case 'STATUS_CHANGE': return 'bg-purple-100 text-purple-800';
|
||||||
case 'STATUS_CHANGE': return 'watch';
|
case 'DELETE': return 'bg-red-100 text-red-800';
|
||||||
default: return 'neutral';
|
default: return 'bg-gray-100 text-gray-800';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6" data-testid="audit-log-view">
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8" data-testid="audit-log-view">
|
||||||
<div className="flex items-center justify-between">
|
<div className="sm:flex sm:items-center sm:justify-between">
|
||||||
<div>
|
<div>
|
||||||
<h2 className="text-xl font-bold tracking-tight text-text-primary">Transaction Audit Trail</h2>
|
<h1 className="text-2xl font-bold text-gray-900">Transaction Audit Trail</h1>
|
||||||
<p className="mt-0.5 text-xs text-text-muted font-mono">
|
<p className="mt-1 text-sm text-gray-500">
|
||||||
Immutable, append-only mutation ledger for <strong>{activeBusinessName || 'Active Enterprise'}</strong> (FR-TENANTSECURITYAUDIT-003)
|
Immutable, append-only mutation ledger for <strong>{activeBusinessName || 'Active Enterprise'}</strong> (FR-TENANTSECURITYAUDIT-003).
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<span className="inline-flex items-center px-2.5 py-1 rounded-full text-[10px] font-mono font-medium bg-status-normal-bg text-status-normal-text border border-status-normal-text/20">
|
<div className="mt-4 sm:mt-0">
|
||||||
Append-Only Statutory Ledger
|
<span className="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-emerald-50 text-emerald-700 border border-emerald-200">
|
||||||
</span>
|
Append-Only Statutory Ledger
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{error && (
|
{error && (
|
||||||
<div className="bg-status-watch-bg border-l-[3px] border-accent-ochre p-3 rounded text-status-watch-text text-xs font-mono">
|
<div className="mt-4 bg-red-50 border-l-4 border-red-400 p-4">
|
||||||
{error}
|
<p className="text-sm text-red-700">{error}</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Audit Log Table adhering to DESIGN.md */}
|
{/* Audit Log Table */}
|
||||||
<div className="bg-card-surface border border-card-border rounded shadow-none overflow-hidden">
|
<div className="mt-8 flex flex-col">
|
||||||
<table className="min-w-full divide-y divide-card-border">
|
<div className="-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8">
|
||||||
<thead className="bg-surface-low">
|
<div className="inline-block min-w-full py-2 align-middle md:px-6 lg:px-8">
|
||||||
<tr>
|
<div className="overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg">
|
||||||
<th className="py-3 px-4 text-left text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono">Timestamp (UTC)</th>
|
<table className="min-w-full divide-y divide-gray-300">
|
||||||
<th className="py-3 px-4 text-left text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono">Action</th>
|
<thead className="bg-gray-50">
|
||||||
<th className="py-3 px-4 text-left text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono">Entity Type</th>
|
<tr>
|
||||||
<th className="py-3 px-4 text-left text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono">Entity ID</th>
|
<th className="py-3.5 pl-4 pr-3 text-left text-xs font-semibold text-gray-900 sm:pl-6">Timestamp (UTC)</th>
|
||||||
<th className="py-3 px-4 text-left text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono">Actor Subject</th>
|
<th className="px-3 py-3.5 text-left text-xs font-semibold text-gray-900">Action</th>
|
||||||
<th className="py-3 px-4 text-right text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono">Payload Diff</th>
|
<th className="px-3 py-3.5 text-left text-xs font-semibold text-gray-900">Entity Type</th>
|
||||||
</tr>
|
<th className="px-3 py-3.5 text-left text-xs font-semibold text-gray-900">Entity ID</th>
|
||||||
</thead>
|
<th className="px-3 py-3.5 text-left text-xs font-semibold text-gray-900">Actor Subject</th>
|
||||||
<tbody className="divide-y divide-card-border bg-white text-xs">
|
<th className="relative py-3.5 pl-3 pr-4 sm:pr-6"><span className="sr-only">Details</span></th>
|
||||||
{events.length === 0 ? (
|
</tr>
|
||||||
<tr>
|
</thead>
|
||||||
<td colSpan={6} className="py-8 text-center text-xs text-text-muted font-mono">
|
<tbody className="divide-y divide-gray-200 bg-white">
|
||||||
No governed audit events recorded for this enterprise.
|
{events.length === 0 ? (
|
||||||
</td>
|
<tr>
|
||||||
</tr>
|
<td colSpan={6} className="py-8 text-center text-sm text-gray-500">
|
||||||
) : (
|
No audit events recorded for this enterprise.
|
||||||
events.map((e) => (
|
</td>
|
||||||
<tr key={e.audit_id} className="hover:bg-surface-bright transition-colors">
|
</tr>
|
||||||
<td className="py-3.5 px-4 font-mono text-text-muted">
|
) : (
|
||||||
{new Date(e.timestamp).toISOString().replace('T', ' ').slice(0, 19)}
|
events.map((e) => (
|
||||||
</td>
|
<tr key={e.audit_id}>
|
||||||
<td className="py-3.5 px-4">
|
<td className="whitespace-nowrap py-4 pl-4 pr-3 text-sm text-gray-500 font-mono sm:pl-6">
|
||||||
<StatusPill
|
{new Date(e.timestamp).toISOString().replace('T', ' ').slice(0, 19)}
|
||||||
status={getActionStatus(e.action)}
|
</td>
|
||||||
label={e.action}
|
<td className="whitespace-nowrap px-3 py-4 text-sm">
|
||||||
/>
|
<span className={`inline-flex px-2 text-xs font-semibold leading-5 rounded-full ${getActionBadgeColor(e.action)}`}>
|
||||||
</td>
|
{e.action}
|
||||||
<td className="py-3.5 px-4 font-medium text-text-primary">{e.entity_type}</td>
|
</span>
|
||||||
<td className="py-3.5 px-4 font-mono text-text-muted">{e.entity_id}</td>
|
</td>
|
||||||
<td className="py-3.5 px-4 font-mono text-text-muted">{e.actor_id}</td>
|
<td className="whitespace-nowrap px-3 py-4 text-sm font-medium text-gray-900">{e.entity_type}</td>
|
||||||
<td className="py-3.5 px-4 text-right font-mono">
|
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500 font-mono">{e.entity_id}</td>
|
||||||
<button
|
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500 font-mono">{e.actor_id}</td>
|
||||||
onClick={() => setSelectedEvent(e)}
|
<td className="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
|
||||||
className="inline-flex items-center space-x-1 text-xs text-text-primary hover:text-accent-ochre font-medium underline underline-offset-2 transition"
|
<button
|
||||||
>
|
onClick={() => setSelectedEvent(e)}
|
||||||
<Eye className="w-3 h-3" />
|
className="text-emerald-600 hover:text-emerald-900"
|
||||||
<span>Inspect</span>
|
>
|
||||||
</button>
|
Inspect Diff
|
||||||
</td>
|
</button>
|
||||||
</tr>
|
</td>
|
||||||
))
|
</tr>
|
||||||
)}
|
))
|
||||||
</tbody>
|
)}
|
||||||
</table>
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* JSON Diff Inspection Modal */}
|
{/* JSON Diff Inspection Modal */}
|
||||||
{selectedEvent && (
|
{selectedEvent && (
|
||||||
<div className="fixed z-50 inset-0 overflow-y-auto">
|
<div className="fixed z-10 inset-0 overflow-y-auto">
|
||||||
<div className="flex items-center justify-center min-h-screen px-4 text-center sm:p-0">
|
<div className="flex items-center justify-center min-h-screen px-4 text-center sm:block sm:p-0">
|
||||||
<div className="fixed inset-0 bg-sidebar-surface/40 transition-opacity" onClick={() => setSelectedEvent(null)} />
|
<div className="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" onClick={() => setSelectedEvent(null)} />
|
||||||
<div className="inline-block bg-card-surface rounded border border-card-border p-6 text-left overflow-hidden shadow-tactile transform transition-all sm:max-w-xl sm:w-full z-10">
|
<div className="inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl sm:w-full sm:p-6">
|
||||||
<div className="flex items-center justify-between pb-3 border-b border-card-border">
|
<div className="flex items-center justify-between">
|
||||||
<div>
|
<h3 className="text-lg leading-6 font-medium text-gray-900">
|
||||||
<h3 className="text-sm font-bold text-text-primary tracking-tight">
|
Audit Mutation Diff: {selectedEvent.entity_type} ({selectedEvent.action})
|
||||||
Mutation Diff: {selectedEvent.entity_type}
|
</h3>
|
||||||
</h3>
|
<span className="text-xs font-mono text-gray-400">{selectedEvent.audit_id}</span>
|
||||||
<p className="text-[11px] text-text-muted font-mono mt-0.5">
|
|
||||||
Actor: <span className="font-semibold text-text-primary">{selectedEvent.actor_id}</span> | {selectedEvent.timestamp}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<StatusPill status={getActionStatus(selectedEvent.action)} label={selectedEvent.action} />
|
|
||||||
</div>
|
</div>
|
||||||
|
<div className="mt-3 text-xs text-gray-500">
|
||||||
<div className="mt-4 bg-surface-low rounded border border-card-border p-3 overflow-x-auto text-text-primary font-mono text-xs">
|
Actor: <span className="font-mono text-gray-800">{selectedEvent.actor_id}</span> | Time: {selectedEvent.timestamp}
|
||||||
<pre className="text-[11px] leading-relaxed">{JSON.stringify(selectedEvent.field_diff, null, 2)}</pre>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div className="mt-4 bg-gray-900 rounded-md p-4 overflow-x-auto text-emerald-400 font-mono text-xs">
|
||||||
<div className="mt-4 pt-3 border-t border-card-border flex justify-end">
|
<pre>{JSON.stringify(selectedEvent.field_diff, null, 2)}</pre>
|
||||||
<Button
|
</div>
|
||||||
|
<div className="mt-5 sm:flex sm:flex-row-reverse">
|
||||||
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
variant="secondary"
|
|
||||||
size="sm"
|
|
||||||
onClick={() => setSelectedEvent(null)}
|
onClick={() => setSelectedEvent(null)}
|
||||||
className="font-mono"
|
className="w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 sm:ml-3 sm:w-auto sm:text-sm"
|
||||||
>
|
>
|
||||||
Close Inspection
|
Close
|
||||||
</Button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -181,3 +178,4 @@ export const AuditLogView: React.FC = () => {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,12 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { tenantStore, TenantMembershipInfo } from '../../stores/tenantStore';
|
import { tenantStore, TenantMembershipInfo } from '../../stores/tenantStore';
|
||||||
import { apiClient } from '../../services/api';
|
import { apiClient } from '../../services/api';
|
||||||
import { Building2, ChevronDown } from 'lucide-react';
|
|
||||||
import { StatusPill } from '../../components/ui/StatusPill';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Header Tenant Switcher Dropdown Component.
|
* Header Tenant Switcher Dropdown Component.
|
||||||
*
|
*
|
||||||
* Fulfills FR-TENANTMEMBERSHIPCONTEXT-002 (UC-019 / SCREEN-TENANT-003).
|
* Fulfills FR-TENANTMEMBERSHIPCONTEXT-002 (UC-019 / SCREEN-TENANT-003).
|
||||||
* Styled per DESIGN.md: AgriTrade Mercantile tokens.
|
* Enables multi-firm trading personas to view active firm context and switch seamlessly.
|
||||||
*/
|
*/
|
||||||
export const HeaderTenantSwitcher: React.FC = () => {
|
export const HeaderTenantSwitcher: React.FC = () => {
|
||||||
const [activeTenantId, setActiveTenantId] = useState<string | null>(tenantStore.getState().activeTenantId);
|
const [activeTenantId, setActiveTenantId] = useState<string | null>(tenantStore.getState().activeTenantId);
|
||||||
|
|
@ -28,6 +26,7 @@ export const HeaderTenantSwitcher: React.FC = () => {
|
||||||
setMyTenants(state.myTenants);
|
setMyTenants(state.myTenants);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Load user's accessible tenants on mount
|
||||||
loadTenants();
|
loadTenants();
|
||||||
|
|
||||||
return () => unsubscribe();
|
return () => unsubscribe();
|
||||||
|
|
@ -39,6 +38,7 @@ export const HeaderTenantSwitcher: React.FC = () => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
if (resp.data && resp.data.tenants) {
|
if (resp.data && resp.data.tenants) {
|
||||||
tenantStore.setMyTenants(resp.data.tenants);
|
tenantStore.setMyTenants(resp.data.tenants);
|
||||||
|
// Auto-select first active tenant if none selected
|
||||||
if (!tenantStore.getState().activeTenantId && resp.data.tenants.length > 0) {
|
if (!tenantStore.getState().activeTenantId && resp.data.tenants.length > 0) {
|
||||||
const first = resp.data.tenants[0];
|
const first = resp.data.tenants[0];
|
||||||
handleSwitch(first.tenant_id, first.business_name, [first.role]);
|
handleSwitch(first.tenant_id, first.business_name, [first.role]);
|
||||||
|
|
@ -70,62 +70,54 @@ export const HeaderTenantSwitcher: React.FC = () => {
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setIsOpen(!isOpen)}
|
onClick={() => setIsOpen(!isOpen)}
|
||||||
className="inline-flex items-center justify-between w-64 rounded border border-card-border px-3 py-1.5 bg-white hover:bg-surface-low focus:outline-none focus:border-sidebar-surface focus:ring-2 focus:ring-secondary-amber/20 transition shadow-none"
|
className="inline-flex items-center justify-between w-64 rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-emerald-500"
|
||||||
id="tenant-menu-button"
|
id="tenant-menu-button"
|
||||||
aria-expanded={isOpen}
|
aria-expanded={isOpen}
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
>
|
>
|
||||||
<div className="flex items-center space-x-2 truncate mr-2">
|
<div className="flex flex-col text-left truncate mr-2">
|
||||||
<Building2 className="w-4 h-4 text-text-muted flex-shrink-0" />
|
<span className="text-xs text-gray-400 uppercase tracking-wider font-semibold">Active Enterprise</span>
|
||||||
<div className="flex flex-col text-left truncate">
|
<span className="font-semibold text-gray-900 truncate">
|
||||||
<span className="text-[10px] text-text-muted uppercase tracking-wider font-mono font-semibold">Active Firm</span>
|
{activeBusinessName || 'Select Enterprise...'}
|
||||||
<span className="font-semibold text-xs text-text-primary truncate">
|
|
||||||
{activeBusinessName || 'Select Trading Firm...'}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center space-x-1 flex-shrink-0">
|
|
||||||
<span className="inline-flex items-center px-1.5 py-0.5 rounded-full text-[10px] font-mono font-medium bg-status-normal-bg text-status-normal-text">
|
|
||||||
{effectiveRoles[0] || 'Member'}
|
|
||||||
</span>
|
</span>
|
||||||
<ChevronDown className="w-3.5 h-3.5 text-text-muted" />
|
|
||||||
</div>
|
</div>
|
||||||
|
<span className="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-emerald-100 text-emerald-800">
|
||||||
|
{effectiveRoles[0] || 'Member'}
|
||||||
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{isOpen && (
|
{isOpen && (
|
||||||
<div
|
<div
|
||||||
className="origin-top-right absolute right-0 mt-1.5 w-72 rounded bg-card-surface border border-card-border shadow-tactile focus:outline-none z-50 divide-y divide-card-border"
|
className="origin-top-right absolute right-0 mt-2 w-72 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none z-50 divide-y divide-gray-100"
|
||||||
role="menu"
|
role="menu"
|
||||||
aria-orientation="vertical"
|
aria-orientation="vertical"
|
||||||
aria-labelledby="tenant-menu-button"
|
aria-labelledby="tenant-menu-button"
|
||||||
>
|
>
|
||||||
<div className="px-4 py-2.5 bg-surface-low">
|
<div className="px-4 py-3">
|
||||||
<p className="text-[10px] text-text-muted uppercase tracking-wider font-mono font-semibold">Authorized Firms Directory</p>
|
<p className="text-xs text-gray-500 uppercase tracking-wider font-semibold">Trading Firms Directory</p>
|
||||||
{error && <p className="text-xs text-error mt-1">{error}</p>}
|
{error && <p className="text-xs text-red-600 mt-1">{error}</p>}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="py-1 max-h-60 overflow-y-auto" role="none">
|
<div className="py-1 max-h-60 overflow-y-auto" role="none">
|
||||||
{myTenants.length === 0 ? (
|
{myTenants.length === 0 ? (
|
||||||
<div className="px-4 py-2 text-xs text-text-muted font-mono">No authorized enterprises found.</div>
|
<div className="px-4 py-2 text-xs text-gray-500">No authorized enterprises found.</div>
|
||||||
) : (
|
) : (
|
||||||
myTenants.map((t) => (
|
myTenants.map((t) => (
|
||||||
<button
|
<button
|
||||||
key={t.membership_id}
|
key={t.membership_id}
|
||||||
onClick={() => handleSwitch(t.tenant_id, t.business_name, [t.role])}
|
onClick={() => handleSwitch(t.tenant_id, t.business_name, [t.role])}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
className={`w-full text-left px-4 py-2.5 text-xs hover:bg-surface-low flex items-center justify-between transition-colors ${
|
className={`w-full text-left px-4 py-2.5 text-sm hover:bg-gray-50 flex items-center justify-between transition-colors ${
|
||||||
t.tenant_id === activeTenantId
|
t.tenant_id === activeTenantId ? 'bg-emerald-50 text-emerald-900 font-semibold' : 'text-gray-700'
|
||||||
? 'bg-status-normal-bg/40 text-text-primary font-semibold border-l-2 border-accent-ochre'
|
|
||||||
: 'text-text-primary'
|
|
||||||
}`}
|
}`}
|
||||||
role="menuitem"
|
role="menuitem"
|
||||||
>
|
>
|
||||||
<div className="truncate pr-2">
|
<div className="truncate pr-2">
|
||||||
<p className="font-medium truncate">{t.business_name}</p>
|
<p className="font-medium truncate">{t.business_name}</p>
|
||||||
<p className="text-[10px] text-text-muted font-mono">{t.legal_identifier}</p>
|
<p className="text-xs text-gray-400 font-mono">{t.legal_identifier}</p>
|
||||||
</div>
|
</div>
|
||||||
<span className="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-mono bg-surface-container text-text-muted">
|
<span className="inline-flex items-center px-1.5 py-0.5 rounded text-xs font-normal bg-gray-100 text-gray-600">
|
||||||
{t.role}
|
{t.role}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -137,3 +129,4 @@ export const HeaderTenantSwitcher: React.FC = () => {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,11 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { apiClient } from '../../services/api';
|
import { apiClient } from '../../services/api';
|
||||||
import { Button } from '../../components/ui/Button';
|
|
||||||
import { StatusPill } from '../../components/ui/StatusPill';
|
|
||||||
import { Plus, Building2, SlidersHorizontal } from 'lucide-react';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Platform Tenants Management View.
|
* Platform Tenants Management View.
|
||||||
*
|
*
|
||||||
* Fulfills FR-TENANTLIFECYCLE-001 (UC-018 / SCREEN-TENANT-001).
|
* Fulfills FR-TENANTLIFECYCLE-001 (UC-018 / SCREEN-TENANT-001).
|
||||||
* Styled per DESIGN.md: AgriTrade Mercantile (Tactile Corporate Minimalism).
|
* System Administrator control plane to provision firms and manage lifecycle status.
|
||||||
*/
|
*/
|
||||||
export interface PlatformTenant {
|
export interface PlatformTenant {
|
||||||
tenant_id: string;
|
tenant_id: string;
|
||||||
|
|
@ -85,7 +82,6 @@ export const PlatformTenantsView: React.FC = () => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
setSelectedTenant(null);
|
setSelectedTenant(null);
|
||||||
setStatusReason('');
|
|
||||||
fetchTenants();
|
fetchTenants();
|
||||||
} else {
|
} else {
|
||||||
setError(resp.error || 'Failed to update tenant status.');
|
setError(resp.error || 'Failed to update tenant status.');
|
||||||
|
|
@ -93,144 +89,153 @@ export const PlatformTenantsView: React.FC = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6" data-testid="platform-tenants-view">
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8" data-testid="platform-tenants-view">
|
||||||
<div className="flex items-center justify-between">
|
<div className="sm:flex sm:items-center sm:justify-between">
|
||||||
<div>
|
<div>
|
||||||
<h2 className="text-xl font-bold tracking-tight text-text-primary">Platform Trading Enterprises</h2>
|
<h1 className="text-2xl font-bold text-gray-900">Platform Enterprise Directory</h1>
|
||||||
<p className="mt-0.5 text-xs text-text-muted font-mono">
|
<p className="mt-1 text-sm text-gray-500">
|
||||||
Provision and govern multi-tenant agricultural trading enterprises (FR-TENANTLIFECYCLE-001)
|
Provision and govern multi-tenant agricultural trading enterprises (FR-TENANTLIFECYCLE-001).
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<div className="mt-4 sm:mt-0">
|
||||||
variant="primary"
|
<button
|
||||||
size="sm"
|
type="button"
|
||||||
onClick={() => setShowModal(true)}
|
onClick={() => setShowModal(true)}
|
||||||
className="flex items-center space-x-1.5 font-mono"
|
className="inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-emerald-600 hover:bg-emerald-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-emerald-500"
|
||||||
>
|
>
|
||||||
<Plus className="w-3.5 h-3.5 mr-1 text-accent-ochre" />
|
Provision Enterprise
|
||||||
<span>Provision Enterprise</span>
|
</button>
|
||||||
</Button>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{error && (
|
{error && (
|
||||||
<div className="bg-status-watch-bg border-l-[3px] border-accent-ochre p-3 rounded text-status-watch-text text-xs font-mono">
|
<div className="mt-4 bg-red-50 border-l-4 border-red-400 p-4">
|
||||||
{error}
|
<p className="text-sm text-red-700">{error}</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Directory Table adhering to DESIGN.md tabular rules */}
|
{/* Directory Table */}
|
||||||
<div className="bg-card-surface border border-card-border rounded shadow-none overflow-hidden">
|
<div className="mt-8 flex flex-col">
|
||||||
<table className="min-w-full divide-y divide-card-border">
|
<div className="-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8">
|
||||||
<thead className="bg-surface-low">
|
<div className="inline-block min-w-full py-2 align-middle md:px-6 lg:px-8">
|
||||||
<tr>
|
<div className="overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg">
|
||||||
<th className="py-3 px-4 text-left text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono">Trading Enterprise</th>
|
<table className="min-w-full divide-y divide-gray-300">
|
||||||
<th className="py-3 px-4 text-left text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono">Legal GSTIN</th>
|
<thead className="bg-gray-50">
|
||||||
<th className="py-3 px-4 text-left text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono">Primary Mandi</th>
|
<tr>
|
||||||
<th className="py-3 px-4 text-left text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono">Contact Email</th>
|
<th className="py-3.5 pl-4 pr-3 text-left text-xs font-semibold text-gray-900 sm:pl-6">Business Name</th>
|
||||||
<th className="py-3 px-4 text-left text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono">Lifecycle Status</th>
|
<th className="px-3 py-3.5 text-left text-xs font-semibold text-gray-900">Legal GSTIN</th>
|
||||||
<th className="py-3 px-4 text-right text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono">Actions</th>
|
<th className="px-3 py-3.5 text-left text-xs font-semibold text-gray-900">Primary Mandi</th>
|
||||||
</tr>
|
<th className="px-3 py-3.5 text-left text-xs font-semibold text-gray-900">Contact Email</th>
|
||||||
</thead>
|
<th className="px-3 py-3.5 text-left text-xs font-semibold text-gray-900">Lifecycle Status</th>
|
||||||
<tbody className="divide-y divide-card-border bg-white text-xs">
|
<th className="relative py-3.5 pl-3 pr-4 sm:pr-6"><span className="sr-only">Actions</span></th>
|
||||||
{tenants.map((t) => (
|
</tr>
|
||||||
<tr key={t.tenant_id} className="hover:bg-surface-bright transition-colors">
|
</thead>
|
||||||
<td className="py-3.5 px-4 font-semibold text-text-primary">{t.business_name}</td>
|
<tbody className="divide-y divide-gray-200 bg-white">
|
||||||
<td className="py-3.5 px-4 font-mono text-text-muted">{t.legal_identifier}</td>
|
{tenants.map((t) => (
|
||||||
<td className="py-3.5 px-4 font-mono text-text-primary">{t.primary_mandi}</td>
|
<tr key={t.tenant_id}>
|
||||||
<td className="py-3.5 px-4 text-text-muted">{t.contact_email}</td>
|
<td className="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">{t.business_name}</td>
|
||||||
<td className="py-3.5 px-4">
|
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500 font-mono">{t.legal_identifier}</td>
|
||||||
<StatusPill
|
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{t.primary_mandi}</td>
|
||||||
status={t.status === 'ACTIVE' ? 'normal' : t.status === 'SUSPENDED' ? 'watch' : 'neutral'}
|
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{t.contact_email}</td>
|
||||||
label={t.status}
|
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
|
||||||
/>
|
<span className={`inline-flex px-2 text-xs font-semibold leading-5 rounded-full ${
|
||||||
</td>
|
t.status === 'ACTIVE' ? 'bg-green-100 text-green-800' :
|
||||||
<td className="py-3.5 px-4 text-right font-mono">
|
t.status === 'SUSPENDED' ? 'bg-yellow-100 text-yellow-800' : 'bg-red-100 text-red-800'
|
||||||
{t.status !== 'CLOSED' && (
|
}`}>
|
||||||
<button
|
{t.status}
|
||||||
onClick={() => { setSelectedTenant(t); setNewStatus(t.status === 'ACTIVE' ? 'SUSPENDED' : 'ACTIVE'); }}
|
</span>
|
||||||
className="text-xs text-text-primary hover:text-accent-ochre font-medium underline underline-offset-2 transition"
|
</td>
|
||||||
>
|
<td className="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
|
||||||
Update State
|
{t.status !== 'CLOSED' && (
|
||||||
</button>
|
<button
|
||||||
)}
|
onClick={() => { setSelectedTenant(t); setNewStatus(t.status === 'ACTIVE' ? 'SUSPENDED' : 'ACTIVE'); }}
|
||||||
</td>
|
className="text-emerald-600 hover:text-emerald-900 mr-4"
|
||||||
</tr>
|
>
|
||||||
))}
|
Update Status
|
||||||
</tbody>
|
</button>
|
||||||
</table>
|
)}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Provision Modal */}
|
{/* Provision Modal */}
|
||||||
{showModal && (
|
{showModal && (
|
||||||
<div className="fixed z-50 inset-0 overflow-y-auto">
|
<div className="fixed z-10 inset-0 overflow-y-auto">
|
||||||
<div className="flex items-center justify-center min-h-screen px-4 text-center sm:p-0">
|
<div className="flex items-center justify-center min-h-screen px-4 text-center sm:block sm:p-0">
|
||||||
<div className="fixed inset-0 bg-sidebar-surface/40 transition-opacity" onClick={() => setShowModal(false)} />
|
<div className="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" onClick={() => setShowModal(false)} />
|
||||||
<div className="inline-block bg-card-surface rounded border border-card-border p-6 text-left overflow-hidden shadow-tactile transform transition-all sm:max-w-md sm:w-full z-10">
|
<div className="inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full sm:p-6">
|
||||||
<h3 className="text-base font-bold text-text-primary tracking-tight">Provision New Trading Enterprise</h3>
|
<h3 className="text-lg leading-6 font-medium text-gray-900">Provision New Enterprise</h3>
|
||||||
<p className="text-xs text-text-muted mt-0.5 font-mono">Registers enterprise entity within row-level multi-tenant database boundary</p>
|
<form onSubmit={handleCreate} className="mt-4 space-y-4">
|
||||||
|
|
||||||
<form onSubmit={handleCreate} className="mt-4 space-y-3.5">
|
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono mb-1">Business Legal Name</label>
|
<label className="block text-xs font-medium text-gray-700">Business Legal Name</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
required
|
required
|
||||||
value={formData.business_name}
|
value={formData.business_name}
|
||||||
onChange={(e) => setFormData({ ...formData, business_name: e.target.value })}
|
onChange={(e) => setFormData({ ...formData, business_name: e.target.value })}
|
||||||
className="w-full bg-white border border-card-border rounded px-3 py-2 text-xs focus:outline-none focus:border-sidebar-surface focus:ring-2 focus:ring-secondary-amber/20"
|
className="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-emerald-500 focus:border-emerald-500 sm:text-sm"
|
||||||
placeholder="e.g. Rameshwaram Grain Mercantile Pvt Ltd"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono mb-1">Legal Identifier / GSTIN</label>
|
<label className="block text-xs font-medium text-gray-700">Legal Identifier / GSTIN</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
required
|
required
|
||||||
value={formData.legal_identifier}
|
value={formData.legal_identifier}
|
||||||
onChange={(e) => setFormData({ ...formData, legal_identifier: e.target.value })}
|
onChange={(e) => setFormData({ ...formData, legal_identifier: e.target.value })}
|
||||||
className="w-full bg-white border border-card-border rounded px-3 py-2 text-xs font-mono focus:outline-none focus:border-sidebar-surface focus:ring-2 focus:ring-secondary-amber/20"
|
className="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-emerald-500 focus:border-emerald-500 sm:text-sm"
|
||||||
placeholder="23AAAAA0000A1Z5"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono mb-1">Primary Mandi APMC Hub</label>
|
<label className="block text-xs font-medium text-gray-700">Primary Mandi APMC Code</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
required
|
required
|
||||||
value={formData.primary_mandi}
|
value={formData.primary_mandi}
|
||||||
onChange={(e) => setFormData({ ...formData, primary_mandi: e.target.value })}
|
onChange={(e) => setFormData({ ...formData, primary_mandi: e.target.value })}
|
||||||
className="w-full bg-white border border-card-border rounded px-3 py-2 text-xs font-mono focus:outline-none focus:border-sidebar-surface focus:ring-2 focus:ring-secondary-amber/20"
|
className="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-emerald-500 focus:border-emerald-500 sm:text-sm"
|
||||||
placeholder="APMC-INDORE"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono mb-1">Corporate Contact Email</label>
|
<label className="block text-xs font-medium text-gray-700">Enterprise Contact Email</label>
|
||||||
<input
|
<input
|
||||||
type="email"
|
type="email"
|
||||||
required
|
required
|
||||||
value={formData.contact_email}
|
value={formData.contact_email}
|
||||||
onChange={(e) => setFormData({ ...formData, contact_email: e.target.value })}
|
onChange={(e) => setFormData({ ...formData, contact_email: e.target.value })}
|
||||||
className="w-full bg-white border border-card-border rounded px-3 py-2 text-xs focus:outline-none focus:border-sidebar-surface focus:ring-2 focus:ring-secondary-amber/20"
|
className="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-emerald-500 focus:border-emerald-500 sm:text-sm"
|
||||||
placeholder="ops@rameshwaramgrain.com"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono mb-1">Initial Tenant Administrator Email</label>
|
<label className="block text-xs font-medium text-gray-700">Initial Tenant Administrator Email</label>
|
||||||
<input
|
<input
|
||||||
type="email"
|
type="email"
|
||||||
value={formData.initial_admin_email}
|
value={formData.initial_admin_email}
|
||||||
onChange={(e) => setFormData({ ...formData, initial_admin_email: e.target.value })}
|
onChange={(e) => setFormData({ ...formData, initial_admin_email: e.target.value })}
|
||||||
className="w-full bg-white border border-card-border rounded px-3 py-2 text-xs focus:outline-none focus:border-sidebar-surface focus:ring-2 focus:ring-secondary-amber/20"
|
className="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-emerald-500 focus:border-emerald-500 sm:text-sm"
|
||||||
placeholder="admin@rameshwaramgrain.com"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="pt-3 border-t border-card-border flex justify-end space-x-2">
|
<div className="mt-5 sm:mt-6 sm:grid sm:grid-cols-2 sm:gap-3">
|
||||||
<Button type="button" variant="secondary" size="sm" onClick={() => setShowModal(false)}>
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setShowModal(false)}
|
||||||
|
className="w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 sm:text-sm"
|
||||||
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</button>
|
||||||
<Button type="submit" variant="primary" size="sm" disabled={loading}>
|
<button
|
||||||
Provision Enterprise
|
type="submit"
|
||||||
</Button>
|
disabled={loading}
|
||||||
|
className="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-emerald-600 text-base font-medium text-white hover:bg-emerald-700 sm:text-sm"
|
||||||
|
>
|
||||||
|
Provision
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -240,21 +245,21 @@ export const PlatformTenantsView: React.FC = () => {
|
||||||
|
|
||||||
{/* Status Change Dialog */}
|
{/* Status Change Dialog */}
|
||||||
{selectedTenant && (
|
{selectedTenant && (
|
||||||
<div className="fixed z-50 inset-0 overflow-y-auto">
|
<div className="fixed z-10 inset-0 overflow-y-auto">
|
||||||
<div className="flex items-center justify-center min-h-screen px-4 text-center sm:p-0">
|
<div className="flex items-center justify-center min-h-screen px-4 text-center sm:block sm:p-0">
|
||||||
<div className="fixed inset-0 bg-sidebar-surface/40 transition-opacity" onClick={() => setSelectedTenant(null)} />
|
<div className="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" onClick={() => setSelectedTenant(null)} />
|
||||||
<div className="inline-block bg-card-surface rounded border border-card-border p-6 text-left overflow-hidden shadow-tactile transform transition-all sm:max-w-md sm:w-full z-10">
|
<div className="inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-md sm:w-full sm:p-6">
|
||||||
<h3 className="text-base font-bold text-text-primary tracking-tight">Update Lifecycle Status</h3>
|
<h3 className="text-lg leading-6 font-medium text-gray-900">Update Tenant Status</h3>
|
||||||
<p className="mt-0.5 text-xs text-text-muted font-mono">
|
<p className="mt-1 text-sm text-gray-500">
|
||||||
Modifying state for <strong>{selectedTenant.business_name}</strong>
|
Updating status for <strong>{selectedTenant.business_name}</strong> ({selectedTenant.status}).
|
||||||
</p>
|
</p>
|
||||||
<div className="mt-4 space-y-3.5">
|
<div className="mt-4 space-y-4">
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono mb-1">Target Lifecycle State</label>
|
<label className="block text-xs font-medium text-gray-700">Target Lifecycle Status</label>
|
||||||
<select
|
<select
|
||||||
value={newStatus}
|
value={newStatus}
|
||||||
onChange={(e) => setNewStatus(e.target.value)}
|
onChange={(e) => setNewStatus(e.target.value)}
|
||||||
className="w-full bg-white border border-card-border rounded px-3 py-2 text-xs font-mono focus:outline-none focus:border-sidebar-surface focus:ring-2 focus:ring-secondary-amber/20"
|
className="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-emerald-500 focus:border-emerald-500 sm:text-sm"
|
||||||
>
|
>
|
||||||
<option value="ACTIVE">ACTIVE</option>
|
<option value="ACTIVE">ACTIVE</option>
|
||||||
<option value="SUSPENDED">SUSPENDED</option>
|
<option value="SUSPENDED">SUSPENDED</option>
|
||||||
|
|
@ -262,22 +267,30 @@ export const PlatformTenantsView: React.FC = () => {
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono mb-1">Statutory Justification / Audit Note</label>
|
<label className="block text-xs font-medium text-gray-700">Reason / Statutory Justification</label>
|
||||||
<textarea
|
<textarea
|
||||||
rows={2}
|
rows={2}
|
||||||
value={statusReason}
|
value={statusReason}
|
||||||
onChange={(e) => setStatusReason(e.target.value)}
|
onChange={(e) => setStatusReason(e.target.value)}
|
||||||
className="w-full bg-white border border-card-border rounded px-3 py-2 text-xs focus:outline-none focus:border-sidebar-surface focus:ring-2 focus:ring-secondary-amber/20"
|
className="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-emerald-500 focus:border-emerald-500 sm:text-sm"
|
||||||
placeholder="Enter compliance or audit reasoning..."
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="pt-3 border-t border-card-border flex justify-end space-x-2">
|
<div className="mt-5 sm:grid sm:grid-cols-2 sm:gap-3">
|
||||||
<Button type="button" variant="secondary" size="sm" onClick={() => setSelectedTenant(null)}>
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setSelectedTenant(null)}
|
||||||
|
className="w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 sm:text-sm"
|
||||||
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</button>
|
||||||
<Button type="button" variant="accent" size="sm" onClick={handleUpdateStatus} disabled={loading}>
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={handleUpdateStatus}
|
||||||
|
disabled={loading}
|
||||||
|
className="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-emerald-600 text-base font-medium text-white hover:bg-emerald-700 sm:text-sm"
|
||||||
|
>
|
||||||
Save Transition
|
Save Transition
|
||||||
</Button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -287,3 +300,4 @@ export const PlatformTenantsView: React.FC = () => {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,12 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { tenantStore } from '../../stores/tenantStore';
|
import { tenantStore } from '../../stores/tenantStore';
|
||||||
import { apiClient } from '../../services/api';
|
import { apiClient } from '../../services/api';
|
||||||
import { Button } from '../../components/ui/Button';
|
|
||||||
import { StatusPill } from '../../components/ui/StatusPill';
|
|
||||||
import { UserPlus, UserCheck, Shield } from 'lucide-react';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tenant Members & Roles Management View.
|
* Tenant Members & Roles Management View.
|
||||||
*
|
*
|
||||||
* Fulfills FR-TENANTMEMBERSHIPCONTEXT-001 (UC-019 / SCREEN-TENANT-002).
|
* Fulfills FR-TENANTMEMBERSHIPCONTEXT-001 (UC-019 / SCREEN-TENANT-002).
|
||||||
* Styled per DESIGN.md: AgriTrade Mercantile (Tactile Corporate Minimalism).
|
* Enables Tenant Administrators to manage user memberships within their tenant boundary.
|
||||||
*/
|
*/
|
||||||
export interface Member {
|
export interface Member {
|
||||||
membership_id: string;
|
membership_id: string;
|
||||||
|
|
@ -69,11 +66,11 @@ export const TenantMembersView: React.FC = () => {
|
||||||
if (resp.status === 200 && resp.data?.memberships) {
|
if (resp.status === 200 && resp.data?.memberships) {
|
||||||
setMembers(resp.data.memberships);
|
setMembers(resp.data.memberships);
|
||||||
} else {
|
} else {
|
||||||
setError(resp.error || 'Failed to fetch tenant memberships.');
|
setError(resp.error || 'Failed to load member roster.');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAssignRole = async (e: React.FormEvent) => {
|
const handleInvite = async (e: React.FormEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (!activeTenantId) return;
|
if (!activeTenantId) return;
|
||||||
|
|
||||||
|
|
@ -114,120 +111,131 @@ export const TenantMembersView: React.FC = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6" data-testid="tenant-members-view">
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8" data-testid="tenant-members-view">
|
||||||
<div className="flex items-center justify-between">
|
<div className="sm:flex sm:items-center sm:justify-between">
|
||||||
<div>
|
<div>
|
||||||
<h2 className="text-xl font-bold tracking-tight text-text-primary">Enterprise Members & Roles</h2>
|
<h1 className="text-2xl font-bold text-gray-900">Enterprise Members & Roles</h1>
|
||||||
<p className="mt-0.5 text-xs text-text-muted font-mono">
|
<p className="mt-1 text-sm text-gray-500">
|
||||||
Governed member roster for <strong>{activeBusinessName || 'Active Firm'}</strong> (FR-TENANTMEMBERSHIPCONTEXT-001)
|
Governed member roster for <strong>{activeBusinessName || 'Active Firm'}</strong> (FR-TENANTMEMBERSHIPCONTEXT-001).
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<div className="mt-4 sm:mt-0">
|
||||||
variant="primary"
|
<button
|
||||||
size="sm"
|
type="button"
|
||||||
onClick={() => setShowInviteModal(true)}
|
onClick={() => setShowInviteModal(true)}
|
||||||
disabled={!activeTenantId}
|
disabled={!activeTenantId}
|
||||||
className="flex items-center space-x-1.5 font-mono"
|
className="inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-emerald-600 hover:bg-emerald-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-emerald-500 disabled:opacity-50"
|
||||||
>
|
>
|
||||||
<UserPlus className="w-3.5 h-3.5 mr-1 text-accent-ochre" />
|
Assign Member Role
|
||||||
<span>Assign Member Role</span>
|
</button>
|
||||||
</Button>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{error && (
|
{error && (
|
||||||
<div className="bg-status-watch-bg border-l-[3px] border-accent-ochre p-3 rounded text-status-watch-text text-xs font-mono">
|
<div className="mt-4 bg-red-50 border-l-4 border-red-400 p-4">
|
||||||
{error}
|
<p className="text-sm text-red-700">{error}</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Members Table */}
|
{/* Members Table */}
|
||||||
<div className="bg-card-surface border border-card-border rounded shadow-none overflow-hidden">
|
<div className="mt-8 flex flex-col">
|
||||||
<table className="min-w-full divide-y divide-card-border">
|
<div className="-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8">
|
||||||
<thead className="bg-surface-low">
|
<div className="inline-block min-w-full py-2 align-middle md:px-6 lg:px-8">
|
||||||
<tr>
|
<div className="overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg">
|
||||||
<th className="py-3 px-4 text-left text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono">Member Account</th>
|
<table className="min-w-full divide-y divide-gray-300">
|
||||||
<th className="py-3 px-4 text-left text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono">PRD Business Role</th>
|
<thead className="bg-gray-50">
|
||||||
<th className="py-3 px-4 text-left text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono">Membership Status</th>
|
<tr>
|
||||||
<th className="py-3 px-4 text-left text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono">Effective Since</th>
|
<th className="py-3.5 pl-4 pr-3 text-left text-xs font-semibold text-gray-900 sm:pl-6">Member Email</th>
|
||||||
<th className="py-3 px-4 text-right text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono">Actions</th>
|
<th className="px-3 py-3.5 text-left text-xs font-semibold text-gray-900">PRD Business Role</th>
|
||||||
</tr>
|
<th className="px-3 py-3.5 text-left text-xs font-semibold text-gray-900">Membership Status</th>
|
||||||
</thead>
|
<th className="px-3 py-3.5 text-left text-xs font-semibold text-gray-900">Added Date</th>
|
||||||
<tbody className="divide-y divide-card-border bg-white text-xs">
|
<th className="relative py-3.5 pl-3 pr-4 sm:pr-6"><span className="sr-only">Actions</span></th>
|
||||||
{members.map((m) => (
|
</tr>
|
||||||
<tr key={m.membership_id} className="hover:bg-surface-bright transition-colors">
|
</thead>
|
||||||
<td className="py-3.5 px-4 font-medium text-text-primary">{m.email}</td>
|
<tbody className="divide-y divide-gray-200 bg-white">
|
||||||
<td className="py-3.5 px-4">
|
{members.map((m) => (
|
||||||
<span className="inline-flex items-center px-2 py-0.5 rounded text-[11px] font-mono font-medium bg-surface-container text-text-primary border border-card-border">
|
<tr key={m.membership_id}>
|
||||||
{m.role}
|
<td className="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">{m.email}</td>
|
||||||
</span>
|
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-700">
|
||||||
</td>
|
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800">
|
||||||
<td className="py-3.5 px-4">
|
{m.role}
|
||||||
<StatusPill
|
</span>
|
||||||
status={m.status === 'ACTIVE' ? 'normal' : 'danger'}
|
</td>
|
||||||
label={m.status}
|
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
|
||||||
/>
|
<span className={`inline-flex px-2 text-xs font-semibold leading-5 rounded-full ${
|
||||||
</td>
|
m.status === 'ACTIVE' ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'
|
||||||
<td className="py-3.5 px-4 font-mono text-text-muted">
|
}`}>
|
||||||
{new Date(m.created_at).toLocaleDateString()}
|
{m.status}
|
||||||
</td>
|
</span>
|
||||||
<td className="py-3.5 px-4 text-right font-mono">
|
</td>
|
||||||
{m.status === 'ACTIVE' && (
|
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
|
||||||
<button
|
{new Date(m.created_at).toLocaleDateString()}
|
||||||
onClick={() => handleRevoke(m.membership_id)}
|
</td>
|
||||||
className="text-xs text-error hover:text-red-900 font-medium underline underline-offset-2 transition"
|
<td className="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
|
||||||
>
|
{m.status === 'ACTIVE' && (
|
||||||
Revoke Role
|
<button
|
||||||
</button>
|
onClick={() => handleRevoke(m.membership_id)}
|
||||||
)}
|
className="text-red-600 hover:text-red-900"
|
||||||
</td>
|
>
|
||||||
</tr>
|
Revoke Access
|
||||||
))}
|
</button>
|
||||||
</tbody>
|
)}
|
||||||
</table>
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Assign Role Modal */}
|
{/* Invite Member Modal */}
|
||||||
{showInviteModal && (
|
{showInviteModal && (
|
||||||
<div className="fixed z-50 inset-0 overflow-y-auto">
|
<div className="fixed z-10 inset-0 overflow-y-auto">
|
||||||
<div className="flex items-center justify-center min-h-screen px-4 text-center sm:p-0">
|
<div className="flex items-center justify-center min-h-screen px-4 text-center sm:block sm:p-0">
|
||||||
<div className="fixed inset-0 bg-sidebar-surface/40 transition-opacity" onClick={() => setShowInviteModal(false)} />
|
<div className="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" onClick={() => setShowInviteModal(false)} />
|
||||||
<div className="inline-block bg-card-surface rounded border border-card-border p-6 text-left overflow-hidden shadow-tactile transform transition-all sm:max-w-md sm:w-full z-10">
|
<div className="inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-md sm:w-full sm:p-6">
|
||||||
<h3 className="text-base font-bold text-text-primary tracking-tight">Assign Enterprise Role</h3>
|
<h3 className="text-lg leading-6 font-medium text-gray-900">Assign Enterprise Role</h3>
|
||||||
<p className="text-xs text-text-muted mt-0.5 font-mono">
|
<form onSubmit={handleInvite} className="mt-4 space-y-4">
|
||||||
Bind an authenticated user to <strong>{activeBusinessName}</strong> with specific business permissions.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<form onSubmit={handleAssignRole} className="mt-4 space-y-3.5">
|
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono mb-1">User Email Address</label>
|
<label className="block text-xs font-medium text-gray-700">User Email Address</label>
|
||||||
<input
|
<input
|
||||||
type="email"
|
type="email"
|
||||||
required
|
required
|
||||||
value={inviteEmail}
|
value={inviteEmail}
|
||||||
onChange={(e) => setInviteEmail(e.target.value)}
|
onChange={(e) => setInviteEmail(e.target.value)}
|
||||||
className="w-full bg-white border border-card-border rounded px-3 py-2 text-xs focus:outline-none focus:border-sidebar-surface focus:ring-2 focus:ring-secondary-amber/20"
|
placeholder="colleague@tradingfirm.com"
|
||||||
placeholder="trader@alphagrain.com"
|
className="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-emerald-500 focus:border-emerald-500 sm:text-sm"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-[11px] font-semibold text-text-muted uppercase tracking-wider font-mono mb-1">PRD Governed Role</label>
|
<label className="block text-xs font-medium text-gray-700">Governed PRD Role</label>
|
||||||
<select
|
<select
|
||||||
value={inviteRole}
|
value={inviteRole}
|
||||||
onChange={(e) => setInviteRole(e.target.value)}
|
onChange={(e) => setInviteRole(e.target.value)}
|
||||||
className="w-full bg-white border border-card-border rounded px-3 py-2 text-xs font-mono focus:outline-none focus:border-sidebar-surface focus:ring-2 focus:ring-secondary-amber/20"
|
className="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-emerald-500 focus:border-emerald-500 sm:text-sm"
|
||||||
>
|
>
|
||||||
{PRD_ROLES.map((r) => (
|
{PRD_ROLES.map((r) => (
|
||||||
<option key={r} value={r}>{r}</option>
|
<option key={r} value={r}>{r}</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div className="pt-3 border-t border-card-border flex justify-end space-x-2">
|
<div className="mt-5 sm:grid sm:grid-cols-2 sm:gap-3">
|
||||||
<Button type="button" variant="secondary" size="sm" onClick={() => setShowInviteModal(false)}>
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setShowInviteModal(false)}
|
||||||
|
className="w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 sm:text-sm"
|
||||||
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</button>
|
||||||
<Button type="submit" variant="primary" size="sm" disabled={loading}>
|
<button
|
||||||
Assign Role
|
type="submit"
|
||||||
</Button>
|
disabled={loading}
|
||||||
|
className="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-emerald-600 text-base font-medium text-white hover:bg-emerald-700 sm:text-sm"
|
||||||
|
>
|
||||||
|
Confirm Assignment
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -237,3 +245,4 @@ export const TenantMembersView: React.FC = () => {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
@tailwind base;
|
|
||||||
@tailwind components;
|
|
||||||
@tailwind utilities;
|
|
||||||
|
|
||||||
@layer base {
|
|
||||||
:root {
|
|
||||||
--surface: #f9f9f6;
|
|
||||||
--sidebar-surface: #162a22;
|
|
||||||
--sidebar-surface-active: #2a4237;
|
|
||||||
--card-surface: #ffffff;
|
|
||||||
--card-border: #e8e6df;
|
|
||||||
--accent-ochre: #c89332;
|
|
||||||
--text-primary: #1c1e1d;
|
|
||||||
--text-muted: #78716c;
|
|
||||||
--status-normal-bg: #eaf5ed;
|
|
||||||
--status-normal-text: #2d6a4f;
|
|
||||||
--status-watch-bg: #fdf6e7;
|
|
||||||
--status-watch-text: #926a1d;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
background-color: var(--surface);
|
|
||||||
color: var(--text-primary);
|
|
||||||
font-family: 'Inter', system-ui, -apple-system, sans-serif;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@layer components {
|
|
||||||
/* AgriTrade Mercantile Component Primitives */
|
|
||||||
.btn-primary {
|
|
||||||
@apply bg-sidebar-surface hover:bg-sidebar-active text-white text-sm font-medium px-4 py-2 rounded transition shadow-none disabled:opacity-50;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-secondary {
|
|
||||||
@apply bg-white hover:bg-surface-low text-text-primary border border-card-border text-sm font-medium px-4 py-2 rounded transition shadow-none disabled:opacity-50;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-accent {
|
|
||||||
@apply bg-accent-ochre hover:brightness-95 text-white text-sm font-semibold px-4 py-2 rounded transition shadow-none disabled:opacity-50;
|
|
||||||
}
|
|
||||||
|
|
||||||
.badge-pill-normal {
|
|
||||||
@apply inline-flex items-center px-2 py-0.5 rounded-full text-[0.6875rem] font-semibold tracking-wider uppercase bg-status-normal-bg text-status-normal-text;
|
|
||||||
}
|
|
||||||
|
|
||||||
.badge-pill-watch {
|
|
||||||
@apply inline-flex items-center px-2 py-0.5 rounded-full text-[0.6875rem] font-semibold tracking-wider uppercase bg-status-watch-bg text-status-watch-text;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-mercantile {
|
|
||||||
@apply bg-card-surface border border-card-border rounded p-6 shadow-none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.callout-ochre {
|
|
||||||
@apply bg-status-watch-bg border-l-[3px] border-accent-ochre p-4 rounded-r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom/client';
|
import ReactDOM from 'react-dom/client';
|
||||||
import { App } from './App';
|
import { App } from './App';
|
||||||
import './index.css';
|
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
|
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<App />
|
<App />
|
||||||
</React.StrictMode>
|
</React.StrictMode>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,98 +0,0 @@
|
||||||
/** @type {import('tailwindcss').Config} */
|
|
||||||
export default {
|
|
||||||
content: [
|
|
||||||
"./index.html",
|
|
||||||
"./src/**/*.{js,ts,jsx,tsx}",
|
|
||||||
],
|
|
||||||
theme: {
|
|
||||||
extend: {
|
|
||||||
colors: {
|
|
||||||
surface: {
|
|
||||||
DEFAULT: '#f9f9f6',
|
|
||||||
dim: '#dadad7',
|
|
||||||
bright: '#f9f9f6',
|
|
||||||
lowest: '#ffffff',
|
|
||||||
low: '#f4f4f1',
|
|
||||||
container: '#eeeeeb',
|
|
||||||
high: '#e8e8e5',
|
|
||||||
highest: '#e2e3e0',
|
|
||||||
},
|
|
||||||
'on-surface': {
|
|
||||||
DEFAULT: '#1a1c1b',
|
|
||||||
variant: '#434845',
|
|
||||||
},
|
|
||||||
primary: {
|
|
||||||
DEFAULT: '#030b08',
|
|
||||||
pine: '#18231f',
|
|
||||||
container: '#18231f',
|
|
||||||
'on-container': '#7f8b85',
|
|
||||||
},
|
|
||||||
secondary: {
|
|
||||||
DEFAULT: '#865300',
|
|
||||||
amber: '#df9b42',
|
|
||||||
container: '#feb55a',
|
|
||||||
},
|
|
||||||
tertiary: {
|
|
||||||
DEFAULT: '#120705',
|
|
||||||
container: '#2c1d1b',
|
|
||||||
},
|
|
||||||
sidebar: {
|
|
||||||
surface: '#162A22',
|
|
||||||
active: '#2A4237',
|
|
||||||
},
|
|
||||||
card: {
|
|
||||||
surface: '#FFFFFF',
|
|
||||||
border: '#E8E6DF',
|
|
||||||
},
|
|
||||||
text: {
|
|
||||||
primary: '#1C1E1D',
|
|
||||||
muted: '#78716C',
|
|
||||||
},
|
|
||||||
status: {
|
|
||||||
'normal-bg': '#EAF5ED',
|
|
||||||
'normal-text': '#2D6A4F',
|
|
||||||
'watch-bg': '#FDF6E7',
|
|
||||||
'watch-text': '#926A1D',
|
|
||||||
},
|
|
||||||
accent: {
|
|
||||||
ochre: '#C89332',
|
|
||||||
},
|
|
||||||
outline: {
|
|
||||||
DEFAULT: '#737875',
|
|
||||||
variant: '#c3c8c4',
|
|
||||||
},
|
|
||||||
error: {
|
|
||||||
DEFAULT: '#ba1a1a',
|
|
||||||
container: '#ffdad6',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
fontFamily: {
|
|
||||||
sans: ['Inter', 'system-ui', '-apple-system', 'sans-serif'],
|
|
||||||
mono: ['JetBrains Mono', 'ui-monospace', 'monospace'],
|
|
||||||
},
|
|
||||||
borderRadius: {
|
|
||||||
sm: '0.125rem',
|
|
||||||
DEFAULT: '0.25rem',
|
|
||||||
md: '0.375rem',
|
|
||||||
lg: '0.5rem',
|
|
||||||
xl: '0.75rem',
|
|
||||||
full: '9999px',
|
|
||||||
},
|
|
||||||
spacing: {
|
|
||||||
gutter: '1rem',
|
|
||||||
'gutter-compact': '0.5rem',
|
|
||||||
'space-xs': '0.25rem',
|
|
||||||
'space-sm': '0.5rem',
|
|
||||||
'space-md': '0.75rem',
|
|
||||||
'space-lg': '1rem',
|
|
||||||
'space-xl': '1.5rem',
|
|
||||||
'space-xxl': '2rem',
|
|
||||||
},
|
|
||||||
boxShadow: {
|
|
||||||
tactile: '0 4px 16px -2px rgba(22, 42, 34, 0.08), 0 1px 2px 0 rgba(22, 42, 34, 0.04)',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: [],
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
| **Gated By** | `up-change-request-impact` |
|
| **Gated By** | `up-change-request-impact` |
|
||||||
| **Scope** | Product Scope, Functional Requirements (`FR-xxx`), Use Cases (`UC-xxx`), Architecture, Code |
|
| **Scope** | Product Scope, Functional Requirements (`FR-xxx`), Use Cases (`UC-xxx`), Architecture, Code |
|
||||||
| **Meta-Process Changes** | Governed separately via `up-process-change` in [`process_change_register.md`](process_change_register.md) (`PCR-xxx`) |
|
| **Meta-Process Changes** | Governed separately via `up-process-change` in [`process_change_register.md`](process_change_register.md) (`PCR-xxx`) |
|
||||||
| **Last Updated** | 2026-10-15 |
|
| **Last Updated** | 2026-10-11 |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -18,7 +18,6 @@ Product Change Requests are impact-analyzed below; each record states its curren
|
||||||
| CR-ID | Trigger Type | Raised By | Date | Originating Stage | Description | Affected Items | Blast Radius / Impact | Disposition | Status |
|
| CR-ID | Trigger Type | Raised By | Date | Originating Stage | Description | Affected Items | Blast Radius / Impact | Disposition | Status |
|
||||||
|---|---|---|---|---|---|---|---|---|---|
|
|---|---|---|---|---|---|---|---|---|---|
|
||||||
| `CR-001` | Bug / Traceability defect | Human request, analyzed by AI | 2026-10-11 | Stage 5 — Elaboration | Review and realign the sample UC-001 identity/authentication use case and its source mappings to the baselined ATB PRD and active tech profile; decide which sample-specific auth/session constraints remain product requirements. | `UC-001`, `FR-AUTH-001`–`FR-AUTH-003` | See CR-001 Impact Analysis below. | Approved by stakeholder on 2026-10-11: UC-001 remains the OIDC AuthN/AuthZ use case; align it with the ATB baseline | Closed — approved impact set rebaselined and verified; iteration construction remains pending |
|
| `CR-001` | Bug / Traceability defect | Human request, analyzed by AI | 2026-10-11 | Stage 5 — Elaboration | Review and realign the sample UC-001 identity/authentication use case and its source mappings to the baselined ATB PRD and active tech profile; decide which sample-specific auth/session constraints remain product requirements. | `UC-001`, `FR-AUTH-001`–`FR-AUTH-003` | See CR-001 Impact Analysis below. | Approved by stakeholder on 2026-10-11: UC-001 remains the OIDC AuthN/AuthZ use case; align it with the ATB baseline | Closed — approved impact set rebaselined and verified; iteration construction remains pending |
|
||||||
| `CR-002` | Scope / UI Rebaseline | User request, analyzed by AI | 2026-10-15 | Stage 11 — Wireframes / Cross-Cutting | Rebaseline all front-end UI tokens, wireframe specifications, layout architecture, and React code to the AgriTrade Mercantile design system defined in `DESIGN.md`. | `06_wireframes/DESIGN.md`, `wireframe_index.md`, 32 screen specs in `screen_specs/`, `project_code/frontend/` | See CR-002 Impact Analysis below. | Approved by stakeholder on 2026-10-15 | Closed — All front-end assets rebaselined and verified |
|
|
||||||
|
|
||||||
|
|
||||||
## CR-001 — UC-001 Alignment with the ATB Product Baseline
|
## CR-001 — UC-001 Alignment with the ATB Product Baseline
|
||||||
|
|
@ -65,46 +64,3 @@ The stakeholder confirmed that UC-001 was executed end-to-end as a process sampl
|
||||||
|
|
||||||
- **Disposition:** Approved by stakeholder on 2026-10-11, with UC-001 covering OIDC AuthN/AuthZ and aligned to the current ATB baseline.
|
- **Disposition:** Approved by stakeholder on 2026-10-11, with UC-001 covering OIDC AuthN/AuthZ and aligned to the current ATB baseline.
|
||||||
- **Status:** Closed — approved requirements/design/test-specification impact set rebaselined and verified. Gate 5.1 passed with zero Critical findings and two justified source-parser warnings. Gate 14.1 was run and failed with two Critical construction-evidence findings (missing dense workbook and Bruno collections); UC-001 requirements remain Baselined, not Delivered, and iteration-01 remains Incomplete / Pending Construction. Gate 14.1 is still mandatory before delivery or iteration closure.
|
- **Status:** Closed — approved requirements/design/test-specification impact set rebaselined and verified. Gate 5.1 passed with zero Critical findings and two justified source-parser warnings. Gate 14.1 was run and failed with two Critical construction-evidence findings (missing dense workbook and Bruno collections); UC-001 requirements remain Baselined, not Delivered, and iteration-01 remains Incomplete / Pending Construction. Gate 14.1 is still mandatory before delivery or iteration closure.
|
||||||
|
|
||||||
|
|
||||||
## CR-002 — Rebaseline Front-End Assets to AgriTrade Mercantile Design System
|
|
||||||
|
|
||||||
### Request and Trigger
|
|
||||||
|
|
||||||
The user updated `project_sdlc/06_wireframes/DESIGN.md` (commit `c9883df`) with the **AgriTrade Mercantile** design system (*Tactile Corporate Minimalism*). This introduces a complete token refresh:
|
|
||||||
- Palette: Primary (`#18231F`), Sidebar Base (`#162A22`), Sidebar Active (`#2A4237`), Secondary (`#DF9B42`), Accent Ochre (`#C89332`), Warm Stone Surface (`#F7F7F4` / `#f9f9f6`), Card Surface (`#FFFFFF`), Precision Borders (`#E8E6DF`), Status Cleared (`#EAF5ED` / `#2D6A4F`), Status Watch (`#FDF6E7` / `#926A1D`).
|
|
||||||
- Typography: Inter for interface text, JetBrains Mono for tabular measurements/values.
|
|
||||||
- Geometry: 4px default roundedness, pill badges (`9999px`).
|
|
||||||
- Layout Archetype: 240px persistent dark pine drawer on the left with an asymmetric operational grid.
|
|
||||||
|
|
||||||
The user approved ("proceed") cascading this update across all affected front-end specifications, configurations, layouts, reusable UI components, and views.
|
|
||||||
|
|
||||||
### Blast Radius & Impact Analysis
|
|
||||||
|
|
||||||
| Artifact / SDLC Tier | Impact & Rebaseline Scope |
|
|
||||||
|---|---|
|
|
||||||
| `project_sdlc/06_wireframes/DESIGN.md` | Ground truth tokens updated (commit `c9883df`). |
|
|
||||||
| `project_sdlc/06_wireframes/wireframe_index.md` | Reconcile design token references and layout archetypes. |
|
|
||||||
| `project_sdlc/06_wireframes/screen_specs/*.md` (32 screen specs) | Reconcile Section 1 (Visual Design Reference) and Section 2 (Layout & navigation drawer) to the new tokens. |
|
|
||||||
| `project_code/frontend/tailwind.config.js` | Create/configure Tailwind theme tokens matching `DESIGN.md`. |
|
|
||||||
| `project_code/frontend/postcss.config.js` | Configure PostCSS for Tailwind CSS. |
|
|
||||||
| `project_code/frontend/index.html` | Update fonts (Inter, JetBrains Mono) and body surface background. |
|
|
||||||
| `project_code/frontend/src/index.css` | Define Tailwind directives and CSS token custom properties. |
|
|
||||||
| `project_code/frontend/src/main.tsx` | Import `index.css`. |
|
|
||||||
| `project_code/frontend/src/components/ui/` | Scaffold shared components (`Button`, `StatusPill`, `Input`, `Card`, `Table`). |
|
|
||||||
| `project_code/frontend/src/App.tsx` | Rebuild shell with 240px persistent sidebar drawer (`#162A22`) and warm stone canvas. |
|
|
||||||
| `project_code/frontend/src/features/*` | Realign Auth and Multi-Tenancy views to the new components and color tokens. |
|
|
||||||
| `project_sdlc/07_test_design/manual_qa/` | Update `MANUAL_TESTING_GUIDE.md` visual inspection criteria. |
|
|
||||||
| `project_sdlc/05_iteration_planning/` | Maintain `@ui-designer-dev` surface status in `iteration_surface_matrix.md`. |
|
|
||||||
|
|
||||||
### Verification Record
|
|
||||||
|
|
||||||
1. **Stage 11 Wireframes:** `wireframe_index.md` and all 32 screen specifications updated to AgriTrade Mercantile design tokens and persistent drawer layout; references tagged with `last_cr: CR-002`.
|
|
||||||
2. **Stage 13 Code:** `tailwind.config.js`, `postcss.config.js`, `index.html`, and `src/index.css` configured; reusable UI components (`Button`, `StatusPill`, `Card`, `Input`) authored; `App.tsx` shell refactored to 240px persistent navigation drawer; 7 feature views updated to tactile tokens.
|
|
||||||
3. **Traceability Gates:** Verified via `scripts/verify_traceability_gates.py --all` (Gates 5.1, 9.1, and 14.1 PASS with 0 Critical blockers).
|
|
||||||
4. **Automated Coverage:** Verified via `scripts/run_tests.sh --scope iteration-01` (197 tests pass with 98.4% coverage >= 95.0% threshold).
|
|
||||||
|
|
||||||
### Disposition Checkpoint
|
|
||||||
|
|
||||||
- **Disposition:** Approved by user on 2026-10-15.
|
|
||||||
- **Status:** Closed — All front-end assets rebaselined and verified across wireframes, configs, shell layout, components, views, and delivery surface matrices.
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
| **Governed Standard** | UP-AI v1.5 Stage 10 Standard |
|
| **Governed Standard** | UP-AI v1.5 Stage 10 Standard |
|
||||||
| **Status** | Delivered (E2E Verified) |
|
| **Status** | Delivered (E2E Verified) |
|
||||||
| **Version** | 1.4.0 |
|
| **Version** | 1.4.0 |
|
||||||
| **Last CR** | `CR-002` |
|
| **Last CR** | `CR-001` |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
| **Governed Standard** | UP-AI v1.5 Stage 13 Standard |
|
| **Governed Standard** | UP-AI v1.5 Stage 13 Standard |
|
||||||
| **Status** | Delivered (E2E Verified) — Live PostgreSQL 17 RLS & Live Container API Verified |
|
| **Status** | Delivered (E2E Verified) — Live PostgreSQL 17 RLS & Live Container API Verified |
|
||||||
| **Version** | 1.2.0 |
|
| **Version** | 1.2.0 |
|
||||||
| **Last CR** | `CR-002` |
|
| **Last CR** | none |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,213 +1,538 @@
|
||||||
---
|
---
|
||||||
name: AgriTrade Mercantile
|
id: DESIGN
|
||||||
colors:
|
version: 1.1.0
|
||||||
surface: '#f9f9f6'
|
status: Reviewed
|
||||||
surface-dim: '#dadad7'
|
last_cr: CR-001
|
||||||
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
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Brand & Style
|
# Design.md — IndiaAgriTrade (RamDayal Agri Commodities) Wholesale Trading Desk
|
||||||
|
|
||||||
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.
|
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**.
|
||||||
|
|
||||||
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.
|
---
|
||||||
|
|
||||||
## Colors
|
## 1. Executive Summary & Domain Architecture
|
||||||
|
|
||||||
The palette balances mercantile tradition and tactical operational ergonomics:
|
### 1.1 Business Context
|
||||||
- **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`).
|
**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.
|
||||||
- **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.
|
|
||||||
|
|
||||||
## Typography
|
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.
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
## Layout & Spacing
|
## 2. Brand Identity & Visual Design System
|
||||||
|
|
||||||
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.
|
### 2.1 Color Palette (Tailwind Tokens)
|
||||||
|
Designed specifically for high-density agricultural trade execution — combining earthy reliability with financial clarity.
|
||||||
|
|
||||||
- **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.
|
```javascript
|
||||||
- **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.
|
// tailwind.config.js theme extension
|
||||||
- **Breakpoints**:
|
module.exports = {
|
||||||
- `Desktop (>= 1280px)`: Full persistent sidebar with multi-panel ledger views and side drawer inspections.
|
theme: {
|
||||||
- `Tablet (768px - 1279px)`: Sidebar collapses to 64px icon rail; main grid shifts to 8 columns.
|
extend: {
|
||||||
- `Mobile (< 768px)`: Sidebar converts to a full-screen bottom-sheet overlay; tabular grids convert into stacked commodity contract cards.
|
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'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Elevation & Depth
|
### 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`
|
||||||
|
|
||||||
This system avoids floating, high-blur shadows, relying instead on **low-contrast architectural outlines and crisp structural contrast**:
|
### 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.
|
||||||
|
|
||||||
- **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.
|
|
||||||
|
|
||||||
## Shapes
|
## 3. Site Map & Detailed Page Blueprints
|
||||||
|
|
||||||
The interface embraces a precise, disciplined shape language suited for technical workflow software.
|
### 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`.
|
||||||
|
|
||||||
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 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.
|
||||||
|
|
||||||
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 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.
|
||||||
|
|
||||||
## Components
|
### 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.
|
||||||
|
|
||||||
### Buttons
|
### Page 5: Logistics, Fleet & E-Way Bill Dispatch (`/logistics-dispatch`)
|
||||||
- **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`.
|
*Transit execution between warehouses, processing plants, and port rakes.*
|
||||||
- **Secondary Action (Export / Print Weighbridge Slip)**: Pure white background, 1px border in `#E8E6DF`, dark charcoal text (`#1C1E1D`). Hover: `#F5F4EF`.
|
- **Dispatch Scheduling**:
|
||||||
- **Ochre Accent Button (Urgent Release / Margin Call)**: Warm ochre background (`#C89332`) with white text and sharp 4px geometry.
|
- 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.
|
||||||
|
|
||||||
### Status Pill Tags
|
### Page 6: Financial Ledger & Counterparty Khata (Vyapar Bahi) (`/financials-khata`)
|
||||||
- **Normal / Cleared**: Background `#EAF5ED`, text `#2D6A4F`, fully rounded pill (`9999px`), padding `2px 8px`, typography `label-uppercase`.
|
*Agricultural mercantile accounting, commission agent balances, and tax compliance.*
|
||||||
- **Watch / Pending**: Background `#FDF6E7`, text `#926A1D`, fully rounded pill (`9999px`), padding `2px 8px`, typography `label-uppercase`.
|
- **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.
|
||||||
|
|
||||||
### 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.
|
|
||||||
|
|
||||||
### Trading Ledger Cards & Tables
|
## 4. Vue 3 Architecture & State Management
|
||||||
- **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`).
|
|
||||||
|
|
||||||
### Alert & Callout Badges
|
### 4.1 Component Tree & File Organization
|
||||||
- Surface `#FDF6E7` with a crisp 3px solid left accent border in `#C89332`. Interior text blends a bold Inter body headline with monospace contract identifiers.
|
```
|
||||||
|
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">×</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.
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-OPERATIONALALERTS-001` (Real-Time Operational Alerts Engine)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-014-operational-alerts/functional-reqs.md#fr-operationalalerts-001-real-time-operational-alerts-engine) |
|
| **Owning FR** | [`FR-OPERATIONALALERTS-001` (Real-Time Operational Alerts Engine)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-014-operational-alerts/functional-reqs.md#fr-operationalalerts-001-real-time-operational-alerts-engine) |
|
||||||
| **Auth Role / Scope Claims** | `Operations Supervisor`, `Partner`, `Managing Director`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Operations Supervisor`, `Partner`, `Managing Director`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-06` |
|
| **Iteration** | `iteration-06` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Real-Time Operational Incident & Hazard Monitoring Console.
|
- **Archetype:** Real-Time Operational Incident & Hazard Monitoring Console.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Incident dashboard adhering to [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`rose-600` Critical alerts, `amber-500` Warnings, `blue-500` Info, `slate-800` card surfaces).
|
||||||
- **Behavior:** Scans and aggregates real-time operational state across four critical business hazard categories:
|
- **Behavior:** Scans and aggregates real-time operational state across four critical business hazard categories:
|
||||||
1. **QC Pending Alert:** Inward lots in state `Under QC` for $>24\text{ hours}$ or flagged as `QC Hold`.
|
1. **QC Pending Alert:** Inward lots in state `Under QC` for $>24\text{ hours}$ or flagged as `QC Hold`.
|
||||||
2. **Warehouse Capacity Alert:** Godowns exceeding $85\%$ capacity utilization.
|
2. **Warehouse Capacity Alert:** Godowns exceeding $85\%$ capacity utilization.
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-AUTH-001` (OIDC Authentication)](../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-001-oidc-authentication) |
|
| **Owning FR** | [`FR-AUTH-001` (OIDC Authentication)](../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-001-oidc-authentication) |
|
||||||
| **Auth Role / Scope Claims** | Public (Unauthenticated entry); redirects to Keycloak OIDC Realm |
|
| **Auth Role / Scope Claims** | Public (Unauthenticated entry); redirects to Keycloak OIDC Realm |
|
||||||
| **Iteration** | `iteration-01` |
|
| **Iteration** | `iteration-01` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Full-page Authentication Gateway & PKCE Callback Handler.
|
- **Archetype:** Full-page Authentication Gateway & PKCE Callback Handler.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) corporate palette (`Slate-900`, `Emerald-600` primary accents).
|
||||||
- **Behavior:** Unauthenticated users hitting any protected route or `/login` are presented with an enterprise sign-in interface. Clicking "Sign In with Keycloak" initiates the OAuth2 Authorization Code flow with PKCE (`code_challenge`). The callback at `/auth/callback` exchanges the authorization code for tokens, initializes session state via `GET /api/v1/auth/session`, and redirects to the intended destination or dashboard.
|
- **Behavior:** Unauthenticated users hitting any protected route or `/login` are presented with an enterprise sign-in interface. Clicking "Sign In with Keycloak" initiates the OAuth2 Authorization Code flow with PKCE (`code_challenge`). The callback at `/auth/callback` exchanges the authorization code for tokens, initializes session state via `GET /api/v1/auth/session`, and redirects to the intended destination or dashboard.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-AUTH-002` (Role-Based Authorization)](../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-002-role-based-authorization) |
|
| **Owning FR** | [`FR-AUTH-002` (Role-Based Authorization)](../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-002-role-based-authorization) |
|
||||||
| **Auth Role / Scope Claims** | Authenticated User lacking required role permissions (`403 Forbidden`) |
|
| **Auth Role / Scope Claims** | Authenticated User lacking required role permissions (`403 Forbidden`) |
|
||||||
| **Iteration** | `iteration-01` |
|
| **Iteration** | `iteration-01` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Security Boundary Guard & 403 Forbidden Feedback Screen.
|
- **Archetype:** Security Boundary Guard & 403 Forbidden Feedback Screen.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Tailwind CSS / shadcn-ui warning state (`Amber-600` / `Rose-600` accents).
|
||||||
- **Behavior:** Rendered whenever an authenticated user attempts to access a frontend route, view, or action prohibited by the `BRD-FR-040` role permission matrix or segregation-of-duties rules (e.g., Quality Officer attempting to edit price rates, Yard Supervisor attempting to confirm sales, or Sales Executive attempting to override credit locks).
|
- **Behavior:** Rendered whenever an authenticated user attempts to access a frontend route, view, or action prohibited by the `BRD-FR-040` role permission matrix or segregation-of-duties rules (e.g., Quality Officer attempting to edit price rates, Yard Supervisor attempting to confirm sales, or Sales Executive attempting to override credit locks).
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-AUTH-003` (Session Handling and Logout)](../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-003-session-handling-and-logout) |
|
| **Owning FR** | [`FR-AUTH-003` (Session Handling and Logout)](../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-003-session-handling-and-logout) |
|
||||||
| **Auth Role / Scope Claims** | Authenticated User (Any valid role) |
|
| **Auth Role / Scope Claims** | Authenticated User (Any valid role) |
|
||||||
| **Iteration** | `iteration-01` |
|
| **Iteration** | `iteration-01` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Account Security & Session Management View.
|
- **Archetype:** Account Security & Session Management View.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Tailwind CSS / shadcn-ui settings page layout (`Slate-800` card borders, `Rose-600` destructive buttons).
|
||||||
- **Behavior:** Provides the user with visibility into their current application session (subject identifier, roles, session establishment timestamp), and enables voluntary termination of the session either via the persistent Header User Profile Menu or the dedicated `/account/sessions` settings tab. Clicking "Log Out" issues `POST /api/v1/auth/logout`, clears client storage, and redirects to `/login`.
|
- **Behavior:** Provides the user with visibility into their current application session (subject identifier, roles, session establishment timestamp), and enables voluntary termination of the session either via the persistent Header User Profile Menu or the dedicated `/account/sessions` settings tab. Clicking "Log Out" issues `POST /api/v1/auth/logout`, clears client storage, and redirects to `/login`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-EXECUTIVEREPORTING-001` (Executive Control Centre Dashboard)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/functional-reqs.md#fr-executivereporting-001-executive-control-centre-dashboard) |
|
| **Owning FR** | [`FR-EXECUTIVEREPORTING-001` (Executive Control Centre Dashboard)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/functional-reqs.md#fr-executivereporting-001-executive-control-centre-dashboard) |
|
||||||
| **Auth Role / Scope Claims** | `Partner`, `Managing Director`, `Operations Supervisor`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Partner`, `Managing Director`, `Operations Supervisor`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-06` |
|
| **Iteration** | `iteration-06` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Executive Control Centre & Operational KPI Dashboard.
|
- **Archetype:** Executive Control Centre & Operational KPI Dashboard.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Modern executive card & grid layout adhering to [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`indigo-600` primary metrics, `emerald-600` revenue/profit, `slate-900` high-contrast typography, `amber-500` utilization warnings).
|
||||||
- **Behavior:** Unified operational dashboard for trading firm principals displaying real-time metrics:
|
- **Behavior:** Unified operational dashboard for trading firm principals displaying real-time metrics:
|
||||||
- Top KPI Stat Cards: Total Stock on Hand (MT), Total Active Stock Lines, Intraday Purchase Turnover (INR), Intraday Sales Revenue (INR), Total Customer Receivables (INR).
|
- Top KPI Stat Cards: Total Stock on Hand (MT), Total Active Stock Lines, Intraday Purchase Turnover (INR), Intraday Sales Revenue (INR), Total Customer Receivables (INR).
|
||||||
- Top 10 Stock Lines by Volume: Commodity, Variety, Stack Location, Godown, Available MT, Bags, Unit Value.
|
- Top 10 Stock Lines by Volume: Commodity, Variety, Stack Location, Godown, Available MT, Bags, Unit Value.
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-DISPATCHDELIVERY-001` (Outbound Dispatch Board Console)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/functional-reqs.md#fr-dispatchdelivery-001-outbound-dispatch-board-console), [`FR-DISPATCHDELIVERY-002` (Outbound Weighbridge & Dispatch Bilty/Manifest)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/functional-reqs.md#fr-dispatchdelivery-002-outbound-weighbridge--dispatch-bilty/manifest) |
|
| **Owning FR** | [`FR-DISPATCHDELIVERY-001` (Outbound Dispatch Board Console)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/functional-reqs.md#fr-dispatchdelivery-001-outbound-dispatch-board-console), [`FR-DISPATCHDELIVERY-002` (Outbound Weighbridge & Dispatch Bilty/Manifest)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/functional-reqs.md#fr-dispatchdelivery-002-outbound-weighbridge--dispatch-bilty/manifest) |
|
||||||
| **Auth Role / Scope Claims** | `Logistics Coordinator`, `Yard Supervisor`, `Weighbridge Operator`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Logistics Coordinator`, `Yard Supervisor`, `Weighbridge Operator`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-04` |
|
| **Iteration** | `iteration-04` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Logistics Dispatch Board & Outward Weighbridge Manifest Generator.
|
- **Archetype:** Logistics Dispatch Board & Outward Weighbridge Manifest Generator.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Dual-purpose operations view (`blue-600` for dispatch scheduling, `emerald-600` for weighbridge capture, `amber-600` for tolerance alerts).
|
||||||
- **Behavior:** Logistics coordinators schedule dispatches matching confirmed sales orders, allocated lots, and transport vehicles from the fleet registry. Fleet status is verified: vehicles in `Maintenance` cannot be assigned. The yard weighbridge captures outward Tare weight (empty truck before loading) and Gross weight (loaded truck). The system computes Net Loaded MT and verifies that it matches allocated order MT within $\pm 1.0\%$ tolerance. Upon successful verification, an official transport Bilty / manifest is generated with e-Way bill linkage.
|
- **Behavior:** Logistics coordinators schedule dispatches matching confirmed sales orders, allocated lots, and transport vehicles from the fleet registry. Fleet status is verified: vehicles in `Maintenance` cannot be assigned. The yard weighbridge captures outward Tare weight (empty truck before loading) and Gross weight (loaded truck). The system computes Net Loaded MT and verifies that it matches allocated order MT within $\pm 1.0\%$ tolerance. Upon successful verification, an official transport Bilty / manifest is generated with e-Way bill linkage.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-DISPATCHDELIVERY-003` (In-Transit Tracking & Proof of Delivery (POD))](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/functional-reqs.md#fr-dispatchdelivery-003-in-transit-tracking--proof-of-delivery-pod) |
|
| **Owning FR** | [`FR-DISPATCHDELIVERY-003` (In-Transit Tracking & Proof of Delivery (POD))](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/functional-reqs.md#fr-dispatchdelivery-003-in-transit-tracking--proof-of-delivery-pod) |
|
||||||
| **Auth Role / Scope Claims** | `Logistics Coordinator`, `Sales Manager`, `Commercial Accountant`, `Partner`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Logistics Coordinator`, `Sales Manager`, `Commercial Accountant`, `Partner`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-04` |
|
| **Iteration** | `iteration-04` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Consignment Delivery Closeout & Transit Shortage Credit Note Settlement Console.
|
- **Archetype:** Consignment Delivery Closeout & Transit Shortage Credit Note Settlement Console.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Document upload and reconciliation view (`emerald-600` for confirmed PODs, `amber-600` for acknowledged shortages, `rose-600` for shortage credit notes requiring approval).
|
||||||
- **Behavior:** The Logistics Coordinator logs destination receipt when the customer takes delivery: actual delivery date/time, destination weighbridge net weight, transit shortage/loss MT, and uploaded signed POD reference. Transitioning to `Delivered` automatically generates the finalized Sales Invoice. If a transit shortage is acknowledged by the customer, the system logs a Consignee Shortage Note and generates a compensating Sales Credit Note against the customer's ledger without altering the immutable outbound dispatch Bilty. If the shortage exceeds 2.0%, mandatory Sales Manager approval is required before the credit note is issued.
|
- **Behavior:** The Logistics Coordinator logs destination receipt when the customer takes delivery: actual delivery date/time, destination weighbridge net weight, transit shortage/loss MT, and uploaded signed POD reference. Transitioning to `Delivered` automatically generates the finalized Sales Invoice. If a transit shortage is acknowledged by the customer, the system logs a Consignee Shortage Note and generates a compensating Sales Credit Note against the customer's ledger without altering the immutable outbound dispatch Bilty. If the shortage exceeds 2.0%, mandatory Sales Manager approval is required before the credit note is issued.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-OPERATINGEXPENSES-001` (Mandi Operating Expense Classification & Recording)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-013-operating-expenses/functional-reqs.md#fr-operatingexpenses-001-mandi-operating-expense-classification--recording) |
|
| **Owning FR** | [`FR-OPERATINGEXPENSES-001` (Mandi Operating Expense Classification & Recording)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-013-operating-expenses/functional-reqs.md#fr-operatingexpenses-001-mandi-operating-expense-classification--recording) |
|
||||||
| **Auth Role / Scope Claims** | `Accounts Executive`, `Yard Supervisor`, `Cashier`, `Finance Head`, `Partner`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Accounts Executive`, `Yard Supervisor`, `Cashier`, `Finance Head`, `Partner`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-05` |
|
| **Iteration** | `iteration-05` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Operating Expense Register & Atomic Cash/Bank Double-Entry Voucher Form.
|
- **Archetype:** Operating Expense Register & Atomic Cash/Bank Double-Entry Voucher Form.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** High-efficiency voucher entry form following [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`agri-700` primary buttons, `slate-800` cards, balanced ledger balance verification badges).
|
||||||
- **Behavior:** Records operational expenses incurred in mandi and godown trading operations. Enforces mandatory classification into standardized Mandi expense categories:
|
- **Behavior:** Records operational expenses incurred in mandi and godown trading operations. Enforces mandatory classification into standardized Mandi expense categories:
|
||||||
- `Labor / Hamali (loading/unloading)`
|
- `Labor / Hamali (loading/unloading)`
|
||||||
- `Freight / Cartage`
|
- `Freight / Cartage`
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-FLEETREGISTRY-001` (Transport Fleet Registry)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-010-fleet-registry/functional-reqs.md#fr-fleetregistry-001-transport-fleet-registry) |
|
| **Owning FR** | [`FR-FLEETREGISTRY-001` (Transport Fleet Registry)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-010-fleet-registry/functional-reqs.md#fr-fleetregistry-001-transport-fleet-registry) |
|
||||||
| **Auth Role / Scope Claims** | `Fleet Manager`, `Logistics Coordinator`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Fleet Manager`, `Logistics Coordinator`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-04` |
|
| **Iteration** | `iteration-04` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Transport Asset Master & Operational Availability Directory.
|
- **Archetype:** Transport Asset Master & Operational Availability Directory.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** High-density fleet card/table layout (`emerald-600` for `Available`, `blue-600` for `On Route`, `rose-600` for `Maintenance`).
|
||||||
- **Behavior:** Fleet managers and logistics coordinators register and manage transport trucks (owned and contract carriers). Captures registration number (e.g. `RJ-09-GA-5678`), make/model, gross payload capacity in MT, ownership category (`Own` vs `Contract`), transporter name, fitness/insurance expiry dates, and operational status (`Available`, `On Route`, `Maintenance`). Enforces invariant: vehicles in `Maintenance` status cannot be assigned to dispatches.
|
- **Behavior:** Fleet managers and logistics coordinators register and manage transport trucks (owned and contract carriers). Captures registration number (e.g. `RJ-09-GA-5678`), make/model, gross payload capacity in MT, ownership category (`Own` vs `Contract`), transporter name, fitness/insurance expiry dates, and operational status (`Available`, `On Route`, `Maintenance`). Enforces invariant: vehicles in `Maintenance` status cannot be assigned to dispatches.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-INWARDRECEIVING-001` (Inward Vehicle Gate Entry & Verification)](../../03_requirements/use_cases/uc-005-inward-receiving/functional-reqs.md#fr-inwardreceiving-001-inward-vehicle-gate-entry--verification), [`FR-INWARDRECEIVING-004` (Weighment Tolerance & Transit Shortage Verification)](../../03_requirements/use_cases/uc-005-inward-receiving/functional-reqs.md#fr-inwardreceiving-004-weighment-tolerance--transit-shortage-verification) |
|
| **Owning FR** | [`FR-INWARDRECEIVING-001` (Inward Vehicle Gate Entry & Verification)](../../03_requirements/use_cases/uc-005-inward-receiving/functional-reqs.md#fr-inwardreceiving-001-inward-vehicle-gate-entry--verification), [`FR-INWARDRECEIVING-004` (Weighment Tolerance & Transit Shortage Verification)](../../03_requirements/use_cases/uc-005-inward-receiving/functional-reqs.md#fr-inwardreceiving-004-weighment-tolerance--transit-shortage-verification) |
|
||||||
| **Auth Role / Scope Claims** | `Security Guard`, `Gate Operator`, `Warehouse Clerk`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Security Guard`, `Gate Operator`, `Warehouse Clerk`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-03` |
|
| **Iteration** | `iteration-03` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Security Gatehouse Dispatch Console & Yard Queue Register.
|
- **Archetype:** Security Gatehouse Dispatch Console & Yard Queue Register.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** High-contrast touch-friendly interface following [`DESIGN.md`](../DESIGN.md) (`agri-700` action buttons, large readable input fields, quick license plate scanners).
|
||||||
- **Behavior:** Security guards and yard operators log arriving trucks carrying agricultural produce. The operator captures vehicle registration number (Indian format: e.g. `RJ-20-GA-1234`), 12-digit e-Way bill number, driver details, supplier dispatch invoice weight and bag count, and links to an active Purchase Sauda contract. The system validates e-Way bill format, verifies that the referenced Sauda is open, issues an Inward Gate Pass Slip, and places the truck into the weighbridge gross queue.
|
- **Behavior:** Security guards and yard operators log arriving trucks carrying agricultural produce. The operator captures vehicle registration number (Indian format: e.g. `RJ-20-GA-1234`), 12-digit e-Way bill number, driver details, supplier dispatch invoice weight and bag count, and links to an active Purchase Sauda contract. The system validates e-Way bill format, verifies that the referenced Sauda is open, issues an Inward Gate Pass Slip, and places the truck into the weighbridge gross queue.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-INWARDRECEIVING-002` (Weighbridge Gross & Tare Weighment Logging)](../../03_requirements/use_cases/uc-005-inward-receiving/functional-reqs.md#fr-inwardreceiving-002-weighbridge-gross--tare-weighment-logging), [`FR-INWARDRECEIVING-003` (Bag Tare Deduction (*Bardana Katai*) & Final Net MT)](../../03_requirements/use_cases/uc-005-inward-receiving/functional-reqs.md#fr-inwardreceiving-003-bag-tare-deduction-bardana-katai--final-net-mt), [`FR-INWARDRECEIVING-005` (Goods Receipt Note (GRN) Posting & Warehouse Stack Placement)](../../03_requirements/use_cases/uc-005-inward-receiving/functional-reqs.md#fr-inwardreceiving-005-goods-receipt-note-grn-posting--warehouse-stack-placement), [`FR-INWARDRECEIVING-006` (Mandatory Lot & Batch Identity Generation)](../../03_requirements/use_cases/uc-005-inward-receiving/functional-reqs.md#fr-inwardreceiving-006-mandatory-lot--batch-identity-generation) |
|
| **Owning FR** | [`FR-INWARDRECEIVING-002` (Weighbridge Gross & Tare Weighment Logging)](../../03_requirements/use_cases/uc-005-inward-receiving/functional-reqs.md#fr-inwardreceiving-002-weighbridge-gross--tare-weighment-logging), [`FR-INWARDRECEIVING-003` (Bag Tare Deduction (*Bardana Katai*) & Final Net MT)](../../03_requirements/use_cases/uc-005-inward-receiving/functional-reqs.md#fr-inwardreceiving-003-bag-tare-deduction-bardana-katai--final-net-mt), [`FR-INWARDRECEIVING-005` (Goods Receipt Note (GRN) Posting & Warehouse Stack Placement)](../../03_requirements/use_cases/uc-005-inward-receiving/functional-reqs.md#fr-inwardreceiving-005-goods-receipt-note-grn-posting--warehouse-stack-placement), [`FR-INWARDRECEIVING-006` (Mandatory Lot & Batch Identity Generation)](../../03_requirements/use_cases/uc-005-inward-receiving/functional-reqs.md#fr-inwardreceiving-006-mandatory-lot--batch-identity-generation) |
|
||||||
| **Auth Role / Scope Claims** | `Weighbridge Operator`, `Warehouse Supervisor`, `Warehouse Clerk`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Weighbridge Operator`, `Warehouse Supervisor`, `Warehouse Clerk`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-03` |
|
| **Iteration** | `iteration-03` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Industrial Weighbridge Scale Terminal & Warehouse Goods Receipt / Lot Stacking Console.
|
- **Archetype:** Industrial Weighbridge Scale Terminal & Warehouse Goods Receipt / Lot Stacking Console.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** High-density operator UI following [`DESIGN.md`](../DESIGN.md) (`agri-700` primary buttons, prominent numeric display for weight digits, `grain-100` background).
|
||||||
- **Behavior:** Captures gross weighment upon arrival and tare weighment after unloading. Automatically calculates gross minus tare. Prompts for bag packaging type (Jute 50kg, HDPE 50kg, Loose bulk) and bag count to compute packaging tare (*Bardana Katai*) with 3-decimal metric tonne precision (NFR-001). Upon tare completion, supervisor reviews transit shortage vs. dispatch invoice, assigns physical warehouse godown stack, posts the Goods Receipt Note (GRN), and generates the unique traceable lot identity (`LOT-YY-MM-COMM-XXXXX`).
|
- **Behavior:** Captures gross weighment upon arrival and tare weighment after unloading. Automatically calculates gross minus tare. Prompts for bag packaging type (Jute 50kg, HDPE 50kg, Loose bulk) and bag count to compute packaging tare (*Bardana Katai*) with 3-decimal metric tonne precision (NFR-001). Upon tare completion, supervisor reviews transit shortage vs. dispatch invoice, assigns physical warehouse godown stack, posts the Goods Receipt Note (GRN), and generates the unique traceable lot identity (`LOT-YY-MM-COMM-XXXXX`).
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-MASTERDATA-001` (Agricultural Commodity Master Data Management)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-016-master-data/functional-reqs.md#fr-masterdata-001-agricultural-commodity-master-data-management) |
|
| **Owning FR** | [`FR-MASTERDATA-001` (Agricultural Commodity Master Data Management)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-016-master-data/functional-reqs.md#fr-masterdata-001-agricultural-commodity-master-data-management) |
|
||||||
| **Auth Role / Scope Claims** | `Tenant Admin`, `Partner`, `Operations Supervisor` |
|
| **Auth Role / Scope Claims** | `Tenant Admin`, `Partner`, `Operations Supervisor` |
|
||||||
| **Iteration** | `iteration-07` |
|
| **Iteration** | `iteration-07` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Platform Master Data Catalog & Specification Console.
|
- **Archetype:** Platform Master Data Catalog & Specification Console.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Adheres to [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`slate-900` table surface, `emerald-600` primary buttons, `amber-500` status chips, `rose-600` deactivation warnings).
|
||||||
- **Behavior:**
|
- **Behavior:**
|
||||||
- Lists tenant-scoped agricultural commodities with standard packaging, quality tolerance baselines, and botanical varieties.
|
- Lists tenant-scoped agricultural commodities with standard packaging, quality tolerance baselines, and botanical varieties.
|
||||||
- Allows Tenant Admins and Partners to create, modify, and manage commodities.
|
- Allows Tenant Admins and Partners to create, modify, and manage commodities.
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-MASTERDATA-002` (Trading Counterparty & Godown Directory)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-016-master-data/functional-reqs.md#fr-masterdata-002-trading-counterparty-and-godown-directory) |
|
| **Owning FR** | [`FR-MASTERDATA-002` (Trading Counterparty & Godown Directory)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-016-master-data/functional-reqs.md#fr-masterdata-002-trading-counterparty-and-godown-directory) |
|
||||||
| **Auth Role / Scope Claims** | `Tenant Admin`, `Partner`, `Finance Officer`, `Operations Supervisor` |
|
| **Auth Role / Scope Claims** | `Tenant Admin`, `Partner`, `Finance Officer`, `Operations Supervisor` |
|
||||||
| **Iteration** | `iteration-07` |
|
| **Iteration** | `iteration-07` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Enterprise Business Partner & Infrastructure Directory Console.
|
- **Archetype:** Enterprise Business Partner & Infrastructure Directory Console.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Adheres to [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (tabbed interface, `slate-900` table background, `emerald-600` primary buttons, badge tags for partner types).
|
||||||
- **Behavior:**
|
- **Behavior:**
|
||||||
- Provides two administrative tabs:
|
- Provides two administrative tabs:
|
||||||
1. **Counterparties Tab:** Farmers, Commission Agents, Wholesale Processors, and Institutional Buyers. Enforces statutory PAN (`[A-Z]{5}[0-9]{4}[A-Z]{1}`), GSTIN (15 characters), bank account details, and strictly validated credit terms (`7`, `15`, or `21` days).
|
1. **Counterparties Tab:** Farmers, Commission Agents, Wholesale Processors, and Institutional Buyers. Enforces statutory PAN (`[A-Z]{5}[0-9]{4}[A-Z]{1}`), GSTIN (15 characters), bank account details, and strictly validated credit terms (`7`, `15`, or `21` days).
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-MKT-001` (Capture Daily Mandi Arrival Observations)](../../03_requirements/use_cases/uc-002-market-desk-observations/functional-reqs.md#fr-mkt-001-capture-daily-mandi-arrival-observations), [`FR-MKT-002` (Capture Daily Mandi Price Range and Modal Rate)](../../03_requirements/use_cases/uc-002-market-desk-observations/functional-reqs.md#fr-mkt-002-capture-daily-mandi-price-range-and-modal-rate) |
|
| **Owning FR** | [`FR-MKT-001` (Capture Daily Mandi Arrival Observations)](../../03_requirements/use_cases/uc-002-market-desk-observations/functional-reqs.md#fr-mkt-001-capture-daily-mandi-arrival-observations), [`FR-MKT-002` (Capture Daily Mandi Price Range and Modal Rate)](../../03_requirements/use_cases/uc-002-market-desk-observations/functional-reqs.md#fr-mkt-002-capture-daily-mandi-price-range-and-modal-rate) |
|
||||||
| **Auth Role / Scope Claims** | `Mandi Buyer`, `Desk Trader`, `Procurement Officer`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Mandi Buyer`, `Desk Trader`, `Procurement Officer`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-03` |
|
| **Iteration** | `iteration-03` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Market Intelligence Blotter & Daily Rate Recording Console.
|
- **Archetype:** Market Intelligence Blotter & Daily Rate Recording Console.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (`agri-700` primary buttons, `grain-100` card headers, `slate-900` text).
|
||||||
- **Behavior:** Authorized Mandi Buyers and Desk Traders monitor and record daily arrivals (in MT) and APMC auction rates (Min, Max, Modal rate in ₹/Qtl) for key monitored mandis across commodities (Wheat, Chana, Mustard, Soyabean, etc.). The console prevents duplicate entries for the same mandi/commodity/variety/date, prevents future observation dates, supports flagging market closure/holidays, and computes arrival variance against internal stock position.
|
- **Behavior:** Authorized Mandi Buyers and Desk Traders monitor and record daily arrivals (in MT) and APMC auction rates (Min, Max, Modal rate in ₹/Qtl) for key monitored mandis across commodities (Wheat, Chana, Mustard, Soyabean, etc.). The console prevents duplicate entries for the same mandi/commodity/variety/date, prevents future observation dates, supports flagging market closure/holidays, and computes arrival variance against internal stock position.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-MARKETTRENDANALYTICS-001` (Intraday Price Trend Analysis & 20-Day Benchmark Analytics)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-003-market-trend-analytics/functional-reqs.md#fr-markettrendanalytics-001-intraday-price-trend-analysis--20-day-benchmark-analytics) |
|
| **Owning FR** | [`FR-MARKETTRENDANALYTICS-001` (Intraday Price Trend Analysis & 20-Day Benchmark Analytics)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-003-market-trend-analytics/functional-reqs.md#fr-markettrendanalytics-001-intraday-price-trend-analysis--20-day-benchmark-analytics) |
|
||||||
| **Auth Role / Scope Claims** | `Purchase Manager`, `Partner`, `Managing Director`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Purchase Manager`, `Partner`, `Managing Director`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-06` |
|
| **Iteration** | `iteration-06` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Commodity Price Analytics & Technical Benchmark Console.
|
- **Archetype:** Commodity Price Analytics & Technical Benchmark Console.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Financial chart and indicator layout adhering to [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`amber-500` modal price curve, `blue-500` 20-day SMA, `emerald-500` 20-day high channel, `rose-500` 20-day low channel, `slate-800` cards).
|
||||||
- **Behavior:** Renders interactive visual charts and trend tables comparing 20-day historical modal rates for selected commodities across Mandis:
|
- **Behavior:** Renders interactive visual charts and trend tables comparing 20-day historical modal rates for selected commodities across Mandis:
|
||||||
- 20-day Simple Moving Average ($\text{SMA}_{20}$):
|
- 20-day Simple Moving Average ($\text{SMA}_{20}$):
|
||||||
$$\text{SMA}_{20} = \frac{1}{20} \sum_{i=1}^{20} \text{Modal Rate}_i$$
|
$$\text{SMA}_{20} = \frac{1}{20} \sum_{i=1}^{20} \text{Modal Rate}_i$$
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-SUPPLIERPAYABLES-001` (Supplier Payables Aging & Balance Snapshots)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-012-supplier-payables/functional-reqs.md#fr-supplierpayables-001-supplier-payables-aging--balance-snapshots) |
|
| **Owning FR** | [`FR-SUPPLIERPAYABLES-001` (Supplier Payables Aging & Balance Snapshots)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-012-supplier-payables/functional-reqs.md#fr-supplierpayables-001-supplier-payables-aging--balance-snapshots) |
|
||||||
| **Auth Role / Scope Claims** | `Accounts Executive`, `Finance Head`, `Purchase Manager`, `Partner`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Accounts Executive`, `Finance Head`, `Purchase Manager`, `Partner`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-05` |
|
| **Iteration** | `iteration-05` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Accounts Payable Aging Console & Supplier Disbursement Register.
|
- **Archetype:** Accounts Payable Aging Console & Supplier Disbursement Register.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** High-density accounts payable dashboard following [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`slate-700` headers, `emerald-600` paid status badges, `amber-500` due soon, `rose-600` overdue warnings).
|
||||||
- **Behavior:** Tracks accounts payable liabilities arising from accepted Goods Receipt Notes (GRNs) across farmers, commission agents, and aggregator suppliers. Computes the payment due date:
|
- **Behavior:** Tracks accounts payable liabilities arising from accepted Goods Receipt Notes (GRNs) across farmers, commission agents, and aggregator suppliers. Computes the payment due date:
|
||||||
$$\text{Due Date} = \text{GRN Date} + \text{Supplier Credit Days}$$
|
$$\text{Due Date} = \text{GRN Date} + \text{Supplier Credit Days}$$
|
||||||
Computes days overdue ($\text{Current Date} - \text{Due Date}$) and classifies payables into aging buckets:
|
Computes days overdue ($\text{Current Date} - \text{Due Date}$) and classifies payables into aging buckets:
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-TENANTOPERATINGPOLICIES-001` (Effective-Dated Tenant Operating Policy Configuration)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-026-tenant-operating-policies/functional-reqs.md#fr-tenantoperatingpolicies-001-effective-dated-tenant-operating-policy-configuration) |
|
| **Owning FR** | [`FR-TENANTOPERATINGPOLICIES-001` (Effective-Dated Tenant Operating Policy Configuration)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-026-tenant-operating-policies/functional-reqs.md#fr-tenantoperatingpolicies-001-effective-dated-tenant-operating-policy-configuration) |
|
||||||
| **Auth Role / Scope Claims** | `Partner`, `Managing Director`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Partner`, `Managing Director`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-07` |
|
| **Iteration** | `iteration-07` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Effective-Dated Risk & Operating Policy Management Console.
|
- **Archetype:** Effective-Dated Risk & Operating Policy Management Console.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Adheres to [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`slate-900` card and table backgrounds, `emerald-600` primary actions, `indigo-500` version chips, `amber-500` audit warnings).
|
||||||
- **Behavior:**
|
- **Behavior:**
|
||||||
- Displays the active, effective tenant operating policy governing operational and financial risk rules across all mandi pipelines.
|
- Displays the active, effective tenant operating policy governing operational and financial risk rules across all mandi pipelines.
|
||||||
- Allows authorized Partners and Managing Directors to publish updated policies with explicit effective date intervals (`effective_from`, optional `effective_to`).
|
- Allows authorized Partners and Managing Directors to publish updated policies with explicit effective date intervals (`effective_from`, optional `effective_to`).
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-PROCUREMENTCONTRACTS-001` (Procurement Price Variance Alert vs. Modal Rate)](../../03_requirements/use_cases/uc-004-procurement-contracts/functional-reqs.md#fr-procurementcontracts-001-procurement-price-variance-alert-vs-modal-rate), [`FR-PROCUREMENTCONTRACTS-002` (Mandi Auction & Direct Purchase Sauda Booking)](../../03_requirements/use_cases/uc-004-procurement-contracts/functional-reqs.md#fr-procurementcontracts-002-mandi-auction--direct-purchase-sauda-booking), [`FR-PROCUREMENTCONTRACTS-003` (Supplier Credit Terms, Payment Due Date, and Advance Recording)](../../03_requirements/use_cases/uc-004-procurement-contracts/functional-reqs.md#fr-procurementcontracts-003-supplier-credit-terms-payment-due-date-and-advance-recording), [`FR-PROCUREMENTCONTRACTS-004` (Mandi Cess, Krishi Kalyan, and Statutory Levies Breakdown)](../../03_requirements/use_cases/uc-004-procurement-contracts/functional-reqs.md#fr-procurementcontracts-004-mandi-cess-krishi-kalyan-and-statutory-levies-breakdown) |
|
| **Owning FR** | [`FR-PROCUREMENTCONTRACTS-001` (Procurement Price Variance Alert vs. Modal Rate)](../../03_requirements/use_cases/uc-004-procurement-contracts/functional-reqs.md#fr-procurementcontracts-001-procurement-price-variance-alert-vs-modal-rate), [`FR-PROCUREMENTCONTRACTS-002` (Mandi Auction & Direct Purchase Sauda Booking)](../../03_requirements/use_cases/uc-004-procurement-contracts/functional-reqs.md#fr-procurementcontracts-002-mandi-auction--direct-purchase-sauda-booking), [`FR-PROCUREMENTCONTRACTS-003` (Supplier Credit Terms, Payment Due Date, and Advance Recording)](../../03_requirements/use_cases/uc-004-procurement-contracts/functional-reqs.md#fr-procurementcontracts-003-supplier-credit-terms-payment-due-date-and-advance-recording), [`FR-PROCUREMENTCONTRACTS-004` (Mandi Cess, Krishi Kalyan, and Statutory Levies Breakdown)](../../03_requirements/use_cases/uc-004-procurement-contracts/functional-reqs.md#fr-procurementcontracts-004-mandi-cess-krishi-kalyan-and-statutory-levies-breakdown) |
|
||||||
| **Auth Role / Scope Claims** | `Procurement Officer`, `Desk Trader`, `Purchase Manager`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Procurement Officer`, `Desk Trader`, `Purchase Manager`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-03` |
|
| **Iteration** | `iteration-03` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Trade Contract Booking Engine, Commercial Blotter & Landed Cost Calculator.
|
- **Archetype:** Trade Contract Booking Engine, Commercial Blotter & Landed Cost Calculator.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (`agri-700` primary buttons, `amber-500` warning badges, `slate-900` text).
|
||||||
- **Behavior:** Commercial buyers book auction or direct purchase contracts (*saudas*) with validated suppliers. Features real-time price variance warning when offered trade rate deviates by $>5\%$ against the latest modal clearing rate, automated calculation of payment due dates from credit term days, advance payment recording, and dynamic breakdown of statutory APMC mandi cess, cess sub-heads, and broker commission. Tracks partial deliveries against booked metric tonnage.
|
- **Behavior:** Commercial buyers book auction or direct purchase contracts (*saudas*) with validated suppliers. Features real-time price variance warning when offered trade rate deviates by $>5\%$ against the latest modal clearing rate, automated calculation of payment due dates from credit term days, advance payment recording, and dynamic breakdown of statutory APMC mandi cess, cess sub-heads, and broker commission. Tracks partial deliveries against booked metric tonnage.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-QUALITYANDLOTCONTROL-001` (Inward Quality Inspection Parameter Recording)](../../03_requirements/use_cases/uc-006-quality-and-lot-control/functional-reqs.md#fr-qualityandlotcontrol-001-inward-quality-inspection-parameter-recording), [`FR-QUALITYANDLOTCONTROL-002` (Quality Deduction / Rebate Calculation)](../../03_requirements/use_cases/uc-006-quality-and-lot-control/functional-reqs.md#fr-qualityandlotcontrol-002-quality-deduction--rebate-calculation), [`FR-QUALITYANDLOTCONTROL-003` (Finite State Machine Enforcement for `QC Hold` vs. `Released`)](../../03_requirements/use_cases/uc-006-quality-and-lot-control/functional-reqs.md#fr-qualityandlotcontrol-003-finite-state-machine-enforcement-for-qc-hold-vs-released), [`FR-QUALITYANDLOTCONTROL-004` (Lot Splitting & Blending Traceability)](../../03_requirements/use_cases/uc-006-quality-and-lot-control/functional-reqs.md#fr-qualityandlotcontrol-004-lot-splitting--blending-traceability) |
|
| **Owning FR** | [`FR-QUALITYANDLOTCONTROL-001` (Inward Quality Inspection Parameter Recording)](../../03_requirements/use_cases/uc-006-quality-and-lot-control/functional-reqs.md#fr-qualityandlotcontrol-001-inward-quality-inspection-parameter-recording), [`FR-QUALITYANDLOTCONTROL-002` (Quality Deduction / Rebate Calculation)](../../03_requirements/use_cases/uc-006-quality-and-lot-control/functional-reqs.md#fr-qualityandlotcontrol-002-quality-deduction--rebate-calculation), [`FR-QUALITYANDLOTCONTROL-003` (Finite State Machine Enforcement for `QC Hold` vs. `Released`)](../../03_requirements/use_cases/uc-006-quality-and-lot-control/functional-reqs.md#fr-qualityandlotcontrol-003-finite-state-machine-enforcement-for-qc-hold-vs-released), [`FR-QUALITYANDLOTCONTROL-004` (Lot Splitting & Blending Traceability)](../../03_requirements/use_cases/uc-006-quality-and-lot-control/functional-reqs.md#fr-qualityandlotcontrol-004-lot-splitting--blending-traceability) |
|
||||||
| **Auth Role / Scope Claims** | `Quality Inspector`, `Lab Chemist`, `Warehouse Manager`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Quality Inspector`, `Lab Chemist`, `Warehouse Manager`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-03` |
|
| **Iteration** | `iteration-03` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Laboratory Analytical Testing Station, Quality Decision FSM Cockpit & Commercial Settlement Refraction Sheet.
|
- **Archetype:** Laboratory Analytical Testing Station, Quality Decision FSM Cockpit & Commercial Settlement Refraction Sheet.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** High-density scientific testing interface following [`DESIGN.md`](../DESIGN.md) (`agri-700` primary buttons, `emerald-500` for Released, `rose-500` for Rejected, `amber-500` for QC Hold).
|
||||||
- **Behavior:** Quality Inspectors and Lab Chemists sample inward lots, record physical and analytical assay parameters (Moisture %, Foreign Matter / Admixture %, Damaged / Discolored Grain %, Shriveled Grain %, Oil / Protein Content %). The engine computes commercial deduction/rebate schedules (price cuts or weight deductions) against Fair Average Quality (FAQ) benchmarks. The inspector executes FSM transitions (`QUALITY_HOLD` $\to$ `RELEASED` or `REJECTED`). Produce under `QUALITY_HOLD` is blocked from dispatch or sales orders. Displays lot lineage and digital quality certificates.
|
- **Behavior:** Quality Inspectors and Lab Chemists sample inward lots, record physical and analytical assay parameters (Moisture %, Foreign Matter / Admixture %, Damaged / Discolored Grain %, Shriveled Grain %, Oil / Protein Content %). The engine computes commercial deduction/rebate schedules (price cuts or weight deductions) against Fair Average Quality (FAQ) benchmarks. The inspector executes FSM transitions (`QUALITY_HOLD` $\to$ `RELEASED` or `REJECTED`). Produce under `QUALITY_HOLD` is blocked from dispatch or sales orders. Displays lot lineage and digital quality certificates.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-CUSTOMERRECEIVABLES-001` (Customer Ledger & Aging Statement)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/functional-reqs.md#fr-customerreceivables-001-customer-ledger--aging-statement) |
|
| **Owning FR** | [`FR-CUSTOMERRECEIVABLES-001` (Customer Ledger & Aging Statement)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/functional-reqs.md#fr-customerreceivables-001-customer-ledger--aging-statement) |
|
||||||
| **Auth Role / Scope Claims** | `Accounts Executive`, `Finance Head`, `Sales Manager`, `Partner`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Accounts Executive`, `Finance Head`, `Sales Manager`, `Partner`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-05` |
|
| **Iteration** | `iteration-05` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Party Sub-Ledger Accounting Console & Multi-Bucket Aging Schedule.
|
- **Archetype:** Party Sub-Ledger Accounting Console & Multi-Bucket Aging Schedule.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** High-density financial tabular layout following [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`emerald-700` positive credits, `rose-700` debit invoices, `slate-800` running balances).
|
||||||
- **Behavior:** Renders an immutable double-entry customer sub-ledger debiting finalized sales invoices, crediting payment receipts and credit notes, and presenting the real-time outstanding balance. Computes a 4-bucket aging schedule based on invoice posting and due dates:
|
- **Behavior:** Renders an immutable double-entry customer sub-ledger debiting finalized sales invoices, crediting payment receipts and credit notes, and presenting the real-time outstanding balance. Computes a 4-bucket aging schedule based on invoice posting and due dates:
|
||||||
- `0–7 Days` (Current / Normal)
|
- `0–7 Days` (Current / Normal)
|
||||||
- `8–15 Days` (Due Soon)
|
- `8–15 Days` (Due Soon)
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-CUSTOMERRECEIVABLES-002` (Automated Customer Credit Exposure Watch & Threshold Alert)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/functional-reqs.md#fr-customerreceivables-002-automated-customer-credit-exposure-watch--threshold-alert), [`FR-CUSTOMERRECEIVABLES-003` (Credit Breach Dispatch Lock & Partner Override)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/functional-reqs.md#fr-customerreceivables-003-credit-breach-dispatch-lock--partner-override) |
|
| **Owning FR** | [`FR-CUSTOMERRECEIVABLES-002` (Automated Customer Credit Exposure Watch & Threshold Alert)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/functional-reqs.md#fr-customerreceivables-002-automated-customer-credit-exposure-watch--threshold-alert), [`FR-CUSTOMERRECEIVABLES-003` (Credit Breach Dispatch Lock & Partner Override)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/functional-reqs.md#fr-customerreceivables-003-credit-breach-dispatch-lock--partner-override) |
|
||||||
| **Auth Role / Scope Claims** | `Accounts Executive`, `Credit Controller`, `Sales Manager`, `Partner`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Accounts Executive`, `Credit Controller`, `Sales Manager`, `Partner`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-05` |
|
| **Iteration** | `iteration-05` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Risk Monitoring Dashboard & Electronic Authorization Modal.
|
- **Archetype:** Risk Monitoring Dashboard & Electronic Authorization Modal.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Visual exposure meters following [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`emerald-500` normal $\le 80\%$, `amber-500` watch $80\%–100\%$, `rose-600` critical $> 100\%$).
|
||||||
- **Behavior:** Continuously evaluates all customer credit profiles. If exposure ratio ($\text{Outstanding} / \text{Credit Limit}$) $> 80\%$, the account is tagged with visual `WATCH` status and surfaced on the dashboard. If exposure $> 100\%$, the system sets `LOCKED` status and hard-blocks pending outbound dispatches. Provides a secure Partner electronic override modal requiring digital sign-off and justification notes.
|
- **Behavior:** Continuously evaluates all customer credit profiles. If exposure ratio ($\text{Outstanding} / \text{Credit Limit}$) $> 80\%$, the account is tagged with visual `WATCH` status and surfaced on the dashboard. If exposure $> 100\%$, the system sets `LOCKED` status and hard-blocks pending outbound dispatches. Provides a secure Partner electronic override modal requiring digital sign-off and justification notes.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-CUSTOMERRECEIVABLES-004` (Customer Payment Receipt Posting)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/functional-reqs.md#fr-customerreceivables-004-customer-payment-receipt-posting) |
|
| **Owning FR** | [`FR-CUSTOMERRECEIVABLES-004` (Customer Payment Receipt Posting)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/functional-reqs.md#fr-customerreceivables-004-customer-payment-receipt-posting) |
|
||||||
| **Auth Role / Scope Claims** | `Accounts Executive`, `Cashier`, `Finance Head`, `Sales Manager`, `Partner`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Accounts Executive`, `Cashier`, `Finance Head`, `Sales Manager`, `Partner`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-05` |
|
| **Iteration** | `iteration-05` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Financial Transaction Register, Payment Voucher Entry Form & Instrument Lifecycle Console.
|
- **Archetype:** Financial Transaction Register, Payment Voucher Entry Form & Instrument Lifecycle Console.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** High-clarity cashier and accounting entry screen following [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`agri-700` primary buttons, `emerald-600` cleared status badges, `amber-500` pending clearance, `rose-600` bounced instrument alerts).
|
||||||
- **Behavior:** Cashiers and accounts executives record received customer payments across payment modes (`NEFT`, `RTGS`, `Cheque`, `Cash`, `UPI`). Upon receipt entry with status `Cleared` (or when `Pending Clearance` transitions to `Cleared`), the amount is credited to the customer's party sub-ledger, decreasing outstanding debt and recalculating credit exposure. If a Cheque transitions to `Bounced`, the system executes an automatic atomic reversal: debits the party ledger to restore debt, re-evaluates exposure, reinstates credit breach dispatch locks if exposure $> 100\%$, and alerts the Sales Manager and Accounts Executive.
|
- **Behavior:** Cashiers and accounts executives record received customer payments across payment modes (`NEFT`, `RTGS`, `Cheque`, `Cash`, `UPI`). Upon receipt entry with status `Cleared` (or when `Pending Clearance` transitions to `Cleared`), the amount is credited to the customer's party sub-ledger, decreasing outstanding debt and recalculating credit exposure. If a Cheque transitions to `Bounced`, the system executes an automatic atomic reversal: debits the party ledger to restore debt, re-evaluates exposure, reinstates credit breach dispatch locks if exposure $> 100\%$, and alerts the Sales Manager and Accounts Executive.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-SALESCONTRACTS-001` (Customer Sales Contract Booking)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/functional-reqs.md#fr-salescontracts-001-customer-sales-contract-booking), [`FR-SALESCONTRACTS-002` (Customer Credit Limit & Pre-Order Exposure Verification)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/functional-reqs.md#fr-salescontracts-002-customer-credit-limit--pre-order-exposure-verification) |
|
| **Owning FR** | [`FR-SALESCONTRACTS-001` (Customer Sales Contract Booking)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/functional-reqs.md#fr-salescontracts-001-customer-sales-contract-booking), [`FR-SALESCONTRACTS-002` (Customer Credit Limit & Pre-Order Exposure Verification)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/functional-reqs.md#fr-salescontracts-002-customer-credit-limit--pre-order-exposure-verification) |
|
||||||
| **Auth Role / Scope Claims** | `Sales Manager`, `Credit Controller`, `Commercial Head`, `Partner`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Sales Manager`, `Credit Controller`, `Commercial Head`, `Partner`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-04` |
|
| **Iteration** | `iteration-04` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Commercial Contract Booking Form with Real-Time Credit Bureau / Exposure Interceptor.
|
- **Archetype:** Commercial Contract Booking Form with Real-Time Credit Bureau / Exposure Interceptor.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** High-clarity commercial entry form following [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`agri-700` primary buttons, `amber-500` credit warning callouts, `rose-600` hard-block credit modals with Partner authorization keys).
|
||||||
- **Behavior:** Sales managers book wholesale customer contracts specifying customer details, destination city, customer segment (`Wholesale`, `Processor`, `Institutional`, `Distributor`), commodity, variety, grade, contracted MT, rate in ₹/Qtl, and delivery schedule. The screen auto-computes Total Sales Value ($\text{MT} \times 10 \times \text{Rate}$). Prior to confirmation, the system interrogates the customer credit ledger:
|
- **Behavior:** Sales managers book wholesale customer contracts specifying customer details, destination city, customer segment (`Wholesale`, `Processor`, `Institutional`, `Distributor`), commodity, variety, grade, contracted MT, rate in ₹/Qtl, and delivery schedule. The screen auto-computes Total Sales Value ($\text{MT} \times 10 \times \text{Rate}$). Prior to confirmation, the system interrogates the customer credit ledger:
|
||||||
$$\text{Projected Exposure} = \text{Current Outstanding INR} + \text{New Order Value INR}$$
|
$$\text{Projected Exposure} = \text{Current Outstanding INR} + \text{New Order Value INR}$$
|
||||||
$$\text{Projected Exposure Ratio \%} = \frac{\text{Projected Exposure}}{\text{Sanctioned Credit Limit}} \times 100$$
|
$$\text{Projected Exposure Ratio \%} = \frac{\text{Projected Exposure}}{\text{Sanctioned Credit Limit}} \times 100$$
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-SALESCONTRACTS-003` (Sales Order Inventory Allocation)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/functional-reqs.md#fr-salescontracts-003-sales-order-inventory-allocation) |
|
| **Owning FR** | [`FR-SALESCONTRACTS-003` (Sales Order Inventory Allocation)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/functional-reqs.md#fr-salescontracts-003-sales-order-inventory-allocation) |
|
||||||
| **Auth Role / Scope Claims** | `Sales Manager`, `Yard Supervisor`, `Warehouse Manager`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Sales Manager`, `Yard Supervisor`, `Warehouse Manager`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-04` |
|
| **Iteration** | `iteration-04` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Inventory Lot Matching & Physical Allocation Workstation.
|
- **Archetype:** Inventory Lot Matching & Physical Allocation Workstation.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Split-panel matching view (`slate-800` left panel for sales order contract parameters, right panel for warehouse stack lot browser with `emerald-600` for `Released` lots and red disabled state with lock icon for `QC Hold` / `Under QC` lots).
|
||||||
- **Behavior:** The Sales Manager matches a confirmed sales order to specific warehouse lots. The system interrogates the lot registry:
|
- **Behavior:** The Sales Manager matches a confirmed sales order to specific warehouse lots. The system interrogates the lot registry:
|
||||||
1. Only lots with FSM state `RELEASED` are selectable. Any lot in `QC_HOLD` or `UNDER_QC` is hard-disabled with an explanatory tooltip.
|
1. Only lots with FSM state `RELEASED` are selectable. Any lot in `QC_HOLD` or `UNDER_QC` is hard-disabled with an explanatory tooltip.
|
||||||
2. The available unreserved balance on the lot must be $\ge$ requested allocation quantity.
|
2. The available unreserved balance on the lot must be $\ge$ requested allocation quantity.
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-TENANTSUPPORTSECURITY-002` (Controlled Privileged Support Access)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-020-tenant-support/functional-reqs.md#fr-tenantsupportsecurity-002-controlled-privileged-support-access) |
|
| **Owning FR** | [`FR-TENANTSUPPORTSECURITY-002` (Controlled Privileged Support Access)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-020-tenant-support/functional-reqs.md#fr-tenantsupportsecurity-002-controlled-privileged-support-access) |
|
||||||
| **Auth Role / Scope Claims** | `Tenant Admin`, `Platform Support Engineer`, `Managing Director` |
|
| **Auth Role / Scope Claims** | `Tenant Admin`, `Platform Support Engineer`, `Managing Director` |
|
||||||
| **Iteration** | `iteration-07` |
|
| **Iteration** | `iteration-07` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Privileged Access Management (PAM) & Dual-Authorization Security Console.
|
- **Archetype:** Privileged Access Management (PAM) & Dual-Authorization Security Console.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Adheres to [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`amber-500` pending approval badges, `emerald-600` active session indicators, `rose-600` break-glass alarms).
|
||||||
- **Behavior:**
|
- **Behavior:**
|
||||||
- Manages time-bounded support impersonation grants requested by Platform Support Engineers for troubleshooting tenant-specific issues.
|
- Manages time-bounded support impersonation grants requested by Platform Support Engineers for troubleshooting tenant-specific issues.
|
||||||
- Implements mandatory **Dual-Authorization**:
|
- Implements mandatory **Dual-Authorization**:
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-TENANTLIFECYCLE-001` (Tenant Provisioning and Lifecycle Management)](../../03_requirements/use_cases/uc-018-tenant-lifecycle/functional-reqs.md#fr-tenantlifecycle-001-tenant-provisioning-and-lifecycle-management) |
|
| **Owning FR** | [`FR-TENANTLIFECYCLE-001` (Tenant Provisioning and Lifecycle Management)](../../03_requirements/use_cases/uc-018-tenant-lifecycle/functional-reqs.md#fr-tenantlifecycle-001-tenant-provisioning-and-lifecycle-management) |
|
||||||
| **Auth Role / Scope Claims** | `System Administrator` only |
|
| **Auth Role / Scope Claims** | `System Administrator` only |
|
||||||
| **Iteration** | `iteration-02` |
|
| **Iteration** | `iteration-02` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Enterprise Administration Dashboard & Tenant Lifecycle Control Panel.
|
- **Archetype:** Enterprise Administration Dashboard & Tenant Lifecycle Control Panel.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (`Slate-900` sidebar, `Indigo-600` operator accent, status badge pills).
|
||||||
- **Behavior:** Platform operators and System Administrators view all registered agricultural trading firms, provision new tenant firms via modal dialog, inspect tenant details, and transition lifecycle states (`ACTIVE` $\leftrightarrow$ `SUSPENDED` $\to$ `CLOSED`). Transitioning a tenant to `SUSPENDED` immediately revokes active member sessions and blocks API ingress.
|
- **Behavior:** Platform operators and System Administrators view all registered agricultural trading firms, provision new tenant firms via modal dialog, inspect tenant details, and transition lifecycle states (`ACTIVE` $\leftrightarrow$ `SUSPENDED` $\to$ `CLOSED`). Transitioning a tenant to `SUSPENDED` immediately revokes active member sessions and blocks API ingress.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-TENANTMEMBERSHIPCONTEXT-001` (Tenant Membership and Role Administration)](../../03_requirements/use_cases/uc-019-tenant-membership-context/functional-reqs.md#fr-tenantmembershipcontext-001-tenant-membership-and-role-administration) |
|
| **Owning FR** | [`FR-TENANTMEMBERSHIPCONTEXT-001` (Tenant Membership and Role Administration)](../../03_requirements/use_cases/uc-019-tenant-membership-context/functional-reqs.md#fr-tenantmembershipcontext-001-tenant-membership-and-role-administration) |
|
||||||
| **Auth Role / Scope Claims** | `Tenant Administrator` within verified active tenant |
|
| **Auth Role / Scope Claims** | `Tenant Administrator` within verified active tenant |
|
||||||
| **Iteration** | `iteration-02` |
|
| **Iteration** | `iteration-02` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Enterprise Settings / Team Member & Role Management Console.
|
- **Archetype:** Enterprise Settings / Team Member & Role Management Console.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (`Emerald-600` brand accent, multi-select role tags, danger modal for revocation).
|
||||||
- **Behavior:** Tenant Administrators manage user accounts and role assignments within their own active firm. Admins can view current members, invite/add new team members by email, update role assignments selecting from the 11 PRD roles, and deactivate memberships. Cross-tenant administration is prevented: queries and mutations are strictly scoped by the active `TenantContext`.
|
- **Behavior:** Tenant Administrators manage user accounts and role assignments within their own active firm. Admins can view current members, invite/add new team members by email, update role assignments selecting from the 11 PRD roles, and deactivate memberships. Cross-tenant administration is prevented: queries and mutations are strictly scoped by the active `TenantContext`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-TENANTMEMBERSHIPCONTEXT-002` (Verified Tenant Context for Every Operation)](../../03_requirements/use_cases/uc-019-tenant-membership-context/functional-reqs.md#fr-tenantmembershipcontext-002-verified-tenant-context-for-every-operation) |
|
| **Owning FR** | [`FR-TENANTMEMBERSHIPCONTEXT-002` (Verified Tenant Context for Every Operation)](../../03_requirements/use_cases/uc-019-tenant-membership-context/functional-reqs.md#fr-tenantmembershipcontext-002-verified-tenant-context-for-every-operation) |
|
||||||
| **Auth Role / Scope Claims** | Authenticated User with $\ge 1$ Active Tenant Memberships |
|
| **Auth Role / Scope Claims** | Authenticated User with $\ge 1$ Active Tenant Memberships |
|
||||||
| **Iteration** | `iteration-02` |
|
| **Iteration** | `iteration-02` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Tenant Selection Modal & Global Navigation Context Switcher Dropdown.
|
- **Archetype:** Tenant Selection Modal & Global Navigation Context Switcher Dropdown.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (Card selector, firm badge, active radio indicator).
|
||||||
- **Behavior:**
|
- **Behavior:**
|
||||||
1. **Post-Login Interceptor:** When an authenticated user signs in and holds active memberships in multiple agricultural trading firms, the application redirects to `/select-tenant` prior to granting dashboard access.
|
1. **Post-Login Interceptor:** When an authenticated user signs in and holds active memberships in multiple agricultural trading firms, the application redirects to `/select-tenant` prior to granting dashboard access.
|
||||||
2. **Global Header Component:** Users can switch active firm context at any time via the top header dropdown. Switching context invokes `POST /api/v1/session/active-tenant` with the selected `tenant_id`, updates the Zustand `tenantStore`, resets local caches, and reloads data scoped to the new tenant.
|
2. **Global Header Component:** Users can switch active firm context at any time via the top header dropdown. Switching context invokes `POST /api/v1/session/active-tenant` with the selected `tenant_id`, updates the Zustand `tenantStore`, resets local caches, and reloads data scoped to the new tenant.
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-TENANTSECURITYAUDIT-003` (Immutable Transaction Audit Logging)](../../03_requirements/use_cases/uc-017-tenant-security-audit/functional-reqs.md#fr-tenantsecurityaudit-003-immutable-transaction-audit-logging) |
|
| **Owning FR** | [`FR-TENANTSECURITYAUDIT-003` (Immutable Transaction Audit Logging)](../../03_requirements/use_cases/uc-017-tenant-security-audit/functional-reqs.md#fr-tenantsecurityaudit-003-immutable-transaction-audit-logging) |
|
||||||
| **Auth Role / Scope Claims** | `Tenant Administrator` or `Partner / MD` within verified active tenant |
|
| **Auth Role / Scope Claims** | `Tenant Administrator` or `Partner / MD` within verified active tenant |
|
||||||
| **Iteration** | `iteration-02` |
|
| **Iteration** | `iteration-02` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Security & Governance Audit Log Table with JSON Diff Inspector.
|
- **Archetype:** Security & Governance Audit Log Table with JSON Diff Inspector.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (Monospace font for IDs, color-coded action pills: `CREATE` green, `UPDATE` amber, `STATUS_CHANGE` blue, slide-over drawer for field diffs).
|
||||||
- **Behavior:** Authorized executive users (`Partner / MD`) and `Tenant Administrator` view the immutable audit trail of all governed mutations (GRN creation, lot transitions, price revisions, sales confirmations, membership changes) executed within their tenant boundary. No mutation or deletion controls exist on this screen.
|
- **Behavior:** Authorized executive users (`Partner / MD`) and `Tenant Administrator` view the immutable audit trail of all governed mutations (GRN creation, lot transitions, price revisions, sales confirmations, membership changes) executed within their tenant boundary. No mutation or deletion controls exist on this screen.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-EXECUTIVEREPORTING-002` (20-Day Consolidated Trading Trend Reporting)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/functional-reqs.md#fr-executivereporting-002-20-day-consolidated-trading-trend-reporting) |
|
| **Owning FR** | [`FR-EXECUTIVEREPORTING-002` (20-Day Consolidated Trading Trend Reporting)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/functional-reqs.md#fr-executivereporting-002-20-day-consolidated-trading-trend-reporting) |
|
||||||
| **Auth Role / Scope Claims** | `Partner`, `Managing Director`, `Operations Supervisor`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Partner`, `Managing Director`, `Operations Supervisor`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-06` |
|
| **Iteration** | `iteration-06` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Time-Series Trading & Financial Position Reporting Console.
|
- **Archetype:** Time-Series Trading & Financial Position Reporting Console.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Dual-visualization reporting layout adhering to [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`cyan-600` procurement volume, `emerald-600` sales volume, `amber-600` closing stock, `purple-600` financial exposure, `slate-800` data grid).
|
||||||
- **Behavior:** Renders rolling 20-day trading snapshots tabulating and charting volume movements alongside financial exposure:
|
- **Behavior:** Renders rolling 20-day trading snapshots tabulating and charting volume movements alongside financial exposure:
|
||||||
- Daily Purchases (MT)
|
- Daily Purchases (MT)
|
||||||
- Daily Sales (MT)
|
- Daily Sales (MT)
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-WAREHOUSEINVENTORY-001` (Multi-Godown Dual-Unit Stock Ledger)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/functional-reqs.md#fr-warehouseinventory-001-multi-godown-dual-unit-stock-ledger) |
|
| **Owning FR** | [`FR-WAREHOUSEINVENTORY-001` (Multi-Godown Dual-Unit Stock Ledger)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/functional-reqs.md#fr-warehouseinventory-001-multi-godown-dual-unit-stock-ledger) |
|
||||||
| **Auth Role / Scope Claims** | `Yard Supervisor`, `Warehouse Manager`, `Commercial Manager`, `Partner`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Yard Supervisor`, `Warehouse Manager`, `Commercial Manager`, `Partner`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-04` |
|
| **Iteration** | `iteration-04` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Dual-Unit Double-Entry Stock Ledger & Physical Inventory Audit Console.
|
- **Archetype:** Dual-Unit Double-Entry Stock Ledger & Physical Inventory Audit Console.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Data-dense tabular layout adhering to [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`slate-800` data tables, `emerald-600` positive inward, `amber-600` outward dispatches, `rose-600` shortage/adjustment indicators).
|
||||||
- **Behavior:** Warehouse managers and yard supervisors view real-time balances per warehouse (WH-01 Neemuch Main Yard, WH-02 Neemuch North, WH-03 Mandsaur Transit, WH-04 Indore Buffer), commodity, variety, and grade in both Metric Tonnes and physical Bag counts. Supports logging periodic physical tally audits against system book balances and posting supervisor-authorized Stock Adjustment Vouchers with reason codes (*Ghat / Nami*, Spillage, Bag Burst). Enforces non-negative stock invariant ($\ge 0$) and prompts for mandatory Partner electronic sign-off if variance exceeds $\pm 1.0\%$.
|
- **Behavior:** Warehouse managers and yard supervisors view real-time balances per warehouse (WH-01 Neemuch Main Yard, WH-02 Neemuch North, WH-03 Mandsaur Transit, WH-04 Indore Buffer), commodity, variety, and grade in both Metric Tonnes and physical Bag counts. Supports logging periodic physical tally audits against system book balances and posting supervisor-authorized Stock Adjustment Vouchers with reason codes (*Ghat / Nami*, Spillage, Bag Burst). Enforces non-negative stock invariant ($\ge 0$) and prompts for mandatory Partner electronic sign-off if variance exceeds $\pm 1.0\%$.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
| **Owning FR** | [`FR-WAREHOUSEINVENTORY-002` (Godown Capacity & Utilization Tracking)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/functional-reqs.md#fr-warehouseinventory-002-godown-capacity--volume-utilization-tracking), [`FR-WAREHOUSEINVENTORY-003` (Godown-to-Godown Internal Stock Transfer)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/functional-reqs.md#fr-warehouseinventory-003-godown-to-godown-internal-stock-transfer) |
|
| **Owning FR** | [`FR-WAREHOUSEINVENTORY-002` (Godown Capacity & Utilization Tracking)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/functional-reqs.md#fr-warehouseinventory-002-godown-capacity--volume-utilization-tracking), [`FR-WAREHOUSEINVENTORY-003` (Godown-to-Godown Internal Stock Transfer)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/functional-reqs.md#fr-warehouseinventory-003-godown-to-godown-internal-stock-transfer) |
|
||||||
| **Auth Role / Scope Claims** | `Yard Supervisor`, `Logistics Coordinator`, `Warehouse Manager`, `Operations Head`, `Tenant Admin` |
|
| **Auth Role / Scope Claims** | `Yard Supervisor`, `Logistics Coordinator`, `Warehouse Manager`, `Operations Head`, `Tenant Admin` |
|
||||||
| **Iteration** | `iteration-04` |
|
| **Iteration** | `iteration-04` |
|
||||||
| **Last CR** | `CR-002` |
|
|
||||||
| **Status** | Baselined for Construction |
|
| **Status** | Baselined for Construction |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -17,7 +16,7 @@
|
||||||
## 1. Screen Overview & Archetype
|
## 1. Screen Overview & Archetype
|
||||||
|
|
||||||
- **Archetype:** Facility Capacity Monitor & Inter-Godown Transfer Dispatch Board.
|
- **Archetype:** Facility Capacity Monitor & Inter-Godown Transfer Dispatch Board.
|
||||||
- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) (AgriTrade Mercantile palette: Deep Forest Pine `#162A22` primary actions, Warm Stone `#F7F7F4` canvas, `#FFFFFF` cards with `#E8E6DF` precision borders, Normal status `#EAF5ED`/`#2D6A4F`, Watch status `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics).
|
- **Visual Design Reference:** Progress-bar visual meters (`amber-500` for $> 85\%$ warning threshold, `emerald-600` for normal operations) and transit timeline cards.
|
||||||
- **Behavior:** Operations heads and yard managers monitor real-time physical capacity utilization in MT across all warehouses:
|
- **Behavior:** Operations heads and yard managers monitor real-time physical capacity utilization in MT across all warehouses:
|
||||||
$$\text{Utilisation \%} = \frac{\text{Current Closing Stock (MT)}}{\text{Storage Capacity (MT)}} \times 100$$
|
$$\text{Utilisation \%} = \frac{\text{Current Closing Stock (MT)}}{\text{Storage Capacity (MT)}} \times 100$$
|
||||||
Triggers inline warning badges when utilization exceeds 85%. Logistics coordinators schedule inter-godown transfers (e.g. Mandsaur Transit Godown to Neemuch Main Yard), logging origin deduction, in-transit state, destination weighbridge capture, and inward credit, reconciling weight within $\pm 0.2\%$ tolerance.
|
Triggers inline warning badges when utilization exceeds 85%. Logistics coordinators schedule inter-godown transfers (e.g. Mandsaur Transit Godown to Neemuch Main Yard), logging origin deduction, in-transit state, destination weighbridge capture, and inward credit, reconciling weight within $\pm 0.2\%$ tolerance.
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
| **Governed Standard** | UP-AI v1.5 Stage 11 Standard |
|
| **Governed Standard** | UP-AI v1.5 Stage 11 Standard |
|
||||||
| **Document Path** | `04_generated_documentation/06_wireframes/wireframe_index.md` |
|
| **Document Path** | `04_generated_documentation/06_wireframes/wireframe_index.md` |
|
||||||
| **Design System Tokens** | [`DESIGN.md`](DESIGN.md) |
|
| **Design System Tokens** | [`DESIGN.md`](DESIGN.md) |
|
||||||
| **Last Updated** | 2026-10-15 |
|
| **Last Updated** | 2026-10-12 |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -54,5 +54,5 @@
|
||||||
- **Framework:** React / TypeScript (`tech-profile.yaml`)
|
- **Framework:** React / TypeScript (`tech-profile.yaml`)
|
||||||
- **Styling & UI Library:** Tailwind CSS + shadcn-ui components (`tailwind_shadcn`)
|
- **Styling & UI Library:** Tailwind CSS + shadcn-ui components (`tailwind_shadcn`)
|
||||||
- **State Store:** Zustand (`useAuthStore`)
|
- **State Store:** Zustand (`useAuthStore`)
|
||||||
- **Design Tokens:** Follows [`DESIGN.md`](DESIGN.md) (AgriTrade Mercantile: Deep Forest Pine `#162A22`, Warm Stone `#F7F7F4`, Harvest Ochre `#C89332`, Inter & JetBrains Mono, 4px baseline roundedness, and 240px persistent drawer).
|
- **Design Tokens:** Follows [`DESIGN.md`](DESIGN.md) colors (`Slate-900` background, `Emerald-600` primary buttons, `Rose-600` destructive actions) and typography (`Inter`).
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
# Session Transcript: UI Theme Update — Affected Front-End Assets Analysis
|
|
||||||
|
|
||||||
- **Session Start (UTC):** 2026-10-15T10:09:03Z
|
|
||||||
- **User Prompt:** "The UI theme for the project has been updated in DESIGN.md. As per the process, what all front-end assets need to be updated?"
|
|
||||||
- **Governed Process:** AI-Native Unified Process (UP-AI v1.5)
|
|
||||||
- **Active Technology Profile:** `tech-profile.yaml` (React, TypeScript, Tailwind/shadcn, Zustand, Vitest, Playwright)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Turn 1: 2026-10-15T10:09:03Z — User Request & Process Analysis
|
|
||||||
|
|
||||||
### User Request
|
|
||||||
> The UI theme for the project has been updated in DESIGN.md. As per the process, what all front-end assets need to be updated?
|
|
||||||
|
|
||||||
### Actions & Discovery
|
|
||||||
1. Inspected `project_sdlc/06_wireframes/DESIGN.md` and verified recent update (commit `c9883df`), which introduced the "AgriTrade Mercantile" Material Design 3 / Tactile Corporate Minimalism theme (Pine Green `#162A22`, Warm Stone `#F7F7F4`, Ochre `#C89332`, Inter & JetBrains Mono typography, 240px persistent navigation drawer, 4px border radius).
|
|
||||||
2. Inspected `tech-profile.yaml`, identifying frontend configuration: `framework: react`, `ui_library: tailwind_shadcn`, `design_system_tokens: "project_sdlc/06_wireframes/DESIGN.md"`.
|
|
||||||
3. Inspected Stage 11 (`up-wireframe-spec`), Stage 12 (`up-test-model-generate`), Stage 13 (`up-code-generate`), Stage 14, and cross-cutting Change Request governance (`up-change-request-impact`).
|
|
||||||
4. Audited existing SDLC and codebase assets:
|
|
||||||
- `project_sdlc/06_wireframes/` (`wireframe_index.md` and 32 screen specs still referencing deprecated `Slate-900` / `Emerald-600` / `agri-700` palette).
|
|
||||||
- `project_code/frontend/` (`App.tsx`, `index.html`, and views in `src/features/` using legacy colors and horizontal topbar; missing `tailwind.config.js`).
|
|
||||||
- `project_sdlc/05_iteration_planning/` (`iteration_surface_matrix.md` across iterations).
|
|
||||||
- `project_sdlc/07_test_design/` (Manual QA testing guides, usability test cases, 21-sheet QA workbooks).
|
|
||||||
- Governance & traceability registers (`change_request_register.md`, `traceability_graph.md`).
|
|
||||||
|
|
||||||
### Deliverable
|
|
||||||
Compile and present a comprehensive, structured enumeration of all front-end assets requiring updates under the UP-AI v1.5 process, categorized by SDLC stage, architectural tier, and delivery surface.
|
|
||||||
|
|
||||||
### Response Summary
|
|
||||||
Provided a comprehensive, structured breakdown of all front-end assets requiring updates under the UP-AI v1.5 process, organized by SDLC Stage and Architectural Layer:
|
|
||||||
1. **Governance & Traceability (`00_process_control/`, `05_iteration_planning/`)**: CR registration (`CR-xxx` via `up-change-request-impact`), traceability graph reconciliation, and delivery surface matrices (`iteration_surface_matrix.md`).
|
|
||||||
2. **Stage 11 Screen Specifications (`06_wireframes/`)**: `wireframe_index.md` and 32 screen specifications in `screen_specs/`.
|
|
||||||
3. **Stage 13 Frontend Codebase (`project_code/frontend/`)**: Tailwind/PostCSS configuration (`tailwind.config.js`), HTML/font imports (`index.html`), application shell layout (`App.tsx` 240px persistent drawer), reusable UI component library (`src/components/ui/`), and 8 active feature views (`src/features/`).
|
|
||||||
4. **Stage 12 & 14 QA & Verification (`07_test_design/`, `tests/`)**: Vitest component test suites, Playwright E2E locators/visual regression, `MANUAL_TESTING_GUIDE.md`, and 21-sheet Excel QA workbooks.
|
|
||||||
5. **Stage 15 Transition & Packaging (`project_code/docker/`)**: Docker frontend build and Nginx static font caching.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Turn 2: 2026-10-15T10:18:44Z — Execution of Front-End Assets Rebaseline (CR-002)
|
|
||||||
|
|
||||||
### User Request
|
|
||||||
> proceed
|
|
||||||
|
|
||||||
### Actions & Implementation
|
|
||||||
1. **Change Control & Impact Analysis (`00_process_control/`)**:
|
|
||||||
- Registered `CR-002: Rebaseline Front-End Assets to AgriTrade Mercantile Design System` in `change_request_register.md`.
|
|
||||||
- Completed full blast radius impact analysis walking the traceability graph across wireframe specifications, design token configs, application shell layout, reusable UI components, and views.
|
|
||||||
- Closed `CR-002` after complete verification.
|
|
||||||
2. **Stage 11 Wireframes & Screen Specifications (`06_wireframes/`)**:
|
|
||||||
- Updated `wireframe_index.md` design tokens note and last updated date.
|
|
||||||
- Rebaselined all 32 screen specifications in `screen_specs/`: replaced deprecated color tokens (`Slate-900`, `Emerald-600`, `agri-700`, `amber-500`) with AgriTrade Mercantile tokens (Deep Forest Pine `#162A22`, Warm Stone `#F7F7F4`, Milk-white cards `#FFFFFF` with `#E8E6DF` borders, Cleared/Normal status `#EAF5ED`/`#2D6A4F`, Watch/Pending `#FDF6E7`/`#926A1D`, Accent Ochre `#C89332`, and JetBrains Mono tabular numerics) and tagged with `last_cr: CR-002`.
|
|
||||||
3. **Stage 13 Code Implementation (`project_code/frontend/`)**:
|
|
||||||
- Created `tailwind.config.js` mapping all AgriTrade Mercantile design tokens (surfaces, containers, sidebar, typography, roundedness, spacing, tactile shadow).
|
|
||||||
- Created `postcss.config.js`.
|
|
||||||
- Created `src/index.css` with `@tailwind` directives, CSS custom properties, and button/badge utility classes.
|
|
||||||
- Updated `index.html` with Inter and JetBrains Mono Google Fonts imports and `bg-surface text-on-surface` body classes.
|
|
||||||
- Updated `src/main.tsx` to import `index.css`.
|
|
||||||
- Created reusable component library in `src/components/ui/`: `Button.tsx`, `StatusPill.tsx`, `Card.tsx`, and `Input.tsx`.
|
|
||||||
- Rebuilt application shell in `src/App.tsx` implementing the fixed 240px persistent dark pine drawer (`#162A22` / `#2A4237`) and asymmetric operational canvas (`#F9F9F6`).
|
|
||||||
- Realigned active feature views to the new components and tactile design tokens: `LoginView.tsx`, `SessionView.tsx`, `AccessDeniedView.tsx`, `CallbackView.tsx`, `HeaderTenantSwitcher.tsx`, `PlatformTenantsView.tsx`, `TenantMembersView.tsx`, `AuditLogView.tsx`.
|
|
||||||
4. **Delivery Surface Matrices (`05_iteration_planning/`)**:
|
|
||||||
- Reconciled `Last CR: CR-002` in `iteration-01/iteration_surface_matrix.md` and `iteration-02/iteration_surface_matrix.md`.
|
|
||||||
5. **Quality Gate Verification**:
|
|
||||||
- Ran `python3 scripts/verify_traceability_gates.py --all`: Gates 5.1, 9.1, and 14.1 passed with 0 Critical, 0 Major, and 0 Minor issues.
|
|
||||||
- Ran automated test runner `scripts/run_tests.sh --scope iteration-01`: 197 tests passed with 98.4% statement coverage (exceeding ≥95.0% threshold).
|
|
||||||
Loading…
Reference in New Issue