|
|
|
@ -46,15 +46,21 @@ const CustomFieldsAssembler = ({ formValues, formHandlers, customFields, ...prop |
|
|
|
|
state: formValues[key], |
|
|
|
|
...value, |
|
|
|
|
}; |
|
|
|
|
return value.type === 'text' |
|
|
|
|
? <CustomTextInput {...extraProps} {...props}/> |
|
|
|
|
: <CustomSelect {...extraProps} {...props}/>; |
|
|
|
|
|
|
|
|
|
if (value.type === 'select') { |
|
|
|
|
return <CustomSelect {...extraProps} {...props}/>; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (value.type === 'text') { |
|
|
|
|
return <CustomTextInput {...extraProps} {...props}/>; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
export default function CustomFieldsForm({ customFieldsData, setCustomFieldsData, onLoadFields = () => {}, ...props }) { |
|
|
|
|
const customFieldsJson = useSetting('Accounts_CustomFields'); |
|
|
|
|
|
|
|
|
|
// TODO: add deps. Left this way so that a possible change in the setting can't crash the page (useForm generates states automatically)
|
|
|
|
|
const [customFields] = useState(() => { |
|
|
|
|
try { |
|
|
|
|
return JSON.parse(customFieldsJson || '{}'); |
|
|
|
|