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: don't show configurator if the item is temporary

Brad Barbin640ac588e436
diff --git a/apps/carbon/app/modules/items/ui/Item/BillOfMaterial.tsx b/apps/carbon/app/modules/items/ui/Item/BillOfMaterial.tsx
index 61113001d0..4c0b47defb 100644
--- a/apps/carbon/app/modules/items/ui/Item/BillOfMaterial.tsx
+++ b/apps/carbon/app/modules/items/ui/Item/BillOfMaterial.tsx
@@ -430,7 +430,7 @@ const BillOfMaterial = ({
>
Add Material
</Button>
- {configurable && (
+ {configurable && materials.length > 0 && (
<IconButton
icon={<LuFunctionSquare />}
aria-label="Configure"
@@ -439,21 +439,16 @@ const BillOfMaterial = ({
rulesByField.has("billOfMaterial") &&
"text-emerald-500 hover:text-emerald-500"
)}
- onClick={
- configurable
- ? () =>
- onConfigure({
- label: "Bill of Material",
- field: "billOfMaterial",
- code: rulesByField.get("billOfMaterial")?.code,
- returnType: {
- type: "list",
- listOptions: materials.map(
- (m) => m.data.itemReadableId!
- ),
- },
- })
- : undefined
+ onClick={() =>
+ onConfigure({
+ label: "Bill of Material",
+ field: "billOfMaterial",
+ code: rulesByField.get("billOfMaterial")?.code,
+ returnType: {
+ type: "list",
+ listOptions: materials.map((m) => m.data.itemReadableId!),
+ },
+ })
}
/>
)}
@@ -642,7 +637,7 @@ function MaterialForm({
onItemChange(value?.value as string);
}}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () =>
onConfigure({
label: "Part",
@@ -666,7 +661,7 @@ function MaterialForm({
value={itemData.description}
isConfigured={rulesByField.has(key("description"))}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () =>
onConfigure({
label: "Description",
@@ -699,7 +694,7 @@ function MaterialForm({
value={itemData.methodType}
isConfigured={rulesByField.has(key("methodType"))}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () =>
onConfigure({
label: "Method Type",
@@ -720,7 +715,7 @@ function MaterialForm({
label="Quantity"
isConfigured={rulesByField.has(key("quantity"))}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () =>
onConfigure({
label: "Quantity",
@@ -743,7 +738,7 @@ function MaterialForm({
}
isConfigured={rulesByField.has(key("unitOfMeasureCode"))}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () =>
onConfigure({
label: "Unit of Measure",
diff --git a/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx b/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx
index 099ed17067..fce9447b75 100644
--- a/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx
+++ b/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx
@@ -597,7 +597,7 @@ const BillOfProcess = ({
>
Add Operation
</Button>
- {configurable && (
+ {configurable && operations.length > 0 && (
<IconButton
icon={<LuFunctionSquare />}
aria-label="Configure"
@@ -606,19 +606,16 @@ const BillOfProcess = ({
rulesByField.has("billOfProcess") &&
"text-emerald-500 hover:text-emerald-500"
)}
- onClick={
- configurable
- ? () =>
- onConfigure({
- label: "Bill of Process",
- field: "billOfProcess",
- code: rulesByField.get("billOfProcess")?.code,
- returnType: {
- type: "list",
- listOptions: operations.map((op) => op.description),
- },
- })
- : undefined
+ onClick={() =>
+ onConfigure({
+ label: "Bill of Process",
+ field: "billOfProcess",
+ code: rulesByField.get("billOfProcess")?.code,
+ returnType: {
+ type: "list",
+ listOptions: operations.map((op) => op.description),
+ },
+ })
}
/>
)}
@@ -824,7 +821,7 @@ function OperationForm({
label="Process"
isConfigured={rulesByField.has(key("processId"))}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () => {
onConfigure({
label: "Process",
@@ -891,7 +888,7 @@ function OperationForm({
}}
isConfigured={rulesByField.has(key("operationType"))}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () => {
onConfigure({
label: "Operation Type",
@@ -918,7 +915,7 @@ function OperationForm({
className="col-span-2"
isConfigured={rulesByField.has(key("description"))}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () => {
onConfigure({
label: "Description",
@@ -950,7 +947,7 @@ function OperationForm({
}}
isConfigured={rulesByField.has(key("operationOrder"))}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () => {
onConfigure({
label: "Operation Order",
@@ -1019,7 +1016,7 @@ function OperationForm({
}}
isConfigured={rulesByField.has(key("setupUnitHint"))}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () => {
onConfigure({
label: "Setup Unit",
@@ -1048,7 +1045,7 @@ function OperationForm({
}
isConfigured={rulesByField.has(key("setupTime"))}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () => {
onConfigure({
label: "Setup Time",
@@ -1076,7 +1073,7 @@ function OperationForm({
}}
isConfigured={rulesByField.has(key("setupUnit"))}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () => {
onConfigure({
label: "Setup Unit",
@@ -1145,7 +1142,7 @@ function OperationForm({
}}
isConfigured={rulesByField.has(key("laborUnitHint"))}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () => {
onConfigure({
label: "Labor Unit",
@@ -1174,7 +1171,7 @@ function OperationForm({
}
isConfigured={rulesByField.has(key("laborTime"))}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () => {
onConfigure({
label: "Labor Time",
@@ -1202,7 +1199,7 @@ function OperationForm({
}}
isConfigured={rulesByField.has(key("laborUnit"))}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () => {
onConfigure({
label: "Labor Unit",
@@ -1272,7 +1269,7 @@ function OperationForm({
}}
isConfigured={rulesByField.has(key("machineUnitHint"))}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () => {
onConfigure({
label: "Machine Unit",
@@ -1301,7 +1298,7 @@ function OperationForm({
}
isConfigured={rulesByField.has(key("machineTime"))}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () => {
onConfigure({
label: "Machine Time",
@@ -1329,7 +1326,7 @@ function OperationForm({
}}
isConfigured={rulesByField.has(key("machineUnit"))}
onConfigure={
- configurable
+ configurable && !isTemporaryId(item.id)
? () => {
onConfigure({
label: "Machine Unit",