-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cb2-11403): remove DFS, add tag (#1631)
Co-authored-by: Thomas Crawley <thomas.crawley@dvsa.gov.uk>
- Loading branch information
1 parent
c274c93
commit bbba66b
Showing
6 changed files
with
128 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 84 additions & 2 deletions
86
src/app/features/search/single-search-result/single-search-result.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,85 @@ | ||
<div *appRoleRequired="roles.TechRecordView"> | ||
<app-dynamic-form-group *ngIf="template" [template]="template" [data]="vehicleDisplayData" class="govuk-summary-list"></app-dynamic-form-group> | ||
</div> | ||
<div class="govuk-summary-list"> | ||
<div class="subheading-container"> | ||
<div class="subheading"> | ||
<h2 class="govuk-heading-m">Technical Record</h2> | ||
<a | ||
class="govuk-link" | ||
id="select-/tech-records/{{searchResult.systemNumber}}/{{searchResult.createdTimestamp}}-link" | ||
routerLink="/tech-records/{{searchResult.systemNumber}}/{{searchResult.createdTimestamp}}"> | ||
Select technical record | ||
</a> | ||
</div> | ||
<app-tag [type]="tagType">{{ searchResult.techRecord_statusCode | uppercase }}</app-tag> | ||
</div> | ||
|
||
<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"> | ||
{{ searchResult.vin | defaultNullOrEmpty }} | ||
</dd> | ||
</div> | ||
<ng-container *ngIf="searchResult.techRecord_vehicleType === 'trl'; else vrm"> | ||
<div class="govuk-summary-list__row"> | ||
<dt class="govuk-summary-list__key"> | ||
TrailerID: | ||
</dt> | ||
<dd class="govuk-summary-list__value" id="test-trailerId"> | ||
<app-number-plate [vrm]="searchResult.trailerId"></app-number-plate> | ||
</dd> | ||
</div> | ||
</ng-container> | ||
<ng-template #vrm> | ||
<div class="govuk-summary-list__row"> | ||
<dt class="govuk-summary-list__key"> | ||
Vehicle registration mark (VRM): | ||
</dt> | ||
<dd class="govuk-summary-list__value" id="test-vrm"> | ||
<app-number-plate [vrm]="searchResult.primaryVrm"></app-number-plate> | ||
</dd> | ||
</div> | ||
</ng-template> | ||
<div class="govuk-summary-list__row"> | ||
<dt class="govuk-summary-list__key"> | ||
Vehicle type: | ||
</dt> | ||
<dd class="govuk-summary-list__value" id="test-vehicleType"> | ||
{{ $any(searchResult.techRecord_vehicleType) | formatVehicleType }} | ||
</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-manufactureYear"> | ||
{{ searchResult.techRecord_manufactureYear | defaultNullOrEmpty }} | ||
</dd> | ||
</div> | ||
<div class="govuk-summary-list__row"> | ||
<dt class="govuk-summary-list__key"> | ||
Make: | ||
</dt> | ||
<dd class="govuk-summary-list__value" id="test-make"> | ||
<ng-container *ngIf="searchResult.techRecord_vehicleType === 'psv'; else make"> | ||
{{ searchResult.techRecord_chassisMake | defaultNullOrEmpty }} | ||
</ng-container> | ||
<ng-template #make>{{ searchResult.techRecord_make | defaultNullOrEmpty }}</ng-template> | ||
</dd> | ||
</div> | ||
<div class="govuk-summary-list__row"> | ||
<dt class="govuk-summary-list__key"> | ||
Model: | ||
</dt> | ||
<dd class="govuk-summary-list__value" id="test-model"> | ||
<ng-container *ngIf="searchResult.techRecord_vehicleType === 'psv'; else model"> | ||
{{ searchResult.techRecord_chassisModel | defaultNullOrEmpty }} | ||
</ng-container> | ||
<ng-template #model>{{ searchResult.techRecord_model | defaultNullOrEmpty }}</ng-template> | ||
</dd> | ||
</div> | ||
</dl> | ||
</div> | ||
</div> |
16 changes: 16 additions & 0 deletions
16
src/app/features/search/single-search-result/single-search-result.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.subheading-container { | ||
display: flex; | ||
flex-direction: column; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.subheading { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
margin-bottom: 0.5rem; | ||
} | ||
|
||
.subheading h2 { | ||
margin-bottom: 0; | ||
} |
52 changes: 17 additions & 35 deletions
52
src/app/features/search/single-search-result/single-search-result.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,32 @@ | ||
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; | ||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; | ||
import { TagType } from '@components/tag/tag.component'; | ||
import { TechRecordSearchSchema } from '@dvsa/cvs-type-definitions/types/v3/tech-record/get/search'; | ||
import { createSingleSearchResult } from '@forms/templates/search/single-search-result.template'; | ||
import { Roles } from '@models/roles.enum'; | ||
import { FormNode } from '@services/dynamic-forms/dynamic-form.types'; | ||
import { StatusCodes } from '@models/vehicle-tech-record.model'; | ||
|
||
@Component({ | ||
selector: 'app-single-search-result[searchResult]', | ||
templateUrl: './single-search-result.component.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
styleUrls: ['./single-search-result.component.scss'], | ||
}) | ||
export class SingleSearchResultComponent implements OnInit { | ||
export class SingleSearchResultComponent { | ||
@Input() searchResult!: TechRecordSearchSchema; | ||
vehicleDisplayData?: VehicleDisplayData; | ||
template?: FormNode; | ||
|
||
ngOnInit(): void { | ||
this.vehicleDisplayData = { | ||
vin: this.searchResult.vin, | ||
vrm: this.searchResult.primaryVrm, | ||
trailerId: this.searchResult.trailerId, | ||
make: | ||
this.searchResult.techRecord_vehicleType === 'psv' | ||
? this.searchResult.techRecord_chassisMake | ||
: this.searchResult.techRecord_make, | ||
model: | ||
this.searchResult.techRecord_vehicleType === 'psv' | ||
? this.searchResult.techRecord_chassisModel | ||
: this.searchResult.techRecord_model, | ||
manufactureYear: this.searchResult.techRecord_manufactureYear, | ||
vehicleType: this.searchResult.techRecord_vehicleType.toUpperCase(), | ||
}; | ||
|
||
this.template = createSingleSearchResult(this.searchResult.systemNumber, this.searchResult.createdTimestamp); | ||
} | ||
|
||
public get roles() { | ||
return Roles; | ||
} | ||
} | ||
|
||
interface VehicleDisplayData { | ||
vin?: string; | ||
vrm?: string; | ||
trailerId?: string; | ||
make?: string | null; | ||
model?: string | null; | ||
manufactureYear?: number | null; | ||
vehicleType?: string; | ||
public get tagType() { | ||
switch (this.searchResult?.techRecord_statusCode) { | ||
case StatusCodes.CURRENT: | ||
return ''; // default is dark blue; | ||
case StatusCodes.ARCHIVED: | ||
return TagType.GREY; | ||
case StatusCodes.PROVISIONAL: | ||
return TagType.ORANGE; | ||
default: | ||
return TagType.BLUE; | ||
} | ||
} | ||
} |
68 changes: 0 additions & 68 deletions
68
src/app/forms/templates/search/single-search-result.template.ts
This file was deleted.
Oops, something went wrong.