Skip to content

Commit

Permalink
Merge branch 'develop' into feat/CB2-14451
Browse files Browse the repository at this point in the history
  • Loading branch information
pbardy2000 committed Dec 6, 2024
2 parents 94f90e2 + b247fa0 commit 5e01f21
Show file tree
Hide file tree
Showing 63 changed files with 1,085 additions and 86 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@angular/router": "^18.2.7",
"@azure/msal-angular": "^3.0.24",
"@azure/msal-browser": "^3.24.0",
"@dvsa/cvs-type-definitions": "^7.6.2",
"@dvsa/cvs-type-definitions": "^7.8.0",
"@ngrx/effects": "^18.0.2",
"@ngrx/entity": "^18.0.2",
"@ngrx/operators": "^18.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,72 @@
</app-banner>

<app-icon [icon]="techRecordEdited.techRecord_vehicleType || ''"></app-icon>

<app-dynamic-form-group [data]="techRecordEdited" [template]="vehicleSummary"></app-dynamic-form-group>

<!-- Vehicle Summary -->
<dl class="govuk-summary-list">
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">Vehicle identification number (VIN)</dt>
<dd class="govuk-summary-list__value" id="test-vin">
{{ techRecordEdited.vin | defaultNullOrEmpty }}
</dd>
</div>
<div class="govuk-summary-list__row" *ngIf="techRecordEdited.techRecord_vehicleType === 'trl'">
<dt class="govuk-summary-list__key">TrailerID</dt>
<dd class="govuk-summary-list__value" id="test-trailerId">
{{ techRecordEdited.trailerId | defaultNullOrEmpty }}
</dd>
</div>
<div class="govuk-summary-list__row" *ngIf="techRecordEdited.techRecord_vehicleType !== 'trl'">
<dt class="govuk-summary-list__key">Vehicle registration mark (VRM)</dt>
<dd class="govuk-summary-list__value" id="test-primaryVrm">
{{ techRecordEdited.primaryVrm | defaultNullOrEmpty }}
</dd>
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">Vehicle type</dt>
<dd class="govuk-summary-list__value" id="test-techRecord_vehicleType">
{{ $any(techRecordEdited.techRecord_vehicleType) | formatVehicleType | defaultNullOrEmpty }}
</dd>
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">Year of manufacture</dt>
<dd class="govuk-summary-list__value" id="test-techRecord_manufactureYear">
{{ techRecordEdited.techRecord_manufactureYear | defaultNullOrEmpty }}
</dd>
</div>
<div class="govuk-summary-list__row" *ngIf="techRecordEdited.techRecord_vehicleType === 'psv'">
<dt class="govuk-summary-list__key">Make</dt>
<dd class="govuk-summary-list__value" id="test-techRecord_chassisMake">
{{ techRecordEdited.techRecord_chassisMake | defaultNullOrEmpty }}
</dd>
</div>
<div class="govuk-summary-list__row" *ngIf="techRecordEdited.techRecord_vehicleType === 'psv'">
<dt class="govuk-summary-list__key">Model</dt>
<dd class="govuk-summary-list__value" id="test-techRecord_chassisModel">
{{ techRecordEdited.techRecord_chassisModel | defaultNullOrEmpty }}
</dd>
</div>
<div class="govuk-summary-list__row" *ngIf="techRecordEdited.techRecord_vehicleType !== 'psv'">
<dt class="govuk-summary-list__key">Make</dt>
<dd class="govuk-summary-list__value" id="test-techRecord_make">
{{
techRecordEdited.techRecord_vehicleType === 'trl' || techRecordEdited.techRecord_vehicleType === 'hgv'
? (techRecordEdited.techRecord_make | defaultNullOrEmpty)
: '-'
}}
</dd>
</div>
<div class="govuk-summary-list__row" *ngIf="techRecordEdited.techRecord_vehicleType !== 'psv'">
<dt class="govuk-summary-list__key">Model</dt>
<dd class="govuk-summary-list__value" id="test-techRecord_model">
{{
techRecordEdited.techRecord_vehicleType === 'trl' || techRecordEdited.techRecord_vehicleType === 'hgv'
? (techRecordEdited.techRecord_model | defaultNullOrEmpty)
: '-'
}}
</dd>
</div>
</dl>

