feat(tickets): inline 'Create new company' affordance in CompanyPicker on New Ticket #188

Merged
YousifShkara merged 1 commit from feat/pms-352-inline-create-company-on-ticket-form into main 2026-06-16 06:32:29 +02:00
Owner

A first-time technician on a tenant with zero companies could not complete the New Ticket flow: Company is required, the picker only surfaced "No companies yet" or "No matches", and there was no inline action to seed one. The only path forward was to leave the form, navigate to Companies, create one, return, retype the title + description, and resubmit. PMS-352 reviewer flagged this as a hard dead-end that bites every new tenant on day one.

CompanyPicker grows an opt-in allow_inline_create prop (default off so the Contact / time-entry pickers stay unchanged). When true the dropdown renders a "+ Create new company" action under both the empty and populated states; clicking it opens a slim Modal carrying a name input that seeds from whatever the user already typed into the picker's search (so the rare "I searched 'Acme' and Acme isn't here, create it" case auto-fills the name and you just hit Create). On a successful POST /contacts/companies the new row is fed through the picker's existing onselect handler, so the New Ticket form lands with the just-created company already picked and every other field preserved.

The minimal POST body matches the server's CreateCompanyRequest defaults (Client type, Active status, portal_enabled true) so the modal doesn't have to surface those decisions on a fast-path create; the user can refine them later from the company detail page. A short note under the input says exactly that so the convention isn't a surprise. The picker's underlying companies list refetches after the POST so a later "Change" reload sees the new row in the dropdown.

#PMS-352

A first-time technician on a tenant with zero companies could not complete the New Ticket flow: Company is required, the picker only surfaced "No companies yet" or "No matches", and there was no inline action to seed one. The only path forward was to leave the form, navigate to Companies, create one, return, retype the title + description, and resubmit. PMS-352 reviewer flagged this as a hard dead-end that bites every new tenant on day one. CompanyPicker grows an opt-in `allow_inline_create` prop (default off so the Contact / time-entry pickers stay unchanged). When true the dropdown renders a "+ Create new company" action under both the empty and populated states; clicking it opens a slim Modal carrying a name input that seeds from whatever the user already typed into the picker's search (so the rare "I searched 'Acme' and Acme isn't here, create it" case auto-fills the name and you just hit Create). On a successful POST /contacts/companies the new row is fed through the picker's existing `onselect` handler, so the New Ticket form lands with the just-created company already picked and every other field preserved. The minimal POST body matches the server's CreateCompanyRequest defaults (Client type, Active status, portal_enabled true) so the modal doesn't have to surface those decisions on a fast-path create; the user can refine them later from the company detail page. A short note under the input says exactly that so the convention isn't a surprise. The picker's underlying companies list refetches after the POST so a later "Change" reload sees the new row in the dropdown. #PMS-352
feat(tickets): inline 'Create new company' affordance in CompanyPicker on New Ticket
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / clippy + fmt + tests (pull_request) Successful in 1m2s
4b2a7c8cae
A first-time technician on a tenant with zero companies could not complete the New Ticket flow: Company is required, the picker only surfaced "No companies yet" or "No matches", and there was no inline action to seed one. The only path forward was to leave the form, navigate to Companies, create one, return, retype the title + description, and resubmit. PMS-352 reviewer flagged this as a hard dead-end that bites every new tenant on day one.

CompanyPicker grows an opt-in `allow_inline_create` prop (default off so the Contact / time-entry pickers stay unchanged). When true the dropdown renders a "+ Create new company" action under both the empty and populated states; clicking it opens a slim Modal carrying a name input that seeds from whatever the user already typed into the picker's search (so the rare "I searched 'Acme' and Acme isn't here, create it" case auto-fills the name and you just hit Create). On a successful POST /contacts/companies the new row is fed through the picker's existing `onselect` handler, so the New Ticket form lands with the just-created company already picked and every other field preserved.

The minimal POST body matches the server's CreateCompanyRequest defaults (Client type, Active status, portal_enabled true) so the modal doesn't have to surface those decisions on a fast-path create; the user can refine them later from the company detail page. A short note under the input says exactly that so the convention isn't a surprise. The picker's underlying companies list refetches after the POST so a later "Change" reload sees the new row in the dropdown.

#PMS-352
YousifShkara deleted branch feat/pms-352-inline-create-company-on-ticket-form 2026-06-16 06:32:29 +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!188
No description provided.