diff --git a/src/assets/scss/components/appPage.scss b/src/assets/scss/components/appPage.scss index 4ed00a3..a07df79 100644 --- a/src/assets/scss/components/appPage.scss +++ b/src/assets/scss/components/appPage.scss @@ -159,6 +159,11 @@ opacity: 0.8; } + &.danger { + border-color: var(--message-error-color); + background-color: #ffd0d0; + } + h2 { color: var(--global-textColor); font-size: 21px; @@ -168,6 +173,12 @@ margin: 0; } + &.danger { + p, span { + color: var(--message-error-color); + } + } + .row { display: flex; gap: 1rem; diff --git a/src/components/FormField/components/CriteriaTable/RenderTable/components/NumericFormulaCell/index.js b/src/components/FormField/components/CriteriaTable/RenderTable/components/NumericFormulaCell/index.js index 75f3b3a..7ededbe 100644 --- a/src/components/FormField/components/CriteriaTable/RenderTable/components/NumericFormulaCell/index.js +++ b/src/components/FormField/components/CriteriaTable/RenderTable/components/NumericFormulaCell/index.js @@ -15,7 +15,7 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table }) return ( onChange(e.value)} onFocus={onFocus} minFractionDigits={0} diff --git a/src/components/FormField/components/CriteriaTable/index.js b/src/components/FormField/components/CriteriaTable/index.js index f965321..0b34a78 100644 --- a/src/components/FormField/components/CriteriaTable/index.js +++ b/src/components/FormField/components/CriteriaTable/index.js @@ -120,12 +120,14 @@ const Table = ({ ? * : null} {tableValue - ? : null} + ?
+ +
: null} ) } diff --git a/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js b/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js index 75f3b3a..7ededbe 100644 --- a/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js +++ b/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js @@ -15,7 +15,7 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table }) return ( onChange(e.value)} onFocus={onFocus} minFractionDigits={0} diff --git a/src/components/FormField/components/Table/index.js b/src/components/FormField/components/Table/index.js index 62d71de..8edd2d7 100644 --- a/src/components/FormField/components/Table/index.js +++ b/src/components/FormField/components/Table/index.js @@ -170,12 +170,15 @@ const Table = ({ ? * : null} {rows - ? : null} + ?
+ +
+ : null} {!isEmpty(columns) && !shouldDisableNewRows ?
{__('Aggiungi una riga', 'gepafin')} diff --git a/src/components/NotificationsSidebar/index.js b/src/components/NotificationsSidebar/index.js index 8d5e7b3..a41e302 100644 --- a/src/components/NotificationsSidebar/index.js +++ b/src/components/NotificationsSidebar/index.js @@ -88,35 +88,24 @@ const NotificationsSidebar = () => { const bodyParams = getPaginationQuery(status, currentPage); if (currentSubscription) { - //console.log('UNsubscribed') currentSubscription.unsubscribe(); setCurrentSubscription(null); } if (userData.id && chosenCompanyId !== 0 && role === 'ROLE_BENEFICIARY') { setLoading(true); - NotificationService.getNotificationsByCompanyId( + NotificationService.getNotificationsByCompanyIdPagination( userData.id, chosenCompanyId, - status === 'UNREAD' ? getNotifications : getNotificationsRead, - errGetNotifications, - [ - ['status', status] - ] + bodyParams, + status === 'UNREAD' ? getNotificationsPagi : getNotificationsReadPagi, + errGetNotifications ); if (isConnected && socket.current) { subscribeTo(`/topic/notifications_user_${userData.id}_company_${chosenCompanyId}`) } } else if (userData.id && role !== 'ROLE_BENEFICIARY') { setLoading(true); - /*NotificationService.getNotifications( - userData.id, - status === 'UNREAD' ? getNotifications : getNotificationsRead, - errGetNotifications, - [ - ['status', status] - ] - );*/ NotificationService.getNotificationsPagination( userData.id, bodyParams, @@ -157,24 +146,6 @@ const NotificationsSidebar = () => { setLoading(false); } - const getNotifications = (resp) => { - if (resp.status === 'SUCCESS') { - setNotifications(resp.data); - setTotalRecordsNum(resp.data.length); - } - set404FromErrorResponse(resp); - setLoading(false); - } - - const getNotificationsRead = (resp) => { - if (resp.status === 'SUCCESS') { - setNotificationsRead(resp.data); - setTotalRecordsNum(resp.data.length); - } - set404FromErrorResponse(resp); - setLoading(false); - } - const errGetNotifications = (resp) => { set404FromErrorResponse(resp); setLoading(false); @@ -257,7 +228,9 @@ const NotificationsSidebar = () => { }; useEffect(() => { - fetchMessages(); + if (userData && userData.id) { + fetchMessages(); + } }, [chosenCompanyId, userData.id, isConnected]); useEffect(() => { diff --git a/src/helpers/getTimeFromISOstring.js b/src/helpers/getTimeFromISOstring.js new file mode 100644 index 0000000..ea08f7d --- /dev/null +++ b/src/helpers/getTimeFromISOstring.js @@ -0,0 +1,9 @@ +const getTimeFromISOstring = ( + value, + options = { + hour: 'numeric', minute: 'numeric' + }) => { + return value ? Intl.DateTimeFormat('it-IT', options).format(new Date(value)) : value; +} + +export default getTimeFromISOstring; \ No newline at end of file diff --git a/src/pages/BandoApplication/index.js b/src/pages/BandoApplication/index.js index 6f5cf0f..cdf52c3 100644 --- a/src/pages/BandoApplication/index.js +++ b/src/pages/BandoApplication/index.js @@ -64,6 +64,7 @@ const BandoApplication = () => { const [signedPdfFile, setSignedPdfFile] = useState([]); const [isRequestForApplData, setIsRequestForApplData] = useState(false); const isAsyncRequest = useStore().main.isAsyncRequest(); + const previousStatus = useRef(''); const toast = useRef(null); const formMsgs = useRef(null); const { @@ -578,6 +579,13 @@ const BandoApplication = () => { }, [formValues]); useEffect(() => { + if (previousStatus.current === applicationStatus || (previousStatus.current !== applicationStatus && isEmpty(previousStatus.current))) { + previousStatus.current = applicationStatus; + return; + } else { + previousStatus.current = applicationStatus; + } + if ('DRAFT' === applicationStatus && !isRequestForApplData) { const applId = getApplicationId(); diff --git a/src/pages/Dashboard/components/DraftApplicationsTable/index.js b/src/pages/Dashboard/components/DraftApplicationsTable/index.js index 629106c..24b093f 100644 --- a/src/pages/Dashboard/components/DraftApplicationsTable/index.js +++ b/src/pages/Dashboard/components/DraftApplicationsTable/index.js @@ -126,7 +126,7 @@ const DraftApplicationsTable = () => { }; const actionsBodyTemplate = (rowData) => { - return + return
+ ); + }; + + const dateStartBodyTemplate = (rowData) => { + const startTimeObj = getTimeParsedFromString(rowData.startTime); + return formatDate(rowData.start_date) + ' ' + getTimeFromISOstring(startTimeObj); + }; + + const dateEndBodyTemplate = (rowData) => { + const endTimeObg = getTimeParsedFromString(rowData.endTime); + return formatDate(rowData.end_date) + ' ' + getTimeFromISOstring(endTimeObg); + }; + + const dateFilterTemplate = (options) => { + return options.filterCallback(e.value, options.index)} dateFormat="mm/dd/yy" placeholder="mm/dd/yyyy" mask="99/99/9999" />; + }; + + const statusBodyTemplate = (rowData) => { + return ; + }; + + const header = renderHeader(); + + return( +
+ setFilters(e.filters)}> + + + + + +
+ ) +} + +export default LatestBandiTable; \ No newline at end of file diff --git a/src/pages/DashboardInstructorManager/index.js b/src/pages/DashboardInstructorManager/index.js index 2ee8a13..3cb597f 100644 --- a/src/pages/DashboardInstructorManager/index.js +++ b/src/pages/DashboardInstructorManager/index.js @@ -9,30 +9,37 @@ import DashboardService from '../../service/dashboard-service'; // components import { Button } from 'primereact/button'; -import PreInstructorDomandeTable from '../DashboardPreInstructor/components/PreInstructorDomandeTable'; +import LatestBandiTableInstructorManager from './components/LatestBandiTableInstructorManager'; +import AllDomandeTable from '../Domande/components/AllDomandeTable'; +import DraftApplicationsTable from '../Dashboard/components/DraftApplicationsTable'; +import ChartDomandePerBando from '../../components/ChartDomandePerBando'; +import ChartStatoDomande from '../../components/ChartStatoDomande'; const DashboardInstructorManager = () => { const navigate = useNavigate(); const [mainStats, setMainStats] = useState({}); + const [chartStats, setChartStats] = useState({}); const goToAllEvaluations = () => { navigate('/domande'); } - const getStats = (data) => { - if (data.status === 'SUCCESS') { - setMainStats(data.data); - } - } - - const errGetStats = () => {} - const getStatValue = (key, fallback = '') => { return pathOr(fallback, [key], mainStats); } + const getStats = (data) => { + if (data.status === 'SUCCESS') { + setMainStats(data.data.widget1); + setChartStats(data.data.widgetBars); + } + } + + const errGetStats = () => { + } + useEffect(() => { - DashboardService.getEvaluationsStats(getStats, errGetStats); + DashboardService.getAdminStats(getStats, errGetStats); }, []); return( @@ -44,63 +51,102 @@ const DashboardInstructorManager = () => {
-

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

