feat(time): prefill work-item from ?ticket_id on Log Time (PMS-362) #253
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/pms-362-log-time-ticket-prefill"
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
Closes AC2 of PMS-362. The "Add Contact from Company" prefill (AC1) was already shipped and works on main; this finishes the deep-link sweep by fixing the one remaining gap the audit found: Add Time Entry from Ticket.
The gap
The ticket-detail "Log Time" button was a routed
Link { to: Route::TimeEntryNew {} }carrying noticket_id, andTimeEntryNewPageread no URL params - so it opened an empty work-item picker and the user had to re-find the ticket they just clicked from.Fix
tickets.rs: switch the Log Time affordance to a plain<a href="/time/new?ticket_id={id}">. ALinkwould strip the query (theTimeEntryNewroute declares no query params); the router still intercepts the same-origin anchor for SPA nav. Mirrors the Add Contact / New Ticket prefill links.time.rs:TimeEntryNewPagereadsticket_idfromwindow.location.searchon mount (read_ticket_prefill_from_url) and seeds thework_itemsignal toticket:<uuid>, so the picker opens preselected and submit resolves the ticket'scompany_idas usual. Direct navigation (no params) still opens an empty picker - no regression (AC3).AC2 audit (every "Add X from Y" deep link + its consumer read)
<a>+ContactNewPagereadslocation.search(shipped)<a>+ New Ticket readsread_company_prefill_from_url(MAPPS-207)<a>+TimeEntryNewPagereadsread_ticket_prefill_from_url(this PR)Verification
wasm
cargo check,cargo clippy --target wasm32-unknown-unknown --lib -- -D warnings, andcargo fmt --all --checkall pass.#PMS-362
The ticket-detail "Log Time" button navigated to /time/new with no context, so the work-item picker opened empty and the user had to re-find the ticket they just clicked from - the same deep-link-drops-context bug PMS-362 fixed for Add Contact, on the flow AC2 names ("Add Time Entry from Ticket"). - tickets.rs: switch the Log Time affordance from a routed Link to a plain <a href="/time/new?ticket_id={id}">. A Link would strip the query (the TimeEntryNew route declares no query params); the router still intercepts the same-origin anchor for SPA nav. Mirrors the Add Contact / New Ticket prefill links. - time.rs: TimeEntryNewPage reads ticket_id from window.location.search on mount (read_ticket_prefill_from_url) and seeds the work_item signal to `ticket:<uuid>`, so the picker opens with that ticket selected and submit resolves its company_id as usual. Direct navigation (no params) still opens an empty picker - no regression. This closes AC2: every "Add X from Y" deep link now round-trips its parent. Audit: Add Contact from Company (anchor + location.search, already shipped), Add Ticket from Company (MAPPS-207), Add Time Entry from Ticket (this change). Add Site from Company is an inline modal (no route), and there is no Add-Asset-from-company/contact deep link, so neither needs a consumer read. #PMS-362