-
-
- {tabs.map((t) => (
- setStatus(t)}
- className={cn(
- "rounded-full border px-3 py-1.5 text-xs font-medium transition-colors",
- status === t ? "border-primary bg-primary text-primary-foreground" : "border-border text-muted-foreground hover:text-foreground"
- )}
- >
- {t}
-
- ))}
-
-
-
- setSearchInput(e.target.value)}
- placeholder="Filter by customer or slip number"
- className="h-12 w-full lg:max-w-sm"
- />
-
-
- Advanced
-
-
-
-
- {error &&
{error}
}
-
- {!error && rows === null && (
-
- {Array.from({ length: 5 }).map((_, i) => (
-
- ))}
-
- )}
-
- {!error && rows !== null && visibleRows.length === 0 && (
-
-
-
{hasFilters ? "No slips match your filters." : "No slips yet."}
-
- )}
-
- {!error && rows !== null && visibleRows.length > 0 && (
- <>
-
-
-
-
- Slip
- Customer
- Date
- Status
- Lines
- Gross
- Discount
- Net
- Actions
-
-
-
- {visibleRows.map((row) => (
-
-
-
- {row.slipNo}
-
-
- {row.customerSnapshotName}
- {new Date(row.createdAt).toLocaleDateString()}
-
-
- {row.status}
-
-
- {row.totals.freeQtyTotal.toFixed(2)}
- {row.totals.subtotal.toFixed(2)}
- -{row.totals.discountTotal.toFixed(2)}
- {row.totals.grandTotal.toFixed(2)}
-
-
-
-
-
-
-
-
- ))}
-
-
-
-
-
-
-
-
Gross total
-
{grossTotal.toFixed(2)}
-
-
-
Discount total
-
-{discountTotal.toFixed(2)}
-
-
-
Net total
-
{netTotal.toFixed(2)}
-
-
-
-
- {pagination && pagination.totalPages > 1 && (
-
-
- Showing {(pagination.page - 1) * pagination.pageSize + 1}-{Math.min(pagination.page * pagination.pageSize, pagination.totalItems)} of {pagination.totalItems}
-
-
- setPage((p) => Math.max(1, p - 1))}>
-
- Previous
-
- Page {pagination.page} of {pagination.totalPages}
- = pagination.totalPages} onClick={() => setPage((p) => Math.min(pagination.totalPages, p + 1))}>
- Next
-
-
-
-
- )}
- >
- )}
-