# v2 RepairOrders Dashboard — Time Management & Interactive Features ## File: `src/pages/RepairOrders.tsx` ## Statuses (6 total): `active | in_progress | waiting_parts | waiting_pickup | completed | delivered` ## Time Calculation ### calcDueTime(ro) ```typescript const baseTime = ro.writeupTime || ro.created; // fall back to creation timestamp const duration = ro.estimatedDuration || 60; // default 1 hour if (baseTime) return new Date(baseTime).getTime() + duration * 60000; // fallback: ro.promisedTime (legacy field) ``` ### formatTimeRemaining(ro, now) Returns `"2h 15m"`, `"45m"`, or `"-10m"` (past due). - Completed/delivered → `"—"` - Null due time → `"—"` ### getUrgencyClass(ro, now) - Completed/delivered → `''` - Past due → `'urgent'` (red row bg) - Within 30 min → `'warning'` (amber text) - Otherwise → `''` ## Multi-Tier Sort (sortOrders) 1. **Waiting For Parts** → pinned to bottom, sorted by due time ascending within group 2. **Customer type**: Waiters above Drop-Offs 3. **Due time**: Most urgent (closest to due) first ## Adding a New Status To add a new status (e.g. `waiting_pickup`), update ALL of these: 1. **`types.ts`**: Add to `RepairOrder.status` union type 2. **`STATUS_CONFIG`** in RepairOrders.tsx: Add label + Tailwind color classes 3. **ROModal status dropdown**: Add `