feat(dashboard): add pending/upcoming expenses table
- Backend: GET /expenses/pending-upcoming returns PENDING expenses with dueDate <= today+5 days, classified as overdue/upcoming - DashboardExpensesTable: groups by periodicExpenseId, shows summed totals with status badges, links to /expenses?periodicExpenseId=X - Expenses route accepts ?periodicExpenseId search param and pre-selects it in the filter - fix: BeloAnalysisPage DatePicker type mismatch
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
getTotalPending,
|
||||
importPeriodicExpenses,
|
||||
importExpenses,
|
||||
getPendingUpcomingExpenses,
|
||||
type CreatePeriodicExpenseInput, type CreateNonPeriodicExpenseInput, type PayExpenseInput,
|
||||
} from "./api";
|
||||
|
||||
@@ -92,6 +93,7 @@ export const expenseKeys = {
|
||||
monthlyTotal: (year: number, month: number) => ["expenses", "monthly-total", year, month] as const,
|
||||
monthlyTotals: (year: number, month: number) => ["expenses", "totals", year, month] as const,
|
||||
totalPending: ["expenses", "pending-total"] as const,
|
||||
pendingUpcoming: ["expenses", "pending-upcoming"] as const,
|
||||
};
|
||||
|
||||
export function usePeriodicExpenses() {
|
||||
@@ -163,6 +165,13 @@ export function useMonthlyTotals(year: number, month: number) {
|
||||
});
|
||||
}
|
||||
|
||||
export function usePendingUpcomingExpenses() {
|
||||
return useQuery({
|
||||
queryKey: expenseKeys.pendingUpcoming,
|
||||
queryFn: getPendingUpcomingExpenses,
|
||||
});
|
||||
}
|
||||
|
||||
export function useTotalPending() {
|
||||
return useQuery({
|
||||
queryKey: expenseKeys.totalPending,
|
||||
|
||||
Reference in New Issue
Block a user