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.

fix: always sort quote line prices by quantity ascending

Brad Barbinf25b35f4695c
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx
index 974659df98..a46f0e7dde 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx
@@ -101,7 +101,9 @@ const LineItems = ({
return acc;
}
acc[line.id!] =
- routeData?.prices?.filter((p) => p.quoteLineId === line.id) ?? [];
+ routeData?.prices
+ ?.filter((p) => p.quoteLineId === line.id)
+ .sort((a, b) => a.quantity - b.quantity) ?? [];
return acc;
},
{}
diff --git a/apps/erp/app/routes/share+/quote.$id.tsx b/apps/erp/app/routes/share+/quote.$id.tsx
index 1d9b515923..d97fa99b0b 100644
--- a/apps/erp/app/routes/share+/quote.$id.tsx
+++ b/apps/erp/app/routes/share+/quote.$id.tsx
@@ -473,7 +473,9 @@ const LineItems = ({
return acc;
}
acc[line.id!] =
- quoteLinePrices?.filter((p) => p.quoteLineId === line.id) ?? [];
+ quoteLinePrices
+ ?.filter((p) => p.quoteLineId === line.id)
+ .sort((a, b) => a.quantity - b.quantity) ?? [];
return acc;
}, {}) ?? {},
[quoteLines, quoteLinePrices]
@@ -491,9 +493,9 @@ const LineItems = ({
return (
<VStack spacing={8} className="w-full">
{quoteLines?.map((line) => {
- const prices = quoteLinePrices?.find(
- (price) => price.quoteLineId === line.id
- );
+ const prices = quoteLinePrices
+ ?.filter((price) => price.quoteLineId === line.id)
+ .sort((a, b) => a.quantity - b.quantity);
if (!line || !prices || !line.id) {
return null;