feat(properties): expenses tab with electricity+water chart
- expense_kind enum (utilities + maintenance/repair/cleaning/insurance/tax/rent/other) - property_expenses table with optional link to a property_accounts row (preserves history via ON DELETE SET NULL) - services/expenses.ts: CRUD + 12-month monthly series aggregation + year-to-date summary by kind - /properties/[id]/expenses tab: inline SVG line chart for electricity + water last 12 months (no chart library), summary card, add/edit/delete inline with account linking when kind matches
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
// Client-safe expense constants. Mirrors expense_kind in schema/_shared.ts.
|
||||
|
||||
export type ExpenseKind =
|
||||
| 'water'
|
||||
| 'electricity'
|
||||
| 'gas'
|
||||
| 'internet'
|
||||
| 'phone'
|
||||
| 'cable'
|
||||
| 'waste'
|
||||
| 'maintenance'
|
||||
| 'repair'
|
||||
| 'cleaning'
|
||||
| 'insurance'
|
||||
| 'tax'
|
||||
| 'rent'
|
||||
| 'other';
|
||||
|
||||
export const EXPENSE_KINDS: readonly ExpenseKind[] = [
|
||||
'electricity',
|
||||
'water',
|
||||
'gas',
|
||||
'internet',
|
||||
'phone',
|
||||
'cable',
|
||||
'waste',
|
||||
'maintenance',
|
||||
'repair',
|
||||
'cleaning',
|
||||
'insurance',
|
||||
'tax',
|
||||
'rent',
|
||||
'other'
|
||||
] as const;
|
||||
|
||||
export const EXPENSE_KIND_LABEL: Record<ExpenseKind, string> = {
|
||||
water: 'Water',
|
||||
electricity: 'Electricity',
|
||||
gas: 'Gas',
|
||||
internet: 'Internet',
|
||||
phone: 'Phone',
|
||||
cable: 'Cable TV',
|
||||
waste: 'Waste',
|
||||
maintenance: 'Maintenance',
|
||||
repair: 'Repair',
|
||||
cleaning: 'Cleaning',
|
||||
insurance: 'Insurance',
|
||||
tax: 'Tax',
|
||||
rent: 'Rent',
|
||||
other: 'Other'
|
||||
};
|
||||
Reference in New Issue
Block a user