diff --git a/components/elements/index.js b/components/elements/index.js index ae011265..8ddc18ab 100644 --- a/components/elements/index.js +++ b/components/elements/index.js @@ -621,6 +621,7 @@ const RenderYesNo = ({ export function YesNofield(props) { const router = useRouter(); + let { t } = useTranslation(); const { name, label, inline, validation } = props; const yesNo = router.locale == "cy" ? ["Ydw", "Na"] : ["Yes", "No"]; @@ -773,6 +774,7 @@ export function Radiofield(props) { const router = useRouter(); const required = (value) => (value ? undefined : "Required"); // console.log(props.options); + let { t } = useTranslation(); const fieldOptions = props.options .slice(1, props.options.length - 1) @@ -996,51 +998,142 @@ export function PickList(props) { } export function NumericField(props) { - const { name, label, validation } = props; + const { + name, + label, + validation, + form, + formProps, + parentFieldShowOnValue, + parentField, + } = props; const required = (value) => (value ? undefined : "Required"); + //parentFieldShowOnValue + var showIfHasParentShowValue = + parentField != false && + !_.isEmpty(formProps[form]) && + _.has(formProps[form].values, parentField) && + parentFieldShowOnValue.indexOf( + formProps[form].values[parentField].toString() + ) > -1; + + (showIfHasParentShowValue == parentField) != false && + showIfHasParentShowValue; + + console.log("parentField:", parentField, showIfHasParentShowValue); + return ( -
- -
+ <> + {parentField != false ? ( + showIfHasParentShowValue && ( +
+ +
+ ) + ) : ( +
+ +
+ )} + ); } export function DecimalField(props) { - const { name, label, validation } = props; + const { + name, + label, + validation, + form, + formProps, + parentFieldShowOnValue, + parentField, + } = props; const required = (value) => (value ? undefined : "Required"); + //parentFieldShowOnValue + var showIfHasParentShowValue = + parentField != false && + !_.isEmpty(formProps[form]) && + _.has(formProps[form].values, parentField) && + parentFieldShowOnValue.indexOf( + formProps[form].values[parentField].toString() + ) > -1; + + (showIfHasParentShowValue == parentField) != false && + showIfHasParentShowValue; + + console.log("parentField:", parentField, showIfHasParentShowValue); + return ( -
- -
+ <> + {parentField != false ? ( + showIfHasParentShowValue && ( +
+ +
+ ) + ) : ( +
+ +
+ )} + ); } diff --git a/components/newappeal/buildfield.js b/components/newappeal/buildfield.js index 0f4e9a50..6244b143 100644 --- a/components/newappeal/buildfield.js +++ b/components/newappeal/buildfield.js @@ -149,7 +149,11 @@ export default function BuildField(props) { ); break; @@ -158,7 +162,11 @@ export default function BuildField(props) { ); break; diff --git a/components/newappeal/createCase.js b/components/newappeal/createCase.js index 16382da1..b9aa1837 100644 --- a/components/newappeal/createCase.js +++ b/components/newappeal/createCase.js @@ -448,6 +448,8 @@ let CreateCase = (props) => { delete values.confirmHASCAS; + console.log(appTypeCollection); + createNewCase( appTypeCollection.appealTypeID, values.lpaTypes, diff --git a/data/formsxml/householderappealhas.xml b/data/formsxml/householderappealhas.xml index d4bf0870..d9091e7d 100644 --- a/data/formsxml/householderappealhas.xml +++ b/data/formsxml/householderappealhas.xml @@ -21,30 +21,11 @@ - + - - - - - - - - - - - - - - - - - - - + @@ -312,6 +293,14 @@