fix(tickets): use CompanyPicker on TicketNewPage so create works (MAPPS-122) #57
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/mapps-122-ticket-new-company-picker"
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
Fixes MAPPS-122: clicking Create Ticket on
/tickets/newdid nothing - no ticket, no error.Root cause
TicketNewPagerendered the company field as a hardcodedSelectwith placeholder option ids"1" / "2" / "3". On submit the handler didUuid::parse_str(&company_v).unwrap_or_else(|_| Uuid::nil()), so a selected"1"became the nil UUID00000000-0000-0000-0000-000000000000. The POST carried a non-existentcompany_id, the server rejected it, and the failure was swallowed intoweb_sys::console::error_1with no user-facing surface - so the form just looked inert. MAPPS-27 wired the POST + navigation but deliberately left this placeholder dropdown in place.Change
src/pages/tickets.rs:Selectwith the existingCompanyPicker(src/components/company_picker.rs), which searchesGET /contacts/companiesand reports a real company UUID viaonselect. The picker's docstring already named the ticket-new form as an intended consumer. Mirrors the contacts-form wiring:company_id+company_namesignals and apicker_selected_idderivation.errorsignal rendered above the form actions. Submitting with no company shows "Please pick a company first." and does not POST; a server-side create failure is surfaced in the form instead of only the browser console. On success the page still navigates to the created ticket's detail route.Verification
just pre-commitgreen:cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo check --target wasm32-unknown-unknown, andcargo test --lib(47 passed). The fix is a UI-wiring change with no new tests (the page has no harness; the picker + fetch path are exercised by the contacts form that already ships them).🤖 Generated with Claude Code