Commit Graph

108 Commits

Author SHA1 Message Date
Satyam-Rastogi 84b1e73fa7 fix(storm-intel): modal z-index, zone click-to-zoom, drawer close on fly-to, left padding
- ZoneAssignmentModal: portal to document.body with z-9999 so it renders above Leaflet map stacking context
- ZoneLayer: clicking any zone polygon or centroid circle fits map bounds to that zone
- handleFlyTo: closes detail drawer after zooming so the map is unobstructed
- StormDetailDrawer: pl-5 on header, body, and footer for consistent left padding
2026-05-18 18:29:29 +05:30
Satyam-Rastogi 12bd2fe0de feat(storm-intel): Phase 4+5 — Tomorrow.io forecast overlay and canvasser zone assignment
- Tomorrow.io 7-day forecast strip with weather icons, storm score bar, and per-day risk color coding
- High-risk alert banner in forecast strip when any day scores >=65
- api/storm-forecast.js: Vercel proxy that reads TOMORROW_API_KEY server-side; graceful empty response when key unset
- useStormForecast hook: USE_MOCK=false with realistic MOCK_FORECAST fallback
- ZoneDrawingLayer: click-to-place polygon vertices using react-leaflet useMapEvents; disables double-click zoom while active; shows live vertex dots + dashed preview polygon
- ZoneLayer: renders stormZones as colored semi-transparent polygons with agent initials at centroid
- ZoneAssignmentModal: name + canvasser picker + color selector + optional storm link; portaled modal
- StormIntelPage: Draw Zone button (Admin/Owner only); drawing state/cancel flow; stormZones displayed on map; zone summary strip in sidebar; StormDetailDrawer has working "Draw Canvasser Zone" action
- FieldStormZonePage: canvasser mobile view at /field/storm-zones showing assigned zones with map, linked storm details, conversion window badge, and peak window alert
- Layout: Storm Zones entry in FIELD_AGENT nav
- App: /field/storm-zones route (FIELD_AGENT + Admin + Owner)
2026-05-18 18:06:17 +05:30
Satyam-Rastogi df50f27ba6 feat(storm-intel): Phase 3 — Revenue Attribution dashboard
Adds an Attribution tab to Storm Intel showing full ROI breakdown of storm-sourced canvassing.

- MOCK_STORM_ATTRIBUTION_LEADS: 35 realistic leads across 7 storms, with addresses, statuses
  (New / Contacted / Appointed / Closed) and contractValues for closed deals — $218,900 total revenue
- useStormAttribution hook: merges historical mock leads with any session-created storm leads,
  aggregates per-storm stats (leads, closed, conversion rate, revenue, pipeline estimate, avg deal size)
- Attribution tab in StormIntelPage:
  - 6 summary stat cards: Total Leads, Closed, Conversion Rate, Revenue, Pipeline, Avg Deal
  - Grouped bar chart (Recharts) — leads generated vs closed per storm, bars colored by severity
  - Per-storm revenue cards ranked by revenue: severity badge, stats row, animated revenue
    progress bar relative to top performer
  - "Top Performing Zone" insight card at bottom
- Tab switcher (Map / Attribution) added to header; filter bar only shows on Map tab
2026-05-18 17:16:34 +05:30
Satyam-Rastogi 4cface49da feat(storm-intel): Phase 2 — storm-sourced lead generation flow
When a canvasser taps "Create Lead from Zone" in the Storm Intel detail drawer,
router state carries the storm context into CreateLeadPage:

- CreateLeadPage reads stormSource from location.state; initialises the form with
  city=Plano, state=TX, leadSource=Door Knock, urgency=high for significant/severe
  storms, and a pre-filled notes field with zone name, hail size, and date
- Amber storm banner renders below the page header showing zone name, hail size,
  and a note that urgency was auto-set; dismissible with X
- stormSource is saved on the lead object via the existing addLead spread
- LeadsListPage LeadCard shows an amber "Storm Zone" badge when lead.stormSource exists
- KanbanCard footer shows a compact amber "Storm" label for storm-sourced leads
2026-05-18 17:06:04 +05:30
Satyam-Rastogi 2e797c89f6 feat(storm-intel): Storm Intelligence Hub — Phase 1
Adds a new Storm Intel section to the sidebar and routes for ADMIN and OWNER roles.

