diff --git a/.env b/.env index ef5dcea..fc25010 100644 --- a/.env +++ b/.env @@ -5,4 +5,4 @@ REACT_APP_LOGO_FILENAME=gepafin-logo.svg REACT_APP_FAVICON_FILENAME=gepafin-favicon.ico REACT_APP_HUB_ID=p4lk3bcx1RStqTaIVVbXs REACT_APP_EVALUATION_FLOW_ID=1 -REACT_APP_LOCAL_DEVELOPMENT=1 \ No newline at end of file +REACT_APP_LOCAL_DEVELOPMENT=1 diff --git a/README.md b/README.md index 86475cf..6e5298b 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,7 @@ Gepafin Front End `npm run start` - start development server `npm run build:dev` - make build based on 'dev' env variables `npm run build:prod` - make build based on 'prod' env variables + +# HUB IDs +`p4lk3bcx1RStqTaIVVbXs` - gepafin +`t7jh5wfg9QXylNaTZkPoE` - sviluppumbria diff --git a/src/helpers/getBandoLabel.js b/src/helpers/getBandoLabel.js index 9c8af0f..1816a42 100644 --- a/src/helpers/getBandoLabel.js +++ b/src/helpers/getBandoLabel.js @@ -29,6 +29,9 @@ const getBandoLabel = (status) => { case 'ADMISSIBLE': return __('Ammisibile', 'gepafin'); + case 'RESPONSE_RECEIVED': + return __('Riposta ricevuta', 'gepafin'); + case 'SOCCORSO': return __('Soccorso', 'gepafin'); diff --git a/src/helpers/getBandoSeverity.js b/src/helpers/getBandoSeverity.js index 9b9d16c..d6c4dbf 100644 --- a/src/helpers/getBandoSeverity.js +++ b/src/helpers/getBandoSeverity.js @@ -27,6 +27,9 @@ const getBandoSeverity = (status) => { case 'ADMISSIBLE': return 'info'; + case 'RESPONSE_RECEIVED': + return 'warning'; + case 'SOCCORSO': return 'warning'; diff --git a/src/pages/Applications/index.js b/src/pages/Applications/index.js index 21aaf42..ed42683 100644 --- a/src/pages/Applications/index.js +++ b/src/pages/Applications/index.js @@ -4,7 +4,7 @@ import { useNavigate } from 'react-router-dom'; import { head } from 'ramda'; // store -import { storeGet, useStore } from '../../store'; +import { useStore } from '../../store'; // components import MyLatestSubmissionsTable from '../DashboardBeneficiario/components/MyLatestSubmissionsTable'; diff --git a/src/pages/BandoViewBeneficiario/index.js b/src/pages/BandoViewBeneficiario/index.js index bcb7bc0..f717c67 100644 --- a/src/pages/BandoViewBeneficiario/index.js +++ b/src/pages/BandoViewBeneficiario/index.js @@ -30,6 +30,8 @@ import { Editor } from 'primereact/editor'; import { Dialog } from 'primereact/dialog'; import PreferredBandoService from '../../service/preferred-bando-service'; +const REACT_APP_HUB_ID = process.env.REACT_APP_HUB_ID; + const BandoViewBeneficiario = () => { const isAsyncRequest = useStore().main.isAsyncRequest(); const chosenCompanyId = useStore().main.chosenCompanyId(); @@ -89,18 +91,26 @@ const BandoViewBeneficiario = () => { } const submitBtnLabel = () => { - if (applicationObj && applicationObj.id) { - return __('Vai alla domanda', 'gepafin'); - } else { + if (REACT_APP_HUB_ID === 't7jh5wfg9QXylNaTZkPoE') { return __('Presenta domanda', 'gepafin'); + } else { + if (applicationObj && applicationObj.id) { + return __('Vai alla domanda', 'gepafin'); + } else { + return __('Presenta domanda', 'gepafin'); + } } } const submitBtnIcon = () => { - if (applicationObj && applicationObj.id) { - return 'pi pi-arrow-right'; - } else { + if (REACT_APP_HUB_ID === 't7jh5wfg9QXylNaTZkPoE') { return 'pi pi-save'; + } else { + if (applicationObj && applicationObj.id) { + return 'pi pi-arrow-right'; + } else { + return 'pi pi-save'; + } } } @@ -108,11 +118,16 @@ const BandoViewBeneficiario = () => { if (data.confidi) { displayConfidiPopup(); } else { - if (applicationObj && applicationObj.id) { - navigate(`/imieibandi/${applicationObj.id}`); - } else { + if (REACT_APP_HUB_ID === 't7jh5wfg9QXylNaTZkPoE') { const bandoId = getBandoId(); ApplicationService.createApplication(bandoId, {}, createApplCallback, errCreateApplCallback, [['companyId', chosenCompanyId]]); + } else { + if (applicationObj && applicationObj.id) { + navigate(`/imieibandi/${applicationObj.id}`); + } else { + const bandoId = getBandoId(); + ApplicationService.createApplication(bandoId, {}, createApplCallback, errCreateApplCallback, [['companyId', chosenCompanyId]]); + } } } } @@ -195,6 +210,7 @@ const BandoViewBeneficiario = () => { if (data.status === 'SUCCESS') { setData(getFormattedBandiData(data.data)); } + storeSet.main.unsetAsyncRequest(); } const errGetBandoCallback = (data) => { @@ -206,6 +222,7 @@ const BandoViewBeneficiario = () => { }); } set404FromErrorResponse(data); + storeSet.main.unsetAsyncRequest(); } const getFormattedBandiData = (data) => { @@ -291,10 +308,13 @@ const BandoViewBeneficiario = () => { BandoService.getBando(bandoId, getBandoCallback, errGetBandoCallback, [ ['companyId', chosenCompanyId] ]); - ApplicationService.getApplications(getApplCallback, errGetApplCallback, [ - ['callId', bandoId], - ['companyId', chosenCompanyId] - ]); + if (REACT_APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE') { + storeSet.main.setAsyncRequest(); + ApplicationService.getApplications(getApplCallback, errGetApplCallback, [ + ['callId', bandoId], + ['companyId', chosenCompanyId] + ]); + } } }, [id, chosenCompanyId]); @@ -521,4 +541,4 @@ const BandoViewBeneficiario = () => { } -export default BandoViewBeneficiario; \ No newline at end of file +export default BandoViewBeneficiario; diff --git a/src/pages/Dashboard/components/DraftApplicationsTable/index.js b/src/pages/Dashboard/components/DraftApplicationsTable/index.js index acaec4b..c41abb0 100644 --- a/src/pages/Dashboard/components/DraftApplicationsTable/index.js +++ b/src/pages/Dashboard/components/DraftApplicationsTable/index.js @@ -42,7 +42,7 @@ const DraftApplicationsTable = () => { if (data.status === 'SUCCESS') { if (is(Array, data.data)) { setItems(getFormattedBandiData(data.data)); - setStatuses(uniq(items.map(o => o.status))) + setStatuses(uniq(data.data.map(o => o.status))) initFilters(); } } diff --git a/src/pages/DomandaEditPreInstructor/components/RepeaterFields/index.js b/src/pages/DomandaEditPreInstructor/components/RepeaterFields/index.js index 7a24f29..d6249d9 100644 --- a/src/pages/DomandaEditPreInstructor/components/RepeaterFields/index.js +++ b/src/pages/DomandaEditPreInstructor/components/RepeaterFields/index.js @@ -19,6 +19,7 @@ const RepeaterFields = ({ updateCallbackFn = () => { }, defaultValue = [], + shouldDisable = false }) => { const [chosen, setChosen] = useState(''); const { @@ -92,6 +93,7 @@ const RepeaterFields = ({
setNewChosen(o.fieldId)}>{o.nameValue}
@@ -762,7 +766,8 @@ const DomandaEditPreInstructor = () => { {['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus) ?