Create new projectors with clos reference

New projectors will be created on a reference to the current list of
of speakers
This commit is contained in:
Sean 2020-03-23 16:57:29 +01:00
parent fe71322199
commit 99c3afb417
2 changed files with 9 additions and 1 deletions

View File

@ -135,4 +135,11 @@ export class ProjectorRepositoryService extends BaseRepository<ViewProjector, Pr
public async setReferenceProjector(projector_id: number): Promise<void> { public async setReferenceProjector(projector_id: number): Promise<void> {
await this.http.post<void>(`/rest/core/projector/${projector_id}/set_reference_projector/`); await this.http.post<void>(`/rest/core/projector/${projector_id}/set_reference_projector/`);
} }
/**
* return the id of the current reference projector
*/
public getReferenceProjectorId(): number {
return this.getViewModelList().find(projector => projector.isReferenceProjector).id;
}
} }

View File

@ -113,7 +113,8 @@ export class ProjectorListComponent extends BaseViewComponent implements OnInit,
dialogRef.afterClosed().subscribe(result => { dialogRef.afterClosed().subscribe(result => {
if (result) { if (result) {
const projectorToCreate: Partial<Projector> = { const projectorToCreate: Partial<Projector> = {
name: this.createForm.value.name name: this.createForm.value.name,
reference_projector_id: this.repo.getReferenceProjectorId()
}; };
this.repo.create(projectorToCreate).then(() => { this.repo.create(projectorToCreate).then(() => {