- StormIntelPage: full-height layout with Leaflet map + storm polygon overlays,
  severity-coded color system, horizontal filter bar (date range / severity / sort),
  and a scrollable storm event list
- Storm detail drawer slides in from right with hail size, est. homes, days ago,
  conversion window indicator (Hot Zone / Warm / Cold / Too Fresh), intel text,
  and quick-action buttons (Create Lead, Open in Dispatch, Assign Canvassers stub)
- Clicking a storm card or map polygon zooms the map to that polygon and opens the drawer
- useStormEvents hook with USE_MOCK flag, date-range cutoff filter, type/severity filter,
  sort by date or severity, and conversionWindow() helper
- api/storm-events.js: NWS api.weather.gov proxy (free, no auth needed), parses
  GeoJSON polygons and hail size from alert descriptions
- MOCK_STORM_EVENTS: 7 realistic Plano TX storm events with accurate polygon coords
- Sidebar: CloudLightning "Storm Intel" entry added for OWNER and ADMIN nav
2026-05-18 16:49:37 +05:30
Satyam-Rastogi 4c1c454681 feat(hail-recon): enable live API — USE_MOCK off, KV dynamic import for graceful degradation 2026-05-18 16:13:29 +05:30
Satyam-Rastogi 9e2173fd43 feat(hail-recon): Hail Recon integration — storm intel panel, hail history, auto storm mode, address monitoring 2026-05-18 15:50:59 +05:30
Satyam-Rastogi 912967fa3a bug-fix/filter dropdowns in dark mode 2026-05-15 18:59:12 +05:30
Satyam-Rastogi d2774b4a1e adds filter in org commission distribution panel 2026-05-15 18:50:22 +05:30
Satyam-Rastogi 932e1bdbaa redesigned createItemModal with responsive and light /dark mode 2026-05-15 15:19:51 +05:30
Satyam-Rastogi a9d3d1ce48 apply commission setting model light mode 2026-05-15 15:06:16 +05:30
Satyam-Rastogi eb34ec4cb3 responsive new lead forms 2026-05-15 14:30:37 +05:30
Satyam-Rastogi b1fdda407d add leaderboard for canvassar 2026-05-15 12:05:05 +05:30
Satyam-Rastogi 00e9c2af00 adds on /off commission for team members in jobs,when comm is on then owner can edit comm 2026-05-14 19:08:31 +05:30
Satyam-Rastogi ef9fa1a401 org team managment removed promotion demotion infor section from org Settings page 2026-05-14 18:21:13 +05:30
Satyam-Rastogi d01e699250 access control by role plus by person in orgsettings 2026-05-14 18:13:42 +05:30
Satyam-Rastogi 69d81c78d0 org level commission distribution for each member 2026-05-14 13:24:16 +05:30
Satyam-Rastogi 5aff14323c door knock and referral attribution 2026-05-14 12:15:46 +05:30
Satyam-Rastogi 8157608ff0 create Teams tab in projectdetails page and display team managment section, removed from projects lists page 2026-05-13 20:24:33 +05:30
Satyam-Rastogi 138ec168b2 change org default commission from 10 to 0 2026-05-13 20:11:30 +05:30
Satyam-Rastogi b051b24fa2 Team Members section added in Projects List page 2026-05-13 19:59:37 +05:30
Satyam-Rastogi b6a7792bf7 org team management section in org Settings module 2026-05-13 18:55:09 +05:30
Satyam-Rastogi 72d541cab2 allow admin to access orgSetting page 2026-05-13 17:47:48 +05:30
Satyam-Rastogi 9bc8a42354 commission overrides in org Settings page 2026-05-13 12:51:36 +05:30
Satyam-Rastogi 7598f8982a adds access modifiers for each role 2026-05-12 21:08:19 +05:30
Satyam-Rastogi e85ecd2571 Org settings module and user roles 2026-05-12 20:36:44 +05:30
Satyam-Rastogi 17c3dc7307 team management feature in Owners Box 2026-05-12 19:29:52 +05:30
Satyam-Rastogi 91392bebcb add name for each entry of budget & cost table 2026-05-12 17:37:11 +05:30
Satyam-Rastogi 3a47e1f88f remove Payments tab and adds sections into budges- costs 2026-05-12 16:58:33 +05:30
Satyam-Rastogi c82cadd547 configurable commission setting 2026-05-12 15:54:01 +05:30
Satyam-Rastogi d32b3ced21 add commission section 2026-05-11 19:53:32 +05:30
Satyam-Rastogi e7b0fae1b3 Gross, Net Profit calculate 2026-05-11 18:56:04 +05:30
Satyam-Rastogi 28f4ae57be addnew payments table 2026-05-11 18:02:29 +05:30
Satyam-Rastogi ebe7a585c0 budgest table add name and remove commited column 2026-05-11 17:00:24 +05:30
Satyam-Rastogi e96dffb3ec fix(ui): light mode color corrections for LeadProjectPage and OwnerProjectDetail
- Replace hardcoded dark-only NEO_PANEL_CLASS bg with dark: prefixed variants so SpotlightCard's bg-white shows through in light mode
- Add light mode fallbacks to all NEON color constants (sky/amber/orange/green/red solid colors replace neon glows)
- Fix progress bar and stepper tracks from bg-black/80 to bg-zinc-200 dark:bg-black/80
- Update stepper node colors to use theme-aware border/text/bg classes
- Fix all section header text-white → text-zinc-900 dark:text-white throughout NeoCard content
- Replace bg-black/30, bg-white/[0.03], border-white/5, divide-white/5 inner elements with light mode equivalents
- Fix table headers (bg-[#18181b]/80 → bg-zinc-100 dark:), row hover states, and body text colors
- Fix action buttons, doc rows, timeline items, and activity feed for proper light mode rendering
2026-04-13 14:01:07 +05:30
Satyam-Rastogi c584d918ac fix(kanban): responsive layout, drag-drop offset, and project view enhancements
Kanban pipeline board:
- Fix h-full flex-col layout so board fills viewport height on all screen sizes
- KanbanColumn drop zone: flex-1 min-h-0 so it expands to fill full column height
- KanbanCard: extract KanbanCardDisplay as named export for DragOverlay rendering above overflow containers
- KanbanPage: lift DndContext to page root; add "Add Stage" shortcut to page header
- PageTransition: remove slide-in-from-bottom-4 transform — the CSS transform ancestor was creating a containing block for position:fixed DragOverlay, causing drag ghost to render at a viewport offset
- Migrate fireCampaignToast to toast.custom() Sonner v2 API with explicit card styling

Project & lead views:
- LeadProjectPage: enrich project detail with richer info sections aligned with project stage
- OwnerProjectDetail: expand construction project detail with additional data panels
- OwnerProjectList: project list view improvements
- mockStore: extend lead/project data to support richer project detail rendering
2026-04-08 23:40:45 +05:30
Satyam-Rastogi b1ece35ac8 feat(kanban): Project Pipeline board with drag-and-drop, lead drawer, and full project view
- 44 mock leads across 7 stage columns + 2 bucket columns (Stuck, Follow-up) with seeded activity logs
- dnd-kit drag-and-drop: cross-column card movement, bucket logic, DragOverlay preview
- Campaign toast on stage drop: 20s countdown, Edit button opens message editor, auto-sends if ignored
- KanbanColumn: droppable zones, stage progress bar (position/total), column color accents, Add/Rename/Delete (Admin+Owner)
- KanbanCard: initials avatar, job type pill, insurance badge, assigned agent, days-in-stage counter, left color accent bar
- ColumnManagerModal: add/rename/delete stages with name, color picker, campaign message; delete blocked if leads exist
- LeadInfoDrawer: right slide-in with progress bar + stage steps, Details and Activity tabs, More Details CTA
- ActivityTimeline: color-coded entries (created/forward/regression/bucket), stage arrows, notes, agent + date
- LeadProjectPage: full project view at /*/leads/:leadId — progress bar, stage mover dropdown, info panels, full activity log, stats
- Routes: /*/kanban + /*/leads/:leadId for Owner, Admin, Field Agent
- Pipeline nav item added for all three roles
2026-04-08 19:56:42 +05:30
Satyam-Rastogi c927f4c44d feat(estimates): template access control — owner can grant edit rights by role or individual
- Add TemplateAccessModal: role-level toggles (All Admins / All Field Agents) + per-person overrides
- Three-state access logic: role grant, individual direct grant, individual exclusion override
- Excluded people (role ON but toggled off) pinned to top with amber 'Excluded' chip
- Direct grants (role OFF but toggled on) show green 'Direct' chip
- canEditTemplates replaces isOwner for all template CRUD guards in EstimatesPage
- Owner retains exclusive access to Manage Access button
- State persisted in mockStore: templateAccessRoles, templateAccessUsers, templateAccessExcluded
2026-04-06 18:33:48 +05:30
Satyam-Rastogi fe9ddda941 feat(estimates): Estimates hub with templates, detail drawer, status tracker, sort, and share
- Add EstimatesPage with Estimates + Templates tabs, KPI strip, search, and filter chips
- Estimate detail drawer with pipeline status tracker (Draft→Sent→Waiting Approval→Approved) and edge statuses (Follow Up Required, Revision Required, Rejected, Expired); clickable nodes update estimate status live
- Share bar: WhatsApp, iMessage, Email, PDF download (jsPDF + autotable, light-mode A4)
- ALL_STATUS_CONFIG as shared status registry across cards, badge, filters, and tracker
- Sort controls: Newest First / Oldest First / By Status
- Date range filter with From/To date inputs and clear button
- Fix unit price discrepancy: Unit Price = clientPrice/qty so Qty × Unit Price = Total
- Fix chatbot overlap: pr-20 on drawer footer keeps grand total visible
- Fix card vs drawer total mismatch: computeGrandTotal extracted to estimateExport.js, used as single source of truth in cards, drawer, PDF, and WhatsApp message
- TemplateEditorModal: Owner CRUD for master templates, duplicate with Save as Copy / Replace Original toggle
2026-04-01 16:45:16 +05:30
Satyam-Rastogi 8f9cb9dd48 feat(estimates): add EstimatesPage hub with templates tab, estimate detail drawer, and template editor
- EstimatesPage: tabbed hub with Estimates and Templates tabs, KPI strip, search + filter
- EstimateDetailModal: right-side drawer showing scope of work, computed line items, and financial summary from template + roof area
- TemplateEditorModal: create/edit/duplicate templates with segmented mode toggle
- Owner-only template management (create, edit, duplicate, delete); Admin/FA read-only view
- Duplicate mode: toggle between 'Save as new copy' (default, editable name) and 'Replace original'
- MASTER_TEMPLATES and MOCK_ESTIMATES moved into mockStore with full CRUD helpers
- TemplateSelectionModal now reads from mockStore instead of local stub
- Sidebar nav updated to point to /estimates hub for all roles
- Routes added: /emp/fa/estimates, /admin/estimates, /owner/estimates
2026-04-01 16:13:36 +05:30
Satyam 9be8ec911f fix(dispatch): fix Leaflet map blank/partial render on mobile and tablet
- DispatchMapPanel: replace h-full/height:100% with explicit inline px height
  on both wrapper div and MapContainer — CollapsePanel uses height:auto which
  makes percentage heights resolve to 0 giving Leaflet a zero-size canvas
- DispatchMapPanel: accept mapHeight prop from parent for responsive sizing
- LynkDispatchPage: compute responsive mapHeight state (300px mobile →
  380px sm → 460px md → 520px lg tablet) updated on window resize; passed
  as prop to DispatchMapPanel on all non-desktop renders
- LynkDispatchPage: add missing reps={effectiveReps} prop on mobile map render
  so live rep status cycling is reflected on all breakpoints
- LynkDispatchPage: add missing onQuickAssign={handleAssign} on desktop lead
  queue render so Quick Assign button works on desktop
- LynkDispatchPage: add whitespace-nowrap to efficiency badge to prevent
  '89% AI-Dispatched' wrapping to two lines in header
- LynkDispatchPage: dispatch synthetic resize event 260ms after map panel
  expands on mobile/tablet so Leaflet invalidateSize fires post-animation
- DispatchMapPanel: add second invalidateSize call at 320ms (belt-and-suspenders
  alongside 50ms) to cover 220ms CollapsePanel animation on slower devices
- DispatchLeadQueue: enrich DROP_POOL leads with phone, email, source
  sub-details and notes so Lead Quick View shows complete data on drop-in leads
2026-03-26 14:31:36 +05:30
Satyam b804f7cff1 feat(dispatch): additional features — quick assign, lead quick view, rep cycling, AI efficiency score, AI Says block
- Quick Assign: accent Zap pill on unassigned lead cards; dispatches top AI rec in one tap; 2.2s confirmation state
- LeadQuickViewModal: right-drawer with client contact (copy buttons), property, source sub-details, editable notes with double-gate confirmation
- Rep Status Live Cycling: repStatuses state map overrides DISPATCH_REPS.status; effectiveReps prop passed to map and AI drawer; assign sets rep to en_route, reverts to available after 60s
- Dispatch Efficiency Score: aiCount/totalCount seeded 8/9 (89%); AI assign increments both, manual override increments total only; shown as badge in header
- Efficiency badge label updated to '89% AI-Dispatched' with tooltip explaining the metric
- AI Says block in RecommendationDrawer: rep identity row (avatar, name, status/distance, large score) + italic AI insight quote above recommendations
- Lead aging badges: amber Aging (20+ min), red pulsing Overdue (40+ min) on unassigned leads
- Search bar in Lead Queue: filters by customer name, address, city; combines with active tab filter
- mockStore enrichment: email + notes + source sub-details on all 12 leads; rating/closeRate on all 5 reps; distanceMi/aiInsight/conflictFlag on all recommendations; updateLeadNotes() action; DISPATCH_WEEKLY_STATS export
- LynkDispatchPage wired for Phase 5 KPIs, storm mode, chart modal, log drawer, and all new features
2026-03-26 14:14:42 +05:30
Satyam e4c75b7cfd feat(dispatch): Phase 6 — weekly performance chart modal and activity log drawer
- DispatchWeeklyChart: Recharts ComposedChart (Area + Line), custom dots for storm/today/emergency days, rep leaderboard with animated progress bars
- DispatchChartModal: centered modal (max-w-2xl, 88vh), portaled to document.body, scale+fade animation, ESC and backdrop close
- DispatchLogDrawer: right-side sliding drawer (400px sm+, full-width mobile), portaled, spring animation from right, full-height scrollable log, ESC and backdrop close
- Storm mode styling on both — amber tint on headers and borders
- DISPATCH_WEEKLY_STATS: 7-day mock data (Mon Mar 20 – Sun Mar 26) with per-rep breakdown, storm day Thursday, partial Sunday
2026-03-26 14:14:13 +05:30
Satyam a636e23568 feat(dispatch): Phase 4 — Leaflet map panel with rep markers, lead pins, route polylines, and storm polygon
- Real Plano TX map using Leaflet with dark/light tile layer filter
- Custom DivIcon rep markers (initials circles, pulsing ring on top AI pick)
- Urgency-colored lead pins with radar rings on selected lead
- Route polyline with stroke-dashoffset draw animation keyed to selected lead
- Travel time chip at route midpoint — solid color background, white text, triple ring shadow
- Storm polygon overlay (NE Plano) with Storm Zone Active badge
- Route Active chip top-right, legend overlay bottom-left (rep status + lead urgency counts)
- Hover tooltips on rep markers (name, status, slots, rating/close%) and lead pins (name, urgency, address, notes snippet)
- invalidateSize() with 50ms defer + window resize listener to fix blank tile area after flex layout settles
2026-03-26 14:13:51 +05:30
Satyam c0706077d3 feat(dispatch): Phase 3 — AI recommendation drawer with scoring and dispatch flow
- Build DispatchRecommendationDrawer with empty/processing/results/dispatched states
- Structured shimmer skeletons during AI processing with cycling analyze messages
- Rep cards: animated score counter, 5-factor breakdown bars, reason chips, capacity donut
- Top Pick badge, storm-aware weather chips (amber styling)
- Assign button fires Sonner toast + updates lead status to confirmed in queue
- Override button opens rep picker modal with capacity and performance data
- Post-assign dispatched confirmation overlay (2.4s) then drawer resets
- Mobile: tap lead auto-expands AI panel and smooth-scrolls to it
2026-03-26 01:57:49 +05:30
Satyam 2fdb55e24c feat(dispatch): Phase 2 — responsive layout, collapsible panels, bug fixes
- Fix tab overflow: scrollable tab bar, shortened labels (Open/Risk/Done)
- Cap DROP_POOL to 3 fires, no repeat flooding
- Resizable drag handles on desktop (xl 1280px breakpoint)
- Collapsible panels on mobile/tablet — Map + AI collapsed by default on mobile
- iPad Air + iPad Pro 11" treated as tablet via xl breakpoint
- Fixed lead list heights: 22rem mobile → 72rem xl (8 cards visible)
- PageTransition h-full fix to maintain height chain
2026-03-26 01:57:09 +05:30
Satyam 1d6d587ebf feat(dispatch): Phase 2 — DispatchLeadQueue with tabs, cards, and live drop-in
- DispatchLeadQueue: 4-tab filter (All / Unassigned / At Risk / Confirmed)
  with live counts; AnimatePresence popLayout for smooth card entrance/exit
- LeadCard: urgency badge (EMERGENCY pulse / HIGH / STANDARD), source icon,
  customer name, lead type, address, status pill, assigned rep initials, time ago
  — colored left border by urgency, blue ring when selected
- Storm mode: emergency leads float to top via sort; PRIORITY badge on
  emergency_tarp cards; amber Unassigned pill in storm context
- 20s interval drops new leads from 3-lead pool; NEW badge fades after 5s
- LynkDispatchPage: left panel now renders DispatchLeadQueue; handleSelectLead
  triggers 1.2s isProcessing state; right panel shows processing/selected/empty
  states ready for Phase 3
2026-03-21 21:53:00 +05:30
Satyam 4648561e7a feat(dispatch): Phase 1 — LynkDispatch AI skeleton, mock data, routes, sidebar
- mockStore: add DISPATCH_LEADS (12), DISPATCH_REPS (5), DISPATCH_RECOMMENDATIONS
  (pre-baked AI scores + route paths for all 12 leads), dispatchLeads state,
  assignDispatchLead() action
- LynkDispatchPage: 3-panel command center shell with storm banner, live badge,
  Storm Mode toggle, KPI bar with real unassigned count
- App.jsx: routes /admin/dispatch and /owner/dispatch wired
- Layout.jsx: LynkDispatch (Zap icon) added to ADMIN and OWNER sidebar nav
2026-03-21 21:46:09 +05:30
Satyam cd3b6c8cfe fix(leaderboard): fix counter animation and number formatting
- AnimatedNumber: add ScrollTrigger so counters animate on scroll-into-view
  instead of firing immediately on mount (fixes table rows animating before
  the user scrolls to them)
- AnimatedNumber: lock locale to 'en-US' for consistent comma formatting
- LeaderboardPage: lock formatValue locale to 'en-US'
- mockStore: update MOCK_SALES_HISTORY dates from Jan/Feb to March 2026 so
  the default "This Month" filter returns data; previous dates caused all
  agents to show $0 revenue, making the animation appear broken
- mockStore: replace unrealistic amounts ($250K–$520K) with realistic
  residential roofing job values ($12K–$42K per deal)
2026-03-20 17:56:41 +05:30
Satyam c393ae676a 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
2026-03-14 23:51:31 +05:30