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 ability to edit shelf in job properties

Brad Barbin7ef5a2986175
diff --git a/apps/erp/app/components/Form/Shelf.tsx b/apps/erp/app/components/Form/Shelf.tsx
index 62291c88c8..48c96cdf9f 100644
--- a/apps/erp/app/components/Form/Shelf.tsx
+++ b/apps/erp/app/components/Form/Shelf.tsx
@@ -8,8 +8,12 @@ import ShelfForm from "~/modules/inventory/ui/Shelves/ShelfForm";
import type { ListItem } from "~/types";
import { path } from "~/utils/path";
-type ShelfSelectProps = Omit<ComboboxProps, "options" | "onChange"> & {
+type ShelfSelectProps = Omit<
+ ComboboxProps,
+ "options" | "onChange" | "inline"
+> & {
locationId?: string;
+ inline?: boolean;
onChange?: (shelf: ListItem | null) => void;
};
@@ -18,7 +22,7 @@ const ShelfPreview = (
options: { value: string; label: string }[]
) => {
const shelf = options.find((o) => o.value === value);
- if (!shelf) return null;
+ if (!shelf) return "Inventory";
return shelf.label;
};
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx b/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx
index 45135081de..0f5d36825d 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx
@@ -31,6 +31,7 @@ import {
Customer,
Item,
Location,
+ Shelf,
Tags,
UnitOfMeasure,
} from "~/components/Form";
@@ -500,6 +501,25 @@ const JobProperties = () => {
/>
</ValidatedForm>
+ <ValidatedForm
+ defaultValues={{ shelfId: routeData?.job?.shelfId ?? undefined }}
+ validator={z.object({
+ shelfId: zfd.text(z.string().optional()),
+ })}
+ className="w-full"
+ >
+ <Shelf
+ label="Shelf"
+ name="shelfId"
+ inline
+ locationId={routeData?.job?.locationId ?? undefined}
+ isReadOnly={isDisabled}
+ onChange={(value) => {
+ onUpdate("shelfId", value?.id ?? null);
+ }}
+ />
+ </ValidatedForm>
+
<ValidatedForm
defaultValues={{
tags: routeData?.job.tags ?? [],
diff --git a/apps/erp/app/routes/x+/job+/update.tsx b/apps/erp/app/routes/x+/job+/update.tsx
index 90f59e3b64..bacf1c75bc 100644
--- a/apps/erp/app/routes/x+/job+/update.tsx
+++ b/apps/erp/app/routes/x+/job+/update.tsx
@@ -130,6 +130,7 @@ export async function action({ request }: ActionFunctionArgs) {
case "dueDate":
case "jobId":
case "locationId":
+ case "shelfId":
case "startDate":
case "unitOfMeasureCode":
return json(