- updated call form, new fields;

- updated preview pages for bando;
- fixed bug with decimal number field;
This commit is contained in:
Vitalii Kiiko
2024-10-01 12:55:17 +02:00
parent 111b1b5620
commit 676d7621e7
17 changed files with 282 additions and 56 deletions

View File

@@ -1,9 +1,10 @@
import React, { useState, useEffect, useCallback, useRef } from 'react';
import React, { useState, useEffect, useRef } from 'react';
import { __, sprintf } from '@wordpress/i18n';
import { useParams } from 'react-router-dom';
import { klona } from 'klona';
import { head, range, is, pluck } from 'ramda';
import { useForm } from 'react-hook-form';
import { TZDate } from '@date-fns/tz';
// store
import { storeSet, useStore } from '../../store';
@@ -22,15 +23,15 @@ import {
isUrl,
isMarcaDaBollo
} from '../../helpers/validators';
import renderHtmlContent from '../../helpers/renderHtmlContent';
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
// components
import { Skeleton } from 'primereact/skeleton';
import { Button } from 'primereact/button';
import FormField from '../../components/FormField';
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
import { Steps } from 'primereact/steps';
import { Toast } from 'primereact/toast';
import { TZDate } from '@date-fns/tz';
import { Messages } from 'primereact/messages';
const BandoApplication = () => {
@@ -300,6 +301,7 @@ const BandoApplication = () => {
<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'));
@@ -329,7 +331,9 @@ const BandoApplication = () => {
return acc;
}, {});
return <FormField
return ['paragraph'].includes(o.name) && text
? <div className="appForm__content">{renderHtmlContent(text.value)}</div>
: <FormField
key={o.id}
type={o.name}
fieldName={o.id}