add date picker
This commit is contained in:
parent
09a514ae86
commit
82f9b1aac2
8 changed files with 1044 additions and 55 deletions
|
|
@ -59,8 +59,8 @@ const columns = [
|
|||
filterable: true,
|
||||
},
|
||||
{
|
||||
label: "Address",
|
||||
fieldName: "address",
|
||||
label: "Service Address",
|
||||
fieldName: "serviceAddress",
|
||||
type: "text",
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
|
|
@ -69,38 +69,50 @@ const columns = [
|
|||
label: "Issue Description",
|
||||
fieldName: "issueDescription",
|
||||
type: "text",
|
||||
sortable: true,
|
||||
sortable: false,
|
||||
filterable: false,
|
||||
},
|
||||
{
|
||||
label: "Priority",
|
||||
fieldName: "priority",
|
||||
type: "status",
|
||||
sortable: true,
|
||||
filterable: false,
|
||||
},
|
||||
{
|
||||
label: "Status",
|
||||
fieldName: "status",
|
||||
type: "status",
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
label: "Assigned Technician",
|
||||
fieldName: "assignedTechnician",
|
||||
label: "Complaint Date",
|
||||
fieldName: "complaintDate",
|
||||
type: "date",
|
||||
sortable: true,
|
||||
filterable: false,
|
||||
},
|
||||
{
|
||||
label: "Raised By",
|
||||
fieldName: "complaintRaisedBy",
|
||||
type: "text",
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
label: "Date Reported",
|
||||
fieldName: "dateReported",
|
||||
label: "Territory",
|
||||
fieldName: "territory",
|
||||
type: "text",
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
label: "Est. Completion",
|
||||
fieldName: "estimatedCompletionDate",
|
||||
type: "text",
|
||||
label: "Warranty Status",
|
||||
fieldName: "warrantyStatus",
|
||||
type: "status",
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
},
|
||||
];
|
||||
|
||||
|
|
@ -155,21 +167,18 @@ const handleLazyLoad = async (event) => {
|
|||
|
||||
console.log("Making API call with:", { paginationParams, filters });
|
||||
|
||||
// For now, use existing API but we should create a paginated version
|
||||
// TODO: Create Api.getPaginatedWarrantyData() method
|
||||
let data = await Api.getWarrantyData();
|
||||
// Get sorting from store for proper API call
|
||||
const sorting = filtersStore.getTableSorting("warranties");
|
||||
|
||||
// Simulate pagination on client side for now
|
||||
const startIndex = paginationParams.page * paginationParams.pageSize;
|
||||
const endIndex = startIndex + paginationParams.pageSize;
|
||||
const paginatedData = data.slice(startIndex, endIndex);
|
||||
// Use the new paginated API method
|
||||
const result = await Api.getPaginatedWarrantyData(paginationParams, filters, sorting);
|
||||
|
||||
// Update local state
|
||||
tableData.value = paginatedData;
|
||||
totalRecords.value = data.length;
|
||||
tableData.value = result.data;
|
||||
totalRecords.value = result.pagination.total;
|
||||
|
||||
// Update pagination store with new total
|
||||
paginationStore.setTotalRecords("warranties", data.length);
|
||||
paginationStore.setTotalRecords("warranties", result.pagination.total);
|
||||
|
||||
// Cache the result
|
||||
paginationStore.setCachedPage(
|
||||
|
|
@ -180,14 +189,14 @@ const handleLazyLoad = async (event) => {
|
|||
paginationParams.sortOrder,
|
||||
filters,
|
||||
{
|
||||
records: paginatedData,
|
||||
totalRecords: data.length,
|
||||
records: result.data,
|
||||
totalRecords: result.pagination.total,
|
||||
},
|
||||
);
|
||||
|
||||
console.log("Loaded from API:", {
|
||||
records: paginatedData.length,
|
||||
total: data.length,
|
||||
records: result.data.length,
|
||||
total: result.pagination.total,
|
||||
page: paginationParams.page + 1,
|
||||
});
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue