massage data

This commit is contained in:
Casey 2025-11-06 18:24:19 -06:00
parent 616fa1be79
commit 60d3f35988
7 changed files with 174 additions and 48 deletions

View file

@ -44,26 +44,31 @@ const onClick = () => {
};
const filters = {
fullName: { value: null, matchMode: FilterMatchMode.CONTAINS },
addressName: { value: null, matchMode: FilterMatchMode.CONTAINS },
};
const columns = [
{
label: "Name",
fieldName: "fullName",
fieldName: "addressName",
type: "text",
sortable: true,
filterable: true,
},
{
label: "Appt. Scheduled",
fieldName: "appointmentStatus",
fieldName: "appointmentScheduledStatus",
type: "status",
sortable: true,
},
{ label: "Estimate Sent", fieldName: "estimateStatus", type: "status", sortable: true },
{ label: "Payment Received", fieldName: "paymentStatus", type: "status", sortable: true },
{ label: "Job Status", fieldName: "jobStatus", type: "status", sortable: true },
{ label: "Estimate Sent", fieldName: "estimateSentStatus", type: "status", sortable: true },
{
label: "Payment Received",
fieldName: "paymentReceivedStatus",
type: "status",
sortable: true,
},
{ label: "Job Status", fieldName: "jobScheduledStatus", type: "status", sortable: true },
];
// Handle lazy loading events from DataTable
const handleLazyLoad = async (event) => {
@ -125,12 +130,19 @@ const handleLazyLoad = async (event) => {
// Call API with pagination and filters
const result = await Api.getPaginatedClientDetails(paginationParams, filters);
// Update local state
// Update local state - extract from pagination structure
tableData.value = result.data;
totalRecords.value = result.totalRecords;
totalRecords.value = result.pagination.total;
// Update pagination store with new total
paginationStore.setTotalRecords("clients", result.totalRecords);
paginationStore.setTotalRecords("clients", result.pagination.total);
console.log("Updated pagination state:", {
tableData: tableData.value.length,
totalRecords: totalRecords.value,
storeTotal: paginationStore.getTablePagination("clients").totalRecords,
storeTotalPages: paginationStore.getTotalPages("clients"),
});
// Cache the result
paginationStore.setCachedPage(
@ -142,13 +154,13 @@ const handleLazyLoad = async (event) => {
filters,
{
records: result.data,
totalRecords: result.totalRecords,
totalRecords: result.pagination.total,
},
);
console.log("Loaded from API:", {
records: result.data.length,
total: result.totalRecords,
total: result.pagination.total,
page: paginationParams.page + 1,
});
} catch (error) {