From 52362ec1ea7463a939970f0a5f8618f32164d7da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Kube=C5=A1?= <46596180+KubesDavid@users.noreply.github.com> Date: Wed, 22 Jan 2025 17:00:51 +0100 Subject: [PATCH] fix: country selection (#10670) --- .../Contacts/ContactsForm/ContactsForm.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/javascript/dashboard/components-next/Contacts/ContactsForm/ContactsForm.vue b/app/javascript/dashboard/components-next/Contacts/ContactsForm/ContactsForm.vue index 9d172cdf9..3f3bffdf5 100644 --- a/app/javascript/dashboard/components-next/Contacts/ContactsForm/ContactsForm.vue +++ b/app/javascript/dashboard/components-next/Contacts/ContactsForm/ContactsForm.vue @@ -35,7 +35,7 @@ const FORM_CONFIG = { EMAIL_ADDRESS: { field: 'email' }, PHONE_NUMBER: { field: 'phoneNumber' }, CITY: { field: 'additionalAttributes.city' }, - COUNTRY: { field: 'additionalAttributes.country' }, + COUNTRY: { field: 'additionalAttributes.countryCode' }, BIO: { field: 'additionalAttributes.description' }, COMPANY_NAME: { field: 'additionalAttributes.companyName' }, }; @@ -123,7 +123,7 @@ const prepareStateBasedOnProps = () => { }; const countryOptions = computed(() => - countries.map(({ name }) => ({ label: name, value: name })) + countries.map(({ name, id }) => ({ label: name, value: id })) ); const editDetailsForm = computed(() => @@ -205,8 +205,8 @@ const getMessageType = key => { }; const handleCountrySelection = value => { - const selectedCountry = countries.find(option => option.name === value); - state.additionalAttributes.countryCode = selectedCountry?.id || ''; + const selectedCountry = countries.find(option => option.id === value); + state.additionalAttributes.country = selectedCountry?.name || ''; emit('update', state); }; @@ -242,7 +242,7 @@ defineExpose({