Merge pull request 'fix: Closed PO list filters are wrong for manager and submitter' (#21) from claude/issue-6 into master
Reviewed-on: https://git.pelagiamarine.com/shad0w/pelagia-portal/pulls/21
This commit is contained in:
commit
600f637de2
1 changed files with 5 additions and 4 deletions
|
|
@ -15,11 +15,12 @@ export default async function MyOrdersPage() {
|
||||||
const { role, id: userId } = session.user;
|
const { role, id: userId } = session.user;
|
||||||
if (!["TECHNICAL", "MANNING", "MANAGER", "SUPERUSER"].includes(role)) redirect("/dashboard");
|
if (!["TECHNICAL", "MANNING", "MANAGER", "SUPERUSER"].includes(role)) redirect("/dashboard");
|
||||||
|
|
||||||
|
const isManager = role === "MANAGER" || role === "SUPERUSER";
|
||||||
|
|
||||||
const closed = await db.purchaseOrder.findMany({
|
const closed = await db.purchaseOrder.findMany({
|
||||||
where: {
|
where: isManager
|
||||||
submitterId: userId,
|
? { status: "CLOSED" }
|
||||||
status: { in: ["MGR_APPROVED", "SENT_FOR_PAYMENT", "PAID_DELIVERED", "CLOSED", "REJECTED"] },
|
: { submitterId: userId, status: "CLOSED" },
|
||||||
},
|
|
||||||
orderBy: { updatedAt: "desc" },
|
orderBy: { updatedAt: "desc" },
|
||||||
include: {
|
include: {
|
||||||
vessel: { select: { name: true } },
|
vessel: { select: { name: true } },
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue