- added pagination for notifications (non beneficiary);

This commit is contained in:
Vitalii Kiiko
2025-01-15 11:50:35 +01:00
parent e0e65aa21c
commit 5d740c1069
20 changed files with 259 additions and 78 deletions

View File

@@ -17,12 +17,13 @@ const NotificationItemChosen = ({ item, closeFn, markReadFn }) => {
<span>{getDateFromISOstring(item.createdDate)}</span> <span>{getDateFromISOstring(item.createdDate)}</span>
{item.message} {item.message}
<Button {item.status === 'UNREAD'
? <Button
style={{marginTop: '20px'}} style={{marginTop: '20px'}}
type="button" type="button"
outlined outlined
onClick={() => markReadFn(item.id)} onClick={() => markReadFn(item.id)}
label={__('Letto', 'gepafin')}/> label={__('Letto', 'gepafin')}/> : null}
</div> </div>
) )
} }

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from 'react'; import React, { useCallback, useEffect, useRef, useState } from 'react';
import { __ } from '@wordpress/i18n'; import { __ } from '@wordpress/i18n';
import { head, isEmpty, pathOr } from 'ramda'; import { head, isEmpty, pathOr } from 'ramda';
import SockJS from 'sockjs-client'; import SockJS from 'sockjs-client';
@@ -19,6 +19,7 @@ import { Sidebar } from 'primereact/sidebar';
import { TabPanel, TabView } from 'primereact/tabview'; import { TabPanel, TabView } from 'primereact/tabview';
import NotificationItem from './components/NotificationItem'; import NotificationItem from './components/NotificationItem';
import NotificationItemChosen from './components/NotificationItemChosen'; import NotificationItemChosen from './components/NotificationItemChosen';
import PaginatorBasic from '../PaginatorBasic';
const socketUrl = process.env.REACT_APP_API_ADDRESS_WS; const socketUrl = process.env.REACT_APP_API_ADDRESS_WS;
@@ -35,22 +36,22 @@ const NotificationsSidebar = () => {
const stomp = useRef(null); const stomp = useRef(null);
const [currentSubscription, setCurrentSubscription] = useState(null); const [currentSubscription, setCurrentSubscription] = useState(null);
const [isConnected, setIsConnected] = useState(false); const [isConnected, setIsConnected] = useState(false);
const [currentPage, setCurrentPage] = useState(1);
const [totalRecordsNum, setTotalRecordsNum] = useState(0);
const [totalPagesNum, setTotalPagesNum] = useState(0);
const perPage = 10;
// Handle tab change // Handle tab change
const handleTabChange = (e) => { const handleTabChange = (e) => {
setActiveIndex(e.index); if (e.index === activeIndex) {
fetchTabData(e.index); return
};
const fetchTabData = (index) => {
setChosenMsg({});
if (0 === index) {
fetchMessages();
} else {
fetchMessages('READ');
} }
} setTotalRecordsNum(0);
setTotalPagesNum(0);
setChosenMsg({});
setActiveIndex(e.index);
setCurrentPage(1);
};
const chooseNotification = (id) => { const chooseNotification = (id) => {
const properItems = activeIndex === 0 ? notifications : notificationsRead; const properItems = activeIndex === 0 ? notifications : notificationsRead;
@@ -64,10 +65,27 @@ const NotificationsSidebar = () => {
setChosenMsg({}); setChosenMsg({});
} }
const fetchMessages = (status = 'UNREAD') => { const getPaginationQuery = (status = 'UNREAD', curPage = 1) => {
return {
'globalFilters': {
'page': curPage,
'limit': perPage,
'sortBy': {
'columnName': 'id',
'sortDesc': true
}
},
'status': [
status
]
}
}
const fetchMessages = useCallback((status = 'UNREAD') => {
const chosenCompanyId = storeGet.main.chosenCompanyId(); const chosenCompanyId = storeGet.main.chosenCompanyId();
const userData = storeGet.main.userData(); const userData = storeGet.main.userData();
const role = pathOr('', ['role', 'roleType'], userData); const role = pathOr('', ['role', 'roleType'], userData);
const bodyParams = getPaginationQuery(status, currentPage);
if (currentSubscription) { if (currentSubscription) {
//console.log('UNsubscribed') //console.log('UNsubscribed')
@@ -77,37 +95,72 @@ const NotificationsSidebar = () => {
if (userData.id && chosenCompanyId !== 0 && role === 'ROLE_BENEFICIARY') { if (userData.id && chosenCompanyId !== 0 && role === 'ROLE_BENEFICIARY') {
setLoading(true); setLoading(true);
NotificationService.getNotifications( NotificationService.getNotificationsByCompanyId(
userData.id,
status === 'UNREAD' ? getNotifications : getNotificationsRead,
errGetNotifications,
[
['status', status],
['companyId', chosenCompanyId]
]
);
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, userData.id,
chosenCompanyId,
status === 'UNREAD' ? getNotifications : getNotificationsRead, status === 'UNREAD' ? getNotifications : getNotificationsRead,
errGetNotifications, errGetNotifications,
[ [
['status', status] ['status', status]
] ]
); );
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,
status === 'UNREAD' ? getNotificationsPagi : getNotificationsReadPagi,
errGetNotifications
);
if (isConnected && socket.current) { if (isConnected && socket.current) {
subscribeTo(`/topic/notifications_user_${userData.id}`) subscribeTo(`/topic/notifications_user_${userData.id}`)
} }
} }
}, [currentPage]);
const getNotificationsPagi = (resp) => {
if (resp.status === 'SUCCESS') {
const { body, totalRecords, currentPage, totalPages } = resp.data;
setNotifications(body);
setTotalRecordsNum(totalRecords);
setTotalPagesNum(totalPages);
if (currentPage > totalPages) {
setCurrentPage(totalPages);
}
}
set404FromErrorResponse(resp);
setLoading(false);
}
const getNotificationsReadPagi = (resp) => {
if (resp.status === 'SUCCESS') {
const { body, totalRecords, currentPage, totalPages } = resp.data;
setNotificationsRead(body);
setTotalRecordsNum(totalRecords);
setTotalPagesNum(totalPages);
if (currentPage > totalPages) {
setCurrentPage(totalPages);
}
}
set404FromErrorResponse(resp);
setLoading(false);
} }
const getNotifications = (resp) => { const getNotifications = (resp) => {
if (resp.status === 'SUCCESS') { if (resp.status === 'SUCCESS') {
setNotifications(resp.data); setNotifications(resp.data);
setTotalRecordsNum(resp.data.length);
} }
set404FromErrorResponse(resp); set404FromErrorResponse(resp);
setLoading(false); setLoading(false);
@@ -116,6 +169,7 @@ const NotificationsSidebar = () => {
const getNotificationsRead = (resp) => { const getNotificationsRead = (resp) => {
if (resp.status === 'SUCCESS') { if (resp.status === 'SUCCESS') {
setNotificationsRead(resp.data); setNotificationsRead(resp.data);
setTotalRecordsNum(resp.data.length);
} }
set404FromErrorResponse(resp); set404FromErrorResponse(resp);
setLoading(false); setLoading(false);
@@ -139,6 +193,7 @@ const NotificationsSidebar = () => {
const msgs = notificationsRead.map(o => o.id === resp.data.id ? resp.data : o); const msgs = notificationsRead.map(o => o.id === resp.data.id ? resp.data : o);
setNotificationsRead(msgs); setNotificationsRead(msgs);
} }
setTotalRecordsNum(totalRecordsNum - 1);
} }
set404FromErrorResponse(resp); set404FromErrorResponse(resp);
} }
@@ -152,7 +207,7 @@ const NotificationsSidebar = () => {
stomp.current = Stomp.over(socket.current); stomp.current = Stomp.over(socket.current);
stomp.current.configure({ stomp.current.configure({
debug: function(str) { debug: function (str) {
//console.log(str); //console.log(str);
}, },
reconnectDelay: 5000, reconnectDelay: 5000,
@@ -190,10 +245,22 @@ const NotificationsSidebar = () => {
setCurrentSubscription(subscription); setCurrentSubscription(subscription);
} }
const onPageChange = (num) => {
setCurrentPage(num);
};
useEffect(() => { useEffect(() => {
fetchMessages(); fetchMessages();
}, [chosenCompanyId, userData.id, isConnected]); }, [chosenCompanyId, userData.id, isConnected]);
useEffect(() => {
if (0 === activeIndex) {
fetchMessages();
} else {
fetchMessages('READ');
}
}, [currentPage, activeIndex]);
useEffect(() => { useEffect(() => {
connectWebSocket(); connectWebSocket();
@@ -215,7 +282,7 @@ const NotificationsSidebar = () => {
<> <>
<i className="pi pi-bell p-overlay-badge topBar__icon notificationsIcon" <i className="pi pi-bell p-overlay-badge topBar__icon notificationsIcon"
onClick={() => setNotificationsVisible(true)}> onClick={() => setNotificationsVisible(true)}>
<Badge value={notifications.filter(o => o.status === 'UNREAD').length}></Badge> <Badge value={totalRecordsNum}></Badge>
</i> </i>
<Sidebar <Sidebar
className="notificationsSidebar" className="notificationsSidebar"
@@ -234,12 +301,19 @@ const NotificationsSidebar = () => {
closeFn={closeChosenMsg} closeFn={closeChosenMsg}
markReadFn={makeNotificationRead}/> markReadFn={makeNotificationRead}/>
: (notifications.length > 0 : (notifications.length > 0
? <ul className="notificationsSidebar__list"> ? <>
{notifications.map(o => <NotificationItem <ul className="notificationsSidebar__list">
key={o.id} {notifications.map(o => <NotificationItem
item={o} key={o.id}
clickFn={chooseNotification}/>)} item={o}
</ul> clickFn={chooseNotification}/>)}
</ul>
<PaginatorBasic
totalPages={totalPagesNum}
currentPage={currentPage}
clickFn={onPageChange}
/>
</>
: <div className="notificationsSidebar__loading"> : <div className="notificationsSidebar__loading">
<i className="pi pi-megaphone" style={{ fontSize: '2rem' }}></i> <i className="pi pi-megaphone" style={{ fontSize: '2rem' }}></i>
{__('Vuoto', 'gepafin')} {__('Vuoto', 'gepafin')}
@@ -256,17 +330,24 @@ const NotificationsSidebar = () => {
closeFn={closeChosenMsg} closeFn={closeChosenMsg}
markReadFn={makeNotificationRead}/> markReadFn={makeNotificationRead}/>
: (notificationsRead.length > 0 : (notificationsRead.length > 0
? <ul className="notificationsSidebar__list"> ? <>
{notificationsRead.map(o => <NotificationItem <ul className="notificationsSidebar__list">
key={o.id} {notificationsRead.map(o => <NotificationItem
item={o} key={o.id}
clickFn={chooseNotification}/>)} item={o}
</ul> clickFn={chooseNotification}/>)}
: </ul>
<div className="notificationsSidebar__loading"> <PaginatorBasic
<i className="pi pi-megaphone" style={{ fontSize: '2rem' }}></i> totalPages={totalPagesNum}
{__('Vuoto', 'gepafin')} currentPage={currentPage}
</div>)} clickFn={onPageChange}
/>
</>
:
<div className="notificationsSidebar__loading">
<i className="pi pi-megaphone" style={{ fontSize: '2rem' }}></i>
{__('Vuoto', 'gepafin')}
</div>)}
</TabPanel> </TabPanel>
</TabView> </TabView>
</Sidebar> </Sidebar>

View File

@@ -0,0 +1,59 @@
import React from 'react';
import { __ } from '@wordpress/i18n';
const PaginatorBasic = ({
currentPage = 0,
totalPages = 0,
clickFn = () => {
}
}) => {
const handleClick = (num) => {
const newNum = num < 0
? 0
: num > totalPages ? totalPages : num;
clickFn(newNum);
}
const prevDisabled = currentPage <= 1;
const nextDisabled = currentPage >= totalPages
return (
totalPages !== 0
? <div className="p-paginator p-component" data-pc-name="paginator" data-pc-section="root">
<button
type="button"
className={`p-paginator-prev p-paginator-element p-link${prevDisabled ? ' p-disabled' : ''}`}
disabled={prevDisabled}
onClick={prevDisabled ? () => {
} : () => handleClick(currentPage - 1)}
aria-label={__('Pagina precedente', 'gepafin')}
data-pc-section="prevpagebutton">
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"
className="p-icon p-paginator-icon" aria-hidden="true" data-pc-section="prevpageicon">
<path
d="M8.75 11.185C8.65146 11.1854 8.55381 11.1662 8.4628 11.1284C8.37179 11.0906 8.28924 11.0351 8.22 10.965L4.72 7.46496C4.57955 7.32433 4.50066 7.13371 4.50066 6.93496C4.50066 6.73621 4.57955 6.54558 4.72 6.40496L8.22 2.93496C8.36095 2.84357 8.52851 2.80215 8.69582 2.81733C8.86312 2.83252 9.02048 2.90344 9.14268 3.01872C9.26487 3.134 9.34483 3.28696 9.36973 3.4531C9.39463 3.61924 9.36303 3.78892 9.28 3.93496L6.28 6.93496L9.28 9.93496C9.42045 10.0756 9.49934 10.2662 9.49934 10.465C9.49934 10.6637 9.42045 10.8543 9.28 10.995C9.13526 11.1257 8.9448 11.1939 8.75 11.185Z"
fill="currentColor"></path>
</svg>
</button>
<span aria-live="polite" className="p-paginator-current" data-pc-section="current">
({currentPage} {__('di', 'gepafin')} {totalPages})
</span>
<button
type="button"
disabled={nextDisabled}
onClick={nextDisabled ? () => {
} : () => handleClick(currentPage + 1)}
className={`p-paginator-next p-paginator-element p-link${nextDisabled ? ' p-disabled' : ''}`}
aria-label={__('Pagina successiva', 'gepafin')}
data-pc-section="nextpagebutton">
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"
className="p-icon p-paginator-icon" aria-hidden="true" data-pc-section="nextpageicon">
<path
d="M5.25 11.1728C5.14929 11.1694 5.05033 11.1455 4.9592 11.1025C4.86806 11.0595 4.78666 10.9984 4.72 10.9228C4.57955 10.7822 4.50066 10.5916 4.50066 10.3928C4.50066 10.1941 4.57955 10.0035 4.72 9.86283L7.72 6.86283L4.72 3.86283C4.66067 3.71882 4.64765 3.55991 4.68275 3.40816C4.71785 3.25642 4.79932 3.11936 4.91585 3.01602C5.03238 2.91268 5.17819 2.84819 5.33305 2.83149C5.4879 2.81479 5.64411 2.84671 5.78 2.92283L9.28 6.42283C9.42045 6.56346 9.49934 6.75408 9.49934 6.95283C9.49934 7.15158 9.42045 7.34221 9.28 7.48283L5.78 10.9228C5.71333 10.9984 5.63193 11.0595 5.5408 11.1025C5.44966 11.1455 5.35071 11.1694 5.25 11.1728Z"
fill="currentColor"></path>
</svg>
</button>
</div> : null
)
}
export default PaginatorBasic;

View File

@@ -45,77 +45,77 @@ const AppSidebar = () => {
label: __('Bandi osservati', 'gepafin'), label: __('Bandi osservati', 'gepafin'),
icon: 'pi pi-star', icon: 'pi pi-star',
href: '/bandi-osservati', href: '/bandi-osservati',
id: 13, id: 5,
enable: intersection(permissions, ['VIEW_CALLS']).length enable: intersection(permissions, ['VIEW_CALLS']).length
}, },
{ {
label: __('Gestione domande', 'gepafin'), label: __('Gestione domande', 'gepafin'),
icon: 'pi pi-file', icon: 'pi pi-file',
href: '/domande', href: '/domande',
id: 5, id: 6,
enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS']).length enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS']).length
}, },
{ {
label: __('Domande da valutare', 'gepafin'), label: __('Domande da valutare', 'gepafin'),
icon: 'pi pi-calendar-clock', icon: 'pi pi-calendar-clock',
href: '/domande', href: '/domande',
id: 6, id: 7,
enable: intersection(permissions, ['EVALUATE_APPLICATIONS']).length enable: intersection(permissions, ['EVALUATE_APPLICATIONS']).length
}, },
{ {
label: __('Archivio domande', 'gepafin'), label: __('Archivio domande', 'gepafin'),
icon: 'pi pi-briefcase', icon: 'pi pi-briefcase',
href: '/domande', href: '/domande',
id: 7, id: 8,
enable: intersection(permissions, ['APPLY_CALLS']).length enable: intersection(permissions, ['APPLY_CALLS']).length
}, },
{ {
label: __('Archivio domande', 'gepafin'), label: __('Archivio domande', 'gepafin'),
icon: 'pi pi-briefcase', icon: 'pi pi-briefcase',
href: '/domande-archivio', href: '/domande-archivio',
id: 5, id: 9,
enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS']).length enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS']).length
}, },
{ {
label: __('Archivio domande', 'gepafin'), label: __('Archivio domande', 'gepafin'),
icon: 'pi pi-briefcase', icon: 'pi pi-briefcase',
href: '/domande-archivio', href: '/domande-archivio',
id: 6, id: 10,
enable: intersection(permissions, ['EVALUATE_APPLICATIONS']).length enable: intersection(permissions, ['EVALUATE_APPLICATIONS']).length
}, },
{ {
label: __('Soccorso istruttorio', 'gepafin'), label: __('Soccorso istruttorio', 'gepafin'),
icon: <HelpIcon/>, icon: <HelpIcon/>,
href: '/soccorso-istruttorio', href: '/soccorso-istruttorio',
id: 8, id: 11,
enable: intersection(permissions, ['EVALUATE_APPLICATIONS']).length enable: intersection(permissions, ['EVALUATE_APPLICATIONS']).length
}, },
{ {
label: __('Gestione utenti', 'gepafin'), label: __('Gestione utenti', 'gepafin'),
icon: 'pi pi-users', icon: 'pi pi-users',
href: '/utenti', href: '/utenti',
id: 9, id: 12,
enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS']).length enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS']).length
}, },
{ {
label: __('Configurazione', 'gepafin'), label: __('Configurazione', 'gepafin'),
icon: 'pi pi-cog', icon: 'pi pi-cog',
//href: '/configurazione', //href: '/configurazione',
id: 10, id: 13,
enable: false enable: false
}, },
{ {
label: __('Report e Analisi', 'gepafin'), label: __('Report e Analisi', 'gepafin'),
icon: 'pi pi-chart-bar', icon: 'pi pi-chart-bar',
//href: '/stats', //href: '/stats',
id: 11, id: 14,
enable: false enable: false
}, },
{ {
label: __('Log di Sistema', 'gepafin'), label: __('Log di Sistema', 'gepafin'),
icon: 'pi pi-receipt', icon: 'pi pi-receipt',
clickFn: () => {}, clickFn: () => {},
id: 12, id: 15,
enable: false enable: false
} }
] ]

View File

@@ -121,7 +121,7 @@ const AllBandiTable = () => {
return( return(
<div className="appPageSection__table"> <div className="appPageSection__table">
<DataTable value={items} paginator showGridlines rows={10} loading={localAsyncRequest} dataKey="id" <DataTable value={items} paginator showGridlines rows={5} loading={localAsyncRequest} dataKey="id"
filters={filters} stripedRows removableSort filters={filters} stripedRows removableSort
header={header} header={header}
emptyMessage={translationStrings.emptyMessage} emptyMessage={translationStrings.emptyMessage}

View File

@@ -206,7 +206,7 @@ const AllBandiAccordion = ({ showOnlyPreferred = false }) => {
<div className="appPageSection__table"> <div className="appPageSection__table">
<DataTable value={items} <DataTable value={items}
paginator paginator
rows={10} rows={5}
loading={isAsyncRequest} loading={isAsyncRequest}
dataKey="id" dataKey="id"
filters={filters} filters={filters}

View File

@@ -186,7 +186,7 @@ const AllBandiPreferredAccordion = () => {
<div className="appPageSection__table"> <div className="appPageSection__table">
<DataTable value={items} <DataTable value={items}
paginator paginator
rows={10} rows={5}
loading={isAsyncRequest} loading={isAsyncRequest}
dataKey="id" dataKey="id"
filters={filters} filters={filters}

View File

@@ -136,7 +136,7 @@ const DraftApplicationsTable = () => {
return ( return (
<div className="appPageSection__table"> <div className="appPageSection__table">
<DataTable value={items} paginator showGridlines rows={10} loading={localAsyncRequest} dataKey="id" <DataTable value={items} paginator showGridlines rows={5} loading={localAsyncRequest} dataKey="id"
filters={filters} stripedRows removableSort filters={filters} stripedRows removableSort
header={header} header={header}
emptyMessage={translationStrings.emptyMessage} emptyMessage={translationStrings.emptyMessage}

View File

@@ -21,17 +21,43 @@ const LatestBandiTable = () => {
const [filters, setFilters] = useState(null); const [filters, setFilters] = useState(null);
const [localAsyncRequest, setLocalAsyncRequest] = useState(false); const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
const [, setStatuses] = useState([]); const [, setStatuses] = useState([]);
/*const [totalRecordsNum, setTotalRecordsNum] = useState(0);
const [perPageNum, setPerPageNum] = useState(0);
const getPaginationQuery = () => {
return {
"globalFilters": {
"page": 1,
"limit": 5,
"sortBy": {
"columnName": "ID",
"sortDesc": true
}
}
}
}
const onPageChange = (e) => {
console.log('onPageChange', e)
}*/
useEffect(() => { useEffect(() => {
setLocalAsyncRequest(true); setLocalAsyncRequest(true);
BandoService.getBandi(getCallback, errGetCallbacks); BandoService.getBandi(getCallback, errGetCallbacks);
//const paginationQuery = getPaginationQuery();
//BandoService.getBandiPaginated(paginationQuery, getCallback, errGetCallbacks);
}, []); }, []);
const getCallback = (data) => { const getCallback = (data) => {
if (data.status === 'SUCCESS') { if (data.status === 'SUCCESS') {
/*const { body, totalRecords, currentPage, totalPages, pageSize } = data.data;
setTotalRecordsNum(totalRecords);
setPerPageNum(pageSize);
const newItems = body.filter(o => o.status === 'PUBLISH');
setItems(getFormattedBandiData(newItems));
setStatuses(uniq(body.map(o => o.status)));*/
const newItems = data.data.filter(o => o.status === 'PUBLISH'); const newItems = data.data.filter(o => o.status === 'PUBLISH');
setItems(getFormattedBandiData(newItems)); setItems(getFormattedBandiData(newItems));
setStatuses(uniq(data.data.map(o => o.status))) setStatuses(uniq(data.data.map(o => o.status)));
initFilters(); initFilters();
} }
setLocalAsyncRequest(false); setLocalAsyncRequest(false);
@@ -106,7 +132,10 @@ const LatestBandiTable = () => {
return( return(
<div className="appPageSection__table"> <div className="appPageSection__table">
<DataTable value={items} paginator showGridlines rows={10} loading={localAsyncRequest} dataKey="id" <DataTable value={items}
paginator showGridlines
/*lazy totalRecords={totalRecordsNum} onPage={onPageChange}*/
rows={5} loading={localAsyncRequest} dataKey="id"
filters={filters} stripedRows removableSort filters={filters} stripedRows removableSort
header={header} header={header}
emptyMessage={translationStrings.emptyMessage} emptyMessage={translationStrings.emptyMessage}

View File

@@ -103,7 +103,7 @@ const LatestUsersActivityTable = () => {
return( return(
<div className="appPageSection__table"> <div className="appPageSection__table">
<DataTable value={items} paginator showGridlines rows={10} loading={loading} dataKey="id" <DataTable value={items} paginator showGridlines rows={5} loading={loading} dataKey="id"
filters={filters} filters={filters}
globalFilterFields={['name', 'status']} globalFilterFields={['name', 'status']}
header={header} header={header}

View File

@@ -189,7 +189,7 @@ const LatestBandiTable = () => {
return ( return (
<div className="appPageSection__table"> <div className="appPageSection__table">
<DataTable value={items} paginator showGridlines rows={10} loading={loading} dataKey="id" <DataTable value={items} paginator showGridlines rows={5} loading={loading} dataKey="id"
filters={filters} stripedRows removableSort filters={filters} stripedRows removableSort
header={header} header={header}
emptyMessage={translationStrings.emptyMessage} emptyMessage={translationStrings.emptyMessage}

View File

@@ -204,7 +204,7 @@ const MyLatestSubmissionsTable = () => {
return ( return (
<div className="appPageSection__table"> <div className="appPageSection__table">
<DataTable value={items} paginator showGridlines rows={10} loading={localAsyncRequest} dataKey="id" <DataTable value={items} paginator showGridlines rows={5} loading={localAsyncRequest} dataKey="id"
filters={filters} stripedRows removableSort filters={filters} stripedRows removableSort
header={header} header={header}
emptyMessage={translationStrings.emptyMessage} emptyMessage={translationStrings.emptyMessage}

View File

@@ -136,7 +136,7 @@ const PreInstructorDomandeTable = () => {
return( return(
<div className="appPageSection__table"> <div className="appPageSection__table">
<DataTable value={items} paginator showGridlines rows={10} loading={localAsyncRequest} dataKey="id" <DataTable value={items} paginator showGridlines rows={5} loading={localAsyncRequest} dataKey="id"
filters={filters} stripedRows removableSort filters={filters} stripedRows removableSort
header={header} header={header}
emptyMessage={translationStrings.emptyMessage} emptyMessage={translationStrings.emptyMessage}

View File

@@ -150,7 +150,7 @@ const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
return ( return (
<div className="appPageSection__table"> <div className="appPageSection__table">
<DataTable value={items} paginator showGridlines rows={10} loading={localAsyncRequest} dataKey="id" <DataTable value={items} paginator showGridlines rows={5} loading={localAsyncRequest} dataKey="id"
filters={filters} stripedRows removableSort filters={filters} stripedRows removableSort
header={header} header={header}
emptyMessage={translationStrings.emptyMessage} emptyMessage={translationStrings.emptyMessage}

View File

@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { __ } from '@wordpress/i18n'; import { __ } from '@wordpress/i18n';
import { is, uniq } from 'ramda'; import { is, uniq } from 'ramda';
import { Link, useLocation } from 'react-router-dom'; import { Link } from 'react-router-dom';
// api // api
import ApplicationService from '../../../../service/application-service'; import ApplicationService from '../../../../service/application-service';
@@ -29,7 +29,6 @@ const AllDomandeArchiveTable = ({ updaterString = '' }) => {
const [filters, setFilters] = useState(null); const [filters, setFilters] = useState(null);
const [localAsyncRequest, setLocalAsyncRequest] = useState(false); const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
const [statuses, setStatuses] = useState([]); const [statuses, setStatuses] = useState([]);
const location = useLocation();
useEffect(() => { useEffect(() => {
setLocalAsyncRequest(true); setLocalAsyncRequest(true);
@@ -141,7 +140,7 @@ const AllDomandeArchiveTable = ({ updaterString = '' }) => {
return ( return (
<div className="appPageSection__table"> <div className="appPageSection__table">
<DataTable value={items} paginator showGridlines rows={10} loading={localAsyncRequest} dataKey="id" <DataTable value={items} paginator showGridlines rows={5} loading={localAsyncRequest} dataKey="id"
filters={filters} stripedRows removableSort filters={filters} stripedRows removableSort
header={header} header={header}
emptyMessage={translationStrings.emptyMessage} emptyMessage={translationStrings.emptyMessage}

View File

@@ -157,7 +157,7 @@ const BeneficiarioDomandeTable = () => {
return ( return (
<div className="appPageSection__table"> <div className="appPageSection__table">
<DataTable value={items} paginator showGridlines rows={10} loading={localAsyncRequest} dataKey="id" <DataTable value={items} paginator showGridlines rows={5} loading={localAsyncRequest} dataKey="id"
filters={filters} stripedRows removableSort filters={filters} stripedRows removableSort
header={header} header={header}
emptyMessage={translationStrings.emptyMessage} emptyMessage={translationStrings.emptyMessage}

View File

@@ -135,7 +135,7 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
return( return(
<div className="appPageSection__table"> <div className="appPageSection__table">
<DataTable value={items} paginator showGridlines rows={10} loading={localAsyncRequest} dataKey="id" <DataTable value={items} paginator showGridlines rows={5} loading={localAsyncRequest} dataKey="id"
filters={filters} stripedRows removableSort filters={filters} stripedRows removableSort
header={header} header={header}
emptyMessage={translationStrings.emptyMessage} emptyMessage={translationStrings.emptyMessage}

View File

@@ -141,7 +141,7 @@ const AllUsersTable = () => {
return ( return (
<div className="appPageSection__table"> <div className="appPageSection__table">
<DataTable value={users} paginator showGridlines rows={10} loading={loading} dataKey="id" <DataTable value={users} paginator showGridlines rows={5} loading={loading} dataKey="id"
filters={filters} stripedRows removableSort filters={filters} stripedRows removableSort
header={header} header={header}
emptyMessage={translationStrings.emptyMessage} emptyMessage={translationStrings.emptyMessage}

View File

@@ -8,6 +8,10 @@ export default class BandoService {
NetworkService.get(`${API_BASE_URL}/call`, callback, errCallback, queryParams); NetworkService.get(`${API_BASE_URL}/call`, callback, errCallback, queryParams);
}; };
static getBandiPaginated = (body, callback, errCallback, queryParams) => {
NetworkService.post(`${API_BASE_URL}/call/pagination`, body, callback, errCallback, queryParams);
};
static getBando = (id, callback, errCallback, queryParams) => { static getBando = (id, callback, errCallback, queryParams) => {
NetworkService.get(`${API_BASE_URL}/call/${id}`, callback, errCallback, queryParams); NetworkService.get(`${API_BASE_URL}/call/${id}`, callback, errCallback, queryParams);
}; };

View File

@@ -8,6 +8,14 @@ export default class NotificationService {
NetworkService.get(`${API_BASE_URL}/notification/user/${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 getNotificationsPagination = (id, body, callback, errCallback, queryParams) => {
NetworkService.post(`${API_BASE_URL}/notification/user/${id}/pagination`, body, callback, errCallback, queryParams);
};
static notificationMakeRead = (id, callback, errCallback) => { static notificationMakeRead = (id, callback, errCallback) => {
NetworkService.put(`${API_BASE_URL}/notification/${id}`, {}, callback, errCallback, [ NetworkService.put(`${API_BASE_URL}/notification/${id}`, {}, callback, errCallback, [
['status', 'READ'] ['status', 'READ']