Merge pull request #6087 from FinnStutzenstein/multiselectListOfSpeakersClosed

Multiselect open/close LOS in agenda
This commit is contained in:
Emanuel Schütze 2021-06-01 14:43:35 +02:00 committed by GitHub
commit e0da18a0e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 2 deletions

View File

@ -103,13 +103,14 @@
<mat-menu #agendaMenu="matMenu"> <mat-menu #agendaMenu="matMenu">
<div *ngIf="!isMultiSelect"> <div *ngIf="!isMultiSelect">
<div *osPerms="'agenda.can_manage'"> <div *osPerms="['agenda.can_manage', 'agenda.can_manage_list_of_speakers']">
<!-- Enable multi select --> <!-- Enable multi select -->
<button mat-menu-item (click)="toggleMultiSelect()"> <button mat-menu-item (click)="toggleMultiSelect()">
<mat-icon>library_add</mat-icon> <mat-icon>library_add</mat-icon>
<span>{{ 'Multiselect' | translate }}</span> <span>{{ 'Multiselect' | translate }}</span>
</button> </button>
</div>
<div *osPerms="'agenda.can_manage'">
<mat-divider></mat-divider> <mat-divider></mat-divider>
<!-- automatic numbering --> <!-- automatic numbering -->
@ -235,6 +236,23 @@
<span>{{ 'Remove from agenda' | translate }}</span> <span>{{ 'Remove from agenda' | translate }}</span>
</button> </button>
</div> </div>
<ng-container *osPerms="['agenda.can_manage', 'agenda.can_manage_list_of_speakers']">
<mat-divider></mat-divider>
</ng-container>
<div *osPerms="'agenda.can_manage_list_of_speakers'">
<!-- Close selected -->
<button mat-menu-item [disabled]="!selectedRows.length" (click)="setClosedListsOfSpeakersSelected(true)">
<mat-icon>lock</mat-icon>
<span>{{ 'Close list of speakers' | translate }}</span>
</button>
<!-- Open selected -->
<button mat-menu-item [disabled]="!selectedRows.length" (click)="setClosedListsOfSpeakersSelected(false)">
<mat-icon>lock_open</mat-icon>
<span>{{ 'Open list of speakers' | translate }}</span>
</button>
</div>
</div> </div>
</mat-menu> </mat-menu>

View File

@ -303,6 +303,25 @@ export class AgendaListComponent extends BaseListViewComponent<ViewItem> impleme
} }
} }
/**
* Sets multiple entries' open/closed state. Needs items in selectedRows, which
* is only filled with any data in multiSelect mode
*
* @param closed true if the item is to be considered done
*/
public async setClosedListsOfSpeakersSelected(closed: boolean): Promise<void> {
try {
for (const item of this.selectedRows) {
const los = (item.contentObject as any)?.listOfSpeakers;
if (los) {
await this.listOfSpeakersRepo.update({ closed: closed }, los);
}
}
} catch (e) {
this.raiseError(e);
}
}
/** /**
* Export all items as CSV * Export all items as CSV
*/ */