diff --git a/buildspec.prod.yml b/buildspec.prod.yml index 9e216fc..ce3c7b5 100644 --- a/buildspec.prod.yml +++ b/buildspec.prod.yml @@ -3,20 +3,10 @@ version: 0.2 phases: install: runtime-versions: - nodejs: 18 - commands: - - npm install -g yarn - - echo yarn -v - - yarn -v - pre_build: - commands: - - yarn install + nodejs: 20 build: commands: - - yarn extract - - yarn compile - - mkdir -pv public/loaded-files - - yarn build:prod + - npm install && npm run build:prod artifacts: files: - '**/*' diff --git a/environments/prod/prod.env b/environments/prod/prod.env index 0793630..26fd054 100644 --- a/environments/prod/prod.env +++ b/environments/prod/prod.env @@ -1,3 +1,3 @@ REACT_APP_TAB_TITLE=Gepafin -REACT_APP_API_EXECUTION_ADDRESS= +REACT_APP_API_EXECUTION_ADDRESS=https://api-dev-gepafin.memento.credit/v1 REACT_APP_LOGO_FILENAME=logo.svg \ No newline at end of file diff --git a/src/assets/scss/components/appPage.scss b/src/assets/scss/components/appPage.scss index f5e3ca4..a7c67c7 100644 --- a/src/assets/scss/components/appPage.scss +++ b/src/assets/scss/components/appPage.scss @@ -10,7 +10,12 @@ font-style: normal; font-weight: 600; line-height: normal; - text-align: center; + } + + .appPageLogin__wrapper { + h1 { + text-align: center; + } } } @@ -223,4 +228,32 @@ gap: 24px; padding: 24px 0 48px; flex-wrap: wrap; +} + +.appPageSection__tableActions { + display: flex; + gap: 24px; + padding: 0; + flex-wrap: wrap; +} + +.appPageSection__addToFavourites { + width: 28px; + height: 28px; + display: flex; + align-items: center; + justify-content: center; + border-radius: 50%; + border: none; + background-color: var(--message-info-color); + color: white; + padding: 0; + + &:hover { + cursor: pointer; + } + + &[disabled] { + background-color: var(--message-info-background); + } } \ No newline at end of file diff --git a/src/layouts/DefaultLayout/components/AppSidebar/index.js b/src/layouts/DefaultLayout/components/AppSidebar/index.js index 8fd2d7f..3d60b5d 100644 --- a/src/layouts/DefaultLayout/components/AppSidebar/index.js +++ b/src/layouts/DefaultLayout/components/AppSidebar/index.js @@ -21,7 +21,7 @@ const AppSidebar = () => { enable: true }, { - label: __('Gestione Bandi', 'gepafin'), + label: __('Gestione bandi', 'gepafin'), icon: 'pi pi-file', href: '/bandi', id: 2, @@ -34,6 +34,13 @@ const AppSidebar = () => { id: 11, enable: intersection(permissions, ['APPLY_CALLS']).length }, + { + label: __('Bandi disponibili', 'gepafin'), + icon: 'pi pi-bookmark', + href: '/bandi', + id: 12, + enable: intersection(permissions, ['VIEW_CALLS']).length + }, { label: __('Gestione Utenti', 'gepafin'), icon: 'pi pi-users', diff --git a/src/pages/Applications/index.js b/src/pages/Applications/index.js index b3da524..da855d3 100644 --- a/src/pages/Applications/index.js +++ b/src/pages/Applications/index.js @@ -10,7 +10,7 @@ const Applications = () => { const navigate = useNavigate(); const gotToBandiDisponibili = () => { - navigate('') + navigate('/bandi') } return( @@ -34,7 +34,6 @@ const Applications = () => {
+
+ } + + const rowExpansionTemplate = (data) => { + return ( +
+ {renderHtmlContent(data.descriptionShort)} +

{__('Scadenza', 'gepafin')}: {getDateFromISOstring(data.dates[1])}

+ +
+ ); + }; + + const allowExpansion = (rowData) => { + return true; + }; + + return( +
+ setExpandedRows(e.data)} + rowExpansionTemplate={rowExpansionTemplate} + onFilter={(e) => setFilters(e.filters)}> + + + + + + +
+ ) +} + +export default AllBandiAccordion; \ No newline at end of file diff --git a/src/pages/BandiBeneficiario/index.js b/src/pages/BandiBeneficiario/index.js new file mode 100644 index 0000000..66942d3 --- /dev/null +++ b/src/pages/BandiBeneficiario/index.js @@ -0,0 +1,25 @@ +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( +
+
+

{__('Bandi disponibili', 'gepafin')}

+
+ +
+ +
+ +
+
+ ) +} + +export default BandiBeneficiario; \ No newline at end of file diff --git a/src/pages/BandoApplication/index.js b/src/pages/BandoApplication/index.js index 6e0171a..a8495bb 100644 --- a/src/pages/BandoApplication/index.js +++ b/src/pages/BandoApplication/index.js @@ -102,6 +102,25 @@ const BandoApplication = () => { return !isNaN(parsed) ? parsed : 0; } + const submitFormCallback = (data) => { + if (data.status === 'SUCCESS') { + console.log(data.data); + if (toast.current) { + toast.current.show({ + severity: 'success', + summary: '', + detail: __('Saved!', 'gepafin') + }); + } + } + storeSet.main.unsetAsyncRequest(); + } + + const errSubmitFormCallback = (data) => { + set404FromErrorResponse(data); + storeSet.main.unsetAsyncRequest(); + } + const goBackward = () => { if (formId) { const applId = getApplicationId(); @@ -124,28 +143,8 @@ const BandoApplication = () => { } } - const submitFormCallback = (data) => { - if (data.status === 'SUCCESS') { - console.log(data.data); - if (toast.current) { - toast.current.show({ - severity: 'success', - summary: '', - detail: __('Saved!', 'gepafin') - }); - } - } - storeSet.main.unsetAsyncRequest(); - } - - const errSubmitFormCallback = (data) => { - set404FromErrorResponse(data); - storeSet.main.unsetAsyncRequest(); - } - const getApplFormCallback = (data) => { if (data.status === 'SUCCESS') { - console.log('getApplFormCallback', data.data); setBandoTitle(data.data.callTitle); setFormData(data.data.applicationFormResponse.content); setFormId(data.data.formId); @@ -156,8 +155,18 @@ const BandoApplication = () => { } const errGetApplFormCallbacks = (data) => { - set404FromErrorResponse(data); storeSet.main.unsetAsyncRequest(); + if (data.status === 'VALIDATION_ERROR') { + if (toast.current) { + toast.current.show({ + severity: 'error', + summary: '', + detail: data.message + }); + } + } else { + set404FromErrorResponse(data); + } } useEffect(() => { diff --git a/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js b/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js index 9c262a7..4a73ec8 100644 --- a/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js +++ b/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js @@ -14,53 +14,51 @@ import { InputText } from 'primereact/inputtext'; import { IconField } from 'primereact/iconfield'; import { InputIcon } from 'primereact/inputicon'; import { Dropdown } from 'primereact/dropdown'; -import { InputNumber } from 'primereact/inputnumber'; +import { ProgressBar } from 'primereact/progressbar'; import { Button } from 'primereact/button'; import { Calendar } from 'primereact/calendar'; import { Tag } from 'primereact/tag'; import ProperBandoLabel from '../../../../components/ProperBandoLabel'; import { Link } from 'react-router-dom'; +import ApplicationService from '../../../../service/application-service'; +import { storeSet, useStore } from '../../../../store'; +import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse'; const MyLatestSubmissionsTable = () => { + const isAsyncRequest = useStore().main.isAsyncRequest(); const [items, setItems] = useState(null); const [filters, setFilters] = useState(null); - const [loading, setLoading] = useState(false); const [globalFilterValue, setGlobalFilterValue] = useState(''); const [statuses, setStatuses] = useState([]); useEffect(() => { - // TODO - const items = [ - { - name: 'Bando Innovazione 2024', - end_date: '2024-08-08T00:00:00+00:00', - modify_date: '2024-08-30T00:00:00+00:00', - progress: 50, - status: 'DRAFT', - id: 33, - callId: 52 - }, - { - name: 'Bando Sostenibilità 2024', - end_date: '2024-07-28T00:00:00+00:00', - modify_date: '2024-08-15T00:00:00+00:00', - progress: 25, - status: 'DRAFT', - id: 34, - callId: 53 - } - ] - setItems(getFormattedBandiData(items)); - setStatuses(uniq(items.map(o => o.status))) - setLoading(false); - initFilters(); + storeSet.main.setAsyncRequest(); + ApplicationService.getApplications(getApplCallback, errGetApplCallback) }, []); + const getApplCallback = (data) => { + if (data.status === 'SUCCESS') { + if(data.data.length) { + setItems(getFormattedBandiData(data.data)); + setStatuses(uniq(items.map(o => o.status))) + initFilters(); + } + } + storeSet.main.unsetAsyncRequest(); + } + + const errGetApplCallback = (data) => { + set404FromErrorResponse(data); + storeSet.main.unsetAsyncRequest(); + } + const getFormattedBandiData = (data) => { return [...(data || [])].map((d) => { - d.modify_date = new Date(d.modify_date); - d.end_date = new Date(d.end_date); + d.modify_date = new Date(); + d.end_date = new Date(); + d.name = `Bando ${d.callId}`; + d.progress = 37; return d; }); @@ -123,10 +121,6 @@ const MyLatestSubmissionsTable = () => { return options.filterCallback(e.value, options.index)} dateFormat="mm/dd/yy" placeholder="mm/dd/yyyy" mask="99/99/9999" />; }; - const balanceFilterTemplate = (options) => { - return options.filterCallback(e.value, options.index)} />; - }; - const statusBodyTemplate = (rowData) => { return ; }; @@ -135,6 +129,10 @@ const MyLatestSubmissionsTable = () => { return options.filterCallback(e.value, options.index)} itemTemplate={statusItemTemplate} placeholder="Select One" className="p-column-filter" showClear />; }; + const progressBodyTemplate = (options) => { + return ; + }; + const statusItemTemplate = (option) => { return ; }; @@ -149,7 +147,7 @@ const MyLatestSubmissionsTable = () => { return(
- { style={{ width: '120px' }} body={statusBodyTemplate} filter filterElement={statusFilterTemplate}/> + style={{ minWidth: '10rem' }} field="progress" body={progressBodyTemplate}/> diff --git a/src/routes.js b/src/routes.js index f4f66cf..18cb6a8 100644 --- a/src/routes.js +++ b/src/routes.js @@ -18,6 +18,7 @@ import BandoFlowEdit from './pages/BandoFlowEdit'; import Applications from './pages/Applications'; import BandoApplication from './pages/BandoApplication'; import Registration from './pages/Registration'; +import BandiBeneficiario from './pages/BandiBeneficiario'; const routes = ({ role }) => { return ( @@ -29,7 +30,7 @@ const routes = ({ role }) => { }/> {'ROLE_SUPER_ADMIN' === role ? : null} - {'ROLE_BENEFICIARY' === role ? : null} + {'ROLE_BENEFICIARY' === role ? : null} }/> {'ROLE_SUPER_ADMIN' === role ? : null}