feat(leads): Phase 8 — Save action, lead list page, and nav update
Save action (CreateLeadPage): - Validate required fields: first/last name, 10-digit phone, address, city, lead source - On failure: Sonner error toast + auto-opens first incomplete section - On success: Sonner success toast with name + address, redirects to /emp/fa/leads - Desktop save bar with progress % indicator and validation error message - Back button navigates to /emp/fa/leads instead of browser history Leads List page (LeadsListPage.jsx): - Route: /emp/fa/leads (FIELD_AGENT, ADMIN, OWNER) - Lead cards: name, urgency + status badges, address, phone, lead source, time ago, creator - Search bar: filters by name, address, city, source, status - Empty state with CTA when no leads saved yet - Animated card entrance with staggered spring transitions mockStore: - Add leads[] state and addLead() action — prepends new lead with id, createdAt, status: New Navigation: - Sidebar "New Lead" replaced with "Leads" (ClipboardList icon) for all roles - New Lead button lives on the list page header Author: Satyam Rastogi
This commit is contained in:
@@ -2735,6 +2735,7 @@ export const MockStoreProvider = ({ children }) => {
|
||||
const [projects, setProjects] = useState(MOCK_PROJECTS);
|
||||
const [orders, setOrders] = useState(MOCK_ORDERS);
|
||||
const [vendorInvoices, setVendorInvoices] = useState(MOCK_VENDOR_INVOICES);
|
||||
const [leads, setLeads] = useState([]);
|
||||
|
||||
// Initialize properties once
|
||||
useEffect(() => {
|
||||
@@ -2823,6 +2824,18 @@ export const MockStoreProvider = ({ children }) => {
|
||||
orders,
|
||||
vendorInvoices,
|
||||
|
||||
leads,
|
||||
addLead: (lead) => {
|
||||
const newLead = {
|
||||
...lead,
|
||||
id: `lead_${Date.now()}`,
|
||||
createdAt: new Date().toISOString(),
|
||||
status: 'New',
|
||||
};
|
||||
setLeads(prev => [newLead, ...prev]);
|
||||
return newLead;
|
||||
},
|
||||
|
||||
updatePropertyStatus,
|
||||
addMeeting,
|
||||
updateUser: (updatedUser) => {
|
||||
|
||||
Reference in New Issue
Block a user