feat(po): manager sets advance payment on approval (#92) #99
No reviewers
Labels
No labels
bug
claude-failed
claude-pr
claude-queue
claude-working
epic
feature
interactive
portal
triaged
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: shad0w/pelagia-portal#99
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/manager-advance-payment"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #92.
Summary
The approving Manager decides how much of the PO is paid first — a 0–100% slider on the approval card (default 100% = full). Per the issue's answered open questions, the slider is convenience only: the absolute amount is what gets stored, it prefills the first Accounts payment, the balance runs the normal partial loop, it's locked at approval, and it is not on the export.
Data
PurchaseOrder.suggestedAdvancePaymentDecimal(12,2), nullable + migration. Null (legacy / no explicit advance) ⇒ full payment, so existing POs are unaffected.Flow
approval-actions.tsx→approvePo): whole-percent slider resolves to ₹amount (100% = exact total, partials rounded to whole rupees); the action clamps to[0, totalAmount], persists it, and records it on theAPPROVEDaudit row. Set once — nothing else writes the field, so it's effectively locked.paymentsqueue +po-detail): the requested advance is surfaced, and it prefills the first payment's amount (only when nothing is paid yet and it's a true partial). The remaining balance then follows the existingPARTIALLY_PAIDloop —markPaidis unchanged.po-export-layout.tsuntouched.Tests
approval-actions.test.ts: persists the advance + audit metadata, defaults to null without an advance, and clamps an over-total amount down to the total.tsc --noEmitclean.Notes
Decimal(12,2)(exact total at 100%, whole rupees for partials).prisma migrate deploy).🤖 Generated with Claude Code