From 65cb100714cc4e70b94002c380258d789cf197a2 Mon Sep 17 00:00:00 2001 From: devketanpro Date: Wed, 20 Dec 2023 10:17:34 +0530 Subject: [PATCH] Hide the text 'Agenda:No Agenda Assigned.' in the list view of the planning items (and anywhere else) if the Agenda field was not selected in the Planning tem profile [SDESK-7136] --- client/components/Main/ListGroupItem.tsx | 2 ++ client/components/Planning/PlanningItem.tsx | 10 +++++++--- client/interfaces.ts | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/client/components/Main/ListGroupItem.tsx b/client/components/Main/ListGroupItem.tsx index b942b83e9..7224f1196 100644 --- a/client/components/Main/ListGroupItem.tsx +++ b/client/components/Main/ListGroupItem.tsx @@ -12,6 +12,7 @@ import {PlanningItem} from '../Planning'; import {ITEM_TYPE, EVENTS, PLANNING, MAIN, CLICK_DELAY} from '../../constants'; import {getItemType, eventUtils} from '../../utils'; +import {planningApi} from '../../superdeskApi'; interface IProps extends Omit< IEventListItemProps & IPlanningListItemProps, @@ -198,6 +199,7 @@ export class ListGroupItem extends React.Component { agendas: agendas, date: date, filterLanguage: searchParams?.language || searchFilterParams?.language, + isAgendaEnabled: planningApi.planning.getEditorProfile().editor.agendas.enabled, onAddCoverageClick: onAddCoverageClick, multiSelected: indexOf(selectedPlanningIds, item._id) !== -1, showAddCoverage: showAddCoverage, diff --git a/client/components/Planning/PlanningItem.tsx b/client/components/Planning/PlanningItem.tsx index b651f19e3..108aec9b1 100644 --- a/client/components/Planning/PlanningItem.tsx +++ b/client/components/Planning/PlanningItem.tsx @@ -66,7 +66,8 @@ class PlanningItemComponent extends React.Component { planningUtils.getAgendaNames(nextProps.item, nextProps.agendas) ) || this.props.minTimeWidth !== nextProps.minTimeWidth || - this.props.filterLanguage !== nextProps.filterLanguage; + this.props.filterLanguage !== nextProps.filterLanguage || + this.props.isAgendaEnabled !== nextProps.isAgendaEnabled; } onItemHoverOn() { @@ -186,7 +187,8 @@ class PlanningItemComponent extends React.Component { agendas, contacts, listViewType, - filterLanguage + filterLanguage, + isAgendaEnabled, } = this.props; if (!item) { @@ -198,7 +200,9 @@ class PlanningItemComponent extends React.Component { const event = get(item, 'event'); const borderState = isItemLocked ? 'locked' : false; const isExpired = isItemExpired(item); - const secondaryFields = get(listFields, 'planning.secondary_fields', PLANNING.LIST.SECONDARY_FIELDS); + const secondaryFields = get(listFields, 'planning.secondary_fields', PLANNING.LIST.SECONDARY_FIELDS) + .filter((fields) => isAgendaEnabled ? true : fields !== 'agendas'); + const {querySelectorParent} = superdeskApi.utilities; const language = filterLanguage || item.language || getUserInterfaceLanguageFromCV(); diff --git a/client/interfaces.ts b/client/interfaces.ts index f2a30f006..1b84bf377 100644 --- a/client/interfaces.ts +++ b/client/interfaces.ts @@ -868,6 +868,7 @@ export interface IPlanningListItemProps extends IBaseListItemProps; desks: Array; filterLanguage?: string; + isAgendaEnabled?:boolean; // showUnlock?: boolean; // Is this used anymore? hideItemActions: boolean; showAddCoverage: boolean;