diff --git a/client/src/app/site/agenda/components/agenda-list/agenda-list.component.ts b/client/src/app/site/agenda/components/agenda-list/agenda-list.component.ts index a5a97aaa4..3f9a70d50 100644 --- a/client/src/app/site/agenda/components/agenda-list/agenda-list.component.ts +++ b/client/src/app/site/agenda/components/agenda-list/agenda-list.component.ts @@ -107,6 +107,7 @@ export class AgendaListComponent extends ListViewBaseComponent impleme this.config .get('agenda_enable_numbering') .subscribe(autoNumbering => (this.isNumberingAllowed = autoNumbering)); + this.setFulltextFilter(); } /** @@ -287,4 +288,24 @@ export class AgendaListComponent extends ListViewBaseComponent impleme return result; } } + + /** + * Overwrites the dataSource's string filter with a case-insensitive search + * in the item number and title + */ + private setFulltextFilter(): void { + this.dataSource.filterPredicate = (data, filter) => { + if (!data) { + return false; + } + filter = filter ? filter.toLowerCase() : ''; + return ( + data.itemNumber.toLowerCase().includes(filter) || + data + .getListTitle() + .toLowerCase() + .includes(filter) + ); + }; + } } diff --git a/client/src/app/site/motions/components/motion-list/motion-list.component.ts b/client/src/app/site/motions/components/motion-list/motion-list.component.ts index 2abe56949..648760b8c 100644 --- a/client/src/app/site/motions/components/motion-list/motion-list.component.ts +++ b/client/src/app/site/motions/components/motion-list/motion-list.component.ts @@ -135,6 +135,7 @@ export class MotionListComponent extends ListViewBaseComponent imple this.dataSource.data = sortedData; this.checkSelection(); }); + this.setFulltextFilter(); } /** @@ -285,4 +286,47 @@ export class MotionListComponent extends ListViewBaseComponent imple this.configService.instant('motions_recommendation_text_mode') as ChangeRecoMode ); } + + /** + * Overwrites the dataSource's string filter with a case-insensitive search + * in the identifier, title, state, recommendations, submitters and motion blocks + */ + private setFulltextFilter(): void { + this.dataSource.filterPredicate = (data, filter) => { + if (!data) { + return false; + } + filter = filter ? filter.toLowerCase() : ''; + if ( + data.recommendation && + this.translate + .instant(data.recommendation.recommendation_label) + .toLowerCase() + .includes(filter) + ) { + return true; + } + if ( + this.translate + .instant(data.state.name) + .toLowerCase() + .includes(filter) + ) { + return true; + } + if (data.submitters.length && data.submitters.find(user => user.full_name.toLowerCase().includes(filter))) { + return true; + } + if (data.motion_block && data.motion_block.title.toLowerCase().includes(filter)) { + return true; + } + if (data.title.toLowerCase().includes(filter)) { + return true; + } + if (data.identifier && data.identifier.toLowerCase().includes(filter)) { + return true; + } + return false; + }; + } }