From 826c44c9967130f26ddbcfc2e8f4d43673819a71 Mon Sep 17 00:00:00 2001 From: Blake Matthes Date: Wed, 11 Jun 2025 20:47:43 -0500 Subject: [PATCH] fix(removed roles): changes to remove the roles and use userRoles instead --- .../admin/user/components/UserCard.tsx | 22 ++++----- .../src/components/production/ocp/Lots.tsx | 46 ++++++++++++------- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/frontend/src/components/admin/user/components/UserCard.tsx b/frontend/src/components/admin/user/components/UserCard.tsx index 8646012..a0ed65d 100644 --- a/frontend/src/components/admin/user/components/UserCard.tsx +++ b/frontend/src/components/admin/user/components/UserCard.tsx @@ -2,15 +2,15 @@ import { LstCard } from "@/components/extendedUI/LstCard"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; -import { - Select, - SelectContent, - SelectGroup, - SelectItem, - SelectLabel, - SelectTrigger, - SelectValue, -} from "@/components/ui/select"; +// import { +// Select, +// SelectContent, +// SelectGroup, +// SelectItem, +// SelectLabel, +// SelectTrigger, +// SelectValue, +// } from "@/components/ui/select"; import { DebugButton } from "@/utils/formStuff/debugButton"; import { userFormOptions } from "@/utils/formStuff/options/userformOptions"; @@ -142,7 +142,7 @@ export default function UserCard(data: any) { ); }} /> - {}}} children={(field) => { @@ -184,7 +184,7 @@ export default function UserCard(data: any) { ); }} - /> + /> */} n.name === "server")[0]?.value || ""; - const roles = ["technician", "admin", "manager", "operator"]; + const roles = ["systemAdmin", "technician", "admin", "manager", "operator"]; const lotdata = data ? data : []; - if (user && roles.includes(user.role)) { + const module = modules.filter((n) => n.name === "logistics"); + + const accessRoles = userRoles.filter( + (n) => n.module_id === module[0]?.module_id + ) as any; + + if (user && roles.includes(accessRoles[0]?.role)) { //width = 1280; const checkCol = lotColumns.some((l) => l.key === "printLabel"); if (!checkCol) { @@ -230,22 +241,25 @@ export default function Lots() { {lot.overPrinting} - {user && roles.includes(user.role) && ( - <> - {server === "usday1vms006" || - server === "localhost" ? ( - <> + {user && + roles.includes(accessRoles[0].role) && ( + <> + {server === "usday1vms006" || + server === "localhost" ? ( + <> + + + + + ) : ( - + - - ) : ( - - - - )} - - )} + )} + + )} ))}