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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
refactor: add useFetcher hook to inline creatable forms
Brad Barbinf5c3da356dc5
diff --git a/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupForm.tsx b/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupForm.tsxindex 5c64367959..6169be8066 100644--- a/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupForm.tsx+++ b/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupForm.tsx@@ -10,7 +10,7 @@ import {VStack,} from "@carbon/react";import { ValidatedForm } from "@carbon/remix-validated-form";-import { useNavigate } from "@remix-run/react";+import { useFetcher, useNavigate } from "@remix-run/react";import type { z } from "zod";import { Hidden, Input, Submit, TextArea } from "~/components/Form";import { usePermissions } from "~/hooks";@@ -22,6 +22,7 @@ type PartGroupFormProps = {};const PartGroupForm = ({ initialValues }: PartGroupFormProps) => {+ const fetcher = useFetcher();const permissions = usePermissions();const navigate = useNavigate();const onClose = () => navigate(-1);@@ -48,6 +49,7 @@ const PartGroupForm = ({ initialValues }: PartGroupFormProps) => {: path.to.newPartGroup}defaultValues={initialValues}+ fetcher={fetcher}className="flex flex-col h-full"><DrawerHeader>diff --git a/apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasureForm.tsx b/apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasureForm.tsxindex 00bcf1db19..2dddd8edf9 100644--- a/apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasureForm.tsx+++ b/apps/carbon/app/modules/parts/ui/UnitOfMeasure/UnitOfMeasureForm.tsx@@ -11,7 +11,7 @@ import {} from "@carbon/react";import { ValidatedForm } from "@carbon/remix-validated-form";-import { useNavigate } from "@remix-run/react";+import { useFetcher, useNavigate } from "@remix-run/react";import type { z } from "zod";import { Hidden, Input, Submit } from "~/components/Form";import { usePermissions } from "~/hooks";@@ -23,6 +23,7 @@ type UnitOfMeasureFormProps = {};const UnitOfMeasureForm = ({ initialValues }: UnitOfMeasureFormProps) => {+ const fetcher = useFetcher();const permissions = usePermissions();const navigate = useNavigate();const onClose = () => navigate(-1);@@ -45,6 +46,7 @@ const UnitOfMeasureForm = ({ initialValues }: UnitOfMeasureFormProps) => {method="post"action={isEditing ? path.to.uom(initialValues.id!) : path.to.newUom}defaultValues={initialValues}+ fetcher={fetcher}className="flex flex-col h-full"><DrawerHeader>diff --git a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContactForm.tsx b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContactForm.tsxindex 2813aaaf19..fcf9d95c11 100644--- a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContactForm.tsx+++ b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContactForm.tsx@@ -10,7 +10,7 @@ import {VStack,} from "@carbon/react";import { ValidatedForm } from "@carbon/remix-validated-form";-import { useNavigate, useParams } from "@remix-run/react";+import { useFetcher, useNavigate, useParams } from "@remix-run/react";import type { z } from "zod";import {DatePicker,@@ -29,6 +29,7 @@ type SupplierContactFormProps = {};const SupplierContactForm = ({ initialValues }: SupplierContactFormProps) => {+ const fetcher = useFetcher();const navigate = useNavigate();const { supplierId } = useParams();@@ -59,6 +60,7 @@ const SupplierContactForm = ({ initialValues }: SupplierContactFormProps) => {: path.to.newSupplierContact(supplierId)}defaultValues={initialValues}+ fetcher={fetcher}onSubmit={onClose}className="flex flex-col h-full">diff --git a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierLocationForm.tsx b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierLocationForm.tsxindex 4cef129cc1..f5f49b2da9 100644--- a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierLocationForm.tsx+++ b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierLocationForm.tsx@@ -11,7 +11,7 @@ import {} from "@carbon/react";import { ValidatedForm } from "@carbon/remix-validated-form";-import { useNavigate, useParams } from "@remix-run/react";+import { useFetcher, useNavigate, useParams } from "@remix-run/react";import type { z } from "zod";import { Hidden, Input, Submit } from "~/components/Form";import { usePermissions } from "~/hooks";@@ -23,6 +23,7 @@ type SupplierLocationFormProps = {};const SupplierLocationForm = ({ initialValues }: SupplierLocationFormProps) => {+ const fetcher = useFetcher();const navigate = useNavigate();const { supplierId } = useParams();@@ -54,6 +55,7 @@ const SupplierLocationForm = ({ initialValues }: SupplierLocationFormProps) => {}defaultValues={initialValues}onSubmit={onClose}+ fetcher={fetcher}className="flex flex-col h-full"><DrawerHeader>diff --git a/apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypeForm.tsx b/apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypeForm.tsxindex 3787b19bc9..bedd18c7c3 100644--- a/apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypeForm.tsx+++ b/apps/carbon/app/modules/purchasing/ui/SupplierTypes/SupplierTypeForm.tsx@@ -10,7 +10,7 @@ import {VStack,} from "@carbon/react";import { ValidatedForm } from "@carbon/remix-validated-form";-import { useNavigate } from "@remix-run/react";+import { useFetcher, useNavigate } from "@remix-run/react";import type { z } from "zod";import { Color, Hidden, Input, Submit } from "~/components/Form";import { usePermissions } from "~/hooks";@@ -22,6 +22,7 @@ type SupplierTypeFormProps = {};const SupplierTypeForm = ({ initialValues }: SupplierTypeFormProps) => {+ const fetcher = useFetcher();const permissions = usePermissions();const navigate = useNavigate();const onClose = () => navigate(-1);@@ -48,6 +49,7 @@ const SupplierTypeForm = ({ initialValues }: SupplierTypeFormProps) => {: path.to.newSupplierType}defaultValues={initialValues}+ fetcher={fetcher}className="flex flex-col h-full"><DrawerHeader>diff --git a/apps/carbon/app/modules/sales/ui/Customer/CustomerContactForm.tsx b/apps/carbon/app/modules/sales/ui/Customer/CustomerContactForm.tsxindex e22ac5f5f1..5a98801153 100644--- a/apps/carbon/app/modules/sales/ui/Customer/CustomerContactForm.tsx+++ b/apps/carbon/app/modules/sales/ui/Customer/CustomerContactForm.tsx@@ -10,7 +10,7 @@ import {VStack,} from "@carbon/react";import { ValidatedForm } from "@carbon/remix-validated-form";-import { useNavigate, useParams } from "@remix-run/react";+import { useFetcher, useNavigate, useParams } from "@remix-run/react";import type { z } from "zod";import {DatePicker,@@ -29,6 +29,7 @@ type CustomerContactFormProps = {};const CustomerContactForm = ({ initialValues }: CustomerContactFormProps) => {+ const fetcher = useFetcher();const navigate = useNavigate();const { customerId } = useParams();@@ -59,6 +60,7 @@ const CustomerContactForm = ({ initialValues }: CustomerContactFormProps) => {: path.to.newCustomerContact(customerId)}defaultValues={initialValues}+ fetcher={fetcher}onSubmit={onClose}className="flex flex-col h-full">diff --git a/apps/carbon/app/modules/sales/ui/Customer/CustomerLocationForm.tsx b/apps/carbon/app/modules/sales/ui/Customer/CustomerLocationForm.tsxindex db7d648e31..7865f58c98 100644--- a/apps/carbon/app/modules/sales/ui/Customer/CustomerLocationForm.tsx+++ b/apps/carbon/app/modules/sales/ui/Customer/CustomerLocationForm.tsx@@ -11,7 +11,7 @@ import {} from "@carbon/react";import { ValidatedForm } from "@carbon/remix-validated-form";-import { useNavigate, useParams } from "@remix-run/react";+import { useFetcher, useNavigate, useParams } from "@remix-run/react";import type { z } from "zod";import { Hidden, Input, Submit } from "~/components/Form";import { usePermissions } from "~/hooks";@@ -23,6 +23,7 @@ type CustomerLocationFormProps = {};const CustomerLocationForm = ({ initialValues }: CustomerLocationFormProps) => {+ const fetcher = useFetcher();const navigate = useNavigate();const { customerId } = useParams();@@ -53,6 +54,7 @@ const CustomerLocationForm = ({ initialValues }: CustomerLocationFormProps) => {: path.to.newCustomerLocation(customerId)}defaultValues={initialValues}+ fetcher={fetcher}onSubmit={onClose}className="flex flex-col h-full">diff --git a/apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypeForm.tsx b/apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypeForm.tsxindex 633d40f4df..89694524da 100644--- a/apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypeForm.tsx+++ b/apps/carbon/app/modules/sales/ui/CustomerTypes/CustomerTypeForm.tsx@@ -10,7 +10,7 @@ import {VStack,} from "@carbon/react";import { ValidatedForm } from "@carbon/remix-validated-form";-import { useNavigate } from "@remix-run/react";+import { useFetcher, useNavigate } from "@remix-run/react";import type { z } from "zod";import { Color, Hidden, Input, Submit } from "~/components/Form";import { usePermissions } from "~/hooks";@@ -22,6 +22,7 @@ type CustomerTypeFormProps = {};const CustomerTypeForm = ({ initialValues }: CustomerTypeFormProps) => {+ const fetcher = useFetcher();const permissions = usePermissions();const navigate = useNavigate();const onClose = () => navigate(-1);@@ -48,6 +49,7 @@ const CustomerTypeForm = ({ initialValues }: CustomerTypeFormProps) => {: path.to.newCustomerType}defaultValues={initialValues}+ fetcher={fetcher}className="flex flex-col h-full"><DrawerHeader>