diff --git a/static/js/index.js b/static/js/index.js index 8ca62b4..471a03d 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -19,7 +19,8 @@ window.app = Vue.createApp({ }, transactionFilter: { user_id: null, // For filtering by user - account_type: null // For filtering by receivable/payable (asset/liability) + account_type: null, // For filtering by receivable/payable (asset/liability) + days: 5 // Number of days to fetch (5, 30, 60, 90) }, accounts: [], currencies: [], @@ -355,6 +356,11 @@ window.app = Vue.createApp({ // Build query params with filters let queryParams = `limit=${limit}&offset=${currentOffset}` + + // Add days filter (default 5) + const days = this.transactionFilter.days || 5 + queryParams += `&days=${days}` + if (this.transactionFilter.user_id) { queryParams += `&filter_user_id=${this.transactionFilter.user_id}` } @@ -389,6 +395,12 @@ window.app = Vue.createApp({ this.transactionPagination.offset = 0 this.loadTransactions(0) }, + setTransactionDays(days) { + // Update days filter and reload from first page + this.transactionFilter.days = days + this.transactionPagination.offset = 0 + this.loadTransactions(0) + }, nextTransactionsPage() { if (this.transactionPagination.has_next) { const newOffset = this.transactionPagination.offset + this.transactionPagination.limit diff --git a/templates/castle/index.html b/templates/castle/index.html index 8d2268d..77c73cb 100644 --- a/templates/castle/index.html +++ b/templates/castle/index.html @@ -336,6 +336,26 @@ + +