diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/endpoints.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/endpoints.component.spec.ts index e3723a619..698b83a9b 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/endpoints.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/endpoints.component.spec.ts @@ -57,7 +57,8 @@ function initHearingRequest(): HearingModel { pin: 'pin', username: 'test@existing.com', contactEmail: 'test@existing.com', - interpretationLanguage: undefined + interpretationLanguage: undefined, + externalReferenceId: 'ex1' } ]; return newHearing; @@ -212,7 +213,14 @@ describe('EndpointsComponent', () => { featureServiceSpy.getFlag.withArgs(FeatureFlags.multiDayBookingEnhancements).and.returnValue(of(true)); component.ngOnInit(); component.videoEndpoints = [ - { id: '1', displayName: 'Test', defenceAdvocate: null, interpretationLanguage: undefined, screening: undefined } + { + id: '1', + displayName: 'Test', + defenceAdvocate: null, + interpretationLanguage: undefined, + screening: undefined, + externalReferenceId: '1' + } ]; component.saveEndpoints(); expect(routerSpy.navigate).toHaveBeenCalledWith(['/other-information']); @@ -232,7 +240,8 @@ describe('EndpointsComponent', () => { displayName: 'Test', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: '1' }; component.onEndpointAdded(endpoint); expect(component.videoEndpoints).toContain(endpoint); @@ -244,7 +253,8 @@ describe('EndpointsComponent', () => { displayName: 'Test', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: '1' }; component.videoEndpoints = [endpoint]; component.onEndpointAdded(endpoint); @@ -255,8 +265,22 @@ describe('EndpointsComponent', () => { describe('onEndpointUpdated', () => { beforeEach(() => { component.videoEndpoints = [ - { id: '1', displayName: 'Test', defenceAdvocate: null, interpretationLanguage: undefined, screening: undefined }, - { id: '2', displayName: 'Test2', defenceAdvocate: null, interpretationLanguage: undefined, screening: undefined } + { + id: '1', + displayName: 'Test', + defenceAdvocate: null, + interpretationLanguage: undefined, + screening: undefined, + externalReferenceId: '1' + }, + { + id: '2', + displayName: 'Test2', + defenceAdvocate: null, + interpretationLanguage: undefined, + screening: undefined, + externalReferenceId: '1' + } ]; }); @@ -266,7 +290,8 @@ describe('EndpointsComponent', () => { displayName: 'Test', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: '1' }; component.videoEndpoints = [endpoint]; const updatedEndpoint = { @@ -274,7 +299,8 @@ describe('EndpointsComponent', () => { displayName: 'Updated', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: '1' }; component.onEndpointUpdated({ original: endpoint, updated: updatedEndpoint }); expect(component.videoEndpoints).toContain(updatedEndpoint); @@ -286,14 +312,16 @@ describe('EndpointsComponent', () => { displayName: 'DoesNotExist', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: '1' }; const updatedEndpoint = { id: '1', displayName: 'Updated', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: '1' }; component.onEndpointUpdated({ original: endpoint, updated: updatedEndpoint }); expect(component.videoEndpoints).not.toContain(endpoint); @@ -303,8 +331,22 @@ describe('EndpointsComponent', () => { describe('onEndpointSelectedForDeletion', () => { beforeEach(() => { component.videoEndpoints = [ - { id: '1', displayName: 'Test', defenceAdvocate: null, interpretationLanguage: undefined, screening: undefined }, - { id: '2', displayName: 'Test2', defenceAdvocate: null, interpretationLanguage: undefined, screening: undefined } + { + id: '1', + displayName: 'Test', + defenceAdvocate: null, + interpretationLanguage: undefined, + screening: undefined, + externalReferenceId: '1' + }, + { + id: '2', + displayName: 'Test2', + defenceAdvocate: null, + interpretationLanguage: undefined, + screening: undefined, + externalReferenceId: '1' + } ]; }); @@ -314,7 +356,8 @@ describe('EndpointsComponent', () => { displayName: 'Test', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: '1' }; component.onEndpointSelectedForDeletion(endpoint); expect(component.videoEndpoints).not.toContain(endpoint); @@ -326,7 +369,8 @@ describe('EndpointsComponent', () => { displayName: 'Test3', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: '1' }; component.onEndpointSelectedForDeletion(endpoint); expect(component.videoEndpoints.length).toBe(2); @@ -340,7 +384,8 @@ describe('EndpointsComponent', () => { displayName: 'Test', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: '1' }; component.onEndpointSelectedForEdit(endpoint); expect(component.videoEndpointToEdit).toBe(endpoint); diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/endpoints.component.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/endpoints.component.ts index dce9b8c7b..ceac8a7f6 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/endpoints.component.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/endpoints.component.ts @@ -95,7 +95,7 @@ export class EndpointsComponent extends BookingBaseComponent implements OnInit, const newEndpointsArray: EndpointModel[] = []; for (const vapDto of this.videoEndpoints) { - const endpointModel = new EndpointModel(); + const endpointModel = new EndpointModel(vapDto.externalReferenceId); endpointModel.id = vapDto.id; endpointModel.displayName = vapDto.displayName; endpointModel.defenceAdvocate = vapDto.defenceAdvocate?.email; @@ -197,7 +197,8 @@ export class EndpointsComponent extends BookingBaseComponent implements OnInit, } : null, interpretationLanguage: e.interpretationLanguage, - screening: e.screening + screening: e.screening, + externalReferenceId: e.externalReferenceId }; }); } diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/models/video-access-point.model.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/models/video-access-point.model.ts index 1967e11da..153a9c86e 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/models/video-access-point.model.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/models/video-access-point.model.ts @@ -7,6 +7,7 @@ export interface VideoAccessPointDto { defenceAdvocate?: EndpointLink; interpretationLanguage: InterpreterSelectedDto; // This should not be optional once the backend is implemented screening: ScreeningDto; + externalReferenceId: string; } export interface EndpointLink { diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/video-endpoint-form/video-endpoint-form.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/video-endpoint-form/video-endpoint-form.component.spec.ts index 3e41f2608..8867dfe81 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/video-endpoint-form/video-endpoint-form.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/video-endpoint-form/video-endpoint-form.component.spec.ts @@ -1,4 +1,4 @@ -import { ComponentFixture, TestBed, fakeAsync, flush } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormBuilder, ReactiveFormsModule } from '@angular/forms'; import { VideoEndpointFormComponent } from './video-endpoint-form.component'; import { VideoAccessPointDto } from '../models/video-access-point.model'; @@ -83,7 +83,8 @@ describe('VideoEndpointFormComponent', () => { displayName: 'Test', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: undefined }; component.form.setValue({ displayName: dto.displayName, @@ -110,14 +111,16 @@ describe('VideoEndpointFormComponent', () => { displayName: 'Original', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: undefined }; const updatedDto: VideoAccessPointDto = { id: '1', displayName: 'Updated', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: undefined }; component.existingVideoEndpoint = originalDto; component.form.setValue({ @@ -134,11 +137,11 @@ describe('VideoEndpointFormComponent', () => { const rep = component.availableRepresentatives[0]; // update the input field with the email of the first participant via the debug fixture element - const displayNameInput = fixture.nativeElement.querySelector('[id="displayName"') as HTMLInputElement; + const displayNameInput = fixture.nativeElement.querySelector('[id="displayName"]') as HTMLInputElement; displayNameInput.value = 'Test Endpoint'; displayNameInput.dispatchEvent(new Event('input')); - const linkedRepresentativeInput = fixture.nativeElement.querySelector('[id="representative"') as HTMLSelectElement; + const linkedRepresentativeInput = fixture.nativeElement.querySelector('[id="representative"]') as HTMLSelectElement; linkedRepresentativeInput.value = rep.email; linkedRepresentativeInput.dispatchEvent(new Event('change')); @@ -150,7 +153,8 @@ describe('VideoEndpointFormComponent', () => { displayName: rep.display_name }, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: undefined }); }); @@ -171,7 +175,8 @@ describe('VideoEndpointFormComponent', () => { displayName: 'Test', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: undefined } ]; component.videoEndpoint = { @@ -179,7 +184,8 @@ describe('VideoEndpointFormComponent', () => { displayName: 'Test', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: undefined }; component.form.setValue({ displayName: 'Test', diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/video-endpoint-form/video-endpoint-form.component.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/video-endpoint-form/video-endpoint-form.component.ts index 1560e1c2e..f9971b03b 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/video-endpoint-form/video-endpoint-form.component.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/video-endpoint-form/video-endpoint-form.component.ts @@ -94,7 +94,8 @@ export class VideoEndpointFormComponent { displayName: this.form.value.displayName, defenceAdvocate, interpretationLanguage: this.interpreterSelection, - screening: this.videoEndpoint?.screening + screening: this.videoEndpoint?.screening, + externalReferenceId: this.videoEndpoint?.externalReferenceId }; if (this.editMode) { this.endpointUpdated.emit({ original: this.videoEndpoint, updated: dto }); diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/video-endpoint-item/video-endpoint-item.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/video-endpoint-item/video-endpoint-item.component.spec.ts index 08453b46e..10ea65ca2 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/video-endpoint-item/video-endpoint-item.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/video-endpoint-item/video-endpoint-item.component.spec.ts @@ -26,7 +26,8 @@ describe('VideoEndpointItemComponent', () => { displayName: 'Test', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: undefined }; component.videoEndpoint = dto; component.edit(); @@ -39,7 +40,8 @@ describe('VideoEndpointItemComponent', () => { displayName: 'Test', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: undefined }; component.videoEndpoint = dto; component.delete(); diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/video-endpoint-list/video-endpoint-list.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/video-endpoint-list/video-endpoint-list.component.spec.ts index 0398f5816..a06959c4f 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/video-endpoint-list/video-endpoint-list.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/video-endpoint-list/video-endpoint-list.component.spec.ts @@ -26,7 +26,8 @@ describe('VideoEndpointListComponent', () => { displayName: 'Test', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: undefined }; component.editEndpoint.emit(dto); expect(component.editEndpoint.emit).toHaveBeenCalledWith(dto); @@ -38,7 +39,8 @@ describe('VideoEndpointListComponent', () => { displayName: 'Test', defenceAdvocate: null, interpretationLanguage: undefined, - screening: undefined + screening: undefined, + externalReferenceId: undefined }; component.deleteEndpoint.emit(dto); expect(component.deleteEndpoint.emit).toHaveBeenCalledWith(dto); diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/screening/screening-form.component.html b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/screening/screening-form.component.html index 0e9c635a4..8b7365216 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/screening/screening-form.component.html +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/screening/screening-form.component.html @@ -63,7 +63,15 @@ - +
+
+ + + Warning + New participants and endpoints cannot be included in screening options, without being saved first. + +
+