department-of-veterans-affairs/vets-website

View on GitHub
src/applications/simple-forms/20-10207/pages/idInfoThirdPartyNonVeteran.js

Summary

Maintainability
A
30 mins
Test Coverage
import {
  firstNameLastNameNoSuffixSchema,
  firstNameLastNameNoSuffixUI,
  radioSchema,
  radioUI,
  titleUI,
} from 'platform/forms-system/src/js/web-component-patterns';

import {
  THIRD_PARTY_TYPES,
  THIRD_PARTY_TYPE_NON_VETERAN_LABELS,
  ADDITIONAL_INFO_THIRD_PARTY_TYPE,
} from '../config/constants';

/** @type {PageSchema} */
export default {
  uiSchema: {
    ...titleUI('Your name'),
    thirdPartyFullName: firstNameLastNameNoSuffixUI(),
    thirdPartyType: radioUI({
      title: 'How are you representing the person with a claim?',
      labels: THIRD_PARTY_TYPE_NON_VETERAN_LABELS,
      errorMessages: {
        required: 'Select your identity',
      },
      labelHeaderLevel: '3',
    }),
  },
  'view:additionalInfoThirdPartyType': {
    'ui:description': ADDITIONAL_INFO_THIRD_PARTY_TYPE,
  },
  schema: {
    type: 'object',
    properties: {
      thirdPartyFullName: firstNameLastNameNoSuffixSchema,
      thirdPartyType: radioSchema(Object.values(THIRD_PARTY_TYPES)),
      'view:additionalInfoThirdPartyType': {
        type: 'object',
        properties: {},
      },
    },
    required: ['thirdPartyType'],
  },
};