Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EN-394] Commercetools Theme - Incorrect address fields mapping #6170

Merged
merged 2 commits into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
>
<span
>{{ userBillingGetters.getStreetName(billingAddress) }}
{{ userBillingGetters.getApartmentNumber(billingAddress) }}</span
{{ userBillingGetters.getStreetNumber(billingAddress) }}</span
>
<span>{{ userBillingGetters.getPostCode(billingAddress) }}</span>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@
class="form__element"
>
<SfInput
v-model="form.apartment"
v-model="form.streetNumber"
name="apartment"
:label="$t('House/Apartment number')"
required
class="form__element"
:valid="!errors[0]"
:errorMessage="errors[0]"
/>
</ValidationProvider>
<div class="form__horizontal">
Expand Down Expand Up @@ -217,7 +218,7 @@ export default {
firstName: '',
lastName: '',
streetName: '',
apartment: '',
streetNumber: '',
city: '',
state: '',
postalCode: '',
Expand All @@ -239,7 +240,7 @@ export default {
firstName: props.address.firstName,
lastName: props.address.lastName,
streetName: props.address.streetName,
apartment: props.address.apartment,
streetNumber: props.address.streetNumber,
city: props.address.city,
state: props.address.state,
postalCode: props.address.postalCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@
class="form__element"
>
<SfInput
v-model="form.apartment"
v-model="form.streetNumber"
name="apartment"
:label="$t('House/Apartment number')"
required
class="form__element"
:valid="!errors[0]"
:errorMessage="errors[0]"
/>
</ValidationProvider>
<div class="form__horizontal">
Expand Down Expand Up @@ -217,7 +218,7 @@ export default {
firstName: '',
lastName: '',
streetName: '',
apartment: '',
streetNumber: '',
city: '',
state: '',
postalCode: '',
Expand All @@ -239,7 +240,7 @@ export default {
firstName: props.address.firstName,
lastName: props.address.lastName,
streetName: props.address.streetName,
apartment: props.address.apartment,
streetNumber: props.address.streetNumber,
city: props.address.city,
state: props.address.state,
postalCode: props.address.postalCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,18 @@ export default {
const address = toRef(props, 'address');

const street = computed(() => {
const { streetName, streetNumber, apartment } = address.value;
const parts = [
address.streetName,
address.streetNumber && ` ${ address.streetNumber }`,
address.apartment && `, Apartment ${ address.apartment }`
streetName,
streetNumber && ` ${ streetNumber }`,
apartment && `, Apartment ${ apartment }`
];

return parts.filter(Boolean).join('');
});

const country = computed(() => {
const country = address.country;
const { country } = address.value;
return config.countries.find(c => c.name === country)?.label || country;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,18 @@ export default {
const address = toRef(props, 'address');

const street = computed(() => {
const { streetName, streetNumber, apartment } = address.value;
const parts = [
address.streetName,
address.streetNumber && ` ${ address.streetNumber }`,
address.apartment && `, Apartment ${ address.apartment }`
streetName,
streetNumber && ` ${ streetNumber }`,
apartment && `, Apartment ${ apartment }`
];

return parts.filter(Boolean).join('');
});

const country = computed(() => {
const country = address.country;
const { country } = address.value;
return config.countries.find(c => c.name === country)?.label || country;
});

Expand Down
4 changes: 2 additions & 2 deletions packages/commercetools/theme/pages/Checkout/Billing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
>
<SfInput
v-e2e="'billing-apartment'"
:value="billingDetails.apartment"
@input="apartment => changeBillingDetails('apartment', apartment)"
:value="billingDetails.streetNumber"
@input="streetNumber => changeBillingDetails('streetNumber', streetNumber)"
:label="$t('House/Apartment number')"
name="apartment"
class="form__element form__element--half form__element--half-even"
Expand Down
4 changes: 2 additions & 2 deletions packages/commercetools/theme/pages/Checkout/Payment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="accordion__content">
<p class="content">
<span class="content__label" v-if="chosenShippingMethod">{{ chosenShippingMethod.name }}</span><br />
{{ shippingDetails.streetName }} {{ shippingDetails.apartment }},
{{ shippingDetails.streetName }} {{ shippingDetails.streetNumber }},
{{ shippingDetails.zipCode }}<br />
{{ shippingDetails.city }}, {{ shippingDetails.country }}
</p>
Expand All @@ -32,7 +32,7 @@
<template v-else>
<p class="content">
<span class="content__label">{{ chosenPaymentMethod.label }}</span><br />
{{ billingDetails.streetName }} {{ billingDetails.apartment }},
{{ billingDetails.streetName }} {{ billingDetails.streetNumber }},
{{ billingDetails.zipCode }}<br />
{{ billingDetails.city }}, {{ billingDetails.country }}
</p>
Expand Down
8 changes: 4 additions & 4 deletions packages/commercetools/theme/pages/Checkout/Shipping.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@
/>
</ValidationProvider>
<ValidationProvider
name="apartment"
name="streetNumber"
rules="required"
v-slot="{ errors }"
slim
>
<SfInput
v-e2e="'shipping-apartment'"
:value="shippingDetails.apartment"
@input="apartment => changeShippingDetails('apartment', apartment)"
:label="$t('House/Apartment number')"
:value="shippingDetails.streetNumber"
@input="streetNumber => changeShippingDetails('streetNumber', streetNumber)"
label="House number"
name="apartment"
class="form__element form__element--half form__element--half-even"
required
Expand Down