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: sales rfq details layout

Brad Barbinf18acbd7a2ec
diff --git a/apps/carbon/app/components/Layout/Navigation/IconSidebar.tsx b/apps/carbon/app/components/Layout/Navigation/IconSidebar.tsx
index 67a151ce30..e802a13038 100644
--- a/apps/carbon/app/components/Layout/Navigation/IconSidebar.tsx
+++ b/apps/carbon/app/components/Layout/Navigation/IconSidebar.tsx
@@ -65,14 +65,10 @@ const IconSidebar = () => {
</Button>
{links.map((link) => {
const m = getModule(link.to);
+
const moduleMatches = matchedModules.has(m);
- const anotherModuleMatches = links.some((l) => {
- const m = getModule(l.to);
- return matchedModules.has(m);
- });
- const isActive =
- currentModule === m || (moduleMatches && !anotherModuleMatches);
+ const isActive = currentModule === m || moduleMatches;
return (
<NavigationIconLink
key={link.name}
diff --git a/apps/carbon/app/modules/sales/sales.models.ts b/apps/carbon/app/modules/sales/sales.models.ts
index ee42ab37de..a4aabf0bcf 100644
--- a/apps/carbon/app/modules/sales/sales.models.ts
+++ b/apps/carbon/app/modules/sales/sales.models.ts
@@ -309,7 +309,6 @@ export const salesRfqValidator = z.object({
customerContactId: zfd.text(z.string().optional()),
customerId: z.string().min(36, { message: "Customer is required" }),
customerReference: zfd.text(z.string().optional()),
- employeeId: z.string().min(36, { message: "Quoter is required" }),
expirationDate: zfd.text(z.string().optional()),
externalNotes: zfd.text(z.string().optional()),
internalNotes: zfd.text(z.string().optional()),
diff --git a/apps/carbon/app/modules/sales/sales.service.ts b/apps/carbon/app/modules/sales/sales.service.ts
index 352b622743..ba7d3fbe6f 100644
--- a/apps/carbon/app/modules/sales/sales.service.ts
+++ b/apps/carbon/app/modules/sales/sales.service.ts
@@ -363,6 +363,24 @@ export async function getCustomerTypesList(
.order("name");
}
+export async function getModelUploadsByRfqId(
+ client: SupabaseClient<Database>,
+ rfqId: string
+) {
+ const lines = await client
+ .from("salesRfqLine")
+ .select("id")
+ .eq("salesRfqId", rfqId);
+ if (lines.error) {
+ return lines;
+ }
+ const lineIds = lines.data?.map((line) => line.id);
+ return client
+ .from("modelUpload")
+ .select("*")
+ .in("salesRfqLineId", lineIds ?? []);
+}
+
export async function getQuote(
client: SupabaseClient<Database>,
quoteId: string
@@ -663,6 +681,13 @@ export async function getSalesOrderLine(
.single();
}
+export async function getSalesRFQ(
+ client: SupabaseClient<Database>,
+ id: string
+) {
+ return client.from("salesRfqs").select("*").eq("id", id).single();
+}
+
export async function getSalesRFQs(
client: SupabaseClient<Database>,
companyId: string,
diff --git a/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQForm.tsx b/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQForm.tsx
index fea2e36041..66a1d9cdb5 100644
--- a/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQForm.tsx
+++ b/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQForm.tsx
@@ -16,7 +16,6 @@ import {
Customer,
CustomerContact,
DatePicker,
- Employee,
Hidden,
Input,
Location,
@@ -56,8 +55,8 @@ const SalesRFQForm = ({ initialValues }: SalesRFQFormProps) => {
<CardTitle>{isEditing ? "RFQ" : "New RFQ"}</CardTitle>
{!isEditing && (
<CardDescription>
- A sales request for quote (RFQ) is an inquiry for pricing on a set
- of parts and quantities.
+ A sales request for quote (RFQ) is a customer inquiry for pricing
+ on a set of parts and quantities. It may result in a quote.
</CardDescription>
)}
</CardHeader>
@@ -94,7 +93,6 @@ const SalesRFQForm = ({ initialValues }: SalesRFQFormProps) => {
label="Customer Contact"
customer={customer}
/>
- <Employee name="employeeId" label="Quoter" />
<DatePicker
name="rfqDate"
diff --git a/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx b/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx
new file mode 100644
index 0000000000..827ad5f3bf
--- /dev/null
+++ b/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx
@@ -0,0 +1,31 @@
+import { Badge, HStack, Heading, VStack } from "@carbon/react";
+
+import { useParams } from "@remix-run/react";
+import { RiProgress2Line } from "react-icons/ri";
+import { useRouteData } from "~/hooks";
+import type { SalesRFQ } from "~/modules/sales";
+import { path } from "~/utils/path";
+
+const SalesRFQHeader = () => {
+ const { rfqId } = useParams();
+ if (!rfqId) throw new Error("rfqId not found");
+
+ const routeData = useRouteData<{ rfqSummary: SalesRFQ }>(
+ path.to.salesRfq(rfqId)
+ );
+
+ return (
+ <div className="flex flex-shrink-0 items-center justify-between px-4 py-2 bg-card border-b border-border">
+ <VStack spacing={0} className="flex-grow">
+ <HStack>
+ <Heading size="h2">{routeData?.rfqSummary?.rfqId}</Heading>
+ <Badge variant="secondary">
+ <RiProgress2Line />
+ </Badge>
+ </HStack>
+ </VStack>
+ </div>
+ );
+};
+
+export default SalesRFQHeader;
diff --git a/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQProperties.tsx b/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQProperties.tsx
new file mode 100644
index 0000000000..777b0ebcd6
--- /dev/null
+++ b/apps/carbon/app/modules/sales/ui/SalesRFQ/SalesRFQProperties.tsx
@@ -0,0 +1,172 @@
+import {
+ Button,
+ Enumerable,
+ HStack,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+ VStack,
+} from "@carbon/react";
+import { getLocalTimeZone, parseDate } from "@internationalized/date";
+import { useParams } from "@remix-run/react";
+import { LuCopy, LuLink } from "react-icons/lu";
+import { CustomerAvatar, useOptimisticAssignment } from "~/components";
+import Assignee from "~/components/Assignee";
+import { useRouteData } from "~/hooks";
+import type { ModelUpload } from "~/modules/items";
+import type { ListItem } from "~/types";
+import { path } from "~/utils/path";
+import type { SalesRFQ } from "../../types";
+import SalesRFQStatus from "./SalesRFQStatus";
+
+const formatter = new Intl.DateTimeFormat("en-US", {
+ dateStyle: "full",
+ timeZone: getLocalTimeZone(),
+});
+
+const SalesRFQProperties = () => {
+ const { rfqId } = useParams();
+ if (!rfqId) throw new Error("rfqId not found");
+
+ const sharedData = useRouteData<{ locations: ListItem[] }>(
+ path.to.salesRfqRoot
+ );
+ const routeData = useRouteData<{
+ rfqSummary: SalesRFQ;
+ modelUploads?: ModelUpload[];
+ }>(path.to.salesRfq(rfqId));
+
+ const locations = sharedData?.locations ?? [];
+
+ const optimisticAssignment = useOptimisticAssignment({
+ id: rfqId,
+ table: "salesRfq",
+ });
+ const assignee =
+ optimisticAssignment !== undefined
+ ? optimisticAssignment
+ : routeData?.rfqSummary?.assignee;
+
+ return (
+ <VStack
+ spacing={4}
+ className="w-96 bg-card h-full overflow-y-auto border-l border-border px-4 py-2"
+ >
+ <VStack spacing={2}>
+ <HStack className="w-full justify-between">
+ <h3 className="text-xs text-muted-foreground">Properties</h3>
+ <HStack spacing={1}>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ aria-label="Link"
+ size="sm"
+ className="p-1"
+ onClick={() =>
+ navigator.clipboard.writeText(
+ window.location.origin + path.to.salesRfq(rfqId)
+ )
+ }
+ >
+ <LuLink className="w-3 h-3" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <span>Copy link to RFQ</span>
+ </TooltipContent>
+ </Tooltip>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ aria-label="Copy"
+ size="sm"
+ className="p-1"
+ onClick={() =>
+ navigator.clipboard.writeText(
+ routeData?.rfqSummary?.rfqId ?? ""
+ )
+ }
+ >
+ <LuCopy className="w-3 h-3" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <span>Copy RFQ number</span>
+ </TooltipContent>
+ </Tooltip>
+ </HStack>
+ </HStack>
+ <span className="text-sm">{routeData?.rfqSummary?.rfqId}</span>
+ </VStack>
+
+ <VStack spacing={2}>
+ <h3 className="text-xs text-muted-foreground">Assignee</h3>
+ <Assignee id={rfqId} table="salesRfq" value={assignee ?? ""} />
+ </VStack>
+
+ <VStack spacing={2}>
+ <h3 className="text-xs text-muted-foreground">Status</h3>
+ <SalesRFQStatus status={routeData?.rfqSummary?.status} />
+ </VStack>
+
+ <VStack spacing={2}>
+ <h3 className="text-xs text-muted-foreground">Customer</h3>
+ <CustomerAvatar
+ customerId={routeData?.rfqSummary?.customerId ?? null}
+ />
+ </VStack>
+
+ {routeData?.rfqSummary?.rfqDate && (
+ <VStack spacing={2}>
+ <h3 className="text-xs text-muted-foreground">RFQ Date</h3>
+ <span className="text-sm">
+ {formatter.format(
+ parseDate(routeData.rfqSummary.rfqDate).toDate(getLocalTimeZone())
+ )}
+ </span>
+ </VStack>
+ )}
+
+ {routeData?.rfqSummary?.expirationDate && (
+ <VStack spacing={2}>
+ <h3 className="text-xs text-muted-foreground">Expiration Date</h3>
+ <span className="text-sm">
+ {formatter.format(
+ parseDate(routeData.rfqSummary.expirationDate).toDate(
+ getLocalTimeZone()
+ )
+ )}
+ </span>
+ </VStack>
+ )}
+
+ {routeData?.rfqSummary?.locationId && (
+ <VStack spacing={2}>
+ <h3 className="text-xs text-muted-foreground">Location</h3>
+ <Enumerable
+ value={
+ locations.find(
+ (location) => location.id === routeData?.rfqSummary?.locationId
+ )?.name ?? null
+ }
+ />
+ </VStack>
+ )}
+
+ {routeData?.rfqSummary?.customerReference && (
+ <VStack spacing={2}>
+ <h3 className="text-xs text-muted-foreground">
+ Customer Order Number
+ </h3>
+ <span className="text-sm">
+ {routeData.rfqSummary.customerReference}
+ </span>
+ </VStack>
+ )}
+ </VStack>
+ );
+};
+
+export default SalesRFQProperties;
diff --git a/apps/carbon/app/modules/sales/ui/SalesRFQ/index.ts b/apps/carbon/app/modules/sales/ui/SalesRFQ/index.ts
index a249161709..f374d0e84c 100644
--- a/apps/carbon/app/modules/sales/ui/SalesRFQ/index.ts
+++ b/apps/carbon/app/modules/sales/ui/SalesRFQ/index.ts
@@ -1,4 +1,6 @@
import SalesRFQForm from "./SalesRFQForm";
+import SalesRFQHeader from "./SalesRFQHeader";
+import SalesRFQProperties from "./SalesRFQProperties";
import SalesRFQStatus from "./SalesRFQStatus";
-export { SalesRFQForm, SalesRFQStatus };
+export { SalesRFQForm, SalesRFQHeader, SalesRFQProperties, SalesRFQStatus };
diff --git a/apps/carbon/app/modules/sales/ui/SalesRFQs/SalesRFQsTable.tsx b/apps/carbon/app/modules/sales/ui/SalesRFQs/SalesRFQsTable.tsx
index 7f4968ff79..a2069184d6 100644
--- a/apps/carbon/app/modules/sales/ui/SalesRFQs/SalesRFQsTable.tsx
+++ b/apps/carbon/app/modules/sales/ui/SalesRFQs/SalesRFQsTable.tsx
@@ -106,6 +106,24 @@ const SalesRFQsTable = memo(({ data, count }: SalesRFQsTableProps) => {
</HStack>
),
},
+ {
+ accessorKey: "status",
+ header: "Status",
+ cell: (item) => {
+ const status = item.getValue<(typeof salesRFQStatusType)[number]>();
+ return <SalesRFQStatus status={status} />;
+ },
+ meta: {
+ filter: {
+ type: "static",
+ options: salesRFQStatusType.map((status) => ({
+ value: status,
+ label: <SalesRFQStatus status={status} />,
+ })),
+ },
+ pluralHeader: "Statuses",
+ },
+ },
{
id: "customerId",
header: "Customer",
@@ -138,28 +156,10 @@ const SalesRFQsTable = memo(({ data, count }: SalesRFQsTableProps) => {
cell: (item) => item.getValue(),
},
{
- accessorKey: "status",
- header: "Status",
- cell: (item) => {
- const status = item.getValue<(typeof salesRFQStatusType)[number]>();
- return <SalesRFQStatus status={status} />;
- },
- meta: {
- filter: {
- type: "static",
- options: salesRFQStatusType.map((status) => ({
- value: status,
- label: <SalesRFQStatus status={status} />,
- })),
- },
- pluralHeader: "Statuses",
- },
- },
- {
- id: "employeeId",
- header: "Quoter",
+ id: "assignee",
+ header: "Assignee",
cell: ({ row }) => (
- <EmployeeAvatar employeeId={row.original.employeeId} />
+ <EmployeeAvatar employeeId={row.original.assignee} />
),
meta: {
filter: {
@@ -172,10 +172,10 @@ const SalesRFQsTable = memo(({ data, count }: SalesRFQsTableProps) => {
},
},
{
- id: "assignee",
- header: "Assignee",
+ id: "createdBy",
+ header: "Created By",
cell: ({ row }) => (
- <EmployeeAvatar employeeId={row.original.assignee} />
+ <EmployeeAvatar employeeId={row.original.employeeId} />
),
meta: {
filter: {
@@ -187,7 +187,6 @@ const SalesRFQsTable = memo(({ data, count }: SalesRFQsTableProps) => {
},
},
},
-
{
accessorKey: "locationName",
header: "Location",
@@ -204,23 +203,6 @@ const SalesRFQsTable = memo(({ data, count }: SalesRFQsTableProps) => {
},
},
},
-
- {
- 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",
@@ -285,7 +267,6 @@ const SalesRFQsTable = memo(({ data, count }: SalesRFQsTableProps) => {
}}
defaultColumnVisibility={{
createdAt: false,
- createdBy: false,
updatedAt: false,
updatedBy: false,
}}
diff --git a/apps/carbon/app/routes/x+/consumable+/$itemId.tsx b/apps/carbon/app/routes/x+/consumable+/$itemId.tsx
index d6ae7e6f0d..1b0c649603 100644
--- a/apps/carbon/app/routes/x+/consumable+/$itemId.tsx
+++ b/apps/carbon/app/routes/x+/consumable+/$itemId.tsx
@@ -19,7 +19,7 @@ import { error } from "~/utils/result";
export const handle: Handle = {
breadcrumb: "Consumables",
to: path.to.consumables,
- module: "parts",
+ module: "items",
};
export async function loader({ request, params }: LoaderFunctionArgs) {
diff --git a/apps/carbon/app/routes/x+/consumable+/_layout.tsx b/apps/carbon/app/routes/x+/consumable+/_layout.tsx
index fb26e3596e..aee29e5ff7 100644
--- a/apps/carbon/app/routes/x+/consumable+/_layout.tsx
+++ b/apps/carbon/app/routes/x+/consumable+/_layout.tsx
@@ -13,7 +13,7 @@ export const meta: MetaFunction = () => {
export const handle: Handle = {
breadcrumb: "Items",
to: path.to.items,
- module: "parts",
+ module: "items",
};
export async function loader({ request }: LoaderFunctionArgs) {
diff --git a/apps/carbon/app/routes/x+/fixture+/_layout.tsx b/apps/carbon/app/routes/x+/fixture+/_layout.tsx
index 64d7b84c60..b23cfcc150 100644
--- a/apps/carbon/app/routes/x+/fixture+/_layout.tsx
+++ b/apps/carbon/app/routes/x+/fixture+/_layout.tsx
@@ -13,7 +13,7 @@ export const meta: MetaFunction = () => {
export const handle: Handle = {
breadcrumb: "Items",
to: path.to.items,
- module: "parts",
+ module: "items",
};
export async function loader({ request }: LoaderFunctionArgs) {
diff --git a/apps/carbon/app/routes/x+/items+/_layout.tsx b/apps/carbon/app/routes/x+/items+/_layout.tsx
index 24bcfefa24..65067c8396 100644
--- a/apps/carbon/app/routes/x+/items+/_layout.tsx
+++ b/apps/carbon/app/routes/x+/items+/_layout.tsx
@@ -13,7 +13,7 @@ export const meta: MetaFunction = () => {
export const handle: Handle = {
breadcrumb: "Items",
to: path.to.parts,
- module: "parts",
+ module: "items",
};
export default function PartsRoute() {
diff --git a/apps/carbon/app/routes/x+/material+/$itemId.tsx b/apps/carbon/app/routes/x+/material+/$itemId.tsx
index 43f2e43f8d..11ddfb2cfd 100644
--- a/apps/carbon/app/routes/x+/material+/$itemId.tsx
+++ b/apps/carbon/app/routes/x+/material+/$itemId.tsx
@@ -19,7 +19,7 @@ import { error } from "~/utils/result";
export const handle: Handle = {
breadcrumb: "Materials",
to: path.to.materials,
- module: "parts",
+ module: "items",
};
export async function loader({ request, params }: LoaderFunctionArgs) {
diff --git a/apps/carbon/app/routes/x+/material+/_layout.tsx b/apps/carbon/app/routes/x+/material+/_layout.tsx
index 457f4dafec..fa908bd372 100644
--- a/apps/carbon/app/routes/x+/material+/_layout.tsx
+++ b/apps/carbon/app/routes/x+/material+/_layout.tsx
@@ -17,7 +17,7 @@ export const meta: MetaFunction = () => {
export const handle: Handle = {
breadcrumb: "Items",
to: path.to.items,
- module: "parts",
+ module: "items",
};
export async function loader({ request }: LoaderFunctionArgs) {
diff --git a/apps/carbon/app/routes/x+/part+/$itemId.tsx b/apps/carbon/app/routes/x+/part+/$itemId.tsx
index d1c03017ed..79f2d15d5e 100644
--- a/apps/carbon/app/routes/x+/part+/$itemId.tsx
+++ b/apps/carbon/app/routes/x+/part+/$itemId.tsx
@@ -19,7 +19,7 @@ import { error } from "~/utils/result";
export const handle: Handle = {
breadcrumb: "Parts",
to: path.to.parts,
- module: "parts",
+ module: "items",
};
export async function loader({ request, params }: LoaderFunctionArgs) {
diff --git a/apps/carbon/app/routes/x+/part+/_layout.tsx b/apps/carbon/app/routes/x+/part+/_layout.tsx
index db5d566ffe..1310b18f07 100644
--- a/apps/carbon/app/routes/x+/part+/_layout.tsx
+++ b/apps/carbon/app/routes/x+/part+/_layout.tsx
@@ -13,7 +13,7 @@ export const meta: MetaFunction = () => {
export const handle: Handle = {
breadcrumb: "Items",
to: path.to.items,
- module: "parts",
+ module: "items",
};
export async function loader({ request }: LoaderFunctionArgs) {
diff --git a/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.tsx b/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.tsx
new file mode 100644
index 0000000000..84a101c7cb
--- /dev/null
+++ b/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.tsx
@@ -0,0 +1,62 @@
+import type { LoaderFunctionArgs } from "@remix-run/node";
+import { json, redirect } from "@remix-run/node";
+import { Outlet } from "@remix-run/react";
+import {
+ SalesRFQHeader,
+ SalesRFQProperties,
+ getModelUploadsByRfqId,
+ getSalesRFQ,
+} from "~/modules/sales";
+import { requirePermissions } from "~/services/auth/auth.server";
+import { flash } from "~/services/session.server";
+import type { Handle } from "~/utils/handle";
+import { path } from "~/utils/path";
+import { error } from "~/utils/result";
+
+export const handle: Handle = {
+ breadcrumb: "RFQs",
+ to: path.to.salesRfqs,
+};
+
+export async function loader({ request, params }: LoaderFunctionArgs) {
+ const { client } = await requirePermissions(request, {
+ view: "sales",
+ });
+
+ const { rfqId } = params;
+ if (!rfqId) throw new Error("Could not find rfqId");
+
+ const [rfqSummary, modelUpload] = await Promise.all([
+ getSalesRFQ(client, rfqId),
+ getModelUploadsByRfqId(client, rfqId),
+ ]);
+
+ if (rfqSummary.error) {
+ throw redirect(
+ path.to.sales,
+ await flash(
+ request,
+ error(rfqSummary.error, "Failed to load part summary")
+ )
+ );
+ }
+
+ return json({
+ rfqSummary: rfqSummary.data,
+ modelUploads: modelUpload.data,
+ });
+}
+
+export default function SalesRFQRoute() {
+ return (
+ <div className="flex flex-col h-[calc(100vh-49px)] w-full">
+ <SalesRFQHeader />
+ <div className="flex h-[calc(100vh-99px)] w-full">
+ <div className="flex h-full w-full overflow-y-auto">
+ <Outlet />
+ </div>
+ <SalesRFQProperties />
+ </div>
+ </div>
+ );
+}
diff --git a/apps/carbon/app/routes/x+/sales-rfq+/_layout.tsx b/apps/carbon/app/routes/x+/sales-rfq+/_layout.tsx
new file mode 100644
index 0000000000..0ae1eeac42
--- /dev/null
+++ b/apps/carbon/app/routes/x+/sales-rfq+/_layout.tsx
@@ -0,0 +1,37 @@
+import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node";
+import { Outlet } from "@remix-run/react";
+import { getUnitOfMeasuresList } from "~/modules/items";
+import { getLocationsList } from "~/modules/resources";
+import { requirePermissions } from "~/services/auth/auth.server";
+import type { Handle } from "~/utils/handle";
+import { path } from "~/utils/path";
+
+export const meta: MetaFunction = () => {
+ return [{ title: "Carbon | Part" }];
+};
+
+export const handle: Handle = {
+ breadcrumb: "Sales",
+ to: path.to.sales,
+ module: "sales",
+};
+
+export async function loader({ request }: LoaderFunctionArgs) {
+ const { client, companyId } = await requirePermissions(request, {
+ view: "sales",
+ });
+
+ const [unitOfMeasures, locations] = await Promise.all([
+ getUnitOfMeasuresList(client, companyId),
+ getLocationsList(client, companyId),
+ ]);
+
+ return {
+ locations: locations?.data ?? [],
+ unitOfMeasures: unitOfMeasures?.data ?? [],
+ };
+}
+
+export default function SalesRFQRoute() {
+ return <Outlet />;
+}
diff --git a/apps/carbon/app/routes/x+/sales-rfq+/new.tsx b/apps/carbon/app/routes/x+/sales-rfq+/new.tsx
index 41b7c623bc..a14dc0410f 100644
--- a/apps/carbon/app/routes/x+/sales-rfq+/new.tsx
+++ b/apps/carbon/app/routes/x+/sales-rfq+/new.tsx
@@ -64,15 +64,14 @@ export async function action({ request }: ActionFunctionArgs) {
}
export default function SalesRFQNewRoute() {
- const { id, defaults } = useUser();
+ const { defaults } = useUser();
const [params] = useUrlParams();
const customerId = params.get("customerId");
const initialValues = {
customerContactId: "",
customerId: customerId ?? "",
customerReference: "",
- employeeId: id,
- expirateDate: "",
+ expirationDate: "",
id: undefined,
locationId: defaults?.locationId ?? "",
rfqDate: today(getLocalTimeZone()).toString(),
diff --git a/apps/carbon/app/routes/x+/service+/_layout.tsx b/apps/carbon/app/routes/x+/service+/_layout.tsx
index e9d99ea9c3..75f1f6f91d 100644
--- a/apps/carbon/app/routes/x+/service+/_layout.tsx
+++ b/apps/carbon/app/routes/x+/service+/_layout.tsx
@@ -13,7 +13,7 @@ export const meta: MetaFunction = () => {
export const handle: Handle = {
breadcrumb: "Items",
to: path.to.items,
- module: "parts",
+ module: "items",
};
export async function loader({ request }: LoaderFunctionArgs) {
diff --git a/apps/carbon/app/routes/x+/tool+/$itemId.tsx b/apps/carbon/app/routes/x+/tool+/$itemId.tsx
index 24765a1787..7723cace62 100644
--- a/apps/carbon/app/routes/x+/tool+/$itemId.tsx
+++ b/apps/carbon/app/routes/x+/tool+/$itemId.tsx
@@ -19,7 +19,7 @@ import { error } from "~/utils/result";
export const handle: Handle = {
breadcrumb: "Tools",
to: path.to.tools,
- module: "parts",
+ module: "items",
};
export async function loader({ request, params }: LoaderFunctionArgs) {
diff --git a/apps/carbon/app/routes/x+/tool+/_layout.tsx b/apps/carbon/app/routes/x+/tool+/_layout.tsx
index 51a220e0cd..a8059b982a 100644
--- a/apps/carbon/app/routes/x+/tool+/_layout.tsx
+++ b/apps/carbon/app/routes/x+/tool+/_layout.tsx
@@ -13,7 +13,7 @@ export const meta: MetaFunction = () => {
export const handle: Handle = {
breadcrumb: "Items",
to: path.to.items,
- module: "parts",
+ module: "items",
};
export async function loader({ request }: LoaderFunctionArgs) {
diff --git a/apps/carbon/app/utils/path.ts b/apps/carbon/app/utils/path.ts
index b3f6736e26..4dc97eb174 100644
--- a/apps/carbon/app/utils/path.ts
+++ b/apps/carbon/app/utils/path.ts
@@ -620,6 +620,7 @@ export const path = {
salesOrderRelease: (id: string) =>
generatePath(`${x}/sales-order/${id}/release`),
salesOrders: `${x}/sales/orders`,
+ salesRfqRoot: `${x}/sales-rfq`,
salesRfq: (id: string) => generatePath(`${x}/sales-rfq/${id}`),
salesRfqDetails: (id: string) => generatePath(`${x}/sales-rfq/${id}`),
salesRfqFavorite: `${x}/sales/rfqs/favorite`,
diff --git a/packages/database/supabase/migrations/20240704105128_rfq.sql b/packages/database/supabase/migrations/20240704105128_rfq.sql
index 9629273df5..b98a62b150 100644
--- a/packages/database/supabase/migrations/20240704105128_rfq.sql
+++ b/packages/database/supabase/migrations/20240704105128_rfq.sql
@@ -63,6 +63,7 @@ CREATE INDEX "salesRfqLine_salesRfqId_idx" ON "salesRfqLine" ("salesRfqId");
CREATE INDEX "salesRfqLine_partNumber_idx" ON "salesRfqLine" ("partNumber", "companyId");
ALTER TABLE "modelUpload" ADD COLUMN "salesRfqLineId" TEXT;
+ALTER TABLE "modelUpload" ADD CONSTRAINT "modelUpload_salesRfqLineId_fkey" FOREIGN KEY ("salesRfqLineId") REFERENCES "salesRfqLine" ("id") ON DELETE SET NULL;
CREATE TABLE "salesRfqFavorite" (
"rfqId" TEXT NOT NULL,