- Rebrand all user-facing text to AgendaMax - Fix sidebar scrolling: card container no longer overflows html (flex h-full min-h-0) - Fix calendar toolbar hover: active buttons keep readable contrast - Sticky calendar toolbar (month/week/day always visible on scroll) - Seed guarantees 2-4 appointments per day for current week (Mon-Sat)
3.6 KiB
3.6 KiB
Task 14 — EmployeeModal: especialidades, horario, eficiencia
File changed
src/pages/EmployeesPage.tsx— extendedEmployeeModalwith three new controls (specialties chips, efficiency range, working hours editor with inherit toggle); added import ofDEFAULT_WH,DAYS,parseWhfrom../lib/workingHours; extendeduseEffectsync and mutation payload.
No other files touched. src/lib/workingHours.ts was already created in Task 13 and is only imported.
Typecheck / build
npm run typecheck→ 0 errors.npm run build→ succeeds (2462 modules transformed, 5.11s).npm run lint→ fails with a pre-existing repo-level config error (ESLint couldn't find an eslint.config.(js|mjs|cjs)— ESLint 9 migration not done). Not caused by this task; same result onmain.
Runtime smoke
Not executed manually (no browser session in this subagent run). Static verification instead:
- Backend wiring confirmed in
server/routes/employees.ts:- POST accepts
specialties,working_hours,efficiency_score(line 76). - PATCH handles
working_hours === null→ stored asnull(line 119) — exactly the "inherit from business" semantics the UI sends. efficiency_scorecoerced viaNumber(...)server-side;specialtiesJSON-stringified if array.
- POST accepts
- GET
/employeesselects these columns (Task 7), so reopening the modal will prefill via theuseEffectsync branch. - The
Employeetype inshared/types.tsdeclares all three fields optional (lines 53–55), so the prefill reads (employee.specialties,employee.efficiency_score,employee.working_hours) typecheck cleanly.
Recommended manual follow-up (per task spec): boot npm run dev, owner → /employees, edit an employee — add "Corte" + "Coloración", set efficiency 85, uncheck inherit and set custom hours, save, reopen to confirm persistence; toggle inherit back on, save, confirm working_hours column is null in DB.
Deviations
- Plan Step 1 said to create
src/lib/workingHours.tsand refactor SettingsPage. Per the task brief, the file already exists (Task 13) and SettingsPage already imports from it — so I only added the import toEmployeesPage.tsx. No other files modified. - Lint not run green (pre-existing repo config issue, not introduced here).
Self-review
- Payload shape:
specialtiessent as astring[](the state isstring[], no manual serialization). ✓efficiency_scoresent asnumber(efficiencyisnumber, initialized viaNumber(e.target.value)). ✓working_hourssent asnullwheninheritHours === true, otherwise the livewhmap. ✓ Matches the backend'sworking_hours === null ? null : …branch.
- Edit-mode prefill:
useEffect[open, employee]readsemployee.specialties(withArray.isArrayguard),employee.efficiency_score(withtypeof === "number"guard, default 50), andparseWh(employee.working_hours)plus ahasOwncheck so a storednull/empty map flipsinheritHoursback totrueand resetswhtoDEFAULT_WH. ✓ - Duplicate prevention in chips input:
setSpecialties((a) => [...new Set([...a, specialtyInput.trim()])])—Setdedupes by value; case-sensitive (so "Corte" ≠ "corte"), which matches how the backend stores them. ✓ - Reset on close/new: the
elsebranch of theuseEffectclearsspecialties,specialtyInput,efficiency,inheritHours, andwh— no stale state leaks between create/edit sessions. ✓ - Type safety on
wh[n]: narrowed with!(wh[n])/wh[n]!.startand an explicit type cast on the spread (as { start: string; end: string }) to avoidnull-widening complaints — typecheck confirms.