Skip to content

Commit

Permalink
fix: quote form validation (#630)
Browse files Browse the repository at this point in the history
  • Loading branch information
goldenmaya authored Jul 7, 2023
1 parent 15cff5e commit 673fa95
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions client-app/pages/account/edit-quote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,11 @@ const accountAddresses = computed<AnyAddressType[]>(() => {
? organizationsAddresses.value.map((address) => ({ ...address, firstName, lastName }))
: personalAddresses.value;
});
const quoteChanged = computed<boolean>(() => !isEqual(originalQuote.value, quote.value));
const quoteChanged = computed<boolean>(
() =>
!isEqual(originalQuote.value, quote.value) ||
(billingAddressEqualsShipping.value && !isBillingAddressEqualsShipping.value)
);
const quoteItemsValid = computed<boolean>(
() =>
!!quote.value?.items?.length &&
Expand Down Expand Up @@ -315,7 +319,11 @@ async function saveChanges(): Promise<void> {
}
});
if (quote.value!.addresses?.length && !isEqual(quote.value!.addresses, originalQuote.value!.addresses)) {
if (
quote.value!.addresses?.length &&
(!isEqual(quote.value!.addresses, originalQuote.value!.addresses) ||
(billingAddressEqualsShipping.value && !isBillingAddressEqualsShipping.value))
) {
if (billingAddressEqualsShipping.value) {
setBillingAddressEqualsShippingAddress();
}
Expand Down

0 comments on commit 673fa95

Please sign in to comment.