feat(time): wire Timesheets page to the backend (MAPPS-125) #86
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/mapps-125-wire-timesheets"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Wires the Timesheets page (
/timesheets,TimesheetsPageinsrc/pages/time.rs) to the live time-tracking API. It was a hardcoded weekly grid: fixed work-item rows (TKT-1234,PRJ-101, ...), hardcoded per-day hours, a hardcoded daily-total row, a decorative week selector anchored to Jan 13 2025, and a decorative Submit button.Closes MAPPS-125.
How
GET /time-entries?user_id=<me>&date_from=<mon>&date_to=<sun>and pivots them client-side into per-work-item rows with seven day buckets (Mon..Sun), summingduration_minutesinto each (row, weekday) cell. Real daily totals and grand total./timesheetssummary endpoint returns week aggregates (total/billable minutes, entry count, approval status), not the per-work-item/day breakdown the grid needs, so the pivot is done in the client. The summary is consumed only for the week-levelapproval_statusbadge (Approved / Rejected / Pending approval / Not submitted).GET /tickets(ticket_number: title) andGET /projects(Project: name), falling back toInternalfor entries linked to neither.monday_of_week(today)) instead of the 2025 demo anchor; the prev/next selector re-runs the fetch.POST /timesheets/<user_id>/<week_start>/submit, disabled when the week has no entries or is already approved, refreshing the status badge on success.TimesheetRowcomponent.Dependency
The grid load depends on PMS-145 (the
GET /time-entriesORDER BY 500 fix) being deployed; without it the grid shows the load-failed state.Verification
cargo fmt --checkclean;cargo clippy --target wasm32-unknown-unknown --all-targets -- -D warningsclean.GET /projects200,GET /timesheets?user_id=&week=200,GET /time-entries?user_id=&date_from=&date_to=200 (all empty on the fresh dev DB, so the page renders the empty + Not-submitted states as expected).🤖 Generated with Claude Code