- updated call form - added new fields;
This commit is contained in:
@@ -18,6 +18,9 @@ import { Toast } from 'primereact/toast';
|
||||
import BandoService from '../../../../service/bando-service';
|
||||
import LookupdataService from '../../../../service/lookupdata-service';
|
||||
|
||||
// tools
|
||||
import { isEmail } from '../../../../helpers/validators';
|
||||
|
||||
// store
|
||||
import { storeSet } from '../../../../store';
|
||||
|
||||
@@ -44,7 +47,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
const toast = useRef(null);
|
||||
|
||||
const onSubmit = (formData) => {
|
||||
if (!isNil(formData.dates) && formData.dates.length) {
|
||||
/*if (!isNil(formData.dates) && formData.dates.length) {
|
||||
formData.dates = formData.dates.map(v => {
|
||||
if (is(String, v)) {
|
||||
return v;
|
||||
@@ -60,10 +63,11 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
BandoService.createBando(formData, createCallback, errCreateCallback);
|
||||
} else {
|
||||
BandoService.updateBandoStep1(formData.id, formData, createCallback, errCreateCallback);
|
||||
}
|
||||
}*/
|
||||
};
|
||||
|
||||
const onSaveDraft = () => {
|
||||
trigger();
|
||||
const formData = getValues();
|
||||
if (!isNil(formData.dates) && formData.dates.length) {
|
||||
formData.dates = formData.dates.map(v => {
|
||||
@@ -285,9 +289,34 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
errors={errors}
|
||||
defaultValue={values['dates']}
|
||||
config={{ required: __('È obbligatorio', 'gepafin') }}
|
||||
/*minDate={minDateStart}*/
|
||||
/>
|
||||
|
||||
<div className="appForm__cols">
|
||||
<FormField
|
||||
type="datepicker"
|
||||
disabled={shouldDisableField()}
|
||||
fieldName="startTime"
|
||||
label={__('Ora di inizio', 'gepafin')}
|
||||
control={control}
|
||||
errors={errors}
|
||||
defaultValue={values['startTime']}
|
||||
config={{ required: __('È obbligatorio', 'gepafin') }}
|
||||
timeOnly={true}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
type="datepicker"
|
||||
disabled={shouldDisableField()}
|
||||
fieldName="endTime"
|
||||
label={__('Ora di fine', 'gepafin')}
|
||||
control={control}
|
||||
errors={errors}
|
||||
defaultValue={values['endTime']}
|
||||
config={{ required: __('È obbligatorio', 'gepafin') }}
|
||||
timeOnly={true}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="appForm__cols">
|
||||
<FormField
|
||||
type="numberinput"
|
||||
@@ -302,6 +331,19 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
icon="€"
|
||||
/>
|
||||
|
||||
<FormField
|
||||
type="numberinput"
|
||||
disabled={shouldDisableField()}
|
||||
fieldName="amountMin"
|
||||
label={__('Importo minimo per Progetto', 'gepafin')}
|
||||
control={control}
|
||||
errors={errors}
|
||||
defaultValue={values['amountMin']}
|
||||
config={{ required: __('È obbligatorio', 'gepafin') }}
|
||||
inputgroup={true}
|
||||
icon="€"
|
||||
/>
|
||||
|
||||
<FormField
|
||||
type="numberinput"
|
||||
disabled={shouldDisableField()}
|
||||
@@ -316,6 +358,38 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="appForm__cols">
|
||||
<FormField
|
||||
type="textinput"
|
||||
disabled={shouldDisableField()}
|
||||
fieldName="email"
|
||||
label={__('Email', 'gepafin')}
|
||||
control={control}
|
||||
errors={errors}
|
||||
defaultValue={values['email']}
|
||||
config={{
|
||||
required: __('È obbligatorio', 'gepafin'),
|
||||
validate: {
|
||||
isEmail
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
type="textinput"
|
||||
disabled={shouldDisableField()}
|
||||
fieldName="phoneNumber"
|
||||
label={__('Telefono', 'gepafin')}
|
||||
control={control}
|
||||
errors={errors}
|
||||
defaultValue={values['phoneNumber']}
|
||||
config={{
|
||||
required: __('È obbligatorio', 'gepafin'),
|
||||
pattern: /^[0-9]/
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<FormFieldRepeaterFaq
|
||||
data={values['faq']}
|
||||
setDataFn={setValue}
|
||||
@@ -338,7 +412,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
<span>{__('Azioni', 'gepafin')}</span>
|
||||
</div>
|
||||
|
||||
<Toast ref={toast} />
|
||||
<Toast ref={toast}/>
|
||||
<BandoEditFormActions
|
||||
id={values.id}
|
||||
status={status}
|
||||
|
||||
Reference in New Issue
Block a user