[Issue]: Need separate button for Payment #91
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#91
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
Need separate button to initiate Payment Request.
It should be done together with submission.
Separate approval for payment is required by the Manager.
Payment can be: PART or FULL / ADVANCE / UPON RECEIVING INVOICE / AFTER DELIVERY / 30 DAYS AFTER INVOICE. ALSO PROVISION TO MENTION EXACT SUM DUE FOR PAYMENT TO BE GIVEN
Priority
P1 — High
Context
/dashboardClaude triage
Triage — Issue #91: Need separate button for Payment
Raised by: Kaushal Pal Singh (MANAGER) · Priority: P1 — High · Page:
/dashboardInterpretation
The reporter (a Manager) wants the payment side of a PO to become its own
explicitly-initiated, separately-approved workflow, distinct from the existing PO
approval. Reading the request literally:
submitter also lodges the payment ask).
PO/
approve_postep.PARTorFULL/ADVANCE/UPON RECEIVING INVOICE/AFTER DELIVERY/30 DAYS AFTER INVOICE.e.g. a part/advance amount).
This is effectively a new approval lane parallel to the PO lifecycle, not a cosmetic
button. Several requirements conflict / are underspecified (see Open Questions).
Current state (what exists today)
app/(portal)/po/new/new-po-form.tsx(Save as Draft / Submit forApproval buttons) →
app/(portal)/po/new/actions.tscreatePo. Submit creates the POthen moves it
SUBMITTED → MGR_REVIEW. No payment concept at submit time.lib/po-state-machine.ts. Payment-relevant transitions:MGR_APPROVED → SENT_FOR_PAYMENT(process_payment, ACCOUNTS/SUPERUSER) andSENT_FOR_PAYMENT → PAID_DELIVERED | PARTIALLY_PAID(mark_paid/mark_partial_payment).There is no separate Manager approval of the payment — Accounts initiates payment
directly after PO approval.
app/(portal)/payments/payment-actions.tsx+app/(portal)/payments/actions.ts(processPayment,markPaid). Fields onPurchaseOrder(prisma/schema.prisma):paymentRef,paymentDate,paidAmount.paidAmountalready supports partial settlement.tcPaymentTerms(T&C), default "Within 30 days fromdelivery." No structured enum for ADVANCE / UPON INVOICE / AFTER DELIVERY / etc.
lib/permissions.ts—approve_po(MANAGER/SUPERUSER),process_payment(ACCOUNTS/SUPERUSER/MANAGER). Norequest_payment/approve_payment_request.app/(portal)/dashboard/page.tsx— role-specific stat cards/links only;no payment-request button.
Action items (developer breakdown)
prisma/schema.prisma+ new migration):NET_30_AFTER_INVOICE).
PurchaseOrder: payment term type, requested/exact sum due, paymentrequest status + requested/approved timestamps + approver.
PaymentRequestmodel if multiple requests per PO are intended.)lib/po-state-machine.ts): add a payment-request-approval state /transitions (e.g.
PAYMENT_REQUESTED → PAYMENT_APPROVED) plus required roles, and wireinto the existing flow without breaking current transitions +
POActionaudit trail.lib/permissions.ts): addrequest_payment/approve_payment_requestand assign to roles.new-po-form.tsx,actions.ts,lib/validations/po.ts): add the"Payment Request" button + payment type select + exact-sum input, with Zod validation.
/approvalsand/orPO detail
components/po/po-detail.tsx), plus server actions.dashboard/page.tsx): Manager payment-request queue / button.lib/notifier.ts) and audit trail updates for the new steps.Open questions (need human/business decision)
request raised at submit by the submitter, then approved by the Manager? Or is it a
fully separate button raised later? The two sentences pull in different directions.
replace the Accounts-initiated
process_paymentstep?PO, like the existing
PARTIALLY_PAIDloop) or a single choice at request time?"30 days after invoice" implying a computed due date).
(dashboard, PO detail, submit form, or a new Payments screen).
Routing rationale
Routing rationale: interactive — this is a large, multi-file P1 feature that is
underspecified/ambiguous and squarely touches the excluded areas (a DB migration, the PO
state machine, role permissions, and payments/money), so it needs human steering and
business/design decisions rather than an unattended run.
Routing:
interactive| Type:feature