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: tools ui

Brad Barbin9aba1bec368c
diff --git a/apps/carbon/app/components/Form/Item.tsx b/apps/carbon/app/components/Form/Item.tsx
index d8054aa625..53e1a15481 100644
--- a/apps/carbon/app/components/Form/Item.tsx
+++ b/apps/carbon/app/components/Form/Item.tsx
@@ -1,7 +1,7 @@
import type { Database } from "@carbon/database";
import { useDisclosure } from "@carbon/react";
import { useMemo, useRef, useState } from "react";
-import { PartForm } from "~/modules/items";
+import { PartForm, ToolForm } from "~/modules/items";
import { useItems } from "~/stores";
import type { ComboboxProps } from "./Combobox";
import CreatableCombobox from "./CreatableCombobox";
@@ -60,6 +60,25 @@ const Item = ({ type, ...props }: ItemSelectProps) => {
}}
/>
)}
+ {type === "Tool" && newItemsModal.isOpen && (
+ <ToolForm
+ type="modal"
+ onClose={() => {
+ setCreated("");
+ newItemsModal.onClose();
+ triggerRef.current?.click();
+ }}
+ initialValues={{
+ id: "",
+ name: created,
+ description: "",
+ itemInventoryType: "Inventory",
+ unitOfMeasureCode: "EA",
+ blocked: false,
+ active: true,
+ }}
+ />
+ )}
</>
);
};
diff --git a/apps/carbon/app/hooks/index.ts b/apps/carbon/app/hooks/index.ts
index 3d7f9fb4a4..4b963eae41 100644
--- a/apps/carbon/app/hooks/index.ts
+++ b/apps/carbon/app/hooks/index.ts
@@ -1,5 +1,6 @@
import { useMovingCellRef } from "./useMovingCellRef";
import { useNanoStore } from "./useNanoStore";
+import { useNextItemId } from "./useNextItemId";
import { useOnboarding } from "./useOnboarding";
import { useOptimisticLocation } from "./useOptimisticLocation";
import { usePermissions } from "./usePermissions";
@@ -12,6 +13,7 @@ import { useUser } from "./useUser";
export {
useMovingCellRef,
useNanoStore,
+ useNextItemId,
useOnboarding,
useOptimisticLocation,
usePermissions,
diff --git a/apps/carbon/app/hooks/useNextItemId.tsx b/apps/carbon/app/hooks/useNextItemId.tsx
new file mode 100644
index 0000000000..62438938d4
--- /dev/null
+++ b/apps/carbon/app/hooks/useNextItemId.tsx
@@ -0,0 +1,52 @@
+import { useState } from "react";
+import { useSupabase } from "~/lib/supabase";
+import { useUser } from "./useUser";
+
+export function useNextItemId(
+ table: "part" | "service" | "tool" | "material" | "consumable"
+) {
+ const { company } = useUser();
+ const { supabase } = useSupabase();
+ const [loading, setLoading] = useState<boolean>(false);
+ const [id, setId] = useState<string>("");
+
+ const onIdChange = async (newToolId: string) => {
+ if (newToolId.endsWith("...") && supabase) {
+ setLoading(true);
+
+ const prefix = newToolId.slice(0, -3);
+ try {
+ const { data } = await supabase
+ ?.from(table)
+ .select("id")
+ .eq("companyId", company.id)
+ .ilike("id", `${prefix}%`)
+ .order("id", { ascending: false })
+ .limit(1)
+ .maybeSingle();
+ if (data?.id) {
+ const sequence = data.id.slice(prefix.length);
+ const currentSequence = parseInt(sequence);
+ const nextSequence = currentSequence + 1;
+ const nextId = `${prefix}${nextSequence
+ .toString()
+ .padStart(
+ sequence.length -
+ (data.id.split(`${currentSequence}`)?.[1].length ?? 0),
+ "0"
+ )}`;
+ setId(nextId);
+ } else {
+ setId(`${prefix}${(1).toString().padStart(9, "0")}`);
+ }
+ } catch {
+ } finally {
+ setLoading(false);
+ }
+ } else {
+ setId(newToolId);
+ }
+ };
+
+ return { id, onIdChange, loading };
+}
diff --git a/apps/carbon/app/modules/items/types.ts b/apps/carbon/app/modules/items/types.ts
index 921b550887..49b58ade98 100644
--- a/apps/carbon/app/modules/items/types.ts
+++ b/apps/carbon/app/modules/items/types.ts
@@ -39,10 +39,6 @@ export type ItemReorderingPolicy =
export type ItemReplenishmentSystem =
Database["public"]["Enums"]["itemReplenishmentSystem"];
-export type PartSummary = NonNullable<
- Awaited<ReturnType<typeof getPart>>
->["data"];
-
export type ItemSupplier = NonNullable<
Awaited<ReturnType<typeof getItemSuppliers>>["data"]
>[number];
@@ -65,12 +61,24 @@ export type Part = NonNullable<
Awaited<ReturnType<typeof getParts>>["data"]
>[number];
+export type PartSummary = NonNullable<
+ Awaited<ReturnType<typeof getPart>>
+>["data"];
+
export type Service = NonNullable<
Awaited<ReturnType<typeof getServices>>["data"]
>[number];
export type ServiceType = Database["public"]["Enums"]["serviceType"];
+export type Tool = NonNullable<
+ Awaited<ReturnType<typeof getTools>>["data"]
+>[number];
+
+export type ToolSummary = NonNullable<
+ Awaited<ReturnType<typeof getTool>>
+>["data"];
+
export type UnitOfMeasure = NonNullable<
Awaited<ReturnType<typeof getUnitOfMeasure>>["data"]
>;
diff --git a/apps/carbon/app/modules/items/ui/Part/PartSidebar/PartSidebar.tsx b/apps/carbon/app/modules/items/ui/Part/PartSidebar/PartSidebar.tsx
deleted file mode 100644
index 6a3709d902..0000000000
--- a/apps/carbon/app/modules/items/ui/Part/PartSidebar/PartSidebar.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import { useParams } from "@remix-run/react";
-import { DetailSidebar } from "~/components/Layout";
-import { useRouteData } from "~/hooks";
-import type { PartSummary } from "~/modules/items/types";
-import { path } from "~/utils/path";
-import { usePartSidebar } from "./usePartSidebar";
-
-const PartSidebar = () => {
- const { itemId } = useParams();
- if (!itemId) throw new Error("itemId not found");
-
- const routeData = useRouteData<{ partSummary: PartSummary }>(
- path.to.part(itemId)
- );
- if (!routeData?.partSummary?.replenishmentSystem)
- throw new Error("Could not find replenishmentSystem in routeData");
-
- const links = usePartSidebar(routeData.partSummary.replenishmentSystem);
-
- return <DetailSidebar links={links} />;
-};
-
-export default PartSidebar;
diff --git a/apps/carbon/app/modules/items/ui/Part/PartSidebar/index.ts b/apps/carbon/app/modules/items/ui/Part/PartSidebar/index.ts
deleted file mode 100644
index edc2d6c882..0000000000
--- a/apps/carbon/app/modules/items/ui/Part/PartSidebar/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import PartSidebar from "./PartSidebar";
-
-export default PartSidebar;
diff --git a/apps/carbon/app/modules/items/ui/Part/index.ts b/apps/carbon/app/modules/items/ui/Part/index.ts
deleted file mode 100644
index cda679f44c..0000000000
--- a/apps/carbon/app/modules/items/ui/Part/index.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import PartForm from "./PartForm";
-import PartHeader from "./PartHeader";
-import PartManufacturingForm from "./PartManufacturingForm";
-import PartSidebar from "./PartSidebar";
-
-export { PartForm, PartHeader, PartManufacturingForm, PartSidebar };
diff --git a/apps/carbon/app/modules/items/ui/Part/PartForm.tsx b/apps/carbon/app/modules/items/ui/Parts/PartForm.tsx
similarity index 73%
rename from apps/carbon/app/modules/items/ui/Part/PartForm.tsx
rename to apps/carbon/app/modules/items/ui/Parts/PartForm.tsx
index 3cdea63b96..b9f27243b1 100644
--- a/apps/carbon/app/modules/items/ui/Part/PartForm.tsx
+++ b/apps/carbon/app/modules/items/ui/Parts/PartForm.tsx
@@ -13,7 +13,7 @@ import {
import { ValidatedForm } from "@carbon/remix-validated-form";
import { useFetcher } from "@remix-run/react";
import type { PostgrestResponse } from "@supabase/supabase-js";
-import { useEffect, useState } from "react";
+import { useEffect } from "react";
import type { z } from "zod";
import {
Boolean,
@@ -27,8 +27,7 @@ import {
TextArea,
UnitOfMeasure,
} from "~/components/Form";
-import { usePermissions, useUser } from "~/hooks";
-import { useSupabase } from "~/lib/supabase";
+import { useNextItemId, usePermissions } from "~/hooks";
import {
itemInventoryTypes,
partReplenishmentSystems,
@@ -42,53 +41,6 @@ type PartFormProps = {
onClose?: () => void;
};
-const useNextPartIdShortcut = () => {
- const { company } = useUser();
- const { supabase } = useSupabase();
- const [loading, setLoading] = useState<boolean>(false);
- const [partId, setPartId] = useState<string>("");
-
- const onPartIdChange = async (newPartId: string) => {
- if (newPartId.endsWith("...") && supabase) {
- setLoading(true);
-
- const prefix = newPartId.slice(0, -3);
- try {
- const { data } = await supabase
- ?.from("part")
- .select("id")
- .eq("companyId", company.id)
- .ilike("id", `${prefix}%`)
- .order("id", { ascending: false })
- .limit(1)
- .maybeSingle();
- if (data?.id) {
- const sequence = data.id.slice(prefix.length);
- const currentSequence = parseInt(sequence);
- const nextSequence = currentSequence + 1;
- const nextId = `${prefix}${nextSequence
- .toString()
- .padStart(
- sequence.length -
- (data.id.split(`${currentSequence}`)?.[1].length ?? 0),
- "0"
- )}`;
- setPartId(nextId);
- } else {
- setPartId(`${prefix}${(1).toString().padStart(9, "0")}`);
- }
- } catch {
- } finally {
- setLoading(false);
- }
- } else {
- setPartId(newPartId);
- }
- };
-
- return { partId, onPartIdChange, loading };
-};
-
function startsWithLetter(value: string) {
return /^[A-Za-z]/.test(value);
}
@@ -107,7 +59,7 @@ const PartForm = ({ initialValues, type = "card", onClose }: PartFormProps) => {
}
}, [fetcher.data, fetcher.state, onClose, type]);
- const { partId, onPartIdChange, loading } = useNextPartIdShortcut();
+ const { id, onIdChange, loading } = useNextItemId("part");
const permissions = usePermissions();
const isEditing = !!initialValues.id;
@@ -160,12 +112,12 @@ const PartForm = ({ initialValues, type = "card", onClose }: PartFormProps) => {
name="id"
label="Part ID"
helperText={
- startsWithLetter(partId)
+ startsWithLetter(id)
? "Use ... to get the next part ID"
: undefined
}
- value={partId}
- onChange={onPartIdChange}
+ value={id}
+ onChange={onIdChange}
isDisabled={loading}
autoFocus
/>
diff --git a/apps/carbon/app/modules/items/ui/Part/PartHeader.tsx b/apps/carbon/app/modules/items/ui/Parts/PartHeader.tsx
similarity index 100%
rename from apps/carbon/app/modules/items/ui/Part/PartHeader.tsx
rename to apps/carbon/app/modules/items/ui/Parts/PartHeader.tsx
diff --git a/apps/carbon/app/modules/items/ui/Part/PartManufacturingForm.tsx b/apps/carbon/app/modules/items/ui/Parts/PartManufacturingForm.tsx
similarity index 100%
rename from apps/carbon/app/modules/items/ui/Part/PartManufacturingForm.tsx
rename to apps/carbon/app/modules/items/ui/Parts/PartManufacturingForm.tsx
diff --git a/apps/carbon/app/modules/items/ui/Part/PartSidebar/usePartSidebar.tsx b/apps/carbon/app/modules/items/ui/Parts/PartNavigation.tsx
similarity index 72%
rename from apps/carbon/app/modules/items/ui/Part/PartSidebar/usePartSidebar.tsx
rename to apps/carbon/app/modules/items/ui/Parts/PartNavigation.tsx
index 984d097fbe..194f11de7a 100644
--- a/apps/carbon/app/modules/items/ui/Part/PartSidebar/usePartSidebar.tsx
+++ b/apps/carbon/app/modules/items/ui/Parts/PartNavigation.tsx
@@ -1,4 +1,5 @@
import { useParams } from "@remix-run/react";
+
import { BiListCheck } from "react-icons/bi";
import {
LuBox,
@@ -9,12 +10,16 @@ import {
LuShoppingCart,
LuTags,
} from "react-icons/lu";
-import { usePermissions } from "~/hooks";
-import type { ItemReplenishmentSystem } from "~/modules/items/types";
+import { DetailSidebar } from "~/components/Layout";
+import { usePermissions, useRouteData } from "~/hooks";
+import type {
+ ItemReplenishmentSystem,
+ PartSummary,
+} from "~/modules/items/types";
import type { Role } from "~/types";
import { path } from "~/utils/path";
-export function usePartSidebar(replenishment: ItemReplenishmentSystem) {
+export function usePartNavigation(replenishment: ItemReplenishmentSystem) {
const permissions = usePermissions();
const { itemId } = useParams();
if (!itemId) throw new Error("itemId not found");
@@ -85,3 +90,20 @@ export function usePartSidebar(replenishment: ItemReplenishmentSystem) {
item.role.some((role) => permissions.is(role as Role)))
);
}
+
+const PartNavigation = () => {
+ const { itemId } = useParams();
+ if (!itemId) throw new Error("itemId not found");
+
+ const routeData = useRouteData<{ partSummary: PartSummary }>(
+ path.to.part(itemId)
+ );
+ if (!routeData?.partSummary?.replenishmentSystem)
+ throw new Error("Could not find replenishmentSystem in routeData");
+
+ const links = usePartNavigation(routeData.partSummary.replenishmentSystem);
+
+ return <DetailSidebar links={links} />;
+};
+
+export default PartNavigation;
diff --git a/apps/carbon/app/modules/items/ui/Parts/index.ts b/apps/carbon/app/modules/items/ui/Parts/index.ts
index 9151d32583..2d742601e5 100644
--- a/apps/carbon/app/modules/items/ui/Parts/index.ts
+++ b/apps/carbon/app/modules/items/ui/Parts/index.ts
@@ -1,3 +1,13 @@
+import PartForm from "./PartForm";
+import PartHeader from "./PartHeader";
+import PartManufacturingForm from "./PartManufacturingForm";
+import PartNavigation from "./PartNavigation";
import PartsTable from "./PartsTable";
-export { PartsTable };
+export {
+ PartForm,
+ PartHeader,
+ PartManufacturingForm,
+ PartNavigation,
+ PartsTable,
+};
diff --git a/apps/carbon/app/modules/items/ui/Routing/PartsTree.tsx b/apps/carbon/app/modules/items/ui/Routing/PartsTree.tsx
deleted file mode 100644
index 97750c9da2..0000000000
--- a/apps/carbon/app/modules/items/ui/Routing/PartsTree.tsx
+++ /dev/null
@@ -1,103 +0,0 @@
-import { Button, HStack, useMount } from "@carbon/react";
-import { useState } from "react";
-import { AiOutlineCodeSandbox } from "react-icons/ai";
-import { BsCaretDownFill } from "react-icons/bs";
-
-type PartsTreeNode = {
- id: string;
- type: "folder" | "file";
- children?: PartsTreeNode[];
-};
-
-const data: PartsTreeNode[] = [
- {
- id: "F012345",
- type: "folder",
- children: [
- {
- id: "F505555",
- type: "file",
- },
- {
- id: "F505556",
- type: "file",
- },
- ],
- },
-];
-
-const PartsTreeExplorer = () => {
- const [expandedNodes, setExpandedNodes] = useState<Record<string, boolean>>(
- {}
- );
-
- useMount(() => {
- const map: Record<string, boolean> = {};
- const traverse = (node: PartsTreeNode[]) => {
- node.forEach((n) => {
- map[n.id] = true; // open all nodes by default;
- if (n.children) {
- traverse(n.children);
- }
- });
- };
-
- traverse(data);
- setExpandedNodes(map);
- });
-
- const toggleNode = (id: string) => {
- setExpandedNodes((prev) => ({
- ...prev,
- [id]: !prev[id],
- }));
- };
-
- const renderPartsTree = (data: PartsTreeNode[], level: number = 0) => {
- return data.map((node) => {
- return (
- <div className="block p-0" role="group" key={node.id}>
- <HStack
- className="items-stretch border-2 border-transparent :active:border-blue-200"
- style={{
- paddingLeft: `calc(${1.5 * level}rem)`,
- }}
- >
- <Button
- variant="ghost"
- aria-label="Expand"
- className="rounded-none"
- onClick={() => toggleNode(node.id)}
- isDisabled={!node.children}
- >
- <BsCaretDownFill
- className="w-4 h-4"
- style={{
- transition: "transform .25s ease",
- transform:
- expandedNodes[node.id] || !node.children
- ? undefined
- : "rotate(-0.25turn)",
- }}
- />
- </Button>
- <Button
- variant="ghost"
- leftIcon={<AiOutlineCodeSandbox />}
- className="rounded-none flex-1 justify-start"
- >
- {node.id}
- </Button>
- </HStack>
- {node.children &&
- expandedNodes[node.id] &&
- renderPartsTree(node.children, level + 1)}
- </div>
- );
- });
- };
-
- return <div role="tree">{renderPartsTree(data)}</div>;
-};
-
-export default PartsTreeExplorer;
diff --git a/apps/carbon/app/modules/items/ui/Routing/index.ts b/apps/carbon/app/modules/items/ui/Routing/index.ts
deleted file mode 100644
index 8c6117b406..0000000000
--- a/apps/carbon/app/modules/items/ui/Routing/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import PartsTree from "./PartsTree";
-
-export { PartsTree };
diff --git a/apps/carbon/app/modules/items/ui/Service/ServiceSidebar/ServiceSidebar.tsx b/apps/carbon/app/modules/items/ui/Service/ServiceSidebar/ServiceSidebar.tsx
deleted file mode 100644
index 104c18f315..0000000000
--- a/apps/carbon/app/modules/items/ui/Service/ServiceSidebar/ServiceSidebar.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import { useParams } from "@remix-run/react";
-import { DetailSidebar } from "~/components/Layout";
-import { useRouteData } from "~/hooks";
-import type { Service } from "~/modules/items/types";
-import { path } from "~/utils/path";
-import { useServiceSidebar } from "./useServiceSidebar";
-
-const ServiceSidebar = () => {
- const { itemId } = useParams();
-
- if (!itemId) throw new Error("itemId not found");
-
- const routeData = useRouteData<{ service: Service }>(path.to.service(itemId));
- if (!routeData?.service?.serviceType)
- throw new Error("Could not find service type in routeData");
-
- const links = useServiceSidebar(routeData.service.serviceType);
-
- return <DetailSidebar links={links} />;
-};
-
-export default ServiceSidebar;
diff --git a/apps/carbon/app/modules/items/ui/Service/ServiceSidebar/index.ts b/apps/carbon/app/modules/items/ui/Service/ServiceSidebar/index.ts
deleted file mode 100644
index 80447118a6..0000000000
--- a/apps/carbon/app/modules/items/ui/Service/ServiceSidebar/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import ServiceSidebar from "./ServiceSidebar";
-
-export default ServiceSidebar;
diff --git a/apps/carbon/app/modules/items/ui/Service/ServiceSidebar/useServiceSidebar.tsx b/apps/carbon/app/modules/items/ui/Service/ServiceSidebar/useServiceSidebar.tsx
deleted file mode 100644
index 945d602bef..0000000000
--- a/apps/carbon/app/modules/items/ui/Service/ServiceSidebar/useServiceSidebar.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-import { LuFileText, LuShare2 } from "react-icons/lu";
-import { usePermissions } from "~/hooks";
-import type { ServiceType } from "~/modules/items/types";
-import type { Role } from "~/types";
-
-export function useServiceSidebar(type: ServiceType) {
- const permissions = usePermissions();
- return [
- {
- name: "Details",
- to: "details",
- icon: LuFileText,
- },
- {
- name: "Suppliers",
- to: "suppliers",
- isDisabled: type === "Internal",
- role: ["employee", "supplier"],
- icon: LuShare2,
- },
- ].filter(
- (item) =>
- !item.isDisabled &&
- (item.role === undefined ||
- item.role.some((role) => permissions.is(role as Role)))
- );
-}
diff --git a/apps/carbon/app/modules/items/ui/Service/index.ts b/apps/carbon/app/modules/items/ui/Service/index.ts
deleted file mode 100644
index 5cd2e5ad9d..0000000000
--- a/apps/carbon/app/modules/items/ui/Service/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import ServiceForm from "./ServiceForm";
-import ServiceHeader from "./ServiceHeader";
-import ServiceSidebar from "./ServiceSidebar";
-
-export { ServiceForm, ServiceHeader, ServiceSidebar };
diff --git a/apps/carbon/app/modules/items/ui/Service/ServiceForm.tsx b/apps/carbon/app/modules/items/ui/Services/ServiceForm.tsx
similarity index 62%
rename from apps/carbon/app/modules/items/ui/Service/ServiceForm.tsx
rename to apps/carbon/app/modules/items/ui/Services/ServiceForm.tsx
index 6e9c2391da..5a944360d8 100644
--- a/apps/carbon/app/modules/items/ui/Service/ServiceForm.tsx
+++ b/apps/carbon/app/modules/items/ui/Services/ServiceForm.tsx
@@ -8,7 +8,6 @@ import {
cn,
} from "@carbon/react";
import { ValidatedForm } from "@carbon/remix-validated-form";
-import { useState } from "react";
import type { z } from "zod";
import {
Boolean,
@@ -21,63 +20,15 @@ import {
Submit,
TextArea,
} from "~/components/Form";
-import { usePermissions, useUser } from "~/hooks";
-import { useSupabase } from "~/lib/supabase";
+import { useNextItemId, usePermissions } from "~/hooks";
import { serviceType, serviceValidator } from "~/modules/items";
type ServiceFormProps = {
initialValues: z.infer<typeof serviceValidator>;
};
-const useNextServiceIdShortcut = () => {
- const { company } = useUser();
- const { supabase } = useSupabase();
- const [loading, setLoading] = useState<boolean>(false);
- const [serviceId, setServiceId] = useState<string>("");
-
- const onServiceIdChange = async (newServiceId: string) => {
- if (newServiceId.endsWith("...") && supabase) {
- setLoading(true);
-
- const prefix = newServiceId.slice(0, -3);
- try {
- const { data } = await supabase
- ?.from("service")
- .select("id")
- .eq("companyId", company.id)
- .ilike("id", `${prefix}%`)
- .order("id", { ascending: false })
- .limit(1)
- .maybeSingle();
- if (data?.id) {
- const sequence = data.id.slice(prefix.length);
- const currentSequence = parseInt(sequence);
- const nextSequence = currentSequence + 1;
- const nextId = `${prefix}${nextSequence
- .toString()
- .padStart(
- sequence.length -
- (data.id.split(`${currentSequence}`)?.[1].length ?? 0),
- "0"
- )}`;
- setServiceId(nextId);
- } else {
- setServiceId(`${prefix}${(1).toString().padStart(9, "0")}`);
- }
- } catch {
- } finally {
- setLoading(false);
- }
- } else {
- setServiceId(newServiceId);
- }
- };
-
- return { serviceId, onServiceIdChange, loading };
-};
-
const ServiceForm = ({ initialValues }: ServiceFormProps) => {
- const { serviceId, onServiceIdChange, loading } = useNextServiceIdShortcut();
+ const { id, onIdChange, loading } = useNextItemId("service");
const permissions = usePermissions();
const isEditing = initialValues.id !== undefined;
@@ -120,8 +71,8 @@ const ServiceForm = ({ initialValues }: ServiceFormProps) => {
name="id"
label="Service ID"
helperText="Use ... to get the next service ID"
- value={serviceId}
- onChange={onServiceIdChange}
+ value={id}
+ onChange={onIdChange}
isDisabled={loading}
autoFocus
/>
diff --git a/apps/carbon/app/modules/items/ui/Service/ServiceHeader.tsx b/apps/carbon/app/modules/items/ui/Services/ServiceHeader.tsx
similarity index 100%
rename from apps/carbon/app/modules/items/ui/Service/ServiceHeader.tsx
rename to apps/carbon/app/modules/items/ui/Services/ServiceHeader.tsx
diff --git a/apps/carbon/app/modules/items/ui/Services/ServiceNavigation.tsx b/apps/carbon/app/modules/items/ui/Services/ServiceNavigation.tsx
new file mode 100644
index 0000000000..f301f94e5a
--- /dev/null
+++ b/apps/carbon/app/modules/items/ui/Services/ServiceNavigation.tsx
@@ -0,0 +1,46 @@
+import { useParams } from "@remix-run/react";
+import { LuFileText, LuShare2 } from "react-icons/lu";
+import { DetailSidebar } from "~/components/Layout";
+import { usePermissions, useRouteData } from "~/hooks";
+import type { Service, ServiceType } from "~/modules/items/types";
+import type { Role } from "~/types";
+import { path } from "~/utils/path";
+
+export function useServiceNavigation(type: ServiceType) {
+ const permissions = usePermissions();
+ return [
+ {
+ name: "Details",
+ to: "details",
+ icon: LuFileText,
+ },
+ {
+ name: "Suppliers",
+ to: "suppliers",
+ isDisabled: type === "Internal",
+ role: ["employee", "supplier"],
+ icon: LuShare2,
+ },
+ ].filter(
+ (item) =>
+ !item.isDisabled &&
+ (item.role === undefined ||
+ item.role.some((role) => permissions.is(role as Role)))
+ );
+}
+
+const ServiceNavigation = () => {
+ const { itemId } = useParams();
+
+ if (!itemId) throw new Error("itemId not found");
+
+ const routeData = useRouteData<{ service: Service }>(path.to.service(itemId));
+ if (!routeData?.service?.serviceType)
+ throw new Error("Could not find service type in routeData");
+
+ const links = useServiceNavigation(routeData.service.serviceType);
+
+ return <DetailSidebar links={links} />;
+};
+
+export default ServiceNavigation;
diff --git a/apps/carbon/app/modules/items/ui/Services/index.ts b/apps/carbon/app/modules/items/ui/Services/index.ts
index 2dee3cefba..05632c36e9 100644
--- a/apps/carbon/app/modules/items/ui/Services/index.ts
+++ b/apps/carbon/app/modules/items/ui/Services/index.ts
@@ -1,3 +1,6 @@
+import ServiceForm from "./ServiceForm";
+import ServiceHeader from "./ServiceHeader";
+import ServiceNavigation from "./ServiceNavigation";
import ServicesTable from "./ServicesTable";
-export { ServicesTable };
+export { ServiceForm, ServiceHeader, ServiceNavigation, ServicesTable };
diff --git a/apps/carbon/app/modules/items/ui/Tools/ToolForm.tsx b/apps/carbon/app/modules/items/ui/Tools/ToolForm.tsx
new file mode 100644
index 0000000000..4b0daa5a8c
--- /dev/null
+++ b/apps/carbon/app/modules/items/ui/Tools/ToolForm.tsx
@@ -0,0 +1,156 @@
+import {
+ ModalCard,
+ ModalCardBody,
+ ModalCardContent,
+ ModalCardDescription,
+ ModalCardFooter,
+ ModalCardHeader,
+ ModalCardProvider,
+ ModalCardTitle,
+ cn,
+ toast,
+} from "@carbon/react";
+import { ValidatedForm } from "@carbon/remix-validated-form";
+import { useFetcher } from "@remix-run/react";
+import type { PostgrestResponse } from "@supabase/supabase-js";
+import { useEffect } from "react";
+import type { z } from "zod";
+import {
+ Boolean,
+ CustomFormFields,
+ Hidden,
+ Input,
+ InputControlled,
+ ItemGroup,
+ Select,
+ Submit,
+ TextArea,
+ UnitOfMeasure,
+} from "~/components/Form";
+import { useNextItemId, usePermissions } from "~/hooks";
+import { itemInventoryTypes, toolValidator } from "~/modules/items";
+import { path } from "~/utils/path";
+
+type ToolFormProps = {
+ initialValues: z.infer<typeof toolValidator>;
+ type?: "card" | "modal";
+ onClose?: () => void;
+};
+
+function startsWithLetter(value: string) {
+ return /^[A-Za-z]/.test(value);
+}
+
+const ToolForm = ({ initialValues, type = "card", onClose }: ToolFormProps) => {
+ const fetcher = useFetcher<PostgrestResponse<{ id: string }>>();
+
+ useEffect(() => {
+ if (type !== "modal") return;
+
+ if (fetcher.state === "loading" && fetcher.data?.data) {
+ onClose?.();
+ toast.success(`Created tool`);
+ } else if (fetcher.state === "idle" && fetcher.data?.error) {
+ toast.error(`Failed to create tool: ${fetcher.data.error.message}`);
+ }
+ }, [fetcher.data, fetcher.state, onClose, type]);
+
+ const { id, onIdChange, loading } = useNextItemId("tool");
+ const permissions = usePermissions();
+ const isEditing = !!initialValues.id;
+
+ const itemInventoryTypeOptions =
+ itemInventoryTypes.map((itemInventoryType) => ({
+ label: itemInventoryType,
+ value: itemInventoryType,
+ })) ?? [];
+
+ return (
+ <ModalCardProvider type={type}>
+ <ModalCard onClose={onClose}>
+ <ModalCardContent>
+ <ValidatedForm
+ action={isEditing ? undefined : path.to.newTool}
+ method="post"
+ validator={toolValidator}
+ defaultValues={initialValues}
+ fetcher={fetcher}
+ >
+ <ModalCardHeader>
+ <ModalCardTitle>
+ {isEditing ? "Tool Details" : "New Tool"}
+ </ModalCardTitle>
+ {!isEditing && (
+ <ModalCardDescription>
+ A tool is a physical item used to make a part that can be used
+ across multiple jobs
+ </ModalCardDescription>
+ )}
+ </ModalCardHeader>
+ <ModalCardBody>
+ <Hidden name="type" value={type} />
+ <div
+ className={cn(
+ "grid w-full gap-x-8 gap-y-2",
+ isEditing ? "grid-cols-1 md:grid-cols-3" : "grid-cols-1"
+ )}
+ >
+ {isEditing ? (
+ <Input name="id" label="Tool ID" isReadOnly />
+ ) : (
+ <InputControlled
+ name="id"
+ label="Tool ID"
+ helperText={
+ startsWithLetter(id)
+ ? "Use ... to get the next tool ID"
+ : undefined
+ }
+ value={id}
+ onChange={onIdChange}
+ isDisabled={loading}
+ autoFocus
+ />
+ )}
+
+ <Input name="name" label="Name" />
+ <ItemGroup name="itemGroupId" label="Posting Group" />
+ {isEditing && (
+ <TextArea name="description" label="Description" />
+ )}
+
+ <Select
+ name="itemInventoryType"
+ label="Tool Type"
+ options={itemInventoryTypeOptions}
+ />
+ <UnitOfMeasure
+ name="unitOfMeasureCode"
+ label="Unit of Measure"
+ />
+
+ <Boolean name="blocked" label="Blocked" />
+ {isEditing && <Boolean name="active" label="Active" />}
+
+ <CustomFormFields table="tool" />
+ </div>
+ </ModalCardBody>
+ <ModalCardFooter>
+ <Submit
+ isDisabled={
+ isEditing
+ ? !permissions.can("update", "parts")
+ : !permissions.can("create", "parts")
+ }
+ >
+ Save
+ </Submit>
+ </ModalCardFooter>
+ </ValidatedForm>
+ </ModalCardContent>
+ </ModalCard>
+ </ModalCardProvider>
+ );
+};
+
+export default ToolForm;
diff --git a/apps/carbon/app/modules/items/ui/Tools/ToolHeader.tsx b/apps/carbon/app/modules/items/ui/Tools/ToolHeader.tsx
new file mode 100644
index 0000000000..6647b2c086
--- /dev/null
+++ b/apps/carbon/app/modules/items/ui/Tools/ToolHeader.tsx
@@ -0,0 +1,104 @@
+import {
+ Card,
+ CardAction,
+ CardAttribute,
+ CardAttributeLabel,
+ CardAttributeValue,
+ CardAttributes,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ Enumerable,
+ HStack,
+ Menubar,
+ VStack,
+} from "@carbon/react";
+
+import { useParams } from "@remix-run/react";
+import { Assign, EmployeeAvatar, useOptimisticAssignment } from "~/components";
+import { usePermissions, useRouteData } from "~/hooks";
+import type { ToolSummary } from "~/modules/items";
+import { path } from "~/utils/path";
+
+const ToolHeader = () => {
+ const permissions = usePermissions();
+ const { itemId } = useParams();
+ if (!itemId) throw new Error("itemId not found");
+
+ const routeData = useRouteData<{ toolSummary: ToolSummary }>(
+ path.to.tool(itemId)
+ );
+
+ const optimisticAssignment = useOptimisticAssignment({
+ id: itemId,
+ table: "item",
+ });
+ const assignee =
+ optimisticAssignment !== undefined
+ ? optimisticAssignment
+ : routeData?.toolSummary?.assignee;
+
+ return (
+ <VStack>
+ {permissions.is("employee") && !!routeData?.toolSummary?.id && (
+ <Menubar>
+ <Assign
+ id={itemId}
+ table="item"
+ value={routeData?.toolSummary?.assignee ?? ""}
+ />
+ </Menubar>
+ )}
+ <Card>
+ <HStack className="justify-between items-start">
+ <CardHeader>
+ <CardTitle>{routeData?.toolSummary?.id}</CardTitle>
+ <CardDescription>{routeData?.toolSummary?.name}</CardDescription>
+ </CardHeader>
+ <CardAction>
+ {/* <Button
+ variant="secondary"
+ onClick={() => alert("TODO")}
+ leftIcon={<FaHistory />}
+ >
+ View History
+ </Button> */}
+ </CardAction>
+ </HStack>
+ <CardContent>
+ <CardAttributes>
+ <CardAttribute>
+ <CardAttributeLabel>Assignee</CardAttributeLabel>
+ <CardAttributeValue>
+ {assignee ? (
+ <EmployeeAvatar employeeId={assignee ?? null} />
+ ) : (
+ "-"
+ )}
+ </CardAttributeValue>
+ </CardAttribute>
+ <CardAttribute>
+ <CardAttributeLabel>Inventory Type</CardAttributeLabel>
+ <CardAttributeValue>
+ <Enumerable
+ value={routeData?.toolSummary?.itemInventoryType ?? null}
+ />
+ </CardAttributeValue>
+ </CardAttribute>
+ <CardAttribute>
+ <CardAttributeLabel>UoM</CardAttributeLabel>
+ <CardAttributeValue>
+ <Enumerable
+ value={routeData?.toolSummary?.unitOfMeasure ?? null}
+ />
+ </CardAttributeValue>
+ </CardAttribute>
+ </CardAttributes>
+ </CardContent>
+ </Card>
+ </VStack>
+ );
+};
+
+export default ToolHeader;
diff --git a/apps/carbon/app/modules/items/ui/Tools/ToolNavigation.tsx b/apps/carbon/app/modules/items/ui/Tools/ToolNavigation.tsx
new file mode 100644
index 0000000000..52c1ded2c9
--- /dev/null
+++ b/apps/carbon/app/modules/items/ui/Tools/ToolNavigation.tsx
@@ -0,0 +1,80 @@
+import { useParams } from "@remix-run/react";
+
+import {
+ LuBox,
+ LuFileBarChart,
+ LuFileText,
+ LuShare2,
+ LuShoppingCart,
+ LuTags,
+} from "react-icons/lu";
+import { DetailSidebar } from "~/components/Layout";
+import { usePermissions } from "~/hooks";
+import type { Role } from "~/types";
+import { path } from "~/utils/path";
+
+export function useToolNavigation() {
+ const permissions = usePermissions();
+ const { itemId } = useParams();
+ if (!itemId) throw new Error("itemId not found");
+
+ return [
+ {
+ name: "Details",
+ to: path.to.toolDetails(itemId),
+ icon: LuFileText,
+ shortcut: "Command+Shift+d",
+ },
+ {
+ name: "Purchasing",
+ to: path.to.toolPurchasing(itemId),
+ role: ["employee", "supplier"],
+ icon: LuShoppingCart,
+ shortcut: "Command+Shift+p",
+ },
+ {
+ name: "Suppliers",
+ to: path.to.toolSuppliers(itemId),
+ role: ["employee", "supplier"],
+ icon: LuShare2,
+ shortcut: "Command+Shift+s",
+ },
+
+ {
+ name: "Costing",
+ to: path.to.toolCosting(itemId),
+ role: ["employee", "supplier"],
+ icon: LuTags,
+ shortcut: "Command+Shift+c",
+ },
+ {
+ name: "Planning",
+ to: path.to.toolPlanning(itemId),
+ role: ["employee"],
+ icon: LuFileBarChart,
+ shortcut: "Command+Shift+p",
+ },
+ {
+ name: "Inventory",
+ to: path.to.toolInventory(itemId),
+ role: ["employee", "supplier"],
+ icon: LuBox,
+ shortcut: "Command+Shift+i",
+ },
+ ].filter(
+ (item) =>
+ item.role === undefined ||
+ item.role.some((role) => permissions.is(role as Role))
+ );
+}
+
+const ToolNavigation = () => {
+ const { itemId } = useParams();
+ if (!itemId) throw new Error("itemId not found");
+
+ const links = useToolNavigation();
+
+ return <DetailSidebar links={links} />;
+};
+
+export default ToolNavigation;
diff --git a/apps/carbon/app/modules/items/ui/Tools/ToolsTable.tsx b/apps/carbon/app/modules/items/ui/Tools/ToolsTable.tsx
new file mode 100644
index 0000000000..4c59312b91
--- /dev/null
+++ b/apps/carbon/app/modules/items/ui/Tools/ToolsTable.tsx
@@ -0,0 +1,213 @@
+import { Checkbox, Enumerable, MenuIcon, MenuItem } from "@carbon/react";
+import { formatDate } from "@carbon/utils";
+import { useNavigate } from "@remix-run/react";
+import type { ColumnDef } from "@tanstack/react-table";
+import { memo, useMemo } from "react";
+import { LuPencil } from "react-icons/lu";
+import { EmployeeAvatar, Hyperlink, New, Table } from "~/components";
+import { usePermissions, useUrlParams } from "~/hooks";
+import { useCustomColumns } from "~/hooks/useCustomColumns";
+import type { Tool } from "~/modules/items";
+import { itemInventoryTypes } from "~/modules/items";
+import { usePeople } from "~/stores";
+import type { ListItem } from "~/types";
+import { path } from "~/utils/path";
+
+type ToolsTableProps = {
+ data: Tool[];
+ itemGroups: ListItem[];
+ count: number;
+};
+
+const ToolsTable = memo(({ data, count, itemGroups }: ToolsTableProps) => {
+ const navigate = useNavigate();
+ const permissions = usePermissions();
+ const [params] = useUrlParams();
+ const [people] = usePeople();
+ const customColumns = useCustomColumns<Tool>("tool");
+
+ const columns = useMemo<ColumnDef<Tool>[]>(() => {
+ const defaultColumns: ColumnDef<Tool>[] = [
+ {
+ accessorKey: "id",
+ header: "Tool ID",
+ cell: ({ row }) => (
+ <Hyperlink to={path.to.partDetails(row.original.itemId!)}>
+ {row.original.id}
+ </Hyperlink>
+ ),
+ },
+ {
+ accessorKey: "name",
+ header: "Name",
+ cell: (item) => item.getValue(),
+ },
+ {
+ accessorKey: "description",
+ header: "Description",
+ cell: (item) => item.getValue(),
+ },
+ {
+ accessorKey: "itemInventoryType",
+ header: "Inventory",
+ cell: (item) => <Enumerable value={item.getValue<string>()} />,
+ meta: {
+ filter: {
+ type: "static",
+ options: itemInventoryTypes.map((type) => ({
+ value: type,
+ label: <Enumerable value={type} />,
+ })),
+ },
+ },
+ },
+ {
+ accessorKey: "itemGroup",
+ header: "Posting Group",
+ cell: (item) => <Enumerable value={item.getValue<string>()} />,
+ meta: {
+ filter: {
+ type: "static",
+ options: itemGroups.map(({ name }) => ({
+ value: name,
+ label: <Enumerable value={name} />,
+ })),
+ },
+ },
+ },
+ {
+ accessorKey: "active",
+ header: "Active",
+ cell: (item) => <Checkbox isChecked={item.getValue<boolean>()} />,
+ meta: {
+ filter: {
+ type: "static",
+ options: [
+ { value: "true", label: "Active" },
+ { value: "false", label: "Inactive" },
+ ],
+ },
+ pluralHeader: "Active Statuses",
+ },
+ },
+ {
+ accessorKey: "blocked",
+ header: "Blocked",
+ cell: (item) => <Checkbox isChecked={item.getValue<boolean>()} />,
+ meta: {
+ filter: {
+ type: "static",
+ options: [
+ { value: "true", label: "Blocked" },
+ { value: "false", label: "Not Blocked" },
+ ],
+ },
+ pluralHeader: "Blocked Statuses",
+ },
+ },
+ {
+ id: "assignee",
+ header: "Assignee",
+ cell: ({ row }) => (
+ <EmployeeAvatar employeeId={row.original.assignee} />
+ ),
+ meta: {
+ filter: {
+ type: "static",
+ options: people.map((employee) => ({
+ value: employee.id,
+ label: employee.name,
+ })),
+ },
+ },
+ },
+ {
+ id: "createdBy",
+ header: "Created By",
+ cell: ({ row }) => (
+ <EmployeeAvatar employeeId={row.original.createdBy} />
+ ),
+ meta: {
+ filter: {
+ type: "static",
+ options: people.map((employee) => ({
+ value: employee.id,
+ label: employee.name,
+ })),
+ },
+ },
+ },
+ {
+ accessorKey: "createdAt",
+ header: "Created At",
+ cell: (item) => formatDate(item.getValue<string>()),
+ },
+ {
+ id: "updatedBy",
+ header: "Updated By",
+ cell: ({ row }) => (
+ <EmployeeAvatar employeeId={row.original.updatedBy} />
+ ),
+ meta: {
+ filter: {
+ type: "static",
+ options: people.map((employee) => ({
+ value: employee.id,
+ label: employee.name,
+ })),
+ },
+ },
+ },
+ {
+ accessorKey: "updatedAt",
+ header: "Created At",
+ cell: (item) => formatDate(item.getValue<string>()),
+ },
+ ];
+ return [...defaultColumns, ...customColumns];
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [params]);
+
+ const renderContextMenu = useMemo(() => {
+ // eslint-disable-next-line react/display-name
+ return (row: Tool) => (
+ <MenuItem onClick={() => navigate(path.to.part(row.id!))}>
+ <MenuIcon icon={<LuPencil />} />
+ Edit Tool
+ </MenuItem>
+ );
+ }, [navigate]);
+
+ return (
+ <>
+ <Table<Tool>
+ count={count}
+ columns={columns}
+ data={data}
+ defaultColumnPinning={{
+ left: ["id"],
+ }}
+ defaultColumnVisibility={{
+ description: false,
+ active: false,
+ blocked: false,
+ createdBy: false,
+ createdAt: false,
+ updatedBy: false,
+ updatedAt: false,
+ }}
+ primaryAction={
+ permissions.can("create", "parts") && (
+ <New label="Tool" to={path.to.newTool} />
+ )
+ }
+ renderContextMenu={renderContextMenu}
+ withColumnOrdering
+ />
+ </>
+ );
+});
+
+ToolsTable.displayName = "ToolTable";
+
+export default ToolsTable;
diff --git a/apps/carbon/app/modules/items/ui/Tools/index.ts b/apps/carbon/app/modules/items/ui/Tools/index.ts
new file mode 100644
index 0000000000..2ae24e79b5
--- /dev/null
+++ b/apps/carbon/app/modules/items/ui/Tools/index.ts
@@ -0,0 +1,6 @@
+import ToolForm from "./ToolForm";
+import ToolHeader from "./ToolHeader";
+import ToolNavigation from "./ToolNavigation";
+import ToolsTable from "./ToolsTable";
+
+export { ToolForm, ToolHeader, ToolNavigation, ToolsTable };
diff --git a/apps/carbon/app/modules/items/ui/index.ts b/apps/carbon/app/modules/items/ui/index.ts
index d72bebd7a0..1dc10cb37b 100644
--- a/apps/carbon/app/modules/items/ui/index.ts
+++ b/apps/carbon/app/modules/items/ui/index.ts
@@ -4,10 +4,8 @@ export * from "./Item";
export * from "./ItemGroups";
export * from "./MaterialForms";
export * from "./MaterialSubstances";
-export * from "./Part";
export * from "./Parts";
-export * from "./Routing";
-export * from "./Service";
export * from "./Services";
+export * from "./Tools";
export * from "./UnitOfMeasure";
export { useItemsSubmodules };
diff --git a/apps/carbon/app/routes/x+/part+/$itemId.tsx b/apps/carbon/app/routes/x+/part+/$itemId.tsx
index a1747dad17..8b394e9554 100644
--- a/apps/carbon/app/routes/x+/part+/$itemId.tsx
+++ b/apps/carbon/app/routes/x+/part+/$itemId.tsx
@@ -1,7 +1,7 @@
import type { LoaderFunctionArgs } from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
import { Outlet } from "@remix-run/react";
-import { PartHeader, PartSidebar, getPart } from "~/modules/items";
+import { PartHeader, PartNavigation, getPart } from "~/modules/items";
import { requirePermissions } from "~/services/auth/auth.server";
import { flash } from "~/services/session.server";
import { path } from "~/utils/path";
@@ -37,7 +37,7 @@ export default function PartRoute() {
<>
<PartHeader />
<div className="grid grid-cols-1 md:grid-cols-[1fr_4fr] h-full w-full gap-4">
- <PartSidebar />
+ <PartNavigation />
<Outlet />
</div>
</>
diff --git a/apps/carbon/app/routes/x+/service+/$itemId.tsx b/apps/carbon/app/routes/x+/service+/$itemId.tsx
index 2148cf93d5..a9d8fa8cec 100644
--- a/apps/carbon/app/routes/x+/service+/$itemId.tsx
+++ b/apps/carbon/app/routes/x+/service+/$itemId.tsx
@@ -1,7 +1,7 @@
import type { LoaderFunctionArgs } from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
import { Outlet } from "@remix-run/react";
-import { ServiceHeader, ServiceSidebar, getService } from "~/modules/items";
+import { ServiceHeader, ServiceNavigation, getService } from "~/modules/items";
import { requirePermissions } from "~/services/auth/auth.server";
import { flash } from "~/services/session.server";
import type { Handle } from "~/utils/handle";
@@ -40,7 +40,7 @@ export default function ServiceRoute() {
<>
<ServiceHeader />
<div className="grid grid-cols-1 md:grid-cols-[1fr_4fr] h-full w-full gap-4">
- <ServiceSidebar />
+ <ServiceNavigation />
<Outlet />
</div>
</>
diff --git a/apps/carbon/app/utils/path.ts b/apps/carbon/app/utils/path.ts
index 10470bc990..e6b6227e35 100644
--- a/apps/carbon/app/utils/path.ts
+++ b/apps/carbon/app/utils/path.ts
@@ -277,6 +277,8 @@ export const path = {
inventory: `${x}/inventory`,
invoicing: `${x}/invoicing`,
items: `${x}/items`,
+ itemGroup: (id: string) => generatePath(`${x}/items/groups/${id}`),
+ itemGroups: `${x}/items/groups`,
jobs: `${x}/jobs`,
location: (id: string) => generatePath(`${x}/resources/locations/${id}`),
locations: `${x}/resources/locations`,
@@ -377,6 +379,7 @@ export const path = {
generatePath(`${x}/supplier/${id}/locations/new`),
newSupplierStatus: `${x}/purchasing/supplier-statuses/new`,
newSupplierType: `${x}/purchasing/supplier-types/new`,
+ newTool: `${x}/tool/new`,
newUom: `${x}/items/uom/new`,
newWorkCell: `${x}/resources/work-cells/cell/new`,
newWorkCellUnit: (id: string) =>
@@ -385,8 +388,6 @@ export const path = {
part: (id: string) => generatePath(`${x}/part/${id}`),
partCosting: (id: string) => generatePath(`${x}/part/${id}/costing`),
partDetails: (id: string) => generatePath(`${x}/part/${id}/details`),
- itemGroup: (id: string) => generatePath(`${x}/items/groups/${id}`),
- itemGroups: `${x}/items/groups`,
partInventory: (id: string) => generatePath(`${x}/part/${id}/inventory`),
partInventoryLocation: (id: string, locationId: string) =>
generatePath(`${x}/part/${id}/inventory?location=${locationId}`),
@@ -556,6 +557,21 @@ export const path = {
generatePath(`${x}/settings/sequences/${id}`),
theme: `${x}/account/theme`,
timecards: `${x}/timecards`,
+ tool: (id: string) => generatePath(`${x}/tool/${id}`),
+ toolCosting: (id: string) => generatePath(`${x}/tool/${id}/costing`),
+ toolDetails: (id: string) => generatePath(`${x}/tool/${id}/details`),
+ toolInventory: (id: string) => generatePath(`${x}/tool/${id}/inventory`),
+ toolInventoryLocation: (id: string, locationId: string) =>
+ generatePath(`${x}/tool/${id}/inventory?location=${locationId}`),
+ toolPlanning: (id: string) => generatePath(`${x}/tool/${id}/planning`),
+ toolPlanningLocation: (id: string, locationId: string) =>
+ generatePath(`${x}/tool/${id}/planning?location=${locationId}`),
+ toolPricing: (id: string) => generatePath(`${x}/tool/${id}/pricing`),
+ toolPurchasing: (id: string) => generatePath(`${x}/tool/${id}/purchasing`),
+ toolRoot: `${x}/tool`,
+ toolSupplier: (itemId: string, id: string) =>
+ generatePath(`${x}/tool/${itemId}/suppliers/${id}`),
+ toolSuppliers: (id: string) => generatePath(`${x}/tool/${id}/suppliers`),
tools: `${x}/items/tools`,
uom: (id: string) => generatePath(`${x}/items/uom/${id}`),
uoms: `${x}/items/uom`,