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:
Vitalii Kiiko
2024-11-14 14:27:19 +01:00
parent 74647cc2fd
commit b08e2d46c0
15 changed files with 55 additions and 48 deletions

View File

@@ -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}