Merge branch 'develop' into feature/130-table-async

This commit is contained in:
Vitalii Kiiko
2025-02-26 11:11:16 +01:00
14 changed files with 286 additions and 87 deletions

View File

@@ -15,7 +15,7 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table })
return (
<InputNumber
disabled={disabled}
value={initialValue ?? 0}
value={initialValue}
onValueChange={(e) => onChange(e.value)}
onFocus={onFocus}
minFractionDigits={0}

View File

@@ -120,12 +120,14 @@ const Table = ({
? <span className="appForm__field--required">*</span> : null}
</label>
{tableValue
? <RenderTable
columnsCfg={columns}
tableValue={tableValue}
lastRowCfg={lastRow}
setTableValueFn={updateValue}
disabled={disabled}/> : null}
? <div style={{ width: '100%', overflow: 'auto' }}>
<RenderTable
columnsCfg={columns}
tableValue={tableValue}
lastRowCfg={lastRow}
setTableValueFn={updateValue}
disabled={disabled}/>
</div> : null}
</>)
}

View File

@@ -15,7 +15,7 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table })
return (
<InputNumber
disabled={disabled}
value={initialValue ?? 0}
value={initialValue}
onValueChange={(e) => onChange(e.value)}
onFocus={onFocus}
minFractionDigits={0}

View File

@@ -170,12 +170,15 @@ const Table = ({
? <span className="appForm__field--required">*</span> : null}
</label>
{rows
? <RenderTable
columnsCfg={columns}
rowsData={rows}
lastRowCfg={lastRow}
setRowsFn={updateRows}
disabled={disabled}/> : null}
? <div style={{ width: '100%', overflow: 'auto' }}>
<RenderTable
columnsCfg={columns}
rowsData={rows}
lastRowCfg={lastRow}
setRowsFn={updateRows}
disabled={disabled}/>
</div>
: null}
{!isEmpty(columns) && !shouldDisableNewRows
? <div className="addNewTableRow p-button p-component" onClick={addNewRow}>
{__('Aggiungi una riga', 'gepafin')}

View File

@@ -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(() => {