diff --git a/App/app/(portal)/my-orders/page.tsx b/App/app/(portal)/my-orders/page.tsx index 1e95f25..2bd44a8 100644 --- a/App/app/(portal)/my-orders/page.tsx +++ b/App/app/(portal)/my-orders/page.tsx @@ -24,6 +24,15 @@ export default async function MyOrdersPage() { include: { vessel: { select: { name: true } }, account: { select: { name: true, code: true } }, + actions: { + where: { + actionType: { in: ["EDITS_REQUESTED", "REJECTED", "APPROVED", "APPROVED_WITH_NOTE"] }, + note: { not: null }, + }, + orderBy: { createdAt: "desc" }, + take: 1, + select: { actor: { select: { name: true } } }, + }, }, }); @@ -62,6 +71,7 @@ type PoRow = { account: { name: string; code: string }; updatedAt: Date; managerNote: string | null; + actions: { actor: { name: string } }[]; }; function PoTable({ title, rows, className = "" }: { title: string; rows: PoRow[]; className?: string }) { @@ -95,7 +105,7 @@ function PoTable({ title, rows, className = "" }: { title: string; rows: PoRow[] {po.managerNote && (
- Note: {po.managerNote} + {po.actions[0]?.actor.name ? `${po.actions[0].actor.name}: ` : "Note: "}{po.managerNote}
)} diff --git a/App/app/(portal)/po/[id]/edit/edit-po-form.tsx b/App/app/(portal)/po/[id]/edit/edit-po-form.tsx index e147848..5ab5394 100644 --- a/App/app/(portal)/po/[id]/edit/edit-po-form.tsx +++ b/App/app/(portal)/po/[id]/edit/edit-po-form.tsx @@ -37,9 +37,10 @@ interface Props { vessels: Vessel[]; accounts: Account[]; vendors: Vendor[]; + managerNoteAuthor?: string | null; } -export function EditPoForm({ po, vessels, accounts, vendors }: Props) { +export function EditPoForm({ po, vessels, accounts, vendors, managerNoteAuthor }: Props) { const router = useRouter(); const [lineItems, setLineItems] = useState