From 059bd499c5874cfc6b75c2aff1c5e00a378d509b Mon Sep 17 00:00:00 2001 From: Brandon Thomas-Davies <87308252+BrandonT95@users.noreply.github.com> Date: Wed, 27 Mar 2024 12:23:52 +0000 Subject: [PATCH 01/29] feat(cb2-10241): update adr notes to use custom component --- .../view-list-item.component.html | 29 ------------------- ...examiner-notes-history-view.component.html | 10 +++---- .../forms/templates/general/adr.template.ts | 2 +- 3 files changed, 6 insertions(+), 35 deletions(-) diff --git a/src/app/forms/components/view-list-item/view-list-item.component.html b/src/app/forms/components/view-list-item/view-list-item.component.html index 254413c294..8ded37f9b4 100644 --- a/src/app/forms/components/view-list-item/view-list-item.component.html +++ b/src/app/forms/components/view-list-item/view-list-item.component.html @@ -20,35 +20,6 @@ - - - - - - - - - - - - - - - - - - -
DateCreated ByNotes
- {{ result.createdAtDate | date : 'dd/MM/yyyy' | defaultNullOrEmpty }} - {{ result.lastUpdatedBy }}{{ result.note }}
-
-
-
No additional examiner notes history available
-
-
- -
- diff --git a/src/app/forms/custom-sections/adr-examiner-notes-history-view/adr-examiner-notes-history-view.component.html b/src/app/forms/custom-sections/adr-examiner-notes-history-view/adr-examiner-notes-history-view.component.html index 6e640b7c6e..87203f4425 100644 --- a/src/app/forms/custom-sections/adr-examiner-notes-history-view/adr-examiner-notes-history-view.component.html +++ b/src/app/forms/custom-sections/adr-examiner-notes-history-view/adr-examiner-notes-history-view.component.html @@ -1,21 +1,21 @@
-

ADR Examiner Notes History

+

Additional Examiner Notes History

