Skip to content

Commit

Permalink
feat(CB2-14451): more pack fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pbardy2000 committed Dec 3, 2024
1 parent e0b12f9 commit d676b73
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="govuk-form-group-radio">
<div class="govuk-form-group-radio" [id]="id">
<fieldset role="group">
<legend>
<h1 tag>
Expand Down Expand Up @@ -32,15 +32,15 @@ <h1 tag>
[value]="option.value"
[checked]="option.value === value"
[attr.aria-describedby]="hintId"
[attr.aria-labelledby]="labelId"
[attr.aria-labelledby]="id + '-' + option.value + '-label'"
[attr.data-testid]="id"
[class.govuk-radios__input--error]="hasError"
[(ngModel)]="value"
(ngModelChange)="onChange($event)"
(blur)="onTouched()"
/>
<label
id="{{ labelId }}"
id="{{ id }}-{{ option.value }}-label"
for="{{ id }}-{{ option.value }}-radio"
>
{{ option.label }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ <h1>

<!-- Suspension type (TRL Only) -->
<div class="govuk-form-group-select" *ngIf="shouldDisplayFormControl('techRecord_suspensionType')">
<label for="techRecord_manufactureMonth">
<label for="techRecord_suspensionType">
Suspension type (optional)
</label>
<app-control-errors elementId="techRecord_suspensionType-error" [control]="$any(form.get('techRecord_suspensionType'))" />
<select govukSelect formControlName="techRecord_manufactureMonth">
<select govukSelect formControlName="techRecord_suspensionType">
<option [value]="option.value" *ngFor="let option of SUSPENSION_TYRE_OPTIONS">{{ option.label }}</option>
</select>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { CommonValidatorsService } from '@forms/validators/common-validators.ser
import { CouplingTypeOptions } from '@models/coupling-type-enum';
import {
ALL_EU_VEHICLE_CATEGORY_OPTIONS,
ALL_VEHICLE_CLASS_DESCRIPTION_OPTIONS,
ALL_VEHICLE_CONFIGURATION_OPTIONS,
EMISSION_STANDARD_OPTIONS,
EXEMPT_OR_NOT_OPTIONS,
Expand All @@ -26,10 +27,10 @@ import {
HGV_PSV_VEHICLE_CONFIGURATION_OPTIONS,
HGV_VEHICLE_CLASS_DESCRIPTION_OPTIONS,
MONTHS,
MOTORCYCLE_VEHICLE_CLASS_DESCRIPTION_OPTIONS,
PSV_EU_VEHICLE_CATEGORY_OPTIONS,
PSV_VEHICLE_CLASS_DESCRIPTION_OPTIONS,
SUSPENSION_TYRE_OPTIONS,
TRL_VEHICLE_CLASS_DESCRIPTION_OPTIONS,
TRL_VEHICLE_CONFIGURATION_OPTIONS,
VEHICLE_SIZE_OPTIONS,
VEHICLE_SUBCLASS_OPTIONS,
Expand Down Expand Up @@ -325,18 +326,19 @@ export class VehicleSectionEditComponent implements OnInit, OnDestroy {
}

get vehicleClassDescriptionOptions() {
switch (this.techRecord()?.techRecord_vehicleType.toLowerCase()) {
switch (this.technicalRecordService.getVehicleTypeWithSmallTrl(this.techRecord())) {
case VehicleTypes.HGV:
return HGV_VEHICLE_CLASS_DESCRIPTION_OPTIONS;
case VehicleTypes.PSV:
return PSV_VEHICLE_CLASS_DESCRIPTION_OPTIONS;
case VehicleTypes.TRL:
case VehicleTypes.SMALL_TRL:
return TRL_VEHICLE_CLASS_DESCRIPTION_OPTIONS;
case VehicleTypes.LGV:
case VehicleTypes.CAR:
return null;
case VehicleTypes.SMALL_TRL:
case VehicleTypes.MOTORCYCLE:
return MOTORCYCLE_VEHICLE_CLASS_DESCRIPTION_OPTIONS;
return ALL_VEHICLE_CLASS_DESCRIPTION_OPTIONS;
default:
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,19 @@
</dd>
</div>
</ng-container>
<ng-container *ngIf="vm.techRecord_vehicleType === VehicleTypes.MOTORCYCLE">
<ng-container *ngIf="vm.techRecord_vehicleType === VehicleTypes.TRL">
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">Vehicle class</dt>
<dd class="govuk-summary-list__value" id="test-techRecord_vehicleClass_motorcycle">
{{ vm.techRecord_vehicleClass_description | multiOption : MOTORCYCLE_VEHICLE_CLASS_DESCRIPTION_OPTIONS }}
{{ vm.techRecord_vehicleClass_description | multiOption : ALL_VEHICLE_CLASS_DESCRIPTION_OPTIONS }}
</dd>
</div>
</ng-container>
<ng-container *ngIf="vm.techRecord_vehicleType === VehicleTypes.MOTORCYCLE || technicalRecordService.getVehicleTypeWithSmallTrl(vm) === VehicleTypes.SMALL_TRL">
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">Vehicle class</dt>
<dd class="govuk-summary-list__value" id="test-techRecord_vehicleClass_motorcycle">
{{ $any(vm).techRecord_vehicleClass_description | multiOption : ALL_VEHICLE_CLASS_DESCRIPTION_OPTIONS }}
</dd>
</div>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Component, inject } from '@angular/core';
import {
ALL_VEHICLE_CLASS_DESCRIPTION_OPTIONS,
HGV_VEHICLE_CLASS_DESCRIPTION_OPTIONS,
MOTORCYCLE_VEHICLE_CLASS_DESCRIPTION_OPTIONS,
PSV_VEHICLE_CLASS_DESCRIPTION_OPTIONS,
TRL_VEHICLE_CLASS_DESCRIPTION_OPTIONS,
} from '@models/options.model';
import { VehicleTypes } from '@models/vehicle-tech-record.model';
import { Store } from '@ngrx/store';
Expand All @@ -17,8 +18,9 @@ import { techRecord } from '@store/technical-records';
export class VehicleSectionViewComponent {
readonly VehicleTypes = VehicleTypes;
readonly HGV_VEHICLE_CLASS_DESCRIPTION_OPTIONS = HGV_VEHICLE_CLASS_DESCRIPTION_OPTIONS;
readonly TRL_VEHICLE_CLASS_DESCRIPTION_OPTIONS = TRL_VEHICLE_CLASS_DESCRIPTION_OPTIONS;
readonly PSV_VEHICLE_CLASS_DESCRIPTION_OPTIONS = PSV_VEHICLE_CLASS_DESCRIPTION_OPTIONS;
readonly MOTORCYCLE_VEHICLE_CLASS_DESCRIPTION_OPTIONS = MOTORCYCLE_VEHICLE_CLASS_DESCRIPTION_OPTIONS;
readonly ALL_VEHICLE_CLASS_DESCRIPTION_OPTIONS = ALL_VEHICLE_CLASS_DESCRIPTION_OPTIONS;

store = inject(Store);
technicalRecordService = inject(TechnicalRecordService);
Expand Down
4 changes: 3 additions & 1 deletion src/app/models/options.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export const PSV_VEHICLE_CLASS_DESCRIPTION_OPTIONS: MultiOptions = [
},
];

export const MOTORCYCLE_VEHICLE_CLASS_DESCRIPTION_OPTIONS: MultiOptions = [
export const TRL_VEHICLE_CLASS_DESCRIPTION_OPTIONS: MultiOptions = [{ label: 'trailer', value: 'trailer' }];

export const ALL_VEHICLE_CLASS_DESCRIPTION_OPTIONS: MultiOptions = [
{ label: 'motorbikes over 200cc or with a sidecar', value: 'motorbikes over 200cc or with a sidecar' },
{ label: 'not applicable', value: 'not applicable' },
{
Expand Down

0 comments on commit d676b73

Please sign in to comment.