Add speakers-filter to motion list

The motion list (and the amendment list) now have an option to filter if speakers are present on the corresponding LOS-object to the displayed motions
This commit is contained in:
Sean Engelhardt 2019-08-22 15:39:18 +02:00
parent b80ac3ac68
commit dee41593c4
2 changed files with 18 additions and 0 deletions

View File

@ -329,6 +329,10 @@ export class ViewMotion extends BaseViewModelWithAgendaItemAndListOfSpeakers<Mot
return !!this.personalNote && !!this.personalNote.note;
}
public get hasSpeakers(): boolean {
return this.speakerAmount > 0;
}
/**
* Translate the state's css class into a color
*

View File

@ -88,6 +88,15 @@ export class MotionFilterListService extends BaseFilterListService<ViewMotion> {
options: []
};
public hasSpeakerOptions: OsFilter = {
property: 'hasSpeakers',
label: 'Speakers',
options: [
{ condition: true, label: this.translate.instant('Has speakers') },
{ condition: false, label: this.translate.instant('Has no speakers') }
]
};
public personalNoteFilterOptions = [
{
property: 'star',
@ -212,6 +221,11 @@ export class MotionFilterListService extends BaseFilterListService<ViewMotion> {
this.tagFilterOptions
];
// only add the filter if the user has the correct permission
if (this.operator.hasPerms('agenda.can_see_list_of_speakers')) {
filterDefinitions.push(this.hasSpeakerOptions);
}
if (!this.operator.isAnonymous) {
filterDefinitions = filterDefinitions.concat(this.personalNoteFilterOptions);
}