- - + + diff --git a/src/app/forms/templates/general/adr.template.ts b/src/app/forms/templates/general/adr.template.ts index 4cc047312e..b1a86e2191 100644 --- a/src/app/forms/templates/general/adr.template.ts +++ b/src/app/forms/templates/general/adr.template.ts @@ -775,7 +775,7 @@ export const AdrTemplate: FormNode = { label: 'Additional examiner notes history', value: null, type: FormNodeTypes.CONTROL, - viewType: FormNodeViewTypes.ADR_EXAMINER_NOTES, // TODO: replace with custom + viewType: FormNodeViewTypes.CUSTOM, viewComponent: AdrExaminerNotesHistoryViewComponent, editType: FormNodeEditTypes.CUSTOM, editComponent: AdrExaminerNotesHistoryEditComponent, From d078144559a042a61522a1fef36981880d250349 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Wed, 27 Mar 2024 14:51:13 +0000 Subject: [PATCH 02/29] feat(cb2-11250): format table --- .../adr-examiner-notes-history-edit.component.html | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html index aa75a8a9dd..869a93ce5f 100644 --- a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html +++ b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html @@ -8,18 +8,22 @@
DateCreated By NotesCreated ByDate
- {{ result.createdAtDate | date : 'dd/MM/yyyy' | defaultNullOrEmpty }} + {{ result.note }} {{ result.lastUpdatedBy }} - {{ result.note }} + {{ result.createdAtDate | date : 'dd/MM/yyyy' | defaultNullOrEmpty }}
- - + + + + From ee711c0c2bc47a9d7c97a463dcc4ecfd22c010d8 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Wed, 27 Mar 2024 15:20:01 +0000 Subject: [PATCH 03/29] feat(cb2-11250): set up router link --- ...examiner-notes-history-edit.component.html | 2 +- ...r-examiner-notes-history.component-edit.ts | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html index 869a93ce5f..d2b346b4d6 100644 --- a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html +++ b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html @@ -23,7 +23,7 @@ {{ examinerNote.createdAtDate | date: 'dd/MM/yyyy' | defaultNullOrEmpty }} diff --git a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.ts b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.ts index 608210e6da..2a49984fc0 100644 --- a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.ts +++ b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.ts @@ -1,4 +1,4 @@ -import { KeyValue } from '@angular/common'; +import { KeyValue, ViewportScroller } from '@angular/common'; import { AfterContentInit, Component, inject, OnDestroy, OnInit, @@ -9,6 +9,11 @@ import { BaseControlComponent } from '@forms/components/base-control/base-contro import { CustomControl, CustomFormControl } from '@forms/services/dynamic-form.types'; import { TechnicalRecordService } from '@services/technical-record/technical-record.service'; import { ReplaySubject, takeUntil } from 'rxjs'; +import { updateScrollPosition } from '@store/technical-records'; +import { TechnicalRecordServiceState } from '@store/technical-records/reducers/technical-record-service.reducer'; +import { Store } from '@ngrx/store'; +import { ActivatedRoute, Router } from '@angular/router'; +import { ReasonForEditing } from '@models/vehicle-tech-record.model'; @Component({ selector: 'app-adr-examiner-notes-history', @@ -22,6 +27,11 @@ export class AdrExaminerNotesHistoryEditComponent extends BaseControlComponent i formArray = new FormArray([]); currentTechRecord?: TechRecordType<'hgv' | 'lgv' | 'trl'> = undefined; technicalRecordService = inject(TechnicalRecordService); + store = inject(Store); + viewportScroller = inject(ViewportScroller); + router = inject(Router); + route = inject(ActivatedRoute); + editingReason?: ReasonForEditing; ngOnInit() { this.formArray.valueChanges.pipe(takeUntil(this.destroy$)).subscribe((changes) => { @@ -30,6 +40,7 @@ export class AdrExaminerNotesHistoryEditComponent extends BaseControlComponent i this.technicalRecordService.techRecord$.pipe(takeUntil(this.destroy$)).subscribe((currentTechRecord) => { this.currentTechRecord = currentTechRecord as TechRecordType<'hgv' | 'lgv' | 'trl'>; }); + this.editingReason = this.route.snapshot.data['reason']; } override ngAfterContentInit() { @@ -48,6 +59,14 @@ export class AdrExaminerNotesHistoryEditComponent extends BaseControlComponent i return returnValue; } + getEditAdditionalExaminerNotePage(examinerNoteIndex: number) { + const route = this.editingReason ? `../${this.editingReason}/edit-examiner-note/${examinerNoteIndex}` : `./tyre-search/${examinerNoteIndex}`; + + this.store.dispatch(updateScrollPosition({ position: this.viewportScroller.getScrollPosition() })); + + void this.router.navigate([route], { relativeTo: this.route, state: this.currentTechRecord }); + } + ngOnDestroy() { this.destroy$.next(true); this.destroy$.complete(); From 491dfa0b1cbce82f78e012ecb1ccff54b6cd1b21 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Wed, 27 Mar 2024 15:41:24 +0000 Subject: [PATCH 04/29] feat(cb2-11250): blank page link working --- ...it-additional-examiner-note.component.html | 1 + ...it-additional-examiner-note.component.scss | 0 ...additional-examiner-note.component.spec.ts | 0 ...edit-additional-examiner-note.component.ts | 15 +++++ .../tech-record/tech-record-routing.module.ts | 59 ++++++++++++++++--- .../tech-record/tech-record.module.ts | 4 ++ ...r-examiner-notes-history.component-edit.ts | 2 +- src/app/models/routes.enum.ts | 2 + 8 files changed, 74 insertions(+), 9 deletions(-) create mode 100644 src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html create mode 100644 src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.scss create mode 100644 src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts create mode 100644 src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html new file mode 100644 index 0000000000..d2e41facc2 --- /dev/null +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html @@ -0,0 +1 @@ +
This is a blank page right now.
diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.scss b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts new file mode 100644 index 0000000000..959a601a3e --- /dev/null +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts @@ -0,0 +1,15 @@ +import { Component, OnDestroy, OnInit } from '@angular/core'; + +@Component({ + selector: 'tech-record-edit-additional-examiner-note', + templateUrl: './tech-record-edit-additional-examiner-note.component.html', + styleUrls: ['./tech-record-edit-additional-examiner-note.component.scss'], +}) +export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit, OnDestroy { + ngOnDestroy(): void { + } + + ngOnInit(): void { + } + +} diff --git a/src/app/features/tech-record/tech-record-routing.module.ts b/src/app/features/tech-record/tech-record-routing.module.ts index 757d0dc75b..717d3f920b 100644 --- a/src/app/features/tech-record/tech-record-routing.module.ts +++ b/src/app/features/tech-record/tech-record-routing.module.ts @@ -10,20 +10,39 @@ import { techRecordDataResolver } from 'src/app/resolvers/tech-record-data/tech- import { techRecordValidateResolver } from 'src/app/resolvers/tech-record-validate/tech-record-validate.resolver'; import { techRecordViewResolver } from 'src/app/resolvers/tech-record-view/tech-record-view.resolver'; import { TechRecordRoutes } from '@models/routes.enum'; -import { AdrGenerateCertificateComponent } from './components/adr-generate-certificate/adr-generate-certificate.component'; -import { TechRecordAmendReasonComponent } from './components/tech-record-amend-reason/tech-record-amend-reason.component'; +import { + AdrGenerateCertificateComponent, +} from './components/adr-generate-certificate/adr-generate-certificate.component'; +import { + TechRecordAmendReasonComponent, +} from './components/tech-record-amend-reason/tech-record-amend-reason.component'; import { AmendVinComponent } from './components/tech-record-amend-vin/tech-record-amend-vin.component'; -import { AmendVrmReasonComponent } from './components/tech-record-amend-vrm-reason/tech-record-amend-vrm-reason.component'; +import { + AmendVrmReasonComponent, +} from './components/tech-record-amend-vrm-reason/tech-record-amend-vrm-reason.component'; import { AmendVrmComponent } from './components/tech-record-amend-vrm/tech-record-amend-vrm.component'; -import { TechRecordChangeStatusComponent } from './components/tech-record-change-status/tech-record-change-status.component'; +import { + TechRecordChangeStatusComponent, +} from './components/tech-record-change-status/tech-record-change-status.component'; import { ChangeVehicleTypeComponent } from './components/tech-record-change-type/tech-record-change-type.component'; -import { TechRecordChangeVisibilityComponent } from './components/tech-record-change-visibility/tech-record-change-visibility.component'; -import { GenerateLetterComponent } from './components/tech-record-generate-letter/tech-record-generate-letter.component'; +import { + TechRecordChangeVisibilityComponent, +} from './components/tech-record-change-visibility/tech-record-change-visibility.component'; +import { + GenerateLetterComponent, +} from './components/tech-record-generate-letter/tech-record-generate-letter.component'; import { GeneratePlateComponent } from './components/tech-record-generate-plate/tech-record-generate-plate.component'; -import { TechRecordSearchTyresComponent } from './components/tech-record-search-tyres/tech-record-search-tyres.component'; -import { TechRecordSummaryChangesComponent } from './components/tech-record-summary-changes/tech-record-summary-changes.component'; +import { + TechRecordSearchTyresComponent, +} from './components/tech-record-search-tyres/tech-record-search-tyres.component'; +import { + TechRecordSummaryChangesComponent, +} from './components/tech-record-summary-changes/tech-record-summary-changes.component'; import { TechRecordUnarchiveComponent } from './components/tech-record-unarchive/tech-record-unarchive-component'; import { TechRecordComponent } from './tech-record.component'; +import { + TechRecordEditAdditionalExaminerNoteComponent, +} from './components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component'; const routes: Routes = [ { @@ -154,6 +173,18 @@ const routes: Routes = [ data: { roles: Roles.TechRecordAmend }, canActivate: [MsalGuard, RoleGuard], }, + { + path: TechRecordRoutes.CORRECT_ERROR_EDIT_ADDITIONAL_EXAMINER_NOTE, + component: TechRecordEditAdditionalExaminerNoteComponent, + data: { + title: 'edit-additional-examiner-note', + roles: Roles.TechRecordAmend, + isEditing: true, + reason: ReasonForEditing.CORRECTING_AN_ERROR, + }, + canActivate: [MsalGuard, RoleGuard], + resolve: { techRecord: techRecordViewResolver }, + }, { path: TechRecordRoutes.NOTIFIABLE_ALTERATION_NEEDED_CHANGE_SUMMARY, component: TechRecordSummaryChangesComponent, @@ -172,6 +203,18 @@ const routes: Routes = [ canActivate: [MsalGuard, RoleGuard], resolve: { techRecord: techRecordViewResolver }, }, + { + path: TechRecordRoutes.NOTIFIABLE_ALTERNATION_NEEDED_EDIT_ADDITIONAL_EXAMINER_NOTE, + component: TechRecordEditAdditionalExaminerNoteComponent, + data: { + title: 'edit-additional-examiner-note', + roles: Roles.TechRecordAmend, + isEditing: true, + reason: ReasonForEditing.NOTIFIABLE_ALTERATION_NEEDED, + }, + canActivate: [MsalGuard, RoleGuard], + resolve: { techRecord: techRecordViewResolver }, + }, { path: TechRecordRoutes.TEST_RECORDS, data: { title: 'Test record', roles: Roles.TestResultView }, diff --git a/src/app/features/tech-record/tech-record.module.ts b/src/app/features/tech-record/tech-record.module.ts index 7ad498a655..05cf3d5da6 100644 --- a/src/app/features/tech-record/tech-record.module.ts +++ b/src/app/features/tech-record/tech-record.module.ts @@ -25,6 +25,9 @@ import { TechRecordComponent } from './tech-record.component'; import { AmendVrmReasonComponent } from './components/tech-record-amend-vrm-reason/tech-record-amend-vrm-reason.component'; import { TechRecordSummaryChangesComponent } from './components/tech-record-summary-changes/tech-record-summary-changes.component'; import { AdrGenerateCertificateComponent } from './components/adr-generate-certificate/adr-generate-certificate.component'; +import { + TechRecordEditAdditionalExaminerNoteComponent +} from './components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component'; @NgModule({ declarations: [ @@ -43,6 +46,7 @@ import { AdrGenerateCertificateComponent } from './components/adr-generate-certi TechRecordHistoryComponent, TechRecordSearchTyresComponent, TechRecordTitleComponent, + TechRecordEditAdditionalExaminerNoteComponent, TechRouterOutletComponent, TestRecordSummaryComponent, VehicleTechnicalRecordComponent, diff --git a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.ts b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.ts index 2a49984fc0..a79f94f0c7 100644 --- a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.ts +++ b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.ts @@ -60,7 +60,7 @@ export class AdrExaminerNotesHistoryEditComponent extends BaseControlComponent i } getEditAdditionalExaminerNotePage(examinerNoteIndex: number) { - const route = this.editingReason ? `../${this.editingReason}/edit-examiner-note/${examinerNoteIndex}` : `./tyre-search/${examinerNoteIndex}`; + const route = this.editingReason ? `../${this.editingReason}/edit-additional-examiner-note/${examinerNoteIndex}` : `./tyre-search/${examinerNoteIndex}`; this.store.dispatch(updateScrollPosition({ position: this.viewportScroller.getScrollPosition() })); diff --git a/src/app/models/routes.enum.ts b/src/app/models/routes.enum.ts index f478b7c7d4..1df9e718a1 100644 --- a/src/app/models/routes.enum.ts +++ b/src/app/models/routes.enum.ts @@ -30,8 +30,10 @@ export enum TechRecordRoutes { CHANGE_VTA_VISIBILITY = 'change-vta-visibility', CORRECT_ERROR_TYRE_SEARCH = 'correcting-an-error/tyre-search/:axleNumber', CORRECT_ERROR_CHANGE_SUMMARY = 'correcting-an-error/change-summary', + CORRECT_ERROR_EDIT_ADDITIONAL_EXAMINER_NOTE = 'correcting-an-error/edit-additional-examiner-note/:examinerNoteIndex', NOTIFIABLE_ALTERATION_NEEDED_CHANGE_SUMMARY = 'notifiable-alteration-needed/change-summary', NOTIFIABLE_ALTERATION_NEEDED_TYRE_SEARCH = 'notifiable-alteration-needed/tyre-search/:axleNumber', + NOTIFIABLE_ALTERNATION_NEEDED_EDIT_ADDITIONAL_EXAMINER_NOTE = 'notifiable-alteration-needed/edit-additional-examiner-note/:examinerNoteIndex', TEST_RECORDS = 'test-records/test-result/:testResultId/:testNumber', CREATE_TEST = 'test-records/create-test', ADR_CERTIFICATE = 'adr-certificate', From 436cc7ec205ee2f8956654ff2f8be38410400d7c Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Wed, 27 Mar 2024 15:44:04 +0000 Subject: [PATCH 05/29] feat(cb2-11250): revert unnecessary changes --- ...ech-record-edit-additional-examiner-note.component.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts index 959a601a3e..b8139fa97c 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts @@ -1,15 +1,10 @@ -import { Component, OnDestroy, OnInit } from '@angular/core'; +import { Component } from '@angular/core'; @Component({ selector: 'tech-record-edit-additional-examiner-note', templateUrl: './tech-record-edit-additional-examiner-note.component.html', styleUrls: ['./tech-record-edit-additional-examiner-note.component.scss'], }) -export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit, OnDestroy { - ngOnDestroy(): void { - } - - ngOnInit(): void { - } +export class TechRecordEditAdditionalExaminerNoteComponent { } From 8222b11c07014e69e8c0fbe5ef9b821cb1560093 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Wed, 27 Mar 2024 15:55:53 +0000 Subject: [PATCH 06/29] feat(cb2-11250): amend routing function --- .../adr-examiner-notes-history.component-edit.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.ts b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.ts index a79f94f0c7..cf732128cf 100644 --- a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.ts +++ b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.ts @@ -60,7 +60,7 @@ export class AdrExaminerNotesHistoryEditComponent extends BaseControlComponent i } getEditAdditionalExaminerNotePage(examinerNoteIndex: number) { - const route = this.editingReason ? `../${this.editingReason}/edit-additional-examiner-note/${examinerNoteIndex}` : `./tyre-search/${examinerNoteIndex}`; + const route = `../${this.editingReason}/edit-additional-examiner-note/${examinerNoteIndex}`; this.store.dispatch(updateScrollPosition({ position: this.viewportScroller.getScrollPosition() })); From 71bf1c522f71933404cd9a1115b3d0741e431789 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Thu, 28 Mar 2024 09:24:53 +0000 Subject: [PATCH 07/29] feat(cb2-11250): fix linting and add unit test --- .../tech-record/tech-record.module.ts | 2 +- ...miner-notes-history.component-edit.spec.ts | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/app/features/tech-record/tech-record.module.ts b/src/app/features/tech-record/tech-record.module.ts index 05cf3d5da6..34c34563bf 100644 --- a/src/app/features/tech-record/tech-record.module.ts +++ b/src/app/features/tech-record/tech-record.module.ts @@ -26,7 +26,7 @@ import { AmendVrmReasonComponent } from './components/tech-record-amend-vrm-reas import { TechRecordSummaryChangesComponent } from './components/tech-record-summary-changes/tech-record-summary-changes.component'; import { AdrGenerateCertificateComponent } from './components/adr-generate-certificate/adr-generate-certificate.component'; import { - TechRecordEditAdditionalExaminerNoteComponent + TechRecordEditAdditionalExaminerNoteComponent, } from './components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component'; @NgModule({ diff --git a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.spec.ts b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.spec.ts index 8f3255936e..f41a81df74 100644 --- a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.spec.ts +++ b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.spec.ts @@ -8,6 +8,12 @@ import { DynamicFormsModule } from '@forms/dynamic-forms.module'; import { mockVehicleTechnicalRecord } from '@mocks/mock-vehicle-technical-record.mock'; import { VehicleTypes } from '@models/vehicle-tech-record.model'; import { TechnicalRecordService } from '@services/technical-record/technical-record.service'; +import { provideMockStore } from '@ngrx/store/testing'; +import { initialAppState } from '@store/index'; +import { ActivatedRoute, Router } from '@angular/router'; +import { of } from 'rxjs'; +import { RouterTestingModule } from '@angular/router/testing'; +import { Store } from '@ngrx/store'; const mockTechRecordService = { techRecord$: jest.fn(), @@ -15,16 +21,20 @@ const mockTechRecordService = { describe('AdrExaminerNotesHistoryEditComponent', () => { let component: AdrExaminerNotesHistoryEditComponent; let fixture: ComponentFixture; + let router: Router; beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [AdrExaminerNotesHistoryEditComponent], - imports: [DynamicFormsModule, FormsModule, ReactiveFormsModule], + imports: [DynamicFormsModule, FormsModule, ReactiveFormsModule, RouterTestingModule], providers: [ { provide: TechnicalRecordService, useValue: mockTechRecordService }, + provideMockStore({ initialState: initialAppState }), + { provide: ActivatedRoute, useValue: { params: of([{ id: 1 }]) } }, ], }).compileComponents(); fixture = TestBed.createComponent(AdrExaminerNotesHistoryEditComponent); component = fixture.componentInstance; + router = TestBed.inject(Router); }); describe('ngOnDestroy', () => { it('should call destroy$.next and destroy$.complete', () => { @@ -56,4 +66,11 @@ describe('AdrExaminerNotesHistoryEditComponent', () => { expect(notes).toEqual([testNote]); }); }); + describe('getEditAdditionalExaminerNotePage', () => { + it('should navigate you to the EditAdditionalExaminerNotePage', () => { + const routerSpy = jest.spyOn(router, 'navigate'); + component.getEditAdditionalExaminerNotePage(1); + expect(routerSpy).toHaveBeenCalled(); + }); + }); }); From 1674375cccd80c6a6741a90d142837e9a5804372 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Thu, 28 Mar 2024 09:36:07 +0000 Subject: [PATCH 08/29] feat(cb2-11250): fix linting and add unit test --- ...additional-examiner-note.component.spec.ts | 38 +++++++++++++++++++ ...miner-notes-history.component-edit.spec.ts | 1 - 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts index e69de29bb2..f829df2360 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts @@ -0,0 +1,38 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { + AdrExaminerNotesHistoryEditComponent +} from '@forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit'; +import { DynamicFormsModule } from '@forms/dynamic-forms.module'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { RouterTestingModule } from '@angular/router/testing'; +import { TechnicalRecordService } from '@services/technical-record/technical-record.service'; +import { provideMockStore } from '@ngrx/store/testing'; +import { initialAppState } from '@store/index'; +import { ActivatedRoute, Router } from '@angular/router'; +import { of } from 'rxjs'; +import { TechRecordEditAdditionalExaminerNoteComponent } from './tech-record-edit-additional-examiner-note.component'; + + +const mockTechRecordService = { + techRecord$: jest.fn(), +}; +describe('TechRecordEditAdditionalExaminerNoteComponent', () => { + let fixture: ComponentFixture; + let component: TechRecordEditAdditionalExaminerNoteComponent; + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [TechRecordEditAdditionalExaminerNoteComponent], + imports: [DynamicFormsModule, FormsModule, ReactiveFormsModule, RouterTestingModule], + providers: [ + { provide: TechnicalRecordService, useValue: mockTechRecordService }, + provideMockStore({ initialState: initialAppState }), + { provide: ActivatedRoute, useValue: { params: of([{ id: 1 }]) } }, + ], + }).compileComponents(); + fixture = TestBed.createComponent(AdrExaminerNotesHistoryEditComponent); + component = fixture.componentInstance; + }); + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.spec.ts b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.spec.ts index f41a81df74..b66f521c34 100644 --- a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.spec.ts +++ b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.spec.ts @@ -13,7 +13,6 @@ import { initialAppState } from '@store/index'; import { ActivatedRoute, Router } from '@angular/router'; import { of } from 'rxjs'; import { RouterTestingModule } from '@angular/router/testing'; -import { Store } from '@ngrx/store'; const mockTechRecordService = { techRecord$: jest.fn(), From aaa721a8517c01a96ae738fa9630f37a7c3ffc95 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Thu, 28 Mar 2024 10:00:37 +0000 Subject: [PATCH 09/29] feat(cb2-11250): update link design --- .../adr-examiner-notes-history-edit.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html index d2b346b4d6..2541e88f48 100644 --- a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html +++ b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html @@ -23,7 +23,7 @@ {{ examinerNote.createdAtDate | date: 'dd/MM/yyyy' | defaultNullOrEmpty }}
From f5589646a2ea84394fddae0ac8f73be614880509 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Thu, 28 Mar 2024 11:21:33 +0000 Subject: [PATCH 10/29] feat(cb2-11250): fix button link styling --- .../adr-examiner-notes-history-edit.component.html | 2 +- .../adr-examiner-notes-history.component-edit.scss | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html index 2541e88f48..1a3319f3a9 100644 --- a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html +++ b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html @@ -23,7 +23,7 @@ {{ examinerNote.createdAtDate | date: 'dd/MM/yyyy' | defaultNullOrEmpty }} diff --git a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.scss b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.scss index dc97c176aa..2df9a0b23d 100644 --- a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.scss +++ b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit.scss @@ -15,4 +15,10 @@ display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; -} \ No newline at end of file +} + +.button { + cursor: pointer; + text-decoration: underline; + color: blue; +} From 12cb9755b93dfb745daee67536c7006aa052a98a Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Thu, 28 Mar 2024 14:54:43 +0000 Subject: [PATCH 11/29] feat(cb2-10033): basic setup and grabbed selected note from record --- ...it-additional-examiner-note.component.html | 8 ++- ...edit-additional-examiner-note.component.ts | 66 ++++++++++++++++++- 2 files changed, 71 insertions(+), 3 deletions(-) diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html index d2e41facc2..cee3e75467 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html @@ -1 +1,7 @@ -
This is a blank page right now.
+
+ This is a blank page right now. + + Save + Back + +
diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts index b8139fa97c..add426dd67 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts @@ -1,10 +1,72 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { TechnicalRecordService } from '@services/technical-record/technical-record.service'; +import { TechRecordType } from '@dvsa/cvs-type-definitions/types/v3/tech-record/tech-record-vehicle-type'; +import { ReplaySubject, take, takeUntil } from 'rxjs'; +import { GlobalErrorService } from '@core/components/global-error/global-error.service'; +import { GlobalError } from '@core/components/global-error/global-error.interface'; +import { AdditionalExaminerNotes } from '@dvsa/cvs-type-definitions/types/v3/tech-record/get/hgv/complete'; @Component({ selector: 'tech-record-edit-additional-examiner-note', templateUrl: './tech-record-edit-additional-examiner-note.component.html', styleUrls: ['./tech-record-edit-additional-examiner-note.component.scss'], }) -export class TechRecordEditAdditionalExaminerNoteComponent { +export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { + currentTechRecord!: TechRecordType<'hgv' | 'trl' | 'lgv'>; + examinerNote!: AdditionalExaminerNotes; + examinerNoteIndex!: number; + destroy$ = new ReplaySubject(1); + + constructor( + private router: Router, + private route: ActivatedRoute, + private technicalRecordService: TechnicalRecordService, + private globalErrorService: GlobalErrorService, + ) { } + + ngOnInit() { + this.technicalRecordService.techRecord$.pipe(takeUntil(this.destroy$)).subscribe((currentTechRecord) => { + this.currentTechRecord = currentTechRecord as TechRecordType<'hgv' | 'lgv' | 'trl'>; + }); + + this.route.params.pipe(take(1)).subscribe((params) => { + this.examinerNoteIndex = params['examinerNoteIndex']; + }); + const additionalExaminerNotes = this.currentTechRecord?.techRecord_adrDetails_additionalExaminerNotes; + if (additionalExaminerNotes) { + this.examinerNote = additionalExaminerNotes[this.examinerNoteIndex]; + console.log(this.examinerNote); + } + } + + navigateBack() { + this.globalErrorService.clearErrors(); + void this.router.navigate(['../../'], { relativeTo: this.route }); + } + + handleSubmit(): void { + if (!this.isFormValid()) { + return; + } + console.log('should dispatch amendAdditionalExaminerNote action'); + // this.store.dispatch( + // amendAdditionalExaminerNote({}) + // ); + } + + isFormValid(): boolean { + this.globalErrorService.clearErrors(); + + const errors: GlobalError[] = []; + + // check for errors in form + + if (errors?.length > 0) { + this.globalErrorService.setErrors(errors); + return false; + } + return true; + } } From eba2597f14384fc3d35bd45451e9d0cb5566b8c1 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Thu, 28 Mar 2024 15:36:43 +0000 Subject: [PATCH 12/29] feat(cb2-10033): stash for mobbing --- ...it-additional-examiner-note.component.html | 21 ++++++++++++++++++- ...edit-additional-examiner-note.component.ts | 9 ++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html index cee3e75467..d832803251 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html @@ -1,7 +1,26 @@
This is a blank page right now. +
+
+
+

Edit Additional Examiner Note

+
+
+ + +
+
+
+
Save - Back + Cancel
diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts index add426dd67..9f25edce56 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts @@ -6,6 +6,7 @@ import { ReplaySubject, take, takeUntil } from 'rxjs'; import { GlobalErrorService } from '@core/components/global-error/global-error.service'; import { GlobalError } from '@core/components/global-error/global-error.interface'; import { AdditionalExaminerNotes } from '@dvsa/cvs-type-definitions/types/v3/tech-record/get/hgv/complete'; +import { FormNodeEditTypes, FormNodeWidth } from '@forms/services/dynamic-form.types'; @Component({ selector: 'tech-record-edit-additional-examiner-note', @@ -69,4 +70,12 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { return true; } + get editTypes(): typeof FormNodeEditTypes { + return FormNodeEditTypes; + } + + get widths(): typeof FormNodeWidth { + return FormNodeWidth; + } + } From 41ad7c359c1fc5c2b8e8d2f3f8153f72157a3c4b Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Thu, 28 Mar 2024 16:01:12 +0000 Subject: [PATCH 13/29] feat(cb2-10033): hook form up to display note which is to be edited --- ...dit-additional-examiner-note.component.html | 18 +++++++++--------- ...-edit-additional-examiner-note.component.ts | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html index d832803251..ca3a4fd6a9 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html @@ -5,15 +5,15 @@

Edit Additional Examiner Note

-
- + + +
diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts index 9f25edce56..ec2caea5ae 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts @@ -6,7 +6,8 @@ import { ReplaySubject, take, takeUntil } from 'rxjs'; import { GlobalErrorService } from '@core/components/global-error/global-error.service'; import { GlobalError } from '@core/components/global-error/global-error.interface'; import { AdditionalExaminerNotes } from '@dvsa/cvs-type-definitions/types/v3/tech-record/get/hgv/complete'; -import { FormNodeEditTypes, FormNodeWidth } from '@forms/services/dynamic-form.types'; +import { CustomFormControl, FormNodeEditTypes, FormNodeTypes, FormNodeWidth } from '@forms/services/dynamic-form.types'; +import { FormGroup, Validators } from '@angular/forms'; @Component({ selector: 'tech-record-edit-additional-examiner-note', @@ -18,6 +19,8 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { examinerNote!: AdditionalExaminerNotes; examinerNoteIndex!: number; destroy$ = new ReplaySubject(1); + form!: FormGroup; + formControl!: CustomFormControl; constructor( private router: Router, @@ -39,6 +42,13 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { this.examinerNote = additionalExaminerNotes[this.examinerNoteIndex]; console.log(this.examinerNote); } + this.formControl = new CustomFormControl({ + name: 'additionalExaminerNote', type: FormNodeTypes.CONTROL, + }, '', [Validators.required]); + this.form = new FormGroup({ + additionalExaminerNote: this.formControl, + }); + this.formControl.patchValue(this.examinerNote.note); } navigateBack() { @@ -74,7 +84,7 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { return FormNodeEditTypes; } - get widths(): typeof FormNodeWidth { + get width(): typeof FormNodeWidth { return FormNodeWidth; } From c5f8445eda9d2dc0cef5bf792ea22b50e1ef154f Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Tue, 2 Apr 2024 12:02:56 +0100 Subject: [PATCH 14/29] feat(cb2-10033): set up model binding to component --- ...edit-additional-examiner-note.component.html | 2 ++ ...d-edit-additional-examiner-note.component.ts | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html index ca3a4fd6a9..192b80fa61 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html @@ -7,11 +7,13 @@

Edit Additional Examiner Note

diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts index ec2caea5ae..54eedee85e 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts @@ -6,7 +6,12 @@ import { ReplaySubject, take, takeUntil } from 'rxjs'; import { GlobalErrorService } from '@core/components/global-error/global-error.service'; import { GlobalError } from '@core/components/global-error/global-error.interface'; import { AdditionalExaminerNotes } from '@dvsa/cvs-type-definitions/types/v3/tech-record/get/hgv/complete'; -import { CustomFormControl, FormNodeEditTypes, FormNodeTypes, FormNodeWidth } from '@forms/services/dynamic-form.types'; +import { + CustomFormControl, + FormNodeEditTypes, + FormNodeTypes, + FormNodeWidth, +} from '@forms/services/dynamic-form.types'; import { FormGroup, Validators } from '@angular/forms'; @Component({ @@ -18,6 +23,7 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { currentTechRecord!: TechRecordType<'hgv' | 'trl' | 'lgv'>; examinerNote!: AdditionalExaminerNotes; examinerNoteIndex!: number; + editedExaminerNote?: string | null; destroy$ = new ReplaySubject(1); form!: FormGroup; formControl!: CustomFormControl; @@ -42,6 +48,7 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { this.examinerNote = additionalExaminerNotes[this.examinerNoteIndex]; console.log(this.examinerNote); } + this.editedExaminerNote = this.examinerNote.note; this.formControl = new CustomFormControl({ name: 'additionalExaminerNote', type: FormNodeTypes.CONTROL, }, '', [Validators.required]); @@ -66,12 +73,20 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { // ); } + ngOnChanges(examinerNote: string) { + console.log(examinerNote); + this.editedExaminerNote = examinerNote; + } + isFormValid(): boolean { this.globalErrorService.clearErrors(); const errors: GlobalError[] = []; // check for errors in form + if (this.editedExaminerNote?.length === 0) { + // errors.push(); + } if (errors?.length > 0) { this.globalErrorService.setErrors(errors); From b22ac5bc989452446c4739973f86401dc9ecd44f Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Tue, 2 Apr 2024 13:45:00 +0100 Subject: [PATCH 15/29] feat(cb2-10033): use correct directive and basic form validation --- ...cord-edit-additional-examiner-note.component.html | 6 ++---- ...record-edit-additional-examiner-note.component.ts | 12 +++++++++++- .../tech-record/tech-record-routing.module.ts | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html index 192b80fa61..ccd904748d 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html @@ -1,21 +1,19 @@
- This is a blank page right now.

Edit Additional Examiner Note

- - +
diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts index 54eedee85e..def72e16ee 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts @@ -39,7 +39,11 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { this.technicalRecordService.techRecord$.pipe(takeUntil(this.destroy$)).subscribe((currentTechRecord) => { this.currentTechRecord = currentTechRecord as TechRecordType<'hgv' | 'lgv' | 'trl'>; }); + this.getExaminerNote(); + this.setupForm(); + } + getExaminerNote() { this.route.params.pipe(take(1)).subscribe((params) => { this.examinerNoteIndex = params['examinerNoteIndex']; }); @@ -49,6 +53,9 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { console.log(this.examinerNote); } this.editedExaminerNote = this.examinerNote.note; + } + + setupForm() { this.formControl = new CustomFormControl({ name: 'additionalExaminerNote', type: FormNodeTypes.CONTROL, }, '', [Validators.required]); @@ -83,9 +90,12 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { const errors: GlobalError[] = []; + const anchorLink = ''; + // check for errors in form if (this.editedExaminerNote?.length === 0) { - // errors.push(); + const error = 'Additional Examiner Note must be populated.'; + errors.push({ error, anchorLink } as GlobalError); } if (errors?.length > 0) { diff --git a/src/app/features/tech-record/tech-record-routing.module.ts b/src/app/features/tech-record/tech-record-routing.module.ts index 717d3f920b..25f65fb5b8 100644 --- a/src/app/features/tech-record/tech-record-routing.module.ts +++ b/src/app/features/tech-record/tech-record-routing.module.ts @@ -177,7 +177,7 @@ const routes: Routes = [ path: TechRecordRoutes.CORRECT_ERROR_EDIT_ADDITIONAL_EXAMINER_NOTE, component: TechRecordEditAdditionalExaminerNoteComponent, data: { - title: 'edit-additional-examiner-note', + title: 'Edit Additional Examiner Note', roles: Roles.TechRecordAmend, isEditing: true, reason: ReasonForEditing.CORRECTING_AN_ERROR, From 39a34d109e667e1d9b277e9a712531b73a0f4c99 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Tue, 2 Apr 2024 13:51:30 +0100 Subject: [PATCH 16/29] feat(cb2-10033): amend routing title for notifiable alteration --- src/app/features/tech-record/tech-record-routing.module.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/features/tech-record/tech-record-routing.module.ts b/src/app/features/tech-record/tech-record-routing.module.ts index 25f65fb5b8..30439c0fe6 100644 --- a/src/app/features/tech-record/tech-record-routing.module.ts +++ b/src/app/features/tech-record/tech-record-routing.module.ts @@ -207,7 +207,7 @@ const routes: Routes = [ path: TechRecordRoutes.NOTIFIABLE_ALTERNATION_NEEDED_EDIT_ADDITIONAL_EXAMINER_NOTE, component: TechRecordEditAdditionalExaminerNoteComponent, data: { - title: 'edit-additional-examiner-note', + title: 'Edit Additional Examiner Note', roles: Roles.TechRecordAmend, isEditing: true, reason: ReasonForEditing.NOTIFIABLE_ALTERATION_NEEDED, From 887d7b381a4a8743e7c6a4e97b0f1b885b1c99e0 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Tue, 2 Apr 2024 14:19:56 +0100 Subject: [PATCH 17/29] feat(cb2-10033): remove validation as requirements confirmed not needed --- ...edit-additional-examiner-note.component.ts | 23 ------------------- .../technical-record-service.actions.ts | 4 +++- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts index def72e16ee..f38a9bdd21 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts @@ -71,9 +71,6 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { } handleSubmit(): void { - if (!this.isFormValid()) { - return; - } console.log('should dispatch amendAdditionalExaminerNote action'); // this.store.dispatch( // amendAdditionalExaminerNote({}) @@ -85,26 +82,6 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { this.editedExaminerNote = examinerNote; } - isFormValid(): boolean { - this.globalErrorService.clearErrors(); - - const errors: GlobalError[] = []; - - const anchorLink = ''; - - // check for errors in form - if (this.editedExaminerNote?.length === 0) { - const error = 'Additional Examiner Note must be populated.'; - errors.push({ error, anchorLink } as GlobalError); - } - - if (errors?.length > 0) { - this.globalErrorService.setErrors(errors); - return false; - } - return true; - } - get editTypes(): typeof FormNodeEditTypes { return FormNodeEditTypes; } diff --git a/src/app/store/technical-records/actions/technical-record-service.actions.ts b/src/app/store/technical-records/actions/technical-record-service.actions.ts index 21ce912342..6583c5155e 100644 --- a/src/app/store/technical-records/actions/technical-record-service.actions.ts +++ b/src/app/store/technical-records/actions/technical-record-service.actions.ts @@ -98,7 +98,9 @@ export const clearScrollPosition = createAction(`${prefix} clearScrollPosition`) export const clearADRDetailsBeforeUpdate = createAction(`${prefix} clearADRDetailsBeforeUpdate`); -export const updateADRAdditionalExaminerNotes = createAction(`${prefix} handleADRExaminerNoteChanges`, props<{ username: string }>()); +export const updateADRAdditionalExaminerNotes = createAction(`${prefix} updateADRAdditionalExaminerNotes`, props<{ username: string }>()); + +export const updateExistingADRAdditionalExaminerNote = createAction(`${prefix} updateExistingADRAdditionalExaminerNote`); export const generateADRCertificate = createAction(`${prefix} generateADRCertificate`, props<{ systemNumber: string, createdTimestamp: string, certificateType: string From 253f11657eefb4151305c0f3d119e193b623051c Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Tue, 2 Apr 2024 16:08:19 +0100 Subject: [PATCH 18/29] feat(cb2-10033): implement state management solution --- ...it-additional-examiner-note.component.html | 1 - ...edit-additional-examiner-note.component.ts | 25 +++++++++++++------ .../technical-record-service.actions.ts | 6 ++++- .../technical-record-service.reducer.ts | 19 +++++++++++++- 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html index ccd904748d..339c87e3ce 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html @@ -10,7 +10,6 @@

Edit Additional Examiner Note

formControlName="additionalExaminerNote" name="AdditionalExaminerNote" [width]="width.L" - (focusout)="isFormValid()" (ngModelChange)="ngOnChanges(examinerNote.value)" > diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts index f38a9bdd21..37405465af 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts @@ -4,7 +4,6 @@ import { TechnicalRecordService } from '@services/technical-record/technical-rec import { TechRecordType } from '@dvsa/cvs-type-definitions/types/v3/tech-record/tech-record-vehicle-type'; import { ReplaySubject, take, takeUntil } from 'rxjs'; import { GlobalErrorService } from '@core/components/global-error/global-error.service'; -import { GlobalError } from '@core/components/global-error/global-error.interface'; import { AdditionalExaminerNotes } from '@dvsa/cvs-type-definitions/types/v3/tech-record/get/hgv/complete'; import { CustomFormControl, @@ -13,6 +12,11 @@ import { FormNodeWidth, } from '@forms/services/dynamic-form.types'; import { FormGroup, Validators } from '@angular/forms'; +import { Store } from '@ngrx/store'; +import { State } from '@store/index'; +import { updateExistingADRAdditionalExaminerNote } from '@store/technical-records'; +import cloneDeep from 'lodash.clonedeep'; +import { isEqual } from 'lodash'; @Component({ selector: 'tech-record-edit-additional-examiner-note', @@ -22,6 +26,7 @@ import { FormGroup, Validators } from '@angular/forms'; export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { currentTechRecord!: TechRecordType<'hgv' | 'trl' | 'lgv'>; examinerNote!: AdditionalExaminerNotes; + examinerNoteOriginal!: AdditionalExaminerNotes; examinerNoteIndex!: number; editedExaminerNote?: string | null; destroy$ = new ReplaySubject(1); @@ -33,6 +38,7 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { private route: ActivatedRoute, private technicalRecordService: TechnicalRecordService, private globalErrorService: GlobalErrorService, + private store: Store, ) { } ngOnInit() { @@ -50,7 +56,7 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { const additionalExaminerNotes = this.currentTechRecord?.techRecord_adrDetails_additionalExaminerNotes; if (additionalExaminerNotes) { this.examinerNote = additionalExaminerNotes[this.examinerNoteIndex]; - console.log(this.examinerNote); + this.examinerNoteOriginal = cloneDeep(this.examinerNote); } this.editedExaminerNote = this.examinerNote.note; } @@ -71,15 +77,20 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { } handleSubmit(): void { - console.log('should dispatch amendAdditionalExaminerNote action'); - // this.store.dispatch( - // amendAdditionalExaminerNote({}) - // ); + if (!isEqual(this.examinerNote, this.examinerNoteOriginal)) { + this.store.dispatch( + updateExistingADRAdditionalExaminerNote({ + examinerNoteIndex: this.examinerNoteIndex, + additionalExaminerNote: this.examinerNote, + }), + ); + } + this.navigateBack(); } ngOnChanges(examinerNote: string) { - console.log(examinerNote); this.editedExaminerNote = examinerNote; + this.examinerNote.note = examinerNote; } get editTypes(): typeof FormNodeEditTypes { diff --git a/src/app/store/technical-records/actions/technical-record-service.actions.ts b/src/app/store/technical-records/actions/technical-record-service.actions.ts index 6583c5155e..8255c800a7 100644 --- a/src/app/store/technical-records/actions/technical-record-service.actions.ts +++ b/src/app/store/technical-records/actions/technical-record-service.actions.ts @@ -8,6 +8,7 @@ import { } from '@ngrx/store'; // eslint-disable-next-line import/no-unresolved import { TypedAction } from '@ngrx/store/src/models'; +import { AdditionalExaminerNotes } from '@dvsa/cvs-type-definitions/types/v3/tech-record/get/hgv/complete'; const prefix = '[Technical Record Service]'; @@ -100,7 +101,10 @@ export const clearADRDetailsBeforeUpdate = createAction(`${prefix} clearADRDetai export const updateADRAdditionalExaminerNotes = createAction(`${prefix} updateADRAdditionalExaminerNotes`, props<{ username: string }>()); -export const updateExistingADRAdditionalExaminerNote = createAction(`${prefix} updateExistingADRAdditionalExaminerNote`); +export const updateExistingADRAdditionalExaminerNote = createAction( + `${prefix} updateExistingADRAdditionalExaminerNote`, + props<{ additionalExaminerNote: AdditionalExaminerNotes, examinerNoteIndex: number }>(), +); export const generateADRCertificate = createAction(`${prefix} generateADRCertificate`, props<{ systemNumber: string, createdTimestamp: string, certificateType: string diff --git a/src/app/store/technical-records/reducers/technical-record-service.reducer.ts b/src/app/store/technical-records/reducers/technical-record-service.reducer.ts index 4639b484da..f49e66f678 100644 --- a/src/app/store/technical-records/reducers/technical-record-service.reducer.ts +++ b/src/app/store/technical-records/reducers/technical-record-service.reducer.ts @@ -11,6 +11,7 @@ import { VehicleTypes } from '@models/vehicle-tech-record.model'; import { createFeatureSelector, createReducer, on } from '@ngrx/store'; import { AxlesService } from '@services/axles/axles.service'; import { cloneDeep } from 'lodash'; +import { AdditionalExaminerNotes } from '@dvsa/cvs-type-definitions/types/v3/tech-record/get/hgv/complete'; import { clearBatch, setApplicationId, @@ -61,7 +62,7 @@ import { updateBody, updateBrakeForces, updateEditingTechRecord, - updateEditingTechRecordCancel, + updateEditingTechRecordCancel, updateExistingADRAdditionalExaminerNote, updateScrollPosition, updateTechRecord, updateTechRecordFailure, @@ -153,6 +154,8 @@ export const vehicleTechRecordReducer = createReducer( on(updateADRAdditionalExaminerNotes, (state, action) => handleADRExaminerNoteChanges(state, action.username)), + on(updateExistingADRAdditionalExaminerNote, (state, action) => handleUpdateExistingADRAdditionalExaminerNote(state, action)), + on(addAxle, (state) => handleAddAxle(state)), on(removeAxle, (state, action) => handleRemoveAxle(state, action)), @@ -547,3 +550,17 @@ function handleADRExaminerNoteChanges(state: TechnicalRecordServiceState, userna } return { ...state, editingTechRecord: additionalNoteTechRecord as unknown as (TechRecordType<'put'>) }; } + +function handleUpdateExistingADRAdditionalExaminerNote( + state: TechnicalRecordServiceState, + action: { additionalExaminerNote: AdditionalExaminerNotes, examinerNoteIndex: number }, +) { + const { editingTechRecord } = state; + const editedTechRecord = editingTechRecord as unknown as + (NonVerbTechRecordType<'hgv' | 'lgv' | 'trl'>); + if (editedTechRecord) { + const examinerNotes = editedTechRecord.techRecord_adrDetails_additionalExaminerNotes; + examinerNotes![action.examinerNoteIndex].note = action.additionalExaminerNote.note; + } + return { ...state, editingTechRecord: editingTechRecord as unknown as (TechRecordType<'put'>) }; +} From 10a1325e7c3a574fcd256f7b1435c3fd358f576e Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Tue, 2 Apr 2024 16:49:50 +0100 Subject: [PATCH 19/29] feat(cb2-10033): fix display for summary screen --- src/app/forms/templates/general/adr-summary.template.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/forms/templates/general/adr-summary.template.ts b/src/app/forms/templates/general/adr-summary.template.ts index d54e01d5d1..e5afeaab2b 100644 --- a/src/app/forms/templates/general/adr-summary.template.ts +++ b/src/app/forms/templates/general/adr-summary.template.ts @@ -774,7 +774,7 @@ export const AdrSummaryTemplate: FormNode = { label: 'Additional examiner notes history', value: null, type: FormNodeTypes.CONTROL, - viewType: FormNodeViewTypes.HIDDEN, + viewType: FormNodeViewTypes.CUSTOM, viewComponent: AdrExaminerNotesHistoryViewComponent, editType: FormNodeEditTypes.CUSTOM, editComponent: AdrExaminerNotesHistoryEditComponent, From 4769a0a793504a3d8878c2144f130565b98051c7 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Tue, 2 Apr 2024 17:18:38 +0100 Subject: [PATCH 20/29] feat(cb2-10033): refactor state and data handling approach --- ...edit-additional-examiner-note.component.ts | 23 +++++++-------- .../technical-record-service.actions.ts | 2 +- .../technical-record-service.reducer.spec.ts | 29 ++++++++++++++++++- .../technical-record-service.reducer.ts | 9 +++--- 4 files changed, 43 insertions(+), 20 deletions(-) diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts index 37405465af..624f135a52 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts @@ -4,7 +4,6 @@ import { TechnicalRecordService } from '@services/technical-record/technical-rec import { TechRecordType } from '@dvsa/cvs-type-definitions/types/v3/tech-record/tech-record-vehicle-type'; import { ReplaySubject, take, takeUntil } from 'rxjs'; import { GlobalErrorService } from '@core/components/global-error/global-error.service'; -import { AdditionalExaminerNotes } from '@dvsa/cvs-type-definitions/types/v3/tech-record/get/hgv/complete'; import { CustomFormControl, FormNodeEditTypes, @@ -15,8 +14,6 @@ import { FormGroup, Validators } from '@angular/forms'; import { Store } from '@ngrx/store'; import { State } from '@store/index'; import { updateExistingADRAdditionalExaminerNote } from '@store/technical-records'; -import cloneDeep from 'lodash.clonedeep'; -import { isEqual } from 'lodash'; @Component({ selector: 'tech-record-edit-additional-examiner-note', @@ -25,10 +22,9 @@ import { isEqual } from 'lodash'; }) export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { currentTechRecord!: TechRecordType<'hgv' | 'trl' | 'lgv'>; - examinerNote!: AdditionalExaminerNotes; - examinerNoteOriginal!: AdditionalExaminerNotes; examinerNoteIndex!: number; - editedExaminerNote?: string | null; + editedExaminerNote: string = ''; + originalExaminerNote: string = ''; destroy$ = new ReplaySubject(1); form!: FormGroup; formControl!: CustomFormControl; @@ -55,10 +51,12 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { }); const additionalExaminerNotes = this.currentTechRecord?.techRecord_adrDetails_additionalExaminerNotes; if (additionalExaminerNotes) { - this.examinerNote = additionalExaminerNotes[this.examinerNoteIndex]; - this.examinerNoteOriginal = cloneDeep(this.examinerNote); + const examinerNote = additionalExaminerNotes[this.examinerNoteIndex].note; + if (examinerNote) { + this.originalExaminerNote = examinerNote; + this.editedExaminerNote = examinerNote; + } } - this.editedExaminerNote = this.examinerNote.note; } setupForm() { @@ -68,7 +66,7 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { this.form = new FormGroup({ additionalExaminerNote: this.formControl, }); - this.formControl.patchValue(this.examinerNote.note); + this.formControl.patchValue(this.editedExaminerNote); } navigateBack() { @@ -77,11 +75,11 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { } handleSubmit(): void { - if (!isEqual(this.examinerNote, this.examinerNoteOriginal)) { + if (this.originalExaminerNote !== this.editedExaminerNote) { this.store.dispatch( updateExistingADRAdditionalExaminerNote({ examinerNoteIndex: this.examinerNoteIndex, - additionalExaminerNote: this.examinerNote, + additionalExaminerNote: this.editedExaminerNote, }), ); } @@ -90,7 +88,6 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { ngOnChanges(examinerNote: string) { this.editedExaminerNote = examinerNote; - this.examinerNote.note = examinerNote; } get editTypes(): typeof FormNodeEditTypes { diff --git a/src/app/store/technical-records/actions/technical-record-service.actions.ts b/src/app/store/technical-records/actions/technical-record-service.actions.ts index 8255c800a7..a4ee05aacb 100644 --- a/src/app/store/technical-records/actions/technical-record-service.actions.ts +++ b/src/app/store/technical-records/actions/technical-record-service.actions.ts @@ -103,7 +103,7 @@ export const updateADRAdditionalExaminerNotes = createAction(`${prefix} updateAD export const updateExistingADRAdditionalExaminerNote = createAction( `${prefix} updateExistingADRAdditionalExaminerNote`, - props<{ additionalExaminerNote: AdditionalExaminerNotes, examinerNoteIndex: number }>(), + props<{ additionalExaminerNote: string, examinerNoteIndex: number }>(), ); export const generateADRCertificate = createAction(`${prefix} generateADRCertificate`, props<{ diff --git a/src/app/store/technical-records/reducers/technical-record-service.reducer.spec.ts b/src/app/store/technical-records/reducers/technical-record-service.reducer.spec.ts index 71076d2966..5951c74729 100644 --- a/src/app/store/technical-records/reducers/technical-record-service.reducer.spec.ts +++ b/src/app/store/technical-records/reducers/technical-record-service.reducer.spec.ts @@ -33,7 +33,7 @@ import { updateBody, updateBrakeForces, updateEditingTechRecord, - updateEditingTechRecordCancel, + updateEditingTechRecordCancel, updateExistingADRAdditionalExaminerNote, updateScrollPosition, updateTechRecord, updateTechRecordFailure, @@ -586,4 +586,31 @@ describe('Vehicle Technical Record Reducer', () => { .toContainEqual(testNote); }); }); + describe('handleUpdateExistingADRExaminerNote', () => { + it('should', () => { + const state: TechnicalRecordServiceState = { + ...initialState, + vehicleTechRecord: { + systemNumber: 'foo', + createdTimestamp: 'bar', + vin: 'testVin', + } as unknown as TechRecordType<'get'>, + editingTechRecord: { + systemNumber: 'foo', + createdTimestamp: 'bar', + vin: 'testVin', + techRecord_adrDetails_additionalExaminerNotes: [ + { + note: 'foo', + createdAtDate: 'bar', + lastUpdatedBy: 'foo', + }, + ], + } as unknown as TechRecordType<'put'>, + loading: true, + }; + // const newNote + // const action = updateExistingADRAdditionalExaminerNote() + }); + }); }); diff --git a/src/app/store/technical-records/reducers/technical-record-service.reducer.ts b/src/app/store/technical-records/reducers/technical-record-service.reducer.ts index f49e66f678..5f1573d33e 100644 --- a/src/app/store/technical-records/reducers/technical-record-service.reducer.ts +++ b/src/app/store/technical-records/reducers/technical-record-service.reducer.ts @@ -11,7 +11,6 @@ import { VehicleTypes } from '@models/vehicle-tech-record.model'; import { createFeatureSelector, createReducer, on } from '@ngrx/store'; import { AxlesService } from '@services/axles/axles.service'; import { cloneDeep } from 'lodash'; -import { AdditionalExaminerNotes } from '@dvsa/cvs-type-definitions/types/v3/tech-record/get/hgv/complete'; import { clearBatch, setApplicationId, @@ -154,7 +153,7 @@ export const vehicleTechRecordReducer = createReducer( on(updateADRAdditionalExaminerNotes, (state, action) => handleADRExaminerNoteChanges(state, action.username)), - on(updateExistingADRAdditionalExaminerNote, (state, action) => handleUpdateExistingADRAdditionalExaminerNote(state, action)), + on(updateExistingADRAdditionalExaminerNote, (state, action) => handleUpdateExistingADRExaminerNote(state, action)), on(addAxle, (state) => handleAddAxle(state)), on(removeAxle, (state, action) => handleRemoveAxle(state, action)), @@ -551,16 +550,16 @@ function handleADRExaminerNoteChanges(state: TechnicalRecordServiceState, userna return { ...state, editingTechRecord: additionalNoteTechRecord as unknown as (TechRecordType<'put'>) }; } -function handleUpdateExistingADRAdditionalExaminerNote( +function handleUpdateExistingADRExaminerNote( state: TechnicalRecordServiceState, - action: { additionalExaminerNote: AdditionalExaminerNotes, examinerNoteIndex: number }, + action: { additionalExaminerNote: string, examinerNoteIndex: number }, ) { const { editingTechRecord } = state; const editedTechRecord = editingTechRecord as unknown as (NonVerbTechRecordType<'hgv' | 'lgv' | 'trl'>); if (editedTechRecord) { const examinerNotes = editedTechRecord.techRecord_adrDetails_additionalExaminerNotes; - examinerNotes![action.examinerNoteIndex].note = action.additionalExaminerNote.note; + examinerNotes![action.examinerNoteIndex].note = action.additionalExaminerNote; } return { ...state, editingTechRecord: editingTechRecord as unknown as (TechRecordType<'put'>) }; } From f525b6db4ad6f987831ab8d8af47664a90e57512 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Tue, 2 Apr 2024 17:35:06 +0100 Subject: [PATCH 21/29] feat(cb2-10033): reducer tests --- .../technical-record-service.reducer.spec.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/app/store/technical-records/reducers/technical-record-service.reducer.spec.ts b/src/app/store/technical-records/reducers/technical-record-service.reducer.spec.ts index 5951c74729..ebbfbbe41f 100644 --- a/src/app/store/technical-records/reducers/technical-record-service.reducer.spec.ts +++ b/src/app/store/technical-records/reducers/technical-record-service.reducer.spec.ts @@ -590,11 +590,6 @@ describe('Vehicle Technical Record Reducer', () => { it('should', () => { const state: TechnicalRecordServiceState = { ...initialState, - vehicleTechRecord: { - systemNumber: 'foo', - createdTimestamp: 'bar', - vin: 'testVin', - } as unknown as TechRecordType<'get'>, editingTechRecord: { systemNumber: 'foo', createdTimestamp: 'bar', @@ -609,8 +604,11 @@ describe('Vehicle Technical Record Reducer', () => { } as unknown as TechRecordType<'put'>, loading: true, }; - // const newNote - // const action = updateExistingADRAdditionalExaminerNote() + const newNote = 'foobar'; + const action = updateExistingADRAdditionalExaminerNote({ additionalExaminerNote: newNote, examinerNoteIndex: 0 }); + const newState = vehicleTechRecordReducer(state, action); + const editingTechRecord = newState.editingTechRecord as unknown as (NonVerbTechRecordType<'hgv' | 'lgv' | 'trl'>); + expect(editingTechRecord.techRecord_adrDetails_additionalExaminerNotes![0].note).toEqual(newNote); }); }); }); From 17e8ec13cd31d9e2024d2f1905f7e4dbfe019000 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Tue, 2 Apr 2024 17:52:48 +0100 Subject: [PATCH 22/29] feat(cb2-10033): basic unit testing draft --- ...additional-examiner-note.component.spec.ts | 23 +++++++++++++++---- ...edit-additional-examiner-note.component.ts | 8 +++++-- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts index f829df2360..4276c5dabb 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts @@ -1,7 +1,4 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { - AdrExaminerNotesHistoryEditComponent -} from '@forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit'; import { DynamicFormsModule } from '@forms/dynamic-forms.module'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { RouterTestingModule } from '@angular/router/testing'; @@ -29,10 +26,28 @@ describe('TechRecordEditAdditionalExaminerNoteComponent', () => { { provide: ActivatedRoute, useValue: { params: of([{ id: 1 }]) } }, ], }).compileComponents(); - fixture = TestBed.createComponent(AdrExaminerNotesHistoryEditComponent); + fixture = TestBed.createComponent(TechRecordEditAdditionalExaminerNoteComponent); component = fixture.componentInstance; }); it('should create', () => { expect(component).toBeTruthy(); }); + describe('getTechRecord', () => { + + }); + describe('getExaminerNote', () => { + + }); + describe('setupForm', () => { + + }); + describe('ngOnInit', () => { + + }); + describe('navigateBack', () => { + + }); + describe('handleSubmit', () => { + + }); }); diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts index 624f135a52..599e4bf69d 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.ts @@ -38,11 +38,15 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { ) { } ngOnInit() { + this.getTechRecord(); + this.getExaminerNote(); + this.setupForm(); + } + + getTechRecord() { this.technicalRecordService.techRecord$.pipe(takeUntil(this.destroy$)).subscribe((currentTechRecord) => { this.currentTechRecord = currentTechRecord as TechRecordType<'hgv' | 'lgv' | 'trl'>; }); - this.getExaminerNote(); - this.setupForm(); } getExaminerNote() { From c06d39e590a5b76c1a6e4d4e844e9e21591909f1 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Wed, 3 Apr 2024 10:16:24 +0100 Subject: [PATCH 23/29] feat(cb2-10033): unit testing --- ...additional-examiner-note.component.spec.ts | 64 +++++++++++++++---- 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts index 4276c5dabb..6568ebf897 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts @@ -3,19 +3,24 @@ import { DynamicFormsModule } from '@forms/dynamic-forms.module'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { RouterTestingModule } from '@angular/router/testing'; import { TechnicalRecordService } from '@services/technical-record/technical-record.service'; -import { provideMockStore } from '@ngrx/store/testing'; +import { MockStore, provideMockStore } from '@ngrx/store/testing'; import { initialAppState } from '@store/index'; import { ActivatedRoute, Router } from '@angular/router'; import { of } from 'rxjs'; +import { GlobalErrorService } from '@core/components/global-error/global-error.service'; import { TechRecordEditAdditionalExaminerNoteComponent } from './tech-record-edit-additional-examiner-note.component'; - const mockTechRecordService = { techRecord$: jest.fn(), }; describe('TechRecordEditAdditionalExaminerNoteComponent', () => { let fixture: ComponentFixture; let component: TechRecordEditAdditionalExaminerNoteComponent; + let router: Router; + let errorService: GlobalErrorService; + let route: ActivatedRoute; + let store: MockStore; + beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [TechRecordEditAdditionalExaminerNoteComponent], @@ -28,26 +33,63 @@ describe('TechRecordEditAdditionalExaminerNoteComponent', () => { }).compileComponents(); fixture = TestBed.createComponent(TechRecordEditAdditionalExaminerNoteComponent); component = fixture.componentInstance; + router = TestBed.inject(Router); + errorService = TestBed.inject(GlobalErrorService); + route = TestBed.inject(ActivatedRoute); + store = TestBed.inject(MockStore); }); it('should create', () => { expect(component).toBeTruthy(); }); - describe('getTechRecord', () => { - + describe('ngOnInit', () => { + it('should call all initialisation functions', () => { + const examinerNoteSpy = jest.spyOn(component, 'getExaminerNote').mockReturnValue(); + const techRecordSpy = jest.spyOn(component, 'getTechRecord').mockReturnValue(); + const formSpy = jest.spyOn(component, 'setupForm').mockReturnValue(); + component.ngOnInit(); + expect(examinerNoteSpy).toHaveBeenCalled(); + expect(formSpy).toHaveBeenCalled(); + expect(techRecordSpy).toHaveBeenCalled(); + }); }); - describe('getExaminerNote', () => { + describe('navigateBack', () => { + it('should clear all errors', () => { + jest.spyOn(router, 'navigate').mockImplementation(); - }); - describe('setupForm', () => { + const clearErrorsSpy = jest.spyOn(errorService, 'clearErrors'); - }); - describe('ngOnInit', () => { + component.navigateBack(); - }); - describe('navigateBack', () => { + expect(clearErrorsSpy).toHaveBeenCalledTimes(1); + }); + + it('should navigate back to the previous page', () => { + const navigateSpy = jest.spyOn(router, 'navigate').mockImplementation(() => Promise.resolve(true)); + + component.navigateBack(); + expect(navigateSpy).toHaveBeenCalledWith(['../../'], { relativeTo: route }); + }); }); describe('handleSubmit', () => { + it('should not dispatch an action if the notes are the same', () => { + const storeSpy = jest.spyOn(store, 'dispatch'); + const navigateBackSpy = jest.spyOn(component, 'navigateBack').mockReturnValue(); + component.originalExaminerNote = 'foobar'; + component.editedExaminerNote = 'foobar'; + component.handleSubmit(); + expect(storeSpy).not.toHaveBeenCalled(); + expect(navigateBackSpy).toHaveBeenCalled(); + }); + it('should dispatch an action if the notes are not the same', () => { + const storeSpy = jest.spyOn(store, 'dispatch'); + const navigateBackSpy = jest.spyOn(component, 'navigateBack').mockReturnValue(); + component.originalExaminerNote = 'foo'; + component.editedExaminerNote = 'bar'; + component.handleSubmit(); + expect(storeSpy).toHaveBeenCalled(); + expect(navigateBackSpy).toHaveBeenCalled(); + }); }); }); From f44616e017fee409d0b65d8e21da0ae6e3a4d2dd Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Wed, 3 Apr 2024 10:18:24 +0100 Subject: [PATCH 24/29] feat(cb2-10033): linting fix --- .../actions/technical-record-service.actions.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/store/technical-records/actions/technical-record-service.actions.ts b/src/app/store/technical-records/actions/technical-record-service.actions.ts index a4ee05aacb..3e70e03b7b 100644 --- a/src/app/store/technical-records/actions/technical-record-service.actions.ts +++ b/src/app/store/technical-records/actions/technical-record-service.actions.ts @@ -8,7 +8,6 @@ import { } from '@ngrx/store'; // eslint-disable-next-line import/no-unresolved import { TypedAction } from '@ngrx/store/src/models'; -import { AdditionalExaminerNotes } from '@dvsa/cvs-type-definitions/types/v3/tech-record/get/hgv/complete'; const prefix = '[Technical Record Service]'; From 16fc329e9b1b66583c978b815ad23b21cb57b842 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Thu, 4 Apr 2024 13:09:15 +0100 Subject: [PATCH 25/29] feat(cb2-10033): fix review screen --- ...ord-edit-additional-examiner-note.component.spec.ts | 3 --- .../features/tech-record/tech-record-routing.module.ts | 10 ++++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts index 8367792b06..6568ebf897 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.spec.ts @@ -1,7 +1,4 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { - AdrExaminerNotesHistoryEditComponent, -} from '@forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history.component-edit'; import { DynamicFormsModule } from '@forms/dynamic-forms.module'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { RouterTestingModule } from '@angular/router/testing'; diff --git a/src/app/features/tech-record/tech-record-routing.module.ts b/src/app/features/tech-record/tech-record-routing.module.ts index 30439c0fe6..e56d706ea7 100644 --- a/src/app/features/tech-record/tech-record-routing.module.ts +++ b/src/app/features/tech-record/tech-record-routing.module.ts @@ -170,7 +170,10 @@ const routes: Routes = [ { path: TechRecordRoutes.CORRECT_ERROR_CHANGE_SUMMARY, component: TechRecordSummaryChangesComponent, - data: { roles: Roles.TechRecordAmend }, + data: { + roles: Roles.TechRecordAmend, + isEditing: true, + }, canActivate: [MsalGuard, RoleGuard], }, { @@ -188,7 +191,10 @@ const routes: Routes = [ { path: TechRecordRoutes.NOTIFIABLE_ALTERATION_NEEDED_CHANGE_SUMMARY, component: TechRecordSummaryChangesComponent, - data: { roles: Roles.TechRecordAmend }, + data: { + roles: Roles.TechRecordAmend, + isEditing: true, + }, canActivate: [MsalGuard, RoleGuard], }, { From 049c8d3ec6f5e030094d825f0a0d15d089412321 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Thu, 4 Apr 2024 13:54:36 +0100 Subject: [PATCH 26/29] feat(cb2-10033): git stash for mobbing --- ...examiner-notes-history-edit.component.html | 2 +- ...examiner-notes-history-view.component.html | 2 +- .../collapsible-text.component.html | 29 +++++ .../collapsible-text.component.scss | 0 .../collapsible-text.component.spec.ts | 0 .../collapsible-text.component.ts | 34 ++++++ src/app/shared/shared.module.ts | 107 +++++++++--------- 7 files changed, 120 insertions(+), 54 deletions(-) create mode 100644 src/app/shared/components/collapsible-text/collapsible-text.component.html create mode 100644 src/app/shared/components/collapsible-text/collapsible-text.component.scss create mode 100644 src/app/shared/components/collapsible-text/collapsible-text.component.spec.ts create mode 100644 src/app/shared/components/collapsible-text/collapsible-text.component.ts diff --git a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html index d92ac9a219..5aef799378 100644 --- a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html +++ b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html @@ -16,7 +16,7 @@
+ + + +
(1); form!: FormGroup; formControl!: CustomFormControl; @@ -57,6 +59,7 @@ export class TechRecordEditAdditionalExaminerNoteComponent implements OnInit { if (additionalExaminerNotes) { const examinerNote = additionalExaminerNotes[this.examinerNoteIndex].note; if (examinerNote) { + this.examinerNoteObj = additionalExaminerNotes[this.examinerNoteIndex]; this.originalExaminerNote = examinerNote; this.editedExaminerNote = examinerNote; } diff --git a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html index 5aef799378..ebf61fca56 100644 --- a/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html +++ b/src/app/forms/custom-sections/adr-examiner-notes-history-edit/adr-examiner-notes-history-edit.component.html @@ -16,7 +16,7 @@
DateCreated By NotesCreated ByDate
- {{ examinerNote.createdAtDate | date : 'dd/MM/yyyy' | defaultNullOrEmpty }} + {{ examinerNote.note }} {{ examinerNote.lastUpdatedBy }} - {{ examinerNote.note }} + {{ examinerNote.createdAtDate | date: 'dd/MM/yyyy' | defaultNullOrEmpty }} + + Edit
- Edit + Edit
- Edit + Edit
- Edit + Edit
- {{ examinerNote.note }} + {{ examinerNote.lastUpdatedBy }} diff --git a/src/app/forms/custom-sections/adr-examiner-notes-history-view/adr-examiner-notes-history-view.component.html b/src/app/forms/custom-sections/adr-examiner-notes-history-view/adr-examiner-notes-history-view.component.html index ad1b14b431..eadf622a11 100644 --- a/src/app/forms/custom-sections/adr-examiner-notes-history-view/adr-examiner-notes-history-view.component.html +++ b/src/app/forms/custom-sections/adr-examiner-notes-history-view/adr-examiner-notes-history-view.component.html @@ -12,7 +12,7 @@

Additional Examiner Notes History

- {{ result.note }} + {{ result.lastUpdatedBy }} diff --git a/src/app/shared/components/collapsible-text/collapsible-text.component.html b/src/app/shared/components/collapsible-text/collapsible-text.component.html new file mode 100644 index 0000000000..5dd21980eb --- /dev/null +++ b/src/app/shared/components/collapsible-text/collapsible-text.component.html @@ -0,0 +1,29 @@ + +
+ {{ getCollapsedString() }} +
+ + +
+
isCollapsed: {{ isCollapsed }}
+ +
+ {{ text }} +
+ + +
diff --git a/src/app/shared/components/collapsible-text/collapsible-text.component.scss b/src/app/shared/components/collapsible-text/collapsible-text.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/shared/components/collapsible-text/collapsible-text.component.spec.ts b/src/app/shared/components/collapsible-text/collapsible-text.component.spec.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/shared/components/collapsible-text/collapsible-text.component.ts b/src/app/shared/components/collapsible-text/collapsible-text.component.ts new file mode 100644 index 0000000000..9384e0341d --- /dev/null +++ b/src/app/shared/components/collapsible-text/collapsible-text.component.ts @@ -0,0 +1,34 @@ +import { ChangeDetectorRef, Component, Input } from '@angular/core'; + +@Component({ + selector: 'collapsible-text', + templateUrl: './collapsible-text.component.html', + styleUrls: ['./collapsible-text.component.scss'], +}) +export class CollapsibleTextComponent { + + @Input() text: string = ''; + @Input() maxChars: number = 0; + @Input() isCollapsed = true; + + constructor(private cdr: ChangeDetectorRef) {} + + getCollapsedString() { + if (this.text.length <= this.maxChars) { + return this.text; + } + return this.text.slice(0, this.maxChars); + } + + open() { + console.log('test'); + this.isCollapsed = false; + this.cdr.markForCheck(); + console.log(this.isCollapsed); + } + + close() { + this.isCollapsed = true; + this.cdr.markForCheck(); + } +} diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 94f3bf1dd5..44593709f6 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -26,62 +26,65 @@ import { GetControlLabelPipe } from './pipes/get-control-label/get-control-label import { RefDataDecodePipe } from './pipes/ref-data-decode/ref-data-decode.pipe'; import { TestTypeNamePipe } from './pipes/test-type-name/test-type-name.pipe'; import { TyreAxleLoadPipe } from './pipes/tyre-axle-load/tyre-axle-load.pipe'; +import { CollapsibleTextComponent } from '@shared/components/collapsible-text/collapsible-text.component'; @NgModule({ - declarations: [ - DefaultNullOrEmpty, - ButtonGroupComponent, - ButtonComponent, - BannerComponent, - RoleRequiredDirective, - FeatureToggleDirective, - FeatureToggleDirective, - TagComponent, - NumberPlateComponent, - IconComponent, - TestTypeNamePipe, - AccordionComponent, - AccordionControlComponent, - PaginationComponent, - TestCertificateComponent, - PreventDoubleClickDirective, - BaseDialogComponent, - DigitGroupSeparatorPipe, - RefDataDecodePipe, - RetrieveDocumentDirective, - InputSpinnerComponent, - RouterOutletComponent, - TyreAxleLoadPipe, - GetControlLabelPipe, - FormatVehicleTypePipe, - ], + declarations: [ + DefaultNullOrEmpty, + ButtonGroupComponent, + ButtonComponent, + BannerComponent, + RoleRequiredDirective, + FeatureToggleDirective, + FeatureToggleDirective, + TagComponent, + NumberPlateComponent, + IconComponent, + TestTypeNamePipe, + AccordionComponent, + AccordionControlComponent, + PaginationComponent, + TestCertificateComponent, + PreventDoubleClickDirective, + BaseDialogComponent, + DigitGroupSeparatorPipe, + RefDataDecodePipe, + RetrieveDocumentDirective, + InputSpinnerComponent, + RouterOutletComponent, + TyreAxleLoadPipe, + GetControlLabelPipe, + FormatVehicleTypePipe, + CollapsibleTextComponent, + ], imports: [CommonModule, RouterModule], - exports: [ - DefaultNullOrEmpty, - ButtonGroupComponent, - ButtonComponent, - BannerComponent, - RoleRequiredDirective, - FeatureToggleDirective, - TagComponent, - NumberPlateComponent, - IconComponent, - TestTypeNamePipe, - AccordionComponent, - AccordionControlComponent, - PaginationComponent, - TestCertificateComponent, - BaseDialogComponent, - DigitGroupSeparatorPipe, - RefDataDecodePipe, - RetrieveDocumentDirective, - InputSpinnerComponent, - RouterOutletComponent, - TyreAxleLoadPipe, - GetControlLabelPipe, - FormatVehicleTypePipe, + exports: [ + DefaultNullOrEmpty, + ButtonGroupComponent, + ButtonComponent, + BannerComponent, + RoleRequiredDirective, + FeatureToggleDirective, + TagComponent, + NumberPlateComponent, + IconComponent, + TestTypeNamePipe, + AccordionComponent, + AccordionControlComponent, + PaginationComponent, + TestCertificateComponent, + BaseDialogComponent, + DigitGroupSeparatorPipe, + RefDataDecodePipe, + RetrieveDocumentDirective, + InputSpinnerComponent, + RouterOutletComponent, + TyreAxleLoadPipe, + GetControlLabelPipe, + FormatVehicleTypePipe, + CollapsibleTextComponent, - ], + ], providers: [DocumentRetrievalService], }) export class SharedModule {} From a0cb8c940c05b2c32290f521e222aa967a239708 Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Fri, 5 Apr 2024 08:58:21 +0100 Subject: [PATCH 27/29] feat(cb2-10033): add logic to hide collapse function and fix missing acs --- ...it-additional-examiner-note.component.html | 6 + ...it-additional-examiner-note.component.scss | 8 ++ ...edit-additional-examiner-note.component.ts | 3 + ...examiner-notes-history-edit.component.html | 2 +- ...examiner-notes-history-view.component.html | 2 +- .../collapsible-text.component.html | 2 +- .../collapsible-text.component.ts | 15 ++- src/app/shared/shared.module.ts | 110 +++++++++--------- 8 files changed, 88 insertions(+), 60 deletions(-) diff --git a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html index 339c87e3ce..5efaac35ec 100644 --- a/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html +++ b/src/app/features/tech-record/components/tech-record-edit-additional-examiner-note/tech-record-edit-additional-examiner-note.component.html @@ -3,6 +3,12 @@

Edit Additional Examiner Note

+
+
Date{{ examinerNoteObj.createdAtDate | date: 'dd/MM/yyyy' | defaultNullOrEmpty }}Created by{{ examinerNoteObj.lastUpdatedBy }}
- + {{ examinerNote.lastUpdatedBy }} diff --git a/src/app/forms/custom-sections/adr-examiner-notes-history-view/adr-examiner-notes-history-view.component.html b/src/app/forms/custom-sections/adr-examiner-notes-history-view/adr-examiner-notes-history-view.component.html index eadf622a11..21407eec46 100644 --- a/src/app/forms/custom-sections/adr-examiner-notes-history-view/adr-examiner-notes-history-view.component.html +++ b/src/app/forms/custom-sections/adr-examiner-notes-history-view/adr-examiner-notes-history-view.component.html @@ -12,7 +12,7 @@

Additional Examiner Notes History

- + {{ result.lastUpdatedBy }} diff --git a/src/app/shared/components/collapsible-text/collapsible-text.component.html b/src/app/shared/components/collapsible-text/collapsible-text.component.html index 5dd21980eb..6bf3101555 100644 --- a/src/app/shared/components/collapsible-text/collapsible-text.component.html +++ b/src/app/shared/components/collapsible-text/collapsible-text.component.html @@ -3,7 +3,7 @@ {{ getCollapsedString() }} -