Skip to content

Commit

Permalink
feat(cb2-13455): VTM - Pass and issue Documents Centrally (additional…
Browse files Browse the repository at this point in the history
… test type ids) (#1530)

* feat(cb2-13455): add issue docs centrally for first test and first test prohibition clearance

* feat(cb2-13455): linting

* feat(cb2-13455): fix linting

* feat(cb2-13455): fix template

* feat(cb2-13455): show issue docs for prs

---------

Co-authored-by: Brandon Thomas-Davies <87308252+BrandonT95@users.noreply.github.com>
  • Loading branch information
pbardy2000 and BrandonT95 authored Aug 8, 2024
1 parent ab634e7 commit e78d142
Show file tree
Hide file tree
Showing 5 changed files with 388 additions and 27 deletions.
33 changes: 6 additions & 27 deletions src/app/forms/models/testTypeId.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,11 @@ export const TEST_TYPES_GROUP6_11: string[] = ['62', '63', '122', '101', '91'];
// ADR tests for HGV and TRL
export const TEST_TYPES_GROUP7: string[] = ['59', '60', '50'];

// tests for HGV and TRL - Annual tests, First tests, Annual retests, Paid/Part paid prohibition clearance
export const TEST_TYPES_GROUP9_10: string[] = [
'76',
'95',
'94',
'53',
'54',
'65',
'66',
'70',
'79',
'82',
'83',
'41',
'40',
'98',
'99',
'103',
'104',
'67',
'107',
'113',
'116',
'119',
'120',
'199',
];
// tests for HGV and TRL - Annual tests, Annual retests, Paid/Part paid prohibition clearance on annual test
export const TEST_TYPES_GROUP9_10: string[] = ['76', '94', '53', '54', '70', '79', '40', '98', '99', '67', '107', '113', '116', '199'];

// tests for HGV and TRL - First tests, Paid/Part paid prohibition clearance on first test
export const TEST_TYPES_GROUP9_10_CENTRAL_DOCS = ['95', '41', '65', '103', '66', '104', '82', '119', '83', '120'];

// tests for TRL - Paid/Part paid prohibition clearance(retest, full inspection, part inspection, without cert)
export const TEST_TYPES_GROUP12_14: string[] = ['117', '108', '109', '110', '114', '71', '72', '73', '77', '80'];
Expand Down Expand Up @@ -200,6 +178,7 @@ export const TEST_TYPES = {
testTypesGroup7: TEST_TYPES_GROUP7,
testTypesGroup8Notifiable: TEST_TYPES_GROUP8_NOTIFABLE,
testTypesGroup9And10: TEST_TYPES_GROUP9_10,
testTypesGroup9And10CentralDocs: TEST_TYPES_GROUP9_10_CENTRAL_DOCS,
testTypesGroup6And11: TEST_TYPES_GROUP6_11,
testTypesGroup12And14: TEST_TYPES_GROUP12_14,
testTypesGroup5And13: TEST_TYPES_GROUP5_13,
Expand Down
23 changes: 23 additions & 0 deletions src/app/forms/templates/test-records/create-master.template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ import { ContingencyTestSectionGroup6And11 } from './section-templates/test/cont
import { ContingencyTestSectionGroup7 } from './section-templates/test/contingency/contingency-test-section-group7.template';
import { ContingencyTestSectionGroup8Notifiable } from './section-templates/test/contingency/contingency-test-section-group8Notifiable.template';
import { ContingencyTestSectionGroup9And10 } from './section-templates/test/contingency/contingency-test-section-group9And10.template';
import {
ContingencyTestSectionGroup9And10CentralDocs,
} from './section-templates/test/contingency/contingency-test-section-group9And10CentralDocs.template';
import { ContingencyTestSectionSpecialistGroup1 } from './section-templates/test/contingency/contingency-test-section-specialist-group1.template';
import { ContingencyTestSectionSpecialistGroup2 } from './section-templates/test/contingency/contingency-test-section-specialist-group2.template';
import {
Expand Down Expand Up @@ -318,6 +321,16 @@ export const contingencyTestTemplates: Record<VehicleTypes, Partial<Record<keyof
customDefects: CustomDefectsHiddenSection,
reasonForCreation: reasonForCreationSection,
},
testTypesGroup9And10CentralDocs: {
required: CreateRequiredSectionHgvTrl,
vehicle: ContingencyVehicleSectionDefaultPsvHgvLight,
test: ContingencyTestSectionGroup9And10CentralDocs,
visit: ContingencyVisitSection,
notes: NotesSection,
defects: DefectsTpl,
customDefects: CustomDefectsHiddenSection,
reasonForCreation: reasonForCreationSection,
},
testTypesGroup12And14: {
required: CreateRequiredSectionHgvTrl,
vehicle: ContingencyVehicleSectionDefaultPsvHgvLight,
Expand Down Expand Up @@ -502,6 +515,16 @@ export const contingencyTestTemplates: Record<VehicleTypes, Partial<Record<keyof
customDefects: CustomDefectsHiddenSection,
reasonForCreation: reasonForCreationSection,
},
testTypesGroup9And10CentralDocs: {
required: CreateRequiredSectionHgvTrl,
vehicle: ContingencyVehicleSectionDefaultTrl,
test: ContingencyTestSectionGroup9And10CentralDocs,
visit: ContingencyVisitSection,
notes: NotesSection,
defects: DefectsTpl,
customDefects: CustomDefectsHiddenSection,
reasonForCreation: reasonForCreationSection,
},
testTypesGroup12And14: {
required: CreateRequiredSectionHgvTrl,
vehicle: ContingencyVehicleSectionDefaultTrl,
Expand Down
21 changes: 21 additions & 0 deletions src/app/forms/templates/test-records/master.template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import { TestSectionGroup6And11 } from './section-templates/test/test-section-gr
import { TestSectionGroup7 } from './section-templates/test/test-section-group7.template';
import { TestSectionGroup8Notifiable } from './section-templates/test/test-section-group8Notifiable.template';
import { TestSectionGroup9And10 } from './section-templates/test/test-section-group9And10.template';
import { TestSectionGroup9And10CentralDocs } from './section-templates/test/test-section-group9And10CentralDocs.template';
import { TestSection } from './section-templates/test/test-section.template';
import { IvaMsvaVehicleSection } from './section-templates/vehicle/amend-iva-msva-psv-hgv-light.template';
import { VehicleSectionDefaultPsvHgvLight } from './section-templates/vehicle/default-psv-hgv-light-vehicle-section.template';
Expand Down Expand Up @@ -306,6 +307,16 @@ export const masterTpl: Record<VehicleTypes, Partial<Record<keyof typeof TEST_TY
reasonForCreation: reasonForCreationSection,
required: RequiredSectionHGVTRL,
},
testTypesGroup9And10CentralDocs: {
vehicle: VehicleSectionDefaultPsvHgvLight,
test: TestSectionGroup9And10CentralDocs,
visit: VisitSection,
notes: NotesSection,
defects: DefectsTpl,
customDefects: CustomDefectsHiddenSection,
reasonForCreation: reasonForCreationSection,
required: RequiredSectionHGVTRL,
},
testTypesGroup12And14: {
vehicle: VehicleSectionDefaultPsvHgvLight,
test: TestSectionGroup12And14,
Expand Down Expand Up @@ -481,6 +492,16 @@ export const masterTpl: Record<VehicleTypes, Partial<Record<keyof typeof TEST_TY
reasonForCreation: reasonForCreationSection,
required: RequiredSectionHGVTRL,
},
testTypesGroup9And10CentralDocs: {
vehicle: VehicleSectionDefaultTrl,
test: TestSectionGroup9And10CentralDocs,
visit: VisitSection,
notes: NotesSection,
defects: DefectsTpl,
customDefects: CustomDefectsHiddenSection,
reasonForCreation: reasonForCreationSection,
required: RequiredSectionHGVTRL,
},
testTypesGroup12And14: {
vehicle: VehicleSectionDefaultTrl,
test: TestSectionGroup12And14,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import { ValidatorNames } from '@forms/models/validators.enum';
import {
FormNode, FormNodeEditTypes, FormNodeTypes, FormNodeViewTypes, FormNodeWidth,
} from '@forms/services/dynamic-form.types';

export const ContingencyTestSectionGroup9And10CentralDocs: FormNode = {
name: 'testSection',
label: 'Test',
type: FormNodeTypes.GROUP,
children: [
{
name: 'contingencyTestNumber',
label: 'Contingency Test Number',
type: FormNodeTypes.CONTROL,
editType: FormNodeEditTypes.NUMERICSTRING,
validators: [{ name: ValidatorNames.MaxLength, args: 8 }, { name: ValidatorNames.MinLength, args: 6 }, { name: ValidatorNames.Required }],
width: FormNodeWidth.L,
},
{
name: 'testStartTimestamp',
label: 'Test start date',
type: FormNodeTypes.CONTROL,
viewType: FormNodeViewTypes.HIDDEN,
editType: FormNodeEditTypes.HIDDEN,
validators: [{ name: ValidatorNames.PastDate }],
},
{
name: 'testEndTimestamp',
type: FormNodeTypes.CONTROL,
label: 'Test end date',
viewType: FormNodeViewTypes.HIDDEN,
editType: FormNodeEditTypes.HIDDEN,
validators: [{ name: ValidatorNames.AheadOfDate, args: 'testStartTimestamp' }],
},
{
name: 'testTypes',
label: 'Test Types',
type: FormNodeTypes.ARRAY,
children: [
{
name: '0', // it is important here that the name of the node for an ARRAY type should be an index value
type: FormNodeTypes.GROUP,
children: [
{
name: 'testResult',
label: 'Result',
editType: FormNodeEditTypes.HIDDEN,
viewType: FormNodeViewTypes.HIDDEN,
value: null,
type: FormNodeTypes.CONTROL,
validators: [{ name: ValidatorNames.HideIfNotEqual, args: { sibling: 'centralDocs', value: ['pass', 'prs'] } }],
},
{
name: 'centralDocs',
type: FormNodeTypes.GROUP,
children: [
{
name: 'issueRequired',
type: FormNodeTypes.CONTROL,
label: 'Issue documents centrally',
editType: FormNodeEditTypes.RADIO,
value: false,
options: [
{ value: true, label: 'Yes' },
{ value: false, label: 'No' },
],
validators: [{ name: ValidatorNames.HideIfParentSiblingEqual, args: { sibling: 'certificateNumber', value: true } }],
},
{
name: 'reasonsForIssue',
type: FormNodeTypes.CONTROL,
viewType: FormNodeViewTypes.HIDDEN,
editType: FormNodeEditTypes.HIDDEN,
value: [],
},
],
},
{
name: 'reasonForAbandoning',
type: FormNodeTypes.CONTROL,
viewType: FormNodeViewTypes.HIDDEN,
editType: FormNodeEditTypes.HIDDEN,
value: null,
required: true,
},
{
name: 'additionalCommentsForAbandon',
type: FormNodeTypes.CONTROL,
viewType: FormNodeViewTypes.HIDDEN,
editType: FormNodeEditTypes.HIDDEN,
value: null,
required: true,
},
{
name: 'certificateNumber',
label: 'Certificate number',
value: '',
type: FormNodeTypes.CONTROL,
viewType: FormNodeViewTypes.HIDDEN,
editType: FormNodeEditTypes.HIDDEN,
},
{
name: 'testExpiryDate',
label: 'Expiry Date',
disabled: true,
type: FormNodeTypes.CONTROL,
viewType: FormNodeViewTypes.HIDDEN,
editType: FormNodeEditTypes.HIDDEN,
},
{
name: 'testTypeStartTimestamp',
type: FormNodeTypes.CONTROL,
value: '',
label: 'Test start date and time',
viewType: FormNodeViewTypes.TIME,
editType: FormNodeEditTypes.DATETIME,
validators: [
{ name: ValidatorNames.Required },
{ name: ValidatorNames.PastDate },
{ name: ValidatorNames.CopyValueToRootControl, args: 'testStartTimestamp' },
],
},
{
name: 'testTypeEndTimestamp',
type: FormNodeTypes.CONTROL,
value: '',
label: 'Test end date and time',
viewType: FormNodeViewTypes.TIME,
editType: FormNodeEditTypes.DATETIME,
validators: [
{ name: ValidatorNames.Required },
{ name: ValidatorNames.PastDate },
{ name: ValidatorNames.AheadOfDate, args: 'testTypeStartTimestamp' },
{ name: ValidatorNames.CopyValueToRootControl, args: 'testEndTimestamp' },
],
},
{
name: 'prohibitionIssued',
label: 'Prohibition issued',
type: FormNodeTypes.CONTROL,
value: null,
editType: FormNodeEditTypes.HIDDEN,
required: true,
},
],
},
],
},
],
};
Loading

0 comments on commit e78d142

Please sign in to comment.