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