diff --git a/src/constants/eventFormRequiredFieldNames.js b/src/constants/eventFormRequiredFieldNames.js index 7e8d03eb..594176f6 100644 --- a/src/constants/eventFormRequiredFieldNames.js +++ b/src/constants/eventFormRequiredFieldNames.js @@ -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', diff --git a/src/constants/standardFieldsTranslations.js b/src/constants/standardFieldsTranslations.js index 5528109e..33721a74 100644 --- a/src/constants/standardFieldsTranslations.js +++ b/src/constants/standardFieldsTranslations.js @@ -46,6 +46,13 @@ export const EVENT = [ en: 'Event type', fr: "Type d'événement", }, + { + label: {(t) => t('dashboard.taxonomy.standardFields.Event.EventDiscipline')}, + key: 'EventDiscipline', + value: 'EventDiscipline', + en: 'Discipline', + fr: 'Discipline', + }, { label: {(t) => t('dashboard.taxonomy.standardFields.place.inLanguage')}, key: 'inLanguage', diff --git a/src/locales/en/translationEn.json b/src/locales/en/translationEn.json index c3f1ea9b..bbdb610d 100644 --- a/src/locales/en/translationEn.json +++ b/src/locales/en/translationEn.json @@ -1079,6 +1079,7 @@ "EventAccessibility": "Event accessibility", "Audience": "Audience", "EventType": "Event type", + "EventDiscipline": "Discipline", "OrganizerRole": "Organizer Role", "PerformerRole": "Performer Role", "SupporterRole": "Contributor Role" diff --git a/src/locales/fr/transalationFr.json b/src/locales/fr/transalationFr.json index 6b2453f8..94dccdb8 100644 --- a/src/locales/fr/transalationFr.json +++ b/src/locales/fr/transalationFr.json @@ -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" diff --git a/src/pages/Dashboard/AddEvent/AddEvent.jsx b/src/pages/Dashboard/AddEvent/AddEvent.jsx index 47099bc4..d9a539aa 100644 --- a/src/pages/Dashboard/AddEvent/AddEvent.jsx +++ b/src/pages/Dashboard/AddEvent/AddEvent.jsx @@ -400,7 +400,8 @@ function AddEvent() { recurringEvent, description = {}, name = {}, - inLanguage = []; + inLanguage = [], + eventDiscipline = []; let eventObj; @@ -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; @@ -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) { @@ -812,6 +810,7 @@ function AddEvent() { ...(accessibilityNote && { accessibilityNote }), additionalType, audience, + discipline: eventDiscipline, url: { uri: urlProtocolCheck(values?.eventLink), @@ -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; @@ -2336,6 +2338,54 @@ function AddEvent() { }} /> + 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"> + } + clearIcon={} + treeData={treeTaxonomyOptions( + allTaxonomyData, + user, + 'EventDiscipline', + false, + calendarContentLanguage, + )} + tagRender={(props) => { + const { label, closable, onClose } = props; + return ( + } + data-cy={`tag-event-discipline-${label}`}> + {label} + + ); + }} + data-cy="treeselect-event-discipline" + /> + {allTaxonomyData?.data?.map((taxonomy, index) => { if (taxonomy?.isDynamicField) { let initialValues; diff --git a/src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx b/src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx index d14bd2a9..cc41ad51 100644 --- a/src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx +++ b/src/pages/Dashboard/EventReadOnly/EventReadOnly.jsx @@ -405,6 +405,40 @@ function EventReadOnly() { /> )} + {eventData?.discipline?.length > 0 && ( +
+
+

+ {taxonomyDetails(allTaxonomyData?.data, user, 'EventDiscipline', 'name', false)} +

+ type?.entityId)} + tagRender={(props) => { + const { label } = props; + return {label}; + }} + /> +
+ )} {allTaxonomyData?.data?.map((taxonomy, index) => { if (taxonomy?.isDynamicField) { let initialValues,