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.

Adding fallback formatter

Kartik Bajajea1a5863d80b
diff --git a/apps/erp/app/components/Table/Table.tsx b/apps/erp/app/components/Table/Table.tsx
index 697a9d7b82..b59ac611ef 100644
--- a/apps/erp/app/components/Table/Table.tsx
+++ b/apps/erp/app/components/Table/Table.tsx
@@ -24,6 +24,7 @@ import {
} from "@carbon/react";
import { clamp } from "@carbon/utils";
import { useNavigation } from "@remix-run/react";
+import { useNumberFormatter } from "@react-aria/i18n";
import type {
Column,
ColumnDef,
@@ -135,6 +136,7 @@ const Table = <T extends object>({
renderContextMenu,
}: TableProps<T>) => {
const tableContainerRef = useRef<HTMLDivElement>(null);
+ const numberFormatter = useNumberFormatter();
const { currentView, view } = useSavedViews();
@@ -962,7 +964,7 @@ const Table = <T extends object>({
>
{!footer.isPlaceholder && footer.column.columnDef.meta?.renderTotal &&
<div className="flex justify-start items-center gap-2">
- {footer.column.columnDef.meta?.formatter ? footer.column.columnDef.meta.formatter(total) : total}
+ {footer.column.columnDef.meta?.formatter ? footer.column.columnDef.meta.formatter(total) : numberFormatter.format(total)}
</div>
}
</Th>
diff --git a/apps/erp/app/modules/inventory/ui/Inventory/InventoryTable.tsx b/apps/erp/app/modules/inventory/ui/Inventory/InventoryTable.tsx
index b7deec3a5f..0e277a241a 100644
--- a/apps/erp/app/modules/inventory/ui/Inventory/InventoryTable.tsx
+++ b/apps/erp/app/modules/inventory/ui/Inventory/InventoryTable.tsx
@@ -120,7 +120,6 @@ const InventoryTable = memo(
),
meta: {
icon: <LuPackage />,
- formatter: numberFormatter.format,
renderTotal: true, },
},
@@ -130,7 +129,6 @@ const InventoryTable = memo(
cell: ({ row }) => numberFormatter.format(row.original.daysRemaining),
meta: {
icon: <LuClock />,
- formatter: numberFormatter.format,
renderTotal: true,
},
},
@@ -140,7 +138,6 @@ const InventoryTable = memo(
cell: ({ row }) => numberFormatter.format(row.original.leadTime),
meta: {
icon: <LuClock />,
- formatter: numberFormatter.format,
renderTotal: true,
},
},
@@ -197,7 +194,6 @@ const InventoryTable = memo(
numberFormatter.format(row.original.usageLast30Days),
meta: {
icon: <LuCalculator />,
- formatter: numberFormatter.format,
renderTotal: true,
},
},
@@ -208,7 +204,6 @@ const InventoryTable = memo(
numberFormatter.format(row.original.usageLast90Days),
meta: {
icon: <LuCalculator />,
- formatter: numberFormatter.format,
renderTotal: true,
},
},
@@ -219,7 +214,6 @@ const InventoryTable = memo(
numberFormatter.format(row.original.quantityOnPurchaseOrder),
meta: {
icon: <LuMoveUp className="text-emerald-500" />,
- formatter: numberFormatter.format,
renderTotal: true,
},
},
@@ -230,7 +224,6 @@ const InventoryTable = memo(
numberFormatter.format(row.original.quantityOnProductionOrder),
meta: {
icon: <LuMoveUp className="text-emerald-500" />,
- formatter: numberFormatter.format,
renderTotal: true,
},
},
@@ -241,7 +234,6 @@ const InventoryTable = memo(
numberFormatter.format(row.original.quantityOnProductionDemand),
meta: {
icon: <LuMoveDown className="text-red-500" />,
- formatter: numberFormatter.format,
renderTotal: true,
},
},
@@ -252,7 +244,6 @@ const InventoryTable = memo(
numberFormatter.format(row.original.quantityOnSalesOrder),
meta: {
icon: <LuMoveDown className="text-red-500" />,
- formatter: numberFormatter.format,
renderTotal: true,
},
},
diff --git a/apps/erp/app/modules/inventory/ui/Traceability/TrackedEntitiesTable.tsx b/apps/erp/app/modules/inventory/ui/Traceability/TrackedEntitiesTable.tsx
index 94c274e2fd..288490872c 100644
--- a/apps/erp/app/modules/inventory/ui/Traceability/TrackedEntitiesTable.tsx
+++ b/apps/erp/app/modules/inventory/ui/Traceability/TrackedEntitiesTable.tsx
@@ -69,6 +69,7 @@ const TrackedEntitiesTable = memo(
),
meta: {
icon: <LuHash />,
+ renderTotal: true,
},
},
{
diff --git a/apps/erp/app/modules/production/ui/Planning/ProductionPlanningTable.tsx b/apps/erp/app/modules/production/ui/Planning/ProductionPlanningTable.tsx
index dc3d0fc9a9..574951b93e 100644
--- a/apps/erp/app/modules/production/ui/Planning/ProductionPlanningTable.tsx
+++ b/apps/erp/app/modules/production/ui/Planning/ProductionPlanningTable.tsx
@@ -321,7 +321,6 @@ const ProductionPlanningTable = ({
cell: ({ row }) => numberFormatter.format(row.original.quantityOnHand),
meta: {
icon: <LuPackage />,
- formatter: numberFormatter.format,
renderTotal: true,
},
},
diff --git a/apps/erp/app/modules/purchasing/ui/Planning/PurchasingPlanningTable.tsx b/apps/erp/app/modules/purchasing/ui/Planning/PurchasingPlanningTable.tsx
index 2e54757b6a..26b31d7763 100644
--- a/apps/erp/app/modules/purchasing/ui/Planning/PurchasingPlanningTable.tsx
+++ b/apps/erp/app/modules/purchasing/ui/Planning/PurchasingPlanningTable.tsx
@@ -381,7 +381,6 @@ const PlanningTable = memo(
numberFormatter.format(row.original.quantityOnHand),
meta: {
icon: <LuPackage />,
- formatter: numberFormatter.format,
renderTotal: true,
},
},