Build an expense analytics plugin with chart views and aggregation. Slug: expense-analytics.
Record schema for expenses: vendor (string, required, searchable, sortable), amount (currency, required, sortable),
category (select: Travel, Meals, Supplies, Equipment, Software, Other, required, filterable),
department (select: Engineering, Sales, Marketing, HR, Finance, Operations, required, filterable),
date (date, required, sortable), description (text, searchable), status (select: pending, approved, rejected, default: pending).
Declare views for expenses: table (default: true), chart (chart_type: bar, x_field: category, y_field: amount, aggregate: sum).
THREE navigation tabs: Dashboard, Expenses, Reports.
DASHBOARD shows: total expense count, total approved amount (use aggregate_records with function 'sum'),
top 3 categories by spend, recent 5 expenses.
EXPENSES page: sortable DataTable with server-side ordering by amount and date using order_by parameter.
Use find_records with order_by: { field: 'amount', direction: 'desc' }.
REPORTS page: Two charts — (1) Bar chart of spend by category, (2) Monthly trend line of total spend.
Use aggregate_records for category breakdown and group_records with date_bucket 'month' for the trend.
Render charts using the shared chart partial (render 'shared/plugin_chart_view', chart_json: @chart_data).
Seed 15 expenses across categories and departments with realistic amounts.
Include data_version 1, search_provider for vendor and description.