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.

style: triangle font and active menu fixes

Brad Barbin8e34d83e7213
diff --git a/apps/carbon/app/components/Layout/Background.tsx b/apps/carbon/app/components/Layout/Background.tsx
index 80d439e770..4b422bc053 100644
--- a/apps/carbon/app/components/Layout/Background.tsx
+++ b/apps/carbon/app/components/Layout/Background.tsx
@@ -1,7 +1,7 @@
const Background = () => {
return (
- <div className="background dark:hidden">
- <div className="gradient" />
+ <div className="background">
+ <div className="gradient dark:hidden" />
</div>
);
};
diff --git a/apps/carbon/app/modules/parts/ui/Part/PartSidebar/usePartSidebar.tsx b/apps/carbon/app/modules/parts/ui/Part/PartSidebar/usePartSidebar.tsx
index a57d37c585..90c5e5673b 100644
--- a/apps/carbon/app/modules/parts/ui/Part/PartSidebar/usePartSidebar.tsx
+++ b/apps/carbon/app/modules/parts/ui/Part/PartSidebar/usePartSidebar.tsx
@@ -1,3 +1,4 @@
+import { useParams } from "@remix-run/react";
import { BiListCheck } from "react-icons/bi";
import { BsBank, BsBarChartLineFill, BsCartDash } from "react-icons/bs";
import { HiOutlineCube } from "react-icons/hi";
@@ -6,19 +7,23 @@ import { PiMoneyFill, PiShareNetworkFill } from "react-icons/pi";
import { usePermissions } from "~/hooks";
import type { PartReplenishmentSystem } from "~/modules/parts/types";
import type { Role } from "~/types";
+import { path } from "~/utils/path";
export function usePartSidebar(replenishment: PartReplenishmentSystem) {
const permissions = usePermissions();
+ const { partId } = useParams();
+ if (!partId) throw new Error("partId not found");
+
return [
{
name: "Details",
- to: "",
+ to: path.to.partDetails(partId),
icon: BsBank,
shortcut: "Command+Shift+d",
},
{
name: "Purchasing",
- to: "purchasing",
+ to: path.to.partPurchasing(partId),
isDisabled: replenishment === "Make",
role: ["employee", "supplier"],
icon: BsCartDash,
@@ -26,7 +31,7 @@ export function usePartSidebar(replenishment: PartReplenishmentSystem) {
},
{
name: "Suppliers",
- to: "suppliers",
+ to: path.to.partSuppliers(partId),
isDisabled: replenishment === "Make",
role: ["employee", "supplier"],
icon: PiShareNetworkFill,
@@ -34,7 +39,7 @@ export function usePartSidebar(replenishment: PartReplenishmentSystem) {
},
{
name: "Manufacturing",
- to: "manufacturing",
+ to: path.to.partManufacturing(partId),
isDisabled: replenishment === "Buy",
role: ["employee"],
icon: BiListCheck,
@@ -42,28 +47,28 @@ export function usePartSidebar(replenishment: PartReplenishmentSystem) {
},
{
name: "Costing",
- to: "costing",
+ to: path.to.partCosting(partId),
role: ["employee", "supplier"],
icon: IoPricetagsOutline,
shortcut: "Command+Shift+c",
},
{
name: "Planning",
- to: "planning",
+ to: path.to.partPlanning(partId),
role: ["employee"],
icon: BsBarChartLineFill,
shortcut: "Command+Shift+p",
},
{
name: "Inventory",
- to: "inventory",
+ to: path.to.partInventory(partId),
role: ["employee", "supplier"],
icon: HiOutlineCube,
shortcut: "Command+Shift+i",
},
{
name: "Sale Price",
- to: "sale-price",
+ to: path.to.partSalePrice(partId),
role: ["employee", "customer"],
icon: PiMoneyFill,
shortcut: "Command+Shift+x",
diff --git a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierHeader.tsx b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierHeader.tsx
index 2475e04450..cf5bad41fe 100644
--- a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierHeader.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierHeader.tsx
@@ -58,7 +58,7 @@ const SupplierHeader = () => {
<CardAttributeValue>
{sharedSupplierData?.supplierTypes?.find(
(type) => type.id === routeData?.supplier?.supplierTypeId
- )?.name ?? "--"}
+ )?.name ?? "-"}
</CardAttributeValue>
</CardAttribute>
<CardAttribute>
@@ -67,7 +67,7 @@ const SupplierHeader = () => {
{sharedSupplierData?.supplierStatuses?.find(
(status) =>
status.id === routeData?.supplier?.supplierStatusId
- )?.name ?? "--"}
+ )?.name ?? "-"}
</CardAttributeValue>
</CardAttribute>
<CardAttribute>
diff --git a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierSidebar/useSupplierSidebar.tsx b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierSidebar/useSupplierSidebar.tsx
index d11e74b276..0183f40dbc 100644
--- a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierSidebar/useSupplierSidebar.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierSidebar/useSupplierSidebar.tsx
@@ -1,3 +1,4 @@
+import { useParams } from "@remix-run/react";
import {
BsBank,
BsCreditCard,
@@ -7,6 +8,7 @@ import {
} from "react-icons/bs";
import { usePermissions } from "~/hooks";
import type { Role } from "~/types";
+import { path } from "~/utils/path";
type Props = {
contacts: number;
@@ -15,16 +17,19 @@ type Props = {
export function useSupplierSidebar({ contacts, locations }: Props) {
const permissions = usePermissions();
+ const { supplierId } = useParams();
+ if (!supplierId) throw new Error("supplierId not found");
+
return [
{
name: "Details",
- to: "",
+ to: path.to.supplierDetails(supplierId),
icon: BsBank,
shortcut: "Command+Shift+d",
},
{
name: "Contacts",
- to: "contacts",
+ to: path.to.supplierContacts(supplierId),
role: ["employee"],
count: contacts,
icon: BsFillPersonLinesFill,
@@ -32,7 +37,7 @@ export function useSupplierSidebar({ contacts, locations }: Props) {
},
{
name: "Locations",
- to: "locations",
+ to: path.to.supplierLocations(supplierId),
role: ["employee", "supplier"],
count: locations,
icon: BsFillPinMapFill,
@@ -40,14 +45,14 @@ export function useSupplierSidebar({ contacts, locations }: Props) {
},
{
name: "Payments",
- to: "payments",
+ to: path.to.supplierPayment(supplierId),
role: ["employee"],
icon: BsCreditCard,
shortcut: "Command+Shift+p",
},
{
name: "Shipping",
- to: "shipping",
+ to: path.to.supplierShipping(supplierId),
role: ["employee"],
icon: BsTruck,
shortcut: "Command+Shift+s",
diff --git a/apps/carbon/app/modules/sales/ui/Customer/CustomerHeader.tsx b/apps/carbon/app/modules/sales/ui/Customer/CustomerHeader.tsx
index b3b7cf2eb1..831f83103d 100644
--- a/apps/carbon/app/modules/sales/ui/Customer/CustomerHeader.tsx
+++ b/apps/carbon/app/modules/sales/ui/Customer/CustomerHeader.tsx
@@ -54,7 +54,7 @@ const CustomerHeader = () => {
<CardAttributeValue>
{sharedCustomerData?.customerTypes?.find(
(type) => type.id === routeData?.customer?.customerTypeId
- )?.name ?? "--"}
+ )?.name ?? "-"}
</CardAttributeValue>
</CardAttribute>
<CardAttribute>
@@ -63,7 +63,7 @@ const CustomerHeader = () => {
{sharedCustomerData?.customerStatuses?.find(
(status) =>
status.id === routeData?.customer?.customerStatusId
- )?.name ?? "--"}
+ )?.name ?? "-"}
</CardAttributeValue>
</CardAttribute>
{/* <CardAttribute>
diff --git a/apps/carbon/app/modules/sales/ui/Customer/CustomerSidebar/useCustomerSidebar.tsx b/apps/carbon/app/modules/sales/ui/Customer/CustomerSidebar/useCustomerSidebar.tsx
index dd19bb801b..ad6f6007bc 100644
--- a/apps/carbon/app/modules/sales/ui/Customer/CustomerSidebar/useCustomerSidebar.tsx
+++ b/apps/carbon/app/modules/sales/ui/Customer/CustomerSidebar/useCustomerSidebar.tsx
@@ -1,3 +1,4 @@
+import { useParams } from "@remix-run/react";
import {
BsBank,
BsCreditCard,
@@ -7,6 +8,7 @@ import {
} from "react-icons/bs";
import { usePermissions } from "~/hooks";
import type { Role } from "~/types";
+import { path } from "~/utils/path";
type Props = {
contacts: number;
@@ -15,16 +17,18 @@ type Props = {
export function useCustomerSidebar({ contacts, locations }: Props) {
const permissions = usePermissions();
+ const { customerId } = useParams();
+ if (!customerId) throw new Error("customerId not found");
return [
{
name: "Details",
- to: "",
+ to: path.to.customerDetails(customerId),
icon: BsBank,
shortcut: "Command+Shift+d",
},
{
name: "Contacts",
- to: "contacts",
+ to: path.to.customerContacts(customerId),
role: ["employee"],
count: contacts,
icon: BsFillPersonLinesFill,
@@ -32,7 +36,7 @@ export function useCustomerSidebar({ contacts, locations }: Props) {
},
{
name: "Locations",
- to: "locations",
+ to: path.to.customerLocations(customerId),
role: ["employee", "customer"],
count: locations,
icon: BsFillPinMapFill,
@@ -40,14 +44,14 @@ export function useCustomerSidebar({ contacts, locations }: Props) {
},
{
name: "Payments",
- to: "payments",
+ to: path.to.customerPayment(customerId),
role: ["employee"],
icon: BsCreditCard,
shortcut: "Command+Shift+p",
},
{
name: "Shipping",
- to: "shipping",
+ to: path.to.customerShipping(customerId),
role: ["employee"],
icon: BsTruck,
shortcut: "Command+Shift+s",
diff --git a/apps/carbon/app/routes/_public+/login.tsx b/apps/carbon/app/routes/_public+/login.tsx
index d0b6d7d8d5..57bbc81706 100644
--- a/apps/carbon/app/routes/_public+/login.tsx
+++ b/apps/carbon/app/routes/_public+/login.tsx
@@ -85,7 +85,7 @@ export default function LoginRoute() {
className="hidden dark:block max-w-[100px] mb-3"
/>
- <div className="rounded-lg bg-card shadow-lg p-8 w-[380px]">
+ <div className="rounded-lg bg-card border border-border shadow-lg p-8 w-[380px]">
<ValidatedForm
validator={loginValidator}
defaultValues={{ redirectTo }}
diff --git a/apps/carbon/app/routes/x+/customer+/$customerId._index.tsx b/apps/carbon/app/routes/x+/customer+/$customerId._index.tsx
index 2889c0cb81..02eb6fefb1 100644
--- a/apps/carbon/app/routes/x+/customer+/$customerId._index.tsx
+++ b/apps/carbon/app/routes/x+/customer+/$customerId._index.tsx
@@ -1,77 +1,9 @@
-import { validationError, validator } from "@carbon/remix-validated-form";
-import type { ActionFunctionArgs } from "@remix-run/node";
-import { json, redirect } from "@remix-run/node";
-import { useParams } from "@remix-run/react";
-import { useRouteData } from "~/hooks";
-import type { CustomerDetail } from "~/modules/sales";
-import {
- CustomerForm,
- customerValidator,
- upsertCustomer,
-} from "~/modules/sales";
-import { requirePermissions } from "~/services/auth";
-import { flash } from "~/services/session.server";
-import { getCustomFields, setCustomFields } from "~/utils/form";
-import { assertIsPost } from "~/utils/http";
+import type { LoaderFunctionArgs } from "@remix-run/node";
+import { redirect } from "@remix-run/node";
import { path } from "~/utils/path";
-import { error, success } from "~/utils/result";
-export async function action({ request }: ActionFunctionArgs) {
- assertIsPost(request);
- const { client, userId } = await requirePermissions(request, {
- create: "sales",
- });
-
- const formData = await request.formData();
- const validation = await validator(customerValidator).validate(formData);
-
- if (validation.error) {
- return validationError(validation.error);
- }
-
- const { id, ...data } = validation.data;
-
- if (!id) {
- return redirect(
- path.to.customers,
- await flash(request, error(null, "Failed to update customer"))
- );
- }
-
- const update = await upsertCustomer(client, {
- id,
- ...data,
- customFields: setCustomFields(formData),
- updatedBy: userId,
- });
- if (update.error) {
- return redirect(
- path.to.customers,
- await flash(request, error(update.error, "Failed to update customer"))
- );
- }
-
- return json(null, await flash(request, success("Updated customer")));
-}
-
-export default function CustomerEditRoute() {
- const { customerId } = useParams();
+export async function loader({ params }: LoaderFunctionArgs) {
+ const { customerId } = params;
if (!customerId) throw new Error("Could not find customerId");
- const routeData = useRouteData<{ customer: CustomerDetail }>(
- path.to.customer(customerId)
- );
-
- if (!routeData?.customer) return null;
-
- const initialValues = {
- id: routeData?.customer?.id ?? undefined,
- name: routeData?.customer?.name ?? "",
- customerTypeId: routeData?.customer?.customerTypeId ?? undefined,
- customerStatusId: routeData?.customer?.customerStatusId ?? undefined,
- accountManagerId: routeData?.customer?.accountManagerId ?? undefined,
- taxId: routeData?.customer?.taxId ?? "",
- ...getCustomFields(routeData?.customer?.customFields),
- };
-
- return <CustomerForm key={initialValues.id} initialValues={initialValues} />;
+ return redirect(path.to.customerDetails(customerId));
}
diff --git a/apps/carbon/app/routes/x+/customer+/$customerId.details.tsx b/apps/carbon/app/routes/x+/customer+/$customerId.details.tsx
new file mode 100644
index 0000000000..2889c0cb81
--- /dev/null
+++ b/apps/carbon/app/routes/x+/customer+/$customerId.details.tsx
@@ -0,0 +1,77 @@
+import { validationError, validator } from "@carbon/remix-validated-form";
+import type { ActionFunctionArgs } from "@remix-run/node";
+import { json, redirect } from "@remix-run/node";
+import { useParams } from "@remix-run/react";
+import { useRouteData } from "~/hooks";
+import type { CustomerDetail } from "~/modules/sales";
+import {
+ CustomerForm,
+ customerValidator,
+ upsertCustomer,
+} from "~/modules/sales";
+import { requirePermissions } from "~/services/auth";
+import { flash } from "~/services/session.server";
+import { getCustomFields, setCustomFields } from "~/utils/form";
+import { assertIsPost } from "~/utils/http";
+import { path } from "~/utils/path";
+import { error, success } from "~/utils/result";
+
+export async function action({ request }: ActionFunctionArgs) {
+ assertIsPost(request);
+ const { client, userId } = await requirePermissions(request, {
+ create: "sales",
+ });
+
+ const formData = await request.formData();
+ const validation = await validator(customerValidator).validate(formData);
+
+ if (validation.error) {
+ return validationError(validation.error);
+ }
+
+ const { id, ...data } = validation.data;
+
+ if (!id) {
+ return redirect(
+ path.to.customers,
+ await flash(request, error(null, "Failed to update customer"))
+ );
+ }
+
+ const update = await upsertCustomer(client, {
+ id,
+ ...data,
+ customFields: setCustomFields(formData),
+ updatedBy: userId,
+ });
+ if (update.error) {
+ return redirect(
+ path.to.customers,
+ await flash(request, error(update.error, "Failed to update customer"))
+ );
+ }
+
+ return json(null, await flash(request, success("Updated customer")));
+}
+
+export default function CustomerEditRoute() {
+ const { customerId } = useParams();
+ if (!customerId) throw new Error("Could not find customerId");
+ const routeData = useRouteData<{ customer: CustomerDetail }>(
+ path.to.customer(customerId)
+ );
+
+ if (!routeData?.customer) return null;
+
+ const initialValues = {
+ id: routeData?.customer?.id ?? undefined,
+ name: routeData?.customer?.name ?? "",
+ customerTypeId: routeData?.customer?.customerTypeId ?? undefined,
+ customerStatusId: routeData?.customer?.customerStatusId ?? undefined,
+ accountManagerId: routeData?.customer?.accountManagerId ?? undefined,
+ taxId: routeData?.customer?.taxId ?? "",
+ ...getCustomFields(routeData?.customer?.customFields),
+ };
+
+ return <CustomerForm key={initialValues.id} initialValues={initialValues} />;
+}
diff --git a/apps/carbon/app/routes/x+/part+/$partId._index.tsx b/apps/carbon/app/routes/x+/part+/$partId._index.tsx
index 92faa316f2..ecdba33351 100644
--- a/apps/carbon/app/routes/x+/part+/$partId._index.tsx
+++ b/apps/carbon/app/routes/x+/part+/$partId._index.tsx
@@ -1,72 +1,9 @@
-import { validationError, validator } from "@carbon/remix-validated-form";
-import type { ActionFunctionArgs } from "@remix-run/node";
+import type { LoaderFunctionArgs } from "@remix-run/node";
import { redirect } from "@remix-run/node";
-import { useParams } from "@remix-run/react";
-import { useRouteData } from "~/hooks";
-import type { PartSummary } from "~/modules/parts";
-import { PartForm, partValidator, upsertPart } from "~/modules/parts";
-import { requirePermissions } from "~/services/auth";
-import { flash } from "~/services/session.server";
-import { getCustomFields, setCustomFields } from "~/utils/form";
-import { assertIsPost } from "~/utils/http";
import { path } from "~/utils/path";
-import { error, success } from "~/utils/result";
-
-export async function action({ request, params }: ActionFunctionArgs) {
- assertIsPost(request);
- const { client, userId } = await requirePermissions(request, {
- update: "parts",
- });
+export async function loader({ params }: LoaderFunctionArgs) {
const { partId } = params;
if (!partId) throw new Error("Could not find partId");
-
- const formData = await request.formData();
- const validation = await validator(partValidator).validate(formData);
-
- if (validation.error) {
- return validationError(validation.error);
- }
-
- const updatePart = await upsertPart(client, {
- ...validation.data,
- id: partId,
- customFields: setCustomFields(formData),
- updatedBy: userId,
- });
- if (updatePart.error) {
- return redirect(
- path.to.part(partId),
- await flash(request, error(updatePart.error, "Failed to update part"))
- );
- }
-
- return redirect(
- path.to.part(partId),
- await flash(request, success("Updated part"))
- );
-}
-
-export default function PartBasicRoute() {
- const { partId } = useParams();
- if (!partId) throw new Error("Could not find partId");
- const partData = useRouteData<{ partSummary: PartSummary }>(
- path.to.part(partId)
- );
- if (!partData) throw new Error("Could not find part data");
-
- const initialValues = {
- id: partData.partSummary?.id ?? "",
- name: partData.partSummary?.name ?? "",
- description: partData.partSummary?.description ?? undefined,
- partType: partData.partSummary?.partType ?? "Inventory",
- partGroupId: partData.partSummary?.partGroupId ?? undefined,
- replenishmentSystem: partData.partSummary?.replenishmentSystem ?? "Buy",
- unitOfMeasureCode: partData.partSummary?.unitOfMeasureCode ?? "EA",
- blocked: partData.partSummary?.blocked ?? false,
- active: partData.partSummary?.active ?? false,
- ...getCustomFields(partData.partSummary?.customFields ?? {}),
- };
-
- return <PartForm key={initialValues.id} initialValues={initialValues} />;
+ return redirect(path.to.partDetails(partId));
}
diff --git a/apps/carbon/app/routes/x+/part+/$partId.details.tsx b/apps/carbon/app/routes/x+/part+/$partId.details.tsx
new file mode 100644
index 0000000000..92faa316f2
--- /dev/null
+++ b/apps/carbon/app/routes/x+/part+/$partId.details.tsx
@@ -0,0 +1,72 @@
+import { validationError, validator } from "@carbon/remix-validated-form";
+import type { ActionFunctionArgs } from "@remix-run/node";
+import { redirect } from "@remix-run/node";
+import { useParams } from "@remix-run/react";
+import { useRouteData } from "~/hooks";
+import type { PartSummary } from "~/modules/parts";
+import { PartForm, partValidator, upsertPart } from "~/modules/parts";
+import { requirePermissions } from "~/services/auth";
+import { flash } from "~/services/session.server";
+import { getCustomFields, setCustomFields } from "~/utils/form";
+import { assertIsPost } from "~/utils/http";
+import { path } from "~/utils/path";
+import { error, success } from "~/utils/result";
+
+export async function action({ request, params }: ActionFunctionArgs) {
+ assertIsPost(request);
+ const { client, userId } = await requirePermissions(request, {
+ update: "parts",
+ });
+
+ const { partId } = params;
+ if (!partId) throw new Error("Could not find partId");
+
+ const formData = await request.formData();
+ const validation = await validator(partValidator).validate(formData);
+
+ if (validation.error) {
+ return validationError(validation.error);
+ }
+
+ const updatePart = await upsertPart(client, {
+ ...validation.data,
+ id: partId,
+ customFields: setCustomFields(formData),
+ updatedBy: userId,
+ });
+ if (updatePart.error) {
+ return redirect(
+ path.to.part(partId),
+ await flash(request, error(updatePart.error, "Failed to update part"))
+ );
+ }
+
+ return redirect(
+ path.to.part(partId),
+ await flash(request, success("Updated part"))
+ );
+}
+
+export default function PartBasicRoute() {
+ const { partId } = useParams();
+ if (!partId) throw new Error("Could not find partId");
+ const partData = useRouteData<{ partSummary: PartSummary }>(
+ path.to.part(partId)
+ );
+ if (!partData) throw new Error("Could not find part data");
+
+ const initialValues = {
+ id: partData.partSummary?.id ?? "",
+ name: partData.partSummary?.name ?? "",
+ description: partData.partSummary?.description ?? undefined,
+ partType: partData.partSummary?.partType ?? "Inventory",
+ partGroupId: partData.partSummary?.partGroupId ?? undefined,
+ replenishmentSystem: partData.partSummary?.replenishmentSystem ?? "Buy",
+ unitOfMeasureCode: partData.partSummary?.unitOfMeasureCode ?? "EA",
+ blocked: partData.partSummary?.blocked ?? false,
+ active: partData.partSummary?.active ?? false,
+ ...getCustomFields(partData.partSummary?.customFields ?? {}),
+ };
+
+ return <PartForm key={initialValues.id} initialValues={initialValues} />;
+}
diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId._index.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId._index.tsx
index b3bf6d86c4..515415eadc 100644
--- a/apps/carbon/app/routes/x+/supplier+/$supplierId._index.tsx
+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId._index.tsx
@@ -1,77 +1,9 @@
-import { validationError, validator } from "@carbon/remix-validated-form";
-import type { ActionFunctionArgs } from "@remix-run/node";
-import { json, redirect } from "@remix-run/node";
-import { useParams } from "@remix-run/react";
-import { useRouteData } from "~/hooks";
-import type { SupplierDetail } from "~/modules/purchasing";
-import {
- SupplierForm,
- supplierValidator,
- upsertSupplier,
-} from "~/modules/purchasing";
-import { requirePermissions } from "~/services/auth";
-import { flash } from "~/services/session.server";
-import { getCustomFields, setCustomFields } from "~/utils/form";
-import { assertIsPost } from "~/utils/http";
+import type { LoaderFunctionArgs } from "@remix-run/node";
+import { redirect } from "@remix-run/node";
import { path } from "~/utils/path";
-import { error, success } from "~/utils/result";
-export async function action({ request }: ActionFunctionArgs) {
- assertIsPost(request);
- const { client, userId } = await requirePermissions(request, {
- create: "purchasing",
- });
-
- const formData = await request.formData();
- const validation = await validator(supplierValidator).validate(formData);
-
- if (validation.error) {
- return validationError(validation.error);
- }
-
- const { id, ...data } = validation.data;
-
- if (!id) {
- return redirect(
- path.to.suppliers,
- await flash(request, error(null, "Failed to update supplier"))
- );
- }
-
- const update = await upsertSupplier(client, {
- id,
- ...data,
- updatedBy: userId,
- customFields: setCustomFields(formData),
- });
- if (update.error) {
- return redirect(
- path.to.suppliers,
- await flash(request, error(update.error, "Failed to update supplier"))
- );
- }
-
- return json(null, await flash(request, success("Updated supplier")));
-}
-
-export default function SupplierEditRoute() {
- const { supplierId } = useParams();
+export async function loader({ params }: LoaderFunctionArgs) {
+ const { supplierId } = params;
if (!supplierId) throw new Error("Could not find supplierId");
- const routeData = useRouteData<{ supplier: SupplierDetail }>(
- path.to.supplier(supplierId)
- );
-
- if (!routeData?.supplier) return null;
-
- const initialValues = {
- id: routeData?.supplier?.id ?? undefined,
- name: routeData?.supplier?.name ?? "",
- supplierTypeId: routeData?.supplier?.supplierTypeId ?? undefined,
- supplierStatusId: routeData?.supplier?.supplierStatusId ?? undefined,
- accountManagerId: routeData?.supplier?.accountManagerId ?? undefined,
- taxId: routeData?.supplier?.taxId ?? "",
- ...getCustomFields(routeData?.supplier?.customFields),
- };
-
- return <SupplierForm key={initialValues.id} initialValues={initialValues} />;
+ return redirect(path.to.supplierDetails(supplierId));
}
diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId.details.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId.details.tsx
new file mode 100644
index 0000000000..b3bf6d86c4
--- /dev/null
+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId.details.tsx
@@ -0,0 +1,77 @@
+import { validationError, validator } from "@carbon/remix-validated-form";
+import type { ActionFunctionArgs } from "@remix-run/node";
+import { json, redirect } from "@remix-run/node";
+import { useParams } from "@remix-run/react";
+import { useRouteData } from "~/hooks";
+import type { SupplierDetail } from "~/modules/purchasing";
+import {
+ SupplierForm,
+ supplierValidator,
+ upsertSupplier,
+} from "~/modules/purchasing";
+import { requirePermissions } from "~/services/auth";
+import { flash } from "~/services/session.server";
+import { getCustomFields, setCustomFields } from "~/utils/form";
+import { assertIsPost } from "~/utils/http";
+import { path } from "~/utils/path";
+import { error, success } from "~/utils/result";
+
+export async function action({ request }: ActionFunctionArgs) {
+ assertIsPost(request);
+ const { client, userId } = await requirePermissions(request, {
+ create: "purchasing",
+ });
+
+ const formData = await request.formData();
+ const validation = await validator(supplierValidator).validate(formData);
+
+ if (validation.error) {
+ return validationError(validation.error);
+ }
+
+ const { id, ...data } = validation.data;
+
+ if (!id) {
+ return redirect(
+ path.to.suppliers,
+ await flash(request, error(null, "Failed to update supplier"))
+ );
+ }
+
+ const update = await upsertSupplier(client, {
+ id,
+ ...data,
+ updatedBy: userId,
+ customFields: setCustomFields(formData),
+ });
+ if (update.error) {
+ return redirect(
+ path.to.suppliers,
+ await flash(request, error(update.error, "Failed to update supplier"))
+ );
+ }
+
+ return json(null, await flash(request, success("Updated supplier")));
+}
+
+export default function SupplierEditRoute() {
+ const { supplierId } = useParams();
+ if (!supplierId) throw new Error("Could not find supplierId");
+ const routeData = useRouteData<{ supplier: SupplierDetail }>(
+ path.to.supplier(supplierId)
+ );
+
+ if (!routeData?.supplier) return null;
+
+ const initialValues = {
+ id: routeData?.supplier?.id ?? undefined,
+ name: routeData?.supplier?.name ?? "",
+ supplierTypeId: routeData?.supplier?.supplierTypeId ?? undefined,
+ supplierStatusId: routeData?.supplier?.supplierStatusId ?? undefined,
+ accountManagerId: routeData?.supplier?.accountManagerId ?? undefined,
+ taxId: routeData?.supplier?.taxId ?? "",
+ ...getCustomFields(routeData?.supplier?.customFields),
+ };
+
+ return <SupplierForm key={initialValues.id} initialValues={initialValues} />;
+}
diff --git a/apps/carbon/app/styles/tailwind.css b/apps/carbon/app/styles/tailwind.css
index ced0db8ee3..69df8d30b5 100644
--- a/apps/carbon/app/styles/tailwind.css
+++ b/apps/carbon/app/styles/tailwind.css
@@ -1,4 +1,53 @@
-@import url("https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&family=Roboto+Mono:wght@300;400;500;600;700&display=swap&display=swap");
+@import url("https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300;400;500;600;700&display=swap&display=swap");
+
+@font-face {
+ font-family: "Triangle";
+ font-style: normal;
+ font-weight: 200;
+ src: url("/fonts/Geist-UltraLight.woff2") format("woff2");
+}
+
+@font-face {
+ font-family: "Triangle";
+ font-style: normal;
+ font-weight: 300;
+ src: url("/fonts/Geist-Light.woff2") format("woff2");
+}
+
+@font-face {
+ font-family: "Triangle";
+ font-style: normal;
+ font-weight: 500;
+ src: url("/fonts/Geist-Medium.woff2") format("woff2");
+}
+
+@font-face {
+ font-family: "Triangle";
+ font-style: normal;
+ font-weight: 600;
+ src: url("/fonts/Geist-SemiBold.woff2") format("woff2");
+}
+
+@font-face {
+ font-family: "Triangle";
+ font-style: normal;
+ font-weight: 700;
+ src: url("/fonts/Geist-Bold.woff2") format("woff2");
+}
+
+@font-face {
+ font-family: "Triangle";
+ font-style: normal;
+ font-weight: 800;
+ src: url("/fonts/Geist-Black.woff2") format("woff2");
+}
+
+@font-face {
+ font-family: "Triangle";
+ font-style: normal;
+ font-weight: 900;
+ src: url("/fonts/Geist-UltraBlack.woff2") format("woff2");
+}
@tailwind base;
@tailwind components;
diff --git a/apps/carbon/app/utils/path.ts b/apps/carbon/app/utils/path.ts
index a80457d602..4d30d0e0ed 100644
--- a/apps/carbon/app/utils/path.ts
+++ b/apps/carbon/app/utils/path.ts
@@ -104,6 +104,8 @@ export const path = {
currency: (id: string) => generatePath(`${x}/accounting/currencies/${id}`),
currencies: `${x}/accounting/currencies`,
customer: (id: string) => generatePath(`${x}/customer/${id}`),
+ customerDetails: (id: string) =>
+ generatePath(`${x}/customer/${id}/details`),
customerRoot: `${x}/customer`,
customers: `${x}/sales/customers`,
customerAccounts: `${x}/users/customers`,
@@ -351,6 +353,7 @@ export const path = {
newWorkCellType: `${x}/resources/work-cells/new`,
part: (id: string) => generatePath(`${x}/part/${id}`),
partCosting: (id: string) => generatePath(`${x}/part/${id}/costing`),
+ partDetails: (id: string) => generatePath(`${x}/part/${id}/details`),
partGroup: (id: string) => generatePath(`${x}/parts/groups/${id}`),
partGroups: `${x}/parts/groups`,
partInventory: (id: string) => generatePath(`${x}/part/${id}/inventory`),
@@ -477,6 +480,8 @@ export const path = {
supplierAccounts: `${x}/users/suppliers`,
supplierContact: (supplierId: string, id: string) =>
generatePath(`${x}/supplier/${supplierId}/contacts/${id}`),
+ supplierDetails: (id: string) =>
+ generatePath(`${x}/supplier/${id}/details`),
supplierContacts: (id: string) =>
generatePath(`${x}/supplier/${id}/contacts`),
supplierLocation: (supplierId: string, id: string) =>
diff --git a/apps/carbon/public/fonts/Geist-Black.woff2 b/apps/carbon/public/fonts/Geist-Black.woff2
new file mode 100644
index 0000000000..c8230cbc68
Binary files /dev/null and b/apps/carbon/public/fonts/Geist-Black.woff2 differ
diff --git a/apps/carbon/public/fonts/Geist-Bold.woff2 b/apps/carbon/public/fonts/Geist-Bold.woff2
new file mode 100644
index 0000000000..d0562e48ec
Binary files /dev/null and b/apps/carbon/public/fonts/Geist-Bold.woff2 differ
diff --git a/apps/carbon/public/fonts/Geist-Light.woff2 b/apps/carbon/public/fonts/Geist-Light.woff2
new file mode 100644
index 0000000000..56611204f7
Binary files /dev/null and b/apps/carbon/public/fonts/Geist-Light.woff2 differ
diff --git a/apps/carbon/public/fonts/Geist-Medium.woff2 b/apps/carbon/public/fonts/Geist-Medium.woff2
new file mode 100644
index 0000000000..76edd10515
Binary files /dev/null and b/apps/carbon/public/fonts/Geist-Medium.woff2 differ
diff --git a/apps/carbon/public/fonts/Geist-Regular.woff2 b/apps/carbon/public/fonts/Geist-Regular.woff2
new file mode 100644
index 0000000000..2ebd0097e7
Binary files /dev/null and b/apps/carbon/public/fonts/Geist-Regular.woff2 differ
diff --git a/apps/carbon/public/fonts/Geist-SemiBold.woff2 b/apps/carbon/public/fonts/Geist-SemiBold.woff2
new file mode 100644
index 0000000000..a6c53e8b06
Binary files /dev/null and b/apps/carbon/public/fonts/Geist-SemiBold.woff2 differ
diff --git a/apps/carbon/public/fonts/Geist-UltraBlack.woff2 b/apps/carbon/public/fonts/Geist-UltraBlack.woff2
new file mode 100644
index 0000000000..198caeadc9
Binary files /dev/null and b/apps/carbon/public/fonts/Geist-UltraBlack.woff2 differ
diff --git a/apps/carbon/public/fonts/Geist-UltraLight.woff2 b/apps/carbon/public/fonts/Geist-UltraLight.woff2
new file mode 100644
index 0000000000..541685251a
Binary files /dev/null and b/apps/carbon/public/fonts/Geist-UltraLight.woff2 differ
diff --git a/packages/documents/src/email/PurchaseOrderEmail.tsx b/packages/documents/src/email/PurchaseOrderEmail.tsx
index 2de9f82556..5293023a62 100644
--- a/packages/documents/src/email/PurchaseOrderEmail.tsx
+++ b/packages/documents/src/email/PurchaseOrderEmail.tsx
@@ -112,7 +112,7 @@ const PurchaseOrderEmail = ({
<Column style={informationTableColumn}>
<Text style={informationTableLabel}>Payment Terms</Text>
<Text style={informationTableValue}>
- {purchaseOrder.paymentTermName ?? "--"}
+ {purchaseOrder.paymentTermName ?? "-"}
</Text>
</Column>
</Row>
@@ -127,7 +127,7 @@ const PurchaseOrderEmail = ({
<Column style={informationTableColumn}>
<Text style={informationTableLabel}>Requested Date</Text>
<Text style={informationTableValue}>
- {purchaseOrder.receiptRequestedDate ?? "--"}
+ {purchaseOrder.receiptRequestedDate ?? "-"}
</Text>
</Column>
</Row>
@@ -218,10 +218,10 @@ const PurchaseOrderEmail = ({
<Column style={lineValueWrapper} align="right">
<Text style={lineValue}>
{line.purchaseOrderLineType === "Comment"
- ? "--"
+ ? "-"
: line.unitPrice
? `$${line.unitPrice.toFixed(2)}`
- : "--"}
+ : "-"}
</Text>
</Column>
</Row>
diff --git a/packages/documents/src/email/QuoteEmail.tsx b/packages/documents/src/email/QuoteEmail.tsx
index ec3d940c1e..3c5ef9ac18 100644
--- a/packages/documents/src/email/QuoteEmail.tsx
+++ b/packages/documents/src/email/QuoteEmail.tsx
@@ -86,7 +86,7 @@ const QuoteEmail = ({
<Column style={informationTableColumn}>
<Text style={informationTableLabel}>Payment Terms</Text>
{/* <Text style={informationTableValue}>
- {quote.paymentTermName ?? "--"}
+ {quote.paymentTermName ?? "-"}
</Text> */}
</Column>
</Row>
@@ -99,7 +99,7 @@ const QuoteEmail = ({
<Column style={informationTableColumn}>
<Text style={informationTableLabel}>Requested Date</Text>
{/* <Text style={informationTableValue}>
- {quote.receiptRequestedDate ?? "--"}
+ {quote.receiptRequestedDate ?? "-"}
</Text> */}
</Column>
</Row>
@@ -199,10 +199,10 @@ const QuoteEmail = ({
<Column style={lineValueWrapper} align="right">
<Text style={lineValue}>
{line.purchaseOrderLineType === "Comment"
- ? "--"
+ ? "-"
: line.unitPrice
? `$${line.unitPrice.toFixed(2)}`
- : "--"}
+ : "-"}
</Text>
</Column>
</Row>
diff --git a/packages/tailwind/tailwind.config.js b/packages/tailwind/tailwind.config.js
index 1ce7b35d71..62cdb40272 100644
--- a/packages/tailwind/tailwind.config.js
+++ b/packages/tailwind/tailwind.config.js
@@ -58,7 +58,7 @@ module.exports = {
sm: "calc(var(--radius) - 4px)",
},
fontFamily: {
- sans: ["Inter", ...fontFamily.sans],
+ sans: ["Triangle", ...fontFamily.sans],
mono: ["Roboto Mono", ...fontFamily.mono],
},
keyframes: {