diff --git a/client/apps/Planning/PlanningList.tsx b/client/apps/Planning/PlanningList.tsx index 2a77ac744..3a2d7e932 100644 --- a/client/apps/Planning/PlanningList.tsx +++ b/client/apps/Planning/PlanningList.tsx @@ -17,6 +17,7 @@ import { IContactItem, SORT_FIELD, ICommonSearchParams, + ISearchFilter, } from '../../interfaces'; import * as actions from '../../actions'; @@ -61,6 +62,7 @@ interface IProps { listViewType: LIST_VIEW_TYPE; sortField: SORT_FIELD; currentSearch: ICommonSearchParams; + searchFilters: Array; openPreview(item: IEventOrPlanningItem): void; edit(item: IEventOrPlanningItem): void; @@ -94,7 +96,8 @@ const mapStateToProps = (state) => ({ contacts: selectors.general.contactsById(state), listViewType: selectors.main.getCurrentListViewType(state), sortField: selectors.main.getCurrentSortField(state), - currentSearch: selectors.main.currentSearch(state) + currentSearch: selectors.main.currentSearch(state), + searchFilters: selectors.eventsPlanning.combinedViewFilters(state), }); const mapDispatchToProps = (dispatch) => ({ @@ -140,6 +143,10 @@ export class PlanningListComponent extends React.PureComponent { } render() { + const activeSearchFilter = this.props.searchFilters.filter((filter) => + filter.item_type === FILTER_TYPE[this.props.activeFilter] && + filter._id === this.props.currentSearch?.filter_id); + const { groups, agendas, @@ -211,6 +218,7 @@ export class PlanningListComponent extends React.PureComponent { sortField={sortField} indexItems searchParams={currentSearch.advancedSearch} + searchFilterParams={activeSearchFilter[0]?.params} /> ); diff --git a/client/components/Main/ListGroup.tsx b/client/components/Main/ListGroup.tsx index d3cbac9df..6cb144717 100644 --- a/client/components/Main/ListGroup.tsx +++ b/client/components/Main/ListGroup.tsx @@ -2,7 +2,11 @@ import React from 'react'; import moment from 'moment-timezone'; import {ListGroupItem} from './'; import {Group, Header} from '../UI/List'; -import {ICommonAdvancedSearchParams, IEventOrPlanningItem, LIST_VIEW_TYPE, SORT_FIELD} from '../../interfaces'; +import { + ICommonAdvancedSearchParams, + IEventOrPlanningItem, ISearchFilter, + LIST_VIEW_TYPE, SORT_FIELD +} from '../../interfaces'; import {timeUtils} from '../../utils'; const TIME_COLUMN_MIN_WIDTH = { @@ -78,7 +82,8 @@ interface IProps { listViewType?: string; sortField?: string; listBoxGroupProps: {}; - searchParams:ICommonAdvancedSearchParams; + searchParams?: ICommonAdvancedSearchParams; + searchFilterParams?: ISearchFilter['params']; } export class ListGroup extends React.Component { @@ -147,6 +152,7 @@ export class ListGroup extends React.Component { sortField, listBoxGroupProps, searchParams, + searchFilterParams, } = this.props; // with defaults @@ -208,6 +214,7 @@ export class ListGroup extends React.Component { sortField: sortField, minTimeWidth: minTimeWidth, searchParams: searchParams, + searchFilterParams: searchFilterParams, }; if (indexItems) { diff --git a/client/components/Main/ListGroupItem.tsx b/client/components/Main/ListGroupItem.tsx index 5290de171..b942b83e9 100644 --- a/client/components/Main/ListGroupItem.tsx +++ b/client/components/Main/ListGroupItem.tsx @@ -4,7 +4,7 @@ import { IEventListItemProps, IPlanningListItemProps, IEventOrPlanningItem, - IEventItem, IPlanningItem, IBaseListItemProps, ICommonAdvancedSearchParams + IEventItem, IPlanningItem, IBaseListItemProps, ICommonAdvancedSearchParams, ISearchFilter } from '../../interfaces'; import {EventItem, EventItemWithPlanning} from '../Events'; @@ -27,6 +27,7 @@ interface IProps extends Omit< navigateDown?: boolean; minTimeWidth?: string; searchParams?: ICommonAdvancedSearchParams; + searchFilterParams?: ISearchFilter['params']; onDoubleClick(item: IEventOrPlanningItem): void; showRelatedPlannings(item: IEventItem): void; @@ -123,6 +124,7 @@ export class ListGroupItem extends React.Component { sortField, minTimeWidth, searchParams, + searchFilterParams, } = this.props; const itemType = getItemType(item); @@ -152,7 +154,7 @@ export class ListGroupItem extends React.Component { ...itemProps, item: item as IEventItem, calendars: calendars, - filterLanguage: searchParams?.language, + filterLanguage: searchParams?.language || searchFilterParams?.language, multiSelected: indexOf(selectedEventIds, item._id) !== -1, [EVENTS.ITEM_ACTIONS.EDIT_EVENT.actionName]: itemActions[EVENTS.ITEM_ACTIONS.EDIT_EVENT.actionName], @@ -195,7 +197,7 @@ export class ListGroupItem extends React.Component { contentTypes: contentTypes, agendas: agendas, date: date, - filterLanguage: searchParams?.language, + filterLanguage: searchParams?.language || searchFilterParams?.language, onAddCoverageClick: onAddCoverageClick, multiSelected: indexOf(selectedPlanningIds, item._id) !== -1, showAddCoverage: showAddCoverage, diff --git a/client/components/Main/ListPanel.tsx b/client/components/Main/ListPanel.tsx index 4b503e73e..d6c36a9b0 100644 --- a/client/components/Main/ListPanel.tsx +++ b/client/components/Main/ListPanel.tsx @@ -10,6 +10,7 @@ import { IEventOrPlanningItem, IG2ContentType, ILockedItems, IPlanningItem, + ISearchFilter, ISession, LIST_VIEW_TYPE, SORT_FIELD } from '../../interfaces'; @@ -68,7 +69,8 @@ interface IProps { listViewType: LIST_VIEW_TYPE; sortField: SORT_FIELD; userInitiatedSearch?: boolean; - searchParams?: ICommonAdvancedSearchParams + searchParams?: ICommonAdvancedSearchParams, + searchFilterParams?: ISearchFilter['params'] onItemClick(item: IEventOrPlanningItem): void; onDoubleClick(item: IEventOrPlanningItem): void; @@ -319,7 +321,8 @@ export class ListPanel extends React.Component { contacts, listViewType, sortField, - searchParams + searchParams, + searchFilterParams, } = this.props; let indexFrom = 0; @@ -399,6 +402,7 @@ export class ListPanel extends React.Component { sortField: sortField, listBoxGroupProps: listBoxGroupProps, searchParams: searchParams, + searchFilterParams: searchFilterParams, ...propsForNestedListItems, };