import React from "react"; import useTranslation from "next-translate/useTranslation"; import { useRouter } from "next/router"; import { Field } from "redux-form"; import fieldLookup from "../../../data/crmfieldlookuptranslations.json"; import { getFieldTranslation } from "../helpers/translationHelpers"; export const RenderRadio = ({ datafieldname, name, label, id, errorMsg, options, input: { onChange, value }, meta: { touched, error }, ...custom }) => { let { t } = useTranslation(); const router = useRouter(); const { locale } = router; const { appealtypes } = router.query; const translatedLabel = getFieldTranslation({ label, locale, appealtypes, fieldLookup }); return ( <>
{touched && error && ( Error: {" "} {errorMsg} )}
{" "} {custom.hint != false && (
{t(custom.hint)}
)} {Object.keys(options).map((key, index) => (
{ let docListObj = custom.documentList; if ( custom.requiredDocumentValue == "Yes" ) { e.target.value != "846040000" ? (docListObj = Object.assign( docListObj, { ["documentCheckList_" + id]: custom.requiredDocumentLabel } )) : delete docListObj[ "documentCheckList_" + id ]; custom.setDocumentsList(docListObj); } }} />
))}
); };