Update TransactionsPage to match castle extension date range API changes
Synchronized TransactionsPage with castle LNbits extension API updates that introduced custom date range filtering. **API Changes (ExpensesAPI.ts):** - Updated `getUserTransactions()` to support `start_date` and `end_date` parameters (YYYY-MM-DD format) - Custom date range takes precedence over preset days parameter - Updated comment: default changed from 5 to 15 days, options now 15/30/60 (removed 5 and 90) **UI Changes (TransactionsPage.vue):** - **New defaults**: Changed default from 5 days to 15 days - **New preset options**: 15, 30, 60 days (removed 5 and 90 day options) - **Custom date range**: Added "Custom" option with date picker inputs - From/To date inputs using native HTML5 date picker - Apply button to load transactions for custom range - Auto-clears custom dates when switching back to preset days - **State management**: - `dateRangeType` ref supports both numbers (15, 30, 60) and 'custom' string - `customStartDate` and `customEndDate` refs for custom date range - **Smart loading**: Only loads transactions after user provides both dates and clicks Apply **Priority Logic:** - Custom date range (start_date + end_date) takes precedence - Falls back to preset days if custom not selected - Defaults to 15 days if custom selected but dates not provided Matches castle extension implementation exactly (see castle extension git diff in fava_client.py, views_api.py, and static/js/index.js). 🐢 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
509fae1d35
commit
84596e518e
2 changed files with 109 additions and 29 deletions
|
|
@ -404,7 +404,9 @@ export class ExpensesAPI extends BaseService {
|
|||
options?: {
|
||||
limit?: number
|
||||
offset?: number
|
||||
days?: number // 5, 30, 60, or 90
|
||||
days?: number // 15, 30, or 60 (default: 15)
|
||||
start_date?: string // ISO format: YYYY-MM-DD
|
||||
end_date?: string // ISO format: YYYY-MM-DD
|
||||
filter_user_id?: string
|
||||
filter_account_type?: string
|
||||
}
|
||||
|
|
@ -415,7 +417,15 @@ export class ExpensesAPI extends BaseService {
|
|||
// Add query parameters
|
||||
if (options?.limit) url.searchParams.set('limit', String(options.limit))
|
||||
if (options?.offset) url.searchParams.set('offset', String(options.offset))
|
||||
if (options?.days) url.searchParams.set('days', String(options.days))
|
||||
|
||||
// Custom date range takes precedence over days
|
||||
if (options?.start_date && options?.end_date) {
|
||||
url.searchParams.set('start_date', options.start_date)
|
||||
url.searchParams.set('end_date', options.end_date)
|
||||
} else if (options?.days) {
|
||||
url.searchParams.set('days', String(options.days))
|
||||
}
|
||||
|
||||
if (options?.filter_user_id)
|
||||
url.searchParams.set('filter_user_id', options.filter_user_id)
|
||||
if (options?.filter_account_type)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue