feat: Adds an option to edit City/Country (#6792)
* feat: Adds an option to edit City/Country * chore: Minor fix
This commit is contained in:
@@ -132,6 +132,17 @@
|
|||||||
"PLACEHOLDER": "Enter the company name",
|
"PLACEHOLDER": "Enter the company name",
|
||||||
"LABEL": "Company Name"
|
"LABEL": "Company Name"
|
||||||
},
|
},
|
||||||
|
"COUNTRY": {
|
||||||
|
"PLACEHOLDER": "Enter the country name",
|
||||||
|
"LABEL": "Country Name",
|
||||||
|
"SELECT_PLACEHOLDER": "Select",
|
||||||
|
"REMOVE": "Remove",
|
||||||
|
"SELECT_COUNTRY": "Select Country"
|
||||||
|
},
|
||||||
|
"CITY": {
|
||||||
|
"PLACEHOLDER": "Enter the city name",
|
||||||
|
"LABEL": "City Name"
|
||||||
|
},
|
||||||
"SOCIAL_PROFILES": {
|
"SOCIAL_PROFILES": {
|
||||||
"FACEBOOK": {
|
"FACEBOOK": {
|
||||||
"PLACEHOLDER": "Enter the Facebook username",
|
"PLACEHOLDER": "Enter the Facebook username",
|
||||||
@@ -346,5 +357,4 @@
|
|||||||
"ERROR_MESSAGE": "Could not merge contacts, try again!"
|
"ERROR_MESSAGE": "Could not merge contacts, try again!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,34 @@
|
|||||||
:label="$t('CONTACT_FORM.FORM.COMPANY_NAME.LABEL')"
|
:label="$t('CONTACT_FORM.FORM.COMPANY_NAME.LABEL')"
|
||||||
:placeholder="$t('CONTACT_FORM.FORM.COMPANY_NAME.PLACEHOLDER')"
|
:placeholder="$t('CONTACT_FORM.FORM.COMPANY_NAME.PLACEHOLDER')"
|
||||||
/>
|
/>
|
||||||
|
<div class="row">
|
||||||
|
<div class="medium-12 columns">
|
||||||
|
<label>
|
||||||
|
{{ $t('CONTACT_FORM.FORM.COUNTRY.LABEL') }}
|
||||||
|
</label>
|
||||||
|
<multiselect
|
||||||
|
v-model="country"
|
||||||
|
track-by="id"
|
||||||
|
label="name"
|
||||||
|
:placeholder="$t('CONTACT_FORM.FORM.COUNTRY.PLACEHOLDER')"
|
||||||
|
selected-label
|
||||||
|
:select-label="$t('CONTACT_FORM.FORM.COUNTRY.SELECT_PLACEHOLDER')"
|
||||||
|
:deselect-label="$t('CONTACT_FORM.FORM.COUNTRY.REMOVE')"
|
||||||
|
:custom-label="countryNameWithCode"
|
||||||
|
:max-height="160"
|
||||||
|
:options="countries"
|
||||||
|
:allow-empty="true"
|
||||||
|
:option-height="104"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<woot-input
|
||||||
|
v-model="city"
|
||||||
|
class="columns"
|
||||||
|
:label="$t('CONTACT_FORM.FORM.CITY.LABEL')"
|
||||||
|
:placeholder="$t('CONTACT_FORM.FORM.CITY.PLACEHOLDER')"
|
||||||
|
/>
|
||||||
|
|
||||||
<div class="medium-12 columns">
|
<div class="medium-12 columns">
|
||||||
<label>
|
<label>
|
||||||
Social Profiles
|
Social Profiles
|
||||||
@@ -116,6 +144,7 @@ import {
|
|||||||
ExceptionWithMessage,
|
ExceptionWithMessage,
|
||||||
} from 'shared/helpers/CustomErrors';
|
} from 'shared/helpers/CustomErrors';
|
||||||
import { required, email } from 'vuelidate/lib/validators';
|
import { required, email } from 'vuelidate/lib/validators';
|
||||||
|
import countries from 'shared/constants/countries.js';
|
||||||
|
|
||||||
import { isPhoneE164OrEmpty } from 'shared/helpers/Validators';
|
import { isPhoneE164OrEmpty } from 'shared/helpers/Validators';
|
||||||
|
|
||||||
@@ -137,6 +166,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
countries: countries,
|
||||||
companyName: '',
|
companyName: '',
|
||||||
description: '',
|
description: '',
|
||||||
email: '',
|
email: '',
|
||||||
@@ -144,6 +174,11 @@ export default {
|
|||||||
phoneNumber: '',
|
phoneNumber: '',
|
||||||
avatarFile: null,
|
avatarFile: null,
|
||||||
avatarUrl: '',
|
avatarUrl: '',
|
||||||
|
country: {
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
},
|
||||||
|
city: '',
|
||||||
socialProfileUserNames: {
|
socialProfileUserNames: {
|
||||||
facebook: '',
|
facebook: '',
|
||||||
twitter: '',
|
twitter: '',
|
||||||
@@ -172,7 +207,6 @@ export default {
|
|||||||
},
|
},
|
||||||
bio: {},
|
bio: {},
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
contact() {
|
contact() {
|
||||||
this.setContactObject();
|
this.setContactObject();
|
||||||
@@ -188,6 +222,11 @@ export default {
|
|||||||
onSuccess() {
|
onSuccess() {
|
||||||
this.$emit('success');
|
this.$emit('success');
|
||||||
},
|
},
|
||||||
|
countryNameWithCode({ name, id }) {
|
||||||
|
if (!id) return name;
|
||||||
|
if (!name && !id) return '';
|
||||||
|
return `${name} (${id})`;
|
||||||
|
},
|
||||||
setContactObject() {
|
setContactObject() {
|
||||||
const {
|
const {
|
||||||
email: emailAddress,
|
email: emailAddress,
|
||||||
@@ -200,6 +239,13 @@ export default {
|
|||||||
this.email = emailAddress || '';
|
this.email = emailAddress || '';
|
||||||
this.phoneNumber = phoneNumber || '';
|
this.phoneNumber = phoneNumber || '';
|
||||||
this.companyName = additionalAttributes.company_name || '';
|
this.companyName = additionalAttributes.company_name || '';
|
||||||
|
this.country = {
|
||||||
|
id: additionalAttributes.country_code || '',
|
||||||
|
name:
|
||||||
|
additionalAttributes.country ||
|
||||||
|
this.$t('CONTACT_FORM.FORM.COUNTRY.SELECT_COUNTRY'),
|
||||||
|
};
|
||||||
|
this.city = additionalAttributes.city || '';
|
||||||
this.description = additionalAttributes.description || '';
|
this.description = additionalAttributes.description || '';
|
||||||
this.avatarUrl = this.contact.thumbnail || '';
|
this.avatarUrl = this.contact.thumbnail || '';
|
||||||
const {
|
const {
|
||||||
@@ -215,6 +261,12 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
getContactObject() {
|
getContactObject() {
|
||||||
|
if (this.country === null) {
|
||||||
|
this.country = {
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
};
|
||||||
|
}
|
||||||
const contactObject = {
|
const contactObject = {
|
||||||
id: this.contact.id,
|
id: this.contact.id,
|
||||||
name: this.name,
|
name: this.name,
|
||||||
@@ -224,6 +276,13 @@ export default {
|
|||||||
...this.contact.additional_attributes,
|
...this.contact.additional_attributes,
|
||||||
description: this.description,
|
description: this.description,
|
||||||
company_name: this.companyName,
|
company_name: this.companyName,
|
||||||
|
country_code: this.country.id,
|
||||||
|
country:
|
||||||
|
this.country.name ===
|
||||||
|
this.$t('CONTACT_FORM.FORM.COUNTRY.SELECT_COUNTRY')
|
||||||
|
? ''
|
||||||
|
: this.country.name,
|
||||||
|
city: this.city,
|
||||||
social_profiles: this.socialProfileUserNames,
|
social_profiles: this.socialProfileUserNames,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -297,4 +356,10 @@ export default {
|
|||||||
.input-group-label {
|
.input-group-label {
|
||||||
font-size: var(--font-size-small);
|
font-size: var(--font-size-small);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::v-deep {
|
||||||
|
.multiselect .multiselect__tags .multiselect__single {
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user