diff --git a/src/locales/en/translationEn.json b/src/locales/en/translationEn.json index ccdff5cb1..b1872decd 100644 --- a/src/locales/en/translationEn.json +++ b/src/locales/en/translationEn.json @@ -540,7 +540,16 @@ "secondPart": "create a new place", "thirdPart": " and do not select this data source." }, - "name": "Place Name", + "name": { + "name": "Place Name", + "placeholder": { + "english": "Enter place name", + "french": "Enter place name" + } + }, + "placeType": { + "placeholder": "Select place type" + }, "dataSource": "Data source", "address": { @@ -578,9 +587,13 @@ "coordinates": { "coordinates": "Coordinates" }, + "region": { + "placeholder": "Select region" + }, "openingHours": { "openingHours": "Opening hours link", - "tooltip": "Add a link to the opening hours" + "tooltip": "Add a link to the opening hours", + "placeholder": "Enter opening hours URL" } }, "containedInPlace": { @@ -592,11 +605,12 @@ "venueAccessibility": { "venueAccessibility": "Venue accessibility", "subheading": "These accessibility items will be displayed in all the event located at this venue.", + "placeholder": "Select accessibility items", "placeAccessibilityNote": { "note": "Note", "placeholder": { - "english": "", - "french": "" + "english": "Enter a note", + "french": "Enter a note" }, "tooltip": "Add supplementary accessibility information." } diff --git a/src/locales/fr/transalationFr.json b/src/locales/fr/transalationFr.json index 79340b4e0..78a39ff45 100644 --- a/src/locales/fr/transalationFr.json +++ b/src/locales/fr/transalationFr.json @@ -538,7 +538,16 @@ "secondPart": "créez une nouvelle lieu", "thirdPart": " et ne sélectionnez pas cette source de données." }, - "name": "Nom du lieu", + "name": { + "name": "Nom du lieu", + "placeholder": { + "english": "Entrez le nom du lieu", + "french": "Entrez le nom du lieu" + } + }, + "placeType": { + "placeholder": "Sélectionnez le type de lieu" + }, "address": { "address": "Adresse", "searchAddressDescription": "Entrer le nom du lieu et/ou l'adresse.", @@ -574,9 +583,13 @@ "coordinates": { "coordinates": "Coordonnées" }, + "region": { + "placeholder": "Sélectionnez le région" + }, "openingHours": { "openingHours": "Lien des heures d'ouverture", - "tooltip": "Ajoutez un lien vers les heures d'ouverture" + "tooltip": "Ajoutez un lien vers les heures d'ouverture", + "placeholder": "Entrez l'url des heures d'ouverture" } }, "containedInPlace": { @@ -587,12 +600,13 @@ }, "venueAccessibility": { "venueAccessibility": "Accessibilité du site", + "placeholder": "Sélectionner un élément", "subheading": "Ces éléments d'accessibilité seront affichés dans tous les événements se déroulant dans ce lieu.", "placeAccessibilityNote": { "note": "Note", "placeholder": { - "english": "", - "french": "" + "english": "Ajouter une note", + "french": "Ajouter une note" }, "tooltip": "Ajoutez des informations supplémentaires sur l'accessibilité." } @@ -609,7 +623,7 @@ }, "image": { "image": "Image", - "subheading": "Only .jpeg and .png files are accepted." + "subheading": "Uniquement les fichiers .jpeg et .png sont acceptés." }, "addMoreDetails": "Ajouter plus de détails", "dataSource": "Source de la donnée", diff --git a/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx b/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx index 957f877f7..2828cf86a 100644 --- a/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx +++ b/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx @@ -133,7 +133,7 @@ function CreateNewOrganization() { } else { organizationObj = { ...organizationObj, - sameAs: organizationObj?.sameAs, + sameAs: organizationData?.sameAs, }; updateOrganization({ data: organizationObj, diff --git a/src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx b/src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx index 2545db7a4..bd7fe64c0 100644 --- a/src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx +++ b/src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx @@ -62,7 +62,7 @@ import { import { urlProtocolCheck } from '../../../components/Input/Common/input.settings'; import { useAddImageMutation } from '../../../services/image'; import { usePrompt } from '../../../hooks/usePrompt'; -import { useAddPostalAddressMutation } from '../../../services/postalAddress'; +import { useAddPostalAddressMutation, useUpdatePostalAddressMutation } from '../../../services/postalAddress'; import PlacesAutocomplete, { geocodeByAddress, getLatLng } from 'react-places-autocomplete'; const { TextArea } = Input; @@ -130,6 +130,7 @@ function CreateNewPlace() { const [addPostalAddress] = useAddPostalAddressMutation(); const [getPlace] = useLazyGetPlaceQuery(); const [getAllTaxonomy] = useLazyGetAllTaxonomyQuery({ sessionId: timestampRef }); + const [updatePostalAddress] = useUpdatePostalAddressMutation(); const reactQuillRefFr = useRef(null); const reactQuillRefEn = useRef(null); @@ -151,7 +152,7 @@ function CreateNewPlace() { usePrompt(t('common.unsavedChanges'), showDialog); - const addUpdatePlaceApiHandler = (placeObj) => { + const addUpdatePlaceApiHandler = (placeObj, postalObj) => { var promise = new Promise(function (resolve, reject) { if (!placeId || placeId === '') { if (artsDataId && artsData) { @@ -167,52 +168,115 @@ function CreateNewPlace() { sameAs: [artsData?.sameAs], }; } - addPlace({ - data: placeObj, - calendarId, - }) + addPostalAddress({ data: postalObj, calendarId }) .unwrap() .then((response) => { - resolve(response?.id); - notification.success({ - description: t('dashboard.places.createNew.addPlace.notification.addSuccess'), - placement: 'top', - closeIcon: <>, - maxCount: 1, - duration: 3, - }); - navigate(`${PathName.Dashboard}/${calendarId}${PathName.Places}`); + if (response && response?.statusCode == 202) { + placeObj = { + ...placeObj, + postalAddressId: { + entityId: response?.data?.id, + }, + }; + addPlace({ + data: placeObj, + calendarId, + }) + .unwrap() + .then((response) => { + resolve(response?.id); + notification.success({ + description: t('dashboard.places.createNew.addPlace.notification.addSuccess'), + placement: 'top', + closeIcon: <>, + maxCount: 1, + duration: 3, + }); + navigate(`${PathName.Dashboard}/${calendarId}${PathName.Places}`); + }) + .catch((errorInfo) => { + reject(); + console.log(errorInfo); + }); + } }) - .catch((errorInfo) => { - reject(); - console.log(errorInfo); - }); + .catch((error) => console.log(error)); } else { placeObj = { ...placeObj, sameAs: placeData?.sameAs, }; - updatePlace({ - data: placeObj, - calendarId, - placeId, - }) - .unwrap() - .then(() => { - resolve(placeId); - notification.success({ - description: t('dashboard.places.createNew.addPlace.notification.editSuccess'), - placement: 'top', - closeIcon: <>, - maxCount: 1, - duration: 3, - }); - navigate(`${PathName.Dashboard}/${calendarId}${PathName.Places}`); - }) - .catch((error) => { - reject(); - console.log(error); - }); + if (!placeData?.address) { + addPostalAddress({ data: postalObj, calendarId }) + .unwrap() + .then((response) => { + if (response && response?.statusCode == 202) { + placeObj = { + ...placeObj, + postalAddressId: { + entityId: response?.data?.id, + }, + }; + updatePlace({ + data: placeObj, + calendarId, + placeId, + }) + .unwrap() + .then(() => { + resolve(placeId); + notification.success({ + description: t('dashboard.places.createNew.addPlace.notification.editSuccess'), + placement: 'top', + closeIcon: <>, + maxCount: 1, + duration: 3, + }); + navigate(`${PathName.Dashboard}/${calendarId}${PathName.Places}`); + }) + .catch((error) => { + reject(); + console.log(error); + }); + } + }) + .catch((error) => console.log(error)); + } else { + updatePostalAddress({ data: postalObj, calendarId, id: placeData?.address?.id }) + .unwrap() + .then((response) => { + if (response && response?.statusCode == 202) { + placeObj = { + ...placeObj, + postalAddressId: { + entityId: placeData?.address?.id, + }, + }; + updatePlace({ + data: placeObj, + calendarId, + placeId, + }) + .unwrap() + .then(() => { + resolve(placeId); + notification.success({ + description: t('dashboard.places.createNew.addPlace.notification.editSuccess'), + placement: 'top', + closeIcon: <>, + maxCount: 1, + duration: 3, + }); + navigate(`${PathName.Dashboard}/${calendarId}${PathName.Places}`); + }) + .catch((error) => { + reject(); + console.log(error); + }); + } + }) + .catch((error) => console.log(error)); + } } }); return promise; @@ -369,19 +433,12 @@ function CreateNewPlace() { }, }; placeObj['image'] = imageCrop; - addPostalAddress({ data: postalObj, calendarId }) - .unwrap() - .then((response) => { - if (response && response?.statusCode == 202) { - addUpdatePlaceApiHandler(placeObj) - .then((id) => resolve(id)) - .catch((error) => { - reject(); - console.log(error); - }); - } - }) - .catch((error) => console.log(error)); + addUpdatePlaceApiHandler(placeObj, postalObj) + .then((id) => resolve(id)) + .catch((error) => { + reject(); + console.log(error); + }); }) .catch((error) => { console.log(error); @@ -394,19 +451,12 @@ function CreateNewPlace() { else placeObj['image'] = imageCrop; } - addPostalAddress({ data: postalObj, calendarId }) - .unwrap() - .then((response) => { - if (response && response?.statusCode == 202) { - addUpdatePlaceApiHandler(placeObj) - .then((id) => resolve(id)) - .catch((error) => { - reject(); - console.log(error); - }); - } - }) - .catch((error) => console.log(error)); + addUpdatePlaceApiHandler(placeObj, postalObj) + .then((id) => resolve(id)) + .catch((error) => { + reject(); + console.log(error); + }); } }) .catch((error) => { @@ -713,7 +763,7 @@ function CreateNewPlace() { )} - +