From e43482f13d3eda1eff6cce8a2db65dcaaa22aa8b Mon Sep 17 00:00:00 2001 From: Abhishek P Anil Date: Tue, 11 Jul 2023 18:23:55 +0530 Subject: [PATCH 1/8] feat: added api layout and api integration for org read only --- src/pages/CreateAccount/index.js | 1 + src/pages/Dashboard/Dashboard.jsx | 1 + .../Dashboard/EventReadOnly/EventReadOnly.jsx | 32 ++-- .../Dashboard/Organizations/Organizations.jsx | 9 +- .../OrganizationsReadOnly.jsx | 139 ++++++++++++++++++ .../Dashboard/OrganizationsReadOnly/index.js | 1 + .../organizationsReadOnly.css | 0 src/router/index.js | 6 +- src/services/organization.js | 1 + 9 files changed, 169 insertions(+), 21 deletions(-) create mode 100644 src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx create mode 100644 src/pages/Dashboard/OrganizationsReadOnly/index.js create mode 100644 src/pages/Dashboard/OrganizationsReadOnly/organizationsReadOnly.css diff --git a/src/pages/CreateAccount/index.js b/src/pages/CreateAccount/index.js index e69de29bb..936430fd2 100644 --- a/src/pages/CreateAccount/index.js +++ b/src/pages/CreateAccount/index.js @@ -0,0 +1 @@ +export { default } from './CreateAccount'; diff --git a/src/pages/Dashboard/Dashboard.jsx b/src/pages/Dashboard/Dashboard.jsx index 46a3ad995..58fe3c90e 100644 --- a/src/pages/Dashboard/Dashboard.jsx +++ b/src/pages/Dashboard/Dashboard.jsx @@ -23,6 +23,7 @@ function Dashboard() { const timestampRef = useRef(Date.now()).current; const { accessToken, user } = useSelector(getUserDetails); const [getCalendar, { currentData: currentCalendarData }] = useLazyGetCalendarQuery(); + const { currentData: allCalendarsData, isLoading } = useGetAllCalendarsQuery( { sessionId: timestampRef }, { skip: accessToken ? false : true }, diff --git a/src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx b/src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx index 9cc7cb5e1..05edb2039 100644 --- a/src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx +++ b/src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx @@ -147,24 +147,20 @@ function EventReadOnly() {
- - - - - - {t('dashboard.sidebar.events')} - - - {contentLanguageBilingual({ - en: eventData?.name?.en, - fr: eventData?.name?.fr, - interfaceLanguage: user?.interfaceLanguage?.toLowerCase(), - calendarContentLanguage: calendarContentLanguage, - })} - - - - + + + + {t('dashboard.sidebar.events')} + + + {contentLanguageBilingual({ + en: eventData?.name?.en, + fr: eventData?.name?.fr, + interfaceLanguage: user?.interfaceLanguage?.toLowerCase(), + calendarContentLanguage: calendarContentLanguage, + })} + + diff --git a/src/pages/Dashboard/Organizations/Organizations.jsx b/src/pages/Dashboard/Organizations/Organizations.jsx index 1049e050d..0745655ac 100644 --- a/src/pages/Dashboard/Organizations/Organizations.jsx +++ b/src/pages/Dashboard/Organizations/Organizations.jsx @@ -13,7 +13,7 @@ import NoContent from '../../../components/NoContent/NoContent'; import ListItem from '../../../components/List/ListItem.jsx/ListItem'; import { useDeleteOrganizationMutation, useLazyGetAllOrganizationQuery } from '../../../services/organization'; import LoadingIndicator from '../../../components/LoadingIndicator/LoadingIndicator'; -import { useOutletContext, useParams } from 'react-router-dom'; +import { useLocation, useNavigate, useOutletContext, useParams } from 'react-router-dom'; import { contentLanguageBilingual } from '../../../utils/bilingual'; import { useSelector } from 'react-redux'; import { getUserDetails } from '../../../redux/reducer/userSlice'; @@ -25,6 +25,8 @@ const { useBreakpoint } = Grid; function Organizations() { const { t } = useTranslation(); + const navigate = useNavigate(); + const location = useLocation(); const screens = useBreakpoint(); const timestampRef = useRef(Date.now()).current; const { calendarId } = useParams(); @@ -67,6 +69,10 @@ function Organizations() { else return false; }; + const listItemHandler = (id) => { + navigate(`${location.pathname}/${id}`); + }; + useEffect(() => { getAllOrganization({ calendarId, @@ -132,6 +138,7 @@ function Organizations() { createdByFirstName={item?.creator?.firstName} createdByLastName={item?.creator?.lastName} artsDataLink={artsDataLinkChecker(item?.sameAs)} + listItemHandler={() => listItemHandler(item?.id)} actions={[ adminCheckHandler() && ( { + if (organizationError) navigate(`${PathName.NotFound}`); + }, [organizationError]); + + console.log(organizationData); + + return ( + organizationSuccess && + !organizationLoading && ( + + + + + + {t('dashboard.sidebar.events')} + + + + + + + +
+

haiii

+

+ {contentLanguageBilingual({ + en: organizationData?.disambiguatingDescription?.en, + fr: organizationData?.disambiguatingDescription?.fr, + interfaceLanguage: user?.interfaceLanguage?.toLowerCase(), + calendarContentLanguage: calendarContentLanguage, + })} +

+
+ +
+ + + <> +

+ {t('dashboard.events.addEditEvent.language.title')} +

+

{t('common.tabFrench')}

+

{organizationData?.name?.fr}

+

{t('common.tabEnglish')}

+

{organizationData?.name?.en}

+ +

+ {t('dashboard.events.addEditEvent.language.title')} +

+

{t('common.tabFrench')}

+

{organizationData?.disambiguatingDescription?.fr}

+

{t('common.tabEnglish')}

+

{organizationData?.disambiguatingDescription?.en}

+ +

+ {t('dashboard.events.addEditEvent.language.title')} +

+

{t('common.tabFrench')}

+

+

+

+

{t('common.tabEnglish')}

+

+

+

+ +

+ {t('dashboard.events.addEditEvent.language.title')} +

+

+ + {organizationData?.url?.uri} + +

+ +

+ {t('dashboard.events.addEditEvent.language.title')} +

+

{t('common.tabFrench')}

+

{organizationData?.contactPoint?.name?.fr}

+

{t('common.tabEnglish')}

+

{organizationData?.contactPoint?.name?.en}

+

{t('common.tabFrench')}

+

+ + {organizationData?.contactPoint?.url?.uri} + +

+

{t('common.tabFrench')}

+

{organizationData?.contactPoint?.telephone}

+

{t('common.tabFrench')}

+

{organizationData?.contactPoint?.email}

+ + <> + + + ) + ); +} + +export default OrganizationsReadOnly; diff --git a/src/pages/Dashboard/OrganizationsReadOnly/index.js b/src/pages/Dashboard/OrganizationsReadOnly/index.js new file mode 100644 index 000000000..5a7e697d6 --- /dev/null +++ b/src/pages/Dashboard/OrganizationsReadOnly/index.js @@ -0,0 +1 @@ +export { default } from './OrganizationsReadOnly'; diff --git a/src/pages/Dashboard/OrganizationsReadOnly/organizationsReadOnly.css b/src/pages/Dashboard/OrganizationsReadOnly/organizationsReadOnly.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/router/index.js b/src/router/index.js index 3efaa533f..05b395368 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,11 +8,12 @@ import Events from '../pages/Dashboard/Events'; import AddEvent from '../pages/Dashboard/AddEvent'; import { ReactComponent as NotFound } from '../../src/assets/images/illustatus.svg'; import EventReadOnly from '../pages/Dashboard/EventReadOnly'; -import CreateAccount from '../pages/CreateAccount/CreateAccount'; +import CreateAccount from '../pages/CreateAccount'; import Users from '../pages/Dashboard/Users'; import Organizations from '../pages/Dashboard/Organizations'; import Places from '../pages/Dashboard/Places'; -import People from '../pages/Dashboard/People/People'; +import People from '../pages/Dashboard/People'; +import OrganizationsReadOnly from '../pages/Dashboard/OrganizationsReadOnly'; export const router = createBrowserRouter([ { @@ -71,6 +72,7 @@ export const router = createBrowserRouter([ path: `:calendarId${PathName.Organizations}`, element: , }, + { path: `:calendarId${PathName.Organizations}/:organizationId`, element: }, { path: `:calendarId${PathName.People}`, element: , diff --git a/src/services/organization.js b/src/services/organization.js index 7b4a26069..d4232cda2 100644 --- a/src/services/organization.js +++ b/src/services/organization.js @@ -53,6 +53,7 @@ export const organizationApi = createApi({ export const { useAddOrganizationMutation, useLazyGetOrganizationQuery, + useGetOrganizationQuery, useLazyGetAllOrganizationQuery, useDeleteOrganizationMutation, } = organizationApi; From 490f9668081bf58f749f0f6c92d3587a757f7b1a Mon Sep 17 00:00:00 2001 From: Abhishek P Anil Date: Wed, 12 Jul 2023 12:22:21 +0530 Subject: [PATCH 2/8] feat: translation and minor css changes added for read only page --- src/locales/en/translationEn.json | 14 ++ src/locales/fr/transalationFr.json | 14 ++ .../OrganizationsReadOnly.jsx | 161 +++++++++++------- 3 files changed, 127 insertions(+), 62 deletions(-) diff --git a/src/locales/en/translationEn.json b/src/locales/en/translationEn.json index 3942d242f..49d4d1719 100644 --- a/src/locales/en/translationEn.json +++ b/src/locales/en/translationEn.json @@ -395,6 +395,20 @@ "description": "Are you sure you want to permanently delete this organization?", "ok": "OK", "cancel": "Cancel" + }, + "readOnly": { + "details": "Details", + "name": "Name", + "disambiguatingDescription": "Disambiguating description", + "description": "Description", + "website": "Website", + "contact": "Contact", + "frenchContactTitle": "French contact title", + "englishContactTitle": "English contact title", + "phoneNumber": "Phone number", + "email": "Email", + "memberOf": "Member of", + "location": "Location" } }, "places": { diff --git a/src/locales/fr/transalationFr.json b/src/locales/fr/transalationFr.json index 60b89bf3e..f896e93a4 100644 --- a/src/locales/fr/transalationFr.json +++ b/src/locales/fr/transalationFr.json @@ -394,6 +394,20 @@ "description": "Êtes-vous sûr de vouloir supprimer définitivement cet organisation?", "ok": "OK", "cancel": "Annuler" + }, + "readOnly": { + "details": "Détails", + "name": "Nom", + "disambiguatingDescription": "Description identifiante", + "description": "Description", + "website": "Site web", + "contact": "Contact", + "frenchContactTitle": "Titre du contact en français", + "englishContactTitle": "Titre du contact en anglais", + "phoneNumber": "Numéro de téléphone", + "email": "Courriel", + "memberOf": "Membre de", + "location": "Endroit" } }, "places": { diff --git a/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx b/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx index e5bad9cd8..b1478dc29 100644 --- a/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx +++ b/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx @@ -46,7 +46,15 @@ function OrganizationsReadOnly() { - {t('dashboard.sidebar.events')} + {t('dashboard.organization.organizations')} + + + {contentLanguageBilingual({ + en: organizationData?.name?.en, + fr: organizationData?.name?.fr, + interfaceLanguage: user?.interfaceLanguage?.toLowerCase(), + calendarContentLanguage: calendarContentLanguage, + })} @@ -55,7 +63,15 @@ function OrganizationsReadOnly() {
-

haiii

+

+ {' '} + {contentLanguageBilingual({ + en: organizationData?.name?.en, + fr: organizationData?.name?.fr, + interfaceLanguage: user?.interfaceLanguage?.toLowerCase(), + calendarContentLanguage: calendarContentLanguage, + })} +

{contentLanguageBilingual({ en: organizationData?.disambiguatingDescription?.en, @@ -69,66 +85,87 @@ function OrganizationsReadOnly() { - <> -

- {t('dashboard.events.addEditEvent.language.title')} -

-

{t('common.tabFrench')}

-

{organizationData?.name?.fr}

-

{t('common.tabEnglish')}

-

{organizationData?.name?.en}

- -

- {t('dashboard.events.addEditEvent.language.title')} -

-

{t('common.tabFrench')}

-

{organizationData?.disambiguatingDescription?.fr}

-

{t('common.tabEnglish')}

-

{organizationData?.disambiguatingDescription?.en}

- -

- {t('dashboard.events.addEditEvent.language.title')} -

-

{t('common.tabFrench')}

-

-

-

-

{t('common.tabEnglish')}

-

-

-

- -

- {t('dashboard.events.addEditEvent.language.title')} -

-

- - {organizationData?.url?.uri} - -

- -

- {t('dashboard.events.addEditEvent.language.title')} -

-

{t('common.tabFrench')}

-

{organizationData?.contactPoint?.name?.fr}

-

{t('common.tabEnglish')}

-

{organizationData?.contactPoint?.name?.en}

-

{t('common.tabFrench')}

-

- - {organizationData?.contactPoint?.url?.uri} - -

-

{t('common.tabFrench')}

-

{organizationData?.contactPoint?.telephone}

-

{t('common.tabFrench')}

-

{organizationData?.contactPoint?.email}

- + + + +

+ {t('dashboard.organization.readOnly.details')} +

+ + +

{t('dashboard.organization.readOnly.name')}

+

{t('common.tabFrench')}

+

{organizationData?.name?.fr}

+

{t('common.tabEnglish')}

+

{organizationData?.name?.en}

+ + +

+ {t('dashboard.organization.readOnly.disambiguatingDescription')} +

+

{t('common.tabFrench')}

+

{organizationData?.disambiguatingDescription?.fr}

+

{t('common.tabEnglish')}

+

{organizationData?.disambiguatingDescription?.en}

+ + +

+ {t('dashboard.organization.readOnly.description')} +

+

{t('common.tabFrench')}

+

+

+

+

{t('common.tabEnglish')}

+

+

+

+ + +

+ {t('dashboard.organization.readOnly.website')} +

+

+ + {organizationData?.url?.uri} + +

+ + +

+ {t('dashboard.organization.readOnly.contact')} +

+

+ {t('dashboard.organization.readOnly.frenchContactTitle')} +

+

{organizationData?.contactPoint?.name?.fr}

+

+ {t('dashboard.organization.readOnly.englishContactTitle')} +

+

{organizationData?.contactPoint?.name?.en}

+

+ {t('dashboard.organization.readOnly.website')} +

+

+ + {organizationData?.contactPoint?.url?.uri} + +

+

+ {t('dashboard.organization.readOnly.phoneNumber')} +

+

{organizationData?.contactPoint?.telephone}

+

+ {t('dashboard.organization.readOnly.email')} +

+

{organizationData?.contactPoint?.email}

+ + + <> From a5394f8c9472643415c5bb9081a7670e44035d8a Mon Sep 17 00:00:00 2001 From: Abhishek P Anil Date: Wed, 12 Jul 2023 14:52:54 +0530 Subject: [PATCH 3/8] feat: added location place component with integration --- .../OrganizationsReadOnly.jsx | 87 +++++++++++++++++-- src/services/places.js | 14 ++- 2 files changed, 91 insertions(+), 10 deletions(-) diff --git a/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx b/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx index b1478dc29..9ca8c023d 100644 --- a/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx +++ b/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useRef } from 'react'; +import React, { useEffect, useRef, useState } from 'react'; import './organizationsReadOnly.css'; import Card from '../../../components/Card/Common/Event'; import { useTranslation } from 'react-i18next'; @@ -10,6 +10,11 @@ import { PathName } from '../../../constants/pathName'; import { contentLanguageBilingual } from '../../../utils/bilingual'; import { useSelector } from 'react-redux'; import { getUserDetails } from '../../../redux/reducer/userSlice'; +import { useLazyGetPlaceQuery } from '../../../services/places'; +import SelectionItem from '../../../components/List/SelectionItem/SelectionItem'; +import { taxonomyClass } from '../../../constants/taxonomyClass'; +import { useLazyGetAllTaxonomyQuery } from '../../../services/taxonomy'; +import { placesOptions } from '../../../components/Select/selectOption.settings'; function OrganizationsReadOnly() { const { t } = useTranslation(); @@ -28,8 +33,13 @@ function OrganizationsReadOnly() { { skip: organizationId ? false : true }, ); + const [getPlace] = useLazyGetPlaceQuery(); + const [getAllTaxonomy] = useLazyGetAllTaxonomyQuery(); + const { user } = useSelector(getUserDetails); + const [locationPlace, setLocationPlace] = useState(); + const calendarContentLanguage = currentCalendarData?.contentLanguage; useEffect(() => { @@ -38,6 +48,50 @@ function OrganizationsReadOnly() { console.log(organizationData); + useEffect(() => { + if (organizationSuccess) { + if (organizationData?.place?.entityId) { + let initialPlace = []; + let initialPlaceAccessibiltiy = []; + getPlace({ placeId: organizationData?.place?.entityId, calendarId }) + .unwrap() + .then((response) => { + initialPlace = [response]; + initialPlace[0] = { + ...initialPlace[0], + ['openingHours']: initialPlace[0]?.openingHours?.uri, + }; + getAllTaxonomy({ + calendarId, + search: '', + taxonomyClass: taxonomyClass.PLACE, + includeConcepts: true, + }) + .unwrap() + .then((res) => { + res?.data?.forEach((taxonomy) => { + if (taxonomy?.mappedToField === 'PlaceAccessibility') { + response?.accessibility?.forEach((accessibility) => { + taxonomy?.concept?.forEach((concept) => { + if (concept?.id == accessibility?.entityId) { + initialPlaceAccessibiltiy = initialPlaceAccessibiltiy?.concat([concept]); + } + }); + }); + } + }); + initialPlace[0] = { + ...initialPlace[0], + ['accessibility']: initialPlaceAccessibiltiy, + }; + setLocationPlace(placesOptions(initialPlace, user, calendarContentLanguage)[0]); + }) + .catch((error) => console.log(error)); + }); + } + } + }, [organizationSuccess]); + return ( organizationSuccess && !organizationLoading && ( @@ -64,7 +118,6 @@ function OrganizationsReadOnly() {

- {' '} {contentLanguageBilingual({ en: organizationData?.name?.en, fr: organizationData?.name?.fr, @@ -87,19 +140,19 @@ function OrganizationsReadOnly() { - +

{t('dashboard.organization.readOnly.details')}

- +

{t('dashboard.organization.readOnly.name')}

{t('common.tabFrench')}

{organizationData?.name?.fr}

{t('common.tabEnglish')}

{organizationData?.name?.en}

- +

{t('dashboard.organization.readOnly.disambiguatingDescription')}

@@ -108,7 +161,7 @@ function OrganizationsReadOnly() {

{t('common.tabEnglish')}

{organizationData?.disambiguatingDescription?.en}

- +

{t('dashboard.organization.readOnly.description')}

@@ -120,8 +173,6 @@ function OrganizationsReadOnly() {

- -

{t('dashboard.organization.readOnly.website')}

@@ -131,7 +182,7 @@ function OrganizationsReadOnly() {

- +

{t('dashboard.organization.readOnly.contact')}

@@ -164,6 +215,24 @@ function OrganizationsReadOnly() {

{organizationData?.contactPoint?.email}

+ +

+ {t('dashboard.organization.readOnly.location')} +

+ {locationPlace && ( + + )} + <> diff --git a/src/services/places.js b/src/services/places.js index 648476348..024863679 100644 --- a/src/services/places.js +++ b/src/services/places.js @@ -28,7 +28,19 @@ export const placesApi = createApi({ }), invalidatesTags: (result, error, arg) => [{ type: 'Places', id: arg.id }], }), + getPlace: builder.query({ + query: ({ placeId, calendarId }) => ({ + url: `places/${placeId}`, + method: 'GET', + headers: { + 'calendar-id': calendarId, + }, + }), + + transformResponse: (response) => response, + }), }), }); -export const { useLazyGetAllPlacesQuery, useGetAllPlacesQuery, useDeletePlacesMutation } = placesApi; +export const { useLazyGetAllPlacesQuery, useGetAllPlacesQuery, useDeletePlacesMutation, useLazyGetPlaceQuery } = + placesApi; From 389de3f076406c48f68c54c9bf4829b0b33b695a Mon Sep 17 00:00:00 2001 From: Abhishek P Anil Date: Wed, 12 Jul 2023 15:15:12 +0530 Subject: [PATCH 4/8] feat: changed the api integration for dynamicFields --- .../OrganizationsReadOnly.jsx | 56 +++++++++++++++++-- src/services/taxonomy.js | 10 +++- 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx b/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx index 9ca8c023d..83e58125c 100644 --- a/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx +++ b/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx @@ -7,14 +7,17 @@ import { LeftOutlined } from '@ant-design/icons'; import { useNavigate, useOutletContext, useParams } from 'react-router-dom'; import { useGetOrganizationQuery } from '../../../services/organization'; import { PathName } from '../../../constants/pathName'; -import { contentLanguageBilingual } from '../../../utils/bilingual'; +import { bilingual, contentLanguageBilingual } from '../../../utils/bilingual'; import { useSelector } from 'react-redux'; import { getUserDetails } from '../../../redux/reducer/userSlice'; import { useLazyGetPlaceQuery } from '../../../services/places'; import SelectionItem from '../../../components/List/SelectionItem/SelectionItem'; import { taxonomyClass } from '../../../constants/taxonomyClass'; -import { useLazyGetAllTaxonomyQuery } from '../../../services/taxonomy'; +import { useGetAllTaxonomyQuery, useLazyGetAllTaxonomyQuery } from '../../../services/taxonomy'; import { placesOptions } from '../../../components/Select/selectOption.settings'; +import { treeDynamicTaxonomyOptions } from '../../../components/TreeSelectOption/treeSelectOption.settings'; +import Tags from '../../../components/Tags/Common/Tags'; +import TreeSelectOption from '../../../components/TreeSelectOption/TreeSelectOption'; function OrganizationsReadOnly() { const { t } = useTranslation(); @@ -32,6 +35,12 @@ function OrganizationsReadOnly() { { id: organizationId, calendarId, sessionId: timestampRef }, { skip: organizationId ? false : true }, ); + const { currentData: allTaxonomyData, isLoading: taxonomyLoading } = useGetAllTaxonomyQuery({ + calendarId, + search: '', + taxonomyClass: taxonomyClass.ORGANIZATION, + includeConcepts: true, + }); const [getPlace] = useLazyGetPlaceQuery(); const [getAllTaxonomy] = useLazyGetAllTaxonomyQuery(); @@ -46,7 +55,6 @@ function OrganizationsReadOnly() { if (organizationError) navigate(`${PathName.NotFound}`); }, [organizationError]); - console.log(organizationData); useEffect(() => { if (organizationSuccess) { @@ -94,7 +102,8 @@ function OrganizationsReadOnly() { return ( organizationSuccess && - !organizationLoading && ( + !organizationLoading && + !taxonomyLoading && ( @@ -215,6 +224,45 @@ function OrganizationsReadOnly() {

{organizationData?.contactPoint?.email}

+ + {allTaxonomyData?.data?.map((taxonomy, index) => { + if (taxonomy?.isDynamicField) { + let initialValues, + initialTaxonomy = []; + organizationData?.dynamicFields?.forEach((dynamicField) => { + if (taxonomy?.id === dynamicField?.taxonomyId) { + initialValues = dynamicField?.conceptIds; + initialTaxonomy.push(taxonomy?.id); + } + }); + if (initialTaxonomy?.includes(taxonomy?.id) && initialValues?.length > 0) + return ( +
+

+ {bilingual({ + en: taxonomy?.name?.en, + fr: taxonomy?.name?.fr, + interfaceLanguage: user?.interfaceLanguage?.toLowerCase(), + })} +

+ { + const { label } = props; + return {label}; + }} + /> +
+ ); + } + })} +

{t('dashboard.organization.readOnly.location')} diff --git a/src/services/taxonomy.js b/src/services/taxonomy.js index c96ee081b..53cb6bb31 100644 --- a/src/services/taxonomy.js +++ b/src/services/taxonomy.js @@ -15,9 +15,15 @@ export const taxonomyApi = createApi({ }), }), getTaxonomy: builder.query({ - query: ({ id }) => `taxonomy/${id}`, + query: ({ id, includeConcepts, calendarId }) => ({ + url: `taxonomy/${id}?include-concepts=${includeConcepts}`, + headers: { + 'calendar-id': calendarId, + }, + }), }), }), }); -export const { useGetAllTaxonomyQuery, useGetTaxonomyQuery, useLazyGetAllTaxonomyQuery } = taxonomyApi; +export const { useGetAllTaxonomyQuery, useGetTaxonomyQuery, useLazyGetAllTaxonomyQuery, useLazyGetTaxonomyQuery } = + taxonomyApi; From 48f2783f19f2df39463f7f1043b6378cb7793824 Mon Sep 17 00:00:00 2001 From: Abhishek P Anil Date: Wed, 12 Jul 2023 15:31:59 +0530 Subject: [PATCH 5/8] feat: display conditions added for orgs read only page --- .../OrganizationsReadOnly.jsx | 298 +++++++++++------- 1 file changed, 181 insertions(+), 117 deletions(-) diff --git a/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx b/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx index 83e58125c..96e790409 100644 --- a/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx +++ b/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx @@ -55,7 +55,6 @@ function OrganizationsReadOnly() { if (organizationError) navigate(`${PathName.NotFound}`); }, [organizationError]); - useEffect(() => { if (organizationSuccess) { if (organizationData?.place?.entityId) { @@ -154,120 +153,185 @@ function OrganizationsReadOnly() { {t('dashboard.organization.readOnly.details')}

- -

{t('dashboard.organization.readOnly.name')}

-

{t('common.tabFrench')}

-

{organizationData?.name?.fr}

-

{t('common.tabEnglish')}

-

{organizationData?.name?.en}

- - -

- {t('dashboard.organization.readOnly.disambiguatingDescription')} -

-

{t('common.tabFrench')}

-

{organizationData?.disambiguatingDescription?.fr}

-

{t('common.tabEnglish')}

-

{organizationData?.disambiguatingDescription?.en}

- - -

- {t('dashboard.organization.readOnly.description')} -

-

{t('common.tabFrench')}

-

-

-

-

{t('common.tabEnglish')}

-

-

-

-

- {t('dashboard.organization.readOnly.website')} -

-

- - {organizationData?.url?.uri} - -

- - -

- {t('dashboard.organization.readOnly.contact')} -

-

- {t('dashboard.organization.readOnly.frenchContactTitle')} -

-

{organizationData?.contactPoint?.name?.fr}

-

- {t('dashboard.organization.readOnly.englishContactTitle')} -

-

{organizationData?.contactPoint?.name?.en}

-

- {t('dashboard.organization.readOnly.website')} -

-

- - {organizationData?.contactPoint?.url?.uri} - -

-

- {t('dashboard.organization.readOnly.phoneNumber')} -

-

{organizationData?.contactPoint?.telephone}

-

- {t('dashboard.organization.readOnly.email')} -

-

{organizationData?.contactPoint?.email}

- - - {allTaxonomyData?.data?.map((taxonomy, index) => { - if (taxonomy?.isDynamicField) { - let initialValues, - initialTaxonomy = []; - organizationData?.dynamicFields?.forEach((dynamicField) => { - if (taxonomy?.id === dynamicField?.taxonomyId) { - initialValues = dynamicField?.conceptIds; - initialTaxonomy.push(taxonomy?.id); - } - }); - if (initialTaxonomy?.includes(taxonomy?.id) && initialValues?.length > 0) - return ( -
-

- {bilingual({ - en: taxonomy?.name?.en, - fr: taxonomy?.name?.fr, - interfaceLanguage: user?.interfaceLanguage?.toLowerCase(), - })} -

- { - const { label } = props; - return {label}; - }} - /> -
- ); - } - })} - - -

- {t('dashboard.organization.readOnly.location')} -

- {locationPlace && ( + {(organizationData?.name?.fr || organizationData?.name?.en) && ( + +

+ {t('dashboard.organization.readOnly.name')} +

+ {organizationData?.name?.fr && ( + <> +

{t('common.tabFrench')}

+

{organizationData?.name?.fr}

+ + )} + {organizationData?.name?.en && ( + <> +

{t('common.tabEnglish')}

+

{organizationData?.name?.en}

+ + )} + + )} + {(organizationData?.disambiguatingDescription?.en || organizationData?.disambiguatingDescription?.fr) && ( + +

+ {t('dashboard.organization.readOnly.disambiguatingDescription')} +

+ {organizationData?.disambiguatingDescription?.fr && ( + <> +

{t('common.tabFrench')}

+

{organizationData?.disambiguatingDescription?.fr}

+ + )} + {organizationData?.disambiguatingDescription?.en && ( + <> +

{t('common.tabEnglish')}

+

{organizationData?.disambiguatingDescription?.en}

+ + )} + + )} + {(organizationData?.description?.fr || organizationData?.description?.en) && ( + +

+ {t('dashboard.organization.readOnly.description')} +

+ {organizationData?.description?.fr && ( + <> +

{t('common.tabFrench')}

+

+

+

+ + )} + {organizationData?.description?.en && ( + <> +

{t('common.tabEnglish')}

+

+

+

+ + )} + + )} + {organizationData?.url?.uri && ( + +

+ {t('dashboard.organization.readOnly.website')} +

+

+ + {organizationData?.url?.uri} + +

+ + )} + + {organizationData?.contactPoint && ( + +

+ {t('dashboard.organization.readOnly.contact')} +

+ {organizationData?.contactPoint?.name?.fr && ( + <> +

+ {t('dashboard.organization.readOnly.frenchContactTitle')} +

+

{organizationData?.contactPoint?.name?.fr}

+ + )} + {organizationData?.contactPoint?.name?.en && ( + <> +

+ {t('dashboard.organization.readOnly.englishContactTitle')} +

+

{organizationData?.contactPoint?.name?.en}

+ + )} + {organizationData?.contactPoint?.url?.uri && ( + <> +

+ {t('dashboard.organization.readOnly.website')} +

+

+ + {organizationData?.contactPoint?.url?.uri} + +

+ + )} + {organizationData?.contactPoint?.telephone && ( + <> +

+ {t('dashboard.organization.readOnly.phoneNumber')} +

+

{organizationData?.contactPoint?.telephone}

+ + )} + {organizationData?.contactPoint?.email && ( + <> +

+ {t('dashboard.organization.readOnly.email')} +

+

{organizationData?.contactPoint?.email}

+ + )} + + )} + {organizationData?.dynamicFields?.length > 0 && ( + + {allTaxonomyData?.data?.map((taxonomy, index) => { + if (taxonomy?.isDynamicField) { + let initialValues, + initialTaxonomy = []; + organizationData?.dynamicFields?.forEach((dynamicField) => { + if (taxonomy?.id === dynamicField?.taxonomyId) { + initialValues = dynamicField?.conceptIds; + initialTaxonomy.push(taxonomy?.id); + } + }); + if (initialTaxonomy?.includes(taxonomy?.id) && initialValues?.length > 0) + return ( +
+

+ {bilingual({ + en: taxonomy?.name?.en, + fr: taxonomy?.name?.fr, + interfaceLanguage: user?.interfaceLanguage?.toLowerCase(), + })} +

+ { + const { label } = props; + return {label}; + }} + /> +
+ ); + } + })} + + )} + {locationPlace && ( + +

+ {t('dashboard.organization.readOnly.location')} +

- )} - + + )} <> From 95f6f41b3e3ea8d828afd2ed87c3260a2e236470 Mon Sep 17 00:00:00 2001 From: Abhishek P Anil Date: Wed, 12 Jul 2023 15:39:46 +0530 Subject: [PATCH 6/8] feat: added image for organization --- .../OrganizationsReadOnly/OrganizationsReadOnly.jsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx b/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx index 96e790409..74ec4f106 100644 --- a/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx +++ b/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx @@ -347,7 +347,18 @@ function OrganizationsReadOnly() { )} - <> + +
+ avatar +
+ ) From 9df33e4fa340d3e053db966fa76e2fbee5feabef Mon Sep 17 00:00:00 2001 From: Abhishek P Anil Date: Wed, 12 Jul 2023 15:41:59 +0530 Subject: [PATCH 7/8] feat: orgs logo is only shown if it exist --- .../OrganizationsReadOnly.jsx | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx b/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx index 74ec4f106..d438c9389 100644 --- a/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx +++ b/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx @@ -348,16 +348,18 @@ function OrganizationsReadOnly() { -
- avatar -
+ {organizationData?.image?.original?.uri && ( +
+ avatar +
+ )} From b2f4db52224151d4077c358f7bc9c3c2256a0769 Mon Sep 17 00:00:00 2001 From: Abhishek P Anil Date: Wed, 12 Jul 2023 15:46:31 +0530 Subject: [PATCH 8/8] feat: feature flag wrapped to orgs read only page --- .../OrganizationsReadOnly.jsx | 509 +++++++++--------- 1 file changed, 257 insertions(+), 252 deletions(-) diff --git a/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx b/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx index d438c9389..8818a143b 100644 --- a/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx +++ b/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx @@ -18,6 +18,8 @@ import { placesOptions } from '../../../components/Select/selectOption.settings' import { treeDynamicTaxonomyOptions } from '../../../components/TreeSelectOption/treeSelectOption.settings'; import Tags from '../../../components/Tags/Common/Tags'; import TreeSelectOption from '../../../components/TreeSelectOption/TreeSelectOption'; +import FeatureFlag from '../../../layout/FeatureFlag/FeatureFlag'; +import { featureFlags } from '../../../utils/featureFlags'; function OrganizationsReadOnly() { const { t } = useTranslation(); @@ -103,266 +105,269 @@ function OrganizationsReadOnly() { organizationSuccess && !organizationLoading && !taxonomyLoading && ( - - - - - - {t('dashboard.organization.organizations')} - - - {contentLanguageBilingual({ - en: organizationData?.name?.en, - fr: organizationData?.name?.fr, - interfaceLanguage: user?.interfaceLanguage?.toLowerCase(), - calendarContentLanguage: calendarContentLanguage, - })} - - - + + + + + + + {t('dashboard.organization.organizations')} + + + {contentLanguageBilingual({ + en: organizationData?.name?.en, + fr: organizationData?.name?.fr, + interfaceLanguage: user?.interfaceLanguage?.toLowerCase(), + calendarContentLanguage: calendarContentLanguage, + })} + + + - - - -
-

- {contentLanguageBilingual({ - en: organizationData?.name?.en, - fr: organizationData?.name?.fr, - interfaceLanguage: user?.interfaceLanguage?.toLowerCase(), - calendarContentLanguage: calendarContentLanguage, - })} -

-

- {contentLanguageBilingual({ - en: organizationData?.disambiguatingDescription?.en, - fr: organizationData?.disambiguatingDescription?.fr, - interfaceLanguage: user?.interfaceLanguage?.toLowerCase(), - calendarContentLanguage: calendarContentLanguage, - })} -

-
- -
- - - - - -

- {t('dashboard.organization.readOnly.details')} -

- - {(organizationData?.name?.fr || organizationData?.name?.en) && ( - -

- {t('dashboard.organization.readOnly.name')} -

- {organizationData?.name?.fr && ( - <> -

{t('common.tabFrench')}

-

{organizationData?.name?.fr}

- - )} - {organizationData?.name?.en && ( - <> -

{t('common.tabEnglish')}

-

{organizationData?.name?.en}

- - )} - - )} - {(organizationData?.disambiguatingDescription?.en || organizationData?.disambiguatingDescription?.fr) && ( - -

- {t('dashboard.organization.readOnly.disambiguatingDescription')} -

- {organizationData?.disambiguatingDescription?.fr && ( - <> -

{t('common.tabFrench')}

-

{organizationData?.disambiguatingDescription?.fr}

- - )} - {organizationData?.disambiguatingDescription?.en && ( - <> -

{t('common.tabEnglish')}

-

{organizationData?.disambiguatingDescription?.en}

- - )} - - )} - {(organizationData?.description?.fr || organizationData?.description?.en) && ( - -

- {t('dashboard.organization.readOnly.description')} + + + +

+

+ {contentLanguageBilingual({ + en: organizationData?.name?.en, + fr: organizationData?.name?.fr, + interfaceLanguage: user?.interfaceLanguage?.toLowerCase(), + calendarContentLanguage: calendarContentLanguage, + })} +

+

+ {contentLanguageBilingual({ + en: organizationData?.disambiguatingDescription?.en, + fr: organizationData?.disambiguatingDescription?.fr, + interfaceLanguage: user?.interfaceLanguage?.toLowerCase(), + calendarContentLanguage: calendarContentLanguage, + })}

- {organizationData?.description?.fr && ( - <> -

{t('common.tabFrench')}

-

-

-

- - )} - {organizationData?.description?.en && ( - <> -

{t('common.tabEnglish')}

-

-

-

- - )} - - )} - {organizationData?.url?.uri && ( +
+ + + + + + -

- {t('dashboard.organization.readOnly.website')} -

-

- - {organizationData?.url?.uri} - +

+ {t('dashboard.organization.readOnly.details')}

- )} + {(organizationData?.name?.fr || organizationData?.name?.en) && ( + +

+ {t('dashboard.organization.readOnly.name')} +

+ {organizationData?.name?.fr && ( + <> +

{t('common.tabFrench')}

+

{organizationData?.name?.fr}

+ + )} + {organizationData?.name?.en && ( + <> +

{t('common.tabEnglish')}

+

{organizationData?.name?.en}

+ + )} + + )} + {(organizationData?.disambiguatingDescription?.en || + organizationData?.disambiguatingDescription?.fr) && ( + +

+ {t('dashboard.organization.readOnly.disambiguatingDescription')} +

+ {organizationData?.disambiguatingDescription?.fr && ( + <> +

{t('common.tabFrench')}

+

{organizationData?.disambiguatingDescription?.fr}

+ + )} + {organizationData?.disambiguatingDescription?.en && ( + <> +

{t('common.tabEnglish')}

+

{organizationData?.disambiguatingDescription?.en}

+ + )} + + )} + {(organizationData?.description?.fr || organizationData?.description?.en) && ( + +

+ {t('dashboard.organization.readOnly.description')} +

+ {organizationData?.description?.fr && ( + <> +

{t('common.tabFrench')}

+

+

+

+ + )} + {organizationData?.description?.en && ( + <> +

{t('common.tabEnglish')}

+

+

+

+ + )} + + )} + {organizationData?.url?.uri && ( + +

+ {t('dashboard.organization.readOnly.website')} +

+

+ + {organizationData?.url?.uri} + +

+ + )} - {organizationData?.contactPoint && ( - -

- {t('dashboard.organization.readOnly.contact')} -

- {organizationData?.contactPoint?.name?.fr && ( - <> -

- {t('dashboard.organization.readOnly.frenchContactTitle')} -

-

{organizationData?.contactPoint?.name?.fr}

- - )} - {organizationData?.contactPoint?.name?.en && ( - <> -

- {t('dashboard.organization.readOnly.englishContactTitle')} -

-

{organizationData?.contactPoint?.name?.en}

- - )} - {organizationData?.contactPoint?.url?.uri && ( - <> -

- {t('dashboard.organization.readOnly.website')} -

-

- - {organizationData?.contactPoint?.url?.uri} - -

- - )} - {organizationData?.contactPoint?.telephone && ( - <> -

- {t('dashboard.organization.readOnly.phoneNumber')} -

-

{organizationData?.contactPoint?.telephone}

- - )} - {organizationData?.contactPoint?.email && ( - <> -

- {t('dashboard.organization.readOnly.email')} -

-

{organizationData?.contactPoint?.email}

- - )} - - )} - {organizationData?.dynamicFields?.length > 0 && ( - - {allTaxonomyData?.data?.map((taxonomy, index) => { - if (taxonomy?.isDynamicField) { - let initialValues, - initialTaxonomy = []; - organizationData?.dynamicFields?.forEach((dynamicField) => { - if (taxonomy?.id === dynamicField?.taxonomyId) { - initialValues = dynamicField?.conceptIds; - initialTaxonomy.push(taxonomy?.id); - } - }); - if (initialTaxonomy?.includes(taxonomy?.id) && initialValues?.length > 0) - return ( -
-

- {bilingual({ - en: taxonomy?.name?.en, - fr: taxonomy?.name?.fr, - interfaceLanguage: user?.interfaceLanguage?.toLowerCase(), - })} -

- { - const { label } = props; - return {label}; - }} - /> -
- ); - } - })} - - )} - {locationPlace && ( - -

- {t('dashboard.organization.readOnly.location')} -

- +

+ {t('dashboard.organization.readOnly.contact')} +

+ {organizationData?.contactPoint?.name?.fr && ( + <> +

+ {t('dashboard.organization.readOnly.frenchContactTitle')} +

+

{organizationData?.contactPoint?.name?.fr}

+ + )} + {organizationData?.contactPoint?.name?.en && ( + <> +

+ {t('dashboard.organization.readOnly.englishContactTitle')} +

+

{organizationData?.contactPoint?.name?.en}

+ + )} + {organizationData?.contactPoint?.url?.uri && ( + <> +

+ {t('dashboard.organization.readOnly.website')} +

+

+ + {organizationData?.contactPoint?.url?.uri} + +

+ + )} + {organizationData?.contactPoint?.telephone && ( + <> +

+ {t('dashboard.organization.readOnly.phoneNumber')} +

+

{organizationData?.contactPoint?.telephone}

+ + )} + {organizationData?.contactPoint?.email && ( + <> +

+ {t('dashboard.organization.readOnly.email')} +

+

{organizationData?.contactPoint?.email}

+ + )} + + )} + {organizationData?.dynamicFields?.length > 0 && ( + + {allTaxonomyData?.data?.map((taxonomy, index) => { + if (taxonomy?.isDynamicField) { + let initialValues, + initialTaxonomy = []; + organizationData?.dynamicFields?.forEach((dynamicField) => { + if (taxonomy?.id === dynamicField?.taxonomyId) { + initialValues = dynamicField?.conceptIds; + initialTaxonomy.push(taxonomy?.id); + } + }); + if (initialTaxonomy?.includes(taxonomy?.id) && initialValues?.length > 0) + return ( +
+

+ {bilingual({ + en: taxonomy?.name?.en, + fr: taxonomy?.name?.fr, + interfaceLanguage: user?.interfaceLanguage?.toLowerCase(), + })} +

+ { + const { label } = props; + return {label}; + }} + /> +
+ ); + } + })} + + )} + {locationPlace && ( + +

+ {t('dashboard.organization.readOnly.location')} +

+ + + )} + + + + {organizationData?.image?.original?.uri && ( +
+ avatar - +
)} - - - - {organizationData?.image?.original?.uri && ( -
- avatar -
- )} - - - + + + + ) ); }