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.

refactor: remove type from customer and supplier table and header cards

Rob Carrington7ba065b6f87e
diff --git a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierHeader.tsx b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierHeader.tsx
index bff4682ad6..31ff08e3bd 100644
--- a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierHeader.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierHeader.tsx
@@ -20,11 +20,7 @@ import {
useOptimisticAssignment,
} from "~/components";
import { usePermissions, useRouteData } from "~/hooks";
-import type {
- SupplierDetail,
- SupplierStatus,
- SupplierType,
-} from "~/modules/purchasing";
+import type { SupplierDetail, SupplierStatus } from "~/modules/purchasing";
import type { ListItem } from "~/types";
import { path } from "~/utils/path";
@@ -38,7 +34,6 @@ const SupplierHeader = () => {
);
const sharedSupplierData = useRouteData<{
- supplierTypes: SupplierType[];
supplierStatuses: SupplierStatus[];
paymentTerms: ListItem[];
}>(path.to.supplierRoot);
@@ -47,10 +42,6 @@ const SupplierHeader = () => {
(status) => status.id === routeData?.supplier?.supplierStatusId
)?.name;
- const supplierType = sharedSupplierData?.supplierTypes?.find(
- (type) => type.id === routeData?.supplier?.supplierTypeId
- )?.name;
-
const optimisticAssignment = useOptimisticAssignment({
id: supplierId,
table: "supplier",
@@ -102,12 +93,6 @@ const SupplierHeader = () => {
</CardAttribute>
)}
- <CardAttribute>
- <CardAttributeLabel>Type</CardAttributeLabel>
- <CardAttributeValue>
- {supplierType ? <Enumerable value={supplierType!} /> : "-"}
- </CardAttributeValue>
- </CardAttribute>
<CardAttribute>
<CardAttributeLabel>Status</CardAttributeLabel>
<CardAttributeValue>
diff --git a/apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTable.tsx b/apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTable.tsx
index ac22b8ecab..7485d18ac5 100644
--- a/apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTable.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTable.tsx
@@ -13,23 +13,18 @@ import {
} from "~/components";
import { usePermissions } from "~/hooks";
import { useCustomColumns } from "~/hooks/useCustomColumns";
-import type {
- Supplier,
- SupplierStatus,
- SupplierType,
-} from "~/modules/purchasing";
+import type { Supplier, SupplierStatus } from "~/modules/purchasing";
import { usePeople } from "~/stores";
import { path } from "~/utils/path";
type SuppliersTableProps = {
data: Supplier[];
count: number;
- supplierTypes: Partial<SupplierType>[];
supplierStatuses: SupplierStatus[];
};
const SuppliersTable = memo(
- ({ data, count, supplierStatuses, supplierTypes }: SuppliersTableProps) => {
+ ({ data, count, supplierStatuses }: SuppliersTableProps) => {
const navigate = useNavigate();
const permissions = usePermissions();
const [people] = usePeople();
@@ -46,21 +41,6 @@ const SuppliersTable = memo(
</Hyperlink>
),
},
-
- {
- accessorKey: "type",
- header: "Supplier Type",
- cell: (item) => <Enumerable value={item.getValue<string>()} />,
- meta: {
- filter: {
- type: "static",
- options: supplierTypes?.map((type) => ({
- value: type.name ?? "",
- label: <Enumerable value={type.name ?? ""} />,
- })),
- },
- },
- },
{
accessorKey: "status",
header: "Supplier Status",
@@ -176,7 +156,7 @@ const SuppliersTable = memo(
];
return [...defaultColumns, ...customColumns];
- }, [people, supplierTypes, supplierStatuses, customColumns]);
+ }, [people, supplierStatuses, customColumns]);
const renderContextMenu = useMemo(
// eslint-disable-next-line react/display-name
diff --git a/apps/carbon/app/modules/sales/ui/Customer/CustomerHeader.tsx b/apps/carbon/app/modules/sales/ui/Customer/CustomerHeader.tsx
index c1c47df1d9..f0d1eaf758 100644
--- a/apps/carbon/app/modules/sales/ui/Customer/CustomerHeader.tsx
+++ b/apps/carbon/app/modules/sales/ui/Customer/CustomerHeader.tsx
@@ -20,11 +20,7 @@ import {
useOptimisticAssignment,
} from "~/components";
import { usePermissions, useRouteData } from "~/hooks";
-import type {
- CustomerDetail,
- CustomerStatus,
- CustomerType,
-} from "~/modules/sales";
+import type { CustomerDetail, CustomerStatus } from "~/modules/sales";
import type { ListItem } from "~/types";
import { path } from "~/utils/path";
@@ -38,7 +34,6 @@ const CustomerHeader = () => {
);
const sharedCustomerData = useRouteData<{
- customerTypes: CustomerType[];
customerStatuses: CustomerStatus[];
paymentTerms: ListItem[];
}>(path.to.customerRoot);
@@ -47,10 +42,6 @@ const CustomerHeader = () => {
(status) => status.id === routeData?.customer?.customerStatusId
)?.name;
- const customerType = sharedCustomerData?.customerTypes?.find(
- (type) => type.id === routeData?.customer?.customerTypeId
- )?.name;
-
const optimisticAssignment = useOptimisticAssignment({
id: customerId,
table: "customer",
@@ -100,12 +91,6 @@ const CustomerHeader = () => {
</CardAttributeValue>
</CardAttribute>
)}
- <CardAttribute>
- <CardAttributeLabel>Type</CardAttributeLabel>
- <CardAttributeValue>
- {customerType ? <Enumerable value={customerType!} /> : "-"}
- </CardAttributeValue>
- </CardAttribute>
<CardAttribute>
<CardAttributeLabel>Status</CardAttributeLabel>
<CardAttributeValue>
diff --git a/apps/carbon/app/modules/sales/ui/Customers/CustomersTable.tsx b/apps/carbon/app/modules/sales/ui/Customers/CustomersTable.tsx
index d929f2a9cb..8d39d43619 100644
--- a/apps/carbon/app/modules/sales/ui/Customers/CustomersTable.tsx
+++ b/apps/carbon/app/modules/sales/ui/Customers/CustomersTable.tsx
@@ -13,19 +13,18 @@ import {
} from "~/components";
import { usePermissions } from "~/hooks";
import { useCustomColumns } from "~/hooks/useCustomColumns";
-import type { Customer, CustomerStatus, CustomerType } from "~/modules/sales";
+import type { Customer, CustomerStatus } from "~/modules/sales";
import { usePeople } from "~/stores";
import { path } from "~/utils/path";
type CustomersTableProps = {
data: Customer[];
count: number;
- customerTypes: Partial<CustomerType>[];
customerStatuses: CustomerStatus[];
};
const CustomersTable = memo(
- ({ data, count, customerStatuses, customerTypes }: CustomersTableProps) => {
+ ({ data, count, customerStatuses }: CustomersTableProps) => {
const navigate = useNavigate();
const permissions = usePermissions();
const [people] = usePeople();
@@ -42,21 +41,6 @@ const CustomersTable = memo(
</Hyperlink>
),
},
-
- {
- accessorKey: "type",
- header: "Customer Type",
- cell: (item) => <Enumerable value={item.getValue<string>()} />,
- meta: {
- filter: {
- type: "static",
- options: customerTypes?.map((type) => ({
- value: type.name ?? "",
- label: <Enumerable value={type.name ?? ""} />,
- })),
- },
- },
- },
{
accessorKey: "status",
header: "Customer Status",
@@ -148,7 +132,7 @@ const CustomersTable = memo(
];
return [...defaultColumns, ...customColumns];
- }, [customerTypes, customerStatuses, people, customColumns]);
+ }, [customerStatuses, people, customColumns]);
const renderContextMenu = useMemo(
// eslint-disable-next-line react/display-name