Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #1532

Merged
merged 10 commits into from
Jan 10, 2025
2 changes: 1 addition & 1 deletion .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion .env.staging
Original file line number Diff line number Diff line change
Expand Up @@ -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"
REACT_APP_CALENDAR_WIDGET_BASE_URL="https://s3.ca-central-1.amazonaws.com/staging.cms-widget.footlight.io/v1/index.html"
4 changes: 3 additions & 1 deletion src/layout/Main/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ function Main(props) {
</Col>
<Col>{children?.length > 3 && children[3]}</Col>
</Row>
<Row style={{ paddingTop: 16 }}>
<Row
gutter={[20, 10]}
style={{ paddingTop: '20px', ...(!screens.md && { paddingRight: '4px', marginRight: 0 }) }}>
<Col>
<Row gutter={20}>{children?.length > 4 && children[4]}</Row>
</Col>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) => {
Expand Down
5 changes: 4 additions & 1 deletion src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -513,6 +515,7 @@ function EventReadOnly() {
taxonomy?.id,
initialTaxonomy?.includes(taxonomy?.id) ? taxonomy : undefined,
'dynamic',
taxonomy?.isAdminOnly,
)
)
return (
Expand Down
5 changes: 5 additions & 0 deletions src/pages/Dashboard/Events/Events.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -211,6 +213,7 @@ function Events() {
: {},
);

const calendar = getCurrentCalendarDetailsFromUserDetails(user, calendarId);
let customFilters = currentCalendarData?.filterPersonalization?.customFields;
const dateTypeSelector = (dates) => {
if (dates?.length == 2) {
Expand Down Expand Up @@ -907,6 +910,7 @@ function Events() {
</SearchableCheckbox>
</Col>
{allTaxonomyData?.data?.length > 0 &&
adminCheckHandler({ user, calendar }) &&
allTaxonomyData?.data?.map((taxonomy, index) => {
if (!taxonomy?.isDynamicField && customFilters?.includes(taxonomy?.id))
return (
Expand Down Expand Up @@ -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 (
Expand Down
4 changes: 3 additions & 1 deletion src/pages/Dashboard/Organizations/Organizations.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
});

Expand Down Expand Up @@ -364,6 +364,7 @@ function Organizations() {
/>
<Space>
{allTaxonomyData?.data?.length > 0 &&
adminCheckHandler({ user, calendar }) &&
allTaxonomyData?.data?.map((taxonomy, index) => {
if (!taxonomy?.isDynamicField && customFilters?.includes(taxonomy?.id))
return (
Expand Down Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -534,6 +539,7 @@ function OrganizationsReadOnly() {
taxonomy?.id,
initialTaxonomy?.includes(taxonomy?.id) ? taxonomy : undefined,
'dynamic',
taxonomy?.isAdminOnly,
)
)
return (
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Dashboard/People/People.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ function People() {
/>
<Space>
{allTaxonomyData?.data?.length > 0 &&
adminCheckHandler({ user, calendar }) &&
allTaxonomyData?.data?.map((taxonomy, index) => {
if (!taxonomy?.isDynamicField && customFilters?.includes(taxonomy?.id))
return (
Expand Down Expand Up @@ -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 (
Expand Down
8 changes: 7 additions & 1 deletion src/pages/Dashboard/PersonReadOnly/PersonReadOnly.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -74,6 +76,7 @@ function PersonReadOnly() {
});

const { user } = useSelector(getUserDetails);
const calendar = getCurrentCalendarDetailsFromUserDetails(user, calendarId);
const activeTabKey = useSelector(getActiveTabKey);

const calendarContentLanguage = currentCalendarData?.contentLanguage;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -331,6 +336,7 @@ function PersonReadOnly() {
taxonomy?.id,
initialTaxonomy?.includes(taxonomy?.id) ? taxonomy : undefined,
'dynamic',
taxonomy?.isAdminOnly,
)
)
return (
Expand Down
8 changes: 7 additions & 1 deletion src/pages/Dashboard/PlaceReadOnly/PlaceReadOnly.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -79,6 +81,7 @@ function PlaceReadOnly() {
});

const { user } = useSelector(getUserDetails);
const calendar = getCurrentCalendarDetailsFromUserDetails(user, calendarId);
const activeTabKey = useSelector(getActiveTabKey);

const [locationPlace, setLocationPlace] = useState();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -386,6 +391,7 @@ function PlaceReadOnly() {
taxonomy?.id,
initialTaxonomy?.includes(taxonomy?.id) ? taxonomy : undefined,
'dynamic',
taxonomy?.isAdminOnly,
)
)
return (
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Dashboard/Places/Places.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ function Places() {
/>
<Space>
{allTaxonomyData?.data?.length > 0 &&
adminCheckHandler({ user, calendar }) &&
allTaxonomyData?.data?.map((taxonomy, index) => {
if (!taxonomy?.isDynamicField && customFilters?.includes(taxonomy?.id))
return (
Expand Down Expand Up @@ -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 (
Expand Down
Loading