Enhanced the Interest Processing tab in the Admin Dashboard with a comprehensive, user-friendly interface for managing automated and manual interest calculations for both savings accounts and fixed deposits.
January 2025
Four compact cards displaying real-time status:
- Visual Status Badge: "Running" (green) or "Stopped" (gray)
- Current System Time: Real-time timestamp
- Helps admins quickly see if automated tasks are active
- Shows the scheduled datetime for next savings interest calculation
- Formatted as readable local time
- Allows admins to plan manual interventions
- Shows the scheduled datetime for next FD interest calculation
- Formatted as readable local time
- Provides visibility into automation schedule
- Start Button: Enables automated interest calculations
- Disabled when scheduler is already running
- Green primary button
- Stop Button: Disables automated interest calculations
- Disabled when scheduler is stopped
- Red destructive variant
- Side-by-side layout for quick control
- Icon: Green trending-up arrow (symbolizes growth)
- Description: Clear explanation of what the action does
- Action Button:
- Shows "Calculating..." with spinner when active
- Shows "Calculate Savings Interest" when idle
- Full width with outline variant
- Disabled during processing
- Use Case: Calculate monthly interest for all eligible savings accounts
- Icon: Blue dollar sign (symbolizes money/deposits)
- Description: Explains FD interest calculation process
- Action Button:
- Shows "Calculating..." with spinner when active
- Shows "Calculate FD Interest" when idle
- Full width with outline variant
- Disabled during processing
- Use Case: Process interest for FDs due for monthly/maturity payments
- Icon: Purple trending-up arrow (symbolizes completion)
- Description: Explains maturity processing
- Action Button:
- Shows "Processing..." with spinner when active
- Shows "Mature Fixed Deposits" when idle
- Full width with outline variant
- Disabled during processing
- Use Case: Process matured FDs and return principal + interest
-
Load Button:
- Shows "Loading..." when fetching data
- Left-aligned with BarChart icon
- Triggers API call to fetch pending savings accounts
-
Report Display (Green theme):
- Month/Year badge (e.g., "2025-01")
- Grid Layout with 2 metrics:
- Accounts Pending: Large bold number
- Potential Interest: Amount in rupees with 2 decimal places
- Export CSV Button:
- Downloads CSV with UTF-8 BOM
- Filename format:
savings-interest-report-{month_year}.csv - Includes: Account ID, Plan, Balance, Interest Rate, Potential Interest
- Only appears when data is available
-
Load Button:
- Shows "Loading..." when fetching data
- Left-aligned with BarChart icon
- Triggers API call to fetch due FDs
-
Report Display (Blue theme):
- "Current" badge (indicates current due deposits)
- Grid Layout with 2 metrics:
- Deposits Due: Large bold number
- Potential Interest: Amount in rupees with 2 decimal places
- Export CSV Button:
- Downloads CSV with UTF-8 BOM
- Filename format:
fd-interest-report-{current_date}.csv - Includes: FD ID, Account ID, Principal, Interest Rate, Days Since Payout, Potential Interest
- Only appears when data is available
- Centered spinner animation
- "Loading interest report..." message
- Appears while fetching data from backend
Appears when savings interest report is loaded and has data.
- Title: "Savings Accounts Pending Interest"
- Description: Shows month/year and count of pending accounts
- Total Badge: Large outline badge displaying total potential interest
- Right-aligned for prominence
- Sticky Header: Header stays visible while scrolling
- Max Height: 96 (24rem) with vertical scroll
- Responsive: Horizontal scroll on smaller screens
- Hover Effect: Rows highlight on hover
- Account ID: Font-medium, primary identifier
- Plan: Gray text, shows savings plan name
- Balance: Right-aligned, formatted with commas and 2 decimals
- Rate: Center-aligned badge with percentage
- Potential Interest: Right-aligned, bold green text, formatted amount
- Alternating hover backgrounds (gray-50)
- Proper spacing (px-4 py-3)
- All amounts formatted with
toLocaleString()for readability
Appears when FD interest report is loaded and has data.
- Title: "Fixed Deposits Due for Interest"
- Description: Shows count of deposits due
- Total Badge: Large outline badge displaying total potential interest
- Sticky Header: Header stays visible while scrolling
- Max Height: 96 (24rem) with vertical scroll
- Responsive: Horizontal scroll on smaller screens
- Hover Effect: Rows highlight on hover
- FD ID: Font-medium, primary identifier
- Account: Gray text, linked savings account
- Principal: Right-aligned, formatted with commas and 2 decimals
- Rate: Center-aligned badge with percentage
- Days/Periods: Center-aligned, shows days since payout and complete periods
- Interest Due: Right-aligned, bold blue text, formatted amount
- Consistent with savings table
- Proper spacing and formatting
- Clear visual hierarchy
Blue-themed informational card at the bottom.
- Automatic Tasks: Explains scheduled automation
- Manual Calculation: Describes manual processing use cases
- Reports: Explains report functionality
- Fixed Deposit Maturity: Details maturity processing
- Blue background (blue-50)
- Blue border (blue-200)
- Blue text (blue-800)
- Clear visual separation from action areas
All backend endpoints from tasks.py are already integrated:
GET /tasks/status: Fetches scheduler statusPOST /tasks/start: Starts automated tasksPOST /tasks/stop: Stops automated tasksPOST /tasks/calculate-savings-interest: Manual savings interestPOST /tasks/calculate-fd-interest: Manual FD interestPOST /tasks/mature-fds: Process matured FDsGET /tasks/savings-interest-report: Savings accounts pending interestGET /tasks/fd-interest-report: FDs due for interest
Existing React state hooks are used:
taskStatus: Stores scheduler status and next run timessavingsInterestReport: Stores savings interest report datafdInterestReport: Stores FD interest report dataloading: Controls button disabled states during processingreportLoading: Controls report loading states
Savings Interest CSV:
const csvContent = [
['Account ID', 'Plan', 'Balance', 'Interest Rate', 'Potential Interest'].join(','),
...savingsInterestReport.accounts.map((acc: any) =>
[
acc.saving_account_id,
acc.plan_name,
acc.balance,
acc.interest_rate,
acc.potential_monthly_interest
].join(',')
)
].join('\n');
const blob = new Blob(['\uFEFF' + csvContent], {
type: 'text/csv;charset=utf-8;'
});FD Interest CSV:
const csvContent = [
['FD ID', 'Account ID', 'Principal', 'Interest Rate', 'Days Since Payout', 'Potential Interest'].join(','),
...fdInterestReport.deposits.map((dep: any) =>
[
dep.fixed_deposit_id,
dep.saving_account_id,
dep.principal_amount,
dep.interest_rate,
dep.days_since_payout,
dep.potential_interest
].join(',')
)
].join('\n');
const blob = new Blob(['\uFEFF' + csvContent], {
type: 'text/csv;charset=utf-8;'
});Key Features:
- UTF-8 BOM (
\uFEFF) for Excel compatibility - Descriptive headers
- Timestamp in filename
- Browser download trigger
- Desktop (lg+): Two-column layout for actions and reports
- Tablet (md): Four-column status cards, stacked action/report panels
- Mobile: Single column stack, all cards full width
- Button Spinners: Rotating RefreshCw icon during processing
- Report Loading: Centered large spinner with message
- Disabled States: Buttons disabled during operations to prevent double-clicks
- Basic two-column layout
- Minimal status information
- Simple report displays (card format only)
- No CSV export
- No visual distinction between report types
- Limited data visibility (10 items shown, rest hidden)
- Prominent Status Display: 4-card status row at top
- Clear Action Organization: Grouped by purpose with icons
- Visual Hierarchy: Color-coded report cards (green/blue)
- Enhanced Data Visibility: Full scrollable tables with all data
- Export Functionality: One-click CSV download
- Better Loading Feedback: Spinners and disabled states
- Helpful Guidance: Blue help card explains all features
- Professional Tables: Sticky headers, proper formatting, hover effects
- Responsive Layout: Works on all screen sizes
- Scheduler Running: Green badge (default variant)
- Scheduler Stopped: Gray badge (secondary variant)
- Savings Interest: Green theme (green-50 background, green-700 text)
- FD Interest: Blue theme (blue-50 background, blue-700 text)
- Savings Interest: Green trending-up icon
- FD Interest: Blue dollar sign icon
- FD Maturity: Purple trending-up icon
- Interest Amounts: Green text (text-green-600)
- FD Interest Amounts: Blue text (text-blue-600)
- Rate Badges: Outline variant (subtle)
- Tables have
max-h-96(384px) with overflow scroll - Only visible rows rendered in viewport
- Smooth scrolling experience
- No lag even with 100+ records
toLocaleString()used for all currency values- Consistent 2 decimal places for money
- Proper thousand separators
- Reports loaded on-demand (not automatic)
- Status fetched once on tab load
- Manual refresh available for status
- No unnecessary polling
- Scheduler status displays correctly
- Start button enables automated tasks
- Stop button disables automated tasks
- Buttons disabled/enabled based on scheduler state
- Savings interest calculation executes
- FD interest calculation executes
- FD maturity processing executes
- Savings interest report loads
- FD interest report loads
- CSV export for savings report works
- CSV export for FD report works
- CSV files open correctly in Excel
- All amounts formatted with 2 decimals
- Tables scroll properly when data exceeds height
- Hover effects work on table rows
- Status cards display in correct order
- Icons match their functions
- Color coding consistent throughout
- Loading spinners appear during operations
- Buttons show "Calculating..."/"Processing..." during work
- Report cards appear after successful load
- Export buttons only appear when data exists
- Tables have sticky headers
- Help guide is readable and informative
- Layout responsive on mobile devices
- Layout responsive on tablets
- Layout optimal on desktop
- Empty savings report handled gracefully
- Empty FD report handled gracefully
- Report load failure shows error
- Calculation failure shows error
- Very large reports (1000+ rows) render without lag
- Multiple rapid button clicks handled (disabled state)
- CSV export with special characters in data
- Add pagination for tables (if >100 records)
- Add column sorting (click headers to sort)
- Add search/filter within tables
- Add "Process Selected" checkboxes for targeted processing
- Add confirmation dialogs for destructive actions
- Add charts/graphs for interest trends
- Add date range selector for reports
- Add email notification settings
- Add audit log for interest processing
- Add undo/rollback functionality
- Add PDF export option
- Add scheduled report generation
- Add comparison view (month-over-month)
- Add predictive analytics for interest
- Add mobile app push notifications
- CSV_EXPORT_FEATURE.md - CSV export functionality
- Backend/tasks.py - Interest processing endpoints
- MANAGER_DASHBOARD_SUMMARY.md - Manager features
POST /tasks/start
Response: { "message": "Tasks started", "status": { ... } }
POST /tasks/stop
Response: { "message": "Tasks stopped", "status": { ... } }
GET /tasks/status
Response: {
"scheduler_running": bool,
"current_time": "ISO8601",
"next_savings_interest_calculation": "ISO8601",
"next_fd_interest_calculation": "ISO8601"
}POST /tasks/calculate-savings-interest
Response: {
"message": "Calculated interest for X accounts",
"accounts_processed": int,
"total_interest": float
}
POST /tasks/calculate-fd-interest
Response: {
"message": "Calculated interest for X deposits",
"deposits_processed": int,
"total_interest": float
}
POST /tasks/mature-fds
Response: {
"message": "Matured X fixed deposits",
"deposits_matured": int,
"total_returned": float
}GET /tasks/savings-interest-report
Response: {
"month_year": "YYYY-MM",
"total_accounts_pending": int,
"total_potential_interest": float,
"accounts": [
{
"saving_account_id": string,
"plan_name": string,
"balance": float,
"interest_rate": float,
"potential_monthly_interest": float
}
]
}
GET /tasks/fd-interest-report
Response: {
"total_deposits_due": int,
"total_potential_interest": float,
"deposits": [
{
"fixed_deposit_id": string,
"saving_account_id": string,
"principal_amount": float,
"interest_rate": float,
"days_since_payout": int,
"complete_periods": int,
"potential_interest": float
}
]
}For issues or questions related to interest processing functionality, contact the development team or create an issue in the project repository.
Last Updated: January 2025