feat(time): editable time entries (MAPPS-166) #159

Merged
nrupard merged 2 commits from feat/mapps-166-editable-time-entries into main 2026-06-15 20:49:06 +02:00
Owner

What

MAPPS-166: time entries were read-only on the list. The server already supports PUT / DELETE /time-entries/{id}, so this wires up the client.

  • Click-to-edit: list rows are now clickable and open a TimeEntryEditModal.
  • Editable fields: work type, hours, date, description, billable.
  • Delete: confirm + DELETE /time-entries/{id}.

RemoteTimeEntry gains id / work_type_id / task_id (and PartialEq) so a row can be edited; the list stores the selected entry by value.

Work item left fixed (deliberate)

The server's update SQL direct-sets ticket_id / project_id / task_id (no COALESCE) and never recomputes company_id. So:

  • the modal does NOT let you change the work item or task (changing them would risk a stale company_id), and
  • it re-sends the existing ticket_id / project_id / task_id on every save, so the partial-looking update doesn't null them.

To move an entry to a different work item, delete it and log again. (start_time / end_time / hourly_rate are preserved server-side via .or(current), so they're not sent.)

Notes

  • No mokosh-server changes.
  • Not compiled locally (no Rust toolchain here). Mirrors the existing Log Time form and the task / rate-card edit modals; CI (cargo clippy --all-targets -- -D warnings) gates. A reviewer pass found no compile/clippy issues.

Test plan

  • Click a time-entry row: the edit modal opens prefilled (work type, hours, date, description, billable).
  • Change hours/date/description/billable/work type and Save: the row updates, totals refresh; confirm the work item link is unchanged (not nulled).
  • Delete a row via the modal; it disappears after confirm.
  • Clicking the Work Item "Ticket" link still navigates to the ticket (does not open the modal).
## What MAPPS-166: time entries were read-only on the list. The server already supports `PUT` / `DELETE /time-entries/{id}`, so this wires up the client. - **Click-to-edit:** list rows are now clickable and open a `TimeEntryEditModal`. - **Editable fields:** work type, hours, date, description, billable. - **Delete:** confirm + `DELETE /time-entries/{id}`. `RemoteTimeEntry` gains `id` / `work_type_id` / `task_id` (and `PartialEq`) so a row can be edited; the list stores the selected entry by value. ## Work item left fixed (deliberate) The server's update SQL **direct-sets** `ticket_id` / `project_id` / `task_id` (no `COALESCE`) and never recomputes `company_id`. So: - the modal does NOT let you change the work item or task (changing them would risk a stale `company_id`), and - it **re-sends** the existing `ticket_id` / `project_id` / `task_id` on every save, so the partial-looking update doesn't null them. To move an entry to a different work item, delete it and log again. (`start_time` / `end_time` / `hourly_rate` are preserved server-side via `.or(current)`, so they're not sent.) ## Notes - No mokosh-server changes. - Not compiled locally (no Rust toolchain here). Mirrors the existing Log Time form and the task / rate-card edit modals; CI (`cargo clippy --all-targets -- -D warnings`) gates. A reviewer pass found no compile/clippy issues. ## Test plan - Click a time-entry row: the edit modal opens prefilled (work type, hours, date, description, billable). - Change hours/date/description/billable/work type and Save: the row updates, totals refresh; confirm the work item link is unchanged (not nulled). - Delete a row via the modal; it disappears after confirm. - Clicking the Work Item "Ticket" link still navigates to the ticket (does not open the modal).
feat(time): editable time entries (click-to-edit modal)
Some checks failed
Check / clippy + fmt + tests (pull_request) Failing after 6s
7e1279b427
MAPPS-166. Time entries were read-only on the list (the server already supports PUT/DELETE /time-entries/{id}). Make list rows click-to-edit, opening a modal that edits the common fields - work type, hours, date, description, billable - plus delete.

The modal reuses the server's update endpoint. Because that PUT direct-sets ticket_id/project_id/task_id (no COALESCE) and never recomputes company_id, the edit form intentionally keeps the work item and task fixed and re-sends their ids so a partial-looking update does not null them; to move an entry to a different work item, delete it and log again. RemoteTimeEntry gains id/work_type_id/task_id (and PartialEq) so a row can be edited.

Not compiled locally (no Rust toolchain in this environment); mirrors the existing Log Time form and the task/rate-card edit modals, and is gated by CI (cargo clippy --all-targets -- -D warnings).

#MAPPS-166

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix(time): stop the edit modal from wiping task_id; UX tweaks
Some checks failed
Check / clippy + fmt + tests (pull_request) Failing after 6s
Create release / Create release from merged PR (pull_request) Has been skipped
e0abe326da
Code-review follow-up on the time-entry edit modal.

- Do not send task_id on update. The time-entry response carries no task_id, so the client cannot echo the current value; sending the always-None value (or omitting it against the current direct-set update) would NULL a project entry's task on every edit. Drop task_id from RemoteTimeEntry and the PUT body. The server preserves it via COALESCE in PMS-328; this PR depends on that fix to be safe (merge after PMS-328).
- Relax the edit Hours field to step="any" / min="0" so an existing off-grid duration (e.g. a 10-minute entry -> 0.1667h) no longer renders the input :invalid; the save handler still enforces 0 < hours <= 24.
- Stop the Work Item ticket link click from also opening the row's edit modal (wrap it in a span that stops propagation); it now just navigates.

#MAPPS-166

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
nrupard deleted branch feat/mapps-166-editable-time-entries 2026-06-15 20:49:06 +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!159
No description provided.