Make some call fields editable after publishing the call
- call form fields are editable (according to the list of keys); - some parts of the form are editable;
This commit is contained in:
@@ -206,8 +206,13 @@ const BandoEditFormStep2 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
}
|
||||
}, []);
|
||||
|
||||
const shouldDisableField = () => {
|
||||
return values.status === 'PUBLISH'
|
||||
const shouldDisableField = (fieldName) => {
|
||||
return values.status === 'PUBLISH' &&
|
||||
![
|
||||
'descriptionShort', 'descriptionLong', 'documentationRequested', 'threshold',
|
||||
'aimedTo', 'criteria', 'docs', 'checklist', 'faq', 'amount', 'amountMin', 'amountMax',
|
||||
'email', 'phoneNumber', 'checkList', 'images'
|
||||
].includes(fieldName)
|
||||
}
|
||||
|
||||
const acceptAllFormats = () => {
|
||||
@@ -219,7 +224,7 @@ const BandoEditFormStep2 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
<UnsavedChangesDetector getValuesFn={getValues}/>
|
||||
<FormFieldRepeaterCriteria
|
||||
data={values}
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('criteria')}
|
||||
setDataFn={setValue}
|
||||
fieldName="criteria"
|
||||
options={criteriaOptions}
|
||||
@@ -238,7 +243,7 @@ const BandoEditFormStep2 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
|
||||
<FormField
|
||||
type="fileuploadasync"
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('docs')}
|
||||
setDataFn={setValue}
|
||||
fieldName="docs"
|
||||
label={__('Documentazione', 'gepafin')}
|
||||
@@ -257,7 +262,7 @@ const BandoEditFormStep2 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
|
||||
<FormField
|
||||
type="fileuploadasync"
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('images')}
|
||||
setDataFn={setValue}
|
||||
fieldName="images"
|
||||
label={__('Immagine del Bando', 'gepafin')}
|
||||
@@ -273,7 +278,7 @@ const BandoEditFormStep2 = forwardRef(function ({ initialData, getFormErrors, st
|
||||
|
||||
<FormFieldRepeater
|
||||
data={values['checkList']}
|
||||
disabled={shouldDisableField()}
|
||||
disabled={shouldDisableField('checkList')}
|
||||
setDataFn={setValue}
|
||||
fieldName="checkList"
|
||||
options={checklistOptions}
|
||||
|
||||
Reference in New Issue
Block a user