feat(forms): send a client a request-form link #487
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/PMS-730-send-request-link"
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?
Third slice of the client-request frontend, after the public page (#485) and the builder (#486): the control that actually sends a client a form.
A Request forms card on the company detail page shows what has been sent to this client and what became of each link, with a "Send a form" action beside it.
Why the company, not the form
The workflow is "I am looking at this client and I need something from them", not "I am looking at a form and wondering who to send it to". The company detail page is where an agent already is when that thought occurs.
Details worth reviewing
Two things are filtered out of the pickers rather than offered and then rejected. Retired forms refuse submissions server-side, so offering one would issue a link that dies on arrival. Contacts with no email address cannot receive anything, so choosing one could only produce a 400 telling the agent to supply an address they could have typed in the first place.
Choosing a contact fills the address in but leaves it editable, so the agent can see where this is actually going and can still override it for a one-off. The server treats an explicit address as winning over the contact's, which is what the help text says.
The contact picker fetches its own list. Reusing the detail page's
contacts_resourcewould have been less code, but it is capped atper_page=5for its preview card, so every contact past the fifth would have been silently missing from the picker.The card owns its own resource. Every other card on that page takes a
Resourceprop threaded from the detail page. This one does not, so composing it costs one line incontacts.rsand it refreshes itself after a send.contacts.rsis already the largest page in the repo at ~4.8k lines, so the card lives in its own module.Submitted beats Expired in the status badge. A link that was used and has since passed its expiry is still a request that came in; showing "Expired" would read as though the client never replied. Unit-tested, along with the other two states.
No token anywhere. The server never returns one and this surface never asks. A link that needs resending is reissued.
Verification
cargo check --target wasm32-unknown-unknown,cargo fmt --all --check,cargo test(261 passed, 0 failed, including 3 new unit tests), and both guard scripts.The two pre-existing clippy failures in
src/pages/projects.rsandsrc/pages/time.rsare unchanged and unrelated; see #485 and #486. They are now the only thing standing between this repo and a cleanjust checkon a current toolchain, so they are worth a two-line PR of their own.Next
The measured-duration readout on the KB article page, which closes the loop.