department-of-veterans-affairs/vets-website

View on GitHub
src/applications/ezr/config/chapters/householdInformation/dependentAdditionalInformation.js

Summary

Maintainability
A
3 hrs
Test Coverage
import {
  yesNoUI,
  yesNoSchema,
} from 'platform/forms-system/src/js/web-component-patterns';
import { replaceStrValues } from '../../../utils/helpers/general';
import { LAST_YEAR } from '../../../utils/constants';
import content from '../../../locales/en/content.json';

export default {
  uiSchema: {
    disabledBefore18: yesNoUI(content['household-dependent-disabled-label']),
    cohabitedLastYear: yesNoUI(
      replaceStrValues(
        content['household-dependent-cohabitated-label'],
        LAST_YEAR,
      ),
    ),
    'view:dependentIncome': yesNoUI(
      replaceStrValues(
        content['household-dependent-earned-income-label'],
        LAST_YEAR,
      ),
    ),
  },
  schema: {
    type: 'object',
    required: ['disabledBefore18', 'cohabitedLastYear', 'view:dependentIncome'],
    properties: {
      disabledBefore18: yesNoSchema,
      cohabitedLastYear: yesNoSchema,
      'view:dependentIncome': yesNoSchema,
    },
  },
};