- saving progress;
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
import React from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
// components
|
||||
import AllBandiAccordion from './components/AllBandiAccordion';
|
||||
import { Button } from 'primereact/button';
|
||||
|
||||
const BandiBeneficiario = () => {
|
||||
return(
|
||||
|
||||
@@ -176,8 +176,12 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const shouldDisableField = () => {
|
||||
return values.status === 'PUBLISH'
|
||||
const shouldDisableField = (fieldName) => {
|
||||
return values.status === 'PUBLISH' &&
|
||||
![
|
||||
'descriptionShort', 'descriptionLong', 'documentationRequested', 'threshold',
|
||||
'aimedTo', 'criteria', 'docs', 'checklist', 'faq'
|
||||
].includes(fieldName)
|
||||
}
|
||||
|
||||
useImperativeHandle(
|
||||
@@ -239,7 +243,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
<UnsavedChangesDetector getValuesFn={getValues}/>
|
||||
<FormField
|
||||
type="switch"
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('confidi')}
|
||||
fieldName="confidi"
|
||||
label={__('Bando Confidi', 'gepafin')}
|
||||
control={control}
|
||||
@@ -251,7 +255,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
|
||||
<FormField
|
||||
type="textinput"
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('name')}
|
||||
fieldName="name"
|
||||
label={__('Titolo del Bando', 'gepafin')}
|
||||
control={control}
|
||||
@@ -262,7 +266,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
|
||||
<FormField
|
||||
type="wysiwyg"
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('descriptionShort')}
|
||||
fieldName="descriptionShort"
|
||||
label={__('Descrizione breve', 'gepafin')}
|
||||
control={control}
|
||||
@@ -275,7 +279,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
|
||||
<FormField
|
||||
type="wysiwyg"
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('descriptionLong')}
|
||||
fieldName="descriptionLong"
|
||||
label={__('Descrizione completa', 'gepafin')}
|
||||
control={control}
|
||||
@@ -291,7 +295,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
|
||||
<FormFieldRepeater
|
||||
data={values['aimedTo']}
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('aimedTo')}
|
||||
setDataFn={setValue}
|
||||
fieldName="aimedTo"
|
||||
options={aimedToOptions}
|
||||
@@ -310,7 +314,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
|
||||
<FormField
|
||||
type="wysiwyg"
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('documentationRequested')}
|
||||
fieldName="documentationRequested"
|
||||
label={__('Documentazione richiesta', 'gepafin')}
|
||||
control={control}
|
||||
@@ -334,7 +338,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
<div className="appForm__cols">
|
||||
<FormField
|
||||
type="datepicker"
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('startDate')}
|
||||
fieldName="startDate"
|
||||
label={__('Data di inizio', 'gepafin')}
|
||||
control={control}
|
||||
@@ -345,7 +349,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
|
||||
<FormField
|
||||
type="datepicker"
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('endDate')}
|
||||
fieldName="endDate"
|
||||
label={__('Data di fine', 'gepafin')}
|
||||
control={control}
|
||||
@@ -358,7 +362,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
<div className="appForm__cols">
|
||||
<FormField
|
||||
type="datepicker"
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('startTime')}
|
||||
fieldName="startTime"
|
||||
label={__('Ora di inizio', 'gepafin')}
|
||||
control={control}
|
||||
@@ -370,7 +374,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
|
||||
<FormField
|
||||
type="datepicker"
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('endTime')}
|
||||
fieldName="endTime"
|
||||
label={__('Ora di fine', 'gepafin')}
|
||||
control={control}
|
||||
@@ -384,7 +388,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
<div className="appForm__cols">
|
||||
<FormField
|
||||
type="numberinput"
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('amount')}
|
||||
fieldName="amount"
|
||||
label={__('Dotazione del Bando', 'gepafin')}
|
||||
control={control}
|
||||
@@ -397,7 +401,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
|
||||
<FormField
|
||||
type="numberinput"
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('amountMin')}
|
||||
fieldName="amountMin"
|
||||
label={__('Importo minimo per Progetto', 'gepafin')}
|
||||
control={control}
|
||||
@@ -410,7 +414,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
|
||||
<FormField
|
||||
type="numberinput"
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('amountMax')}
|
||||
fieldName="amountMax"
|
||||
label={__('Importo massimo per Progetto', 'gepafin')}
|
||||
control={control}
|
||||
@@ -425,7 +429,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
<div className="appForm__cols">
|
||||
<FormField
|
||||
type="textinput"
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('email')}
|
||||
fieldName="email"
|
||||
label={__('Email', 'gepafin')}
|
||||
control={control}
|
||||
@@ -441,7 +445,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
|
||||
<FormField
|
||||
type="textinput"
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('phoneNumber')}
|
||||
fieldName="phoneNumber"
|
||||
label={__('Telefono', 'gepafin')}
|
||||
control={control}
|
||||
@@ -457,6 +461,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
|
||||
<FormFieldRepeaterFaq
|
||||
data={values['faq']}
|
||||
disabled={shouldDisableField('faq')}
|
||||
setDataFn={setValue}
|
||||
fieldName="faq"
|
||||
options={faqOptions}
|
||||
|
||||
Reference in New Issue
Block a user