-
+

{__('Panoramica di Sistema', 'gepafin')}

+
- {__('Totale domande', 'gepafin')} + {__('Bandi attivi', 'gepafin')}
- {__('In soccorso', 'gepafin')} + {__('Utenti registrati', 'gepafin')}
- {__('In valutazione', 'gepafin')} + {__('Domande in pre-istruttoria', 'gepafin')}
- {__('Completate', 'gepafin')} + {__('Domande in bozza', 'gepafin')}
- {__('Tempo medio di valutazione', 'gepafin')} + {__('Aziende', 'gepafin')}
- {__('Domande in scadenza (48h)', 'gepafin')} + {__('Totale finanziamenti attivi', 'gepafin')} + value={getStatValue('totalActiveFinancing', 0)} + format={{ + notation: 'compact', + compactDisplay: 'short', + roundingMode: 'trunc', + style: 'currency', + currency: 'EUR', + currencyDisplay: 'symbol' + }} + locales="it-IT"/>
-
+ {/*

{__('Panoramica delle domande da valutare', 'gepafin')}

+
*/} +
+

{__('Ultimi bandi pubblicati', 'gepafin')}

+
+
+

{__('Ultime domande pubblicate', 'gepafin')}

+ +
+ +
+ +
+

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

+ +
+ +
+ + {chartStats.applicationPerCall + ?
+

{__('Statistiche di sistema', 'gepafin')}

+
+ + +
+
: null} + +
+
{__('Azioni rapide', 'gepafin')}
diff --git a/src/service/notification-service.js b/src/service/notification-service.js index 75c22a7..e946893 100644 --- a/src/service/notification-service.js +++ b/src/service/notification-service.js @@ -4,12 +4,8 @@ const API_BASE_URL = process.env.REACT_APP_API_EXECUTION_ADDRESS; export default class NotificationService { - /*static getNotifications = (id, callback, errCallback, queryParams) => { - NetworkService.get(`${API_BASE_URL}/notification/user/${id}`, callback, errCallback, queryParams); - };*/ - - static getNotificationsByCompanyId = (id, companyId, callback, errCallback, queryParams) => { - NetworkService.get(`${API_BASE_URL}/notification/user/${id}/company/${companyId}/notifications`, callback, errCallback, queryParams); + static getNotificationsByCompanyIdPagination = (id, companyId, body, callback, errCallback, queryParams) => { + NetworkService.post(`${API_BASE_URL}/notification/user/${id}/company/${companyId}/pagination`, body, callback, errCallback, queryParams); }; static getNotificationsPagination = (id, body, callback, errCallback, queryParams) => { @@ -22,9 +18,9 @@ export default class NotificationService { ]); }; - static notificationMakeUnread = (id, callback, errCallback) => { + /*static notificationMakeUnread = (id, callback, errCallback) => { NetworkService.put(`${API_BASE_URL}/notification/${id}`, {}, callback, errCallback, [ ['status', 'UNREAD'] ]); - }; + };*/ }