Merge pull request #4342 from MaximilianKrambach/quickfilters
agenda and motion list filters
This commit is contained in:
commit
9459e9d6e9
@ -107,6 +107,7 @@ export class AgendaListComponent extends ListViewBaseComponent<ViewItem> impleme
|
|||||||
this.config
|
this.config
|
||||||
.get<boolean>('agenda_enable_numbering')
|
.get<boolean>('agenda_enable_numbering')
|
||||||
.subscribe(autoNumbering => (this.isNumberingAllowed = autoNumbering));
|
.subscribe(autoNumbering => (this.isNumberingAllowed = autoNumbering));
|
||||||
|
this.setFulltextFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -286,4 +287,24 @@ export class AgendaListComponent extends ListViewBaseComponent<ViewItem> impleme
|
|||||||
return result;
|
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)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,7 @@ export class MotionListComponent extends ListViewBaseComponent<ViewMotion> imple
|
|||||||
this.dataSource.data = sortedData;
|
this.dataSource.data = sortedData;
|
||||||
this.checkSelection();
|
this.checkSelection();
|
||||||
});
|
});
|
||||||
|
this.setFulltextFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -285,4 +286,47 @@ export class MotionListComponent extends ListViewBaseComponent<ViewMotion> imple
|
|||||||
this.configService.instant<string>('motions_recommendation_text_mode') as ChangeRecoMode
|
this.configService.instant<string>('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;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user