removed logging and redundant imports

This commit is contained in:
2022-06-23 13:40:30 +01:00
parent d55aedfa65
commit 047fcb8142
4 changed files with 90 additions and 84 deletions
+81 -24
View File
@@ -599,7 +599,6 @@ const RenderYesNo = ({
: delete docListObj[
"documentCheckList_" + id
];
console.log(docListObj);
custom.setDocumentsList(docListObj);
}
}}
@@ -623,27 +622,70 @@ export function YesNofield(props) {
const router = useRouter();
let { t } = useTranslation();
const { name, label, inline, validation } = props;
const {
name,
label,
inline,
form,
formProps,
validation,
parentFieldShowOnValue,
parentField,
} = props;
const yesNo = router.locale == "cy" ? ["Ydw", "Na"] : ["Yes", "No"];
const required = (value) => (value ? undefined : "Required");
var showIfHasParentShowValue =
parentField != false &&
!_.isEmpty(formProps[form]) &&
_.has(formProps[form].values, parentField) &&
parentFieldShowOnValue.indexOf(
formProps[form].values[parentField].toString()
) > -1;
(showIfHasParentShowValue == parentField) != false &&
showIfHasParentShowValue;
return (
<Field
name={props.name}
datafieldname={props.name}
label={props.label}
options={yesNo}
id={props.name}
className={"govuk-radios__input"}
validate={eval(validation)}
errorMsg={t("newappeal:select-an-option-label")}
component={RenderYesNo}
inline={_.has(props, "inline") ? props.inline : "true"}
requiredDocumentLabel={props.requiredDocumentLabel}
requiredDocumentValue={props.requiredDocumentValue}
setDocumentsList={props.setDocumentsList}
documentList={props.documentList}
/>
<>
{parentField != false ? (
showIfHasParentShowValue && (
<Field
name={props.name}
datafieldname={props.name}
label={props.label}
options={yesNo}
id={props.name}
className={"govuk-radios__input"}
validate={eval(validation)}
errorMsg={t("newappeal:select-an-option-label")}
component={RenderYesNo}
inline={_.has(props, "inline") ? props.inline : "true"}
requiredDocumentLabel={props.requiredDocumentLabel}
requiredDocumentValue={props.requiredDocumentValue}
setDocumentsList={props.setDocumentsList}
documentList={props.documentList}
/>
)
) : (
<Field
name={props.name}
datafieldname={props.name}
label={props.label}
options={yesNo}
id={props.name}
className={"govuk-radios__input"}
validate={eval(validation)}
errorMsg={t("newappeal:select-an-option-label")}
component={RenderYesNo}
inline={_.has(props, "inline") ? props.inline : "true"}
requiredDocumentLabel={props.requiredDocumentLabel}
requiredDocumentValue={props.requiredDocumentValue}
setDocumentsList={props.setDocumentsList}
documentList={props.documentList}
/>
)}
</>
);
}
@@ -792,12 +834,6 @@ export function Radiofield(props) {
(showIfHasParentShowValue == parentField) != false &&
showIfHasParentShowValue;
// console.log(
// datafieldname,
// showIfHasParentShowValue,
// formProps[form].values[parentField]
// );
return (
<>
{parentField != false ? (
@@ -1209,6 +1245,7 @@ export function FileUploadField(props) {
errorMsg="Is required"
ticketnumber={props.ticketnumber}
documentTypeCode={props.documentTypeCode}
hint={props.hint}
/>
</>
);
@@ -1340,6 +1377,7 @@ const rejectStyle = {
const RenderFileUpload = (field) => {
const files = field.input.value;
let { t } = useTranslation();
const style = useMemo(
() => ({
...baseStyle,
@@ -1435,6 +1473,22 @@ const RenderFileUpload = (field) => {
case "000010":
return "000010";
break;
case "000011":
return "000011";
break;
case "000012":
return "000012";
break;
case "000013":
return "000013";
break;
case "000014":
return "000014";
break;
case "000015":
return "000015";
break;
default:
return "000000";
}
@@ -1465,6 +1519,9 @@ const RenderFileUpload = (field) => {
>
{({ getRootProps, getInputProps }) => (
<>
{field.hint != false && (
<div className="govuk-hint">{t(field.hint)}</div>
)}
<div className="govuk-form-group"></div>
<section className="container">
<div {...getRootProps({ style })}>