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 notes to production events admin ui

Brad Barbina724dba9ecfe
diff --git a/apps/carbon/app/modules/production/production.models.ts b/apps/carbon/app/modules/production/production.models.ts
index 9bcaeba7d9..b2d80b0de8 100644
--- a/apps/carbon/app/modules/production/production.models.ts
+++ b/apps/carbon/app/modules/production/production.models.ts
@@ -402,6 +402,7 @@ export const productionEventValidator = z
workCenterId: zfd.text(z.string().optional()),
startTime: z.string().min(1, { message: "Start time is required" }),
endTime: zfd.text(z.string().optional()),
+ notes: zfd.text(z.string().optional()),
})
.refine(
(data) => {
diff --git a/apps/carbon/app/modules/production/ui/Jobs/ProductionEventForm.tsx b/apps/carbon/app/modules/production/ui/Jobs/ProductionEventForm.tsx
index 63eddbfcd8..cbfcfbecf6 100644
--- a/apps/carbon/app/modules/production/ui/Jobs/ProductionEventForm.tsx
+++ b/apps/carbon/app/modules/production/ui/Jobs/ProductionEventForm.tsx
@@ -1,4 +1,4 @@
-import { ValidatedForm } from "@carbon/form";
+import { TextArea, ValidatedForm } from "@carbon/form";
import {
Button,
Drawer,
@@ -114,6 +114,7 @@ const ProductionEventForm = ({
minValue={startTime}
onChange={setEndTime}
/>
+ <TextArea name="notes" label="Notes" />
</VStack>
</DrawerBody>
<DrawerFooter>
diff --git a/apps/carbon/app/routes/x+/job+/$jobId.events.$id.tsx b/apps/carbon/app/routes/x+/job+/$jobId.events.$id.tsx
index 7f86ceffeb..2a2d726dcc 100644
--- a/apps/carbon/app/routes/x+/job+/$jobId.events.$id.tsx
+++ b/apps/carbon/app/routes/x+/job+/$jobId.events.$id.tsx
@@ -101,6 +101,7 @@ export default function EditProductionEventRoute() {
employeeId: productionEvent?.employeeId ?? "",
workCenterId: productionEvent?.workCenterId ?? "",
endTime: productionEvent?.endTime ?? "",
+ notes: productionEvent?.notes ?? "",
};
return (
diff --git a/apps/carbon/app/routes/x+/job+/$jobId.events.new.tsx b/apps/carbon/app/routes/x+/job+/$jobId.events.new.tsx
index 1525df96c6..850e15e456 100644
--- a/apps/carbon/app/routes/x+/job+/$jobId.events.new.tsx
+++ b/apps/carbon/app/routes/x+/job+/$jobId.events.new.tsx
@@ -93,6 +93,7 @@ export default function NewProductionEventRoute() {
startTime: new Date(new Date().setHours(8, 0, 0, 0)).toISOString(),
employeeId: "",
workCenterId: "",
+ notes: "",
};
return (
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 6088c7ac18..d88ac9ae50 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -11903,7 +11903,7 @@ export type Database = {
endTime: string | null
id: string
jobOperationId: string
- notes: Json | null
+ notes: string | null
startTime: string
type: Database["public"]["Enums"]["productionEventType"] | null
updatedAt: string | null
@@ -11919,7 +11919,7 @@ export type Database = {
endTime?: string | null
id?: string
jobOperationId: string
- notes?: Json | null
+ notes?: string | null
startTime?: string
type?: Database["public"]["Enums"]["productionEventType"] | null
updatedAt?: string | null
@@ -11935,7 +11935,7 @@ export type Database = {
endTime?: string | null
id?: string
jobOperationId?: string
- notes?: Json | null
+ notes?: string | null
startTime?: string
type?: Database["public"]["Enums"]["productionEventType"] | null
updatedAt?: string | null
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 6088c7ac18..d88ac9ae50 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -11903,7 +11903,7 @@ export type Database = {
endTime: string | null
id: string
jobOperationId: string
- notes: Json | null
+ notes: string | null
startTime: string
type: Database["public"]["Enums"]["productionEventType"] | null
updatedAt: string | null
@@ -11919,7 +11919,7 @@ export type Database = {
endTime?: string | null
id?: string
jobOperationId: string
- notes?: Json | null
+ notes?: string | null
startTime?: string
type?: Database["public"]["Enums"]["productionEventType"] | null
updatedAt?: string | null
@@ -11935,7 +11935,7 @@ export type Database = {
endTime?: string | null
id?: string
jobOperationId?: string
- notes?: Json | null
+ notes?: string | null
startTime?: string
type?: Database["public"]["Enums"]["productionEventType"] | null
updatedAt?: string | null
diff --git a/packages/database/supabase/migrations/20241125201554_production-event-notes-text.sql b/packages/database/supabase/migrations/20241125201554_production-event-notes-text.sql
new file mode 100644
index 0000000000..5dbd157fb8
--- /dev/null
+++ b/packages/database/supabase/migrations/20241125201554_production-event-notes-text.sql
@@ -0,0 +1,5 @@
+ALTER TABLE "productionEvent"
+ DROP COLUMN "notes";
+
+ALTER TABLE "productionEvent"
+ ADD COLUMN "notes" TEXT;