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.

wip: add keys to update forms and flush out BoM explorer

Brad Barbin0cceca69c776
diff --git a/apps/carbon/app/modules/sales/ui/Quotation/QuotationAssemblyForm.tsx b/apps/carbon/app/modules/sales/ui/Quotation/QuotationAssemblyForm.tsx
index c0adfb8ee5..c4e19a9701 100644
--- a/apps/carbon/app/modules/sales/ui/Quotation/QuotationAssemblyForm.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotation/QuotationAssemblyForm.tsx
@@ -27,7 +27,7 @@ import {
Part,
Submit,
} from "~/components/Form";
-import { usePermissions, useRouteData } from "~/hooks";
+import { usePermissions, useRouteData, useUrlParams } from "~/hooks";
import { useSupabase } from "~/lib/supabase";
import type { Quotation } from "~/modules/sales";
import { quotationAssemblyValidator } from "~/modules/sales";
@@ -53,6 +53,9 @@ const QuotationAssemblyForm = ({
if (!quoteId) throw new Error("quoteId not found");
if (!lineId) throw new Error("lineId not found");
+ const [params] = useUrlParams();
+ const parentAssemblyId = params.get("parentAssemblyId");
+
const isEditing = initialValues.id !== undefined;
const [partData, setPartData] = useState<{
@@ -139,7 +142,10 @@ const QuotationAssemblyForm = ({
</HStack>
<CardContent>
<Hidden name="id" />
- <Hidden name="parentAssemblyId" />
+ <Hidden
+ name="parentAssemblyId"
+ value={parentAssemblyId ?? undefined}
+ />
<Hidden name="unitOfMeasureCode" value={partData?.uom} />
<VStack>
<div className="grid w-full gap-x-8 gap-y-2 grid-cols-1 md:grid-cols-3">
diff --git a/apps/carbon/app/modules/sales/ui/Quotation/QuotationForm.tsx b/apps/carbon/app/modules/sales/ui/Quotation/QuotationForm.tsx
index d910e196a7..ef3160ea47 100644
--- a/apps/carbon/app/modules/sales/ui/Quotation/QuotationForm.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotation/QuotationForm.tsx
@@ -93,7 +93,6 @@ const QuotationForm = ({ initialValues }: QuotationFormProps) => {
{isEditing && (
<>
<DatePicker name="expirationDate" label="Expiration Date" />
-
<TextArea name="notes" label="Notes" />
</>
)}
diff --git a/apps/carbon/app/modules/sales/ui/Quotation/QuotationLineForm.tsx b/apps/carbon/app/modules/sales/ui/Quotation/QuotationLineForm.tsx
index 07f9fcd954..2c82f2fda4 100644
--- a/apps/carbon/app/modules/sales/ui/Quotation/QuotationLineForm.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotation/QuotationLineForm.tsx
@@ -114,9 +114,7 @@ const QuotationLineForm = ({ initialValues }: QuotationLineFormProps) => {
<Card>
<HStack className="w-full justify-between items-start">
<CardHeader>
- <CardTitle>
- {isEditing ? partData?.partId : "New Quote Line"}
- </CardTitle>
+ <CardTitle>{isEditing ? "Quote Line" : "New Quote Line"}</CardTitle>
<CardDescription>
{isEditing
? partData?.description
diff --git a/apps/carbon/app/modules/sales/ui/Quotation/QuotationOperationForm.tsx b/apps/carbon/app/modules/sales/ui/Quotation/QuotationOperationForm.tsx
index dd6d46f211..596a67045b 100644
--- a/apps/carbon/app/modules/sales/ui/Quotation/QuotationOperationForm.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotation/QuotationOperationForm.tsx
@@ -30,7 +30,7 @@ import {
Submit,
WorkCellType,
} from "~/components/Form";
-import { usePermissions, useRouteData } from "~/hooks";
+import { usePermissions, useRouteData, useUrlParams } from "~/hooks";
import { useSupabase } from "~/lib/supabase";
import type { Quotation } from "~/modules/sales";
import { quotationOperationValidator } from "~/modules/sales";
@@ -56,6 +56,9 @@ const QuotationOperationForm = ({
if (!quoteId) throw new Error("quoteId not found");
if (!lineId) throw new Error("lineId not found");
+ const [params] = useUrlParams();
+ const quoteAssemblyId = params.get("quoteAssemblyId");
+
const isEditing = initialValues.id !== undefined;
const routeData = useRouteData<{
@@ -164,7 +167,7 @@ const QuotationOperationForm = ({
</HStack>
<CardContent>
<Hidden name="id" />
- <Hidden name="quoteAssemblyId" />
+ <Hidden name="quoteAssemblyId" value={quoteAssemblyId ?? undefined} />
<VStack>
<div className="grid w-full gap-x-8 gap-y-2 grid-cols-1 md:grid-cols-3">
diff --git a/apps/carbon/app/modules/sales/ui/Quotation/QuotationStatus.tsx b/apps/carbon/app/modules/sales/ui/Quotation/QuotationStatus.tsx
index 4abed87060..fd93a0d12e 100644
--- a/apps/carbon/app/modules/sales/ui/Quotation/QuotationStatus.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotation/QuotationStatus.tsx
@@ -11,7 +11,7 @@ const QuotationStatus = ({ status }: QuotationStatusProps) => {
return <Status color="gray">{status}</Status>;
case "Open":
case "Replied":
- return <Status color="orange">{status}</Status>;
+ return <Status color="blue">{status}</Status>;
case "Ordered":
case "Partially Ordered":
return <Status color="green">{status}</Status>;
diff --git a/apps/carbon/app/modules/sales/ui/Quotation/useQuotation.tsx b/apps/carbon/app/modules/sales/ui/Quotation/useQuotation.tsx
index 26ab7d7695..03b15990d3 100644
--- a/apps/carbon/app/modules/sales/ui/Quotation/useQuotation.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotation/useQuotation.tsx
@@ -1,5 +1,6 @@
import { useStore as useValue } from "@nanostores/react";
import { atom, computed } from "nanostores";
+import { arrayToTree } from "performant-array-to-tree";
import { useNanoStore } from "~/hooks";
import type {
Quotation,
@@ -9,6 +10,25 @@ import type {
QuotationOperation,
} from "~/modules/sales";
+type BillOfMaterialNodeType =
+ | "parent"
+ | "line"
+ | "assemblies"
+ | "operations"
+ | "materials"
+ | "assembly"
+ | "operation"
+ | "material";
+
+type BillOfMaterialNode = {
+ id: string;
+ parentId?: string;
+ label: string;
+ type: BillOfMaterialNodeType;
+ meta?: any;
+ children?: BillOfMaterialNode[];
+};
+
type Quote = {
quote?: Quotation;
lines: QuotationLine[];
@@ -25,24 +45,176 @@ const $quotationStore = atom<Quote>({
materials: [],
});
-const $quotationMenuStore = computed($quotationStore, (store) => {
+const $quotationMenuStore = computed($quotationStore, (store: Quote) => {
if (!store.quote) return [];
- const menu = [
+
+ const materialsByOperationId = store.materials.reduce<
+ Record<string, QuotationMaterial[]>
+ >((acc, material) => {
+ if (!acc[material.quoteOperationId]) {
+ acc[material.quoteOperationId] = [];
+ }
+ acc[material.quoteOperationId].push(material);
+ return acc;
+ }, {});
+
+ const operationsByAssemblyId = store.operations.reduce<
+ Record<string, BillOfMaterialNode[]>
+ >((acc, operation) => {
+ if (!operation?.quoteAssemblyId) return acc;
+ if (!acc[operation.quoteAssemblyId]) {
+ acc[operation.quoteAssemblyId] = [];
+ }
+ acc[operation.quoteAssemblyId].push({
+ id: operation.id,
+ parentId: operation.quoteAssemblyId ?? undefined,
+ label: operation.description ?? "Operation",
+ type: "operation",
+ meta: operation,
+ children: [
+ {
+ id: operation.id,
+ label: "Materials",
+ type: "materials",
+ meta: operation,
+ children: materialsByOperationId[operation.id]?.map((material) => ({
+ id: material.id,
+ parentId: operation.id,
+ label: material.partId,
+ type: "material",
+ meta: material,
+ })),
+ },
+ ],
+ });
+ return acc;
+ }, {});
+
+ const itemsByLineId: Record<
+ string,
{
- id: store.quote.id,
- label: store.quote.quoteId,
+ assemblies: BillOfMaterialNode[];
+ operations: BillOfMaterialNode[];
+ }
+ > = {};
+
+ store.assemblies.forEach((assembly) => {
+ if (!itemsByLineId[assembly.quoteLineId]) {
+ itemsByLineId[assembly.quoteLineId] = {
+ assemblies: [],
+ operations: [],
+ };
+ }
+ itemsByLineId[assembly.quoteLineId].assemblies.push({
+ id: assembly.id,
+ parentId: assembly.parentAssemblyId ?? undefined,
+ label: assembly.partId,
+ type: "assembly",
+ meta: assembly,
+ });
+ });
+
+ store.operations.forEach((operation) => {
+ if (!itemsByLineId[operation.quoteLineId]) {
+ itemsByLineId[operation.quoteLineId] = {
+ assemblies: [],
+ operations: [],
+ };
+ }
+ itemsByLineId[operation.quoteLineId].operations.push({
+ id: operation.id,
+ parentId: operation.quoteAssemblyId ?? undefined,
+ label: operation.description ?? "Operation",
+ type: "operation",
+ meta: operation,
+ children: [
+ {
+ id: operation.id,
+ label: "Materials",
+ type: "materials",
+ meta: operation,
+ children: materialsByOperationId[operation.id]?.map((material) => ({
+ id: material.id,
+ parentId: operation.id,
+ label: material.partId,
+ type: "material",
+ meta: material,
+ })),
+ },
+ ],
+ });
+ });
+
+ const menu: BillOfMaterialNode[] = [
+ {
+ id: store.quote.id!,
+ label: store.quote.quoteId!,
type: "parent",
- children: store.lines.map((line) => ({
+ children: store.lines.map<BillOfMaterialNode>((line) => ({
id: line.id,
label: line.partId,
type: "line",
meta: line,
+ children: [
+ {
+ id: line.id,
+ label: "Assemblies",
+ type: "assemblies",
+ children: [
+ ...(arrayToTree(itemsByLineId[line.id]?.assemblies, {
+ id: "id",
+ dataField: null,
+ }) as BillOfMaterialNode[]),
+ ],
+ },
+ {
+ id: line.id,
+ label: "Operations",
+ type: "operations",
+ children: itemsByLineId[line.id]?.operations.filter(
+ (operation) => operation.parentId === undefined
+ ) as BillOfMaterialNode[],
+ },
+ ],
})),
},
];
+ traverseTree(menu, (node) => {
+ if (node.type === "assembly") {
+ node.children = [
+ {
+ id: node.meta.quoteLineId,
+ parentId: node.id,
+ label: "Assemblies",
+ type: "assemblies",
+ children: node.children,
+ },
+ {
+ id: node.meta.quoteLineId,
+ parentId: node.id,
+ label: "Operations",
+ type: "operations",
+ children: operationsByAssemblyId[node.id] ?? [],
+ },
+ ];
+ }
+ });
+
return menu;
});
+function traverseTree(
+ tree: BillOfMaterialNode[],
+ callback: (node: BillOfMaterialNode) => void
+) {
+ tree.forEach((node) => {
+ callback(node);
+ if (node.children) {
+ traverseTree(node.children, callback);
+ }
+ });
+}
+
export const useQuotation = () => useNanoStore<Quote>($quotationStore);
export const useQuotationMenu = () => useValue($quotationMenuStore);
diff --git a/apps/carbon/app/routes/x+/accounting+/categories.$categoryId.tsx b/apps/carbon/app/routes/x+/accounting+/categories.$categoryId.tsx
index 19a7d37189..dbea7605c5 100644
--- a/apps/carbon/app/routes/x+/accounting+/categories.$categoryId.tsx
+++ b/apps/carbon/app/routes/x+/accounting+/categories.$categoryId.tsx
@@ -85,6 +85,10 @@ export default function EditAccountCategoryRoute() {
};
return (
- <AccountCategoryForm onClose={onClose} initialValues={initialValues} />
+ <AccountCategoryForm
+ key={initialValues.id}
+ onClose={onClose}
+ initialValues={initialValues}
+ />
);
}
diff --git a/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.$subcategoryId.tsx b/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.$subcategoryId.tsx
index e836bd4f62..69ac44eacb 100644
--- a/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.$subcategoryId.tsx
+++ b/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.$subcategoryId.tsx
@@ -50,6 +50,10 @@ export default function EditAccountSubcategoryRoute() {
};
return (
- <AccountSubcategoryForm initialValues={initialValues} onClose={onClose} />
+ <AccountSubcategoryForm
+ key={initialValues.id}
+ initialValues={initialValues}
+ onClose={onClose}
+ />
);
}
diff --git a/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.new.tsx b/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.new.tsx
index 546f60a78e..89e29d8244 100644
--- a/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.new.tsx
+++ b/apps/carbon/app/routes/x+/accounting+/categories.list.$categoryId.new.tsx
@@ -1,5 +1,6 @@
import { useNavigate, useParams } from "@remix-run/react";
-import { AccountSubcategoryForm ,
+import {
+ AccountSubcategoryForm,
accountSubcategoryValidator,
upsertAccountSubcategory,
} from "~/modules/accounting";
diff --git a/apps/carbon/app/routes/x+/accounting+/charts.$accountId.tsx b/apps/carbon/app/routes/x+/accounting+/charts.$accountId.tsx
index 8a73cf3b75..4ea2b7707b 100644
--- a/apps/carbon/app/routes/x+/accounting+/charts.$accountId.tsx
+++ b/apps/carbon/app/routes/x+/accounting+/charts.$accountId.tsx
@@ -84,5 +84,7 @@ export default function EditChartOfAccountsRoute() {
directPosting: account?.directPosting ?? false,
};
- return <ChartOfAccountForm initialValues={initialValues} />;
+ return (
+ <ChartOfAccountForm key={initialValues.id} initialValues={initialValues} />
+ );
}
diff --git a/apps/carbon/app/routes/x+/accounting+/currencies.$currencyId.tsx b/apps/carbon/app/routes/x+/accounting+/currencies.$currencyId.tsx
index af582b331e..34770ed3bf 100644
--- a/apps/carbon/app/routes/x+/accounting+/currencies.$currencyId.tsx
+++ b/apps/carbon/app/routes/x+/accounting+/currencies.$currencyId.tsx
@@ -81,5 +81,5 @@ export default function EditCurrencysRoute() {
isBaseCurrency: currency?.isBaseCurrency ?? false,
};
- return <CurrencyForm initialValues={initialValues} />;
+ return <CurrencyForm key={initialValues.id} initialValues={initialValues} />;
}
diff --git a/apps/carbon/app/routes/x+/accounting+/payment-terms.$paymentTermId.tsx b/apps/carbon/app/routes/x+/accounting+/payment-terms.$paymentTermId.tsx
index e7a74fdb84..18909b1da6 100644
--- a/apps/carbon/app/routes/x+/accounting+/payment-terms.$paymentTermId.tsx
+++ b/apps/carbon/app/routes/x+/accounting+/payment-terms.$paymentTermId.tsx
@@ -83,5 +83,7 @@ export default function EditPaymentTermsRoute() {
paymentTerm?.calculationMethod ?? ("Net" as PaymentTermCalculationMethod),
};
- return <PaymentTermForm initialValues={initialValues} />;
+ return (
+ <PaymentTermForm key={initialValues.id} initialValues={initialValues} />
+ );
}
diff --git a/apps/carbon/app/routes/x+/customer+/$customerId.contacts.$customerContactId.tsx b/apps/carbon/app/routes/x+/customer+/$customerId.contacts.$customerContactId.tsx
index 888b83d457..d711b84d6f 100644
--- a/apps/carbon/app/routes/x+/customer+/$customerId.contacts.$customerContactId.tsx
+++ b/apps/carbon/app/routes/x+/customer+/$customerId.contacts.$customerContactId.tsx
@@ -108,5 +108,7 @@ export default function EditCustomerContactRoute() {
birthday: contact?.contact?.birthday ?? undefined,
};
- return <CustomerContactForm initialValues={initialValues} />;
+ return (
+ <CustomerContactForm key={initialValues.id} initialValues={initialValues} />
+ );
}
diff --git a/apps/carbon/app/routes/x+/customer+/$customerId.index.tsx b/apps/carbon/app/routes/x+/customer+/$customerId.index.tsx
index eb15746965..5f5f25c91b 100644
--- a/apps/carbon/app/routes/x+/customer+/$customerId.index.tsx
+++ b/apps/carbon/app/routes/x+/customer+/$customerId.index.tsx
@@ -69,5 +69,5 @@ export default function CustomerEditRoute() {
taxId: routeData?.customer?.taxId ?? "",
};
- return <CustomerForm initialValues={initialValues} />;
+ return <CustomerForm key={initialValues.id} initialValues={initialValues} />;
}
diff --git a/apps/carbon/app/routes/x+/customer+/$customerId.locations.$customerLocationId.tsx b/apps/carbon/app/routes/x+/customer+/$customerId.locations.$customerLocationId.tsx
index c77482ccf1..34653ffed6 100644
--- a/apps/carbon/app/routes/x+/customer+/$customerId.locations.$customerLocationId.tsx
+++ b/apps/carbon/app/routes/x+/customer+/$customerId.locations.$customerLocationId.tsx
@@ -96,5 +96,10 @@ export default function EditCustomerLocationRoute() {
postalCode: location?.address?.postalCode ?? "",
};
- return <CustomerLocationForm initialValues={initialValues} />;
+ return (
+ <CustomerLocationForm
+ key={initialValues.id}
+ initialValues={initialValues}
+ />
+ );
}
diff --git a/apps/carbon/app/routes/x+/customer+/$customerId.shipping.tsx b/apps/carbon/app/routes/x+/customer+/$customerId.shipping.tsx
index b33de57f46..bd82a30c90 100644
--- a/apps/carbon/app/routes/x+/customer+/$customerId.shipping.tsx
+++ b/apps/carbon/app/routes/x+/customer+/$customerId.shipping.tsx
@@ -91,5 +91,10 @@ export default function CustomerShippingRoute() {
shippingTermId: customerShipping?.shippingTermId ?? "",
};
- return <CustomerShippingForm initialValues={initialValues} />;
+ return (
+ <CustomerShippingForm
+ key={initialValues.customerId}
+ initialValues={initialValues}
+ />
+ );
}
diff --git a/apps/carbon/app/routes/x+/documents+/search.$documentId.tsx b/apps/carbon/app/routes/x+/documents+/search.$documentId.tsx
index 5a9f478b28..9fe01785a8 100644
--- a/apps/carbon/app/routes/x+/documents+/search.$documentId.tsx
+++ b/apps/carbon/app/routes/x+/documents+/search.$documentId.tsx
@@ -92,6 +92,7 @@ export default function EditDocumentRoute() {
return (
<DocumentForm
+ key={initialValues.id}
initialValues={initialValues}
ownerId={document.createdBy ?? ""}
/>
diff --git a/apps/carbon/app/routes/x+/inventory+/receipts.$receiptId.tsx b/apps/carbon/app/routes/x+/inventory+/receipts.$receiptId.tsx
index 23e9c9283f..3605b52436 100644
--- a/apps/carbon/app/routes/x+/inventory+/receipts.$receiptId.tsx
+++ b/apps/carbon/app/routes/x+/inventory+/receipts.$receiptId.tsx
@@ -95,6 +95,7 @@ export default function EditReceiptsRoute() {
return (
<ReceiptForm
+ key={initialValues.id}
// @ts-ignore
initialValues={initialValues}
status={receipt.status}
diff --git a/apps/carbon/app/routes/x+/inventory+/shipping-methods.$shippingMethodId.tsx b/apps/carbon/app/routes/x+/inventory+/shipping-methods.$shippingMethodId.tsx
index fc05cf6877..5c4b67c88a 100644
--- a/apps/carbon/app/routes/x+/inventory+/shipping-methods.$shippingMethodId.tsx
+++ b/apps/carbon/app/routes/x+/inventory+/shipping-methods.$shippingMethodId.tsx
@@ -81,5 +81,7 @@ export default function EditShippingMethodsRoute() {
trackingUrl: shippingMethod?.trackingUrl ?? "",
};
- return <ShippingMethodForm initialValues={initialValues} />;
+ return (
+ <ShippingMethodForm key={initialValues.id} initialValues={initialValues} />
+ );
}
diff --git a/apps/carbon/app/routes/x+/part+/$partId.costing.tsx b/apps/carbon/app/routes/x+/part+/$partId.costing.tsx
index fa28a021a7..4314329f58 100644
--- a/apps/carbon/app/routes/x+/part+/$partId.costing.tsx
+++ b/apps/carbon/app/routes/x+/part+/$partId.costing.tsx
@@ -86,5 +86,5 @@ export async function action({ request, params }: ActionFunctionArgs) {
export default function PartCostingRoute() {
const { partCost } = useLoaderData<typeof loader>();
- return <PartCostingForm initialValues={partCost} />;
+ return <PartCostingForm key={partCost.partId} initialValues={partCost} />;
}
diff --git a/apps/carbon/app/routes/x+/part+/$partId.index.tsx b/apps/carbon/app/routes/x+/part+/$partId.index.tsx
index c36bc8bc24..0e79a6038c 100644
--- a/apps/carbon/app/routes/x+/part+/$partId.index.tsx
+++ b/apps/carbon/app/routes/x+/part+/$partId.index.tsx
@@ -65,5 +65,5 @@ export default function PartBasicRoute() {
active: partData.partSummary?.active ?? false,
};
- return <PartForm initialValues={initialValues} />;
+ return <PartForm key={initialValues.id} initialValues={initialValues} />;
}
diff --git a/apps/carbon/app/routes/x+/part+/$partId.inventory.tsx b/apps/carbon/app/routes/x+/part+/$partId.inventory.tsx
index 5170c30030..345868a59c 100644
--- a/apps/carbon/app/routes/x+/part+/$partId.inventory.tsx
+++ b/apps/carbon/app/routes/x+/part+/$partId.inventory.tsx
@@ -170,6 +170,7 @@ export default function PartInventoryRoute() {
};
return (
<PartInventoryForm
+ key={initialValues.partId}
initialValues={initialValues}
quantities={quantities}
locations={sharedPartsData?.locations ?? []}
diff --git a/apps/carbon/app/routes/x+/part+/$partId.manufacturing.tsx b/apps/carbon/app/routes/x+/part+/$partId.manufacturing.tsx
index 17514e33d3..47721f5f5d 100644
--- a/apps/carbon/app/routes/x+/part+/$partId.manufacturing.tsx
+++ b/apps/carbon/app/routes/x+/part+/$partId.manufacturing.tsx
@@ -92,5 +92,10 @@ export default function PartManufacturingRoute() {
lotSize: partManufacturing.lotSize ?? 0,
};
- return <PartManufacturingForm initialValues={initialValues} />;
+ return (
+ <PartManufacturingForm
+ key={initialValues.partId}
+ initialValues={initialValues}
+ />
+ );
}
diff --git a/apps/carbon/app/routes/x+/part+/$partId.planning.tsx b/apps/carbon/app/routes/x+/part+/$partId.planning.tsx
index 8e733ddb59..3184fd49f0 100644
--- a/apps/carbon/app/routes/x+/part+/$partId.planning.tsx
+++ b/apps/carbon/app/routes/x+/part+/$partId.planning.tsx
@@ -145,6 +145,7 @@ export default function PartPlanningRoute() {
return (
<PartPlanningForm
+ key={partPlanning.partId}
initialValues={partPlanning}
locations={sharedPartsData.locations ?? []}
/>
diff --git a/apps/carbon/app/routes/x+/part+/$partId.purchasing.tsx b/apps/carbon/app/routes/x+/part+/$partId.purchasing.tsx
index 7cfe7d67b4..3390075feb 100644
--- a/apps/carbon/app/routes/x+/part+/$partId.purchasing.tsx
+++ b/apps/carbon/app/routes/x+/part+/$partId.purchasing.tsx
@@ -98,6 +98,7 @@ export default function PartPurchasingRoute() {
return (
<PartPurchasingForm
+ key={initialValues.partId}
initialValues={initialValues}
unitOfMeasures={sharedPartData?.unitOfMeasures ?? []}
/>
diff --git a/apps/carbon/app/routes/x+/part+/$partId.sale-price.tsx b/apps/carbon/app/routes/x+/part+/$partId.sale-price.tsx
index 2da1102e38..849256a3a8 100644
--- a/apps/carbon/app/routes/x+/part+/$partId.sale-price.tsx
+++ b/apps/carbon/app/routes/x+/part+/$partId.sale-price.tsx
@@ -96,6 +96,7 @@ export default function PartSalePriceRoute() {
return (
<PartSalePriceForm
+ key={initialValues.partId}
initialValues={initialValues}
unitOfMeasures={sharedPartData?.unitOfMeasures ?? []}
/>
diff --git a/apps/carbon/app/routes/x+/parts+/groups.$groupId.tsx b/apps/carbon/app/routes/x+/parts+/groups.$groupId.tsx
index 78cd8adc88..9e2a061d87 100644
--- a/apps/carbon/app/routes/x+/parts+/groups.$groupId.tsx
+++ b/apps/carbon/app/routes/x+/parts+/groups.$groupId.tsx
@@ -78,5 +78,5 @@ export default function EditPartGroupsRoute() {
description: partGroup?.description ?? "",
};
- return <PartGroupForm initialValues={initialValues} />;
+ return <PartGroupForm key={initialValues.id} initialValues={initialValues} />;
}
diff --git a/apps/carbon/app/routes/x+/parts+/uom.$uomId.tsx b/apps/carbon/app/routes/x+/parts+/uom.$uomId.tsx
index 722de9e713..30811415a4 100644
--- a/apps/carbon/app/routes/x+/parts+/uom.$uomId.tsx
+++ b/apps/carbon/app/routes/x+/parts+/uom.$uomId.tsx
@@ -79,5 +79,7 @@ export default function EditUnitOfMeasuresRoute() {
code: unitOfMeasure?.code ?? "",
};
- return <UnitOfMeasureForm initialValues={initialValues} />;
+ return (
+ <UnitOfMeasureForm key={initialValues.id} initialValues={initialValues} />
+ );
}
diff --git a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.details.tsx b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.details.tsx
index 6b02565f7a..9c94f2695e 100644
--- a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.details.tsx
+++ b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.details.tsx
@@ -91,6 +91,7 @@ export default function PurchaseInvoiceBasicRoute() {
return (
<PurchaseInvoiceForm
+ key={initialValues.id}
initialValues={initialValues}
paymentTerms={sharedData?.paymentTerms ?? []}
/>
diff --git a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.$lineId.tsx b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.$lineId.tsx
index 7d65be3d26..b82d2ce84a 100644
--- a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.$lineId.tsx
+++ b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.$lineId.tsx
@@ -117,5 +117,10 @@ export default function EditPurchaseInvoiceLineRoute() {
shelfId: purchaseInvoiceLine?.shelfId ?? "",
};
- return <PurchaseInvoiceLineForm initialValues={initialValues} />;
+ return (
+ <PurchaseInvoiceLineForm
+ key={initialValues.id}
+ initialValues={initialValues}
+ />
+ );
}
diff --git a/apps/carbon/app/routes/x+/purchase-order+/$orderId.delivery.tsx b/apps/carbon/app/routes/x+/purchase-order+/$orderId.delivery.tsx
index 90837b373a..68624946e8 100644
--- a/apps/carbon/app/routes/x+/purchase-order+/$orderId.delivery.tsx
+++ b/apps/carbon/app/routes/x+/purchase-order+/$orderId.delivery.tsx
@@ -139,6 +139,7 @@ export default function PurchaseOrderDeliveryRoute() {
return (
<PurchaseOrderDeliveryForm
+ key={initialValues.id}
initialValues={initialValues}
shippingMethods={shippingMethods}
shippingTerms={shippingTerms}
diff --git a/apps/carbon/app/routes/x+/purchase-order+/$orderId.details.tsx b/apps/carbon/app/routes/x+/purchase-order+/$orderId.details.tsx
index 2409a44681..e0b9856b57 100644
--- a/apps/carbon/app/routes/x+/purchase-order+/$orderId.details.tsx
+++ b/apps/carbon/app/routes/x+/purchase-order+/$orderId.details.tsx
@@ -81,5 +81,7 @@ export default function PurchaseOrderBasicRoute() {
notes: orderData?.purchaseOrder?.notes ?? "",
};
- return <PurchaseOrderForm initialValues={initialValues} />;
+ return (
+ <PurchaseOrderForm key={initialValues.id} initialValues={initialValues} />
+ );
}
diff --git a/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.$lineId.tsx b/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.$lineId.tsx
index d9504166cd..daaf356e14 100644
--- a/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.$lineId.tsx
+++ b/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.$lineId.tsx
@@ -117,5 +117,10 @@ export default function EditPurchaseOrderLineRoute() {
shelfId: purchaseOrderLine?.shelfId ?? "",
};
- return <PurchaseOrderLineForm initialValues={initialValues} />;
+ return (
+ <PurchaseOrderLineForm
+ key={initialValues.id}
+ initialValues={initialValues}
+ />
+ );
}
diff --git a/apps/carbon/app/routes/x+/purchase-order+/$orderId.payment.tsx b/apps/carbon/app/routes/x+/purchase-order+/$orderId.payment.tsx
index a58e0f29c5..f3e67bc8e3 100644
--- a/apps/carbon/app/routes/x+/purchase-order+/$orderId.payment.tsx
+++ b/apps/carbon/app/routes/x+/purchase-order+/$orderId.payment.tsx
@@ -111,11 +111,12 @@ export default function PurchaseOrderPaymentRoute() {
purchaseOrderPayment.invoiceSupplierContactId ?? undefined,
paymentTermId: purchaseOrderPayment.paymentTermId ?? undefined,
paymentComplete: purchaseOrderPayment.paymentComplete ?? undefined,
- currencyCode: purchaseOrderPayment.currencyCode ?? "USD",
+ currencyCode: (purchaseOrderPayment.currencyCode ?? "USD") as "USD",
};
return (
<PurchaseOrderPaymentForm
+ key={initialValues.id}
initialValues={initialValues}
paymentTerms={paymentTerms}
/>
diff --git a/apps/carbon/app/routes/x+/purchasing+/supplier-types.$supplierTypeId.tsx b/apps/carbon/app/routes/x+/purchasing+/supplier-types.$supplierTypeId.tsx
index 695bc91825..4fd53bd322 100644
--- a/apps/carbon/app/routes/x+/purchasing+/supplier-types.$supplierTypeId.tsx
+++ b/apps/carbon/app/routes/x+/purchasing+/supplier-types.$supplierTypeId.tsx
@@ -94,5 +94,7 @@ export default function EditSupplierTypesRoute() {
color: supplierType.color ?? "#000000",
};
- return <SupplierTypeForm initialValues={initialValues} />;
+ return (
+ <SupplierTypeForm key={initialValues.id} initialValues={initialValues} />
+ );
}
diff --git a/apps/carbon/app/routes/x+/quote+/$id.details.tsx b/apps/carbon/app/routes/x+/quote+/$id.details.tsx
index b65e906d62..6499ab34ba 100644
--- a/apps/carbon/app/routes/x+/quote+/$id.details.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$id.details.tsx
@@ -84,7 +84,7 @@ export default function QuotationBasicRoute() {
return (
<>
- <QuotationForm initialValues={initialValues} />
+ <QuotationForm key={initialValues.id} initialValues={initialValues} />
<QuotationDocuments
id={id}
attachments={quoteData.internalDocuments}
diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.delete.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.delete.tsx
index cda0eac7d6..b599b64111 100644
--- a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.delete.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.delete.tsx
@@ -3,8 +3,8 @@ import { json, redirect, useNavigate, useParams } from "@remix-run/react";
import type { ActionFunctionArgs } from "@remix-run/node";
import { ConfirmDelete } from "~/components/Modals";
import { useRouteData } from "~/hooks";
-import type { QuotationAssembly } from "~/modules/sales";
-import { deleteQuoteAssembly } from "~/modules/sales";
+import type { QuotationOperation } from "~/modules/sales";
+import { deleteQuoteOperation } from "~/modules/sales";
import { requirePermissions } from "~/services/auth";
import { flash } from "~/services/session.server";
import { assertIsPost } from "~/utils/http";
@@ -17,19 +17,19 @@ export async function action({ request, params }: ActionFunctionArgs) {
update: "sales",
});
- const { id: quoteId, lineId: quoteLineId, assemblyId } = params;
+ const { id: quoteId, lineId: quoteLineId, operationId } = params;
if (!quoteId) throw new Error("Could not find quoteId");
if (!quoteLineId) throw new Error("Could not find quoteLineId");
- if (!assemblyId) throw new Error("Could not find assemblyId");
+ if (!operationId) throw new Error("Could not find operationId");
- const deleteAssembly = await deleteQuoteAssembly(client, assemblyId);
+ const deleteOperation = await deleteQuoteOperation(client, operationId);
- if (deleteAssembly.error) {
+ if (deleteOperation.error) {
return json(
path.to.quoteLine(quoteId, quoteLineId),
await flash(
request,
- error(deleteAssembly.error, "Failed to update quote assembly")
+ error(deleteOperation.error, "Failed to update quote operation")
)
);
}
@@ -37,26 +37,25 @@ export async function action({ request, params }: ActionFunctionArgs) {
return redirect(path.to.quoteLine(quoteId, quoteLineId));
}
-export default function DeleteQuoteAssembly() {
+export default function DeleteQuoteOperation() {
const navigate = useNavigate();
- const { id, lineId, assemblyId } = useParams();
+ const { id, lineId, operationId } = useParams();
if (!id) throw new Error("id not found");
if (!lineId) throw new Error("lineId not found");
- if (!assemblyId) throw new Error("assemblyId not found");
+ if (!operationId) throw new Error("operationId not found");
- const routeData = useRouteData<{ quoteAssembly: QuotationAssembly }>(
- path.to.quoteAssembly(id, lineId, assemblyId)
+ const routeData = useRouteData<{ quoteOperation: QuotationOperation }>(
+ path.to.quoteOperation(id, lineId, operationId)
);
- if (!routeData?.quoteAssembly) throw new Error("quote assembly not found");
+ if (!routeData?.quoteOperation) throw new Error("quote operation not found");
return (
<ConfirmDelete
- action={path.to.deleteQuoteAssembly(id, lineId, assemblyId)}
- name={routeData?.quoteAssembly.partId}
- text={`Are you sure you want to delete the assembly: ${routeData?.quoteAssembly.partId}? This cannot be undone.`}
- onCancel={() => navigate(path.to.quoteAssembly(id, lineId, assemblyId))}
+ name={routeData.quoteOperation.description ?? "Operation"}
+ text={`Are you sure you want to delete the operation? This cannot be undone.`}
+ onCancel={() => navigate(path.to.quoteOperation(id, lineId, operationId))}
/>
);
}
diff --git a/apps/carbon/app/routes/x+/quote+/$id.tsx b/apps/carbon/app/routes/x+/quote+/$id.tsx
index 5de6baa504..cd08d36c39 100644
--- a/apps/carbon/app/routes/x+/quote+/$id.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$id.tsx
@@ -118,10 +118,10 @@ export default function QuotationRoute() {
quotationMaterials,
quotationOperations,
} = useLoaderData<typeof loader>();
- const [, setQuotation] = useQuotation();
+ const [quote, setQuote] = useQuotation();
useEffect(() => {
- setQuotation({
+ setQuote({
quote: quotation,
lines: quotationLines,
assemblies: quotationAssemblies,
@@ -133,7 +133,7 @@ export default function QuotationRoute() {
quotationAssemblies,
quotationMaterials,
quotationOperations,
- setQuotation,
+ setQuote,
quotation,
]);
@@ -146,9 +146,9 @@ export default function QuotationRoute() {
<CollapsibleSidebar width={260}>
<VStack className="border-b border-border p-4" spacing={1}>
<Heading size="h3" noOfLines={1}>
- QUO000001
+ {quote.quote?.quoteId}
</Heading>
- <QuotationStatus status="Draft" />
+ {quote.quote && <QuotationStatus status={quote.quote?.status} />}
</VStack>
<VStack className="border-b border-border p-2" spacing={0}>
<HStack className="w-full justify-between">
@@ -252,10 +252,10 @@ type BillOfMaterialNode = {
// type: "operation",
// children: [
// {
-// id: "8",
-// label: "Materials",
-// type: "materials",
-// children: [
+// id: "8",
+// label: "Materials",
+// type: "materials",
+// children: [
// {
// id: "9",
// label: "RAW000001",
@@ -352,9 +352,14 @@ const BillOfMaterialItem = ({
<Button
variant="ghost"
className="w-full justify-between text-muted-foreground"
+ asChild
>
- <span>{label}</span>
- <IoMdAdd />
+ <Link
+ to={path.to.newQuoteMaterial(params.id!, meta.quoteLineId, meta.id)}
+ >
+ <span>{label}</span>
+ <IoMdAdd />
+ </Link>
</Button>
);
case "operations":
@@ -372,7 +377,7 @@ const BillOfMaterialItem = ({
);
case "line":
isActive = pathname === path.to.quoteLine(params.id!, id);
- console.log(meta);
+
return (
<Button
variant={isActive ? "primary" : "ghost"}
@@ -396,23 +401,42 @@ const BillOfMaterialItem = ({
</Button>
);
case "assembly":
+ isActive =
+ pathname ===
+ path.to.quoteAssembly(params.id!, meta.quoteLineId, meta.id);
return (
<Button
leftIcon={<AiOutlinePartition />}
- variant="ghost"
+ variant={isActive ? "primary" : "ghost"}
className="flex-1 justify-start"
+ asChild
>
- {label}
+ <Link
+ to={path.to.quoteAssembly(params.id!, meta.quoteLineId, meta.id)}
+ prefetch="intent"
+ >
+ {label}
+ </Link>
</Button>
);
case "operation":
+ isActive = [
+ path.to.quoteOperation(params.id!, meta.quoteLineId, meta.id),
+ path.to.newQuoteMaterial(params.id!, meta.quoteLineId, meta.id),
+ ].includes(pathname);
return (
<Button
leftIcon={<LuClock />}
- variant="ghost"
+ variant={isActive ? "primary" : "ghost"}
className="flex-1 justify-start"
+ asChild
>
- {label}
+ <Link
+ to={path.to.quoteOperation(params.id!, meta.quoteLineId, meta.id)}
+ prefetch="intent"
+ >
+ {label}
+ </Link>
</Button>
);
case "material":
@@ -421,8 +445,13 @@ const BillOfMaterialItem = ({
leftIcon={<HiOutlineCube />}
variant="ghost"
className="flex-1 justify-start"
+ asChild
>
- {label}
+ <Link
+ to={path.to.quoteOperation(params.id!, meta.quoteLineId, parentId!)}
+ >
+ {label}
+ </Link>
</Button>
);
case "parent":
@@ -449,6 +478,7 @@ const BillOfMaterialExplorer = () => {
if (!params.id) throw new Error("id not found");
const menu = useQuotationMenu() as BillOfMaterialNode[];
+
const [expandedNodes, setExpandedNodes] = useState<Record<string, boolean>>({
[params.id]: true,
});
@@ -482,7 +512,9 @@ const BillOfMaterialExplorer = () => {
style={{
transition: "transform .25s ease",
transform:
- expandedNodes[node.id] || !node.children
+ expandedNodes[node.id] ||
+ !node.children ||
+ node.children?.length === 0
? undefined
: "rotate(-0.25turn)",
}}
diff --git a/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.$id.tsx b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.$id.tsx
index 99132ae6f1..383cd64d01 100644
--- a/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.$id.tsx
+++ b/apps/carbon/app/routes/x+/resources+/ability.$abilityId.employee.$id.tsx
@@ -117,6 +117,7 @@ export default function EmployeeAbilityRoute() {
return (
<EmployeeAbilityForm
+ key={`${initialValues.employeeId}${abilityId}`}
ability={routeData?.ability}
initialValues={initialValues}
weeks={routeData?.weeks ?? 4}
diff --git a/apps/carbon/app/routes/x+/resources+/attributes.$categoryId.tsx b/apps/carbon/app/routes/x+/resources+/attributes.$categoryId.tsx
index 0b44a6dd25..4ba8cc14b0 100644
--- a/apps/carbon/app/routes/x+/resources+/attributes.$categoryId.tsx
+++ b/apps/carbon/app/routes/x+/resources+/attributes.$categoryId.tsx
@@ -88,6 +88,10 @@ export default function EditAttributeCategoryRoute() {
};
return (
- <AttributeCategoryForm onClose={onClose} initialValues={initialValues} />
+ <AttributeCategoryForm
+ key={initialValues.id}
+ onClose={onClose}
+ initialValues={initialValues}
+ />
);
}
diff --git a/apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.$attributeId.tsx b/apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.$attributeId.tsx
index 0362d4e464..fc29298091 100644
--- a/apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.$attributeId.tsx
+++ b/apps/carbon/app/routes/x+/resources+/attributes.list.$categoryId.$attributeId.tsx
@@ -47,6 +47,7 @@ export default function EditAttributeRoute() {
return (
<AttributeForm
+ key={`${attribute.id}${categoryId}`}
initialValues={{
id: attribute?.id,
name: attribute?.name,
diff --git a/apps/carbon/app/routes/x+/resources+/contractors.$supplierContactId.tsx b/apps/carbon/app/routes/x+/resources+/contractors.$supplierContactId.tsx
index a120880963..c55340e699 100644
--- a/apps/carbon/app/routes/x+/resources+/contractors.$supplierContactId.tsx
+++ b/apps/carbon/app/routes/x+/resources+/contractors.$supplierContactId.tsx
@@ -86,5 +86,7 @@ export default function ContractorRoute() {
abilities: contractor.abilityIds ?? ([] as string[]),
};
- return <ContractorForm initialValues={initialValues} />;
+ return (
+ <ContractorForm key={initialValues.id} initialValues={initialValues} />
+ );
}
diff --git a/apps/carbon/app/routes/x+/resources+/departments.$departmentId.tsx b/apps/carbon/app/routes/x+/resources+/departments.$departmentId.tsx
index 011c6f1a21..e98d13bec6 100644
--- a/apps/carbon/app/routes/x+/resources+/departments.$departmentId.tsx
+++ b/apps/carbon/app/routes/x+/resources+/departments.$departmentId.tsx
@@ -85,5 +85,7 @@ export default function DepartmentRoute() {
parentDepartmentId: department.parentDepartmentId ?? undefined,
};
- return <DepartmentForm initialValues={initialValues} />;
+ return (
+ <DepartmentForm key={initialValues.id} initialValues={initialValues} />
+ );
}
diff --git a/apps/carbon/app/routes/x+/resources+/equipment.$typeId.tsx b/apps/carbon/app/routes/x+/resources+/equipment.$typeId.tsx
index d9a012564b..b5a022e4e1 100644
--- a/apps/carbon/app/routes/x+/resources+/equipment.$typeId.tsx
+++ b/apps/carbon/app/routes/x+/resources+/equipment.$typeId.tsx
@@ -89,5 +89,11 @@ export default function EditAttributeCategoryRoute() {
setupHours: equipmentType?.setupHours ?? 0,
};
- return <EquipmentTypeForm onClose={onClose} initialValues={initialValues} />;
+ return (
+ <EquipmentTypeForm
+ key={initialValues.id}
+ onClose={onClose}
+ initialValues={initialValues}
+ />
+ );
}
diff --git a/apps/carbon/app/routes/x+/resources+/equipment.list.$typeId.$equipmentId.tsx b/apps/carbon/app/routes/x+/resources+/equipment.list.$typeId.$equipmentId.tsx
index eaeb1c6895..bc484cfcf2 100644
--- a/apps/carbon/app/routes/x+/resources+/equipment.list.$typeId.$equipmentId.tsx
+++ b/apps/carbon/app/routes/x+/resources+/equipment.list.$typeId.$equipmentId.tsx
@@ -58,6 +58,7 @@ export default function EditEquipmentRoute() {
return (
<EquipmentForm
+ key={`${equipment.id}${typeId}`}
initialValues={{
id: equipment?.id,
name: equipment?.name ?? "",
diff --git a/apps/carbon/app/routes/x+/resources+/holidays.$holidayId.tsx b/apps/carbon/app/routes/x+/resources+/holidays.$holidayId.tsx
index 332c85ad79..02e51fd2ec 100644
--- a/apps/carbon/app/routes/x+/resources+/holidays.$holidayId.tsx
+++ b/apps/carbon/app/routes/x+/resources+/holidays.$holidayId.tsx
@@ -83,5 +83,5 @@ export default function HolidayRoute() {
date: holiday.date,
};
- return <HolidayForm initialValues={initialValues} />;
+ return <HolidayForm key={initialValues.id} initialValues={initialValues} />;
}
diff --git a/apps/carbon/app/routes/x+/resources+/partners.$supplierLocationId.$abilityId.tsx b/apps/carbon/app/routes/x+/resources+/partners.$supplierLocationId.$abilityId.tsx
index 53396a5971..176c6ba04c 100644
--- a/apps/carbon/app/routes/x+/resources+/partners.$supplierLocationId.$abilityId.tsx
+++ b/apps/carbon/app/routes/x+/resources+/partners.$supplierLocationId.$abilityId.tsx
@@ -82,5 +82,5 @@ export default function PartnerRoute() {
abilityId: partner.abilityId ?? "",
};
- return <PartnerForm initialValues={initialValues} />;
+ return <PartnerForm key={initialValues.id} initialValues={initialValues} />;
}
diff --git a/apps/carbon/app/routes/x+/resources+/shifts.$shiftId.tsx b/apps/carbon/app/routes/x+/resources+/shifts.$shiftId.tsx
index be3ec173c8..97f3a129d2 100644
--- a/apps/carbon/app/routes/x+/resources+/shifts.$shiftId.tsx
+++ b/apps/carbon/app/routes/x+/resources+/shifts.$shiftId.tsx
@@ -87,5 +87,5 @@ export default function ShiftRoute() {
sunday: shift.sunday,
};
- return <ShiftForm initialValues={initialValues} />;
+ return <ShiftForm key={initialValues.id} initialValues={initialValues} />;
}
diff --git a/apps/carbon/app/routes/x+/resources+/work-cells.$typeId.tsx b/apps/carbon/app/routes/x+/resources+/work-cells.$typeId.tsx
index 0f414953bd..e141ee4673 100644
--- a/apps/carbon/app/routes/x+/resources+/work-cells.$typeId.tsx
+++ b/apps/carbon/app/routes/x+/resources+/work-cells.$typeId.tsx
@@ -92,5 +92,11 @@ export default function EditAttributeCategoryRoute() {
defaultStandardFactor: workCellType?.defaultStandardFactor ?? "Total Hours",
};
- return <WorkCellTypeForm onClose={onClose} initialValues={initialValues} />;
+ return (
+ <WorkCellTypeForm
+ key={initialValues.id}
+ onClose={onClose}
+ initialValues={initialValues}
+ />
+ );
}
diff --git a/apps/carbon/app/routes/x+/resources+/work-cells.list.$typeId.$workCellId.tsx b/apps/carbon/app/routes/x+/resources+/work-cells.list.$typeId.$workCellId.tsx
index 13697e5478..267e5753f7 100644
--- a/apps/carbon/app/routes/x+/resources+/work-cells.list.$typeId.$workCellId.tsx
+++ b/apps/carbon/app/routes/x+/resources+/work-cells.list.$typeId.$workCellId.tsx
@@ -56,6 +56,7 @@ export default function EditWorkCellRoute() {
return (
<WorkCellForm
+ key={`${workCell?.id}${typeId}`}
initialValues={{
id: workCell?.id,
name: workCell?.name ?? "",
diff --git a/apps/carbon/app/routes/x+/sales+/customer-types.$customerTypeId.tsx b/apps/carbon/app/routes/x+/sales+/customer-types.$customerTypeId.tsx
index da68a18cb1..f0f84e8447 100644
--- a/apps/carbon/app/routes/x+/sales+/customer-types.$customerTypeId.tsx
+++ b/apps/carbon/app/routes/x+/sales+/customer-types.$customerTypeId.tsx
@@ -85,5 +85,7 @@ export default function EditCustomerTypesRoute() {
color: customerType?.color ?? "#000000",
};
- return <CustomerTypeForm initialValues={initialValues} />;
+ return (
+ <CustomerTypeForm key={initialValues.id} initialValues={initialValues} />
+ );
}
diff --git a/apps/carbon/app/routes/x+/service+/$serviceId.index.tsx b/apps/carbon/app/routes/x+/service+/$serviceId.index.tsx
index f8a2d0d069..13d9b6f40b 100644
--- a/apps/carbon/app/routes/x+/service+/$serviceId.index.tsx
+++ b/apps/carbon/app/routes/x+/service+/$serviceId.index.tsx
@@ -64,5 +64,5 @@ export default function ServiceDetailsRoute() {
blocked: routeData.service?.blocked ?? false,
};
- return <ServiceForm initialValues={initialValues} />;
+ return <ServiceForm key={initialValues.id} initialValues={initialValues} />;
}
diff --git a/apps/carbon/app/routes/x+/settings+/sequences.$tableId.tsx b/apps/carbon/app/routes/x+/settings+/sequences.$tableId.tsx
index a2ff9df899..175db8e73e 100644
--- a/apps/carbon/app/routes/x+/settings+/sequences.$tableId.tsx
+++ b/apps/carbon/app/routes/x+/settings+/sequences.$tableId.tsx
@@ -81,5 +81,7 @@ export default function EditSequenceRoute() {
suffix: sequence?.suffix ?? "",
};
- return <SequenceForm initialValues={initialValues} />;
+ return (
+ <SequenceForm key={initialValues.table} initialValues={initialValues} />
+ );
}
diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId.contacts.$supplierContactId.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId.contacts.$supplierContactId.tsx
index 09bf2288c5..0b0921c8da 100644
--- a/apps/carbon/app/routes/x+/supplier+/$supplierId.contacts.$supplierContactId.tsx
+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId.contacts.$supplierContactId.tsx
@@ -108,5 +108,7 @@ export default function EditSupplierContactRoute() {
birthday: contact?.contact?.birthday ?? undefined,
};
- return <SupplierContactForm initialValues={initialValues} />;
+ return (
+ <SupplierContactForm key={initialValues.id} initialValues={initialValues} />
+ );
}
diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId.index.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId.index.tsx
index 4d8c4225fa..4787f4bbac 100644
--- a/apps/carbon/app/routes/x+/supplier+/$supplierId.index.tsx
+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId.index.tsx
@@ -69,5 +69,5 @@ export default function SupplierEditRoute() {
taxId: routeData?.supplier?.taxId ?? "",
};
- return <SupplierForm initialValues={initialValues} />;
+ return <SupplierForm key={initialValues.id} initialValues={initialValues} />;
}
diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId.locations.$supplierLocationId.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId.locations.$supplierLocationId.tsx
index 763d1f2ff9..bfdc6b856f 100644
--- a/apps/carbon/app/routes/x+/supplier+/$supplierId.locations.$supplierLocationId.tsx
+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId.locations.$supplierLocationId.tsx
@@ -96,5 +96,10 @@ export default function EditSupplierLocationRoute() {
postalCode: location?.address?.postalCode ?? "",
};
- return <SupplierLocationForm initialValues={initialValues} />;
+ return (
+ <SupplierLocationForm
+ key={initialValues.id}
+ initialValues={initialValues}
+ />
+ );
}
diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId.payments.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId.payments.tsx
index c1ed09adfc..fb8c0f7d78 100644
--- a/apps/carbon/app/routes/x+/supplier+/$supplierId.payments.tsx
+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId.payments.tsx
@@ -89,5 +89,10 @@ export default function SupplierPaymentRoute() {
currencyCode: supplierPayment?.currencyCode ?? "",
};
- return <SupplierPaymentForm initialValues={initialValues} />;
+ return (
+ <SupplierPaymentForm
+ key={initialValues.supplierId}
+ initialValues={initialValues}
+ />
+ );
}
diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId.shipping.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId.shipping.tsx
index a513c0b9dd..9de4817c9c 100644
--- a/apps/carbon/app/routes/x+/supplier+/$supplierId.shipping.tsx
+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId.shipping.tsx
@@ -91,5 +91,10 @@ export default function SupplierShippingRoute() {
shippingTermId: supplierShipping?.shippingTermId ?? "",
};
- return <SupplierShippingForm initialValues={initialValues} />;
+ return (
+ <SupplierShippingForm
+ key={initialValues.supplierId}
+ initialValues={initialValues}
+ />
+ );
}
diff --git a/apps/carbon/app/routes/x+/users+/employee-types.$employeeTypeId.tsx b/apps/carbon/app/routes/x+/users+/employee-types.$employeeTypeId.tsx
index dd5932feda..6d6503f9bf 100644
--- a/apps/carbon/app/routes/x+/users+/employee-types.$employeeTypeId.tsx
+++ b/apps/carbon/app/routes/x+/users+/employee-types.$employeeTypeId.tsx
@@ -131,6 +131,7 @@ export default function EditEmployeeTypesRoute() {
return (
<EmployeeTypeForm
+ key={initialValues.id}
// @ts-expect-error
initialValues={initialValues}
/>
diff --git a/apps/carbon/app/routes/x+/users+/employees.$employeeId.tsx b/apps/carbon/app/routes/x+/users+/employees.$employeeId.tsx
index 942022dddf..6574507022 100644
--- a/apps/carbon/app/routes/x+/users+/employees.$employeeId.tsx
+++ b/apps/carbon/app/routes/x+/users+/employees.$employeeId.tsx
@@ -114,6 +114,7 @@ export default function UsersEmployeeRoute() {
return (
<EmployeePermissionsForm
+ key={initialValues.id}
name={`${employee?.user?.firstName} ${employee?.user?.lastName}`}
employeeTypes={employeeTypes}
// @ts-ignore
diff --git a/apps/carbon/app/routes/x+/users+/groups.$groupId.tsx b/apps/carbon/app/routes/x+/users+/groups.$groupId.tsx
index 8f33896c6b..c3a08b3f06 100644
--- a/apps/carbon/app/routes/x+/users+/groups.$groupId.tsx
+++ b/apps/carbon/app/routes/x+/users+/groups.$groupId.tsx
@@ -106,5 +106,5 @@ export default function UsersGroupRoute() {
selections: group?.selections || [],
};
- return <GroupForm initialValues={initialValues} />;
+ return <GroupForm key={initialValues.id} initialValues={initialValues} />;
}