feat(time): wire Time Tracking pages to the backend (MAPPS-124) #70

Merged
longjacksonle merged 2 commits from feat/mapps-124-wire-time-tracking into main 2026-06-07 01:19:34 +02:00

What

Closes MAPPS-124. The /time pages were hardcoded template, not wired to the backend - logging time saved nothing and the list showed fabricated data.

  • TimeEntryListPage (/time): fixed stat cards (4.5h/32.5h/28.0h/4.5h), a fake John Smith / Jane Doe user filter, 5 hardcoded rows.
  • TimeEntryNewPage (/time/new, "Log Time"): mock submit - onsubmit waited 1s then navigated, never POSTed; hardcoded Work Item dropdown; no work-type/company selection (both required by the API).

Changes

  • Log Time form now POSTs a real CreateTimeEntryRequest: Work Item picker from GET /tickets (supplies ticket_id + the required company_id), Work Type picker from GET /work-types (work_type_id), user_id from the auth context, date = today, hours -> duration_minutes, description -> notes, billable flag. Validates input, surfaces errors, navigates to /time on success.
  • Entries list fetches GET /time-entries, renders real rows (date, ticket link, notes, hours, billable + billing status), computes the four stat cards from the fetched entries, and has loading / empty / load-failed states. Dropped the hardcoded rows, the fake user filter, and the unused TimeEntryRow component.

Verification

Create path verified end to end against the running server: POST /api/v1/time-entries with the assembled body returns 200 and the entry persists (correct user/date/work_type/company/duration/billable). The work-types + ticket-company lookups return real data.

Dependency

GET /time-entries 500s until mokosh-server PR #116 (PMS-145) lands + the server rebuilds (the ORDER BY bug), so the list shows its load-failed/empty state until then. The page is robust to it, and the create path works independently.

Out of scope

TimesheetsPage (/timesheets) is still a separate hardcoded grid - a follow-up.

🤖 Generated with Claude Code

## What Closes **MAPPS-124**. The `/time` pages were hardcoded template, not wired to the backend - logging time saved nothing and the list showed fabricated data. - **TimeEntryListPage** (`/time`): fixed stat cards (4.5h/32.5h/28.0h/4.5h), a fake John Smith / Jane Doe user filter, 5 hardcoded rows. - **TimeEntryNewPage** (`/time/new`, "Log Time"): **mock submit** - `onsubmit` waited 1s then navigated, never POSTed; hardcoded Work Item dropdown; no work-type/company selection (both required by the API). ## Changes - **Log Time form** now POSTs a real `CreateTimeEntryRequest`: Work Item picker from `GET /tickets` (supplies `ticket_id` + the required `company_id`), Work Type picker from `GET /work-types` (`work_type_id`), `user_id` from the auth context, `date` = today, hours -> `duration_minutes`, description -> `notes`, billable flag. Validates input, surfaces errors, navigates to `/time` on success. - **Entries list** fetches `GET /time-entries`, renders real rows (date, ticket link, notes, hours, billable + billing status), computes the four stat cards from the fetched entries, and has loading / empty / load-failed states. Dropped the hardcoded rows, the fake user filter, and the unused `TimeEntryRow` component. ## Verification Create path verified end to end against the running server: `POST /api/v1/time-entries` with the assembled body returns **200** and the entry persists (correct user/date/work_type/company/duration/billable). The work-types + ticket-company lookups return real data. ## Dependency `GET /time-entries` 500s until **mokosh-server PR #116 (PMS-145)** lands + the server rebuilds (the ORDER BY bug), so the list shows its load-failed/empty state until then. The page is robust to it, and the create path works independently. ## Out of scope `TimesheetsPage` (`/timesheets`) is still a separate hardcoded grid - a follow-up. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(time): wire Time Tracking pages to the backend (MAPPS-124)
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 43s
13f7828080
The /time pages were hardcoded template. TimeEntryListPage showed fixed stat cards (4.5h/32.5h/28.0h/4.5h), a fake John Smith / Jane Doe user filter, and 5 hardcoded rows. TimeEntryNewPage ("Log Time") mock-submitted: onsubmit waited 1s then navigated, never POSTing, with a hardcoded Work Item dropdown and no work-type/company selection that the API requires.

Wire both to the real API:
- TimeEntryNewPage POSTs a real CreateTimeEntryRequest. Work Item is a real ticket picker (GET /tickets) that supplies ticket_id + the required company_id; Work Type is a real picker (GET /work-types) for the required work_type_id; user_id comes from the auth context, date defaults to today, hours convert to duration_minutes, description -> notes, plus the billable flag. Validates input, surfaces errors in a banner, and navigates to /time on success.
- TimeEntryListPage fetches GET /time-entries, renders real rows (date, ticket link, notes, hours, billable + billing status), computes the four stat cards from the fetched entries, and shows loading / empty / load-failed states. Removed the hardcoded rows, the fake user filter, and the now-unused TimeEntryRow component.

The create path is verified end to end (POST returns 200 and the entry persists). The list depends on mokosh-server PR #116 (PMS-145): GET /time-entries 500s until that ORDER BY fix lands + the server rebuilds, so the list shows its load-failed/empty state until then; this page is robust to it. TimesheetsPage (/timesheets) is still a separate hardcoded surface, out of scope here.

cargo check + clippy clean on wasm32; fmt clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Merge branch 'main' into feat/mapps-124-wire-time-tracking
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / clippy + fmt + tests (pull_request) Successful in 47s
4756da123e
longjacksonle deleted branch feat/mapps-124-wire-time-tracking 2026-06-07 01:19:34 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-apps!70
No description provided.