Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix: rls policy for tools

Brad Barbin0a37748e624f
diff --git a/apps/erp/app/components/InfiniteScroll.tsx b/apps/erp/app/components/InfiniteScroll.tsx
index 04861fb559..fd7ac238ad 100644
--- a/apps/erp/app/components/InfiniteScroll.tsx
+++ b/apps/erp/app/components/InfiniteScroll.tsx
@@ -3,6 +3,7 @@
import { Skeleton } from "@carbon/react";
import { useEffect } from "react";
import { useInView } from "react-intersection-observer";
+import Empty from "./Empty";
interface InfiniteScrollProps<T extends { id: string }> {
component: React.FC<{ item: T }>;
@@ -62,9 +63,13 @@ export default function InfiniteScroll<T extends { id: string }>({
return (
<div className="w-full">
<ul className="relative h-full overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent">
- {items.map((item) => (
- <Component key={item.id} item={item} />
- ))}
+ {items.length === 0 ? (
+ <div className="flex pt-16 justify-center">
+ <Empty />
+ </div>
+ ) : (
+ items.map((item) => <Component key={item.id} item={item} />)
+ )}
<div ref={ref}>{hasMore && <LoadingSkeleton />}</div>
</ul>
</div>
diff --git a/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx b/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
index 1c21835cc1..cf6b63c965 100644
--- a/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
+++ b/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
@@ -412,7 +412,7 @@ const BillOfProcess = ({
},
{
id: 1,
- label: "Work Instructions",
+ label: "Instructions",
content: (
<div className="flex flex-col">
<div>
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
index b15e9e941d..dfc8bd70ec 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
@@ -61,6 +61,7 @@ import {
Assignee,
DirectionAwareTabs,
EmployeeAvatar,
+ Empty,
TimeTypeIcon,
} from "~/components";
import Activity from "~/components/Activity";
@@ -627,7 +628,7 @@ const JobBillOfProcess = ({
},
{
id: 1,
- label: "Work Instructions",
+ label: "Instructions",
content: (
<div className="flex flex-col">
<div>
@@ -1966,57 +1967,63 @@ function OperationChat({ jobOperationId }: { jobOperationId: string }) {
<ScrollArea className="flex-1 p-4">
<Loading isLoading={isLoading}>
<div className="flex flex-col gap-3">
- {messages.map((m) => {
- const createdBy = employees.find(
- (employee) => employee.id === m.createdBy
- );
- const isUser = m.createdBy === user.id;
- return (
- <div
- key={m.id}
- className={cn(
- "flex gap-2 items-end",
- isUser && "flex-row-reverse"
- )}
- >
- <Avatar
- src={createdBy?.avatarUrl ?? undefined}
- name={createdBy?.name}
- />
-
- <div className="flex flex-col gap-1 max-w-[80%] ">
- <div className="flex flex-col gap-1">
- {!isUser && (
- <span className="text-xs opacity-70">
- {createdBy?.name}
- </span>
- )}
- <div
- className={cn(
- "rounded-2xl p-3 w-full flex flex-col gap-1",
- isUser ? "bg-blue-500 text-white" : "bg-muted"
+ {messages.length === 0 ? (
+ <div className="flex justify-center pt-16">
+ <Empty />
+ </div>
+ ) : (
+ messages.map((m) => {
+ const createdBy = employees.find(
+ (employee) => employee.id === m.createdBy
+ );
+ const isUser = m.createdBy === user.id;
+ return (
+ <div
+ key={m.id}
+ className={cn(
+ "flex gap-2 items-end",
+ isUser && "flex-row-reverse"
+ )}
+ >
+ <Avatar
+ src={createdBy?.avatarUrl ?? undefined}
+ name={createdBy?.name}
+ />
+
+ <div className="flex flex-col gap-1 max-w-[80%] ">
+ <div className="flex flex-col gap-1">
+ {!isUser && (
+ <span className="text-xs opacity-70">
+ {createdBy?.name}
+ </span>
)}
- >
- <p className="text-sm">{m.note}</p>
-
- <span className="text-xs opacity-70">
- {new Date(m.createdAt).toLocaleTimeString([], {
- hour: "2-digit",
- minute: "2-digit",
- })}
- </span>
+ <div
+ className={cn(
+ "rounded-2xl p-3 w-full flex flex-col gap-1",
+ isUser ? "bg-blue-500 text-white" : "bg-muted"
+ )}
+ >
+ <p className="text-sm">{m.note}</p>
+
+ <span className="text-xs opacity-70">
+ {new Date(m.createdAt).toLocaleTimeString([], {
+ hour: "2-digit",
+ minute: "2-digit",
+ })}
+ </span>
+ </div>
</div>
</div>
</div>
- </div>
- );
- })}
+ );
+ })
+ )}
<div ref={messagesEndRef} style={{ height: 0 }} />
</div>
</Loading>
</ScrollArea>
- <div className="border-t p-4">
+ <div>
<form className="flex gap-2" onSubmit={handleSubmit}>
<Input
className="flex-1"
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
index 8f1ae5d8a3..baeabb2de2 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
@@ -477,7 +477,7 @@ const QuoteBillOfProcess = ({
},
{
id: 1,
- label: "Work Instructions",
+ label: "Instructions",
content: (
<div className="flex flex-col">
<div>
diff --git a/packages/utils/src/themes.ts b/packages/utils/src/themes.ts
index 116141276a..5af0770c5f 100644
--- a/packages/utils/src/themes.ts
+++ b/packages/utils/src/themes.ts
@@ -89,14 +89,14 @@ export const themes = [
ring: "0 0% 3.9%",
},
dark: {
- background: "0 0% 6.9%",
+ background: "20 33% 4%",
foreground: "0 0% 98%",
card: "0 0% 8.9%",
"card-foreground": "0 0% 98%",
popover: "0 0% 8.9%",
"popover-foreground": "0 0% 98%",
- primary: "30 24% 81%",
- "primary-foreground": "0 0% 9%",
+ primary: "30 24% 94%",
+ "primary-foreground": "0 0% 1%",
active: "30 24% 16%",
"active-foreground": "0 0% 98%",
secondary: "0 0% 14.9%",