feat(cashier): add server-side pagination to GL entries closing report

- Backend: add offset/limit query params to gl-entries endpoint
- Backend: return totalFilteredRecords + pageItems response structure
- Backend: totals (DR/CR) computed from all records regardless of page
- Frontend: integrate mat-paginator with page size options 10/20/50/100
- Frontend: reset offset to 0 on filter change

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jaanu423
2026-06-10 15:52:15 +05:30
co-authored by Claude Sonnet 4.6
parent 05cbe21542
commit de420bb8ab
3 changed files with 43 additions and 6 deletions
@@ -10,6 +10,7 @@ import { Component, OnInit, inject } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { MatIconModule } from '@angular/material/icon';
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
import { CashierService } from '../cashier.service';
/** Day-wise denomination-wise closing cash collected from deposits. */
@@ -21,7 +22,8 @@ import { CashierService } from '../cashier.service';
imports: [
CommonModule,
FormsModule,
MatIconModule
MatIconModule,
MatPaginatorModule
]
})
export class ClosingCashReportComponent implements OnInit {
@@ -44,6 +46,17 @@ export class ClosingCashReportComponent implements OnInit {
glLoading = false;
glLoaded = false;
// GL Pagination
glTotal = 0;
glOffset = 0;
glPageSize = 20;
glPageSizeOptions = [
10,
20,
50,
100
];
// Filters for GL
tellers: any[] = [];
cashiers: any[] = [];
@@ -111,22 +124,37 @@ export class ClosingCashReportComponent implements OnInit {
error: () => {}
});
}
this.glOffset = 0;
this.glLoaded = false;
this.loadGl();
}
onCashierChange(): void {
this.glOffset = 0;
this.glLoaded = false;
this.loadGl();
}
onGlPageChange(event: PageEvent): void {
this.glPageSize = event.pageSize;
this.glOffset = event.pageIndex * event.pageSize;
this.loadGl();
}
loadGl(): void {
this.glLoading = true;
this.service
.getGlEntries(this.date, this.selectedCashierId || undefined, this.selectedTellerId || undefined)
.getGlEntries(
this.date,
this.selectedCashierId || undefined,
this.selectedTellerId || undefined,
this.glOffset,
this.glPageSize
)
.subscribe({
next: (res: any) => {
this.glRows = res?.rows || [];
this.glRows = res?.pageItems || [];
this.glTotal = Number(res?.totalFilteredRecords || 0);
this.glTotalDr = Number(res?.totalDr || 0);
this.glTotalCr = Number(res?.totalCr || 0);
this.glLoading = false;
@@ -134,6 +162,7 @@ export class ClosingCashReportComponent implements OnInit {
},
error: () => {
this.glRows = [];
this.glTotal = 0;
this.glTotalDr = 0;
this.glTotalCr = 0;
this.glLoading = false;