From b73174d688e4b7939855da6ec99afcf39ddaeb4a Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Fri, 3 Jan 2025 10:09:17 +0100 Subject: [PATCH 01/15] - fixed counter of unread msgs; --- src/components/NotificationsSidebar/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/NotificationsSidebar/index.js b/src/components/NotificationsSidebar/index.js index a499b13..f44a5e5 100644 --- a/src/components/NotificationsSidebar/index.js +++ b/src/components/NotificationsSidebar/index.js @@ -215,7 +215,7 @@ const NotificationsSidebar = () => { <> setNotificationsVisible(true)}> - + o.status === 'UNREAD').length}> Date: Fri, 3 Jan 2025 14:00:38 +0100 Subject: [PATCH 02/15] - saving progress; --- src/assets/scss/components/formBuilder.scss | 64 ++++++++- .../components/ElementSetting/index.js | 2 +- .../ElementSettingTableColumns/index.js | 126 +++++++++++++----- 3 files changed, 153 insertions(+), 39 deletions(-) diff --git a/src/assets/scss/components/formBuilder.scss b/src/assets/scss/components/formBuilder.scss index 0eac29a..40ba8ca 100644 --- a/src/assets/scss/components/formBuilder.scss +++ b/src/assets/scss/components/formBuilder.scss @@ -191,16 +191,70 @@ } .formElementSettings__repeater { - display: flex; - flex-direction: column; + display: grid; + grid-template-columns: 1fr; gap: 0.5rem; } .formElementSettings__repeaterItem { + display: grid; + grid-template-columns: 4.5fr 2.4fr 1fr 1.4fr 0.7fr; + gap: 12px; + > div { + display: flex; + align-items: center; + width: 100%; + box-sizing: border-box; + + input, select, .p-dropdown { + width: 100%; + box-sizing: border-box; + } + } } -.formElementSettings__subRepeater { - padding: 10px 20px; - background-color: #f9f9f9; +.formElementSettings__subRepeaterWrapper { + display: grid; + grid-template-columns: 1fr; + gap: 7px; +} + +.formElementSettings__subRepeaterItem { + display: grid; + grid-template-columns: 9.3fr 0.7fr; + gap: 12px; + + > div { + display: flex; + align-items: center; + width: 100%; + box-sizing: border-box; + + input, select, .p-dropdown { + width: 100%; + box-sizing: border-box; + } + } +} + +.formElementSettings__repeaterItemIconBtn { + border: none; + background: transparent; + padding: 0; + font-size: 2rem; + color: var(--table-border-color); + + i { + font-size: 2rem; + } + + &:hover { + cursor: pointer; + color: var(--menuitem-active-background); + } + + &:not([data-active="false"]) { + color: var(--menuitem-active-background); + } } \ 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 1da64fa..a226f8c 100644 --- a/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js +++ b/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js @@ -22,7 +22,7 @@ const ElementSetting = ({ setting, changeFn, updateDataFn, bandoStatus }) => { options: __('Opzioni', 'gepafin'), mime: __('Tipo di file', 'gepafin'), text: __('Testo formattato', 'gepafin'), - table_columns: __('Colonne', 'gepafin'), + table_columns: '', } const renderHeader = () => { diff --git a/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSettingTableColumns/index.js b/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSettingTableColumns/index.js index ee5d9aa..fa3320d 100644 --- a/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSettingTableColumns/index.js +++ b/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSettingTableColumns/index.js @@ -1,5 +1,5 @@ import React, { useEffect, useState } from 'react'; -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import { wrap } from 'object-path-immutable'; import { pathOr } from 'ramda'; @@ -10,6 +10,7 @@ import { InputSwitch } from 'primereact/inputswitch'; // tools import uniqid from '../../../../../../helpers/uniqid'; +import { Dropdown } from 'primereact/dropdown'; const ElementSettingTableColumns = ({ value, @@ -55,6 +56,16 @@ const ElementSettingTableColumns = ({ setStateFieldData(newData); } + const onTypeChange = (value, index) => { + const newData = stateFieldData.map((o, i) => { + if (i === index) { + o.fieldtype = value; + } + return o; + }) + setStateFieldData(newData); + } + const onSubInputChange = (e, name, index) => { const { value } = e.target; const newRowsData = wrap(rowsData).set([index, name], value).value(); @@ -83,21 +94,69 @@ const ElementSettingTableColumns = ({ setStateFieldData(newData); } - const properField = (item, i) => { + const setColFormulaChecked = (index) => { + const newData = stateFieldData.map((o, i) => { + if (i === index) { + o.enableFormula = o.enableFormula !== true; + } + return o; + }); + setStateFieldData(newData); + } + + const properFields = (item, i) => { return <> - onInputChange(e, i)}/> -
- {__('Predefinito?', 'gepafin')} +
+ onInputChange(e, i)}/> +
+
+ onTypeChange(e.value, i)} + options={[ + { value: 'text', label: __('Testo', 'gepafin') }, + { value: 'number', label: __('Numerico', 'gepafin') } + ]}/> +
+
+ +
+
setChecked(e.value, i)}/>
+
+
} const properSubField = (item, i, name) => { - return onSubInputChange(e, name, i)}/> + return <> +
+ onSubInputChange(e, name, i)}/> +
+
+
+ } useEffect(() => { @@ -119,39 +178,40 @@ const ElementSettingTableColumns = ({ return ( <>
+ {stateFieldData.length > 0 + ?
+
{__('Colonne', 'gepafin')}
+
{__('Tipo', 'gepafin')}
+
{__('Calcola', 'gepafin')}
+
{__('Predefinito?', 'gepafin')}
+
+
: null} {stateFieldData.map((o, i) =>
-
- {properField(o, i)} -
+ {properFields(o, i)}
)} -
{stateFieldData - .filter(o => o.predefined) - .map((o, i) =>
-
- -
- {rowsData.map((c, k) => { - return
-
+ .filter(o => o.predefined).length > 0 + ?
+ {stateFieldData + .filter(o => o.predefined) + .map((o, i) => +
+ {rowsData.map((c, k) => { + return
{properSubField(c, k, o.name)} -
-
- })} -
-
-
)} + })} +
)} +
+ : null} ) } From 652d11fe8d2e27f894ffc660d41b92b5226a0934 Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Fri, 3 Jan 2025 14:08:54 +0100 Subject: [PATCH 03/15] - removed uploading delega on company profile page; --- src/pages/ProfileCompany/index.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/pages/ProfileCompany/index.js b/src/pages/ProfileCompany/index.js index f7ee19d..8b7c856 100644 --- a/src/pages/ProfileCompany/index.js +++ b/src/pages/ProfileCompany/index.js @@ -23,10 +23,10 @@ import FormField from '../../components/FormField'; import { Button } from 'primereact/button'; import BlockingOverlay from '../../components/BlockingOverlay'; import { InputText } from 'primereact/inputtext'; -import FileuploadDelega from '../../components/FileuploadDelega'; +//import FileuploadDelega from '../../components/FileuploadDelega'; import { Toast } from 'primereact/toast'; -import getFormatedFileSizeText from '../../helpers/getFormatedFileSizeText'; -import { defaultMaxFileSize } from '../../configData'; +//import getFormatedFileSizeText from '../../helpers/getFormatedFileSizeText'; +//import { defaultMaxFileSize } from '../../configData'; import { Dialog } from 'primereact/dialog'; import { confirmPopup, ConfirmPopup } from 'primereact/confirmpopup'; @@ -37,7 +37,7 @@ const ProfileCompany = () => { const infoMsgs = useRef(null); const [formInitialData, setFormInitialData] = useState({}); const [delegaData, setDelegaData] = useState({}); - const [delega, setDelega] = useState([]); + //const [delega, setDelega] = useState([]); const [isVisibleRemoveDialog, setIsVisibleRemoveDialog] = useState(false); const { delegaFirstName = '', delegaLastName = '', delegaCodiceFiscale = '' } = delegaData; const toast = useRef(null); @@ -161,11 +161,11 @@ const ProfileCompany = () => { setDelegaData(newDelegaData) } - const setDelegaFile = (name, value) => { + /*const setDelegaFile = (name, value) => { setDelega(value); - } + }*/ - const getDellegaCallback = (data) => { + /*const getDellegaCallback = (data) => { if (data.data) { setDelega([data.data]); } @@ -175,7 +175,7 @@ const ProfileCompany = () => { const errDellegaCallback = () => { setDelega([]); storeSet.main.unsetAsyncRequest(); - } + }*/ const downloadDelega = () => { storeSet.main.setAsyncRequest(); @@ -338,14 +338,14 @@ const ProfileCompany = () => { setFormInitialData(companyData); }, [chosenCompanyId, companies]); - useEffect(() => { + /*useEffect(() => { if (formInitialData.id) { storeSet.main.setAsyncRequest(); CompanyService.getCompanyDelega(getDellegaCallback, errDellegaCallback, [ ['companyId', formInitialData.id] ]); } - }, [formInitialData]) + }, [formInitialData])*/ return (
@@ -516,7 +516,7 @@ const ProfileCompany = () => { ?
{__('Compilazione Delega', 'gepafin')} -

{__('Per procedere come delegato, compila il form seguente, scarica il documento della delega, fallo firmare dal rappresentante legale e ricaricalo.', 'gepafin')}

+

{__('Per procedere come delegato, compila il form seguente, scarica il documento della delega, fallo firmare dal rappresentante legale.', 'gepafin')}

@@ -563,7 +563,7 @@ const ProfileCompany = () => { icon="pi pi-check" iconPos="right"/>
-
+ {/*
+
*/} {/*
-

Abbiamo preso in carica la tua richiesta a breve l'azienda sarà rimossa dal tuo profilo

-
+ */}
) diff --git a/src/service/company-service.js b/src/service/company-service.js index 0dc3e8c..1246a91 100644 --- a/src/service/company-service.js +++ b/src/service/company-service.js @@ -37,6 +37,6 @@ export default class CompanyService { }; static deleteCompany = (id, callback, errCallback) => { - NetworkService.delete(`${API_BASE_URL}/company/${id}`, {}, callback, errCallback); + NetworkService.delete(`${API_BASE_URL}/company/user/${id}`, {}, callback, errCallback); }; } From 7106c0d300e4c3dbdbd212e82a14e2295e78edbd Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Fri, 3 Jan 2025 14:43:07 +0100 Subject: [PATCH 05/15] - update copy for delega on company profile page; --- src/pages/ProfileCompany/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/ProfileCompany/index.js b/src/pages/ProfileCompany/index.js index 8b7c856..6147296 100644 --- a/src/pages/ProfileCompany/index.js +++ b/src/pages/ProfileCompany/index.js @@ -516,7 +516,7 @@ const ProfileCompany = () => { ?
{__('Compilazione Delega', 'gepafin')} -

{__('Per procedere come delegato, compila il form seguente, scarica il documento della delega, fallo firmare dal rappresentante legale.', 'gepafin')}

+

{__('Per procedere come delegato, compila il form seguente, scarica il documento della delega, fallo firmare dal rappresentante legale e ricaricalo nel form di domanda.', 'gepafin')}

From 45f5f5e99d1f2fc3e73e262a04509d2392fc96bf Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Fri, 3 Jan 2025 15:21:42 +0100 Subject: [PATCH 06/15] - added new setting 'isDelegation'; --- .../BuilderElementSettings/components/ElementSetting/index.js | 3 ++- src/tempData.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js b/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js index 1da64fa..d38ca25 100644 --- a/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js +++ b/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js @@ -19,6 +19,7 @@ const ElementSetting = ({ setting, changeFn, updateDataFn, bandoStatus }) => { placeholder: __('Segnaposto', 'gepafin'), step: __('Numero Decimali', 'gepafin'), isRequestedAmount: __('Importo richiesto', 'gepafin'), + isDelegation: __('Delega', 'gepafin'), options: __('Opzioni', 'gepafin'), mime: __('Tipo di file', 'gepafin'), text: __('Testo formattato', 'gepafin'), @@ -80,7 +81,7 @@ const ElementSetting = ({ setting, changeFn, updateDataFn, bandoStatus }) => { name={setting.name} bandoStatus={bandoStatus} setDataFn={updateDataFn}/> - } else if (setting.name === 'isRequestedAmount') { + } else if (['isRequestedAmount', 'isDelegation'].includes(setting.name)) { return changeFn(e.value, setting.name)}/> diff --git a/src/tempData.js b/src/tempData.js index 6c8c231..372def6 100644 --- a/src/tempData.js +++ b/src/tempData.js @@ -214,6 +214,10 @@ export const elementItems = [ { name: "mime", value: [] + }, + { + name: "isDelegation", + value: false } ], validators: { From a2739ba9660ddfd05fec3029064bfc99c6c89747 Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Tue, 7 Jan 2025 08:34:31 +0100 Subject: [PATCH 07/15] - added websocket url as env var for production; --- environments/prod/prod.env | 1 + 1 file changed, 1 insertion(+) diff --git a/environments/prod/prod.env b/environments/prod/prod.env index ecbe860..8e5fc08 100644 --- a/environments/prod/prod.env +++ b/environments/prod/prod.env @@ -1,6 +1,7 @@ REACT_APP_TAB_TITLE=Gepafin REACT_APP_API_EXECUTION_ADDRESS=https://bandi-api.gepafin.it/v1 REACT_APP_API_ADDRESS=https://bandi-api.gepafin.it +REACT_APP_API_ADDRESS_WS=https://bandi-api.gepafin.it/wss REACT_APP_LOGO_FILENAME=gepafin-logo.svg REACT_APP_FAVICON_FILENAME=gepafin-favicon.ico REACT_APP_HUB_ID=p4lk3bcx1RStqTaIVVbXs From f052be6ce891d2c6941e471f7831167298426fad Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Tue, 7 Jan 2025 11:33:18 +0100 Subject: [PATCH 08/15] - added accordions for table rows; --- src/pages/BandoForms/index.js | 32 +++++++------- .../ElementSettingTableColumns/index.js | 44 +++++++++++-------- 2 files changed, 43 insertions(+), 33 deletions(-) diff --git a/src/pages/BandoForms/index.js b/src/pages/BandoForms/index.js index db0fdff..1f57fa4 100644 --- a/src/pages/BandoForms/index.js +++ b/src/pages/BandoForms/index.js @@ -290,21 +290,23 @@ const BandoForms = () => {

{__('Modifica form esistente', 'gepafin')}

{__('Continua a lavorare su un form precedentemente salvato', 'gepafin')}

- setSelectedForm(e.value)} - options={forms} - optionLabel="label" - placeholder={__('Seleziona form', 'gepafin')}/> -
diff --git a/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSettingTableColumns/index.js b/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSettingTableColumns/index.js index fa3320d..fd6212a 100644 --- a/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSettingTableColumns/index.js +++ b/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSettingTableColumns/index.js @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react'; import { __, sprintf } from '@wordpress/i18n'; import { wrap } from 'object-path-immutable'; -import { pathOr } from 'ramda'; +import { isEmpty, pathOr } from 'ramda'; // components import { InputText } from 'primereact/inputtext'; @@ -11,6 +11,7 @@ import { InputSwitch } from 'primereact/inputswitch'; // tools import uniqid from '../../../../../../helpers/uniqid'; import { Dropdown } from 'primereact/dropdown'; +import { Accordion, AccordionTab } from 'primereact/accordion'; const ElementSettingTableColumns = ({ value, @@ -109,7 +110,7 @@ const ElementSettingTableColumns = ({
onInputChange(e, i)}/>
@@ -173,7 +174,7 @@ const ElementSettingTableColumns = ({ }); }, [stateFieldData, rowsData]); - stateFieldData.filter(o => o.predefined) + //stateFieldData.filter(o => o.predefined) return ( <> @@ -195,21 +196,28 @@ const ElementSettingTableColumns = ({ {stateFieldData .filter(o => o.predefined).length > 0 ?
- {stateFieldData - .filter(o => o.predefined) - .map((o, i) => -
- {rowsData.map((c, k) => { - return
- {properSubField(c, k, o.name)} -
- })} -
)} + + {stateFieldData + //.filter(o => o.predefined) + .map((o, i) => + o.predefined + ? +
+ {rowsData.map((c, k) => { + return
+ {properSubField(c, k, o.name)} +
+ })} +
+
: null)} +
: null} From 8bc17536f6e928ba1991fea4dd62e9a235df3d31 Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Tue, 7 Jan 2025 12:21:05 +0100 Subject: [PATCH 09/15] - add appl stats; - added roleId param for reg form; --- .../scss/components/statsBigBadges.scss | 87 ++++++++++++++----- src/assets/scss/theme.scss | 3 + src/pages/Domande/index.js | 72 ++++++++++++++- src/pages/Registration/index.js | 3 +- src/service/dashboard-service.js | 4 + 5 files changed, 147 insertions(+), 22 deletions(-) diff --git a/src/assets/scss/components/statsBigBadges.scss b/src/assets/scss/components/statsBigBadges.scss index 1788b0c..6cb3c0a 100644 --- a/src/assets/scss/components/statsBigBadges.scss +++ b/src/assets/scss/components/statsBigBadges.scss @@ -25,8 +25,8 @@ justify-content: space-between; padding: 16px; border-radius: 6px; - border: 1px solid var(--yellow-500); - background: var(--card-full-background-color-2); + border: 1px solid #858585; + background: #cecece; align-items: center; gap: 48px; @@ -41,26 +41,73 @@ span:nth-last-of-type(1) { font-size: 22px; } +} - &:nth-of-type(2) { - border: 1px solid var(--yellow-500); - background: var(--card-full-background-color-3); +.statsBigBadges__grid { + .statsBigBadges__gridItem { + &:nth-of-type(1) { + border: 1px solid var(--yellow-500); + background: var(--card-full-background-color-2); + } + + &:nth-of-type(2) { + border: 1px solid var(--yellow-500); + background: var(--card-full-background-color-3); + } + + &:nth-of-type(3) { + border: 1px solid var(--yellow-500); + background: var(--card-full-background-color-4); + } + + &:nth-of-type(4) { + border: 1px solid var(--yellow-500); + background: var(--card-full-background-color-1); + } + + &:nth-of-type(5) { + border: 1px solid var(--yellow-500); + background: var(--card-full-background-color-5); + } + + &:nth-of-type(6) { + border: 1px solid var(--yellow-500); + background: var(--card-full-background-color-6); + } } - &:nth-of-type(3) { - border: 1px solid var(--yellow-500); - background: var(--card-full-background-color-4); - } - &:nth-of-type(4) { - border: 1px solid var(--yellow-500); - background: var(--card-full-background-color-1); - } - &:nth-of-type(5) { - border: 1px solid var(--yellow-500); - background: var(--card-full-background-color-5); - } - &:nth-of-type(6) { - border: 1px solid var(--yellow-500); - background: var(--card-full-background-color-6); + + &.applStats { + .statsBigBadges__gridItem { + &:nth-of-type(1) { + border: 1px solid var(--yellow-500); + background: var(--card-full-background-color-2); + } + + &:nth-of-type(2) { + border: 1px solid var(--yellow-500); + background: var(--card-full-background-color-3); + } + + &:nth-of-type(3) { + border: 1px solid var(--yellow-500); + background: var(--card-full-background-color-4); + } + + &:nth-of-type(4) { + border: 1px solid var(--yellow-500); + background: var(--card-full-background-color-7); + } + + &:nth-of-type(5) { + border: 1px solid var(--yellow-500); + background: var(--card-full-background-color-8); + } + + &:nth-of-type(6) { + border: 1px solid var(--yellow-500); + background: var(--card-full-background-color-9); + } + } } } diff --git a/src/assets/scss/theme.scss b/src/assets/scss/theme.scss index 2b48f72..943b18a 100644 --- a/src/assets/scss/theme.scss +++ b/src/assets/scss/theme.scss @@ -28,6 +28,9 @@ --card-full-background-color-1: #54965b; --card-full-background-color-5: #4ba190; --card-full-background-color-6: #6d68c0; + --card-full-background-color-7: #06B6D4; + --card-full-background-color-8: #FF3D32; + --card-full-background-color-9: #F97316; } @import "./components/layout.scss"; diff --git a/src/pages/Domande/index.js b/src/pages/Domande/index.js index 0512a71..41f63ce 100644 --- a/src/pages/Domande/index.js +++ b/src/pages/Domande/index.js @@ -1,6 +1,6 @@ import React, { useEffect, useRef, useState } from 'react'; import { __ } from '@wordpress/i18n'; -import { isEmpty } from 'ramda'; +import { isEmpty, pathOr } from 'ramda'; // api import UserService from '../../service/user-service'; @@ -20,6 +20,8 @@ import { Button } from 'primereact/button'; import { classNames } from 'primereact/utils'; import { Dropdown } from 'primereact/dropdown'; import DraftApplicationsTable from '../Dashboard/components/DraftApplicationsTable'; +import NumberFlow from '@number-flow/react'; +import DashboardService from '../../service/dashboard-service'; const Domande = () => { const [loading, setLoading] = useState(false); @@ -29,6 +31,7 @@ const Domande = () => { const [chosenUser, setChosenUser] = useState(0); const [chosenApplication, setChosenApplication] = useState(0); const [updaterString, setUpdaterString] = useState(''); + const [mainStats, setMainStats] = useState({}); const toast = useRef(null); const getRolesCallback = (data) => { @@ -123,6 +126,18 @@ const Domande = () => { storeSet.main.unsetAsyncRequest(); } + const getStatValue = (key, fallback = '') => { + return pathOr(fallback, [key], mainStats); + } + + const getStats = (data) => { + if (data.status === 'SUCCESS') { + setMainStats(data.data); + } + } + + const errGetStats = () => {} + useEffect(() => { if (roleIds.length > 0) { setLoading(true); @@ -137,6 +152,10 @@ const Domande = () => { } }, [isVisibleEditDialog]); + useEffect(() => { + DashboardService.getApplicationsStats(getStats, errGetStats); + }, []); + return (
@@ -152,6 +171,57 @@ const Domande = () => {
+
+

{__('Riepilogo', 'gepafin')}

+
+
+ {__('Totale domande', 'gepafin')} + +
+
+ {__('Assegnate', 'gepafin')} + +
+
+ {__('Completate', 'gepafin')} + +
+
+ {__('Tempo medio di valutazione', 'gepafin')} + +
+
+ {__('In soccorso istruttorio', 'gepafin')} + +
+
+ {__('Domande in scadenza (48h)', 'gepafin')} + +
+
+
+ +
+

{__('Domande in bozza', 'gepafin')}

diff --git a/src/pages/Registration/index.js b/src/pages/Registration/index.js index 90677e8..7d9f624 100644 --- a/src/pages/Registration/index.js +++ b/src/pages/Registration/index.js @@ -50,7 +50,8 @@ const Registration = () => { const newFormData = { ...formData, dateOfBirth: originalDateOfBirth, - hubUuid: APP_HUB_ID + hubUuid: APP_HUB_ID, + roleId: 1 } AuthenticationService.registerUser(newFormData, regCallback, regError, [ diff --git a/src/service/dashboard-service.js b/src/service/dashboard-service.js index 999c18c..87d7572 100644 --- a/src/service/dashboard-service.js +++ b/src/service/dashboard-service.js @@ -8,6 +8,10 @@ export default class DashboardService { NetworkService.get(`${API_BASE_URL}/dashboard`, callback, errCallback); }; + static getApplicationsStats = (callback, errCallback) => { + NetworkService.get(`${API_BASE_URL}/dashboard/application`, callback, errCallback); + }; + static getBeneficiaryStatsForCompany = (id, callback, errCallback) => { NetworkService.get(`${API_BASE_URL}/dashboard/beneficiary/company/${id}`, callback, errCallback); }; From 68f6152e6fd6857608f84931ede3cf0a5d8edf4e Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Wed, 8 Jan 2025 11:20:27 +0100 Subject: [PATCH 10/15] - added render for last row with autosum; --- src/assets/scss/components/formBuilder.scss | 39 +++++++++ .../components/DefaultCell/index.js | 20 +++++ .../components/LastRowCell/index.js | 21 +++++ .../components/NumericFormulaCell/index.js | 29 +++++++ .../components/Table/RenderTable/index.js | 40 +++++---- .../FormField/components/Table/index.js | 50 ++++++++--- .../ElementSettingTableColumns/index.js | 83 +++++++++++++++++-- src/pages/BandoFormsPreview/index.js | 4 +- 8 files changed, 252 insertions(+), 34 deletions(-) create mode 100644 src/components/FormField/components/Table/RenderTable/components/DefaultCell/index.js create mode 100644 src/components/FormField/components/Table/RenderTable/components/LastRowCell/index.js create mode 100644 src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js diff --git a/src/assets/scss/components/formBuilder.scss b/src/assets/scss/components/formBuilder.scss index 40ba8ca..9f70641 100644 --- a/src/assets/scss/components/formBuilder.scss +++ b/src/assets/scss/components/formBuilder.scss @@ -257,4 +257,43 @@ &:not([data-active="false"]) { color: var(--menuitem-active-background); } +} + +.formElementSettings__lastRowHeader { + display: grid; + grid-template-columns: 8.3fr 1.7fr; + gap: 7px; +} + +.formElementSettings__lastRowHeaderTitle { + display: flex; + height: 40px; + padding: 10.5px 17.5px; + justify-content: center; + align-items: center; + border-radius: 4px; + background: #f8f9fa; + border: 1px solid #dee2e6; + font-size: 14px; + font-style: normal; + font-weight: 700; + color: white; +} + +.formElementSettings__lastRowItem { + display: grid; + grid-template-columns: 1.7fr 8.3fr; + gap: 7px; + + > div { + display: flex; + align-items: center; + width: 100%; + box-sizing: border-box; + + input, select, .p-dropdown { + width: 100%; + box-sizing: border-box; + } + } } \ No newline at end of file diff --git a/src/components/FormField/components/Table/RenderTable/components/DefaultCell/index.js b/src/components/FormField/components/Table/RenderTable/components/DefaultCell/index.js new file mode 100644 index 0000000..4a3086e --- /dev/null +++ b/src/components/FormField/components/Table/RenderTable/components/DefaultCell/index.js @@ -0,0 +1,20 @@ +const DefaultCell = ({ getValue, row: { index }, column: { id }, table }) => { + const initialValue = getValue(); + const disabled = table.options.meta?.disabled; + + const onBlur = (e) => { + table.options.meta?.updateData(index, id, e.target.value); + }; + + return ( + table.options.meta?.updateData(index, id, e.target.value)} + onBlur={onBlur} + className="w-full px-2 py-1 border rounded" + /> + ); +}; + +export default DefaultCell; \ No newline at end of file diff --git a/src/components/FormField/components/Table/RenderTable/components/LastRowCell/index.js b/src/components/FormField/components/Table/RenderTable/components/LastRowCell/index.js new file mode 100644 index 0000000..cb56a61 --- /dev/null +++ b/src/components/FormField/components/Table/RenderTable/components/LastRowCell/index.js @@ -0,0 +1,21 @@ +import { head, isEmpty, isNil, sum } from 'ramda'; + +const LastRowCell = ({columnId, lastRows, columnMeta = {}, getColumnDataFn}) => { + const cellData = head(lastRows.filter(o => !isNil(o[columnId]))); + let cellValue = cellData[columnId]; + + if (columnMeta.enableFormula) { + const getAllRowsValues = getColumnDataFn(columnId) + .map(v => isEmpty(v) ? 0 : v); + + if (cellValue === 'sum') { + cellValue = sum(getAllRowsValues); + } else { + cellValue = 0; + } + } + + return {cellValue}; +}; + +export default LastRowCell; \ No newline at end of file diff --git a/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js b/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js new file mode 100644 index 0000000..089bc82 --- /dev/null +++ b/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js @@ -0,0 +1,29 @@ +const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table }) => { + const initialValue = getValue(); + const disabled = table.options.meta?.disabled; + + const onBlur = (e) => { + const numValue = e.target.value === 0 ? null : Number(e.target.value); + table.options.meta?.updateData(index, id, numValue); + }; + + const onChange = (e) => { + if (e.target.value === 0 || !isNaN(e.target.value)) { + table.options.meta?.updateData(index, id, e.target.value); + } + }; + + return ( + + ); +}; + +export default NumericFormulaCell; \ No newline at end of file diff --git a/src/components/FormField/components/Table/RenderTable/index.js b/src/components/FormField/components/Table/RenderTable/index.js index e30ac5e..604a453 100644 --- a/src/components/FormField/components/Table/RenderTable/index.js +++ b/src/components/FormField/components/Table/RenderTable/index.js @@ -1,31 +1,22 @@ import React from 'react'; import { flexRender, getCoreRowModel, useReactTable } from '@tanstack/react-table'; import { wrap } from 'object-path-immutable'; +import { isEmpty } from 'ramda'; -const RenderTable = ({ data, columns, setRowsFn, disabled }) => { +// components +import DefaultCell from './components/DefaultCell'; +import LastRowCell from './components/LastRowCell'; + +const RenderTable = ({ data, columns, lastRow, setRowsFn, disabled }) => { const table = useReactTable({ data, columns, defaultColumn: { - cell: ({ getValue, row: { index }, column: { id }, table }) => { - const initialValue = getValue(); - - const onBlur = (e) => { - table.options.meta?.updateData(index, id, e.target.value); - }; - - return ( - table.options.meta?.updateData(index, id, e.target.value)} - onBlur={onBlur} - /> - ); - }, + cell: DefaultCell }, getCoreRowModel: getCoreRowModel(), meta: { + disabled, updateData: (rowIndex, columnId, value) => { const newRowsData = wrap(data).set([rowIndex, columnId], value).value(); setRowsFn(newRowsData); @@ -33,6 +24,11 @@ const RenderTable = ({ data, columns, setRowsFn, disabled }) => { } }); + const getColumnData = (columnId) => { + const rows = table.getRowModel().rows; + return rows.map(row => row.getValue(columnId)); + }; + return ( @@ -72,6 +68,16 @@ const RenderTable = ({ data, columns, setRowsFn, disabled }) => { ); })} + {!isEmpty(lastRow) + ? + {columns.map((o) => )} + + : null}
) diff --git a/src/components/FormField/components/Table/index.js b/src/components/FormField/components/Table/index.js index d08e21e..8ebd19b 100644 --- a/src/components/FormField/components/Table/index.js +++ b/src/components/FormField/components/Table/index.js @@ -10,6 +10,7 @@ import { Button } from 'primereact/button'; import RenderTable from './RenderTable'; import { klona } from 'klona'; import { nonEmptyTables } from '../../../../helpers/validators'; +import NumericFormulaCell from './RenderTable/components/NumericFormulaCell'; const Table = ({ fieldName, @@ -25,6 +26,7 @@ const Table = ({ const [columnsCfg, setColumnsCfg] = useState([]); const [rowsCfg, setRowsCfg] = useState([]); const [columns, setColumns] = useState([]); + const [lastRow, setLastRow] = useState([]); const [rows, setRows] = useState(null); const [shouldDisableNewRows, setShouldDisableNewRows] = useState(false); const [rowIndexToDelete, rowRowIndexToDelete] = useState(null); @@ -72,19 +74,23 @@ const Table = ({ useEffect(() => { let shouldDisableNewRows = false; - let newColumns = columnsCfg.map((o) => { const item = { accessorKey: o.name, header: () => o.label, - footer: (props) => props.column.id + footer: (props) => props.column.id, + meta: { + predefined: o.predefined, + enableFormula: o.enableFormula, + fieldtype: o.fieldtype + } } if (o.predefined) { shouldDisableNewRows = true; - item.cell = (info) => { - return info.getValue(); - } + item.cell = (info) => info.getValue(); + } else if (o.enableFormula || o.fieldtype === 'numeric') { + item.cell = NumericFormulaCell; } return item; @@ -97,7 +103,7 @@ const Table = ({ accessorKey: 'actions', header: () => '', footer: (props) => props.column.id, - cell: ({row: { index }}) =>
: null} ) } diff --git a/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSettingTableColumns/index.js b/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSettingTableColumns/index.js index fd6212a..49af3a1 100644 --- a/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSettingTableColumns/index.js +++ b/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSettingTableColumns/index.js @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import React, { useCallback, useEffect, useState } from 'react'; import { __, sprintf } from '@wordpress/i18n'; import { wrap } from 'object-path-immutable'; import { isEmpty, pathOr } from 'ramda'; @@ -57,6 +57,17 @@ const ElementSettingTableColumns = ({ setStateFieldData(newData); } + const onLastRowInputChange = (e, index) => { + const { value } = e.target; + const newData = stateFieldData.map((o, i) => { + if (i === index) { + o.lastRowText = value; + } + return o; + }) + setStateFieldData(newData); + } + const onTypeChange = (value, index) => { const newData = stateFieldData.map((o, i) => { if (i === index) { @@ -67,6 +78,16 @@ const ElementSettingTableColumns = ({ setStateFieldData(newData); } + const onLastRowFormulaChange = (value, index) => { + const newData = stateFieldData.map((o, i) => { + if (i === index) { + o.lastRowFormula = value; + } + return o; + }) + setStateFieldData(newData); + } + const onSubInputChange = (e, name, index) => { const { value } = e.target; const newRowsData = wrap(rowsData).set([index, name], value).value(); @@ -98,7 +119,17 @@ const ElementSettingTableColumns = ({ const setColFormulaChecked = (index) => { const newData = stateFieldData.map((o, i) => { if (i === index) { - o.enableFormula = o.enableFormula !== true; + const newVal = o.enableFormula !== true; + o.enableFormula = newVal; + if (newVal) { + o.lastRowFormula = 'sum'; + o.fieldtype = 'numeric'; + delete o.lastRowText; + } else { + delete o.lastRowFormula; + delete o.fieldtype; + o.lastRowText = ''; + } } return o; }); @@ -115,11 +146,12 @@ const ElementSettingTableColumns = ({
onTypeChange(e.value, i)} options={[ { value: 'text', label: __('Testo', 'gepafin') }, - { value: 'number', label: __('Numerico', 'gepafin') } + { value: 'numeric', label: __('Numerico', 'gepafin') } ]}/>
@@ -160,6 +192,48 @@ const ElementSettingTableColumns = ({ } + const properFieldsLastRow = (item, i) => { + return <> +
+ {sprintf(__('Colonna %d'), i + 1)} +
+ {item.enableFormula + ?
+ onLastRowFormulaChange(e.value, i)} + options={[ + { value: 'sum', label: __('Somma automatica', 'gepafin') } + ]}/> +
+ :
+ onLastRowInputChange(e, i)}/> +
} + + } + + const lastRow = useCallback(() => { + return
+
+
+ {__('Definisci ultima righa', 'gepafin')} +
+
+ {stateFieldData.map((o, i) =>
+ {properFieldsLastRow(o, i)} +
)} +
+ }, [stateFieldData]); + useEffect(() => { const stateFieldData = pathOr([], ['stateFieldData'], value); setStateFieldData(stateFieldData); @@ -174,8 +248,6 @@ const ElementSettingTableColumns = ({ }); }, [stateFieldData, rowsData]); - //stateFieldData.filter(o => o.predefined) - return ( <>
@@ -220,6 +292,7 @@ const ElementSettingTableColumns = ({
: null} + {lastRow()} ) } diff --git a/src/pages/BandoFormsPreview/index.js b/src/pages/BandoFormsPreview/index.js index 8d34160..d9e3d30 100644 --- a/src/pages/BandoFormsPreview/index.js +++ b/src/pages/BandoFormsPreview/index.js @@ -155,8 +155,8 @@ const BandoFormsPreview = () => { }, {}); return ['paragraph'].includes(o.name) && text - ?
-
+ ?
+
{renderHtmlContent(text.value)}
From 2ab8c049a47b4060a1b2a8edd1ec03f9aaf036a3 Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Wed, 8 Jan 2025 14:47:19 +0100 Subject: [PATCH 11/15] - added confirmation for amendment; - fixed amendment creation; - added configrmation for appl deletion; - re added delega related fieldss on company profile page for non gepafin hubs; --- .../MyLatestSubmissionsTable/index.js | 21 +++- src/pages/ProfileCompany/index.js | 103 ++++++++---------- src/pages/SoccorsoAddPreInstructor/index.js | 46 +++++++- 3 files changed, 109 insertions(+), 61 deletions(-) diff --git a/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js b/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js index f8885ce..0f0cbcf 100644 --- a/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js +++ b/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js @@ -24,6 +24,7 @@ import { Tag } from 'primereact/tag'; import ProperBandoLabel from '../../../../components/ProperBandoLabel'; import { Link } from 'react-router-dom'; import translationStrings from '../../../../translationStringsForComponents'; +import { ConfirmPopup, confirmPopup } from 'primereact/confirmpopup'; const MyLatestSubmissionsTable = () => { const chosenCompanyId = useStore().main.chosenCompanyId(); @@ -167,8 +168,10 @@ const MyLatestSubmissionsTable = () => {
+ {APP_HUB_ID !== 'p4lk3bcx1RStqTaIVVbXs' + ?
+
: null} - {/*
- - -
*/} - - {/*
-
*/} + {APP_HUB_ID !== 'p4lk3bcx1RStqTaIVVbXs' + ?
+ + +
: null}
:
} diff --git a/src/pages/SoccorsoAddPreInstructor/index.js b/src/pages/SoccorsoAddPreInstructor/index.js index dca2bfe..55cd49e 100644 --- a/src/pages/SoccorsoAddPreInstructor/index.js +++ b/src/pages/SoccorsoAddPreInstructor/index.js @@ -23,6 +23,7 @@ import BlockingOverlay from '../../components/BlockingOverlay'; import { Toast } from 'primereact/toast'; import { InputSwitch } from 'primereact/inputswitch'; import ApplicationEvaluationService from '../../service/application-evaluation-service'; +import { Dialog } from 'primereact/dialog'; const SoccorsoAddPreInstructor = () => { const isAsyncRequest = useStore().main.isAsyncRequest(); @@ -31,6 +32,7 @@ const SoccorsoAddPreInstructor = () => { const [data, setData] = useState({}); const [evaluationId, setEvaluationId] = useState(0); const [formData, setFormData] = useState({}); + const [isVisibleConfirmDialog, setIsVisibleConfirmDialog] = useState(false) const toast = useRef(null); const goToEvaluationPage = () => { @@ -49,8 +51,8 @@ const SoccorsoAddPreInstructor = () => { const getCallbackEvaluation = (data) => { if (data.status === 'SUCCESS') { - setEvaluationId(data.data.assignedApplicationId); - AmendmentsService.getSoccorsoByApplEvalId(data.data.assignedApplicationId, getCallback, errGetCallback) + setEvaluationId(data.data.id); + AmendmentsService.getSoccorsoByApplEvalId(data.data.id, getCallback, errGetCallback) } } @@ -152,6 +154,32 @@ const SoccorsoAddPreInstructor = () => { storeSet.main.unsetAsyncRequest(); } + const initCreationProcess = () => { + setIsVisibleConfirmDialog(true); + } + + const headerConfirmDialog = () => { + return {__('Richiesta di conferma', 'gepafin')}; + } + + const hideConfirmDialog = () => { + setIsVisibleConfirmDialog(false); + } + + const footerConfirmDialog = () => { + return
+
+ } + + const doConfirm = () => { + setIsVisibleConfirmDialog(false); + doCreate(); + } + return (
@@ -286,12 +314,24 @@ const SoccorsoAddPreInstructor = () => { icon="pi pi-times" iconPos="right"/>
+ +
+

{__('Soccorso istruttorio autorizzato dal direttore e autorizzazione caricata su portale a seguito del quale parte l\'email?', 'gepafin')}

+
+
+
: <> From 3fa5ae2e85113abddd563aa6f8e96b6dd19a6904 Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Wed, 8 Jan 2025 15:01:46 +0100 Subject: [PATCH 12/15] - updated amendment closing process; --- .../components/BeneficiarioDomandeTable/index.js | 4 ++-- src/pages/SoccorsoEditPreInstructor/index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/DomandeBeneficiario/components/BeneficiarioDomandeTable/index.js b/src/pages/DomandeBeneficiario/components/BeneficiarioDomandeTable/index.js index a0eed2c..18ceb27 100644 --- a/src/pages/DomandeBeneficiario/components/BeneficiarioDomandeTable/index.js +++ b/src/pages/DomandeBeneficiario/components/BeneficiarioDomandeTable/index.js @@ -140,7 +140,7 @@ const BeneficiarioDomandeTable = () => { }; const actionsBodyTemplate = (rowData) => { - return <> + return
{rowData.status === 'SOCCORSO' ?
} const header = renderHeader(); diff --git a/src/pages/SoccorsoEditPreInstructor/index.js b/src/pages/SoccorsoEditPreInstructor/index.js index ff42e8c..f10a68e 100644 --- a/src/pages/SoccorsoEditPreInstructor/index.js +++ b/src/pages/SoccorsoEditPreInstructor/index.js @@ -528,7 +528,7 @@ const SoccorsoEditPreInstructor = () => {
From b54f3a87e0cb0ad3d93222a74779b520bd3006b7 Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Wed, 8 Jan 2025 15:44:21 +0100 Subject: [PATCH 13/15] -hid delega on company page for all hub; --- src/pages/ProfileCompany/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/ProfileCompany/index.js b/src/pages/ProfileCompany/index.js index c1b2db8..5162575 100644 --- a/src/pages/ProfileCompany/index.js +++ b/src/pages/ProfileCompany/index.js @@ -559,7 +559,7 @@ const ProfileCompany = () => {
- {APP_HUB_ID !== 'p4lk3bcx1RStqTaIVVbXs' + {APP_HUB_ID === 'nonexisting' // hide it from all hub ?
: null} - {APP_HUB_ID !== 'p4lk3bcx1RStqTaIVVbXs' + {APP_HUB_ID === 'nonexisting' // hide it from all hub ?