From a6a49378e9fe2179c2bd84a8340e2151393840be Mon Sep 17 00:00:00 2001 From: syam babu Date: Thu, 19 Dec 2024 18:39:27 +0530 Subject: [PATCH 1/6] fix: made custom filters admin only. closes #1470 --- src/pages/Dashboard/Events/Events.jsx | 5 +++++ src/pages/Dashboard/Organizations/Organizations.jsx | 2 ++ src/pages/Dashboard/People/People.jsx | 2 ++ src/pages/Dashboard/Places/Places.jsx | 2 ++ 4 files changed, 11 insertions(+) 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 e73ce81e..1dce21ab 100644 --- a/src/pages/Dashboard/Organizations/Organizations.jsx +++ b/src/pages/Dashboard/Organizations/Organizations.jsx @@ -281,6 +281,7 @@ function Organizations() { /> {allTaxonomyData?.data?.length > 0 && + adminCheckHandler({ user, calendar }) && allTaxonomyData?.data?.map((taxonomy, index) => { if (!taxonomy?.isDynamicField && customFilters?.includes(taxonomy?.id)) return ( @@ -343,6 +344,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/People/People.jsx b/src/pages/Dashboard/People/People.jsx index cee812c6..9c99216a 100644 --- a/src/pages/Dashboard/People/People.jsx +++ b/src/pages/Dashboard/People/People.jsx @@ -292,6 +292,7 @@ function People() { /> {allTaxonomyData?.data?.length > 0 && + adminCheckHandler({ user, calendar }) && allTaxonomyData?.data?.map((taxonomy, index) => { if (!taxonomy?.isDynamicField && customFilters?.includes(taxonomy?.id)) return ( @@ -354,6 +355,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/Places/Places.jsx b/src/pages/Dashboard/Places/Places.jsx index af323c4c..3953fcdf 100644 --- a/src/pages/Dashboard/Places/Places.jsx +++ b/src/pages/Dashboard/Places/Places.jsx @@ -303,6 +303,7 @@ function Places() { /> {allTaxonomyData?.data?.length > 0 && + adminCheckHandler({ user, calendar }) && allTaxonomyData?.data?.map((taxonomy, index) => { if (!taxonomy?.isDynamicField && customFilters?.includes(taxonomy?.id)) return ( @@ -365,6 +366,7 @@ function Places() { ); })} {allTaxonomyData?.data?.length > 0 && + adminCheckHandler({ user, calendar }) && allTaxonomyData?.data?.map((taxonomy, index) => { if (taxonomy?.isDynamicField === true && customFilters?.includes(taxonomy?.id)) return ( From 651826e74a21cc207646ebac555d1998110e5efa Mon Sep 17 00:00:00 2001 From: syam babu Date: Thu, 19 Dec 2024 18:47:18 +0530 Subject: [PATCH 2/6] fix: changes query param from concept to concept-id in Organization listing page --- src/pages/Dashboard/Organizations/Organizations.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Dashboard/Organizations/Organizations.jsx b/src/pages/Dashboard/Organizations/Organizations.jsx index 1dce21ab..90e4f83d 100644 --- a/src/pages/Dashboard/Organizations/Organizations.jsx +++ b/src/pages/Dashboard/Organizations/Organizations.jsx @@ -196,7 +196,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)); } }); From aaa9558d9c6fdc68427c97e2e1fd3d9c2ccded21 Mon Sep 17 00:00:00 2001 From: syam babu Date: Fri, 3 Jan 2025 10:45:30 +0530 Subject: [PATCH 3/6] fix: fixed layout issue for admin only filters --- src/layout/Main/Main.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/layout/Main/Main.jsx b/src/layout/Main/Main.jsx index bac838ec..a0e7df8e 100644 --- a/src/layout/Main/Main.jsx +++ b/src/layout/Main/Main.jsx @@ -25,7 +25,10 @@ function Main(props) { {children?.length > 2 && children[2]} {children?.length > 3 && children[3]} - + + {children?.length > 4 && children[4]} From 5628428b2c8ea01b92bc8ed77a385ffbb6406f94 Mon Sep 17 00:00:00 2001 From: syam babu Date: Wed, 8 Jan 2025 17:41:17 +0530 Subject: [PATCH 4/6] fix: fixed issue deleting logo automatically delete image for organization entities. closes #1520 --- .../CreateNewOrganization/CreateNewOrganization.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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) => { From 784f3b6e3d3a7908e68123ee1e2c570343fb2a7d Mon Sep 17 00:00:00 2001 From: syam babu Date: Wed, 8 Jan 2025 18:22:53 +0530 Subject: [PATCH 5/6] fix: fixed admin-only fields visible for non-admin users in read-only pages. --- src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx | 5 ++++- .../OrganizationsReadOnly/OrganizationsReadOnly.jsx | 8 +++++++- src/pages/Dashboard/PersonReadOnly/PersonReadOnly.jsx | 8 +++++++- src/pages/Dashboard/PlaceReadOnly/PlaceReadOnly.jsx | 8 +++++++- 4 files changed, 25 insertions(+), 4 deletions(-) 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/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/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 ( From 56d2d662b8ee2b4d01e6ee580216a2aa7a633716 Mon Sep 17 00:00:00 2001 From: syam babu Date: Thu, 9 Jan 2025 18:26:09 +0530 Subject: [PATCH 6/6] feat: upgraded vidget from v0 to v1. closes #1529 --- .env.production | 2 +- .env.staging | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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