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: item ids should be uppercase only

Brad Barbin3df6fb120f50
diff --git a/apps/carbon/app/components/Form/InputControlled.tsx b/apps/carbon/app/components/Form/InputControlled.tsx
index 25b703f818..6a8740f448 100644
--- a/apps/carbon/app/components/Form/InputControlled.tsx
+++ b/apps/carbon/app/components/Form/InputControlled.tsx
@@ -16,6 +16,7 @@ import { forwardRef, useEffect } from "react";
type FormInputControlledProps = Omit<InputProps, "value" | "onChange"> & {
name: string;
label?: string;
+ isUppercase?: boolean;
isRequired?: boolean;
helperText?: string;
prefix?: string;
@@ -36,6 +37,7 @@ const InputControlled = forwardRef<HTMLInputElement, FormInputControlledProps>(
value,
className,
onChange,
+ isUppercase,
...rest
},
ref
@@ -44,13 +46,13 @@ const InputControlled = forwardRef<HTMLInputElement, FormInputControlledProps>(
const [controlValue, setControlValue] = useControlField<string>(name);
useEffect(() => {
- setControlValue(value);
- }, [setControlValue, value]);
+ setControlValue(isUppercase ? uppercase(value) : value);
+ }, [isUppercase, setControlValue, value]);
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
setControlValue(e.target.value);
if (onChange && typeof onChange === "function") {
- onChange(e.target.value);
+ onChange(isUppercase ? uppercase(e.target.value) : e.target.value);
}
};
@@ -83,6 +85,10 @@ const InputControlled = forwardRef<HTMLInputElement, FormInputControlledProps>(
}
);
+function uppercase(value?: string) {
+ return value?.toUpperCase() ?? "";
+}
+
InputControlled.displayName = "InputControlled";
export default InputControlled;
diff --git a/apps/carbon/app/modules/items/ui/Consumables/ConsumableForm.tsx b/apps/carbon/app/modules/items/ui/Consumables/ConsumableForm.tsx
index 472fbcf6e2..dd4e30a743 100644
--- a/apps/carbon/app/modules/items/ui/Consumables/ConsumableForm.tsx
+++ b/apps/carbon/app/modules/items/ui/Consumables/ConsumableForm.tsx
@@ -118,6 +118,7 @@ const ConsumableForm = ({
value={id}
onChange={onIdChange}
isDisabled={loading}
+ isUppercase
autoFocus
/>
)}
diff --git a/apps/carbon/app/modules/items/ui/Fixtures/FixtureForm.tsx b/apps/carbon/app/modules/items/ui/Fixtures/FixtureForm.tsx
index e84d133c8f..e1b3a96750 100644
--- a/apps/carbon/app/modules/items/ui/Fixtures/FixtureForm.tsx
+++ b/apps/carbon/app/modules/items/ui/Fixtures/FixtureForm.tsx
@@ -131,6 +131,7 @@ const FixtureForm = ({
value={id}
onChange={onIdChange}
isDisabled={loading}
+ isUppercase
autoFocus
/>
)}
diff --git a/apps/carbon/app/modules/items/ui/Materials/MaterialForm.tsx b/apps/carbon/app/modules/items/ui/Materials/MaterialForm.tsx
index 8acad0273c..1edf21176f 100644
--- a/apps/carbon/app/modules/items/ui/Materials/MaterialForm.tsx
+++ b/apps/carbon/app/modules/items/ui/Materials/MaterialForm.tsx
@@ -127,6 +127,7 @@ const MaterialForm = ({
value={id}
onChange={onIdChange}
isDisabled={loading}
+ isUppercase
autoFocus
/>
)}
diff --git a/apps/carbon/app/modules/items/ui/Parts/PartForm.tsx b/apps/carbon/app/modules/items/ui/Parts/PartForm.tsx
index e4eb788a47..45d3d31496 100644
--- a/apps/carbon/app/modules/items/ui/Parts/PartForm.tsx
+++ b/apps/carbon/app/modules/items/ui/Parts/PartForm.tsx
@@ -125,6 +125,7 @@ const PartForm = ({ initialValues, type = "card", onClose }: PartFormProps) => {
value={id}
onChange={onIdChange}
isDisabled={loading}
+ isUppercase
autoFocus
/>
)}
diff --git a/apps/carbon/app/modules/items/ui/Services/ServiceForm.tsx b/apps/carbon/app/modules/items/ui/Services/ServiceForm.tsx
index 90b7afa040..f952228337 100644
--- a/apps/carbon/app/modules/items/ui/Services/ServiceForm.tsx
+++ b/apps/carbon/app/modules/items/ui/Services/ServiceForm.tsx
@@ -76,6 +76,7 @@ const ServiceForm = ({ initialValues }: ServiceFormProps) => {
value={id}
onChange={onIdChange}
isDisabled={loading}
+ isUppercase
autoFocus
/>
)}
diff --git a/apps/carbon/app/modules/items/ui/Tools/ToolForm.tsx b/apps/carbon/app/modules/items/ui/Tools/ToolForm.tsx
index 01d18cadd9..8b8deab783 100644
--- a/apps/carbon/app/modules/items/ui/Tools/ToolForm.tsx
+++ b/apps/carbon/app/modules/items/ui/Tools/ToolForm.tsx
@@ -114,6 +114,7 @@ const ToolForm = ({ initialValues, type = "card", onClose }: ToolFormProps) => {
value={id}
onChange={onIdChange}
isDisabled={loading}
+ isUppercase
autoFocus
/>
)}
diff --git a/apps/carbon/app/modules/resources/ui/WorkCenters/WorkCenterForm.tsx b/apps/carbon/app/modules/resources/ui/WorkCenters/WorkCenterForm.tsx
index cff7ee0af1..55ca5ee751 100644
--- a/apps/carbon/app/modules/resources/ui/WorkCenters/WorkCenterForm.tsx
+++ b/apps/carbon/app/modules/resources/ui/WorkCenters/WorkCenterForm.tsx
@@ -107,7 +107,7 @@ const WorkCenterForm = ({
<Number
name="laborRate"
- label="Labor Rate"
+ label="Labor Rate (Hourly)"
formatOptions={{
style: "currency",
currency: "USD",
@@ -115,7 +115,7 @@ const WorkCenterForm = ({
/>
<Number
name="machineRate"
- label="Machine Rate"
+ label="Machine Rate (Hourly)"
formatOptions={{
style: "currency",
currency: "USD",
@@ -123,7 +123,7 @@ const WorkCenterForm = ({
/>
<Number
name="overheadRate"
- label="Overhead Rate"
+ label="Overhead Rate (Hourly)"
formatOptions={{
style: "currency",
currency: "USD",