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: material dimensions crud

Brad Barbin38dd3435d2c3
diff --git a/apps/erp/app/modules/items/items.models.ts b/apps/erp/app/modules/items/items.models.ts
index 29b7e2c345..48dc3dc2eb 100644
--- a/apps/erp/app/modules/items/items.models.ts
+++ b/apps/erp/app/modules/items/items.models.ts
@@ -484,6 +484,12 @@ export const itemUnitSalePriceValidator = z.object({
allowInvoiceDiscount: zfd.checkbox(),
});
+export const materialDimensionValidator = z.object({
+ id: zfd.text(z.string().optional()),
+ name: z.string().min(1, { message: "Name is required" }).max(255),
+ materialFormId: z.string().min(1, { message: "Shape is required" }),
+});
+
export const materialFinishValidator = z.object({
id: zfd.text(z.string().optional()),
materialSubstanceId: z.string().min(1, { message: "Substance is required" }),
diff --git a/apps/erp/app/modules/items/items.service.ts b/apps/erp/app/modules/items/items.service.ts
index c0dc66014b..fad6937bc5 100644
--- a/apps/erp/app/modules/items/items.service.ts
+++ b/apps/erp/app/modules/items/items.service.ts
@@ -28,6 +28,7 @@ import type {
itemUnitSalePriceValidator,
itemValidator,
makeMethodVersionValidator,
+ materialDimensionValidator,
materialFinishValidator,
materialFormValidator,
materialGradeValidator,
@@ -226,6 +227,13 @@ export async function deleteItemPostingGroup(
return client.from("itemPostingGroup").delete().eq("id", id);
}
+export async function deleteMaterialDimension(
+ client: SupabaseClient<Database>,
+ id: string
+) {
+ return client.from("materialDimension").delete().eq("id", id);
+}
+
export async function deleteMaterialFinish(
client: SupabaseClient<Database>,
id: string
@@ -812,6 +820,39 @@ export async function getMaterialsList(
return query.order("name");
}
+export async function getMaterialDimension(
+ client: SupabaseClient<Database>,
+ id: string
+) {
+ return client.from("materialDimension").select("*").eq("id", id).single();
+}
+
+export async function getMaterialDimensions(
+ client: SupabaseClient<Database>,
+ companyId: string,
+ args?: GenericQueryFilters & { search: string | null }
+) {
+ let query = client
+ .from("materialDimensions")
+ .select("*", {
+ count: "exact",
+ })
+ .or(`companyId.eq.${companyId},companyId.is.null`);
+
+ if (args?.search) {
+ query = query.ilike("name", `%${args.search}%`);
+ }
+
+ if (args) {
+ query = setGenericQueryFilters(query, args, [
+ { column: "formName", ascending: true },
+ { column: "name", ascending: true },
+ ]);
+ }
+
+ return query;
+}
+
export async function getMaterialFinish(
client: SupabaseClient<Database>,
id: string
@@ -2526,6 +2567,34 @@ export async function upsertMaterial(
return updateMaterial;
}
+export async function upsertMaterialDimension(
+ client: SupabaseClient<Database>,
+ materialDimension:
+ | (Omit<z.infer<typeof materialDimensionValidator>, "id"> & {
+ companyId: string;
+ })
+ | (Omit<z.infer<typeof materialDimensionValidator>, "id"> & {
+ id: string;
+ })
+) {
+ if ("id" in materialDimension) {
+ return (
+ client
+ .from("materialDimension")
+ .update(sanitize(materialDimension))
+ // @ts-ignore
+ .eq("id", materialDimension.id)
+ .select("id")
+ .single()
+ );
+ }
+ return client
+ .from("materialDimension")
+ .insert([materialDimension])
+ .select("*")
+ .single();
+}
+
export async function upsertMaterialFinish(
client: SupabaseClient<Database>,
materialFinish:
diff --git a/apps/erp/app/modules/items/types.ts b/apps/erp/app/modules/items/types.ts
index d02f57c33a..6b9849d157 100644
--- a/apps/erp/app/modules/items/types.ts
+++ b/apps/erp/app/modules/items/types.ts
@@ -14,6 +14,7 @@ import type {
getItemShelfQuantities,
getMakeMethods,
getMaterial,
+ getMaterialDimensions,
getMaterialFinishes,
getMaterialForms,
getMaterialGrades,
@@ -108,6 +109,10 @@ export type Material = NonNullable<
Awaited<ReturnType<typeof getMaterials>>["data"]
>[number];
+export type MaterialDimension = NonNullable<
+ Awaited<ReturnType<typeof getMaterialDimensions>>["data"]
+>[number];
+
export type MaterialFinish = NonNullable<
Awaited<ReturnType<typeof getMaterialFinishes>>["data"]
>[number];
diff --git a/apps/erp/app/modules/items/ui/MaterialDimensions/MaterialDimensionForm.tsx b/apps/erp/app/modules/items/ui/MaterialDimensions/MaterialDimensionForm.tsx
new file mode 100644
index 0000000000..69ffacabe9
--- /dev/null
+++ b/apps/erp/app/modules/items/ui/MaterialDimensions/MaterialDimensionForm.tsx
@@ -0,0 +1,108 @@
+import { ValidatedForm } from "@carbon/form";
+import {
+ Button,
+ HStack,
+ ModalDrawer,
+ ModalDrawerBody,
+ ModalDrawerContent,
+ ModalDrawerFooter,
+ ModalDrawerHeader,
+ ModalDrawerProvider,
+ ModalDrawerTitle,
+ VStack,
+ toast,
+} from "@carbon/react";
+import { useFetcher } from "@remix-run/react";
+import type { PostgrestResponse } from "@supabase/supabase-js";
+import { useEffect } from "react";
+import type { z } from "zod";
+import { Hidden, Input, Submit } from "~/components/Form";
+import Shape from "~/components/Form/Shape";
+import { usePermissions } from "~/hooks";
+import { path } from "~/utils/path";
+import { materialDimensionValidator } from "../../items.models";
+
+type MaterialDimensionFormProps = {
+ initialValues: z.infer<typeof materialDimensionValidator>;
+ type?: "modal" | "drawer";
+ open?: boolean;
+ onClose: (data?: { id: string; name: string }) => void;
+};
+
+const MaterialDimensionForm = ({
+ initialValues,
+ open = true,
+ type = "drawer",
+ onClose,
+}: MaterialDimensionFormProps) => {
+ const permissions = usePermissions();
+ const fetcher = useFetcher<PostgrestResponse<{ id: string; name: string }>>();
+
+ const isEditing = initialValues.id !== undefined;
+ const isDisabled = isEditing
+ ? !permissions.can("update", "parts")
+ : !permissions.can("create", "parts");
+
+ useEffect(() => {
+ if (type !== "modal") return;
+
+ if (fetcher.state === "loading" && fetcher.data?.data) {
+ onClose?.();
+ toast.success(`Created material dimension`);
+ } else if (fetcher.state === "idle" && fetcher.data?.error) {
+ toast.error(
+ `Failed to create material dimension: ${fetcher.data.error.message}`
+ );
+ }
+ }, [fetcher.data, fetcher.state, onClose, type]);
+
+ return (
+ <ModalDrawerProvider type={type}>
+ <ModalDrawer
+ open={open}
+ onOpenChange={(open) => {
+ if (!open) onClose?.();
+ }}
+ >
+ <ModalDrawerContent>
+ <ValidatedForm
+ validator={materialDimensionValidator}
+ method="post"
+ action={
+ isEditing
+ ? path.to.materialDimension(initialValues.id!)
+ : path.to.newMaterialDimension
+ }
+ defaultValues={initialValues}
+ fetcher={fetcher}
+ className="flex flex-col h-full"
+ >
+ <ModalDrawerHeader>
+ <ModalDrawerTitle>
+ {isEditing ? "Edit" : "New"} Material Dimension
+ </ModalDrawerTitle>
+ </ModalDrawerHeader>
+ <ModalDrawerBody>
+ <Hidden name="id" />
+ <Hidden name="type" value={type} />
+ <VStack spacing={4}>
+ <Shape name="materialFormId" label="Shape" />
+ <Input name="name" label="Name" />
+ </VStack>
+ </ModalDrawerBody>
+ <ModalDrawerFooter>
+ <HStack>
+ <Submit isDisabled={isDisabled}>Save</Submit>
+ <Button size="md" variant="solid" onClick={() => onClose()}>
+ Cancel
+ </Button>
+ </HStack>
+ </ModalDrawerFooter>
+ </ValidatedForm>
+ </ModalDrawerContent>
+ </ModalDrawer>
+ </ModalDrawerProvider>
+ );
+};
+
+export default MaterialDimensionForm;
diff --git a/apps/erp/app/modules/items/ui/MaterialDimensions/MaterialDimensionsTable.tsx b/apps/erp/app/modules/items/ui/MaterialDimensions/MaterialDimensionsTable.tsx
new file mode 100644
index 0000000000..2849d22743
--- /dev/null
+++ b/apps/erp/app/modules/items/ui/MaterialDimensions/MaterialDimensionsTable.tsx
@@ -0,0 +1,148 @@
+import { Badge, MenuIcon, MenuItem } from "@carbon/react";
+import { useNavigate } from "@remix-run/react";
+import type { ColumnDef } from "@tanstack/react-table";
+import { memo, useCallback, useMemo } from "react";
+import {
+ LuCircleCheck,
+ LuDessert,
+ LuPencil,
+ LuShapes,
+ LuTrash,
+} from "react-icons/lu";
+import { Hyperlink, New, Table } from "~/components";
+import { Enumerable } from "~/components/Enumerable";
+import { useSubstance } from "~/components/Form/Substance";
+import { usePermissions, useUrlParams } from "~/hooks";
+import { path } from "~/utils/path";
+import type { MaterialDimension } from "../../types";
+
+type MaterialDimensionsTableProps = {
+ data: MaterialDimension[];
+ count: number;
+};
+
+const MaterialDimensionsTable = memo(
+ ({ data, count }: MaterialDimensionsTableProps) => {
+ const [params] = useUrlParams();
+ const navigate = useNavigate();
+ const permissions = usePermissions();
+ const substances = useSubstance();
+
+ const rows = useMemo(() => data, [data]);
+
+ const columns = useMemo<ColumnDef<(typeof rows)[number]>[]>(() => {
+ const defaultColumns: ColumnDef<(typeof rows)[number]>[] = [
+ {
+ accessorKey: "formName",
+ header: "Shape",
+ cell: ({ row }) => <Enumerable value={row.original.formName} />,
+ meta: {
+ icon: <LuShapes />,
+ filter: {
+ type: "static",
+ options: substances.map((substance) => ({
+ label: <Enumerable value={substance.label} />,
+ value: substance.label,
+ })),
+ },
+ },
+ },
+ {
+ accessorKey: "name",
+ header: "Dimension",
+ cell: ({ row }) =>
+ row.original.companyId === null ? (
+ row.original.name
+ ) : (
+ <Hyperlink
+ to={`${path.to.materialDimension(
+ row.original.id!
+ )}?${params.toString()}`}
+ >
+ {row.original.name}
+ </Hyperlink>
+ ),
+ meta: {
+ icon: <LuDessert />,
+ },
+ },
+
+ {
+ accessorKey: "companyId",
+ header: "Standard",
+ cell: ({ row }) => {
+ return row.original.companyId === null ? (
+ <Badge variant="outline">Standard</Badge>
+ ) : (
+ <Badge variant="blue">Custom</Badge>
+ );
+ },
+ meta: {
+ icon: <LuCircleCheck />,
+ },
+ },
+ ];
+ return [...defaultColumns];
+ }, [params, substances]);
+
+ const renderContextMenu = useCallback(
+ (row: (typeof rows)[number]) => {
+ return (
+ <>
+ <MenuItem
+ disabled={
+ !permissions.can("update", "parts") || row.companyId === null
+ }
+ onClick={() => {
+ navigate(
+ `${path.to.materialDimension(row.id!)}?${params.toString()}`
+ );
+ }}
+ >
+ <MenuIcon icon={<LuPencil />} />
+ Edit Material Dimension
+ </MenuItem>
+ <MenuItem
+ disabled={
+ !permissions.can("delete", "parts") || row.companyId === null
+ }
+ destructive
+ onClick={() => {
+ navigate(
+ `${path.to.deleteMaterialDimension(
+ row.id!
+ )}?${params.toString()}`
+ );
+ }}
+ >
+ <MenuIcon icon={<LuTrash />} />
+ Delete Material Dimension
+ </MenuItem>
+ </>
+ );
+ },
+ [navigate, params, permissions]
+ );
+
+ return (
+ <Table<(typeof rows)[number]>
+ data={data}
+ columns={columns}
+ count={count}
+ primaryAction={
+ permissions.can("create", "parts") && (
+ <New
+ label="Material Dimension"
+ to={`${path.to.newMaterialDimension}?${params.toString()}`}
+ />
+ )
+ }
+ renderContextMenu={renderContextMenu}
+ title="Material Dimensions"
+ />
+ );
+ }
+);
+
+MaterialDimensionsTable.displayName = "MaterialDimensionsTable";
+export default MaterialDimensionsTable;
diff --git a/apps/erp/app/modules/items/ui/MaterialFinishes/MaterialFinishForm.tsx b/apps/erp/app/modules/items/ui/MaterialFinishes/MaterialFinishForm.tsx
index b4fc4ccc64..8f267b079f 100644
--- a/apps/erp/app/modules/items/ui/MaterialFinishes/MaterialFinishForm.tsx
+++ b/apps/erp/app/modules/items/ui/MaterialFinishes/MaterialFinishForm.tsx
@@ -48,10 +48,10 @@ const MaterialFinishForm = ({
if (fetcher.state === "loading" && fetcher.data?.data) {
onClose?.();
- toast.success(`Created material form`);
+ toast.success(`Created material finish`);
} else if (fetcher.state === "idle" && fetcher.data?.error) {
toast.error(
- `Failed to create material form: ${fetcher.data.error.message}`
+ `Failed to create material finish: ${fetcher.data.error.message}`
);
}
}, [fetcher.data, fetcher.state, onClose, type]);
diff --git a/apps/erp/app/modules/items/ui/MaterialFinishes/MaterialFinishesTable.tsx b/apps/erp/app/modules/items/ui/MaterialFinishes/MaterialFinishesTable.tsx
index 98ae2e187b..47ab0d36ad 100644
--- a/apps/erp/app/modules/items/ui/MaterialFinishes/MaterialFinishesTable.tsx
+++ b/apps/erp/app/modules/items/ui/MaterialFinishes/MaterialFinishesTable.tsx
@@ -52,14 +52,14 @@ const MaterialFinishesTable = memo(
header: "Finish",
cell: ({ row }) =>
row.original.companyId === null ? (
- <Enumerable value={row.original.name} />
+ row.original.name
) : (
<Hyperlink
to={`${path.to.materialFinish(
row.original.id!
)}?${params.toString()}`}
>
- <Enumerable value={row.original.name} />
+ {row.original.name}
</Hyperlink>
),
meta: {
diff --git a/apps/erp/app/modules/items/ui/MaterialGrades/MaterialGradeForm.tsx b/apps/erp/app/modules/items/ui/MaterialGrades/MaterialGradeForm.tsx
index 6ae1e0a8cf..9c8fdceb79 100644
--- a/apps/erp/app/modules/items/ui/MaterialGrades/MaterialGradeForm.tsx
+++ b/apps/erp/app/modules/items/ui/MaterialGrades/MaterialGradeForm.tsx
@@ -48,10 +48,10 @@ const MaterialGradeForm = ({
if (fetcher.state === "loading" && fetcher.data?.data) {
onClose?.();
- toast.success(`Created material form`);
+ toast.success(`Created material grade`);
} else if (fetcher.state === "idle" && fetcher.data?.error) {
toast.error(
- `Failed to create material form: ${fetcher.data.error.message}`
+ `Failed to create material grade: ${fetcher.data.error.message}`
);
}
}, [fetcher.data, fetcher.state, onClose, type]);
diff --git a/apps/erp/app/modules/items/ui/MaterialGrades/MaterialGradesTable.tsx b/apps/erp/app/modules/items/ui/MaterialGrades/MaterialGradesTable.tsx
index 40b9bb5581..a301141519 100644
--- a/apps/erp/app/modules/items/ui/MaterialGrades/MaterialGradesTable.tsx
+++ b/apps/erp/app/modules/items/ui/MaterialGrades/MaterialGradesTable.tsx
@@ -52,14 +52,14 @@ const MaterialGradesTable = memo(
header: "Grade",
cell: ({ row }) =>
row.original.companyId === null ? (
- <Enumerable value={row.original.name} />
+ row.original.name
) : (
<Hyperlink
to={`${path.to.materialGrade(
row.original.id!
)}?${params.toString()}`}
>
- <Enumerable value={row.original.name} />
+ {row.original.name}
</Hyperlink>
),
meta: {
diff --git a/apps/erp/app/modules/items/ui/useItemsSubmodules.tsx b/apps/erp/app/modules/items/ui/useItemsSubmodules.tsx
index bc029fbf0f..7349054e42 100644
--- a/apps/erp/app/modules/items/ui/useItemsSubmodules.tsx
+++ b/apps/erp/app/modules/items/ui/useItemsSubmodules.tsx
@@ -1,6 +1,7 @@
import { AiOutlinePartition } from "react-icons/ai";
import {
LuAtom,
+ LuAxis3D,
LuBeef,
LuDessert,
LuGlassWater,
@@ -67,6 +68,12 @@ const itemsRoutes: AuthenticatedRouteGroup[] = [
{
name: "Configure",
routes: [
+ {
+ name: "Dimensions",
+ to: path.to.materialDimensions,
+ icon: <LuAxis3D />,
+ role: "employee",
+ },
{
name: "Finishes",
to: path.to.materialFinishes,
diff --git a/apps/erp/app/routes/x+/items+/dimensions.$id.tsx b/apps/erp/app/routes/x+/items+/dimensions.$id.tsx
new file mode 100644
index 0000000000..4ee9469d5a
--- /dev/null
+++ b/apps/erp/app/routes/x+/items+/dimensions.$id.tsx
@@ -0,0 +1,99 @@
+import { assertIsPost, error, notFound, success } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { flash } from "@carbon/auth/session.server";
+import { validationError, validator } from "@carbon/form";
+import { useLoaderData, useNavigate } from "@remix-run/react";
+import type { ActionFunctionArgs, LoaderFunctionArgs } from "@vercel/remix";
+import { json, redirect } from "@vercel/remix";
+import {
+ getMaterialDimension,
+ materialDimensionValidator,
+ upsertMaterialDimension,
+} from "~/modules/items";
+import MaterialDimensionForm from "~/modules/items/ui/MaterialDimensions/MaterialDimensionForm";
+
+import { getParams, path } from "~/utils/path";
+
+export async function loader({ request, params }: LoaderFunctionArgs) {
+ const { client } = await requirePermissions(request, {
+ view: "parts",
+ role: "employee",
+ });
+
+ const { id } = params;
+ if (!id) throw notFound("id not found");
+
+ const materialDimension = await getMaterialDimension(client, id);
+
+ if (materialDimension.data?.companyId === null) {
+ throw redirect(
+ path.to.materialDimensions,
+ await flash(
+ request,
+ error(new Error("Access denied"), "Cannot edit global material grade")
+ )
+ );
+ }
+
+ return json({
+ materialDimension: materialDimension?.data ?? null,
+ });
+}
+
+export async function action({ request, params }: ActionFunctionArgs) {
+ assertIsPost(request);
+ const { client } = await requirePermissions(request, {
+ update: "parts",
+ });
+
+ const { id } = params;
+ if (!id) throw new Error("Could not find id");
+
+ const formData = await request.formData();
+ const validation = await validator(materialDimensionValidator).validate(
+ formData
+ );
+
+ if (validation.error) {
+ return validationError(validation.error);
+ }
+
+ const updateMaterialDimension = await upsertMaterialDimension(client, {
+ id: id,
+ ...validation.data,
+ });
+
+ if (updateMaterialDimension.error) {
+ return json(
+ {},
+ await flash(
+ request,
+ error(updateMaterialDimension.error, "Failed to update material grade")
+ )
+ );
+ }
+
+ throw redirect(
+ `${path.to.materialDimensions}?${getParams(request)}`,
+ await flash(request, success("Updated material grade"))
+ );
+}
+
+export default function EditMaterialDimensionsRoute() {
+ const { materialDimension } = useLoaderData<typeof loader>();
+ const navigate = useNavigate();
+
+ const initialValues = {
+ id: materialDimension?.id ?? undefined,
+ name: materialDimension?.name ?? "",
+ materialFormId: materialDimension?.materialFormId ?? "",
+ };
+
+ return (
+ <MaterialDimensionForm
+ key={initialValues.id}
+ initialValues={initialValues}
+ onClose={() => navigate(-1)}
+ />
+ );
+}
diff --git a/apps/erp/app/routes/x+/items+/dimensions.delete.$id.tsx b/apps/erp/app/routes/x+/items+/dimensions.delete.$id.tsx
new file mode 100644
index 0000000000..7432977f60
--- /dev/null
+++ b/apps/erp/app/routes/x+/items+/dimensions.delete.$id.tsx
@@ -0,0 +1,84 @@
+import { error, notFound, success } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { flash } from "@carbon/auth/session.server";
+import { useLoaderData, useNavigate, useParams } from "@remix-run/react";
+import type { ActionFunctionArgs, LoaderFunctionArgs } from "@vercel/remix";
+import { json, redirect } from "@vercel/remix";
+import { ConfirmDelete } from "~/components/Modals";
+import { deleteMaterialDimension, getMaterialDimension } from "~/modules/items";
+import { getParams, path } from "~/utils/path";
+
+export async function loader({ request, params }: LoaderFunctionArgs) {
+ const { client } = await requirePermissions(request, {
+ view: "parts",
+ });
+ const { id } = params;
+ if (!id) throw notFound("id not found");
+
+ const materialDimension = await getMaterialDimension(client, id);
+ if (materialDimension.error) {
+ throw redirect(
+ path.to.materialDimensions,
+ await flash(
+ request,
+ error(materialDimension.error, "Failed to get material dimension")
+ )
+ );
+ }
+
+ return json({ materialDimension: materialDimension.data });
+}
+
+export async function action({ request, params }: ActionFunctionArgs) {
+ const { client } = await requirePermissions(request, {
+ delete: "parts",
+ });
+
+ const { id } = params;
+ if (!id) {
+ throw redirect(
+ path.to.materialDimensions,
+ await flash(
+ request,
+ error(params, "Failed to get an material dimension id")
+ )
+ );
+ }
+
+ const { error: deleteTypeError } = await deleteMaterialDimension(client, id);
+ if (deleteTypeError) {
+ throw redirect(
+ `${path.to.materialDimensions}?${getParams(request)}`,
+ await flash(
+ request,
+ error(deleteTypeError, "Failed to delete material dimension")
+ )
+ );
+ }
+
+ throw redirect(
+ path.to.materialDimensions,
+ await flash(request, success("Successfully deleted material dimension"))
+ );
+}
+
+export default function DeleteMaterialDimensionRoute() {
+ const { id } = useParams();
+ if (!id) throw new Error("id not found");
+
+ const { materialDimension } = useLoaderData<typeof loader>();
+ const navigate = useNavigate();
+
+ if (!materialDimension) return null;
+
+ const onCancel = () => navigate(-1);
+
+ return (
+ <ConfirmDelete
+ action={path.to.deleteMaterialDimension(id)}
+ name={materialDimension.name}
+ text={`Are you sure you want to delete the material dimension: ${materialDimension.name}? This cannot be undone.`}
+ onCancel={onCancel}
+ />
+ );
+}
diff --git a/apps/erp/app/routes/x+/items+/dimensions.new.tsx b/apps/erp/app/routes/x+/items+/dimensions.new.tsx
new file mode 100644
index 0000000000..0e6dd4a231
--- /dev/null
+++ b/apps/erp/app/routes/x+/items+/dimensions.new.tsx
@@ -0,0 +1,92 @@
+import { assertIsPost, error, success } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { flash } from "@carbon/auth/session.server";
+import { validationError, validator } from "@carbon/form";
+import { useNavigate } from "@remix-run/react";
+import type { ActionFunctionArgs, LoaderFunctionArgs } from "@vercel/remix";
+import { json, redirect } from "@vercel/remix";
+import {
+ materialDimensionValidator,
+ upsertMaterialDimension,
+} from "~/modules/items";
+import MaterialDimensionForm from "~/modules/items/ui/MaterialDimensions/MaterialDimensionForm";
+
+import { getParams, path } from "~/utils/path";
+
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requirePermissions(request, {
+ create: "parts",
+ });
+
+ return null;
+}
+
+export async function action({ request }: ActionFunctionArgs) {
+ assertIsPost(request);
+ const { client, companyId } = await requirePermissions(request, {
+ create: "parts",
+ });
+
+ const formData = await request.formData();
+ const modal = formData.get("type") == "modal";
+
+ const validation = await validator(materialDimensionValidator).validate(
+ formData
+ );
+
+ if (validation.error) {
+ return validationError(validation.error);
+ }
+
+ const { id, ...data } = validation.data;
+
+ const insertMaterialDimension = await upsertMaterialDimension(client, {
+ ...data,
+ companyId,
+ });
+ if (insertMaterialDimension.error) {
+ return json(
+ {},
+ await flash(
+ request,
+ error(
+ insertMaterialDimension.error,
+ "Failed to insert material dimension"
+ )
+ )
+ );
+ }
+
+ const materialDimensionId = insertMaterialDimension.data?.id;
+ if (!materialDimensionId) {
+ return json(
+ {},
+ await flash(
+ request,
+ error(insertMaterialDimension, "Failed to insert material dimension")
+ )
+ );
+ }
+
+ return modal
+ ? json(insertMaterialDimension, { status: 201 })
+ : redirect(
+ `${path.to.materialDimensions}?${getParams(request)}`,
+ await flash(request, success("Dimension created"))
+ );
+}
+
+export default function NewMaterialDimensionsRoute() {
+ const navigate = useNavigate();
+ const initialValues = {
+ name: "",
+ materialFormId: "",
+ };
+
+ return (
+ <MaterialDimensionForm
+ onClose={() => navigate(-1)}
+ initialValues={initialValues}
+ />
+ );
+}
diff --git a/apps/erp/app/routes/x+/items+/dimensions.tsx b/apps/erp/app/routes/x+/items+/dimensions.tsx
new file mode 100644
index 0000000000..ad46a9eb9d
--- /dev/null
+++ b/apps/erp/app/routes/x+/items+/dimensions.tsx
@@ -0,0 +1,65 @@
+import { error } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { flash } from "@carbon/auth/session.server";
+import { VStack } from "@carbon/react";
+import { Outlet, useLoaderData } from "@remix-run/react";
+import type { LoaderFunctionArgs } from "@vercel/remix";
+import { json, redirect } from "@vercel/remix";
+import { getMaterialDimensions } from "~/modules/items";
+import MaterialDimensionsTable from "~/modules/items/ui/MaterialDimensions/MaterialDimensionsTable";
+
+import type { Handle } from "~/utils/handle";
+import { path } from "~/utils/path";
+import { getGenericQueryFilters } from "~/utils/query";
+
+export const handle: Handle = {
+ breadcrumb: "Dimensions",
+ to: path.to.materialDimensions,
+};
+
+export async function loader({ request }: LoaderFunctionArgs) {
+ const { client, companyId } = await requirePermissions(request, {
+ view: "parts",
+ role: "employee",
+ });
+
+ const url = new URL(request.url);
+ const searchParams = new URLSearchParams(url.search);
+ const search = searchParams.get("search");
+ const { limit, offset, sorts, filters } =
+ getGenericQueryFilters(searchParams);
+
+ const [materialDimensions] = await Promise.all([
+ getMaterialDimensions(client, companyId, {
+ limit,
+ offset,
+ sorts,
+ search,
+ filters,
+ }),
+ ]);
+
+ if (materialDimensions.error) {
+ console.error(materialDimensions.error);
+ throw redirect(
+ path.to.items,
+ await flash(request, error(null, "Error loading material dimensions"))
+ );
+ }
+
+ return json({
+ materialDimensions: materialDimensions.data ?? [],
+ count: materialDimensions.count ?? 0,
+ });
+}
+
+export default function MaterialDimensionsRoute() {
+ const { materialDimensions, count } = useLoaderData<typeof loader>();
+
+ return (
+ <VStack spacing={0} className="h-full">
+ <MaterialDimensionsTable data={materialDimensions} count={count ?? 0} />
+ <Outlet />
+ </VStack>
+ );
+}
diff --git a/apps/erp/app/utils/path.ts b/apps/erp/app/utils/path.ts
index 0a73d009dd..c7947e2f34 100644
--- a/apps/erp/app/utils/path.ts
+++ b/apps/erp/app/utils/path.ts
@@ -67,6 +67,7 @@ export const path = {
materialForms: `${api}/items/forms`,
materialGrades: `${api}/items/grades`,
materialFinishes: `${api}/items/finishes`,
+ materialDimensions: `${api}/items/dimensions`,
materialSubstances: `${api}/items/substances`,
messagingNotify: `${api}/messaging/notify`,
mrp: (locationId?: string) =>
@@ -506,6 +507,8 @@ export const path = {
generatePath(`${x}/job/methods/operation/parameter/delete/${id}`),
deleteJobOperationTool: (id: string) =>
generatePath(`${x}/job/methods/operation/tool/delete/${id}`),
+ deleteMaterialDimension: (id: string) =>
+ generatePath(`${x}/items/dimensions/delete/${id}`),
deleteMaterialFinish: (id: string) =>
generatePath(`${x}/items/finishes/delete/${id}`),
deleteMaterialForm: (id: string) =>
@@ -737,6 +740,9 @@ export const path = {
generatePath(`${x}/material/${id}/view/costing`),
materialDetails: (id: string) =>
generatePath(`${x}/material/${id}/view/details`),
+ materialDimension: (id: string) =>
+ generatePath(`${x}/items/dimensions/${id}`),
+ materialDimensions: `${x}/items/dimensions`,
materialFinish: (id: string) => generatePath(`${x}/items/finishes/${id}`),
materialFinishes: `${x}/items/finishes`,
materialForm: (id: string) => generatePath(`${x}/items/forms/${id}`),
@@ -852,6 +858,7 @@ export const path = {
newProcedureParameter: (id: string) =>
generatePath(`${x}/procedure/${id}/parameters/new`),
newItemPostingGroup: `${x}/items/groups/new`,
+ newMaterialDimension: `${x}/items/dimensions/new`,
newMaterialFinish: `${x}/items/finishes/new`,
newMaterialForm: `${x}/items/forms/new`,
newMaterialGrade: `${x}/items/grades/new`,
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index 8843410e4e..952cfcab11 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -14820,6 +14820,9 @@ export default {
{
$ref: "#/parameters/rowFilter.materialDimensions.companyId",
},
+ {
+ $ref: "#/parameters/rowFilter.materialDimensions.formName",
+ },
{
$ref: "#/parameters/select",
},
@@ -14858,78 +14861,6 @@ export default {
},
tags: ["materialDimensions"],
},
- post: {
- parameters: [
- {
- $ref: "#/parameters/body.materialDimensions",
- },
- {
- $ref: "#/parameters/select",
- },
- {
- $ref: "#/parameters/preferPost",
- },
- ],
- responses: {
- "201": {
- description: "Created",
- },
- },
- tags: ["materialDimensions"],
- },
- delete: {
- parameters: [
- {
- $ref: "#/parameters/rowFilter.materialDimensions.id",
- },
- {
- $ref: "#/parameters/rowFilter.materialDimensions.materialFormId",
- },
- {
- $ref: "#/parameters/rowFilter.materialDimensions.name",
- },
- {
- $ref: "#/parameters/rowFilter.materialDimensions.companyId",
- },
- {
- $ref: "#/parameters/preferReturn",
- },
- ],
- responses: {
- "204": {
- description: "No Content",
- },
- },
- tags: ["materialDimensions"],
- },
- patch: {
- parameters: [
- {
- $ref: "#/parameters/rowFilter.materialDimensions.id",
- },
- {
- $ref: "#/parameters/rowFilter.materialDimensions.materialFormId",
- },
- {
- $ref: "#/parameters/rowFilter.materialDimensions.name",
- },
- {
- $ref: "#/parameters/rowFilter.materialDimensions.companyId",
- },
- {
- $ref: "#/parameters/body.materialDimensions",
- },
- {
- $ref: "#/parameters/preferReturn",
- },
- ],
- responses: {
- "204": {
- description: "No Content",
- },
- },
- tags: ["materialDimensions"],
- },
},
"/salesOrder": {
get: {
@@ -43911,6 +43842,132 @@ export default {
tags: ["nonConformanceSupplier"],
},
},
+ "/materialDimension": {
+ get: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.materialDimension.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.materialDimension.materialFormId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.materialDimension.name",
+ },
+ {
+ $ref: "#/parameters/rowFilter.materialDimension.companyId",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/order",
+ },
+ {
+ $ref: "#/parameters/range",
+ },
+ {
+ $ref: "#/parameters/rangeUnit",
+ },
+ {
+ $ref: "#/parameters/offset",
+ },
+ {
+ $ref: "#/parameters/limit",
+ },
+ {
+ $ref: "#/parameters/preferCount",
+ },
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ schema: {
+ items: {
+ $ref: "#/definitions/materialDimension",
+ },
+ type: "array",
+ },
+ },
+ "206": {
+ description: "Partial Content",
+ },
+ },
+ tags: ["materialDimension"],
+ },
+ post: {
+ parameters: [
+ {
+ $ref: "#/parameters/body.materialDimension",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/preferPost",
+ },
+ ],
+ responses: {
+ "201": {
+ description: "Created",
+ },
+ },
+ tags: ["materialDimension"],
+ },
+ delete: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.materialDimension.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.materialDimension.materialFormId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.materialDimension.name",
+ },
+ {
+ $ref: "#/parameters/rowFilter.materialDimension.companyId",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["materialDimension"],
+ },
+ patch: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.materialDimension.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.materialDimension.materialFormId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.materialDimension.name",
+ },
+ {
+ $ref: "#/parameters/rowFilter.materialDimension.companyId",
+ },
+ {
+ $ref: "#/parameters/body.materialDimension",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["materialDimension"],
+ },
+ },
"/salesOrders": {
get: {
parameters: [
@@ -64894,10 +64951,8 @@ export default {
type: "object",
},
materialDimensions: {
- required: ["id", "materialFormId", "name"],
properties: {
id: {
- default: "public.xid()",
description: "Note:\nThis is a Primary Key.<pk/>",
format: "text",
type: "string",
@@ -64918,6 +64973,10 @@ export default {
format: "text",
type: "string",
},
+ formName: {
+ format: "text",
+ type: "string",
+ },
},
type: "object",
},
@@ -78358,6 +78417,34 @@ export default {
},
type: "object",
},
+ materialDimension: {
+ required: ["id", "materialFormId", "name"],
+ properties: {
+ id: {
+ default: "public.xid()",
+ description: "Note:\nThis is a Primary Key.<pk/>",
+ format: "text",
+ type: "string",
+ },
+ materialFormId: {
+ description:
+ "Note:\nThis is a Foreign Key to `materialForm.id`.<fk table='materialForm' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ name: {
+ format: "text",
+ type: "string",
+ },
+ companyId: {
+ description:
+ "Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ },
+ type: "object",
+ },
salesOrders: {
properties: {
id: {
@@ -90712,6 +90799,12 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.materialDimensions.formName": {
+ name: "formName",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.salesOrder": {
name: "salesOrder",
description: "salesOrder",
@@ -105916,6 +106009,39 @@ export default {
in: "query",
type: "string",
},
+ "body.materialDimension": {
+ name: "materialDimension",
+ description: "materialDimension",
+ required: false,
+ in: "body",
+ schema: {
+ $ref: "#/definitions/materialDimension",
+ },
+ },
+ "rowFilter.materialDimension.id": {
+ name: "id",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.materialDimension.materialFormId": {
+ name: "materialFormId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.materialDimension.name": {
+ name: "name",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.materialDimension.companyId": {
+ name: "companyId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.salesOrders": {
name: "salesOrders",
description: "salesOrders",
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 6e07940ee6..b07e0e779a 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -12119,52 +12119,10 @@ export type Database = {
isOneToOne: false;
referencedRelation: "materialForm";
referencedColumns: ["id"];
- },
- {
- foreignKeyName: "material_materialSubstanceId_fkey";
- columns: ["materialSubstanceId"];
- isOneToOne: false;
- referencedRelation: "materialSubstance";
- referencedColumns: ["id"];
- },
- {
- foreignKeyName: "material_updatedBy_fkey";
- columns: ["updatedBy"];
- isOneToOne: false;
- referencedRelation: "employees";
- referencedColumns: ["id"];
- },
- {
- foreignKeyName: "material_updatedBy_fkey";
- columns: ["updatedBy"];
- isOneToOne: false;
- referencedRelation: "employeesAcrossCompanies";
- referencedColumns: ["id"];
- },
- {
- foreignKeyName: "material_updatedBy_fkey";
- columns: ["updatedBy"];
- isOneToOne: false;
- referencedRelation: "employeeSummary";
- referencedColumns: ["id"];
- },
- {
- foreignKeyName: "material_updatedBy_fkey";
- columns: ["updatedBy"];
- isOneToOne: false;
- referencedRelation: "user";
- referencedColumns: ["id"];
- },
- {
- foreignKeyName: "material_updatedBy_fkey";
- columns: ["updatedBy"];
- isOneToOne: false;
- referencedRelation: "userDefaults";
- referencedColumns: ["userId"];
}
];
};
- materialDimensions: {
+ materialDimension: {
Row: {
companyId: string | null;
id: string;
@@ -37855,6 +37813,52 @@ export type Database = {
}
];
};
+ materialDimensions: {
+ Row: {
+ companyId: string | null;
+ formName: string | null;
+ id: string | null;
+ materialFormId: string | null;
+ name: string | null;
+ };
+ Relationships: [
+ {
+ foreignKeyName: "materialDimensions_companyId_fkey";
+ columns: ["companyId"];
+ isOneToOne: false;
+ referencedRelation: "companies";
+ referencedColumns: ["id"];
+ },
+ {
+ foreignKeyName: "materialDimensions_companyId_fkey";
+ columns: ["companyId"];
+ isOneToOne: false;
+ referencedRelation: "company";
+ referencedColumns: ["id"];
+ },
+ {
+ foreignKeyName: "materialDimensions_companyId_fkey";
+ columns: ["companyId"];
+ isOneToOne: false;
+ referencedRelation: "customFieldTables";
+ referencedColumns: ["companyId"];
+ },
+ {
+ foreignKeyName: "materialDimensions_companyId_fkey";
+ columns: ["companyId"];
+ isOneToOne: false;
+ referencedRelation: "integrations";
+ referencedColumns: ["companyId"];
+ },
+ {
+ foreignKeyName: "materialDimensions_materialFormId_fkey";
+ columns: ["materialFormId"];
+ isOneToOne: false;
+ referencedRelation: "materialForm";
+ referencedColumns: ["id"];
+ }
+ ];
+ };
materialFinishes: {
Row: {
companyId: string | null;
@@ -43079,14 +43083,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey";
- columns: ["paymentCountryCode"];
+ columns: ["customerCountryCode"];
isOneToOne: false;
referencedRelation: "country";
referencedColumns: ["alpha2"];
},
{
foreignKeyName: "address_countryCode_fkey";
- columns: ["customerCountryCode"];
+ columns: ["paymentCountryCode"];
isOneToOne: false;
referencedRelation: "country";
referencedColumns: ["alpha2"];
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 6e07940ee6..b07e0e779a 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -12119,52 +12119,10 @@ export type Database = {
isOneToOne: false;
referencedRelation: "materialForm";
referencedColumns: ["id"];
- },
- {
- foreignKeyName: "material_materialSubstanceId_fkey";
- columns: ["materialSubstanceId"];
- isOneToOne: false;
- referencedRelation: "materialSubstance";
- referencedColumns: ["id"];
- },
- {
- foreignKeyName: "material_updatedBy_fkey";
- columns: ["updatedBy"];
- isOneToOne: false;
- referencedRelation: "employees";
- referencedColumns: ["id"];
- },
- {
- foreignKeyName: "material_updatedBy_fkey";
- columns: ["updatedBy"];
- isOneToOne: false;
- referencedRelation: "employeesAcrossCompanies";
- referencedColumns: ["id"];
- },
- {
- foreignKeyName: "material_updatedBy_fkey";
- columns: ["updatedBy"];
- isOneToOne: false;
- referencedRelation: "employeeSummary";
- referencedColumns: ["id"];
- },
- {
- foreignKeyName: "material_updatedBy_fkey";
- columns: ["updatedBy"];
- isOneToOne: false;
- referencedRelation: "user";
- referencedColumns: ["id"];
- },
- {
- foreignKeyName: "material_updatedBy_fkey";
- columns: ["updatedBy"];
- isOneToOne: false;
- referencedRelation: "userDefaults";
- referencedColumns: ["userId"];
}
];
};
- materialDimensions: {
+ materialDimension: {
Row: {
companyId: string | null;
id: string;
@@ -37855,6 +37813,52 @@ export type Database = {
}
];
};
+ materialDimensions: {
+ Row: {
+ companyId: string | null;
+ formName: string | null;
+ id: string | null;
+ materialFormId: string | null;
+ name: string | null;
+ };
+ Relationships: [
+ {
+ foreignKeyName: "materialDimensions_companyId_fkey";
+ columns: ["companyId"];
+ isOneToOne: false;
+ referencedRelation: "companies";
+ referencedColumns: ["id"];
+ },
+ {
+ foreignKeyName: "materialDimensions_companyId_fkey";
+ columns: ["companyId"];
+ isOneToOne: false;
+ referencedRelation: "company";
+ referencedColumns: ["id"];
+ },
+ {
+ foreignKeyName: "materialDimensions_companyId_fkey";
+ columns: ["companyId"];
+ isOneToOne: false;
+ referencedRelation: "customFieldTables";
+ referencedColumns: ["companyId"];
+ },
+ {
+ foreignKeyName: "materialDimensions_companyId_fkey";
+ columns: ["companyId"];
+ isOneToOne: false;
+ referencedRelation: "integrations";
+ referencedColumns: ["companyId"];
+ },
+ {
+ foreignKeyName: "materialDimensions_materialFormId_fkey";
+ columns: ["materialFormId"];
+ isOneToOne: false;
+ referencedRelation: "materialForm";
+ referencedColumns: ["id"];
+ }
+ ];
+ };
materialFinishes: {
Row: {
companyId: string | null;
@@ -43079,14 +43083,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey";
- columns: ["paymentCountryCode"];
+ columns: ["customerCountryCode"];
isOneToOne: false;
referencedRelation: "country";
referencedColumns: ["alpha2"];
},
{
foreignKeyName: "address_countryCode_fkey";
- columns: ["customerCountryCode"];
+ columns: ["paymentCountryCode"];
isOneToOne: false;
referencedRelation: "country";
referencedColumns: ["alpha2"];
diff --git a/packages/database/supabase/migrations/20250719100358_material-seed.sql b/packages/database/supabase/migrations/20250719100358_material-seed.sql
index a60bfcc5fd..7f5e19d167 100644
--- a/packages/database/supabase/migrations/20250719100358_material-seed.sql
+++ b/packages/database/supabase/migrations/20250719100358_material-seed.sql
@@ -232,7 +232,7 @@ INSERT INTO "materialGrade" ("id", "materialSubstanceId", "name", "companyId") V
-CREATE TABLE "materialDimensions" (
+CREATE TABLE "materialDimension" (
"id" TEXT NOT NULL PRIMARY KEY DEFAULT xid(),
"materialFormId" TEXT NOT NULL,
"name" TEXT NOT NULL,
@@ -243,7 +243,17 @@ CREATE TABLE "materialDimensions" (
CONSTRAINT "materialDimensions_name_companyId_unique" UNIQUE ("materialFormId", "name", "companyId")
);
-INSERT INTO "materialDimensions" ("id", "materialFormId", "name", "companyId") VALUES
+CREATE OR REPLACE VIEW "materialDimensions" WITH(SECURITY_INVOKER=true) AS
+ SELECT
+ "materialDimension"."id",
+ "materialDimension"."materialFormId",
+ "materialDimension"."name",
+ "materialDimension"."companyId",
+ "materialForm"."name" AS "formName"
+ FROM "materialDimension"
+ LEFT JOIN "materialForm" ON "materialDimension"."materialFormId" = "materialForm"."id";
+
+INSERT INTO "materialDimension" ("id", "materialFormId", "name", "companyId") VALUES
-- Sheet dimensions (gauges)
('sheet-20ga', 'sheet', '20 Gauge', null),
('sheet-18ga', 'sheet', '18 Gauge', null),
@@ -384,19 +394,80 @@ INSERT INTO "materialDimensions" ("id", "materialFormId", "name", "companyId") V
('rectbar-1-2x2', 'rectbar', '1/2" x 2"', null),
-- Angle dimensions (leg x leg x thickness)
+ ('angle-1-2x1-2x1-8', 'angle', '1/2" x 1/2" x 1/8"', null),
+ ('angle-5-8x5-8x1-8', 'angle', '5/8" x 5/8" x 1/8"', null),
+ ('angle-3-4x3-4x1-8', 'angle', '3/4" x 3/4" x 1/8"', null),
('angle-1x1x1-8', 'angle', '1" x 1" x 1/8"', null),
('angle-1x1x3-16', 'angle', '1" x 1" x 3/16"', null),
+ ('angle-1x1x1-4', 'angle', '1" x 1" x 1/4"', null),
('angle-1-25x1-25x1-8', 'angle', '1.25" x 1.25" x 1/8"', null),
('angle-1-25x1-25x3-16', 'angle', '1.25" x 1.25" x 3/16"', null),
+ ('angle-1-25x1-25x1-4', 'angle', '1.25" x 1.25" x 1/4"', null),
('angle-1-5x1-5x1-8', 'angle', '1.5" x 1.5" x 1/8"', null),
('angle-1-5x1-5x3-16', 'angle', '1.5" x 1.5" x 3/16"', null),
+ ('angle-1-5x1-5x1-4', 'angle', '1.5" x 1.5" x 1/4"', null),
+ ('angle-1-75x1-75x1-8', 'angle', '1.75" x 1.75" x 1/8"', null),
+ ('angle-1-75x1-75x3-16', 'angle', '1.75" x 1.75" x 3/16"', null),
+ ('angle-1-75x1-75x1-4', 'angle', '1.75" x 1.75" x 1/4"', null),
+ ('angle-2x1-5x1-8', 'angle', '2" x 1.5" x 1/8"', null),
+ ('angle-2x1-5x3-16', 'angle', '2" x 1.5" x 3/16"', null),
+ ('angle-2x1-5x1-4', 'angle', '2" x 1.5" x 1/4"', null),
('angle-2x2x1-8', 'angle', '2" x 2" x 1/8"', null),
('angle-2x2x3-16', 'angle', '2" x 2" x 3/16"', null),
('angle-2x2x1-4', 'angle', '2" x 2" x 1/4"', null),
+ ('angle-2x2x3-8', 'angle', '2" x 2" x 3/8"', null),
+ ('angle-2-5x1-5x3-16', 'angle', '2.5" x 1.5" x 3/16"', null),
+ ('angle-2-5x1-5x1-4', 'angle', '2.5" x 1.5" x 1/4"', null),
+ ('angle-2-5x2x1-4', 'angle', '2.5" x 2" x 1/4"', null),
+ ('angle-2-5x2x5-16', 'angle', '2.5" x 2" x 5/16"', null),
+ ('angle-2-5x2-5x3-16', 'angle', '2.5" x 2.5" x 3/16"', null),
+ ('angle-2-5x2-5x1-4', 'angle', '2.5" x 2.5" x 1/4"', null),
+ ('angle-2-5x2-5x3-8', 'angle', '2.5" x 2.5" x 3/8"', null),
+ ('angle-2-5x2-5x1-2', 'angle', '2.5" x 2.5" x 1/2"', null),
+ ('angle-3x2x3-16', 'angle', '3" x 2" x 3/16"', null),
+ ('angle-3x2x1-4', 'angle', '3" x 2" x 1/4"', null),
+ ('angle-3x2x3-8', 'angle', '3" x 2" x 3/8"', null),
+ ('angle-3x2x1-2', 'angle', '3" x 2" x 1/2"', null),
+ ('angle-3x3x3-16', 'angle', '3" x 3" x 3/16"', null),
('angle-3x3x1-4', 'angle', '3" x 3" x 1/4"', null),
- ('angle-3x3x5-16', 'angle', '3" x 3" x 5/16"', null),
+ ('angle-3x3x3-8', 'angle', '3" x 3" x 3/8"', null),
+ ('angle-3x3x1-2', 'angle', '3" x 3" x 1/2"', null),
+ ('angle-3-5x3-5x1-4', 'angle', '3.5" x 3.5" x 1/4"', null),
+ ('angle-3-5x3-5x3-8', 'angle', '3.5" x 3.5" x 3/8"', null),
+ ('angle-4x3x1-4', 'angle', '4" x 3" x 1/4"', null),
+ ('angle-4x3x3-8', 'angle', '4" x 3" x 3/8"', null),
+ ('angle-4x3x1-2', 'angle', '4" x 3" x 1/2"', null),
+ ('angle-4x3-5x1-2', 'angle', '4" x 3.5" x 1/2"', null),
('angle-4x4x1-4', 'angle', '4" x 4" x 1/4"', null),
- ('angle-4x4x5-16', 'angle', '4" x 4" x 5/16"', null),
+ ('angle-4x4x3-8', 'angle', '4" x 4" x 3/8"', null),
+ ('angle-4x4x1-2', 'angle', '4" x 4" x 1/2"', null),
+ ('angle-4x4x5-8', 'angle', '4" x 4" x 5/8"', null),
+ ('angle-4x4x3-4', 'angle', '4" x 4" x 3/4"', null),
+ ('angle-5x3x1-4', 'angle', '5" x 3" x 1/4"', null),
+ ('angle-5x3x3-8', 'angle', '5" x 3" x 3/8"', null),
+ ('angle-5x3x1-2', 'angle', '5" x 3" x 1/2"', null),
+ ('angle-5x3-5x1-4', 'angle', '5" x 3.5" x 1/4"', null),
+ ('angle-5x3-5x5-16', 'angle', '5" x 3.5" x 5/16"', null),
+ ('angle-5x3-5x3-8', 'angle', '5" x 3.5" x 3/8"', null),
+ ('angle-5x5x3-8', 'angle', '5" x 5" x 3/8"', null),
+ ('angle-5x5x1-2', 'angle', '5" x 5" x 1/2"', null),
+ ('angle-6x4x3-8', 'angle', '6" x 4" x 3/8"', null),
+ ('angle-6x4x1-2', 'angle', '6" x 4" x 1/2"', null),
+ ('angle-6x4x3-4', 'angle', '6" x 4" x 3/4"', null),
+ ('angle-6x6x3-8', 'angle', '6" x 6" x 3/8"', null),
+ ('angle-6x6x1-2', 'angle', '6" x 6" x 1/2"', null),
+ ('angle-6x6x5-8', 'angle', '6" x 6" x 5/8"', null),
+ ('angle-6x6x3-4', 'angle', '6" x 6" x 3/4"', null),
+ ('angle-6x6x1', 'angle', '6" x 6" x 1"', null),
+ ('angle-8x4x1-2', 'angle', '8" x 4" x 1/2"', null),
+ ('angle-8x4x3-4', 'angle', '8" x 4" x 3/4"', null),
+ ('angle-8x4x1', 'angle', '8" x 4" x 1"', null),
+ ('angle-8x6x1-2', 'angle', '8" x 6" x 1/2"', null),
+ ('angle-8x6x3-4', 'angle', '8" x 6" x 3/4"', null),
+ ('angle-8x6x1', 'angle', '8" x 6" x 1"', null),
+ ('angle-8x8x1-2', 'angle', '8" x 8" x 1/2"', null),
+ ('angle-8x8x3-4', 'angle', '8" x 8" x 3/4"', null),
+ ('angle-8x8x1', 'angle', '8" x 8" x 1"', null),
-- Channel dimensions (depth x flange width x thickness)
('channel-3x1-41x170', 'channel', 'C3 x 4.1', null),