[Issue]: New PO Project Code Selection #124
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#124
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
Provide list of Project Codes in drop down menu:
Priority
P2 — Medium
Context
/po/newClaude triage
Triage — Issue #124: New PO Project Code Selection
Type: Feature (enhancement) · Priority: P2 · Page:
/po/newRouting: claude-queue
Request interpretation
The PO create form (
/po/new) currently exposes Project Code as a free-textoptional input. The reporter (a Manager) wants it to be a drop-down restricted to a
known list of project codes:
This is an enhancement to existing behaviour (free-text → constrained select), not a bug —
nothing is broken; the field works today.
Key finding — no schema change needed
projectCodealready exists as a nullable column and is already wired end-to-end:prisma/schema.prisma:560—projectCode String?(already nullable, free text).lib/validations/po.ts:36—projectCode: z.string().optional().formData.get("projectCode")(new / edit /manager-edit) and persist
?? null.So this is a UI-only change: swap the
<input>for a<select>carrying the fivefixed options plus an empty "— none —" option (the field stays optional). No DB migration,
no permissions, no payments, no external systems.
Action items
PROJECT_CODESinlib/validations/po.ts(next to the existing PO constants likeTC_DEFAULTS), so allthree forms import the same list and it is easy to extend later.
<select name="projectCode">(keeping
name="projectCode"so the existing server actions need no change) in allthree PO forms:
app/(portal)/po/new/new-po-form.tsx:163-164app/(portal)/po/[id]/edit/edit-po-form.tsx:199-200app/(portal)/approvals/[id]/manager-edit-po-form.tsx:197-198Include a blank/optional first option since the field is not required.
projectCodethat is not in the new list. Mirror the existing Delivery-Location pattern
(
### Delivery Locations, App/CLAUDE.md): ifpo.projectCodeis set but not in thelist, render it as a leading "(current)" option so it is never silently dropped.
z.enum([...PROJECT_CODES]).optional()inlib/validations/po.ts:36. Defer if it would reject legacy values on edit — keepingz.string().optional()is the safe default and still passes type-check.Files / areas involved
app/(portal)/po/new/new-po-form.tsxapp/(portal)/po/[id]/edit/edit-po-form.tsxapp/(portal)/approvals/[id]/manager-edit-po-form.tsxlib/validations/po.ts(sharedPROJECT_CODESconstant)actions.tsfiles,schema.prisma, orpo-detail.tsx.Acceptance / verification
option; selection persists and displays on PO detail (
po-detail.tsxalready renders it).pnpm type-checkandpnpm lintpass.Open questions (non-blocking — sensible defaults chosen)
shared constant is the proportionate choice. An admin-managed table (like sites /
delivery locations) would be a larger feature + migration — out of scope for this P2.
Default: hardcode.
avoid rejecting legacy values on edit (see action item 4).
Routing rationale: localized UI-only change (free-text input → fixed-list select) on an
already-existing nullable column — no migration, auth, payments, or external systems —
with clear acceptance verifiable by type-check/lint/existing tests, so it routes to
claude-queue.
Routing:
claude-queue| Type:feature[Claude] Started working on this issue on branch
claude/issue-124.[Claude] Opened PR #126 with a proposed fix. Review and merge it, then create a release tag to deploy.