diff --git a/src/components/MultilingualInput/multilingualInput.css b/src/components/MultilingualInput/multilingualInput.css index 68b8f7b5..bc5421cb 100644 --- a/src/components/MultilingualInput/multilingualInput.css +++ b/src/components/MultilingualInput/multilingualInput.css @@ -27,8 +27,8 @@ } .bilingual-child-wrapper .literal-badge { - top: 11px; - right: 3px; + top: 9px; + right: -3px; } .bilingual-child-wrapper .ant-form-item { diff --git a/src/constants/formFields.js b/src/constants/formFields.js index 2cb9b4bb..2ddcee06 100644 --- a/src/constants/formFields.js +++ b/src/constants/formFields.js @@ -112,7 +112,7 @@ export const formFieldValue = [ ['name', `${contentLanguageKeyMap[language]}`]) ?? []), 'datePicker', 'dateRangePicker', 'datePickerWrapper', @@ -1834,7 +1834,7 @@ function AddEvent() { break; case eventFormRequiredFieldNames.DESCRIPTION: calendarContentLanguage.forEach((language) => { - publishValidateFields.push(['editor', [contentLanguageKeyMap[language]]]); + publishValidateFields.push(['editor', contentLanguageKeyMap[language]]); }); setDescriptionMinimumWordCount( requiredField?.rule?.minimumWordCount ? Number(requiredField?.rule?.minimumWordCount) : 1, @@ -2955,7 +2955,7 @@ function AddEvent() { data={eventData?.description} form={form} calendarContentLanguage={calendarContentLanguage} - name={['editor']} + name={'editor'} required={requiredFieldNames?.includes(eventFormRequiredFieldNames?.DESCRIPTION)} placeholder={placeHolderCollectionCreator({ calendarContentLanguage, diff --git a/src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx b/src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx index 234150f7..25c11d99 100644 --- a/src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx +++ b/src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx @@ -715,20 +715,6 @@ function CreateNewPlace() { const handleSelect = (address) => { geocodeByAddress(address) .then((results) => { - form.setFieldsValue({ - address: results[0]?.formatted_address, - addressCountry: results[0].address_components.find((item) => item.types.includes('country'))?.long_name, - addressCountryEn: results[0].address_components.find((item) => item.types.includes('country'))?.long_name, - addressLocality: results[0].address_components.find((item) => item.types.includes('locality'))?.long_name, - addressLocalityEn: results[0].address_components.find((item) => item.types.includes('locality'))?.long_name, - addressRegion: results[0].address_components.find((item) => - item.types.includes('administrative_area_level_1'), - )?.short_name, - addressRegionEn: results[0].address_components.find((item) => - item.types.includes('administrative_area_level_1'), - )?.short_name, - postalCode: results[0].address_components.find((item) => item.types.includes('postal_code'))?.long_name, - }); let streetNumber = results[0].address_components.find((item) => item.types.includes('street_number'))?.long_name ?? null; let streetName = results[0].address_components.find((item) => item.types.includes('route'))?.long_name ?? null; @@ -737,10 +723,31 @@ function CreateNewPlace() { else if (streetNumber && !streetName) streetAddress = streetNumber; else if (!streetNumber && streetName) streetAddress = streetName; else if (!streetNumber && !streetName) streetAddress = null; - form.setFieldsValue({ - streetAddress: streetAddress, - streetAddressEn: streetAddress, + + calendarContentLanguage.forEach((language) => { + const langKey = contentLanguageKeyMap[language]; + form.setFieldValue([formFieldNames.STREET_ADDRESS, langKey], streetAddress); + form.setFieldValue( + [formFieldNames.COUNTRY, langKey], + results[0].address_components.find((item) => item.types.includes('country'))?.long_name, + ); + + form.setFieldValue( + [formFieldNames.CITY, langKey], + results[0].address_components.find((item) => item.types.includes('locality'))?.long_name, + ); + form.setFieldValue( + [formFieldNames.PROVINCE, langKey], + results[0].address_components.find((item) => item.types.includes('administrative_area_level_1')) + ?.short_name, + ); }); + + form.setFieldValue( + formFieldNames.POSTAL_CODE, + results[0].address_components.find((item) => item.types.includes('postal_code'))?.long_name, + ); + return getLatLng(results[0]); }) .then((latLng) => { @@ -1161,7 +1168,7 @@ function CreateNewPlace() { break; case placeFormRequiredFieldNames.DESCRIPTION: calendarContentLanguage.forEach((language) => { - publishValidateFields.push([formFieldNames.DESCRIPTION, [contentLanguageKeyMap[language]]]); + publishValidateFields.push([formFieldNames.DESCRIPTION, contentLanguageKeyMap[language]]); }); // setDescriptionMinimumWordCount(Number(requiredField?.rule?.minimumWordCount)); break; @@ -1170,7 +1177,7 @@ function CreateNewPlace() { break; case placeFormRequiredFieldNames.STREET_ADDRESS: calendarContentLanguage.forEach((language) => { - publishValidateFields.push([formFieldNames.STREET_ADDRESS, [contentLanguageKeyMap[language]]]); + publishValidateFields.push([formFieldNames.STREET_ADDRESS, contentLanguageKeyMap[language]]); }); break; case placeFormRequiredFieldNames.DISAMBIGUATING_DESCRIPTION: @@ -1231,7 +1238,7 @@ function CreateNewPlace() { } else if (newEntityName) { calendarContentLanguage.forEach((language) => { const langKey = contentLanguageKeyMap[language]; - form.setFieldValue([[formFieldNames.NAME], `${langKey}`], newEntityName); + form.setFieldValue([formFieldNames.NAME, `${langKey}`], newEntityName); }); } }, []); @@ -1392,7 +1399,7 @@ function CreateNewPlace() { entityId={placeId} calendarContentLanguage={calendarContentLanguage} form={form} - name={[formFieldNames.NAME]} + name={formFieldNames.NAME} data={ placeData?.name ? placeData?.name @@ -1496,7 +1503,7 @@ function CreateNewPlace() { entityId={placeId} calendarContentLanguage={calendarContentLanguage} form={form} - name={[formFieldNames.DISAMBIGUATING_DESCRIPTION]} + name={formFieldNames.DISAMBIGUATING_DESCRIPTION} data={ placeData?.disambiguatingDescription ? placeData?.disambiguatingDescription @@ -1543,7 +1550,7 @@ function CreateNewPlace() { } form={form} calendarContentLanguage={calendarContentLanguage} - name={[formFieldNames.DESCRIPTION]} + name={formFieldNames.DESCRIPTION} placeholder={placeHolderCollectionCreator({ calendarContentLanguage, t, @@ -1778,7 +1785,7 @@ function CreateNewPlace() { entityId={placeId} calendarContentLanguage={calendarContentLanguage} form={form} - name={[formFieldNames.STREET_ADDRESS]} + name={formFieldNames.STREET_ADDRESS} data={ placeData?.address?.streetAddress ? placeData?.address?.streetAddress @@ -1816,7 +1823,7 @@ function CreateNewPlace() { entityId={placeId} calendarContentLanguage={calendarContentLanguage} form={form} - name={[formFieldNames.CITY]} + name={formFieldNames.CITY} data={ placeData?.address?.addressLocality ? placeData?.address?.addressLocality @@ -1884,7 +1891,7 @@ function CreateNewPlace() { entityId={placeId} calendarContentLanguage={calendarContentLanguage} form={form} - name={[formFieldNames.PROVINCE]} + name={formFieldNames.PROVINCE} data={ placeData?.address?.addressRegion ? placeData?.address?.addressRegion @@ -1924,7 +1931,7 @@ function CreateNewPlace() { entityId={placeId} calendarContentLanguage={calendarContentLanguage} form={form} - name={[formFieldNames.COUNTRY]} + name={formFieldNames.COUNTRY} data={ placeData?.address?.addressCountry ? placeData?.address?.addressCountry @@ -2625,7 +2632,7 @@ function CreateNewPlace() { entityId={placeId} calendarContentLanguage={calendarContentLanguage} form={form} - name={[formFieldNames.ACCESSIBILITY_NOTE]} + name={formFieldNames.ACCESSIBILITY_NOTE} data={placeData?.accessibilityNote} required={false} validations={t('common.validations.informationRequired')}