Skip to content

Commit

Permalink
feature/CB2-11802 - Add body declaration type field to VTM ADR section (
Browse files Browse the repository at this point in the history
#1626)

* feat(cb2-11802): basic boilerplate

* feat(cb2-11802): basic validation changes

* feat(cb2-11802): update enums and their values

* feat(cb2-11802): stash

* feat(cb2-11802): small change to model

* feat(cb2-11802): added to payload

---------

Co-authored-by: Thomas Evans <36958694+tomevs88@users.noreply.github.com>
  • Loading branch information
tomcrawleyy and tomevs88 authored Oct 29, 2024
1 parent 78557b6 commit bb3528e
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 5 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.4.0",
"@dvsa/cvs-type-definitions": "^7.5.0",
"@ngrx/effects": "^18.0.2",
"@ngrx/entity": "^18.0.2",
"@ngrx/operators": "^18.1.0",
Expand Down
36 changes: 36 additions & 0 deletions src/app/forms/templates/general/adr-summary.template.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ADRAdditionalNotesNumber } from '@dvsa/cvs-type-definitions/types/v3/tech-record/enums/adrAdditionalNotesNumber.enum.js';
import { ADRBodyDeclarationTypes } from '@dvsa/cvs-type-definitions/types/v3/tech-record/enums/adrBodyDeclarationType.enum.js';
import { ADRBodyType } from '@dvsa/cvs-type-definitions/types/v3/tech-record/enums/adrBodyType.enum.js';
import { ADRCompatibilityGroupJ } from '@dvsa/cvs-type-definitions/types/v3/tech-record/enums/adrCompatibilityGroupJ.enum.js';
import { ADRDangerousGood } from '@dvsa/cvs-type-definitions/types/v3/tech-record/enums/adrDangerousGood.enum.js';
Expand Down Expand Up @@ -199,6 +200,20 @@ export const AdrSummaryTemplate: FormNode = {
hide: true,
options: getOptionsFromEnum(ADRDangerousGood),
validators: [
{
name: ValidatorNames.ShowGroupsWhenIncludes,
args: {
values: [ADRDangerousGood, ADRDangerousGood.EXPLOSIVES_TYPE_3],
groups: ['body_declaration'],
},
},
{
name: ValidatorNames.HideGroupsWhenExcludes,
args: {
values: [ADRDangerousGood.EXPLOSIVES_TYPE_3],
groups: ['body_declaration'],
},
},
{
name: ValidatorNames.ShowGroupsWhenIncludes,
args: {
Expand All @@ -219,6 +234,27 @@ export const AdrSummaryTemplate: FormNode = {
},
],
},
{
name: 'techRecord_adrDetails_bodyDeclaration_type',
label: 'Body declaration',
type: FormNodeTypes.CONTROL,
groups: ['body_declaration', 'adr_details', 'dangerous_goods'],
hide: true,
options: [
{ value: ADRBodyDeclarationTypes.PRE_1ST_JULY_2005, label: ADRBodyDeclarationTypes.PRE_1ST_JULY_2005 },
{
value: ADRBodyDeclarationTypes.ON_OR_AFTER_1ST_JULY_2005,
label: ADRBodyDeclarationTypes.ON_OR_AFTER_1ST_JULY_2005,
},
{ value: ADRBodyDeclarationTypes.UNKNOWN, label: ADRBodyDeclarationTypes.UNKNOWN },
],
validators: [
{
name: ValidatorNames.RequiredIfEquals,
args: { sibling: 'techRecord_adrDetails_dangerousGoods', value: [true] },
},
],
},
{
name: 'techRecord_adrDetails_compatibilityGroupJ',
label: 'Compatibility group J',
Expand Down
37 changes: 37 additions & 0 deletions src/app/forms/templates/general/adr.template.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ADRAdditionalNotesNumber } from '@dvsa/cvs-type-definitions/types/v3/tech-record/enums/adrAdditionalNotesNumber.enum.js';
import { ADRBodyDeclarationTypes } from '@dvsa/cvs-type-definitions/types/v3/tech-record/enums/adrBodyDeclarationType.enum.js';
import { ADRBodyType } from '@dvsa/cvs-type-definitions/types/v3/tech-record/enums/adrBodyType.enum.js';
import { ADRCompatibilityGroupJ } from '@dvsa/cvs-type-definitions/types/v3/tech-record/enums/adrCompatibilityGroupJ.enum.js';
import { ADRDangerousGood } from '@dvsa/cvs-type-definitions/types/v3/tech-record/enums/adrDangerousGood.enum.js';
Expand Down Expand Up @@ -206,6 +207,20 @@ export const AdrTemplate: FormNode = {
groups: ['adr_details', 'dangerous_goods'],
hide: true,
validators: [
{
name: ValidatorNames.ShowGroupsWhenIncludes,
args: {
values: [ADRDangerousGood, ADRDangerousGood.EXPLOSIVES_TYPE_3],
groups: ['body_declaration'],
},
},
{
name: ValidatorNames.HideGroupsWhenExcludes,
args: {
values: [ADRDangerousGood.EXPLOSIVES_TYPE_3],
groups: ['body_declaration'],
},
},
{
name: ValidatorNames.ShowGroupsWhenIncludes,
args: {
Expand All @@ -226,6 +241,28 @@ export const AdrTemplate: FormNode = {
},
],
},
{
name: 'techRecord_adrDetails_bodyDeclaration_type',
label: 'Body declaration',
type: FormNodeTypes.CONTROL,
editType: FormNodeEditTypes.RADIO,
groups: ['body_declaration', 'adr_details', 'dangerous_goods'],
hide: true,
options: [
{ value: ADRBodyDeclarationTypes.PRE_1ST_JULY_2005, label: ADRBodyDeclarationTypes.PRE_1ST_JULY_2005 },
{
value: ADRBodyDeclarationTypes.ON_OR_AFTER_1ST_JULY_2005,
label: ADRBodyDeclarationTypes.ON_OR_AFTER_1ST_JULY_2005,
},
{ value: ADRBodyDeclarationTypes.UNKNOWN, label: ADRBodyDeclarationTypes.UNKNOWN },
],
validators: [
{
name: ValidatorNames.RequiredIfEquals,
args: { sibling: 'techRecord_adrDetails_dangerousGoods', value: [true] },
},
],
},
{
name: 'techRecord_adrDetails_compatibilityGroupJ',
label: 'Compatibility group J',
Expand Down
4 changes: 4 additions & 0 deletions src/app/models/vehicle/adrDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export interface AdrDetails {
/**
* Optional for all vehicle types
*/
bodyDeclaration_type?: string;
/**
* Optional for all vehicle types, displayed only if explosives type 3 chosen for
*/
compatibilityGroupJ?: boolean;
/**
* Optional. Applicable only if vehicleDetails.type contains the word ‘tank’ or ‘battery’.
Expand Down

0 comments on commit bb3528e

Please sign in to comment.