<app-accordion-control [class]="'padding'" [sectionState]="sectionTemplatesState$ | async">
<ng-container *ngFor="let section of customVehicleTemplate; let i = index">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
TechRecordGETPSV,
TechRecordGETTRL,
} from '@dvsa/cvs-type-definitions/types/v3/tech-record/tech-record-verb-vehicle-type';
import { VehicleSummary } from '@forms/templates/tech-records/vehicle-summary.template';
import { vehicleTemplateMap } from '@forms/utils/tech-record-constants';
import { Axles, VehicleTypes } from '@models/vehicle-tech-record.model';
import { Actions, ofType } from '@ngrx/effects';
Expand Down Expand Up @@ -139,10 +138,6 @@ export class TechRecordSummaryChangesComponent implements OnInit, OnDestroy {
: undefined;
}

get vehicleSummary(): FormNode {
return VehicleSummary;
}

get deletedAxles(): Axles {
if (this.techRecordEdited?.techRecord_vehicleType === 'hgv' && this.techRecordDeletions) {
return Object.values((this.techRecordDeletions as Partial<TechRecordGETHGV>).techRecord_axles ?? {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { provideMockStore } from '@ngrx/store/testing';
import { TestRecordsService } from '@services/test-records/test-records.service';
import { SharedModule } from '@shared/shared.module';
import { initialAppState } from '@store/index';
import { ReplaySubject } from 'rxjs';
import { ReplaySubject, of } from 'rxjs';
import { VehicleHeaderComponent } from '../../../../components/vehicle-header/vehicle-header.component';
import { ConfirmCancellationComponent } from '../confirm-cancellation.component';

Expand All @@ -28,6 +28,7 @@ describe('ConfirmCancellationComponent', () => {
provide: TestRecordsService,
useValue: {
cancelTest: () => {},
isTestTypeGroupEditable$: of(false),
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ <h1 class="govuk-heading-l">
</div>
</div>

<!-- Recalls warning -->
<app-field-warning-message
*ngIf="(recalls | async)?.hasRecall"
warningMessage="This vehicle has an outstanding vehicle recall. Tell the presenter to contact their nearest dealership to arrange for a free repair.">
</app-field-warning-message>

<div class="govuk-grid-row">
<div class="govuk-grid-column-one-half">
<h2 class="govuk-heading-m">Vehicle details</h2>
Expand Down Expand Up @@ -90,6 +96,12 @@ <h1 class="govuk-heading-l govuk-!-margin-bottom-2">
</div>
</div>

<!-- Recalls warning -->
<app-field-warning-message
*ngIf="(recalls | async)?.hasRecall"
warningMessage="This vehicle has an outstanding vehicle recall. Tell the presenter to contact their nearest dealership to arrange for a free repair.">
</app-field-warning-message>

<div class="tester_and_location">
<dl class="govuk-summary-list govuk-summary-list--no-border">
<div class="govuk-summary-list__row">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { TestRecordsService } from '@/src/app/services/test-records/test-records.service';
import { ChangeDetectionStrategy, Component, Input, inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { RecallsSchema } from '@dvsa/cvs-type-definitions/types/v1/recalls';
import { TechRecordType } from '@dvsa/cvs-type-definitions/types/v3/tech-record/tech-record-vehicle-type';
import { ReferenceDataResourceType } from '@models/reference-data.model';
import { TestResultStatus } from '@models/test-results/test-result-status.enum';
Expand All @@ -8,10 +10,9 @@ import { TestType, resultOfTestEnum } from '@models/test-types/test-type.model';
import { TEST_TYPES_GROUP7 } from '@models/testTypeId.enum';
import { V3TechRecordModel, VehicleTypes } from '@models/vehicle-tech-record.model';
import { Store } from '@ngrx/store';
import { TestTypesService } from '@services/test-types/test-types.service';
import { techRecord } from '@store/technical-records';
import { selectAllTestTypes } from '@store/test-types/test-types.selectors';
import { Observable } from 'rxjs';
import { Observable, map } from 'rxjs';
import { TagType, TagTypes } from '../../../../components/tag/tag.component';

@Component({
Expand All @@ -26,11 +27,9 @@ export class VehicleHeaderComponent {
@Input() testNumber?: string | null;
@Input() isReview = false;

constructor(
private testTypesService: TestTypesService,
private store: Store,
private activatedRoute: ActivatedRoute
) {}
store = inject(Store);
activatedRoute = inject(ActivatedRoute);
testRecordsService = inject(TestRecordsService);

get test(): TestType | undefined {
return this.testResult?.testTypes?.find((t) => this.testNumber === t.testNumber);
Expand Down Expand Up @@ -82,6 +81,12 @@ export class VehicleHeaderComponent {
return testCode ? `(${testCode})` : '';
}

get recalls(): Observable<RecallsSchema | undefined> {
return this.testRecordsService.isTestTypeGroupEditable$.pipe(
map((editable) => (editable ? this.testResult?.recalls : this.activatedRoute.snapshot?.data?.['recalls']))
);
}

// eslint-disable-next-line @typescript-eslint/no-shadow
getVehicleDescription(techRecord: V3TechRecordModel, vehicleType: VehicleTypes | undefined) {
switch (vehicleType) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { recallsResolver } from '@/src/app/resolvers/recalls/recalls.resolver';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { DefectSelectComponent } from '@forms/components/defect-select/defect-select.component';
Expand Down Expand Up @@ -40,6 +41,7 @@ const routes: Routes = [
defectTaxonomy: defectsTaxonomyResolver,
testStations: testStationsResolver,
testCode: testCodeResolver,
recalls: recallsResolver,
},
data: { title: 'Test details', roles: Roles.TestResultCreateContingency, breadcrumbPreserveQueryParams: true },
canActivate: [RoleGuard],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ export class PsvBrakesComponent implements OnInit, OnChanges, OnDestroy {
}

get brakeCode(): string {
return `${this.brakeCodePrefix}${this.form.get('techRecord_brakes_brakeCodeOriginal')?.value}`;
const suffix = this.form.get('techRecord_brakes_brakeCodeOriginal')?.value;
return suffix ? `${this.brakeCodePrefix}${suffix}` : '-';
}

get brakesForm(): FormGroup {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const SmallTrailerTechRecord: FormNode = {
editType: FormNodeEditTypes.SELECT,
options: [
{ value: 'January', label: 'January' },
{ value: 'February', label: 'Febraury' },
{ value: 'February', label: 'February' },
{ value: 'March', label: 'March' },
{ value: 'April', label: 'April' },
{ value: 'May', label: 'May' },
Expand Down
56 changes: 0 additions & 56 deletions src/app/forms/templates/tech-records/vehicle-summary.template.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,26 @@ export const ContingencyTestSectionGroup1: FormNode = {
editType: FormNodeEditTypes.HIDDEN,
validators: [{ name: ValidatorNames.AheadOfDate, args: 'testStartTimestamp' }],
},
{
name: 'recalls',
type: FormNodeTypes.GROUP,
children: [
{
name: 'hasRecall',
value: false,
type: FormNodeTypes.CONTROL,
viewType: FormNodeViewTypes.HIDDEN,
editType: FormNodeEditTypes.HIDDEN,
},
{
name: 'manufacturer',
value: null,
type: FormNodeTypes.CONTROL,
viewType: FormNodeViewTypes.HIDDEN,
editType: FormNodeEditTypes.HIDDEN,
},
],
},
{
name: 'testTypes',
label: 'Test Types',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,26 @@ export const ContingencyTestSectionGroup12and14: FormNode = {
editType: FormNodeEditTypes.HIDDEN,
validators: [{ name: ValidatorNames.AheadOfDate, args: 'testStartTimestamp' }],
},
{
name: 'recalls',
type: FormNodeTypes.GROUP,
children: [
{
name: 'hasRecall',
value: false,
type: FormNodeTypes.CONTROL,
viewType: FormNodeViewTypes.HIDDEN,
editType: FormNodeEditTypes.HIDDEN,
},
{
name: 'manufacturer',
value: null,
type: FormNodeTypes.CONTROL,
viewType: FormNodeViewTypes.HIDDEN,
editType: FormNodeEditTypes.HIDDEN,
},
],
},
{
name: 'testTypes',
label: 'Test Types',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ export const ContingencyTestSectionGroup15and16: FormNode = {
editType: FormNodeEditTypes.HIDDEN,
validators: [{ name: ValidatorNames.AheadOfDate, args: 'testStartTimestamp' }],
},
{
name: 'recalls',
type: FormNodeTypes.GROUP,
children: [
{
name: 'hasRecall',
value: false,
type: FormNodeTypes.CONTROL,
viewType: FormNodeViewTypes.HIDDEN,
editType: FormNodeEditTypes.HIDDEN,
},
{
name: 'manufacturer',
value: null,
type: FormNodeTypes.CONTROL,
viewType: FormNodeViewTypes.HIDDEN,
editType: FormNodeEditTypes.HIDDEN,
},
],
},
{
name: 'testTypes',
label: 'Test Types',
Expand Down
Loading

0 comments on commit 5e01f21

Please sign in to comment.