From ee47a48f99c66443f036b9e6cc96db6c6e0340d4 Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Thu, 14 Nov 2024 11:45:06 +0100 Subject: [PATCH 1/3] - saving progress; --- src/pages/BandiBeneficiario/index.js | 2 - .../components/BandoEditFormStep1/index.js | 39 +++++++++++-------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/pages/BandiBeneficiario/index.js b/src/pages/BandiBeneficiario/index.js index 66942d3..8165092 100644 --- a/src/pages/BandiBeneficiario/index.js +++ b/src/pages/BandiBeneficiario/index.js @@ -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( diff --git a/src/pages/BandoEdit/components/BandoEditFormStep1/index.js b/src/pages/BandoEdit/components/BandoEditFormStep1/index.js index 4117123..8f92b67 100644 --- a/src/pages/BandoEdit/components/BandoEditFormStep1/index.js +++ b/src/pages/BandoEdit/components/BandoEditFormStep1/index.js @@ -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 Date: Thu, 14 Nov 2024 14:27:19 +0100 Subject: [PATCH 2/3] 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; --- src/assets/scss/components/appForm.scss | 1 + src/assets/scss/components/misc.scss | 4 ++++ src/components/FormFieldRepeater/index.js | 1 + .../FormFieldRepeaterCriteria/index.js | 1 + src/components/FormFieldRepeaterFaq/index.js | 1 + .../components/BandoEditFormActions/index.js | 6 +++-- .../components/BandoEditFormStep1/index.js | 3 ++- .../components/BandoEditFormStep2/index.js | 17 +++++++++----- .../components/BuilderElement/index.js | 22 ++----------------- .../components/ElementSetting/index.js | 4 +++- .../ElementSettingRepeater/index.js | 7 +++--- .../ElementSettingTableColumns/index.js | 18 ++++++++++----- .../BuilderElementSettings/index.js | 3 ++- .../components/FormBuilder/index.js | 7 +++--- src/pages/BandoFormsEdit/index.js | 8 +++---- 15 files changed, 55 insertions(+), 48 deletions(-) diff --git a/src/assets/scss/components/appForm.scss b/src/assets/scss/components/appForm.scss index c114ba9..bb532bd 100644 --- a/src/assets/scss/components/appForm.scss +++ b/src/assets/scss/components/appForm.scss @@ -147,6 +147,7 @@ .appForm__fileUploadItemName { color: var(--global-textColor); font-style: italic; + text-align: left; } .appForm__row { diff --git a/src/assets/scss/components/misc.scss b/src/assets/scss/components/misc.scss index c276636..0b795e1 100644 --- a/src/assets/scss/components/misc.scss +++ b/src/assets/scss/components/misc.scss @@ -118,6 +118,10 @@ user-select: none; } +.p-dropdown-panel { + max-width: 100%; +} + .p-inputgroup.flex-1 { align-items: center; } diff --git a/src/components/FormFieldRepeater/index.js b/src/components/FormFieldRepeater/index.js index 9d69312..fe00a72 100644 --- a/src/components/FormFieldRepeater/index.js +++ b/src/components/FormFieldRepeater/index.js @@ -73,6 +73,7 @@ const FormFieldRepeater = ({ const properField = (item, i) => { return !isNil(item.lookUpDataId) ? selectItem(e, i)} optionDisabled={(opt) => usedExistingValues().includes(opt.value)} diff --git a/src/components/FormFieldRepeaterCriteria/index.js b/src/components/FormFieldRepeaterCriteria/index.js index 7882cf8..9f96447 100644 --- a/src/components/FormFieldRepeaterCriteria/index.js +++ b/src/components/FormFieldRepeaterCriteria/index.js @@ -79,6 +79,7 @@ const FormFieldRepeaterCriteria = ({ const properField = (item, i) => { return !isNil(item.lookUpDataId) ? selectItem(e, i)} optionDisabled={(opt) => usedExistingValues().includes(opt.value)} diff --git a/src/components/FormFieldRepeaterFaq/index.js b/src/components/FormFieldRepeaterFaq/index.js index 2420943..5ba60a3 100644 --- a/src/components/FormFieldRepeaterFaq/index.js +++ b/src/components/FormFieldRepeaterFaq/index.js @@ -182,6 +182,7 @@ const FormFieldRepeaterFaq = ({ disabled={disabled} icon="pi pi-plus" onClick={addNewItem}/> selectItem(e)} + filter disabled={disabled} optionDisabled={(opt) => usedExistingValues().includes(opt.title)} options={stateOptionsData} diff --git a/src/pages/BandoEdit/components/BandoEditFormActions/index.js b/src/pages/BandoEdit/components/BandoEditFormActions/index.js index 3b65462..b431c89 100644 --- a/src/pages/BandoEdit/components/BandoEditFormActions/index.js +++ b/src/pages/BandoEdit/components/BandoEditFormActions/index.js @@ -5,14 +5,16 @@ import { isNil } from 'ramda'; // components import { Button } from 'primereact/button'; -const BandoEditFormActions = ({ id, openPreview, openPreviewEvaluation, submitFn }) => { +const BandoEditFormActions = ({ id, openPreview, openPreviewEvaluation, submitFn, status }) => { return (
) - - /*return ( -
- {draggingId === id - ?
- : <> -
- - -
-
-
- - } -
- )*/ } export default BuilderElement; \ No newline at end of file diff --git a/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js b/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js index 6264b89..6e2dcfc 100644 --- a/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js +++ b/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js @@ -11,7 +11,7 @@ import { Editor } from 'primereact/editor'; import { mimeTypes } from '../../../../../../configData'; import ElementSettingTableColumns from '../ElementSettingTableColumns'; -const ElementSetting = ({ setting, changeFn, updateDataFn }) => { +const ElementSetting = ({ setting, changeFn, updateDataFn, bandoStatus }) => { const settingLabels = { label: __('Label', 'gepafin'), @@ -48,6 +48,7 @@ const ElementSetting = ({ setting, changeFn, updateDataFn }) => { return } else if (setting.name === 'mime') { return { return } else { return { const [stateFieldData, setStateFieldData] = useState([]); @@ -53,10 +54,10 @@ const ElementSettingRepeater = ({ {stateFieldData.map((o, i) =>
{properField(o, i)} -
)} - : null} - {data.confidi + {!isEmpty(chosenCompanyId) && chosenCompanyId !== 0 && data.confidi ? : null} diff --git a/src/pages/BandoViewBeneficiario/index.js b/src/pages/BandoViewBeneficiario/index.js index c452129..3496c13 100644 --- a/src/pages/BandoViewBeneficiario/index.js +++ b/src/pages/BandoViewBeneficiario/index.js @@ -247,13 +247,15 @@ const BandoViewBeneficiario = () => { const header = renderHeader(); useEffect(() => { - const bandoId = getBandoId(); - storeSet.main.setAsyncRequest(); - BandoService.getBando(bandoId, getBandoCallback, errGetBandoCallback); - ApplicationService.getApplications(getApplCallback, errGetApplCallback, [ - ['callId', bandoId], - ['companyId', chosenCompanyId] - ]) + if (!isEmpty(chosenCompanyId) && chosenCompanyId !== 0) { + const bandoId = getBandoId(); + storeSet.main.setAsyncRequest(); + BandoService.getBando(bandoId, getBandoCallback, errGetBandoCallback); + ApplicationService.getApplications(getApplCallback, errGetApplCallback, [ + ['callId', bandoId], + ['companyId', chosenCompanyId] + ]); + } }, [id, chosenCompanyId]); return ( diff --git a/src/pages/DashboardBeneficiario/components/LatestBandiTable/index.js b/src/pages/DashboardBeneficiario/components/LatestBandiTable/index.js index 5e381d9..a5dd246 100644 --- a/src/pages/DashboardBeneficiario/components/LatestBandiTable/index.js +++ b/src/pages/DashboardBeneficiario/components/LatestBandiTable/index.js @@ -1,10 +1,10 @@ import React, { useState, useEffect } from 'react'; import { __ } from '@wordpress/i18n'; -import { uniq } from 'ramda'; +import { isEmpty, uniq } from 'ramda'; import { Link } from 'react-router-dom'; // store -import { storeSet } from '../../../../store'; +import { storeSet, useStore } from '../../../../store'; // api import BandoService from '../../../../service/bando-service'; @@ -22,6 +22,7 @@ import ProperBandoLabel from '../../../../components/ProperBandoLabel'; const LatestBandiTable = () => { + const chosenCompanyId = useStore().main.chosenCompanyId(); const [items, setItems] = useState(null); const [filters, setFilters] = useState(null); const [loading, setLoading] = useState(false); @@ -145,8 +146,9 @@ const LatestBandiTable = () => { body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/> - + {!isEmpty(chosenCompanyId) && chosenCompanyId !== 0 + ? : null} ) diff --git a/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js b/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js index 608b2ba..ce3f987 100644 --- a/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js +++ b/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import { __ } from '@wordpress/i18n'; -import { uniq, is } from 'ramda'; +import { uniq, is, isEmpty } from 'ramda'; // tools import getBandoLabel from '../../../../helpers/getBandoLabel'; @@ -36,11 +36,13 @@ const MyLatestSubmissionsTable = () => { const [statuses, setStatuses] = useState([]); useEffect(() => { - setLocalAsyncRequest(true); - ApplicationService.getApplications(getApplCallback, errGetApplCallback, [ - ['companyId', chosenCompanyId], - ['statuses', ['DRAFT', 'AWAITING', 'READY']] - ]) + if (!isEmpty(chosenCompanyId) && chosenCompanyId !== 0) { + setLocalAsyncRequest(true); + ApplicationService.getApplications(getApplCallback, errGetApplCallback, [ + ['companyId', chosenCompanyId], + ['statuses', ['DRAFT', 'AWAITING', 'READY']] + ]); + } }, [chosenCompanyId]); const getApplCallback = (data) => { diff --git a/src/pages/DomandeBeneficiario/components/BeneficiarioDomandeTable/index.js b/src/pages/DomandeBeneficiario/components/BeneficiarioDomandeTable/index.js index d97fd2e..22ac157 100644 --- a/src/pages/DomandeBeneficiario/components/BeneficiarioDomandeTable/index.js +++ b/src/pages/DomandeBeneficiario/components/BeneficiarioDomandeTable/index.js @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import { __ } from '@wordpress/i18n'; -import { is, uniq } from 'ramda'; +import { is, isEmpty, uniq } from 'ramda'; import { Link } from 'react-router-dom'; // store @@ -36,11 +36,13 @@ const BeneficiarioDomandeTable = () => { const [statuses, setStatuses] = useState([]); useEffect(() => { - setLocalAsyncRequest(true); - ApplicationService.getApplications(getApplCallback, errGetApplCallback, [ - ['companyId', chosenCompanyId], - ['statuses', ['SOCCORSO', 'APPROVED', 'REJECTED', 'EVALUATION']] - ]) + if (!isEmpty(chosenCompanyId) && chosenCompanyId !== 0) { + setLocalAsyncRequest(true); + ApplicationService.getApplications(getApplCallback, errGetApplCallback, [ + ['companyId', chosenCompanyId], + ['statuses', ['SOCCORSO', 'APPROVED', 'REJECTED', 'EVALUATION']] + ]); + } }, [chosenCompanyId]); const getApplCallback = (data) => {