Skip to content

Commit

Permalink
feat(cb2-0000): dynamically display tags based off vehicle type
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonT95 committed Nov 29, 2024
1 parent 12f4288 commit 69314f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ <h1>
label="Speed limiter exempt"
formControlName="techRecord_speedLimiterMrk"
[options]="EXEMPT_OR_NOT_OPTIONS"
[tags]="[{ colour: TagType.PURPLE, label: TagTypeLabels.PLATES }]"
[tags]="[showTagBasedOnVehicleTypes([VehicleTypes.HGV], { colour: TagType.PURPLE, label: TagTypeLabels.PLATES })]"
></govuk-form-group-radio>

<!-- Tacho exempt -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
import { VehicleConfiguration } from '@models/vehicle-configuration.enum';
import { V3TechRecordModel, VehicleSizes, VehicleTypes } from '@models/vehicle-tech-record.model';
import { Store } from '@ngrx/store';
import { FormNodeWidth, TagTypeLabels } from '@services/dynamic-forms/dynamic-form.types';
import { CustomTag, FormNodeWidth, TagTypeLabels } from '@services/dynamic-forms/dynamic-form.types';
import { TechnicalRecordService } from '@services/technical-record/technical-record.service';
import { ReplaySubject } from 'rxjs';

Expand Down Expand Up @@ -408,4 +408,8 @@ export class VehicleSectionEditComponent implements OnInit, OnDestroy {
this.getVehicleType() === VehicleTypes.MOTORCYCLE
);
}

showTagBasedOnVehicleTypes(vehicleTypes: VehicleTypes[], tagsToDisplay: CustomTag): CustomTag {
if (vehicleTypes.includes(this.getVehicleType())) return tagsToDisplay;
}
}

0 comments on commit 69314f3

Please sign in to comment.