From 1340f444855949e74831cdb14bf34d8949c120f1 Mon Sep 17 00:00:00 2001 From: Laxman Date: Thu, 14 May 2026 14:39:31 +0530 Subject: [PATCH] few more bugs fixed and dealer ide ui alignmen and visibibity chabges done F& F made manuall trigger --- src/App.tsx | 176 +++++++++++- src/components/dealer/QuestionnaireForm.tsx | 6 +- src/components/layout/Header.tsx | 6 +- src/components/layout/Sidebar.tsx | 2 +- .../dashboard/pages/DealerDashboard.tsx | 20 +- .../pages/ProspectiveDashboardPage.tsx | 102 ++++--- .../pages/ProspectiveApplicationDetails.tsx | 101 ++++--- .../relocation/pages/DealerRelocationPage.tsx | 8 +- .../pages/DealerResignationDetailsPage.tsx | 251 +----------------- .../pages/DealerResignationPage.tsx | 45 +--- .../resignation/pages/ResignationDetails.tsx | 22 +- .../termination/pages/TerminationDetails.tsx | 2 +- src/pages/public/PublicQuestionnairePage.tsx | 60 +++-- 13 files changed, 373 insertions(+), 428 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 0385b18..26ab270 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -57,12 +57,20 @@ import { API } from '@/api/API'; import { SocketProvider } from '@/context/SocketContext'; // Layout Component -const AppLayout = ({ onLogout, title }: { onLogout: () => void, title: string }) => { +const AppLayout = ({ + onLogout, + title, + subtitle, +}: { + onLogout: () => void; + title: string; + subtitle: string; +}) => { return (
-
window.location.reload()} /> +
window.location.reload()} />
@@ -139,8 +147,18 @@ export default function App() { // Helper to determine page title based on path const getPageTitle = (pathname: string) => { if (pathname.startsWith('/applications/') && pathname.length > 14) return 'Application Details'; - if (pathname.includes('/resignation/') && pathname.length > 13) return 'Resignation Details'; - // ... Add more dynamic title logic as needed + if (pathname.startsWith('/resignation/') && !pathname.startsWith('/dealer-resignation')) return 'Resignation Details'; + if (pathname.startsWith('/dealer-resignation/')) return 'Resignation Request Details'; + if (pathname.startsWith('/termination/')) return 'Termination Details'; + if (pathname.startsWith('/fnf/')) return 'F&F Request Details'; + if (pathname.startsWith('/constitutional-change/')) return 'Constitutional Change Details'; + if (pathname.startsWith('/relocation-requests/')) return 'Relocation Request Details'; + if (pathname.startsWith('/finance-onboarding/')) return 'Payment Details'; + if (pathname.startsWith('/finance-audit/')) return 'Finance Audit'; + if (pathname.startsWith('/finance-fnf/')) return 'F&F Settlement Details'; + if (pathname.startsWith('/fdd-details/')) return 'FDD Audit Workspace'; + if (pathname.startsWith('/questionnaire-builder/')) return 'Questionnaire Builder'; + if (pathname.startsWith('/worknotes/')) return 'Work Notes'; const titles: Record = { '/dashboard': 'Dashboard', '/applications': 'Dealership Requests', @@ -166,11 +184,155 @@ export default function App() { '/approval-policies': 'Approval Policies', '/fdd-dashboard': 'FDD Dashboard', '/fdd-details': 'Audit Workspace', + '/questions': 'Questionnaires', + '/questionnaires': 'Questionnaire Templates', + '/interview-configs': 'Interview Configuration', + '/system-logs': 'System Logs', + '/sla-configurations': 'SLA Matrix', '/notifications': 'Notifications', }; return titles[pathname] || 'Dashboard'; }; + /** Short context line under the main header title — varies by route (and sometimes role). */ + const getPageSubtitle = (pathname: string, role: string) => { + const rl = (role || '').toLowerCase(); + const isDealerRole = rl === 'dealer' || rl.includes('dealer'); + const isFinanceRole = rl.includes('finance'); + + if (pathname.startsWith('/worknotes/')) { + return 'Collaborative notes and clarifications linked to this onboarding or offboarding record.'; + } + if (pathname.startsWith('/applications/') && pathname !== '/applications') { + return 'Review stages, documents, interviews, and decisions for this single dealership onboarding application.'; + } + if (pathname === '/applications') { + return 'Search, filter, and open dealership applications your role can work on.'; + } + if (pathname === '/all-applications') { + return 'Cross-team view of every dealership application in the pipeline.'; + } + if (pathname === '/opportunity-requests') { + return 'Applications tied to an opportunity location for DD prioritisation.'; + } + if (pathname === '/non-opportunities') { + return 'Applications without a mapped opportunity; track for future reference or follow-up.'; + } + if (pathname === '/dashboard') { + if (isDealerRole) { + return 'Your home for outlet actions: constitutional change (how your business is legally registered), relocation, and resignation requests.'; + } + if (isFinanceRole) { + return 'Payment verification, finance audits, and F&F settlement work for dealership accounts.'; + } + return 'Operational snapshot for dealership onboarding: workloads, alerts, and shortcuts for your role.'; + } + if (pathname.startsWith('/dealer-resignation/')) { + return 'Read-only summary of the resignation you submitted for this outlet.'; + } + if (pathname === '/dealer-resignation') { + return 'Start a new outlet resignation or open a request you already submitted.'; + } + if (pathname === '/dealer-constitutional') { + return 'Constitutional change updates your outlet’s registered legal structure (for example sole proprietorship to private limited). Submit one request per outlet; Royal Enfield teams review documents and approve before records change.'; + } + if (pathname === '/dealer-relocation') { + return 'Request a move of your dealership to a new address or territory, and track requests in progress.'; + } + if (pathname.startsWith('/constitutional-change/')) { + return 'Review evidence, comments, and workflow for this constitutional change case.'; + } + if (pathname === '/constitutional-change') { + return 'Process dealer requests to change registered legal constitution, supporting documents, and approvals.'; + } + if (pathname.startsWith('/relocation-requests/')) { + return 'Assess feasibility, documents, and approvals for this relocation request.'; + } + if (pathname === '/relocation-requests') { + return 'Manage dealer relocation proposals: new sites, handovers, and compliance checks.'; + } + if (pathname.startsWith('/resignation/') && !pathname.startsWith('/dealer-resignation')) { + return 'HR workflow: clearances, handovers, and settlement steps for this resignation.'; + } + if (pathname === '/resignation') { + return 'Queue of dealership resignation cases across your authorised outlets.'; + } + if (pathname.startsWith('/termination/')) { + return 'Contractual exit details, evidence, and approvals for this termination case.'; + } + if (pathname === '/termination') { + return 'Monitor dealership terminations, disputes, and mandated approvals.'; + } + if (pathname.startsWith('/fnf/')) { + return 'Line items, deductions, and payout status for this full & final settlement.'; + } + if (pathname === '/fnf') { + return 'Track F&F batches from clearance through finance payout.'; + } + if (pathname.startsWith('/finance-onboarding/')) { + return 'Payment schedule, proofs, and audit notes for this onboarding application.'; + } + if (pathname === '/finance-onboarding') { + return 'Validate security deposits, first fills, and related onboarding payments.'; + } + if (pathname.startsWith('/finance-audit/')) { + return 'Finance audit trail and checklist for this application.'; + } + if (pathname.startsWith('/finance-fnf/')) { + return 'Settlement calculations and release steps for this F&F record.'; + } + if (pathname === '/finance-fnf') { + return 'Finance queue for F&F approvals and disbursements.'; + } + if (pathname.startsWith('/fdd-details/')) { + return 'Field Development Director audit workspace for this application.'; + } + if (pathname === '/fdd-dashboard') { + return 'FDD workload: audits due, flags raised, and follow-up actions.'; + } + if (pathname.startsWith('/questionnaire-builder/') || pathname === '/questionnaire-builder') { + return 'Author and publish questionnaire versions used in dealership assessments.'; + } + if (pathname === '/questionnaires' || pathname === '/questions') { + return 'List of published questionnaire templates and versions.'; + } + if (pathname === '/master') { + return 'Hierarchy, geography, templates, and reference data shared across onboarding.'; + } + if (pathname === '/users') { + return 'Create and maintain internal users, roles, and access for this portal.'; + } + if (pathname === '/approval-policies') { + return 'Configure who must approve each onboarding stage or document type.'; + } + if (pathname === '/sla-configurations') { + return 'Define turnaround targets and escalations for onboarding milestones.'; + } + if (pathname === '/interview-configs') { + return 'Set up interview templates, panels, and scoring used during selection.'; + } + if (pathname === '/system-logs') { + return 'Immutable record of configuration and administrative actions for compliance.'; + } + if (pathname === '/notifications') { + return 'System and workflow alerts for your account.'; + } + if (pathname === '/tasks') { + return 'Tasks assigned to you (placeholder module).'; + } + if (pathname === '/reports') { + return 'Analytics and exports for onboarding performance (placeholder module).'; + } + if (pathname === '/settings') { + return 'Profile, notifications, and security preferences for your account.'; + } + + const title = getPageTitle(pathname); + return title === 'Dashboard' + ? 'Operational snapshot for dealership onboarding: workloads, alerts, and shortcuts for your role.' + : `You are viewing: ${title}.`; + }; + if (loading) { return (
@@ -215,7 +377,11 @@ export default function App() { {/* Internal & Dealer Routes - EXCLUDES Prospective Dealers */} - + }> } /> diff --git a/src/components/dealer/QuestionnaireForm.tsx b/src/components/dealer/QuestionnaireForm.tsx index 3a5b85a..fed022b 100644 --- a/src/components/dealer/QuestionnaireForm.tsx +++ b/src/components/dealer/QuestionnaireForm.tsx @@ -198,8 +198,8 @@ const QuestionnaireForm: React.FC = ({ file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold - file:bg-amber-50 file:text-amber-700 - hover:file:bg-amber-100" + file:bg-red-50 file:text-re-red + hover:file:bg-red-100" onChange={(e) => handleFileChange(q.id, e)} disabled={readOnly} /> @@ -240,7 +240,7 @@ const QuestionnaireForm: React.FC = ({ checked={responses[q.id] === val} onChange={() => handleInputChange(q.id, val)} disabled={readOnly} - className="text-amber-600 focus:ring-amber-500 w-4 h-4" + className="text-re-red focus:ring-re-red w-4 h-4" /> {val} diff --git a/src/components/layout/Header.tsx b/src/components/layout/Header.tsx index b3975dc..2a2e02e 100644 --- a/src/components/layout/Header.tsx +++ b/src/components/layout/Header.tsx @@ -18,10 +18,12 @@ import { formatDistanceToNow } from 'date-fns'; interface HeaderProps { title: string; + /** Context line under the title; changes per route in App layout. */ + subtitle: string; onRefresh?: () => void; } -export function Header({ title, onRefresh }: HeaderProps) { +export function Header({ title, subtitle, onRefresh }: HeaderProps) { const { user: currentUser } = useSelector((state: RootState) => state.auth); const { socket } = useSocket(); const [notifications, setNotifications] = useState([]); @@ -101,7 +103,7 @@ export function Header({ title, onRefresh }: HeaderProps) {

{title}

-

Manage and track dealership applications

+

{subtitle}

diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx index 65ca18a..5e9280a 100644 --- a/src/components/layout/Sidebar.tsx +++ b/src/components/layout/Sidebar.tsx @@ -181,7 +181,7 @@ export function Sidebar({ onLogout }: SidebarProps) {
Royal Enfield - Dealer Onboarding + Dealer Network
); @@ -58,7 +58,7 @@ export function DealerDashboard({ currentUser, onNavigate }: DealerDashboardProp title: 'Relocation Requests', value: statsSummary.relocation, icon: MapPin, - color: 'bg-amber-500', + color: 'bg-re-red', change: 'Active Requests', onClick: () => onNavigate('dealer-relocation') }, @@ -96,8 +96,8 @@ export function DealerDashboard({ currentUser, onNavigate }: DealerDashboardProp title: 'Request Relocation', description: 'Move dealership to new location', icon: MapPin, - color: 'bg-amber-50 hover:bg-amber-100 border-amber-200', - textColor: 'text-amber-700', + color: 'bg-red-50 hover:bg-red-100 border-red-200', + textColor: 'text-re-red', onClick: () => onNavigate('dealer-relocation') }, ]; @@ -105,14 +105,14 @@ export function DealerDashboard({ currentUser, onNavigate }: DealerDashboardProp return (
{/* Welcome Section */} -
+

Welcome back, {profile.name || currentUser?.name}!

-

+

Dealer Code: {profile.dealerCode} • {profile.businessName}

-

+

{primaryOutlet.name} • {primaryOutlet.location}

@@ -225,21 +225,21 @@ export function DealerDashboard({ currentUser, onNavigate }: DealerDashboardProp - + Important Reminders
- +

GST Filing Due

Due by Jan 15, 2026

- +

Inventory Audit Scheduled

Jan 20, 2026

diff --git a/src/features/dashboard/pages/ProspectiveDashboardPage.tsx b/src/features/dashboard/pages/ProspectiveDashboardPage.tsx index d660900..975fd33 100644 --- a/src/features/dashboard/pages/ProspectiveDashboardPage.tsx +++ b/src/features/dashboard/pages/ProspectiveDashboardPage.tsx @@ -8,18 +8,18 @@ import { RefreshCw, } from 'lucide-react'; import { useDispatch, useSelector } from 'react-redux'; -import { useNavigate, Routes, Route, useParams } from 'react-router-dom'; +import { useNavigate, Routes, Route, useParams, useLocation } from 'react-router-dom'; import { RootState } from '@/store'; import { logout } from '@/store/slices/authSlice'; import { toast } from 'sonner'; import { API } from '@/api/API'; import { formatDateTime } from '@/components/ui/utils'; -import { Badge } from '@/components/ui/badge'; import { ProspectiveApplicationDetails } from '@/features/onboarding/pages/ProspectiveApplicationDetails'; export function ProspectiveDashboardPage() { const dispatch = useDispatch(); const navigate = useNavigate(); + const location = useLocation(); const { user } = useSelector((state: RootState) => state.auth); const [collapsed, setCollapsed] = useState(false); const [activeTab, setActiveTab] = useState('applicant'); @@ -35,22 +35,46 @@ export function ProspectiveDashboardPage() { {/* Sidebar */}
-
- {!collapsed && ( -
-
- -
- Applicant Portal + {!collapsed ? ( +
+
+
- )} - -
+
+ Royal Enfield +
+

+ Applicant Portal +

+
+ ) : ( +
+
+ Royal Enfield +
+ +
+ )}