diff --git a/.env.production b/.env.production index 5f662ed0..db935b0c 100644 --- a/.env.production +++ b/.env.production @@ -14,4 +14,4 @@ REACT_APP_FEATURE_FLAG_IMAGE_CROP=true REACT_APP_ENV="production" REACT_APP_INVITE_URL=" https://cms.footlight.io/join?invitationId=" REACT_APP_ACCEPT_URL=" https://cms.footlight.io/accept?invitationId=" -REACT_APP_CALENDAR_WIDGET_BASE_URL="https://listing-widget.footlight.io/v0/index.html" +REACT_APP_CALENDAR_WIDGET_BASE_URL="https://listing-widget.footlight.io/v1/index.html" diff --git a/.env.staging b/.env.staging index 337ca97f..a375a074 100644 --- a/.env.staging +++ b/.env.staging @@ -14,4 +14,4 @@ REACT_APP_FEATURE_FLAG_IMAGE_CROP=true REACT_APP_ENV="staging" REACT_APP_INVITE_URL="http://staging.cms.footlight.io/join?invitationId=" REACT_APP_ACCEPT_URL="http://staging.cms.footlight.io/accept?invitationId=" -REACT_APP_CALENDAR_WIDGET_BASE_URL="https://s3.ca-central-1.amazonaws.com/staging.cms-widget.footlight.io/v0/index.html" \ No newline at end of file +REACT_APP_CALENDAR_WIDGET_BASE_URL="https://s3.ca-central-1.amazonaws.com/staging.cms-widget.footlight.io/v1/index.html" \ No newline at end of file diff --git a/src/layout/Main/Main.jsx b/src/layout/Main/Main.jsx index 38f3d9f9..a0e7df8e 100644 --- a/src/layout/Main/Main.jsx +++ b/src/layout/Main/Main.jsx @@ -26,7 +26,9 @@ function Main(props) { {children?.length > 3 && children[3]} - + {children?.length > 4 && children[4]} diff --git a/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx b/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx index 2d4e9c48..43015326 100644 --- a/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx +++ b/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx @@ -392,7 +392,12 @@ function CreateNewOrganization() { } } }; - if ((values?.image || (values?.image && values?.image?.length > 0)) && !values?.logo) { + + if ( + (values?.image || (values?.image && values?.image?.length > 0)) && + (!values?.logo || (Array.isArray(values?.logo) && values?.logo?.length === 0)) + ) { + organizationPayload['logo'] = []; if (values?.image?.length > 0 && values?.image[0]?.originFileObj) { const formdata = new FormData(); formdata.append('file', values?.image[0].originFileObj); @@ -452,7 +457,7 @@ function CreateNewOrganization() { // Main image is removed and no new image is added // No gallery images are added organizationPayload['image'] = []; - } else organizationPayload['image'] = imageCrop; + } else organizationPayload['image'] = organizationData?.image; addUpdateOrganizationApiHandler(organizationPayload, toggle) .then((id) => resolve(id)) .catch((error) => { diff --git a/src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx b/src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx index 39b44728..43161873 100644 --- a/src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx +++ b/src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx @@ -126,8 +126,10 @@ function EventReadOnly() { } }); - const checkIfFieldIsToBeDisplayed = (field, data, type = 'standard') => { + const checkIfFieldIsToBeDisplayed = (field, data, type = 'standard', adminOnly = false) => { if (typeof data === 'string' && data !== '') return true; + if (adminOnly && !adminCheckHandler({ calendar, user })) return false; + if (Array.isArray(data) && data.length > 0 && data.every((item) => item !== null && item !== undefined)) return true; if (data !== null && isDataValid(data)) return true; @@ -513,6 +515,7 @@ function EventReadOnly() { taxonomy?.id, initialTaxonomy?.includes(taxonomy?.id) ? taxonomy : undefined, 'dynamic', + taxonomy?.isAdminOnly, ) ) return ( diff --git a/src/pages/Dashboard/Events/Events.jsx b/src/pages/Dashboard/Events/Events.jsx index 6dfd7d53..d9c540d9 100644 --- a/src/pages/Dashboard/Events/Events.jsx +++ b/src/pages/Dashboard/Events/Events.jsx @@ -35,6 +35,8 @@ import { dateFilterOptions, dateFilterTypes } from '../../../constants/dateFilte import { taxonomyClass } from '../../../constants/taxonomyClass'; import { useGetAllTaxonomyQuery } from '../../../services/taxonomy'; import { treeTaxonomyOptions } from '../../../components/TreeSelectOption/treeSelectOption.settings'; +import { adminCheckHandler } from '../../../utils/adminCheckHandler'; +import { getCurrentCalendarDetailsFromUserDetails } from '../../../utils/getCurrentCalendarDetailsFromUserDetails'; const { useBreakpoint } = Grid; const standardTaxonomyMaps = [ @@ -211,6 +213,7 @@ function Events() { : {}, ); + const calendar = getCurrentCalendarDetailsFromUserDetails(user, calendarId); let customFilters = currentCalendarData?.filterPersonalization?.customFields; const dateTypeSelector = (dates) => { if (dates?.length == 2) { @@ -907,6 +910,7 @@ function Events() { {allTaxonomyData?.data?.length > 0 && + adminCheckHandler({ user, calendar }) && allTaxonomyData?.data?.map((taxonomy, index) => { if (!taxonomy?.isDynamicField && customFilters?.includes(taxonomy?.id)) return ( @@ -969,6 +973,7 @@ function Events() { ); })} {allTaxonomyData?.data?.length > 0 && + adminCheckHandler({ user, calendar }) && allTaxonomyData?.data?.map((taxonomy, index) => { if (taxonomy?.isDynamicField === true && customFilters?.includes(taxonomy?.id)) return ( diff --git a/src/pages/Dashboard/Organizations/Organizations.jsx b/src/pages/Dashboard/Organizations/Organizations.jsx index 8aba604f..34e4f580 100644 --- a/src/pages/Dashboard/Organizations/Organizations.jsx +++ b/src/pages/Dashboard/Organizations/Organizations.jsx @@ -276,7 +276,7 @@ function Organizations() { ); Object.keys(taxonomyFilter)?.forEach((taxonomy) => { if (taxonomyFilter[taxonomy]?.length > 0) { - taxonomyFilter[taxonomy]?.forEach((concept) => query.append('concept', concept)); + taxonomyFilter[taxonomy]?.forEach((concept) => query.append('concept-ids', concept)); } }); @@ -364,6 +364,7 @@ function Organizations() { /> {allTaxonomyData?.data?.length > 0 && + adminCheckHandler({ user, calendar }) && allTaxonomyData?.data?.map((taxonomy, index) => { if (!taxonomy?.isDynamicField && customFilters?.includes(taxonomy?.id)) return ( @@ -426,6 +427,7 @@ function Organizations() { ); })} {allTaxonomyData?.data?.length > 0 && + adminCheckHandler({ user, calendar }) && allTaxonomyData?.data?.map((taxonomy, index) => { if (taxonomy?.isDynamicField === true && customFilters?.includes(taxonomy?.id)) return ( diff --git a/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx b/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx index 63841544..4bd42df0 100644 --- a/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx +++ b/src/pages/Dashboard/OrganizationsReadOnly/OrganizationsReadOnly.jsx @@ -35,6 +35,8 @@ import ReadOnlyPageTabLayout from '../../../layout/ReadOnlyPageTabLayout/ReadOnl import { isDataValid } from '../../../utils/MultiLingualFormItemSupportFunctions'; import { organizationFormFieldNames } from '../../../constants/personAndOrganizationFormFieldNames'; import ImageUpload from '../../../components/ImageUpload'; +import { adminCheckHandler } from '../../../utils/adminCheckHandler'; +import { getCurrentCalendarDetailsFromUserDetails } from '../../../utils/getCurrentCalendarDetailsFromUserDetails'; function OrganizationsReadOnly() { const { t } = useTranslation(); @@ -76,6 +78,8 @@ function OrganizationsReadOnly() { sessionId: timestampRef, }); const { user } = useSelector(getUserDetails); + const calendar = getCurrentCalendarDetailsFromUserDetails(user, calendarId); + const activeTabKey = useSelector(getActiveTabKey); const [locationPlace, setLocationPlace] = useState(); @@ -104,8 +108,9 @@ function OrganizationsReadOnly() { } }); - const checkIfFieldIsToBeDisplayed = (field, data, type = 'standard') => { + const checkIfFieldIsToBeDisplayed = (field, data, type = 'standard', adminOnly = false) => { if (typeof data === 'string' && data !== '') return true; + if (adminOnly && !adminCheckHandler({ calendar, user })) return false; if (Array.isArray(data) && data.length > 0 && data.every((item) => item !== null && item !== undefined)) return true; if (data !== null && isDataValid(data)) return true; @@ -534,6 +539,7 @@ function OrganizationsReadOnly() { taxonomy?.id, initialTaxonomy?.includes(taxonomy?.id) ? taxonomy : undefined, 'dynamic', + taxonomy?.isAdminOnly, ) ) return ( diff --git a/src/pages/Dashboard/People/People.jsx b/src/pages/Dashboard/People/People.jsx index 17ff00c2..de6221ca 100644 --- a/src/pages/Dashboard/People/People.jsx +++ b/src/pages/Dashboard/People/People.jsx @@ -376,6 +376,7 @@ function People() { /> {allTaxonomyData?.data?.length > 0 && + adminCheckHandler({ user, calendar }) && allTaxonomyData?.data?.map((taxonomy, index) => { if (!taxonomy?.isDynamicField && customFilters?.includes(taxonomy?.id)) return ( @@ -438,6 +439,7 @@ function People() { ); })} {allTaxonomyData?.data?.length > 0 && + adminCheckHandler({ user, calendar }) && allTaxonomyData?.data?.map((taxonomy, index) => { if (taxonomy?.isDynamicField === true && customFilters?.includes(taxonomy?.id)) return ( diff --git a/src/pages/Dashboard/PersonReadOnly/PersonReadOnly.jsx b/src/pages/Dashboard/PersonReadOnly/PersonReadOnly.jsx index 6f6d7652..df248412 100644 --- a/src/pages/Dashboard/PersonReadOnly/PersonReadOnly.jsx +++ b/src/pages/Dashboard/PersonReadOnly/PersonReadOnly.jsx @@ -37,6 +37,8 @@ import { getActiveTabKey } from '../../../redux/reducer/readOnlyTabSlice'; import ReadOnlyPageTabLayout from '../../../layout/ReadOnlyPageTabLayout/ReadOnlyPageTabLayout'; import { isDataValid } from '../../../utils/MultiLingualFormItemSupportFunctions'; import { personFormFieldNames } from '../../../constants/personAndOrganizationFormFieldNames'; +import { adminCheckHandler } from '../../../utils/adminCheckHandler'; +import { getCurrentCalendarDetailsFromUserDetails } from '../../../utils/getCurrentCalendarDetailsFromUserDetails'; function PersonReadOnly() { const { t } = useTranslation(); @@ -74,6 +76,7 @@ function PersonReadOnly() { }); const { user } = useSelector(getUserDetails); + const calendar = getCurrentCalendarDetailsFromUserDetails(user, calendarId); const activeTabKey = useSelector(getActiveTabKey); const calendarContentLanguage = currentCalendarData?.contentLanguage; @@ -102,8 +105,10 @@ function PersonReadOnly() { } }); - const checkIfFieldIsToBeDisplayed = (field, data, type = 'standard') => { + const checkIfFieldIsToBeDisplayed = (field, data, type = 'standard', adminOnly = false) => { if (typeof data === 'string' && data !== '') return true; + if (adminOnly && !adminCheckHandler({ calendar, user })) return false; + if (Array.isArray(data) && data.length > 0 && data.every((item) => item !== null && item !== undefined)) return true; if (data !== null && isDataValid(data)) return true; @@ -331,6 +336,7 @@ function PersonReadOnly() { taxonomy?.id, initialTaxonomy?.includes(taxonomy?.id) ? taxonomy : undefined, 'dynamic', + taxonomy?.isAdminOnly, ) ) return ( diff --git a/src/pages/Dashboard/PlaceReadOnly/PlaceReadOnly.jsx b/src/pages/Dashboard/PlaceReadOnly/PlaceReadOnly.jsx index 87f3c539..daf2caab 100644 --- a/src/pages/Dashboard/PlaceReadOnly/PlaceReadOnly.jsx +++ b/src/pages/Dashboard/PlaceReadOnly/PlaceReadOnly.jsx @@ -40,6 +40,8 @@ import ReadOnlyPageTabLayout from '../../../layout/ReadOnlyPageTabLayout/ReadOnl import { getActiveTabKey } from '../../../redux/reducer/readOnlyTabSlice'; import { isDataValid } from '../../../utils/MultiLingualFormItemSupportFunctions'; import { placeFormRequiredFieldNames } from '../../../constants/placeFormRequiredFieldNames'; +import { adminCheckHandler } from '../../../utils/adminCheckHandler'; +import { getCurrentCalendarDetailsFromUserDetails } from '../../../utils/getCurrentCalendarDetailsFromUserDetails'; function PlaceReadOnly() { const { t } = useTranslation(); @@ -79,6 +81,7 @@ function PlaceReadOnly() { }); const { user } = useSelector(getUserDetails); + const calendar = getCurrentCalendarDetailsFromUserDetails(user, calendarId); const activeTabKey = useSelector(getActiveTabKey); const [locationPlace, setLocationPlace] = useState(); @@ -107,8 +110,10 @@ function PlaceReadOnly() { } }); - const checkIfFieldIsToBeDisplayed = (field, data, type = 'standard') => { + const checkIfFieldIsToBeDisplayed = (field, data, type = 'standard', adminOnly = false) => { if (typeof data === 'string' && data !== '') return true; + if (adminOnly && !adminCheckHandler({ calendar, user })) return false; + if (Array.isArray(data) && data.length > 0 && data.every((item) => item !== null && item !== undefined)) return true; if (data !== null && isDataValid(data)) return true; @@ -386,6 +391,7 @@ function PlaceReadOnly() { taxonomy?.id, initialTaxonomy?.includes(taxonomy?.id) ? taxonomy : undefined, 'dynamic', + taxonomy?.isAdminOnly, ) ) return ( diff --git a/src/pages/Dashboard/Places/Places.jsx b/src/pages/Dashboard/Places/Places.jsx index 9c5aaad5..1188c8ba 100644 --- a/src/pages/Dashboard/Places/Places.jsx +++ b/src/pages/Dashboard/Places/Places.jsx @@ -388,6 +388,7 @@ function Places() { /> {allTaxonomyData?.data?.length > 0 && + adminCheckHandler({ user, calendar }) && allTaxonomyData?.data?.map((taxonomy, index) => { if (!taxonomy?.isDynamicField && customFilters?.includes(taxonomy?.id)) return ( @@ -450,6 +451,7 @@ function Places() { ); })} {allTaxonomyData?.data?.length > 0 && + adminCheckHandler({ user, calendar }) && allTaxonomyData?.data?.map((taxonomy, index) => { if (taxonomy?.isDynamicField === true && customFilters?.includes(taxonomy?.id)) return (