Skip to content

[upstream #4952] feat(dashboard): Allow creating customer and address inline on draft … - #23

Open
ayim wants to merge 2 commits into
masterfrom
mirror/upstream-4952
Open

[upstream #4952] feat(dashboard): Allow creating customer and address inline on draft …#23
ayim wants to merge 2 commits into
masterfrom
mirror/upstream-4952

Conversation

@ayim

@ayim ayim commented Jul 28, 2026

Copy link
Copy Markdown
Owner

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.

  • 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.

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 — setCustomerForDraftOrder accepts an optional CreateCustomerInput, and setDraftOrderShippingAddress / setDraftOrderBillingAddress accept a CreateAddressInput. The React UI simply never used these paths. This PR wires them up:

  • CustomerCustomerSelector gets an opt-in allowCreateNew tabbed 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 when allowCreateNew is not set, so the customer-groups call site is untouched.
  • AddressCustomerAddressSelector gets an "Existing address" / "New address" tabbed popover. The new-address tab reuses the shared CustomerAddressForm (default-shipping/billing checkboxes hidden via a new hideDefaultAddressFlags prop, matching Angular's draft flow). Works with or without a customer set.
  • Both the draft order page and the order modification page are wired to the inline-create paths.

Added e2e coverage in sales/orders.spec.ts for 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 — CustomerSelector keeps its original select-only behaviour by default (inline creation is opt-in via allowCreateNew), and no backend/GraphQL changes are required.

Screenshots

image image

Checklist

📌 Always:

  • I have set a clear title
  • My PR is small and contains a single feature
  • I have checked my own PR

👍 Most of the time:

  • I have added or updated test cases
  • I have updated the README if needed

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Ryrahul added 2 commits July 11, 2026 03:05
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Draft order: allow creating a customer and address inline in the React dashboard (parity with Angular admin-ui)

2 participants