Skip to content

Commit

Permalink
Merge pull request #720 from culturecreates/feature/issue-683
Browse files Browse the repository at this point in the history
tech-support-tickets/issues/29
  • Loading branch information
AbhishekPAnil authored Oct 25, 2023
2 parents 9f33a6b + a489d1d commit 00ef5b3
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 22 deletions.
14 changes: 14 additions & 0 deletions src/components/Button/SmallButton/SmallButton.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import { Button } from 'antd';
import './smallButton.css';

const SmallButton = (props) => {
const { label } = props;
return (
<div className="small-button-wrapper" {...props}>
<Button>{label}</Button>
</div>
);
};

export default SmallButton;
1 change: 1 addition & 0 deletions src/components/Button/SmallButton/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './SmallButton';
22 changes: 22 additions & 0 deletions src/components/Button/SmallButton/smallButton.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.small-button-wrapper .ant-btn {
background: #2196f3;
border-radius: 4px;
height: 24px;
font-size: 12px;
font-weight: 600;
line-height: 16px;
letter-spacing: 0em;
text-align: left;
color: #ffffff;
}

.small-button-wrapper .ant-btn-default {
padding-top: 4px;
padding-left: 8px;
padding-bottom: 4px;
padding-right: 8px;
}

.small-button-wrapper {
cursor: initial;
}
13 changes: 13 additions & 0 deletions src/components/List/SelectionItem/SelectionItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { contentLanguageBilingual } from '../../../utils/bilingual';
import { useSelector } from 'react-redux';
import { getUserDetails } from '../../../redux/reducer/userSlice';
import ArtsDataLink from '../../Tags/ArtsDataLink/ArtsDataLink';
import SmallButton from '../../Button/SmallButton';

function SelectionItem(props) {
const {
Expand All @@ -18,6 +19,7 @@ function SelectionItem(props) {
onClose,
itemWidth,
postalAddress,
region,
accessibility,
openingHours,
calendarContentLanguage,
Expand Down Expand Up @@ -119,6 +121,17 @@ function SelectionItem(props) {

{postalAddress?.postalCode && <span>{postalAddress?.postalCode}</span>}
<br />
{Array.isArray(region) && (
<SmallButton
styles={{ marginTop: 5, marginBottom: 5 }}
label={contentLanguageBilingual({
en: region[0]?.name?.en,
fr: region[0]?.name?.fr,
interfaceLanguage: user?.interfaceLanguage?.toLowerCase(),
calendarContentLanguage: calendarContentLanguage,
})}
/>
)}
{openingHours && (
<p>
<a
Expand Down
2 changes: 2 additions & 0 deletions src/components/Select/selectOption.settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const placesOptions = (data, user, calendarContentLanguage, source = sour
<SelectionItem
itemWidth="100%"
icon={<EnvironmentOutlined style={{ color: '#607EFC' }} />}
region={place?.regions}
name={
place?.name?.en || place?.name?.fr
? contentLanguageBilingual({
Expand Down Expand Up @@ -74,6 +75,7 @@ export const placesOptions = (data, user, calendarContentLanguage, source = sour
})
: typeof place?.description === 'string' && place?.description,
postalAddress: place?.postalAddress ?? place?.address,
region: place?.regions,
accessibility: place?.accessibility ?? [],
openingHours: place?.openingHours,
key: place?.id,
Expand Down
61 changes: 39 additions & 22 deletions src/pages/Dashboard/AddEvent/AddEvent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ function AddEvent() {
.then((response) => {
resolve(response?.id);
setNewEventId(response?.id);

if (!toggle) {
notification.success({
description: t('dashboard.events.addEditEvent.notification.saveAsDraft'),
Expand Down Expand Up @@ -915,42 +916,55 @@ function AddEvent() {
...initialPlace[0],
['openingHours']: initialPlace[0]?.openingHours?.uri,
};
let initialPlaceAccessibiltiy = [];
if (initialPlace[0]?.accessibility?.length > 0) {
getAllTaxonomy({
calendarId,
search: '',
taxonomyClass: taxonomyClass.PLACE,
includeConcepts: true,
sessionId: timestampRef,
})
.unwrap()
.then((res) => {
getAllTaxonomy({
calendarId,
search: '',
taxonomyClass: taxonomyClass.PLACE,
includeConcepts: true,
sessionId: timestampRef,
})
.unwrap()
.then((res) => {
if (initialPlace[0]?.accessibility?.length > 0) {
res?.data?.forEach((taxonomy) => {
if (taxonomy?.mappedToField === 'PlaceAccessibility') {
let initialPlaceAccessibiltiy = [];
initialPlace[0]?.accessibility?.forEach((accessibility) => {
taxonomy?.concept?.forEach((concept) => {
if (concept?.id == accessibility?.entityId) {
initialPlaceAccessibiltiy = initialPlaceAccessibiltiy?.concat([concept]);
initialPlaceAccessibiltiy.push(concept);
}
});
});
initialPlace[0] = {
...initialPlace[0],
['accessibility']: initialPlaceAccessibiltiy,
};
setLocationPlace(placesOptions(initialPlace, user, calendarContentLanguage)[0], sourceOptions.CMS);
}
});
} else {
initialPlace[0] = {
...initialPlace[0],
['accessibility']: initialPlaceAccessibiltiy,
['accessibility']: [],
};
setLocationPlace(placesOptions(initialPlace, user, calendarContentLanguage)[0], sourceOptions.CMS);
})
.catch((error) => console.log(error));
} else {
initialPlace[0] = {
...initialPlace[0],
['accessibility']: [],
};
setLocationPlace(placesOptions(initialPlace, user, calendarContentLanguage)[0], sourceOptions.CMS);
}
}
res?.data?.map((taxonomy) => {
if (taxonomy?.mappedToField == 'Region') {
taxonomy?.concept?.forEach((t) => {
if (initialPlace[0]?.regions[0]?.entityId == t?.id) {
initialPlace[0] = { ...initialPlace[0], regions: [t] };
setLocationPlace(
placesOptions(initialPlace, user, calendarContentLanguage)[0],
sourceOptions.CMS,
);
}
});
}
});
})
.catch((error) => console.log(error));
}
if (eventData?.locations?.filter((location) => location?.isVirtualLocation == true)?.length > 0)
initialAddedFields = initialAddedFields?.concat(locationType?.fieldNames);
Expand All @@ -971,6 +985,7 @@ function AddEvent() {
type: organizer?.type,
logo: organizer?.entity?.logo,
image: organizer?.entity?.image,
contactPoint: organizer?.entity?.contactPoint,
};
});
setSelectedOrganizers(
Expand Down Expand Up @@ -1108,6 +1123,7 @@ function AddEvent() {
window.location.replace(`${location?.origin}${PathName.Dashboard}/${calendarId}${PathName.Events}/${eventId}`);
}
}, [isLoading, currentCalendarData]);

useEffect(() => {
if (currentCalendarData) {
let publishValidateFields = [];
Expand Down Expand Up @@ -1788,6 +1804,7 @@ function AddEvent() {
accessibility={locationPlace?.accessibility}
openingHours={locationPlace?.openingHours}
calendarContentLanguage={calendarContentLanguage}
region={locationPlace?.region}
bordered
closable
onClose={() => {
Expand Down

0 comments on commit 00ef5b3

Please sign in to comment.