diff --git a/App/app/(portal)/dashboard/page.tsx b/App/app/(portal)/dashboard/page.tsx index 8c54ae5..81436d7 100644 --- a/App/app/(portal)/dashboard/page.tsx +++ b/App/app/(portal)/dashboard/page.tsx @@ -63,7 +63,7 @@ async function SubmitterDashboard({ userId }: { userId: string }) { + New Purchase Order - View all my purchase orders → + View closed purchase orders → {recentPos.length > 0 && ( diff --git a/App/app/(portal)/my-orders/page.tsx b/App/app/(portal)/my-orders/page.tsx index a0acc52..1e95f25 100644 --- a/App/app/(portal)/my-orders/page.tsx +++ b/App/app/(portal)/my-orders/page.tsx @@ -2,11 +2,11 @@ import { auth } from "@/auth"; import { db } from "@/lib/db"; import { redirect } from "next/navigation"; import Link from "next/link"; -import { formatCurrency, formatDate, PO_STATUS_LABELS, PO_STATUS_VARIANTS } from "@/lib/utils"; +import { formatCurrency, formatDate } from "@/lib/utils"; import { PoStatusBadge } from "@/components/po/po-status-badge"; import type { Metadata } from "next"; -export const metadata: Metadata = { title: "My Purchase Orders" }; +export const metadata: Metadata = { title: "Closed Purchase Orders" }; export default async function MyOrdersPage() { const session = await auth(); @@ -15,8 +15,11 @@ export default async function MyOrdersPage() { const { role, id: userId } = session.user; if (!["TECHNICAL", "MANNING", "MANAGER", "SUPERUSER"].includes(role)) redirect("/dashboard"); - const pos = await db.purchaseOrder.findMany({ - where: { submitterId: userId }, + const closed = await db.purchaseOrder.findMany({ + where: { + submitterId: userId, + status: { in: ["MGR_APPROVED", "SENT_FOR_PAYMENT", "PAID_DELIVERED", "CLOSED", "REJECTED"] }, + }, orderBy: { updatedAt: "desc" }, include: { vessel: { select: { name: true } }, @@ -24,17 +27,10 @@ export default async function MyOrdersPage() { }, }); - const open = pos.filter((p) => - ["DRAFT", "SUBMITTED", "MGR_REVIEW", "VENDOR_ID_PENDING", "EDITS_REQUESTED", "PARTIALLY_CLOSED", "PARTIALLY_PAID"].includes(p.status) - ); - const closed = pos.filter((p) => - ["MGR_APPROVED", "SENT_FOR_PAYMENT", "PAID_DELIVERED", "CLOSED", "REJECTED"].includes(p.status) - ); - return (
You haven't raised any purchase orders yet.
- - Create your first PO → +No closed purchase orders yet.
+ + View active orders on the dashboard →