Service area management with zip code territories, team assignments, coverage analysis, and performance analytics. Inspired by Salesforce Territories, DoorDash Zones, ServiceTitan, and Google Maps.
RegionListScreen — Contractor-scoped region list with active toggle, zip count summaries, and team assignments.
useQuery(api.pricebook.regionalPricing.listRegions)
CreateRegionScreen — Multi-section form with type selector, color picker, boundary preview, and team assignment.
useMutation(api.pricebook.regionalPricing.createRegion)
RegionZipcodesScreen — Search + add, bulk paste, removable chip grid, coverage area estimate.
useMutation(api.pricebook.regionalPricing.addZipcode, removeZipcode)
RegionMapScreen — Map placeholder with colored zone overlays, overlap detection alerts, region legend, and zoom controls.
useQuery(api.pricebook.regionalPricing.listRegions) + geo.ts utilities
EditRegionScreen — Pre-filled form with all region details, zip summary, boundary adjustment, rename, and team reassignment.
useMutation(api.pricebook.regionalPricing.updateRegion)
TerritoryAssignmentScreen — Drag-assign interface with primary/backup designation, team grouping, and unassigned alerts.
useMutation(api.teams.assignTerritory) · Segmented By Team / By Region
CoverageAnalysisScreen — Heat map of job density vs coverage, gap detection, expansion suggestions, and competition density.
useQuery(api.analytics.regionCoverage) · getPricingForZipcode
RegionAnalyticsScreen — Jobs per region chart, revenue by territory, team utilization, travel time analysis, and underserved areas.
useQuery(api.analytics.regionPerformance) · usePricingAnalytics(timeRange)
Schema tables, hooks, queries, and mutations that power the region & territory system.