- updated call form, new fields;
- updated preview pages for bando; - fixed bug with decimal number field;
This commit is contained in:
@@ -28,6 +28,7 @@ import {
|
||||
isPIVA,
|
||||
isUrl
|
||||
} from '../../helpers/validators';
|
||||
import renderHtmlContent from '../../helpers/renderHtmlContent';
|
||||
|
||||
const BandoFormsPreview = () => {
|
||||
const { id, formId } = useParams();
|
||||
@@ -55,7 +56,8 @@ const BandoFormsPreview = () => {
|
||||
isMarcaDaBollo
|
||||
}
|
||||
|
||||
const onSubmit = () => {}
|
||||
const onSubmit = () => {
|
||||
}
|
||||
|
||||
const closePreview = () => {
|
||||
const parsedId = parseInt(id)
|
||||
@@ -116,6 +118,7 @@ const BandoFormsPreview = () => {
|
||||
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
|
||||
{formData.map(o => {
|
||||
const label = head(o.settings.filter(o => o.name === 'label'));
|
||||
const text = head(o.settings.filter(o => o.name === 'text'));
|
||||
const placeholder = head(o.settings.filter(o => o.name === 'placeholder'));
|
||||
const options = head(o.settings.filter(o => o.name === 'options'));
|
||||
const step = head(o.settings.filter(o => o.name === 'step'));
|
||||
@@ -145,23 +148,25 @@ const BandoFormsPreview = () => {
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
return <FormField
|
||||
key={o.id}
|
||||
type={o.name}
|
||||
fieldName={o.id}
|
||||
label={label ? label.value : ''}
|
||||
placeholder={placeholder ? placeholder.value : ''}
|
||||
control={control}
|
||||
register={register}
|
||||
errors={errors}
|
||||
defaultValue={values[o.id]}
|
||||
maxFractionDigits={step}
|
||||
accept={mimeValue}
|
||||
config={validations}
|
||||
options={options ? options.value : []}
|
||||
setDataFn={setValue}
|
||||
sourceId={0}
|
||||
/>
|
||||
return ['paragraph'].includes(o.name) && text
|
||||
? <div className="appForm__content">{renderHtmlContent(text.value)}</div>
|
||||
: <FormField
|
||||
key={o.id}
|
||||
type={o.name}
|
||||
fieldName={o.id}
|
||||
label={label ? label.value : ''}
|
||||
placeholder={placeholder ? placeholder.value : ''}
|
||||
control={control}
|
||||
register={register}
|
||||
errors={errors}
|
||||
defaultValue={values[o.id]}
|
||||
maxFractionDigits={step ? step.value : 0}
|
||||
accept={mimeValue}
|
||||
config={validations}
|
||||
options={options ? options.value : []}
|
||||
setDataFn={setValue}
|
||||
sourceId={0}
|
||||
/>
|
||||
})}
|
||||
</form>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user