From cb9995da75be972e5559f1efcc9e43a02cdd2eeb Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Tue, 14 Jun 2022 17:08:11 +0100 Subject: [PATCH] added hcas diagnostic choice --- components/elements/index.js | 2 +- components/newappeal/aboutyou.js | 21 +-- components/newappeal/createCase.js | 205 +++++++++++++++++++++++------ pages/newappeal/index.js | 1 + 4 files changed, 176 insertions(+), 53 deletions(-) diff --git a/components/elements/index.js b/components/elements/index.js index 42ef4ed4..a855f258 100644 --- a/components/elements/index.js +++ b/components/elements/index.js @@ -108,7 +108,7 @@ export function Textfield(props) { // console.log(parentField, showIfHasParentShowValue); // console.log(parentField, formProps, form); - //console.log("validation props:", validation); + console.log("validation props:", validation); return (
diff --git a/components/newappeal/aboutyou.js b/components/newappeal/aboutyou.js index 83d38979..b8724267 100644 --- a/components/newappeal/aboutyou.js +++ b/components/newappeal/aboutyou.js @@ -239,6 +239,8 @@ let AboutYou = (props) => { ...custom }) => { let { t } = useTranslation(); + const required = (value) => (value ? undefined : "Required"); + return ( <>
{ type="radio" className="govuk-radios__input" value={options[key].split("|")[0]} + validate={[required]} // checked={ // value == // parseInt(options[key].split("|")[0]) @@ -393,12 +396,12 @@ let AboutYou = (props) => { label={label} options={fieldOptions} id={name} - //validate={[required]} + validate={[required]} errorMsg="Select an option" component={RenderRadio} inline={props.inline} hint={props.hint} - validate={eval(validation)} + //validate={eval(validation)} requiredDocumentLabel={props.requiredDocumentLabel} requiredDocumentValue={props.requiredDocumentValue} setDocumentsList={props.setDocumentsList} @@ -412,12 +415,12 @@ let AboutYou = (props) => { label={label} options={fieldOptions} id={name} - //validate={[required]} + validate={[required]} errorMsg="Select an option" component={RenderRadio} inline={props.inline} hint={props.hint} - validate={eval(validation)} + //validate={eval(validation)} requiredDocumentLabel={props.requiredDocumentLabel} requiredDocumentValue={props.requiredDocumentValue} setDocumentsList={props.setDocumentsList} @@ -504,7 +507,7 @@ let AboutYou = (props) => { options="[846040000|newappeal:about-you-who-are-you-label-appellant,846040001|newappeal:about-you-who-are-you-label-agent]" id={"pinswg_appellantagent"} className="govuk-radios__input" - //validate={[required]} + validate={"[required]"} errorMsg="Select an option" /> @@ -579,7 +582,7 @@ let AboutYou = (props) => { options="[846040000|newappeal:about-you-agent-contact-preferences-value-email,846040001|newappeal:about-you-agent-contact-preferences-value-post]" id={"pinswg_contactprefs"} className="govuk-radios__input" - validate={[required]} + validate={"[required]"} errorMsg="Select an option" /> { options="[846040000|newappeal:about-you-agent-language-preferences-value-english,846040001|newappeal:about-you-agent-language-preferences-value-welsh]" id={"pinswg_languagepreference"} className="govuk-radios__input" - validate={[required]} - errorMsg="Select an option" + validate={"[required]"} + errorMsg="Select an optionqqq" /> )} @@ -749,7 +752,7 @@ let AboutYou = (props) => { id={"pinswg_languagepreference"} className="govuk-radios__input" validate={[required]} - errorMsg="Select an option" + errorMsg="Select an optionwww" /> )} diff --git a/components/newappeal/createCase.js b/components/newappeal/createCase.js index df6757af..95f9ae1a 100644 --- a/components/newappeal/createCase.js +++ b/components/newappeal/createCase.js @@ -156,7 +156,7 @@ let CreateCase = (props) => { className="govuk-select" id="appealTypes" name={name} - onChange={(e) => props.onChangeSelectAppealType(e)} + //onChange={(e) => props.onChangeSelectAppealType(e)} >