From 99c3afb4178ff3fccc72620d6aadd98cb03b59ac Mon Sep 17 00:00:00 2001 From: Sean Date: Mon, 23 Mar 2020 16:57:29 +0100 Subject: [PATCH] Create new projectors with clos reference New projectors will be created on a reference to the current list of of speakers --- .../repositories/projector/projector-repository.service.ts | 7 +++++++ .../components/projector-list/projector-list.component.ts | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/client/src/app/core/repositories/projector/projector-repository.service.ts b/client/src/app/core/repositories/projector/projector-repository.service.ts index c0f718110..d2ef0ae99 100644 --- a/client/src/app/core/repositories/projector/projector-repository.service.ts +++ b/client/src/app/core/repositories/projector/projector-repository.service.ts @@ -135,4 +135,11 @@ export class ProjectorRepositoryService extends BaseRepository { await this.http.post(`/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; + } } diff --git a/client/src/app/site/projector/components/projector-list/projector-list.component.ts b/client/src/app/site/projector/components/projector-list/projector-list.component.ts index d78c3d2c8..99718d932 100644 --- a/client/src/app/site/projector/components/projector-list/projector-list.component.ts +++ b/client/src/app/site/projector/components/projector-list/projector-list.component.ts @@ -113,7 +113,8 @@ export class ProjectorListComponent extends BaseViewComponent implements OnInit, dialogRef.afterClosed().subscribe(result => { if (result) { const projectorToCreate: Partial = { - name: this.createForm.value.name + name: this.createForm.value.name, + reference_projector_id: this.repo.getReferenceProjectorId() }; this.repo.create(projectorToCreate).then(() => {