[Issue]: Allow manager to decide payment type for PO #92
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#92
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Raised by
Kaushal Pal Singh (kps@pelagiamarine.com, MANAGER) — via portal Report Issue button
Description
The payment type - complete or partial should be decided upon by the manager approving the PO. There should be below slider when you click approve -
Slider for advance payment - 0 to 100% (Full PO value). By default at 100%.
This data must get added to PO and be visible to accounts once PO is sent for payment
Priority
P2 — Medium
Context
/dashboardClaude triage
Triage — Issue #92: Allow manager to decide payment type (advance %) for PO
Type: Feature (new capability layered onto the existing manager-approval flow)
Routing: interactive
Priority: P2
What's being asked
When a Manager approves a PO, they should be able to set how much of the PO value is to
be paid as an advance — a slider from 0% to 100% of the full PO value, defaulting
to 100% ("complete" vs "partial" payment). This decision must be:
Action items
PurchaseOrderto hold the manager'sadvance decision, e.g.
advancePaymentPercent Decimal @db.Decimal(5,2) @default(100)(or an absolute
advanceAmount). New column ⇒ Prisma schema change + migration +prisma generate. Touchesprisma/schema.prisma,prisma/migrations/.app/(portal)/approvals/[id]/approval-actions.tsx. Currentlydispatch("approve")fires immediately with no intermediate panel, so the "show slider on Approve click"
interaction needs a two-step confirm (like the existing reject / request-edits pattern)
or an always-visible slider above the Approve button.
approvePo()inapp/(portal)/approvals/[id]/actions.tsmust accept and persist the advance value, ideally validated via a new/extended Zod
schema in
lib/validations/po.ts. Record it on thePOActionaudit row (APPROVED).(
app/(portal)/payments/page.tsx) and PO detail (components/po/po-detail.tsx), soAccounts sees the intended advance when the PO reaches
SENT_FOR_PAYMENT. Decidewhether the exported PO/invoice (
lib/po-export-layout.ts) should also reflect it.Number()in theServer Component before passing into any Client Component (slider / display).
Files / areas involved
prisma/schema.prisma+ new migration (prisma/migrations/) — schema changeapp/(portal)/approvals/[id]/approval-actions.tsx— slider UI (client)app/(portal)/approvals/[id]/actions.ts—approvePo()persist + auditlib/validations/po.ts— validate 0–100 rangeapp/(portal)/payments/page.tsx,app/(portal)/payments/actions.ts— Accounts surfacecomponents/po/po-detail.tsx, possiblylib/po-export-layout.ts— displaytests/integration/(approve flow),tests/unit/(slider component)Open questions (need human / business steering)
payments today:
markPaid()accepts apaymentAmount, and the state machine hasPARTIALLY_PAID/mark_partial_payment. Is the manager's advance % meant to cap /pre-fill the first Accounts payment, just be advisory, or drive an automatic split?
This determines whether
markPaid/payment-actions.tsxlogic must change too.totalAmount(Decimal(12,2)).balance — does it still funnel through the normal
PARTIALLY_PAIDloop?Why interactive (not claude-queue)
This is explicitly disqualified on multiple counts: it requires a DB schema migration,
it is a payments/money change, and it carries genuine business-logic ambiguity
(how the manager's advance interacts with the existing Accounts-driven partial-payment
state machine) plus a UI interaction design decision (how/when the slider appears) that
needs visual verification. An unattended run could not safely resolve these without human
steering.
Routing rationale: New payments-related capability requiring a DB migration, money logic, and unresolved business/UX decisions about how the advance interacts with the existing partial-payment flow — needs human steering, so interactive.
Routing:
interactive| Type:feature