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 close process on save

Brad Barbinecec8511388f
diff --git a/apps/erp/app/modules/items/items.models.ts b/apps/erp/app/modules/items/items.models.ts
index 3d0efd3f47..f7ac782d8f 100644
--- a/apps/erp/app/modules/items/items.models.ts
+++ b/apps/erp/app/modules/items/items.models.ts
@@ -216,7 +216,7 @@ export const methodMaterialValidator = z.object({
export const methodOperationValidator = z
.object({
- id: zfd.text(z.string().optional()),
+ id: z.string().min(1, { message: "Operation ID is required" }),
makeMethodId: z.string().min(0, { message: "Make method is required" }),
order: zfd.numeric(z.number().min(0)),
operationOrder: z.enum(methodOperationOrders, {
diff --git a/apps/erp/app/modules/items/items.service.ts b/apps/erp/app/modules/items/items.service.ts
index c9705828f6..e0ee1a7226 100644
--- a/apps/erp/app/modules/items/items.service.ts
+++ b/apps/erp/app/modules/items/items.service.ts
@@ -2403,6 +2403,11 @@ export async function upsertMethodOperation(
createdBy: string;
customFields?: Json;
})
+ | (z.infer<typeof methodOperationValidator> & {
+ companyId: string;
+ createdBy: string;
+ customFields?: Json;
+ })
| (Omit<z.infer<typeof methodOperationValidator>, "id"> & {
id: string;
updatedBy: string;
diff --git a/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx b/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
index c158526944..5c9caf2dc8 100644
--- a/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
+++ b/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
@@ -167,7 +167,10 @@ type TemporaryItems = {
[key: string]: Operation;
};
-const initialOperation: Omit<Operation, "makeMethodId" | "order" | "tools"> = {
+const initialOperation: Omit<
+ Operation,
+ "makeMethodId" | "order" | "tools" | "id"
+> = {
description: "",
laborTime: 0,
laborUnit: "Minutes/Piece",
@@ -285,7 +288,7 @@ const BillOfProcess = ({
const onUpdateWorkInstruction = useDebounce(
async (id: string, content: JSONContent) => {
- if (!isTemporaryId(id)) {
+ if (!temporaryItems[id]) {
await carbon
?.from("methodOperation")
.update({
@@ -341,11 +344,11 @@ const BillOfProcess = ({
// Update order state immediately
setOrderState(newOrderState);
- // Only send non-temporary items to the server
+ // Only send saved items to the server (exclude temporary items)
const updates = Object.entries(newOrderState).reduce<
Record<string, number>
>((acc, [id, order]) => {
- if (!isTemporaryId(id)) {
+ if (!temporaryItems[id]) {
acc[id] = order;
}
return acc;
@@ -368,7 +371,7 @@ const BillOfProcess = ({
);
const onAddItem = () => {
- const temporaryId = Math.random().toString(16).slice(2);
+ const operationId = nanoid();
let newOrder = 1;
if (operations.length) {
@@ -377,16 +380,16 @@ const BillOfProcess = ({
const newOperation: Operation = {
...initialOperation,
- id: temporaryId,
+ id: operationId,
order: newOrder,
makeMethodId,
};
setTemporaryItems((prev) => ({
...prev,
- [temporaryId]: newOperation,
+ [operationId]: newOperation,
}));
- setSelectedItemId(temporaryId);
+ setSelectedItemId(operationId);
};
const onRemoveItem = async (id: string) => {
@@ -395,7 +398,8 @@ const BillOfProcess = ({
const operation = operationsById.get(id);
if (!operation) return;
- if (isTemporaryId(id)) {
+ // Check if this is a temporary item (exists in temporaryItems state)
+ if (temporaryItems[id]) {
setTemporaryItems((prev) => {
const { [id]: _, ...rest } = prev;
return rest;
@@ -464,6 +468,7 @@ const BillOfProcess = ({
item={item}
rulesByField={rulesByField}
workInstruction={workInstructions[item.id] ?? {}}
+ temporaryItems={temporaryItems}
onConfigure={onConfigure}
setSelectedItemId={setSelectedItemId}
setTemporaryItems={setTemporaryItems}
@@ -492,7 +497,10 @@ const BillOfProcess = ({
)}
</span>
),
- disabled: hasProcedure || item.data.operationType === "Outside",
+ disabled:
+ item.id in temporaryItems ||
+ hasProcedure ||
+ item.data.operationType === "Outside",
content: (
<div className="flex flex-col">
<div>
@@ -528,7 +536,10 @@ const BillOfProcess = ({
},
{
id: 2,
- disabled: hasProcedure || item.data.operationType === "Outside",
+ disabled:
+ item.id in temporaryItems ||
+ hasProcedure ||
+ item.data.operationType === "Outside",
label: (
<span className="flex items-center gap-2">
<span>Parameters</span>
@@ -554,10 +565,11 @@ const BillOfProcess = ({
<ParametersForm
parameters={parameters}
operationId={item.id!}
+ temporaryItems={temporaryItems}
isDisabled={
isReadOnly ||
selectedItemId === null ||
- isTemporaryId(selectedItemId!)
+ (selectedItemId !== null && !!temporaryItems[selectedItemId])
}
configurable={configurable}
rulesByField={rulesByField}
@@ -568,7 +580,10 @@ const BillOfProcess = ({
},
{
id: 3,
- disabled: hasProcedure || item.data.operationType === "Outside",
+ disabled:
+ item.id in temporaryItems ||
+ hasProcedure ||
+ item.data.operationType === "Outside",
label: (
<span className="flex items-center gap-2">
<span>Steps</span>
@@ -594,10 +609,11 @@ const BillOfProcess = ({
<AttributesForm
attributes={attributes}
operationId={item.id!}
+ temporaryItems={temporaryItems}
isDisabled={
isReadOnly ||
selectedItemId === null ||
- isTemporaryId(selectedItemId!)
+ (selectedItemId !== null && !!temporaryItems[selectedItemId])
}
configurable={configurable}
rulesByField={rulesByField}
@@ -608,7 +624,8 @@ const BillOfProcess = ({
},
{
id: 4,
- disabled: item.data.operationType === "Outside",
+ disabled:
+ item.id in temporaryItems || item.data.operationType === "Outside",
label: (
<span className="flex items-center gap-2">
<span>Tools</span>
@@ -620,10 +637,11 @@ const BillOfProcess = ({
<ToolsForm
tools={tools}
operationId={item.id!}
+ temporaryItems={temporaryItems}
isDisabled={
isReadOnly ||
selectedItemId === null ||
- isTemporaryId(selectedItemId!)
+ (selectedItemId !== null && !!temporaryItems[selectedItemId])
}
/>
</div>
@@ -818,16 +836,13 @@ const BillOfProcess = ({
export default BillOfProcess;
-function isTemporaryId(id: string) {
- return id.length < 20;
-}
-
type OperationFormProps = {
configurable: boolean;
isReadOnly: boolean;
item: ItemWithData;
rulesByField: Map<string, ConfigurationRule>;
workInstruction: JSONContent;
+ temporaryItems: TemporaryItems;
onConfigure: (configuration: Configuration) => void;
setSelectedItemId: Dispatch<SetStateAction<string | null>>;
setTemporaryItems: Dispatch<SetStateAction<TemporaryItems>>;
@@ -840,58 +855,28 @@ function OperationForm({
item,
rulesByField,
workInstruction,
+ temporaryItems,
onConfigure,
setSelectedItemId,
setWorkInstructions,
setTemporaryItems,
}: OperationFormProps) {
const methodOperationFetcher = useFetcher<{ id: string }>();
- const { id: userId, company } = useUser();
+ const { company } = useUser();
const { carbon } = useCarbon();
- const addingWorkInstruction = useRef(false);
const baseCurrency = company?.baseCurrencyCode ?? "USD";
useEffect(() => {
- // replace the temporary id with the actual id
+ // Remove from temporary items after successful submission
if (methodOperationFetcher.data && methodOperationFetcher.data.id) {
- if (isTemporaryId(item.id) && carbon && !addingWorkInstruction.current) {
- addingWorkInstruction.current = true;
- carbon
- .from("methodOperation")
- .update({
- workInstruction: workInstruction,
- createdAt: today(getLocalTimeZone()).toString(),
- updatedBy: userId,
- })
- .eq("id", methodOperationFetcher.data.id)
- .then(() => {
- setWorkInstructions((prev) => ({
- ...prev,
- [methodOperationFetcher.data?.id!]: workInstruction,
- }));
- setSelectedItemId(null);
- // Clear temporary item after successful save
- setTemporaryItems((prev) => {
- const { [item.id]: _, ...rest } = prev;
- return rest;
- });
- addingWorkInstruction.current = false;
- });
- } else {
- setSelectedItemId(null);
- }
+ // Clear temporary item after successful save
+ setTemporaryItems((prev) => {
+ const { [item.id]: _, ...rest } = prev;
+ return rest;
+ });
}
- }, [
- item.id,
- methodOperationFetcher.data,
- setSelectedItemId,
- carbon,
- userId,
- workInstruction,
- setTemporaryItems,
- setWorkInstructions,
- ]);
+ }, [item.id, methodOperationFetcher.data, setTemporaryItems]);
const machineDisclosure = useDisclosure();
const laborDisclosure = useDisclosure();
@@ -999,7 +984,7 @@ function OperationForm({
return (
<ValidatedForm
action={
- isTemporaryId(item.id)
+ temporaryItems[item.id]
? path.to.newMethodOperation
: path.to.methodOperation(item.id!)
}
@@ -1008,11 +993,6 @@ function OperationForm({
validator={methodOperationValidator}
className="w-full flex flex-col gap-y-4"
fetcher={methodOperationFetcher}
- onSubmit={() => {
- if (!isTemporaryId(item.id)) {
- setSelectedItemId(null);
- }
- }}
>
<div>
<Hidden name="id" />
@@ -1026,7 +1006,7 @@ function OperationForm({
label="Process"
isConfigured={rulesByField.has(key("processId"))}
onConfigure={
- configurable && !isTemporaryId(item.id)
+ configurable && !temporaryItems[item.id]
? () => {
onConfigure({
label: "Process",
@@ -1063,7 +1043,7 @@ function OperationForm({
}}
isConfigured={rulesByField.has(key("operationOrder"))}
onConfigure={
- configurable && !isTemporaryId(item.id)
+ configurable && !temporaryItems[item.id]
? () => {
onConfigure({
label: "Operation Order",
@@ -1100,7 +1080,7 @@ function OperationForm({
}}
isConfigured={rulesByField.has(key("operationType"))}
onConfigure={
- configurable && !isTemporaryId(item.id)
+ configurable && !temporaryItems[item.id]
? () => {
onConfigure({
label: "Operation Type",
@@ -1127,7 +1107,7 @@ function OperationForm({
className="col-span-2"
isConfigured={rulesByField.has(key("description"))}
onConfigure={
- configurable && !isTemporaryId(item.id)
+ configurable && !temporaryItems[item.id]
? () => {
onConfigure({
label: "Description",
@@ -1205,7 +1185,7 @@ function OperationForm({
processId={processData.processId}
isConfigured={rulesByField.has(key("workCenterId"))}
onConfigure={
- configurable && !isTemporaryId(item.id)
+ configurable && !temporaryItems[item.id]
? () => {
onConfigure({
label: "Work Center",
@@ -1297,7 +1277,7 @@ function OperationForm({
}
isConfigured={rulesByField.has(key("setupTime"))}
onConfigure={
- configurable && !isTemporaryId(item.id)
+ configurable && !temporaryItems[item.id]
? () => {
onConfigure({
label: "Setup Time",
@@ -1325,7 +1305,7 @@ function OperationForm({
}}
isConfigured={rulesByField.has(key("setupUnit"))}
onConfigure={
- configurable && !isTemporaryId(item.id)
+ configurable && !temporaryItems[item.id]
? () => {
onConfigure({
label: "Setup Unit",
@@ -1408,7 +1388,7 @@ function OperationForm({
}
isConfigured={rulesByField.has(key("laborTime"))}
onConfigure={
- configurable && !isTemporaryId(item.id)
+ configurable && !temporaryItems[item.id]
? () => {
onConfigure({
label: "Labor Time",
@@ -1436,7 +1416,7 @@ function OperationForm({
}}
isConfigured={rulesByField.has(key("laborUnit"))}
onConfigure={
- configurable && !isTemporaryId(item.id)
+ configurable && !temporaryItems[item.id]
? () => {
onConfigure({
label: "Labor Unit",
@@ -1520,7 +1500,7 @@ function OperationForm({
}
isConfigured={rulesByField.has(key("machineTime"))}
onConfigure={
- configurable && !isTemporaryId(item.id)
+ configurable && !temporaryItems[item.id]
? () => {
onConfigure({
label: "Machine Time",
@@ -1548,7 +1528,7 @@ function OperationForm({
}}
isConfigured={rulesByField.has(key("machineUnit"))}
onConfigure={
- configurable && !isTemporaryId(item.id)
+ configurable && !temporaryItems[item.id]
? () => {
onConfigure({
label: "Machine Unit",
@@ -1614,7 +1594,7 @@ function OperationForm({
value={processData.procedureId}
isConfigured={rulesByField.has(key("procedureId"))}
onConfigure={
- configurable && !isTemporaryId(item.id)
+ configurable && !temporaryItems[item.id]
? () => {
onConfigure({
label: "Procedure",
@@ -1664,6 +1644,7 @@ function AttributesForm({
configurable,
isDisabled,
attributes,
+ temporaryItems,
rulesByField,
onConfigure,
}: {
@@ -1671,6 +1652,7 @@ function AttributesForm({
configurable: boolean;
isDisabled: boolean;
attributes: OperationAttribute[];
+ temporaryItems: TemporaryItems;
rulesByField: Map<string, ConfigurationRule>;
onConfigure?: (c: Configuration) => void;
}) {
@@ -1715,7 +1697,7 @@ function AttributesForm({
return getPrivateUrl(result.data.path);
};
- if (isDisabled && isTemporaryId(operationId)) {
+ if (isDisabled && temporaryItems[operationId]) {
return (
<Alert className="max-w-[420px] mx-auto my-8">
<LuTriangleAlert />
@@ -2283,6 +2265,7 @@ function ParametersForm({
configurable,
isDisabled,
parameters,
+ temporaryItems,
rulesByField,
onConfigure,
}: {
@@ -2290,12 +2273,13 @@ function ParametersForm({
configurable: boolean;
isDisabled: boolean;
parameters: OperationParameter[];
+ temporaryItems: TemporaryItems;
rulesByField: Map<string, ConfigurationRule>;
onConfigure?: (c: Configuration) => void;
}) {
const fetcher = useFetcher<typeof newMethodOperationParameterAction>();
- if (isDisabled && isTemporaryId(operationId)) {
+ if (isDisabled && temporaryItems[operationId]) {
return (
<Alert className="max-w-[420px] mx-auto my-8">
<LuTriangleAlert />
@@ -2566,14 +2550,16 @@ function ToolsForm({
operationId,
isDisabled,
tools,
+ temporaryItems,
}: {
operationId: string;
isDisabled: boolean;
tools: OperationTool[];
+ temporaryItems: TemporaryItems;
}) {
const fetcher = useFetcher<typeof newMethodOperationToolAction>();
- if (isDisabled && isTemporaryId(operationId)) {
+ if (isDisabled && temporaryItems[operationId]) {
return (
<Alert className="max-w-[420px] mx-auto my-8">
<LuTriangleAlert />
diff --git a/apps/erp/app/modules/production/production.models.ts b/apps/erp/app/modules/production/production.models.ts
index acb183a9a0..a0931c6136 100644
--- a/apps/erp/app/modules/production/production.models.ts
+++ b/apps/erp/app/modules/production/production.models.ts
@@ -182,7 +182,7 @@ export const salesOrderToJobValidator = baseJobValidator
);
export const baseJobOperationValidator = z.object({
- id: zfd.text(z.string().optional()),
+ id: z.string().min(1, { message: "Operation ID is required" }),
jobMakeMethodId: z
.string()
.min(1, { message: "Quote Make Method is required" }),
diff --git a/apps/erp/app/modules/production/production.service.ts b/apps/erp/app/modules/production/production.service.ts
index 06c4ffaadc..a596cd703a 100644
--- a/apps/erp/app/modules/production/production.service.ts
+++ b/apps/erp/app/modules/production/production.service.ts
@@ -1192,21 +1192,20 @@ export async function upsertJobMaterial(
export async function upsertJobOperation(
client: SupabaseClient<Database>,
jobOperation:
- | (Omit<z.infer<typeof jobOperationValidator>, "id"> & {
+ | (z.infer<typeof jobOperationValidator> & {
jobId: string;
companyId: string;
createdBy: string;
customFields?: Json;
})
- | (Omit<z.infer<typeof jobOperationValidator>, "id"> & {
- id: string;
+ | (z.infer<typeof jobOperationValidator> & {
jobId: string;
companyId: string;
updatedBy: string;
customFields?: Json;
})
) {
- if ("id" in jobOperation) {
+ if ("updatedBy" in jobOperation) {
return client
.from("jobOperation")
.update(sanitize(jobOperation))
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
index dc8d0b689e..9578101f39 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
@@ -175,14 +175,18 @@ type JobBillOfProcessProps = {
function makeItems(
operations: Operation[],
- tags: { name: string }[]
+ tags: { name: string }[],
+ temporaryItems: TemporaryItems
): ItemWithData[] {
- return operations.map((operation) => makeItem(operation, tags));
+ return operations.map((operation) =>
+ makeItem(operation, tags, temporaryItems)
+ );
}
function makeItem(
operation: Operation,
- tags: { name: string }[]
+ tags: { name: string }[],
+ temporaryItems: TemporaryItems
): ItemWithData {
return {
id: operation.id!,
@@ -230,7 +234,7 @@ function makeItem(
)}
</HStack>
),
- footer: isTemporaryId(operation.id ?? "") ? null : (
+ footer: temporaryItems[operation.id!] ? null : (
<HStack className="w-full justify-between">
<HStack>
<JobOperationStatus operation={operation} />
@@ -251,7 +255,7 @@ function makeItem(
const initialOperation: Omit<
Operation,
- "jobMakeMethodId" | "order" | "jobOperationTool"
+ "jobMakeMethodId" | "order" | "jobOperationTool" | "id"
> = {
assignee: null,
description: "",
@@ -407,7 +411,7 @@ const JobBillOfProcess = ({
(a, b) => (orderState[a.id!] ?? a.order) - (orderState[b.id!] ?? b.order)
);
- const items = makeItems(operations, tags).map((item) => ({
+ const items = makeItems(operations, tags, temporaryItems).map((item) => ({
...item,
checked: checkedState[item.id] ?? false,
}));
@@ -425,7 +429,7 @@ const JobBillOfProcess = ({
};
const onAddItem = () => {
- const temporaryId = Math.random().toString(16).slice(2);
+ const operationId = nanoid();
let newOrder = 1;
if (operations.length) {
@@ -434,16 +438,16 @@ const JobBillOfProcess = ({
const newOperation: Operation = {
...initialOperation,
- id: temporaryId,
+ id: operationId,
order: newOrder,
jobMakeMethodId,
};
setTemporaryItems((prev) => ({
...prev,
- [temporaryId]: newOperation,
+ [operationId]: newOperation,
}));
- setSelectedItemId(temporaryId);
+ setSelectedItemId(operationId);
};
const onRemoveItem = async (id: string) => {
@@ -452,7 +456,7 @@ const JobBillOfProcess = ({
const operation = operationsById.get(id);
if (!operation) return;
- if (isTemporaryId(id)) {
+ if (temporaryItems[id]) {
setTemporaryItems((prev) => {
const { [id]: _, ...rest } = prev;
return rest;
@@ -484,7 +488,7 @@ const JobBillOfProcess = ({
},
}));
const updates = newItems.reduce<Record<string, number>>((acc, item) => {
- if (!isTemporaryId(item.id)) {
+ if (!temporaryItems[item.id]) {
acc[item.id] = item.data.order;
}
return acc;
@@ -516,7 +520,7 @@ const JobBillOfProcess = ({
const onUpdateWorkInstruction = useDebounce(
async (content: JSONContent) => {
- if (selectedItemId !== null && !isTemporaryId(selectedItemId))
+ if (selectedItemId !== null && !temporaryItems[selectedItemId])
await carbon
?.from("jobOperation")
.update({
@@ -562,7 +566,7 @@ const JobBillOfProcess = ({
carbon &&
accessToken &&
selectedItemId &&
- !isTemporaryId(selectedItemId)
+ !temporaryItems[selectedItemId]
) {
carbon.realtime.setAuth(accessToken);
@@ -704,8 +708,9 @@ const JobBillOfProcess = ({
locationId={locationId}
workInstruction={workInstructions[item.id] ?? {}}
setWorkInstructions={setWorkInstructions}
- setSelectedItemId={setSelectedItemId}
setTemporaryItems={setTemporaryItems}
+ setSelectedItemId={setSelectedItemId}
+ temporaryItems={temporaryItems}
/>
</motion.div>
</div>
@@ -714,7 +719,8 @@ const JobBillOfProcess = ({
{
id: 1,
label: "Instructions",
- disabled: item.data.operationType === "Outside",
+ disabled:
+ item.id in temporaryItems || item.data.operationType === "Outside",
content: (
<div className="flex flex-col">
<div>
@@ -750,7 +756,8 @@ const JobBillOfProcess = ({
},
{
id: 2,
- disabled: item.data.operationType === "Outside",
+ disabled:
+ item.id in temporaryItems || item.data.operationType === "Outside",
label: (
<span className="flex items-center gap-2">
<span>Params</span>
@@ -763,15 +770,17 @@ const JobBillOfProcess = ({
parameters={parameters}
operationId={item.id!}
isDisabled={
- selectedItemId === null || isTemporaryId(selectedItemId!)
+ selectedItemId === null || !!temporaryItems[selectedItemId]
}
+ temporaryItems={temporaryItems}
/>
</div>
),
},
{
id: 3,
- disabled: item.data.operationType === "Outside",
+ disabled:
+ item.id in temporaryItems || item.data.operationType === "Outside",
label: (
<span className="flex items-center gap-2">
<span>Steps</span>
@@ -784,15 +793,17 @@ const JobBillOfProcess = ({
attributes={attributes}
operationId={item.id!}
isDisabled={
- selectedItemId === null || isTemporaryId(selectedItemId!)
+ selectedItemId === null || !!temporaryItems[selectedItemId]
}
+ temporaryItems={temporaryItems}
/>
</div>
),
},
{
id: 4,
- disabled: item.data.operationType === "Outside",
+ disabled:
+ item.id in temporaryItems || item.data.operationType === "Outside",
label: (
<span className="flex items-center gap-2">
<span>Tools</span>
@@ -805,15 +816,17 @@ const JobBillOfProcess = ({
tools={tools}
operationId={item.id!}
isDisabled={
- selectedItemId === null || isTemporaryId(selectedItemId!)
+ selectedItemId === null || !!temporaryItems[selectedItemId]
}
+ temporaryItems={temporaryItems}
/>
</div>
),
},
{
id: 5,
- disabled: item.data.operationType === "Outside",
+ disabled:
+ item.id in temporaryItems || item.data.operationType === "Outside",
label: "Events",
content: (
<div className="flex w-full flex-col pr-2 py-6 min-h-[300px]">
@@ -839,7 +852,8 @@ const JobBillOfProcess = ({
},
{
id: 6,
- disabled: item.data.operationType === "Outside",
+ disabled:
+ item.id in temporaryItems || item.data.operationType === "Outside",
label: "Chat",
content: <OperationChat jobOperationId={item.id} />,
},
@@ -978,17 +992,16 @@ const JobBillOfProcess = ({
export default JobBillOfProcess;
-function isTemporaryId(id: string) {
- return id.length < 20;
-}
function AttributesForm({
operationId,
isDisabled,
attributes,
+ temporaryItems,
}: {
operationId: string;
isDisabled: boolean;
attributes: JobOperationAttribute[];
+ temporaryItems: TemporaryItems;
}) {
const fetcher = useFetcher<typeof newJobOperationParameterAction>();
const [type, setType] = useState<OperationAttribute["type"]>("Task");
@@ -1031,7 +1044,7 @@ function AttributesForm({
return getPrivateUrl(result.data.path);
};
- if (isDisabled && isTemporaryId(operationId)) {
+ if (isDisabled && temporaryItems[operationId]) {
return (
<Alert className="max-w-[420px] mx-auto my-8">
<LuTriangleAlert />
@@ -1575,14 +1588,16 @@ function ParametersForm({
operationId,
isDisabled,
parameters,
+ temporaryItems,
}: {
operationId: string;
isDisabled: boolean;
parameters: OperationParameter[];
+ temporaryItems: TemporaryItems;
}) {
const fetcher = useFetcher<typeof newJobOperationParameterAction>();
- if (isDisabled && isTemporaryId(operationId)) {
+ if (isDisabled && temporaryItems[operationId]) {
return (
<Alert className="max-w-[420px] mx-auto my-8">
<LuTriangleAlert />
@@ -1789,6 +1804,7 @@ function OperationForm({
setWorkInstructions,
setTemporaryItems,
setSelectedItemId,
+ temporaryItems,
}: {
item: ItemWithData;
isDisabled: boolean;
@@ -1798,41 +1814,25 @@ function OperationForm({
setWorkInstructions: Dispatch<SetStateAction<PendingWorkInstructions>>;
setTemporaryItems: Dispatch<SetStateAction<TemporaryItems>>;
setSelectedItemId: Dispatch<SetStateAction<string | null>>;
+ temporaryItems: TemporaryItems;
}) {
const { jobId } = useParams();
- const { id: userId, company } = useUser();
+ const { company } = useUser();
if (!jobId) throw new Error("jobId not found");
const fetcher = useFetcher<{ id: string }>();
const { carbon } = useCarbon();
- const addingWorkInstruction = useRef(false);
const baseCurrency = company?.baseCurrencyCode ?? "USD";
useEffect(() => {
- // replace the temporary id with the actual id
if (fetcher.data && fetcher.data.id) {
- if (isTemporaryId(item.id) && carbon && !addingWorkInstruction.current) {
- setSelectedItemId(null);
- // Clear temporary item after successful save
- setTemporaryItems((prev) => {
- const { [item.id]: _, ...rest } = prev;
- return rest;
- });
- } else {
- setSelectedItemId(null);
- }
+ // Clear temporary item after successful save
+ setTemporaryItems((prev) => {
+ const { [item.id]: _, ...rest } = prev;
+ return rest;
+ });
}
- }, [
- item.id,
- fetcher.data,
- setSelectedItemId,
- item.data.workInstruction,
- carbon,
- userId,
- workInstruction,
- setWorkInstructions,
- setTemporaryItems,
- ]);
+ }, [item.id, fetcher.data, setTemporaryItems]);
const machineDisclosure = useDisclosure();
const laborDisclosure = useDisclosure();
@@ -1997,7 +1997,7 @@ function OperationForm({
return (
<ValidatedForm
action={
- isTemporaryId(item.id)
+ temporaryItems[item.id]
? path.to.newJobOperation(jobId)
: path.to.jobOperation(jobId, item.id!)
}
@@ -2010,11 +2010,6 @@ function OperationForm({
}
className="w-full flex flex-col gap-y-4"
fetcher={fetcher}
- onSubmit={() => {
- if (!isTemporaryId(item.id)) {
- setSelectedItemId(null);
- }
- }}
>
<div>
<Hidden name="id" />
@@ -2522,7 +2517,7 @@ function OperationForm({
}));
}}
/>
- {!isTemporaryId(item.id) && processData.procedureId && (
+ {!temporaryItems[item.id] && processData.procedureId && (
<div className="flex flex-col gap-2 w-auto">
{procedureWasChanged && (
<span className="text-sm text-muted-foreground">
@@ -2829,14 +2824,16 @@ function ToolsForm({
operationId,
isDisabled,
tools,
+ temporaryItems,
}: {
operationId: string;
isDisabled: boolean;
tools: OperationTool[];
+ temporaryItems: TemporaryItems;
}) {
const fetcher = useFetcher<typeof newJobOperationToolAction>();
- if (isDisabled && isTemporaryId(operationId)) {
+ if (isDisabled && temporaryItems[operationId]) {
return (
<Alert className="max-w-[420px] mx-auto my-8">
<LuTriangleAlert />
diff --git a/apps/erp/app/modules/sales/sales.models.ts b/apps/erp/app/modules/sales/sales.models.ts
index e92db84844..c1f6b94a4d 100644
--- a/apps/erp/app/modules/sales/sales.models.ts
+++ b/apps/erp/app/modules/sales/sales.models.ts
@@ -289,7 +289,7 @@ export const quoteMaterialValidator = z
export const quoteOperationValidator = z
.object({
- id: zfd.text(z.string().optional()),
+ id: z.string().min(1, { message: "Operation ID is required" }),
quoteMakeMethodId: z
.string()
.min(1, { message: "Quote Make Method is required" }),
diff --git a/apps/erp/app/modules/sales/sales.service.ts b/apps/erp/app/modules/sales/sales.service.ts
index a797b33db9..88e35afa80 100644
--- a/apps/erp/app/modules/sales/sales.service.ts
+++ b/apps/erp/app/modules/sales/sales.service.ts
@@ -2394,6 +2394,13 @@ export async function upsertQuoteOperation(
createdBy: string;
customFields?: Json;
})
+ | (z.infer<typeof quoteOperationValidator> & {
+ quoteId: string;
+ quoteLineId: string;
+ companyId: string;
+ createdBy: string;
+ customFields?: Json;
+ })
| (Omit<z.infer<typeof quoteOperationValidator>, "id"> & {
id: string;
quoteId: string;
@@ -2402,17 +2409,17 @@ export async function upsertQuoteOperation(
customFields?: Json;
})
) {
- if ("id" in operation) {
+ if ("createdBy" in operation) {
return client
.from("quoteOperation")
- .update(sanitize(operation))
- .eq("id", operation.id)
+ .insert([operation])
.select("id")
.single();
}
return client
.from("quoteOperation")
- .insert([operation])
+ .update(sanitize(operation))
+ .eq("id", operation.id)
.select("id")
.single();
}
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
index 5a1fd90b1f..6833d6d051 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
@@ -209,7 +209,7 @@ function makeItem(
const initialOperation: Omit<
Operation,
- "quoteMakeMethodId" | "order" | "quoteOperationTool"
+ "quoteMakeMethodId" | "order" | "quoteOperationTool" | "id"
> = {
description: "",
laborRate: 0,
@@ -350,7 +350,7 @@ const QuoteBillOfProcess = ({
const onUpdateWorkInstruction = useDebounce(
async (content: JSONContent) => {
- if (selectedItemId !== null && !isTemporaryId(selectedItemId))
+ if (selectedItemId !== null && !temporaryItems[selectedItemId])
await carbon
?.from("quoteOperation")
.update({
@@ -392,7 +392,7 @@ const QuoteBillOfProcess = ({
// we create a temporary item and append it to the list
const onAddItem = () => {
- const temporaryId = Math.random().toString(16).slice(2);
+ const operationId = nanoid();
let newOrder = 1;
if (operations.length) {
@@ -401,16 +401,16 @@ const QuoteBillOfProcess = ({
const newOperation: Operation = {
...initialOperation,
- id: temporaryId,
+ id: operationId,
order: newOrder,
quoteMakeMethodId,
};
setTemporaryItems((prev) => ({
...prev,
- [temporaryId]: newOperation,
+ [operationId]: newOperation,
}));
- setSelectedItemId(temporaryId);
+ setSelectedItemId(operationId);
};
const onRemoveItem = async (id: string) => {
@@ -419,7 +419,7 @@ const QuoteBillOfProcess = ({
const operation = operationsById.get(id);
if (!operation) return;
- if (isTemporaryId(id)) {
+ if (temporaryItems[id]) {
setTemporaryItems((prev) => {
const { [id]: _, ...rest } = prev;
return rest;
@@ -451,7 +451,7 @@ const QuoteBillOfProcess = ({
},
}));
const updates = newItems.reduce<Record<string, number>>((acc, item) => {
- if (!isTemporaryId(item.id)) {
+ if (!temporaryItems[item.id]) {
acc[item.id] = item.data.order;
}
return acc;
@@ -524,6 +524,7 @@ const QuoteBillOfProcess = ({
setWorkInstructions={setWorkInstructions}
setSelectedItemId={setSelectedItemId}
setTemporaryItems={setTemporaryItems}
+ temporaryItems={temporaryItems}
/>
</motion.div>
</div>
@@ -531,7 +532,10 @@ const QuoteBillOfProcess = ({
},
{
id: 1,
- disabled: hasProcedure || item.data.operationType === "Outside",
+ disabled:
+ item.id in temporaryItems ||
+ hasProcedure ||
+ item.data.operationType === "Outside",
label: (
<span className="flex items-center gap-2">
Instructions
@@ -585,7 +589,10 @@ const QuoteBillOfProcess = ({
{
id: 2,
- disabled: hasProcedure || item.data.operationType === "Outside",
+ disabled:
+ item.id in temporaryItems ||
+ hasProcedure ||
+ item.data.operationType === "Outside",
label: (
<span className="flex items-center gap-2">
<span>Parameters</span>
@@ -612,15 +619,19 @@ const QuoteBillOfProcess = ({
parameters={parameters}
operationId={item.id!}
isDisabled={
- selectedItemId === null || isTemporaryId(selectedItemId!)
+ selectedItemId === null || !!temporaryItems[selectedItemId!]
}
+ temporaryItems={temporaryItems}
/>
</div>
),
},
{
id: 3,
- disabled: hasProcedure || item.data.operationType === "Outside",
+ disabled:
+ item.id in temporaryItems ||
+ hasProcedure ||
+ item.data.operationType === "Outside",
label: (
<span className="flex items-center gap-2">
<span>Steps</span>
@@ -647,15 +658,17 @@ const QuoteBillOfProcess = ({
attributes={attributes}
operationId={item.id!}
isDisabled={
- selectedItemId === null || isTemporaryId(selectedItemId!)
+ selectedItemId === null || !!temporaryItems[selectedItemId!]
}
+ temporaryItems={temporaryItems}
/>
</div>
),
},
{
id: 4,
- disabled: item.data.operationType === "Outside",
+ disabled:
+ item.id in temporaryItems || item.data.operationType === "Outside",
label: (
<span className="flex items-center gap-2">
<span>Tools</span>
@@ -668,8 +681,9 @@ const QuoteBillOfProcess = ({
tools={tools}
operationId={item.id!}
isDisabled={
- selectedItemId === null || isTemporaryId(selectedItemId!)
+ selectedItemId === null || !!temporaryItems[selectedItemId!]
}
+ temporaryItems={temporaryItems}
/>
</div>
),
@@ -809,18 +823,16 @@ const QuoteBillOfProcess = ({
export default QuoteBillOfProcess;
-export function isTemporaryId(id: string) {
- return id.length < 20;
-}
-
function AttributesForm({
operationId,
isDisabled,
attributes,
+ temporaryItems,
}: {
operationId: string;
isDisabled: boolean;
attributes: OperationAttribute[];
+ temporaryItems: TemporaryItems;
}) {
const fetcher = useFetcher<typeof newQuoteOperationParameterAction>();
const [type, setType] = useState<OperationAttribute["type"]>("Task");
@@ -865,7 +877,7 @@ function AttributesForm({
[]
);
- if (isDisabled && isTemporaryId(operationId)) {
+ if (isDisabled && temporaryItems[operationId]) {
return (
<Alert className="max-w-[420px] mx-auto my-8">
<LuTriangleAlert />
@@ -1343,14 +1355,16 @@ function ParametersForm({
operationId,
isDisabled,
parameters,
+ temporaryItems,
}: {
operationId: string;
isDisabled: boolean;
parameters: OperationParameter[];
+ temporaryItems: TemporaryItems;
}) {
const fetcher = useFetcher<typeof newQuoteOperationParameterAction>();
- if (isDisabled && isTemporaryId(operationId)) {
+ if (isDisabled && temporaryItems[operationId]) {
return (
<Alert className="max-w-[420px] mx-auto my-8">
<LuTriangleAlert />
@@ -1557,6 +1571,7 @@ function OperationForm({
setWorkInstructions,
setTemporaryItems,
setSelectedItemId,
+ temporaryItems,
}: {
item: ItemWithData;
isDisabled: boolean;
@@ -1564,56 +1579,27 @@ function OperationForm({
setWorkInstructions: Dispatch<SetStateAction<PendingWorkInstructions>>;
setTemporaryItems: Dispatch<SetStateAction<TemporaryItems>>;
setSelectedItemId: Dispatch<SetStateAction<string | null>>;
+ temporaryItems: TemporaryItems;
}) {
const { quoteId, lineId } = useParams();
- const { id: userId, company } = useUser();
+ const { company } = useUser();
if (!quoteId) throw new Error("quoteId not found");
if (!lineId) throw new Error("lineId not found");
const fetcher = useFetcher<{ id: string }>();
const { carbon } = useCarbon();
- const addingWorkInstruction = useRef(false);
+
const baseCurrency = company?.baseCurrencyCode ?? "USD";
useEffect(() => {
if (fetcher.data && fetcher.data.id) {
- if (isTemporaryId(item.id) && carbon && !addingWorkInstruction.current) {
- addingWorkInstruction.current = true;
- carbon
- .from("quoteOperation")
- .update({
- workInstruction: workInstruction,
- createdAt: today(getLocalTimeZone()).toString(),
- updatedBy: userId,
- })
- .eq("id", fetcher.data.id)
- .then(() => {
- setWorkInstructions((prev) => ({
- ...prev,
- [fetcher.data?.id!]: workInstruction,
- }));
- setSelectedItemId(null);
- // Clear temporary item after successful save
- setTemporaryItems((prev) => {
- const { [item.id]: _, ...rest } = prev;
- return rest;
- });
- addingWorkInstruction.current = false;
- });
- } else {
- setSelectedItemId(null);
- }
+ // Clear temporary item after successful save
+ setTemporaryItems((prev) => {
+ const { [item.id]: _, ...rest } = prev;
+ return rest;
+ });
}
- }, [
- item.id,
- fetcher.data,
- setSelectedItemId,
- carbon,
- userId,
- workInstruction,
- setTemporaryItems,
- setWorkInstructions,
- ]);
+ }, [item.id, fetcher.data, setTemporaryItems]);
const machineDisclosure = useDisclosure();
const laborDisclosure = useDisclosure();
@@ -1776,7 +1762,7 @@ function OperationForm({
return (
<ValidatedForm
action={
- isTemporaryId(item.id)
+ temporaryItems[item.id]
? path.to.newQuoteOperation(quoteId, lineId)
: path.to.quoteOperation(quoteId, lineId, item.id!)
}
@@ -1785,11 +1771,6 @@ function OperationForm({
validator={quoteOperationValidator}
className="w-full flex flex-col gap-y-4"
fetcher={fetcher}
- onSubmit={() => {
- if (!isTemporaryId(item.id)) {
- setSelectedItemId(null);
- }
- }}
>
<div>
<Hidden name="id" />
@@ -2451,14 +2432,16 @@ function ToolsForm({
operationId,
isDisabled,
tools,
+ temporaryItems,
}: {
operationId: string;
isDisabled: boolean;
tools: OperationTool[];
+ temporaryItems: TemporaryItems;
}) {
const fetcher = useFetcher<typeof newQuoteOperationToolAction>();
- if (isDisabled && isTemporaryId(operationId)) {
+ if (isDisabled && temporaryItems[operationId]) {
return (
<Alert className="max-w-[420px] mx-auto my-8">
<LuTriangleAlert />
diff --git a/apps/erp/app/routes/x+/_index.tsx b/apps/erp/app/routes/x+/_index.tsx
index 641fdc4c51..0cabf2c765 100644
--- a/apps/erp/app/routes/x+/_index.tsx
+++ b/apps/erp/app/routes/x+/_index.tsx
@@ -1,9 +1,11 @@
-import { Heading, cn } from "@carbon/react";
+import { Button, Heading, cn } from "@carbon/react";
import { useMode } from "@carbon/remix";
import { getLocalTimeZone } from "@internationalized/date";
import { useLocale } from "@react-aria/i18n";
+import { Link } from "@remix-run/react";
import { useMemo, type ComponentProps } from "react";
-import { useUser } from "~/hooks";
+import { usePermissions, useUser } from "~/hooks";
+import { path } from "~/utils/path";
export default function AppIndexRoute() {
const user = useUser();
@@ -22,21 +24,31 @@ export default function AppIndexRoute() {
const { company } = useUser();
const mode = useMode();
+ const permissions = usePermissions();
let logo = mode === "dark" ? company?.logoDark : company?.logoLight;
+ let hasCustomLogo = !!logo;
if (!logo) {
- logo = mode === "dark" ? "/carbon-word-dark.svg" : "/carbon-word-light.svg";
+ logo =
+ mode === "dark"
+ ? "/carbon-word-only-dark.svg"
+ : "/carbon-word-only-light.svg";
}
return (
<div className="p-8 w-full flex flex-col h-[calc(100dvh-var(--header-height)*2)] bg-muted">
<Heading size="h3">Hello, {user.firstName}</Heading>
<Subheading>{formatter.format(date)}</Subheading>
- <div className="flex flex-col flex-grow items-center justify-center p-8">
+ <div className="flex flex-col flex-grow items-center justify-center gap-3 p-8">
<img
src={logo}
alt="Carbon"
className="max-w-lg -mt-[var(--header-height)]"
/>
+ {!hasCustomLogo && permissions.can("update", "settings") && (
+ <Button asChild size="sm" variant="secondary">
+ <Link to={path.to.logos}>Update Logo</Link>
+ </Button>
+ )}
</div>
</div>
);
diff --git a/apps/erp/app/routes/x+/items+/methods+/operation.new.tsx b/apps/erp/app/routes/x+/items+/methods+/operation.new.tsx
index 8133fc703e..b124792a74 100644
--- a/apps/erp/app/routes/x+/items+/methods+/operation.new.tsx
+++ b/apps/erp/app/routes/x+/items+/methods+/operation.new.tsx
@@ -24,10 +24,8 @@ export async function action({ request, params }: ActionFunctionArgs) {
return validationError(validation.error);
}
- const { id, ...data } = validation.data;
-
const insertMethodOperation = await upsertMethodOperation(client, {
- ...data,
+ ...validation.data,
companyId,
createdBy: userId,
customFields: setCustomFields(formData),
diff --git a/apps/erp/app/routes/x+/job+/methods+/$jobId.operation.new.tsx b/apps/erp/app/routes/x+/job+/methods+/$jobId.operation.new.tsx
index a3c869bf36..3da85c2128 100644
--- a/apps/erp/app/routes/x+/job+/methods+/$jobId.operation.new.tsx
+++ b/apps/erp/app/routes/x+/job+/methods+/$jobId.operation.new.tsx
@@ -30,10 +30,8 @@ export async function action({ request, params }: ActionFunctionArgs) {
return validationError(validation.error);
}
- const { id, ...data } = validation.data;
-
const insertJobOperation = await upsertJobOperation(serviceRole, {
- ...data,
+ ...validation.data,
jobId,
companyId,
createdBy: userId,
diff --git a/apps/erp/app/routes/x+/quote+/methods+/$quoteId.$lineId.operation.new.tsx b/apps/erp/app/routes/x+/quote+/methods+/$quoteId.$lineId.operation.new.tsx
index d7f9f0699a..622ca7e48d 100644
--- a/apps/erp/app/routes/x+/quote+/methods+/$quoteId.$lineId.operation.new.tsx
+++ b/apps/erp/app/routes/x+/quote+/methods+/$quoteId.$lineId.operation.new.tsx
@@ -29,10 +29,8 @@ export async function action({ request, params }: ActionFunctionArgs) {
return validationError(validation.error);
}
- const { id, ...data } = validation.data;
-
const insertQuoteOperation = await upsertQuoteOperation(client, {
- ...data,
+ ...validation.data,
quoteId,
quoteLineId: lineId,
companyId,
diff --git a/apps/erp/public/carbon-word-only-dark.svg b/apps/erp/public/carbon-word-only-dark.svg
new file mode 100644
index 0000000000..eaab7b0993
--- /dev/null
+++ b/apps/erp/public/carbon-word-only-dark.svg
@@ -0,0 +1,8 @@
+<svg width="944" height="208" viewBox="0 0 944 208" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M0.517578 128.877C0.517578 113.031 3.74102 99.213 10.1879 87.4213C16.6348 75.4453 25.5683 66.2331 36.9885 59.7845C48.4086 53.1516 61.4866 49.8352 76.2223 49.8352C95.1945 49.8352 110.851 54.6256 123.192 64.2063C135.718 73.6029 144.099 86.8686 148.335 104.003H106.615C104.404 97.3706 100.628 92.2117 95.2866 88.5268C90.1291 84.6576 83.6823 82.723 75.946 82.723C64.8942 82.723 56.1449 86.7764 49.698 94.8832C43.2511 102.806 40.0277 114.137 40.0277 128.877C40.0277 143.432 43.2511 154.763 49.698 162.87C56.1449 170.792 64.8942 174.754 75.946 174.754C91.6027 174.754 101.826 167.752 106.615 153.75H148.335C144.099 170.332 135.718 183.505 123.192 193.27C110.667 203.035 95.0103 207.918 76.2223 207.918C61.4866 207.918 48.4086 204.694 36.9885 198.245C25.5683 191.612 16.6348 182.4 10.1879 170.608C3.74102 158.632 0.517578 144.722 0.517578 128.877Z" fill="#E0E0E0"/>
+<path d="M158.437 128.324C158.437 112.847 161.476 99.1209 167.555 87.1449C173.818 75.169 182.199 65.9567 192.698 59.5081C203.381 53.0595 215.262 49.8352 228.34 49.8352C239.76 49.8352 249.707 52.1383 258.18 56.7444C266.837 61.3505 273.744 67.1543 278.902 74.1556V52.3225H317.859V205.431H278.902V183.045C273.928 190.23 267.021 196.218 258.18 201.009C249.522 205.615 239.484 207.918 228.063 207.918C215.17 207.918 203.381 204.602 192.698 197.969C182.199 191.336 173.818 182.031 167.555 170.055C161.476 157.895 158.437 143.985 158.437 128.324ZM278.902 128.877C278.902 119.48 277.06 111.465 273.376 104.833C269.692 98.0154 264.719 92.8565 258.456 89.3559C252.193 85.671 245.47 83.8285 238.286 83.8285C231.103 83.8285 224.472 85.5788 218.393 89.0795C212.315 92.5802 207.341 97.7391 203.473 104.556C199.789 111.189 197.947 119.112 197.947 128.324C197.947 137.536 199.789 145.643 203.473 152.644C207.341 159.461 212.315 164.712 218.393 168.397C224.656 172.082 231.287 173.925 238.286 173.925C245.47 173.925 252.193 172.174 258.456 168.674C264.719 164.989 269.692 159.83 273.376 153.197C277.06 146.38 278.902 138.273 278.902 128.877Z" fill="#E0E0E0"/>
+<path d="M386.031 76.0902C391.004 67.9834 397.451 61.6269 405.371 57.0208C413.476 52.4146 422.686 50.1116 433.001 50.1116V90.7377H422.778C410.621 90.7377 401.411 93.5935 395.148 99.3051C389.07 105.017 386.031 114.966 386.031 129.153V205.431H347.349V52.3225H386.031V76.0902Z" fill="#E0E0E0"/>
+<path d="M489.447 74.7083C494.42 67.3385 501.235 61.3505 509.893 56.7444C518.734 52.1383 528.773 49.8352 540.009 49.8352C553.087 49.8352 564.875 53.0595 575.374 59.5081C586.058 65.9567 594.439 75.169 600.517 87.1449C606.78 98.9367 609.911 112.663 609.911 128.324C609.911 143.985 606.78 157.895 600.517 170.055C594.439 182.031 586.058 191.336 575.374 197.969C564.875 204.602 553.087 207.918 540.009 207.918C528.589 207.918 518.55 205.707 509.893 201.285C501.42 196.679 494.604 190.783 489.447 183.598V205.431H450.766V0.917969H489.447V74.7083ZM570.401 128.324C570.401 119.112 568.467 111.189 564.599 104.556C560.915 97.7391 555.942 92.5802 549.679 89.0795C543.601 85.5788 536.969 83.8285 529.786 83.8285C522.786 83.8285 516.155 85.671 509.893 89.3559C503.814 92.8565 498.841 98.0154 494.973 104.833C491.289 111.65 489.447 119.664 489.447 128.877C489.447 138.089 491.289 146.104 494.973 152.921C498.841 159.738 503.814 164.989 509.893 168.674C516.155 172.174 522.786 173.925 529.786 173.925C536.969 173.925 543.601 172.082 549.679 168.397C555.942 164.712 560.915 159.461 564.599 152.644C568.467 145.827 570.401 137.72 570.401 128.324Z" fill="#E0E0E0"/>
+<path d="M697.7 207.918C682.964 207.918 669.702 204.694 657.913 198.245C646.125 191.612 636.823 182.308 630.007 170.332C623.376 158.356 620.061 144.537 620.061 128.877C620.061 113.216 623.468 99.3973 630.284 87.4213C637.283 75.4453 646.769 66.2331 658.742 59.7845C670.715 53.1516 684.069 49.8352 698.805 49.8352C713.54 49.8352 726.895 53.1516 738.867 59.7845C750.84 66.2331 760.234 75.4453 767.049 87.4213C774.049 99.3973 777.549 113.216 777.549 128.877C777.549 144.537 773.957 158.356 766.773 170.332C759.774 182.308 750.196 191.612 738.039 198.245C726.066 204.694 712.619 207.918 697.7 207.918ZM697.7 174.201C704.699 174.201 711.238 172.543 717.316 169.226C723.579 165.726 728.552 160.567 732.236 153.75C735.92 146.933 737.762 138.642 737.762 128.877C737.762 114.321 733.894 103.174 726.158 95.436C718.606 87.5134 709.304 83.5521 698.252 83.5521C687.2 83.5521 677.898 87.5134 670.346 95.436C662.979 103.174 659.295 114.321 659.295 128.877C659.295 143.432 662.886 154.671 670.07 162.594C677.438 170.332 686.648 174.201 697.7 174.201Z" fill="#E0E0E0"/>
+<path d="M882.456 50.1116C900.692 50.1116 915.428 55.9153 926.664 67.5228C937.9 78.946 943.518 94.9754 943.518 115.611V205.431H904.836V120.862C904.836 108.702 901.797 99.3973 895.719 92.9487C889.64 86.3158 881.351 82.9994 870.852 82.9994C860.169 82.9994 851.696 86.3158 845.433 92.9487C839.355 99.3973 836.315 108.702 836.315 120.862V205.431H797.634V52.3225H836.315V71.3919C841.473 64.7591 848.012 59.6002 855.932 55.9153C864.037 52.0461 872.878 50.1116 882.456 50.1116Z" fill="#E0E0E0"/>
+</svg>
diff --git a/apps/erp/public/carbon-word-only-light.svg b/apps/erp/public/carbon-word-only-light.svg
new file mode 100644
index 0000000000..b9bb1c59c8
--- /dev/null
+++ b/apps/erp/public/carbon-word-only-light.svg
@@ -0,0 +1,8 @@
+<svg width="944" height="208" viewBox="0 0 944 208" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M0.517578 128.877C0.517578 113.031 3.74102 99.213 10.1879 87.4213C16.6348 75.4453 25.5683 66.2331 36.9885 59.7845C48.4086 53.1516 61.4866 49.8352 76.2223 49.8352C95.1945 49.8352 110.851 54.6256 123.192 64.2063C135.718 73.6029 144.099 86.8686 148.335 104.003H106.615C104.404 97.3706 100.628 92.2117 95.2866 88.5268C90.1291 84.6576 83.6823 82.723 75.946 82.723C64.8942 82.723 56.1449 86.7764 49.698 94.8832C43.2511 102.806 40.0277 114.137 40.0277 128.877C40.0277 143.432 43.2511 154.763 49.698 162.87C56.1449 170.792 64.8942 174.754 75.946 174.754C91.6027 174.754 101.826 167.752 106.615 153.75H148.335C144.099 170.332 135.718 183.505 123.192 193.27C110.667 203.035 95.0103 207.918 76.2223 207.918C61.4866 207.918 48.4086 204.694 36.9885 198.245C25.5683 191.612 16.6348 182.4 10.1879 170.608C3.74102 158.632 0.517578 144.722 0.517578 128.877Z" fill="#383838"/>
+<path d="M158.437 128.324C158.437 112.847 161.476 99.1209 167.555 87.1449C173.818 75.169 182.199 65.9567 192.698 59.5081C203.381 53.0595 215.262 49.8352 228.34 49.8352C239.76 49.8352 249.707 52.1383 258.18 56.7444C266.837 61.3505 273.744 67.1543 278.902 74.1556V52.3225H317.859V205.431H278.902V183.045C273.928 190.23 267.021 196.218 258.18 201.009C249.522 205.615 239.484 207.918 228.063 207.918C215.17 207.918 203.381 204.602 192.698 197.969C182.199 191.336 173.818 182.031 167.555 170.055C161.476 157.895 158.437 143.985 158.437 128.324ZM278.902 128.877C278.902 119.48 277.06 111.465 273.376 104.833C269.692 98.0154 264.719 92.8565 258.456 89.3559C252.193 85.671 245.47 83.8285 238.286 83.8285C231.103 83.8285 224.472 85.5788 218.393 89.0795C212.315 92.5802 207.341 97.7391 203.473 104.556C199.789 111.189 197.947 119.112 197.947 128.324C197.947 137.536 199.789 145.643 203.473 152.644C207.341 159.461 212.315 164.712 218.393 168.397C224.656 172.082 231.287 173.925 238.286 173.925C245.47 173.925 252.193 172.174 258.456 168.674C264.719 164.989 269.692 159.83 273.376 153.197C277.06 146.38 278.902 138.273 278.902 128.877Z" fill="#383838"/>
+<path d="M386.031 76.0902C391.004 67.9834 397.451 61.6269 405.371 57.0208C413.476 52.4146 422.686 50.1116 433.001 50.1116V90.7377H422.778C410.621 90.7377 401.411 93.5935 395.148 99.3051C389.07 105.017 386.031 114.966 386.031 129.153V205.431H347.349V52.3225H386.031V76.0902Z" fill="#383838"/>
+<path d="M489.447 74.7083C494.42 67.3385 501.235 61.3505 509.893 56.7444C518.734 52.1383 528.773 49.8352 540.009 49.8352C553.087 49.8352 564.875 53.0595 575.374 59.5081C586.058 65.9567 594.439 75.169 600.517 87.1449C606.78 98.9367 609.911 112.663 609.911 128.324C609.911 143.985 606.78 157.895 600.517 170.055C594.439 182.031 586.058 191.336 575.374 197.969C564.875 204.602 553.087 207.918 540.009 207.918C528.589 207.918 518.55 205.707 509.893 201.285C501.42 196.679 494.604 190.783 489.447 183.598V205.431H450.766V0.917969H489.447V74.7083ZM570.401 128.324C570.401 119.112 568.467 111.189 564.599 104.556C560.915 97.7391 555.942 92.5802 549.679 89.0795C543.601 85.5788 536.969 83.8285 529.786 83.8285C522.786 83.8285 516.155 85.671 509.893 89.3559C503.814 92.8565 498.841 98.0154 494.973 104.833C491.289 111.65 489.447 119.664 489.447 128.877C489.447 138.089 491.289 146.104 494.973 152.921C498.841 159.738 503.814 164.989 509.893 168.674C516.155 172.174 522.786 173.925 529.786 173.925C536.969 173.925 543.601 172.082 549.679 168.397C555.942 164.712 560.915 159.461 564.599 152.644C568.467 145.827 570.401 137.72 570.401 128.324Z" fill="#383838"/>
+<path d="M697.7 207.918C682.964 207.918 669.702 204.694 657.913 198.245C646.125 191.612 636.823 182.308 630.007 170.332C623.376 158.356 620.061 144.537 620.061 128.877C620.061 113.216 623.468 99.3973 630.284 87.4213C637.283 75.4453 646.769 66.2331 658.742 59.7845C670.715 53.1516 684.069 49.8352 698.805 49.8352C713.54 49.8352 726.895 53.1516 738.867 59.7845C750.84 66.2331 760.234 75.4453 767.049 87.4213C774.049 99.3973 777.549 113.216 777.549 128.877C777.549 144.537 773.957 158.356 766.773 170.332C759.774 182.308 750.196 191.612 738.039 198.245C726.066 204.694 712.619 207.918 697.7 207.918ZM697.7 174.201C704.699 174.201 711.238 172.543 717.316 169.226C723.579 165.726 728.552 160.567 732.236 153.75C735.92 146.933 737.762 138.642 737.762 128.877C737.762 114.321 733.894 103.174 726.158 95.436C718.606 87.5134 709.304 83.5521 698.252 83.5521C687.2 83.5521 677.898 87.5134 670.346 95.436C662.979 103.174 659.295 114.321 659.295 128.877C659.295 143.432 662.886 154.671 670.07 162.594C677.438 170.332 686.648 174.201 697.7 174.201Z" fill="#383838"/>
+<path d="M882.456 50.1116C900.692 50.1116 915.428 55.9153 926.664 67.5228C937.9 78.946 943.518 94.9754 943.518 115.611V205.431H904.836V120.862C904.836 108.702 901.797 99.3973 895.719 92.9487C889.64 86.3158 881.351 82.9994 870.852 82.9994C860.169 82.9994 851.696 86.3158 845.433 92.9487C839.355 99.3973 836.315 108.702 836.315 120.862V205.431H797.634V52.3225H836.315V71.3919C841.473 64.7591 848.012 59.6002 855.932 55.9153C864.037 52.0461 872.878 50.1116 882.456 50.1116Z" fill="#383838"/>
+</svg>