feat(loans): Due EMI column + unclip account dropdown - #38
Merged
Conversation
Due EMI shows the rupees owed on exactly the installments Pending EMI counts (unpaid, due on or before this month's end): unpaid principal + unpaid interest, which is what payEmi charges. Late fees are excluded — they're a separate penalty receivable, collected or waived alongside. Both counts now come from one tally helper (src/lib/emi-due.ts) so the two columns can't disagree about which installments are payable. Column is sortable, totalled in the footer, and included in export. Also drops overflow-hidden from the sticky TopBar wrapper, which was clipping the account dropdown; the banner image keeps its own clipping wrapper. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Plain-text version of the paid/total progress ring: "48 / 60" with "20% pending" underneath. Spans the whole schedule, unlike Pending EMI (payable this month). Sorts on % pending; loans with no schedule sort last via a -1 sentinel. Waived installments count as settled — they owe nothing, so leaving them out would report them as forever pending. Both loan pages now fetch the full schedule once and tallyEmiSchedule() derives all three EMI columns in one pass, replacing the pending-only query. UNPAID_EMI_STATUSES is now consumed there rather than duplicated. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Due EMI column
Adds a Due EMI column beside Pending EMI on
/admin/loansand/dashboard/loans.Pending EMI is a count; Due EMI is the money. It sums, over exactly the installments Pending EMI counts (unpaid rows due on or before this month's end):
That is precisely what
payEmicharges. Late fees are excluded — they're a separate penalty receivable, collected (or waived) alongside the EMI rather than being part of it.src/lib/emi-due.ts(new) —installmentOutstanding()+tallyPendingEmi()returning{ count, due }per loan. Both pages now derive the count and the amount from the same query result, so the two columns can't disagree about which installments are payable. Each leg is clamped at ≥0 so an over-applied principal payment can't cancel out interest still owed.formatRupees, amber when more than one installment is stacked up (matching Pending EMI),—for accrual-model loans, with a footer total. Also added to CSV/PDF export with its own total.TopBar dropdown fix
The sticky TopBar wrapper had
overflow-hidden, which clipped the account dropdown — it renders below the bar's box. Removed; the banner image keeps its own clipping wrapper, so the cover-crop behaviour is unchanged. Dropdown also getsz-30to clear page content under thez-20bar.Verification
npm test— 256 passed (7 new insrc/lib/emi-due.test.ts: partials, Postgres numeric-as-string, over-application, grouping)npm run lint— clean (one pre-existing warning inpending-interest-panel.tsx)npm run build— passes🤖 Generated with Claude Code