web-app/src/modules/expenses/index.ts
padreug be00c61c77 Add transactions page with fuzzy search and success dialog for expenses
Features:
- Created TransactionsPage with mobile-optimized layout
  - Card-based transaction items with status indicators
  - Fuzzy search by description, payee, reference, username, and tags
  - Day filter options (5, 30, 60, 90 days)
  - Pagination support
  - Responsive design for mobile and desktop
- Added getUserTransactions API method to ExpensesAPI
  - Supports filtering by days, user ID, and account type
  - Returns paginated transaction data
- Updated AddExpense component with success confirmation
  - Shows success message in same dialog after submission
  - Provides option to navigate to transactions page
  - Clean single-dialog approach
- Added "My Transactions" link to navbar menu
- Added Transaction and TransactionListResponse types
- Added permission management types and API methods (grantPermission, listPermissions, revokePermission)
- Installed alert-dialog component for UI consistency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-13 09:57:28 +01:00

71 lines
1.8 KiB
TypeScript

/**
* Expenses Module
*
* Provides expense tracking and submission functionality
* integrated with castle LNbits extension.
*/
import type { App } from 'vue'
import { markRaw } from 'vue'
import type { ModulePlugin } from '@/core/types'
import { container, SERVICE_TOKENS } from '@/core/di-container'
import { ExpensesAPI } from './services/ExpensesAPI'
import AddExpense from './components/AddExpense.vue'
import TransactionsPage from './views/TransactionsPage.vue'
export const expensesModule: ModulePlugin = {
name: 'expenses',
version: '1.0.0',
dependencies: ['base'],
routes: [
{
path: '/expenses/transactions',
name: 'ExpenseTransactions',
component: TransactionsPage,
meta: {
requiresAuth: true,
title: 'My Transactions'
}
}
],
quickActions: [
{
id: 'add-expense',
label: 'Expense',
icon: 'DollarSign',
component: markRaw(AddExpense),
category: 'finance',
order: 10,
requiresAuth: true
}
],
async install(app: App) {
console.log('[Expenses Module] Installing...')
// 1. Create and register service
const expensesAPI = new ExpensesAPI()
container.provide(SERVICE_TOKENS.EXPENSES_API, expensesAPI)
// 2. Initialize service (wait for dependencies)
await expensesAPI.initialize({
waitForDependencies: true,
maxRetries: 3,
retryDelay: 1000
})
console.log('[Expenses Module] ExpensesAPI initialized')
// 3. Register components globally (optional, for use outside quick actions)
app.component('AddExpense', AddExpense)
console.log('[Expenses Module] Installed successfully')
}
}
export default expensesModule
// Export types for use in other modules
export type { Account, AccountNode, ExpenseEntry, ExpenseEntryRequest } from './types'