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.

feat: add customer name to mes operation view

Brad Barbine7a52c4bade9
diff --git a/apps/mes/app/components/JobOperation.tsx b/apps/mes/app/components/JobOperation.tsx
index c31810ba8d..bcaa1b846a 100644
--- a/apps/mes/app/components/JobOperation.tsx
+++ b/apps/mes/app/components/JobOperation.tsx
@@ -175,6 +175,7 @@ import {
LuPrinter,
LuQrCode,
LuSend,
+ LuSquareUser,
LuTimer,
LuTrash,
LuTriangleAlert,
@@ -227,6 +228,7 @@ export const JobOperation = ({
trackedEntities,
workCenter,
}: JobOperationProps) => {
+ console.log({ job });
const [params, setParams] = useUrlParams();
const trackedEntityParam = params.get("trackedEntityId");
@@ -411,6 +413,12 @@ export const JobOperation = ({
<Heading size="h4">{operation.jobReadableId}</Heading>
<HStack className="justify-end items-center gap-2">
+ {job.customer?.name && (
+ <HStack className="justify-start space-x-2">
+ <LuSquareUser className="text-muted-foreground" />
+ <span className="text-sm truncate">{job.customer.name}</span>
+ </HStack>
+ )}
{operation.description && (
<HStack className="justify-start space-x-2">
<LuClipboardCheck className="text-muted-foreground" />
@@ -1495,6 +1503,20 @@ export const JobOperation = ({
</span>
</HStack>
</VStack>
+ {job.customer?.name && (
+ <VStack spacing={1}>
+ <span className="text-muted-foreground text-xs">
+ Customer
+ </span>
+ <HStack className="justify-start space-x-2">
+ <LuSquareUser className="text-muted-foreground" />
+ <span className="text-sm truncate">
+ {job.customer.name}
+ </span>
+ </HStack>
+ </VStack>
+ )}
+
{operation.description && (
<VStack spacing={1}>
<span className="text-muted-foreground text-xs">
diff --git a/apps/mes/app/services/operations.service.ts b/apps/mes/app/services/operations.service.ts
index 11da9fa174..51940174b4 100644
--- a/apps/mes/app/services/operations.service.ts
+++ b/apps/mes/app/services/operations.service.ts
@@ -187,7 +187,7 @@ export async function getJobByOperationId(
if (operation.error) return operation;
return client
.from("jobs")
- .select("*")
+ .select("*, customer(name)")
.eq("id", operation.data.jobId)
.single();
}