# Coastal Timesheet v2 — Expert Panel Audit & Fix Task ## App Location - Frontend source: `/opt/code-collab/projects/active/ba94ec47/v2/frontend/` - Backend source: `/opt/code-collab/projects/active/ba94ec47/v2/backend/` - Docker: `/opt/code-collab/projects/active/ba94ec47/v2/docker/` - Live at: `http://100.94.106.120:8080` (Tailscale) - Admin login: `admin@coastal.com` / `CoastalAdmin2026!` ## Critical Bugs to Fix ### Bug 1: Timezone causes wrong day names (CRITICAL) **File:** `frontend/src/components/DayCard.jsx` and `frontend/src/pages/Timesheet.jsx` **Problem:** `new Date("2026-02-10")` parses as UTC midnight. In US timezones, `getDay()` returns previous day (Sunday instead of Monday). **Fix:** Use `new Date(date + 'T00:00:00')` (local) or split the date string and construct manually. Apply everywhere dates are parsed from `YYYY-MM-DD` strings. **Also fix in:** `WeekNavigator.jsx`, `History.jsx`, anywhere `new Date(dateString)` is used with YYYY-MM-DD format. ### Bug 2: Pre-filled entries can't be edited or deleted **Problem:** User reports entries exist that can't be modified. Likely the `disabled={isLocked}` check is triggering incorrectly, or the auto-save/PUT endpoint has an issue. **Check:** `Timesheet.jsx` — `isLocked` logic, `handleEntryChange`, `handleDeleteEntry`. Also check if the seed created phantom entries. ### Bug 3: Week label mismatch **Problem:** Shows "Feb 9 - Feb 15" but starts with Sunday Feb 8. The header says one range but cards show different dates. **Fix:** Ensure `WeekNavigator` header range and `getWeekDates()` output are consistent — both Mon-Sun. ## Feature Requirements ### Multiple homeowners per day (already partially works) - The "Add Entry" button exists in DayCard but verify it works end-to-end - Each day should support unlimited entries (different homeowners, different hours) - Total hours per day should sum all entries ### Admin Reporting (needs frontend) Backend already has these endpoints — need admin UI: - `GET /api/admin/timesheets` — list all employee timesheets with filters - `GET /api/admin/timesheets/:id` — detail view of specific timesheet - `GET /api/admin/reports` — reporting with date range, employee, homeowner filters - `GET /api/admin/reports/pdf` — PDF export ### Admin Panel Enhancements Needed 1. **Employee Timesheet Browser** — Admin can select any employee and see their timesheet for any week 2. **Filters** — by employee, date range, homeowner, status (draft/submitted/approved/rejected) 3. **Bulk actions** — approve/reject multiple timesheets at once 4. **Export** — CSV/PDF export of filtered data 5. **Dashboard summary** — total hours this week/month, pending reviews count, recent submissions ## Quality Standards - Mobile-first, responsive design - Dark mode support throughout - Loading states for all async operations - Error handling with user-friendly messages - No console errors - All dates display correctly in US timezones - Professional, polished UI suitable for 40+ employees