- beneficiary notifications pagination added;
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -5,6 +5,10 @@ import { uniq } from 'ramda';
|
||||
// api
|
||||
import BandoService from '../../../../service/bando-service';
|
||||
|
||||
// tools
|
||||
import getTimeParsedFromString from '../../../../helpers/getTimeParsedFromString';
|
||||
import getTimeFromISOstring from '../../../../helpers/getTimeFromISOstring';
|
||||
|
||||
// components
|
||||
import { FilterMatchMode, FilterOperator } from 'primereact/api';
|
||||
import { DataTable } from 'primereact/datatable';
|
||||
@@ -12,10 +16,7 @@ import { Column } from 'primereact/column';
|
||||
import { Button } from 'primereact/button';
|
||||
import { Calendar } from 'primereact/calendar';
|
||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||
import { Link } from 'react-router-dom';
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
import getTimeParsedFromString from '../../../../helpers/getTimeParsedFromString';
|
||||
import getTimeFromISOstring from '../../../../helpers/getTimeFromISOstring';
|
||||
|
||||
|
||||
const LatestBandiTable = () => {
|
||||
@@ -100,12 +101,6 @@ const LatestBandiTable = () => {
|
||||
return <ProperBandoLabel status={rowData.status}/>;
|
||||
};
|
||||
|
||||
const actionsBodyTemplate = (rowData) => {
|
||||
return <Link to={`/bandi/${rowData.id}`}>
|
||||
<Button severity="info" label={__('Modifica', 'gepafin')} icon="pi pi-pencil" size="small" iconPos="right" />
|
||||
</Link>
|
||||
}
|
||||
|
||||
const header = renderHeader();
|
||||
|
||||
return(
|
||||
|
||||
@@ -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']
|
||||
]);
|
||||
};
|
||||
};*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user