[upstream #4952] feat(dashboard): Allow creating customer and address inline on draft … - #23
Open
ayim wants to merge 2 commits into
Open
[upstream #4952] feat(dashboard): Allow creating customer and address inline on draft …#23ayim wants to merge 2 commits into
ayim wants to merge 2 commits into
Conversation
…orders Brings the React dashboard draft order flow to parity with the Angular admin-ui by allowing an admin to create a new customer inline and enter a new/ad-hoc shipping or billing address inline, rather than only selecting existing records. - CustomerSelector gains an opt-in `allowCreateNew` mode rendering a tabbed popover (select existing / create new) that emits a CreateCustomerInput via `onCreateNew`. - CustomerAddressSelector gains a "New address" tab embedding the shared CustomerAddressForm, emitting a CreateAddressInput via `onSubmitNew`. - CustomerAddressForm gains a `hideDefaultAddressFlags` prop (the default shipping/billing flags are not applicable in the draft order context). - Wired into both the draft order page and the order modification page. No backend changes required: setCustomerForDraftOrder already accepts a CreateCustomerInput, and the draft order address mutations accept a CreateAddressInput. Relates to vendurehq#4838
…ddress selectors Reset the customer selector tab to 'existing' when a customer is selected or created (programmatic close does not trigger onOpenChange), and preserve an explicitly chosen 'new' tab in the address selector while the address query transitions from loading to loaded. Relates to vendurehq#4810
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mirrored from vendurehq#4952 for the Overwatch review demo.
Original author: @Ryrahul
Brings the React dashboard draft order flow to parity with the Angular admin-ui by allowing an admin to create a new customer inline and enter a new/ad-hoc shipping or billing address inline, rather than only selecting existing records.
allowCreateNewmode rendering a tabbed popover (select existing / create new) that emits a CreateCustomerInput viaonCreateNew.onSubmitNew.hideDefaultAddressFlagsprop (the default shipping/billing flags are not applicable in the draft order context).No backend changes required: setCustomerForDraftOrder already accepts a CreateCustomerInput, and the draft order address mutations accept a CreateAddressInput.
Fixes vendurehq#4951
Description
The React dashboard draft order flow previously only allowed selecting an existing customer and selecting one of the customer's saved addresses. The old Angular admin-ui also supported creating a new customer inline and entering a new/ad-hoc address inline. This PR restores that parity.
The backend already fully supports this —
setCustomerForDraftOrderaccepts an optionalCreateCustomerInput, andsetDraftOrderShippingAddress/setDraftOrderBillingAddressaccept aCreateAddressInput. The React UI simply never used these paths. This PR wires them up:CustomerSelectorgets an opt-inallowCreateNewtabbed popover ("Existing customer" / "Create new customer"). The create form has the same fields as Angular (title, first name, last name, email, phone). The existing select-only behaviour is preserved whenallowCreateNewis not set, so the customer-groups call site is untouched.CustomerAddressSelectorgets an "Existing address" / "New address" tabbed popover. The new-address tab reuses the sharedCustomerAddressForm(default-shipping/billing checkboxes hidden via a newhideDefaultAddressFlagsprop, matching Angular's draft flow). Works with or without a customer set.Added e2e coverage in
sales/orders.spec.tsfor creating a customer inline and entering a new shipping address inline. All 20 order e2e tests pass.Breaking changes
None. The change is additive and backward-compatible —
CustomerSelectorkeeps its original select-only behaviour by default (inline creation is opt-in viaallowCreateNew), and no backend/GraphQL changes are required.Screenshots
Checklist
📌 Always:
👍 Most of the time:
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.