Data-layer work on the assistant, in the order it mattered. Correctness first: - getBookingsPage keeps the envelope's `total`/`page`. getBookings threw them away, so no caller could tell a full result from a truncated one. - Every booking read now drains pages up to a budget instead of taking page one at the API's 1000-row cap. Past 1000 lifetime bookings, every count and sum in this file silently under-reported while the source line beside it still read "complete". Row order is detected per call, so a backend that stops returning newest-first degrades to a full scan rather than to a wrong answer. - A capped scan now says "At least N", appends what it scanned versus the total, and marks its source call as failed. - Revenue excludes cancelled orders, sums every service option rather than the first, and is labelled estimated — it is a quote, not settled money. - A strong order reference that isn't found is answered "I couldn't find it" instead of falling through to a broader intent, which used to answer "142 orders created today" to a question about one order. Then agreement with the Orders page: - utils/orderStatusGroups.js is now the single definition of which raw booking enums make up each status; orders.js builds its tabs from it and the assistant matches against it. The assistant had been using api.js's Deliveries taxonomy, which keeps miler_assigned on `pending`, so the Orders page showed 19 Assigned while the bot answered 0. The two taxonomies stay separate on purpose — Orders tracks the operator's action, Deliveries tracks the rider's. - A status question with no date named is no longer scoped to today. "How many orders are assigned" describes the queue right now, which is what the Orders page's tabs show; they apply no date filter either. - The Orders header said "Today" over counts that were never date-filtered. Corrected the label rather than adding a filter, since filtering would hide currently-visible rows — a product decision, not a bug fix. Then capability: - delayedOrders answers "which orders are delayed" from the promised delivery time. deliveries.js and Dispatch.js both rejected that field for batch bucketing because an ETA is not the wave an order belongs to; that reasoning does not carry over to lateness, where a promise that never gets re-stamped is exactly the right baseline. If no order carries an ETA it says so rather than reporting a reassuring "0 delayed". - orderQuery composes status x batch x tenant x rider, plus rankings. It claims a question only when two or more of those are present, so single-dimension questions keep their proven intents. A date is not counted as a dimension — counting it re-routed four working questions. - An unresolved tenant/rider name falls through instead of having its filter silently dropped, which was the original defect. - orderLookup resolves the rider's name and reads the tracking trail defensively, since that endpoint's response shape is undocumented. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Doormile Express - Operator Dispatch Console & Deliveries Portal
A high-fidelity, real-time dispatcher command center and order-delivery console built using React, React-Leaflet, TanStack Query, and Material UI.
This platform enables real-time visual tracking of delivery partners, responsive slot scheduling adjustments, route matching analysis, and direct order status management from a cohesive operational interface.
🚀 Key Features
📍 1. Real-Time Rider Live GPS Mapping
- Interactive Leaflet Maps: Displays live geolocated pins for every active and idle rider across Coimbatore.
- Polished Glassmorphism Popovers: High-fidelity Map Popups loaded with crucial metrics (Active Orders, Contact number, monospaced coordinates, and last-seen timestamps).
- Dynamic Pulsing Live Indicator: Double-ring animated indicator reflecting current partner connectivity state (pulsing green
#16a34afor active, red#dc2626for idle). - Rider Routes & Planned Path Overlay: Parallel Indigo/Emerald rails representing planned paths vs actual tracks side-by-side using perpendicular polyline offsets.
🕒 2. Five-Wave Dispatch Slot Bucketing
- Flexible Scheduling Boundaries: Segmented timing filters supporting precise fractional-hour offsets (e.g., Slot 1 ends at 12:30 PM, Slot 2 starts at 12:20 PM).
- Default Operational Waves:
- Slot 1 (Morning Rush): 8:00 AM → 12:30 PM
- Slot 2 (Lunch Wave): 12:20 PM → 3:00 PM
- Slot 3 (Afternoon Wave): 3:00 PM → 7:00 PM
- Slot 4 (Evening Wave): 7:00 PM → 8:00 PM
- Slot 5 (Night Wave): 8:00 PM → Midnight
- State Validation & Caching: Employs an array-length-validated state cache (Key version
v6in LocalStorage) that auto-invalidates older 3-slot schema outputs during reload or hot-deployments to eliminate UI sync race conditions.
📦 3. Live Deliveries Portal & Update Status Modal
- Dynamic Filter Tabs: Filter deliveries based on active operational states (pending, accepted, on road, completed).
- Interactive Status Dialog: Positioned directly underneath the Amount inputs, allowing dispatchers to dynamically select and execute delivery state changes rather than submitting hardcoded records.
🛠️ Technology Stack
- Framework: React 18
- State Management: Redux Toolkit & React Context
- Server Cache/Queries:
@tanstack/react-query - Mapping Libraries:
leaflet,react-leaflet, Custom Polyline Offset modules - Component Styling: MUI v5 (Material UI) & custom vanilla CSS design systems
- Date/Time Parsers:
dayjs
⚙️ Environment Variables Config (.env)
Configure the following variables in your root .env or .env.development file to supply runtime secrets and API targets:
REACT_APP_VERSION=v2.1.0
GENERATE_SOURCEMAP=false
# Backend Services Endpoint URLs
REACT_APP_DOORMILE_URL=https://api.doormile.com/api/v1
No Maps API key is required — maps and address search run on free Leaflet/OpenStreetMap (Nominatim + OSRM), not Google Maps.
🏃 Getting Started & Local Development
1. Prerequisite Installations
Ensure that Node.js (v16+ recommended) is installed on your computer.
2. Install Project Dependencies
Use either npm or yarn to fetch the required modules defined in the lockfiles:
# If using npm
npm install
# If using yarn
yarn install
3. Run Development Server
Launches the console locally with real-time hot-reloading:
# Start standard environment
npm start
# Start dev configuration (loads .env.development)
npm run start:dev
Open http://localhost:3000 in your web browser to view the console.
📦 Production Builds & Verification
To compile the application down to highly optimized, static production files, perform the following commands:
1. Compile the Bundle
npm run build
(Or yarn build). This compiles all files and outputs them to the build/ directory.
2. Verify static pages locally
To test the production compilation locally before deploying:
npx serve -s build
Click on the output Network addresses (e.g. http://localhost:3000 or the local IP address) to view the compiled pages.
Note
If you run the static build server locally and see a blank white page, ensure you have added
"homepage": "."to yourpackage.jsonto properly configure relative Webpack asset paths.