diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/list/participant-list.component.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/list/participant-list.component.ts index 03de9cc9d..6e5257d10 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/list/participant-list.component.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/list/participant-list.component.ts @@ -164,11 +164,13 @@ export class ParticipantListComponent implements OnInit, OnChanges, DoCheck { } private getJudicialPanelMembers(): ParticipantModel[] { - console.log(this.hearing.judiciaryParticipants); - return this.hearing.judiciaryParticipants - .filter(j => j.roleCode === 'PanelMember') - .sort((a, b) => a.displayName.localeCompare(b.displayName)) - .map(h => ParticipantModel.fromJudicialMember(h, false)); + if (this.hearing.judiciaryParticipants) { + console.log(this.hearing.judiciaryParticipants); + return this.hearing.judiciaryParticipants + .filter(j => j.roleCode === 'PanelMember') + .sort((a, b) => a.displayName.localeCompare(b.displayName)) + .map(h => ParticipantModel.fromJudicialMember(h, false)); + } } private getPanelMembers() { diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.spec.ts index 19fb0f018..245f7cc44 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.spec.ts @@ -377,6 +377,7 @@ describe('SummaryComponent with valid request', () => { expect(component.hearing.linked_participants).toEqual([]); expect(component.hearing.participants).toEqual([]); }); + it('should remove interpreter and clear the linked participant list on remove interpreter', () => { component.ngOnInit(); component.hearing.participants = []; diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.ts index a34e6dddf..0c8b9b39d 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.ts @@ -136,7 +136,7 @@ export class SummaryComponent implements OnInit, OnDestroy { } this.judgeAssigned = this.hearing.participants.filter(e => e.is_judge).length > 0 || - this.hearing.judiciaryParticipants.some(e => e.roleCode === 'Judge'); + this.hearing.judiciaryParticipants?.some(e => e.roleCode === 'Judge'); } private checkForExistingRequest() { @@ -179,7 +179,7 @@ export class SummaryComponent implements OnInit, OnDestroy { } } - const judicalParticipant = this.hearing.judiciaryParticipants.findIndex(x => x.email === this.selectedParticipantEmail); + const judicalParticipant = this.hearing.judiciaryParticipants?.findIndex(x => x.email === this.selectedParticipantEmail); if (judicalParticipant > -1) { this.removerFullName = this.hearing.judiciaryParticipants[judicalParticipant].fullName; this.showConfirmationRemoveParticipant = true; @@ -214,7 +214,7 @@ export class SummaryComponent implements OnInit, OnDestroy { this.hearing = { ...this.hearing }; } - const judicalParticipant = this.hearing.judiciaryParticipants.findIndex(x => x.email === this.selectedParticipantEmail); + const judicalParticipant = this.hearing.judiciaryParticipants?.findIndex(x => x.email === this.selectedParticipantEmail); if (judicalParticipant > -1) { this.hearing.judiciaryParticipants.splice(judicalParticipant, 1); this.hearing = { ...this.hearing };