Skip to content

Commit

Permalink
Merge pull request #1253 from culturecreates/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
sahalali authored Jul 31, 2024
2 parents 4b6ae22 + 60ec40b commit b942640
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 21 deletions.
1 change: 1 addition & 0 deletions src/constants/eventFormRequiredFieldNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const eventFormRequiredFieldNames = {
START_DATE: 'START_DATE',
TICKET_INFO: 'TICKET_INFO',
EVENT_TYPE: 'EVENT_TYPE',
EVENT_DISCIPLINE: 'EVENT_DISCIPLINE',
AUDIENCE: 'AUDIENCE',
LOCATION: 'LOCATION',
IMAGE: 'IMAGE',
Expand Down
7 changes: 7 additions & 0 deletions src/constants/standardFieldsTranslations.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ export const EVENT = [
en: 'Event type',
fr: "Type d'événement",
},
{
label: <Translation>{(t) => t('dashboard.taxonomy.standardFields.Event.EventDiscipline')}</Translation>,
key: 'EventDiscipline',
value: 'EventDiscipline',
en: 'Discipline',
fr: 'Discipline',
},
{
label: <Translation>{(t) => t('dashboard.taxonomy.standardFields.place.inLanguage')}</Translation>,
key: 'inLanguage',
Expand Down
1 change: 1 addition & 0 deletions src/locales/en/translationEn.json
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,7 @@
"EventAccessibility": "Event accessibility",
"Audience": "Audience",
"EventType": "Event type",
"EventDiscipline": "Discipline",
"OrganizerRole": "Organizer Role",
"PerformerRole": "Performer Role",
"SupporterRole": "Contributor Role"
Expand Down
1 change: 1 addition & 0 deletions src/locales/fr/transalationFr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,7 @@
"EventAccessibility": "Accessibilité de l'événement",
"Audience": "Public",
"EventType": "Type d'événement",
"EventDiscipline": "Discipline",
"OrganizerRole": "Rôle de l'organisation",
"PerformerRole": "Rôle d'interprète",
"SupporterRole": "Rôle de contributeur"
Expand Down
92 changes: 71 additions & 21 deletions src/pages/Dashboard/AddEvent/AddEvent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ function AddEvent() {
recurringEvent,
description = {},
name = {},
inLanguage = [];
inLanguage = [],
eventDiscipline = [];

let eventObj;

Expand Down Expand Up @@ -581,25 +582,24 @@ function AddEvent() {
}

if (values?.eventType) {
additionalType = values?.eventType?.map((eventTypeId) => {
return {
entityId: eventTypeId,
};
});
additionalType = values?.eventType?.map((eventTypeId) => ({
entityId: eventTypeId,
}));
}
if (values?.eventDiscipline) {
eventDiscipline = values?.eventDiscipline?.map((eventDiscipline) => ({
entityId: eventDiscipline,
}));
}
if (values?.targetAudience) {
audience = values?.targetAudience?.map((audienceId) => {
return {
entityId: audienceId,
};
});
audience = values?.targetAudience?.map((audienceId) => ({
entityId: audienceId,
}));
}
if (values?.inLanguage) {
inLanguage = values?.inLanguage?.map((inLanguageId) => {
return {
entityId: inLanguageId,
};
});
inLanguage = values?.inLanguage?.map((inLanguageId) => ({
entityId: inLanguageId,
}));
}
if (values?.locationPlace || values?.locationPlace?.length > 0) {
let place;
Expand Down Expand Up @@ -658,11 +658,9 @@ function AddEvent() {
};
}
if (values?.eventAccessibility) {
accessibility = values?.eventAccessibility?.map((accessibilityId) => {
return {
entityId: accessibilityId,
};
});
accessibility = values?.eventAccessibility?.map((accessibilityId) => ({
entityId: accessibilityId,
}));
}

if (values?.englishAccessibilityNote || values?.frenchAccessibilityNote) {
Expand Down Expand Up @@ -812,6 +810,7 @@ function AddEvent() {
...(accessibilityNote && { accessibilityNote }),
additionalType,
audience,
discipline: eventDiscipline,

url: {
uri: urlProtocolCheck(values?.eventLink),
Expand Down Expand Up @@ -1926,6 +1925,9 @@ function AddEvent() {
case eventFormRequiredFieldNames.EVENT_TYPE:
publishValidateFields.push('eventType');
break;
case eventFormRequiredFieldNames.EVENT_DISCIPLINE:
publishValidateFields.push('eventDiscipline');
break;
case eventFormRequiredFieldNames.AUDIENCE:
publishValidateFields.push('targetAudience');
break;
Expand Down Expand Up @@ -2336,6 +2338,54 @@ function AddEvent() {
}}
/>
</Form.Item>
<Form.Item
name="eventDiscipline"
label={taxonomyDetails(allTaxonomyData?.data, user, 'EventDiscipline', 'name', false)}
initialValue={eventData?.discipline?.map((type) => type?.entityId)}
hidden={
standardAdminOnlyFields?.includes(eventFormRequiredFieldNames?.EVENT_DISCIPLINE)
? adminCheckHandler({ calendar, user })
? false
: true
: false
}
style={{
display: !taxonomyDetails(allTaxonomyData?.data, user, 'EventDiscipline', 'name', false) && 'none',
}}
rules={[
{
required: requiredFieldNames?.includes(eventFormRequiredFieldNames?.EVENT_DISCIPLINE),
message: t('common.validations.informationRequired'),
},
]}
data-cy="form-item-event-discipline-label">
<TreeSelectOption
allowClear
treeDefaultExpandAll
notFoundContent={<NoContent />}
clearIcon={<CloseCircleOutlined style={{ color: '#1b3de6', fontSize: '14px' }} />}
treeData={treeTaxonomyOptions(
allTaxonomyData,
user,
'EventDiscipline',
false,
calendarContentLanguage,
)}
tagRender={(props) => {
const { label, closable, onClose } = props;
return (
<Tags
closable={closable}
onClose={onClose}
closeIcon={<CloseCircleOutlined style={{ color: '#1b3de6', fontSize: '12px' }} />}
data-cy={`tag-event-discipline-${label}`}>
{label}
</Tags>
);
}}
data-cy="treeselect-event-discipline"
/>
</Form.Item>
{allTaxonomyData?.data?.map((taxonomy, index) => {
if (taxonomy?.isDynamicField) {
let initialValues;
Expand Down
34 changes: 34 additions & 0 deletions src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,40 @@ function EventReadOnly() {
/>
</div>
)}
{eventData?.discipline?.length > 0 && (
<div
style={{
display: standardAdminOnlyFields?.includes(eventFormRequiredFieldNames?.EVENT_DISCIPLINE)
? adminCheckHandler({ calendar, user })
? 'initial'
: 'none'
: 'initial',
}}>
<br />
<p className="read-only-event-content-sub-title-primary">
{taxonomyDetails(allTaxonomyData?.data, user, 'EventDiscipline', 'name', false)}
</p>
<TreeSelectOption
style={{ marginBottom: '1rem' }}
bordered={false}
showArrow={false}
open={false}
disabled
treeData={treeTaxonomyOptions(
allTaxonomyData,
user,
'EventDiscipline',
false,
calendarContentLanguage,
)}
defaultValue={eventData?.discipline?.map((type) => type?.entityId)}
tagRender={(props) => {
const { label } = props;
return <Tags>{label}</Tags>;
}}
/>
</div>
)}
{allTaxonomyData?.data?.map((taxonomy, index) => {
if (taxonomy?.isDynamicField) {
let initialValues,
Expand Down

0 comments on commit b942640

Please sign in to comment.