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
[FEAT] Adding RFQs to Purchasing module
Gaurav Bhattb582b6fe621a
diff --git a/apps/erp/app/components/CadModel.tsx b/apps/erp/app/components/CadModel.tsxindex ed44776d18..e5f83a7959 100644--- a/apps/erp/app/components/CadModel.tsx+++ b/apps/erp/app/components/CadModel.tsx@@ -29,6 +29,7 @@ type CadModelProps = {metadata?: {itemId?: string;salesRfqLineId?: string;+ purchasingRfqLineId?: string;quoteLineId?: string;salesOrderLineId?: string;jobId?: string;diff --git a/apps/erp/app/modules/purchasing/purchasing.models.ts b/apps/erp/app/modules/purchasing/purchasing.models.tsindex 836a9a0fe3..d92ff00b19 100644--- a/apps/erp/app/modules/purchasing/purchasing.models.ts+++ b/apps/erp/app/modules/purchasing/purchasing.models.ts@@ -382,3 +382,46 @@ export const supplierQuoteLineValidator = z.object({zfd.numeric(z.number().min(0.00001, { message: "Quantity is required" })))});++export const purchasingRfqStatusType = [+ "Draft",+ "Ready for request",+ "Requested",+ "Closed"+] as const;++export const purchasingRfqValidator = z.object({+ id: zfd.text(z.string().optional()),+ rfqId: zfd.text(z.string().optional()),+ rfqDate: z.string().min(1, { message: "RFQ Date is required" }),+ expirationDate: zfd.text(z.string().optional()),+ locationId: zfd.text(z.string().optional()),+ employeeId: zfd.text(z.string().optional()),+ status: z.enum(purchasingRfqStatusType).optional(),+ supplierIds: z+ .array(z.string())+ .min(1, { message: "At least one supplier is required" })+});++export const purchasingRfqLineValidator = z.object({+ id: zfd.text(z.string().optional()),+ purchasingRfqId: z.string().min(1, { message: "RFQ is required" }),+ partNumber: zfd.text(z.string().optional()),+ partRevision: zfd.text(z.string().optional()),+ itemId: zfd.text(z.string().optional()),+ description: zfd.text(z.string().optional()),+ quantity: z.array(+ zfd.numeric(z.number().min(0.00001, { message: "Quantity is required" }))+ ),+ unitOfMeasureCode: z+ .string()+ .min(1, { message: "Unit of measure is required" }),+ order: zfd.numeric(z.number().min(0))+});++export const purchasingRfqSuppliersValidator = z.object({+ purchasingRfqId: z.string().min(1, { message: "RFQ is required" }),+ supplierIds: z+ .array(z.string())+ .min(1, { message: "At least one supplier is required" })+});diff --git a/apps/erp/app/modules/purchasing/purchasing.service.ts b/apps/erp/app/modules/purchasing/purchasing.service.tsindex 5ed7c630d0..2c4ec0e1d6 100644--- a/apps/erp/app/modules/purchasing/purchasing.service.ts+++ b/apps/erp/app/modules/purchasing/purchasing.service.ts@@ -1672,3 +1672,356 @@ export async function upsertSupplierType(.eq("id", supplierType.id);}}++// ============================================================+// PURCHASING RFQ FUNCTIONS+// ============================================================++export async function deletePurchasingRFQ(+ client: SupabaseClient<Database>,+ purchasingRfqId: string+) {+ return client.from("purchasingRfq").delete().eq("id", purchasingRfqId);+}++export async function deletePurchasingRFQLine(+ client: SupabaseClient<Database>,+ purchasingRfqLineId: string+) {+ return client+ .from("purchasingRfqLine")+ .delete()+ .eq("id", purchasingRfqLineId);+}++export async function getPurchasingRFQ(+ client: SupabaseClient<Database>,+ id: string+) {+ return client.from("purchasingRfqs").select("*").eq("id", id).single();+}++export async function getPurchasingRFQs(+ client: SupabaseClient<Database>,+ companyId: string,+ args: GenericQueryFilters & {+ search: string | null;+ }+) {+ let query = client+ .from("purchasingRfqs")+ .select("*", { count: "exact" })+ .eq("companyId", companyId);++ if (args.search) {+ query = query.ilike("rfqId", `%${args.search}%`);+ }++ query = setGenericQueryFilters(query, args, [+ { column: "rfqId", ascending: false }+ ]);+ return query;+}++export async function getPurchasingRFQLine(+ client: SupabaseClient<Database>,+ lineId: string+) {+ return client+ .from("purchasingRfqLines")+ .select("*")+ .eq("id", lineId)+ .single();+}++export async function getPurchasingRFQLines(+ client: SupabaseClient<Database>,+ purchasingRfqId: string+) {+ return client+ .from("purchasingRfqLines")+ .select("*")+ .eq("purchasingRfqId", purchasingRfqId)+ .order("order", { ascending: true });+}++export async function getPurchasingRFQSuppliers(+ client: SupabaseClient<Database>,+ purchasingRfqId: string+) {+ return client+ .from("purchasingRfqSupplier")+ .select("*, supplier:supplierId(id, name)")+ .eq("purchasingRfqId", purchasingRfqId);+}++export async function upsertPurchasingRFQ(+ client: SupabaseClient<Database>,+ purchasingRfq: {+ id?: string;+ rfqId: string;+ rfqDate: string;+ expirationDate?: string;+ locationId?: string;+ employeeId?: string;+ status?: string;+ companyId: string;+ createdBy?: string;+ updatedBy?: string;+ customFields?: Json;+ }+) {+ if (purchasingRfq.id) {+ return client+ .from("purchasingRfq")+ .update(sanitize(purchasingRfq))+ .eq("id", purchasingRfq.id)+ .select("id")+ .single();+ }+ return client+ .from("purchasingRfq")+ .insert([purchasingRfq])+ .select("id")+ .single();+}++export async function upsertPurchasingRFQLine(+ client: SupabaseClient<Database>,+ purchasingRfqLine: {+ id?: string;+ purchasingRfqId: string;+ partNumber?: string;+ partRevision?: string;+ itemId?: string;+ description?: string;+ quantity: number[];+ unitOfMeasureCode: string;+ order: number;+ companyId: string;+ createdBy?: string;+ updatedBy?: string;+ customFields?: Json;+ }+) {+ if (purchasingRfqLine.id) {+ return client+ .from("purchasingRfqLine")+ .update(sanitize(purchasingRfqLine))+ .eq("id", purchasingRfqLine.id)+ .select("id")+ .single();+ }+ return client+ .from("purchasingRfqLine")+ .insert([purchasingRfqLine])+ .select("id")+ .single();+}++export async function upsertPurchasingRFQSuppliers(+ client: SupabaseClient<Database>,+ purchasingRfqId: string,+ supplierIds: string[],+ companyId: string,+ createdBy: string+) {+ // Delete existing suppliers for this RFQ+ await client+ .from("purchasingRfqSupplier")+ .delete()+ .eq("purchasingRfqId", purchasingRfqId);++ // Insert new suppliers+ if (supplierIds.length === 0) {+ return { data: [], error: null };+ }++ const suppliersToInsert = supplierIds.map((supplierId) => ({+ purchasingRfqId,+ supplierId,+ companyId,+ createdBy+ }));++ return client+ .from("purchasingRfqSupplier")+ .insert(suppliersToInsert)+ .select("id");+}++export async function updatePurchasingRFQStatus(+ client: SupabaseClient<Database>,+ args: {+ id: string;+ status: string;+ assignee?: string | null;+ updatedBy: string;+ }+) {+ return client+ .from("purchasingRfq")+ .update({+ status: args.status,+ assignee: args.assignee,+ updatedBy: args.updatedBy,+ updatedAt: new Date().toISOString()+ })+ .eq("id", args.id)+ .select("id")+ .single();+}++export async function getPurchasingRFQLineDocuments(+ client: SupabaseClient<Database>,+ companyId: string,+ lineId: string,+ itemId?: string | null+) {+ const basePath = `${companyId}/purchasing-rfq/${lineId}`;++ const { data, error } = await client.storage.from("private").list(basePath);++ if (error) {+ return [];+ }++ return data ?? [];+}++export async function getLinkedSupplierQuotes(+ client: SupabaseClient<Database>,+ purchasingRfqId: string+) {+ return client+ .from("purchasingRfqToSupplierQuote")+ .select(+ `+ supplierQuoteId,+ supplierQuote:supplierQuoteId (+ id,+ supplierQuoteId,+ revisionId,+ status,+ supplierId,+ supplier:supplierId (name)+ )+ `+ )+ .eq("purchasingRfqId", purchasingRfqId);+}++export async function getLinkedPurchasingRfqs(+ client: SupabaseClient<Database>,+ supplierQuoteId: string+) {+ return client+ .from("purchasingRfqToSupplierQuote")+ .select(+ `+ purchasingRfqId,+ purchasingRfq:purchasingRfqId (+ id,+ rfqId,+ status+ )+ `+ )+ .eq("supplierQuoteId", supplierQuoteId);+}++export async function getLinkedPurchasingRfqsForInteraction(+ client: SupabaseClient<Database>,+ supplierInteractionId: string+) {+ // First get all supplier quote IDs in this interaction+ const { data: quotes, error: quotesError } = await client+ .from("supplierQuote")+ .select("id")+ .eq("supplierInteractionId", supplierInteractionId);++ if (quotesError || !quotes || quotes.length === 0) {+ return { data: [], error: quotesError };+ }++ const quoteIds = quotes.map((q) => q.id);++ // Then get all purchasing RFQs linked to any of these quotes+ return client+ .from("purchasingRfqToSupplierQuote")+ .select(+ `+ purchasingRfqId,+ purchasingRfq:purchasingRfqId (+ id,+ rfqId,+ status+ )+ `+ )+ .in("supplierQuoteId", quoteIds);+}++export async function getSupplierQuotesForComparison(+ client: SupabaseClient<Database>,+ purchasingRfqId: string+) {+ // 1. Get all supplier quote IDs linked to this RFQ with supplier info+ const { data: links, error: linksError } = await client+ .from("purchasingRfqToSupplierQuote")+ .select(+ `+ supplierQuoteId,+ supplierQuote:supplierQuoteId (+ id,+ supplierQuoteId,+ revisionId,+ status,+ supplierId,+ currencyCode,+ exchangeRate,+ supplier:supplierId (name)+ )+ `+ )+ .eq("purchasingRfqId", purchasingRfqId);++ if (linksError || !links?.length) {+ return { data: { quotes: [], lines: [], prices: [] }, error: linksError };+ }++ // Extract quotes and filter for Active status only+ const allQuotes = links+ .map((l) => l.supplierQuote)+ .filter(+ (q): q is NonNullable<typeof q> => q !== null && q.status === "Active"+ );++ if (allQuotes.length === 0) {+ return { data: { quotes: [], lines: [], prices: [] }, error: null };+ }++ const activeQuoteIds = allQuotes+ .map((q) => q.id)+ .filter((id): id is string => !!id);++ // 2. Fetch lines and pricing for all active quotes+ const lines = await client+ .from("supplierQuoteLines")+ .select("*")+ .in("supplierQuoteId", activeQuoteIds);++ const prices = await client+ .from("supplierQuoteLinePrice")+ .select("*")+ .in("supplierQuoteId", activeQuoteIds);++ return {+ data: {+ quotes: allQuotes,+ lines: lines.data ?? [],+ prices: prices.data ?? []+ },+ error: lines.error || prices.error+ };+}diff --git a/apps/erp/app/modules/purchasing/types.ts b/apps/erp/app/modules/purchasing/types.tsindex 811cc5c242..a5c3443ca0 100644--- a/apps/erp/app/modules/purchasing/types.ts+++ b/apps/erp/app/modules/purchasing/types.ts@@ -5,6 +5,9 @@ import type {getPurchaseOrderLines,getPurchaseOrders,getPurchasingPlanning,+ getPurchasingRFQLines,+ getPurchasingRFQSuppliers,+ getPurchasingRFQs,getSupplier,getSupplierContacts,getSupplierInteraction,@@ -48,6 +51,21 @@ export type PurchasingPlanningItem = NonNullable<Awaited<ReturnType<typeof getPurchasingPlanning>>["data"]>[number];+export type PurchasingRFQ = NonNullable<+ Awaited<ReturnType<typeof getPurchasingRFQs>>["data"]+>[number];++export type PurchasingRFQLine = NonNullable<+ Awaited<ReturnType<typeof getPurchasingRFQLines>>["data"]+>[number];++export type PurchasingRFQSupplier = NonNullable<+ Awaited<ReturnType<typeof getPurchasingRFQSuppliers>>["data"]+>[number];++export type PurchasingRFQStatusType =+ Database["public"]["Enums"]["purchasingRfqStatus"];+export type Supplier = NonNullable<Awaited<ReturnType<typeof getSuppliers>>["data"]>[number];diff --git a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/DeletePurchasingRFQLine.tsx b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/DeletePurchasingRFQLine.tsxnew file mode 100644index 0000000000..1578320371--- /dev/null+++ b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/DeletePurchasingRFQLine.tsx@@ -0,0 +1,26 @@+import { useParams } from "react-router";+import { ConfirmDelete } from "~/components/Modals";+import { path } from "~/utils/path";+import type { PurchasingRFQLine } from "../../types";++export default function DeletePurchasingRFQLine({+ line,+ onCancel+}: {+ line: PurchasingRFQLine;+ onCancel: () => void;+}) {+ const { rfqId } = useParams();+ if (!rfqId) throw new Error("id not found");+ if (!line.id) return null;++ return (+ <ConfirmDelete+ action={path.to.deletePurchasingRfqLine(rfqId, line.id)}+ name={line.description ?? "this line"}+ text={`Are you sure you want to delete the line: ${line.description}? This cannot be undone.`}+ onCancel={onCancel}+ onSubmit={onCancel}+ />+ );+}diff --git a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQExplorer.tsx b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQExplorer.tsxnew file mode 100644index 0000000000..ca3131593d--- /dev/null+++ b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQExplorer.tsx@@ -0,0 +1,226 @@+import {+ Button,+ cn,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuIcon,+ DropdownMenuItem,+ DropdownMenuTrigger,+ HStack,+ IconButton,+ Kbd,+ Tooltip,+ TooltipContent,+ TooltipTrigger,+ useDisclosure,+ useKeyboardShortcuts,+ VStack+} from "@carbon/react";+import { prettifyKeyboardShortcut } from "@carbon/utils";+import { useRef, useState } from "react";+import { LuCirclePlus, LuEllipsisVertical, LuTrash } from "react-icons/lu";+import { Link, useParams } from "react-router";+import { Empty, ItemThumbnail } from "~/components";+import { usePermissions, useRouteData } from "~/hooks";+import type { MethodItemType } from "~/modules/shared";+import { path } from "~/utils/path";+import type { PurchasingRFQ, PurchasingRFQLine } from "../../types";+import DeletePurchasingRFQLine from "./DeletePurchasingRFQLine";+import PurchasingRFQLineForm from "./PurchasingRFQLineForm";++export default function PurchasingRFQExplorer() {+ const { rfqId } = useParams();+ if (!rfqId) throw new Error("Could not find rfqId");+ const purchasingRfqData = useRouteData<{+ rfqSummary: PurchasingRFQ;+ lines: PurchasingRFQLine[];+ }>(path.to.purchasingRfq(rfqId));+ const permissions = usePermissions();++ const newPurchasingRFQLineDisclosure = useDisclosure();+ const deleteLineDisclosure = useDisclosure();+ const [deleteLine, setDeleteLine] = useState<PurchasingRFQLine | null>(null);++ const onDeleteLine = (line: PurchasingRFQLine) => {+ setDeleteLine(line);+ deleteLineDisclosure.onOpen();+ };++ const onDeleteCancel = () => {+ setDeleteLine(null);+ deleteLineDisclosure.onClose();+ };++ const newButtonRef = useRef<HTMLButtonElement>(null);+ useKeyboardShortcuts({+ "Command+Shift+l": (event: KeyboardEvent) => {+ event.stopPropagation();+ newButtonRef.current?.click();+ }+ });++ const purchasingRfqLineInitialValues = {+ purchasingRfqId: rfqId,+ partNumber: "",+ partRevision: "",+ description: "",+ itemId: "",+ quantity: [1],+ order: 1,+ unitOfMeasureCode: "EA"+ };++ const isDisabled = ["Requested", "Closed"].includes(+ purchasingRfqData?.rfqSummary.status ?? ""+ );++ const lines = purchasingRfqData?.lines ?? [];++ return (+ <div data-purchasing-rfq-explorer>+ <VStack className="w-full h-[calc(100dvh-99px)] justify-between">+ <VStack+ className="flex-1 overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent"+ spacing={0}+ >+ {lines.length > 0 ? (+ lines.map((line) => (+ <PurchasingRFQLineItem+ key={line.id}+ line={line}+ isDisabled={isDisabled}+ onDelete={onDeleteLine}+ />+ ))+ ) : (+ <Empty>+ {permissions.can("update", "purchasing") && (+ <Button+ leftIcon={<LuCirclePlus />}+ isDisabled={isDisabled}+ variant="secondary"+ onClick={newPurchasingRFQLineDisclosure.onOpen}+ >+ Add Line Item+ </Button>+ )}+ </Empty>+ )}+ </VStack>+ <div className="w-full flex flex-0 sm:flex-row border-t border-border p-4 sm:justify-start sm:space-x-2">+ <Tooltip>+ <TooltipTrigger className="w-full">+ <Button+ ref={newButtonRef}+ className="w-full"+ isDisabled={+ isDisabled || !permissions.can("update", "purchasing")+ }+ leftIcon={<LuCirclePlus />}+ variant="secondary"+ onClick={newPurchasingRFQLineDisclosure.onOpen}+ >+ Add Line Item+ </Button>+ </TooltipTrigger>+ <TooltipContent>+ <HStack>+ <span>New Line Item</span>+ <Kbd>{prettifyKeyboardShortcut("Command+Shift+l")}</Kbd>+ </HStack>+ </TooltipContent>+ </Tooltip>+ </div>+ </VStack>+ {newPurchasingRFQLineDisclosure.isOpen && (+ <PurchasingRFQLineForm+ initialValues={purchasingRfqLineInitialValues}+ type="modal"+ onClose={newPurchasingRFQLineDisclosure.onClose}+ />+ )}+ {deleteLineDisclosure.isOpen && (+ <DeletePurchasingRFQLine line={deleteLine!} onCancel={onDeleteCancel} />+ )}+ </div>+ );+}++type PurchasingRFQLineItemProps = {+ line: PurchasingRFQLine;+ isDisabled: boolean;+ onDelete: (line: PurchasingRFQLine) => void;+};++function PurchasingRFQLineItem({+ line,+ isDisabled,+ onDelete+}: PurchasingRFQLineItemProps) {+ const { rfqId, lineId } = useParams();+ if (!rfqId) throw new Error("Could not find rfqId");+ const permissions = usePermissions();++ const isSelected = lineId === line.id;++ return (+ <VStack spacing={0} className="border-b">+ <Link+ className="w-full"+ prefetch="intent"+ to={path.to.purchasingRfqLine(rfqId, line.id!)}+ >+ <HStack+ className={cn(+ "group w-full p-2 items-center hover:bg-accent/30 cursor-pointer relative",+ isSelected && "bg-accent/60 hover:bg-accent/50 shadow-inner"+ )}+ >+ <HStack spacing={2} className="flex-grow min-w-0 pr-10">+ <ItemThumbnail+ thumbnailPath={line.thumbnailPath}+ type={line.itemType as MethodItemType}+ />++ <VStack spacing={0} className="min-w-0">+ <span className="font-semibold line-clamp-1">+ {line.itemReadableId || line.description || "Item"}+ </span>+ <span className="font-medium text-muted-foreground text-xs line-clamp-1">+ {line.description}+ </span>+ </VStack>+ </HStack>+ <div className="absolute right-2">+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <IconButton+ aria-label="More"+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100"+ icon={<LuEllipsisVertical />}+ variant="solid"+ onClick={(e) => e.stopPropagation()}+ />+ </DropdownMenuTrigger>+ <DropdownMenuContent>+ <DropdownMenuItem+ destructive+ disabled={+ isDisabled || !permissions.can("update", "purchasing")+ }+ onClick={(e) => {+ e.stopPropagation();+ onDelete(line);+ }}+ >+ <DropdownMenuIcon icon={<LuTrash />} />+ Delete Line+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </div>+ </HStack>+ </Link>+ </VStack>+ );+}diff --git a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQForm.tsx b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQForm.tsxnew file mode 100644index 0000000000..d1565207d6--- /dev/null+++ b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQForm.tsx@@ -0,0 +1,99 @@+import { ValidatedForm } from "@carbon/form";+import {+ Card,+ CardContent,+ CardDescription,+ CardFooter,+ CardHeader,+ CardTitle,+ cn,+ VStack+} from "@carbon/react";+import type { z } from "zod";+import {+ CustomFormFields,+ DatePicker,+ Employee,+ Hidden,+ Location,+ SequenceOrCustomId,+ Submit,+ Suppliers+} from "~/components/Form";+import { usePermissions } from "~/hooks";+import { purchasingRfqValidator } from "../../purchasing.models";++type PurchasingRFQFormValues = z.infer<typeof purchasingRfqValidator>;++type PurchasingRFQFormProps = {+ initialValues: PurchasingRFQFormValues;+};++const PurchasingRFQForm = ({ initialValues }: PurchasingRFQFormProps) => {+ const permissions = usePermissions();+ const isEditing = initialValues.id !== undefined;+ const isDraft = ["Draft"].includes(initialValues.status ?? "");++ return (+ <Card>+ <ValidatedForm+ method="post"+ validator={purchasingRfqValidator}+ defaultValues={initialValues}+ >+ <CardHeader>+ <CardTitle>+ {isEditing ? "Purchasing RFQ" : "New Purchasing RFQ"}+ </CardTitle>+ {!isEditing && (+ <CardDescription>+ A purchasing request for quote (RFQ) is sent to suppliers to+ request pricing on a set of items and quantities.+ </CardDescription>+ )}+ </CardHeader>+ <CardContent>+ {isEditing && <Hidden name="rfqId" />}+ <VStack>+ <div+ className={cn(+ "grid w-full gap-x-8 gap-y-4",+ isEditing+ ? "grid-cols-1 lg:grid-cols-3"+ : "grid-cols-1 md:grid-cols-2"+ )}+ >+ {!isEditing && (+ <SequenceOrCustomId+ name="rfqId"+ label="RFQ ID"+ table="purchasingRfq"+ />+ )}+ <Suppliers name="supplierIds" label="Suppliers" />+ <DatePicker name="rfqDate" label="RFQ Date" />+ <DatePicker name="expirationDate" label="Due Date" />+ <Location name="locationId" label="Receiving Location" />+ <Employee name="employeeId" label="Buyer" isOptional />+ <CustomFormFields table="purchasingRfq" />+ </div>+ </VStack>+ </CardContent>+ <CardFooter>+ <Submit+ isDisabled={+ !isDraft ||+ (isEditing+ ? !permissions.can("update", "purchasing")+ : !permissions.can("create", "purchasing"))+ }+ >+ Save+ </Submit>+ </CardFooter>+ </ValidatedForm>+ </Card>+ );+};++export default PurchasingRFQForm;diff --git a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQHeader.tsx b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQHeader.tsxnew file mode 100644index 0000000000..81f019a87d--- /dev/null+++ b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQHeader.tsx@@ -0,0 +1,470 @@+import { useCarbon } from "@carbon/auth";+import { Select, Submit, ValidatedForm } from "@carbon/form";+import {+ Alert,+ AlertDescription,+ AlertTitle,+ Button,+ Copy,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuIcon,+ DropdownMenuItem,+ DropdownMenuTrigger,+ Heading,+ HStack,+ IconButton,+ Modal,+ ModalBody,+ ModalContent,+ ModalDescription,+ ModalFooter,+ ModalHeader,+ ModalTitle,+ useDisclosure,+ useMount,+ VStack+} from "@carbon/react";+import { useEffect, useState } from "react";+import {+ LuCircleCheck,+ LuCircleX,+ LuEllipsisVertical,+ LuGitCompare,+ LuLoaderCircle,+ LuPanelLeft,+ LuPanelRight,+ LuTrash,+ LuTriangleAlert+} from "react-icons/lu";+import { RiProgress4Line } from "react-icons/ri";+import type { FetcherWithComponents } from "react-router";+import { Link, useFetcher, useParams } from "react-router";+import { z } from "zod";+import { zfd } from "zod-form-data";+import { usePanels } from "~/components/Layout";+import ConfirmDelete from "~/components/Modals/ConfirmDelete";+import { usePermissions, useRouteData, useUser } from "~/hooks";+import { path } from "~/utils/path";+import type { PurchasingRFQ, PurchasingRFQLine } from "../../types";+import { SupplierQuoteCompareDrawer } from "../SupplierQuote";+import PurchasingRFQStatus from "./PurchasingRFQStatus";++const PurchasingRFQHeader = () => {+ const { rfqId } = useParams();+ if (!rfqId) throw new Error("rfqId not found");++ const convertToSupplierQuotesModal = useDisclosure();+ const requiresSuppliersAlert = useDisclosure();+ const noQuoteReasonModal = useDisclosure();+ const deleteRFQModal = useDisclosure();+ const compareQuotesModal = useDisclosure();+ const { toggleExplorer, toggleProperties } = usePanels();++ const permissions = usePermissions();++ const routeData = useRouteData<{+ rfqSummary: PurchasingRFQ;+ lines: PurchasingRFQLine[];+ suppliers: {+ id: string;+ supplierId: string;+ supplier: { id: string; name: string };+ }[];+ linkedQuotes: unknown[];+ }>(path.to.purchasingRfq(rfqId));++ const status = routeData?.rfqSummary?.status ?? "Draft";++ const statusFetcher = useFetcher<{}>();++ const hasSuppliers = (routeData?.suppliers?.length ?? 0) > 0;+ const hasLinkedQuotes = (routeData?.linkedQuotes?.length ?? 0) > 0;++ return (+ <div className="flex flex-shrink-0 items-center justify-between p-2 bg-card border-b h-[50px] overflow-x-auto scrollbar-hide ">+ <HStack className="w-full justify-between">+ <HStack>+ <IconButton+ aria-label="Toggle Explorer"+ icon={<LuPanelLeft />}+ onClick={toggleExplorer}+ variant="ghost"+ />+ <Link to={path.to.purchasingRfqDetails(rfqId)}>+ <Heading size="h4" className="flex items-center gap-2">+ <span>{routeData?.rfqSummary?.rfqId}</span>+ </Heading>+ </Link>+ <Copy text={routeData?.rfqSummary?.rfqId ?? ""} />+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <IconButton+ aria-label="More options"+ icon={<LuEllipsisVertical />}+ variant="secondary"+ size="sm"+ />+ </DropdownMenuTrigger>+ <DropdownMenuContent>+ <DropdownMenuItem+ disabled={+ !permissions.can("delete", "purchasing") ||+ !permissions.is("employee")+ }+ destructive+ onClick={deleteRFQModal.onOpen}+ >+ <DropdownMenuIcon icon={<LuTrash />} />+ Delete RFQ+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ <PurchasingRFQStatus status={routeData?.rfqSummary?.status} />+ </HStack>+ <HStack>+ {hasSuppliers ? (+ <statusFetcher.Form+ method="post"+ action={path.to.purchasingRfqStatus(rfqId)}+ >+ <input type="hidden" name="status" value="Ready for request" />+ <Button+ isDisabled={+ status !== "Draft" ||+ routeData?.lines?.length === 0 ||+ !permissions.can("update", "purchasing")+ }+ isLoading={+ statusFetcher.state !== "idle" &&+ statusFetcher.formData?.get("status") === "Ready for request"+ }+ leftIcon={<LuCircleCheck />}+ variant={status === "Draft" ? "primary" : "secondary"}+ type="submit"+ >+ Ready to Send+ </Button>+ </statusFetcher.Form>+ ) : (+ <Button+ isDisabled={+ status !== "Draft" ||+ routeData?.lines?.length === 0 ||+ !permissions.can("update", "purchasing")+ }+ leftIcon={<LuCircleCheck />}+ variant={status === "Draft" ? "primary" : "secondary"}+ onClick={requiresSuppliersAlert.onOpen}+ >+ Ready to Send+ </Button>+ )}++ <Button+ isDisabled={+ status !== "Ready for request" ||+ routeData?.lines?.length === 0 ||+ !hasSuppliers ||+ !permissions.can("create", "purchasing")+ }+ leftIcon={<RiProgress4Line />}+ type="submit"+ variant={+ ["Ready for request", "Requested"].includes(status)+ ? "primary"+ : "secondary"+ }+ onClick={convertToSupplierQuotesModal.onOpen}+ >+ Create Supplier Quotes+ </Button>++ <Button+ onClick={noQuoteReasonModal.onOpen}+ isDisabled={+ status !== "Ready for request" ||+ statusFetcher.state !== "idle" ||+ !permissions.can("update", "purchasing")+ }+ isLoading={+ statusFetcher.state !== "idle" &&+ statusFetcher.formData?.get("status") === "Closed"+ }+ leftIcon={<LuCircleX />}+ variant={+ ["Ready for request", "Closed"].includes(status)+ ? "destructive"+ : "secondary"+ }+ >+ No Quote+ </Button>++ {hasLinkedQuotes && (+ <Button+ onClick={compareQuotesModal.onOpen}+ leftIcon={<LuGitCompare />}+ variant="secondary"+ >+ Compare Quotes+ </Button>+ )}++ <statusFetcher.Form+ method="post"+ action={path.to.purchasingRfqStatus(rfqId)}+ >+ <input type="hidden" name="status" value="Draft" />+ <Button+ isDisabled={+ !["Ready for request", "Requested", "Closed"].includes(+ status+ ) ||+ statusFetcher.state !== "idle" ||+ !permissions.can("update", "purchasing")+ }+ isLoading={+ statusFetcher.state !== "idle" &&+ statusFetcher.formData?.get("status") === "Draft"+ }+ leftIcon={<LuLoaderCircle />}+ type="submit"+ variant="secondary"+ >+ Reopen+ </Button>+ </statusFetcher.Form>++ <IconButton+ aria-label="Toggle Properties"+ icon={<LuPanelRight />}+ onClick={toggleProperties}+ variant="ghost"+ />+ </HStack>+ </HStack>+ {convertToSupplierQuotesModal.isOpen && (+ <ConvertToSupplierQuotesModal+ lines={routeData?.lines ?? []}+ suppliers={routeData?.suppliers ?? []}+ rfqId={rfqId}+ onClose={convertToSupplierQuotesModal.onClose}+ />+ )}+ {requiresSuppliersAlert.isOpen && (+ <RequiresSuppliersAlert onClose={requiresSuppliersAlert.onClose} />+ )}+ {noQuoteReasonModal.isOpen && (+ <NoQuoteReasonModal+ fetcher={statusFetcher}+ rfqId={rfqId}+ onClose={noQuoteReasonModal.onClose}+ />+ )}+ {deleteRFQModal.isOpen && (+ <ConfirmDelete+ action={path.to.deletePurchasingRfq(rfqId)}+ isOpen={deleteRFQModal.isOpen}+ name={routeData?.rfqSummary?.rfqId!}+ text={`Are you sure you want to delete ${routeData?.rfqSummary+ ?.rfqId!}? This cannot be undone.`}+ onCancel={() => {+ deleteRFQModal.onClose();+ }}+ onSubmit={() => {+ deleteRFQModal.onClose();+ }}+ />+ )}+ {compareQuotesModal.isOpen && (+ <SupplierQuoteCompareDrawer+ isOpen={compareQuotesModal.isOpen}+ onClose={compareQuotesModal.onClose}+ purchasingRfqId={rfqId}+ />+ )}+ </div>+ );+};++export default PurchasingRFQHeader;++const rfqNoQuoteReasonValidator = z.object({+ status: z.enum(["Closed"]),+ noQuoteReasonId: zfd.text(z.string().optional())+});++function NoQuoteReasonModal({+ fetcher,+ rfqId,+ onClose+}: {+ fetcher: FetcherWithComponents<{}>;+ rfqId: string;+ onClose: () => void;+}) {+ const user = useUser();+ const [noQuoteReasons, setNoQuoteReasons] = useState<+ {+ label: string;+ value: string;+ }[]+ >([]);+ const { carbon } = useCarbon();+ const fetchReasons = async () => {+ if (!carbon) return;+ const { data } = await carbon+ .from("noQuoteReason")+ .select("*")+ .eq("companyId", user.company.id);++ setNoQuoteReasons(+ data?.map((reason) => ({ label: reason.name, value: reason.id })) ?? []+ );+ };++ useMount(() => {+ fetchReasons();+ });++ return (+ <Modal open onOpenChange={(open) => !open && onClose()}>+ <ModalContent>+ <ValidatedForm+ method="post"+ action={path.to.purchasingRfqStatus(rfqId)}+ validator={rfqNoQuoteReasonValidator}+ fetcher={fetcher}+ onSubmit={() => {+ onClose();+ }}+ >+ <ModalHeader>+ <ModalTitle>No Quote Reason</ModalTitle>+ <ModalDescription>+ Select a reason for why the quote was not created.+ </ModalDescription>+ </ModalHeader>+ <ModalBody>+ <input type="hidden" name="status" value="Closed" />+ <VStack spacing={2}>+ <Select+ name="noQuoteReasonId"+ label="No Quote Reason"+ options={noQuoteReasons}+ />+ </VStack>+ </ModalBody>+ <ModalFooter>+ <Button variant="secondary" onClick={onClose}>+ Cancel+ </Button>+ <Submit withBlocker={false}>Save</Submit>+ </ModalFooter>+ </ValidatedForm>+ </ModalContent>+ </Modal>+ );+}++function RequiresSuppliersAlert({ onClose }: { onClose: () => void }) {+ return (+ <Modal open onOpenChange={(open) => !open && onClose()}>+ <ModalContent>+ <ModalHeader>+ <ModalTitle>Cannot send RFQ</ModalTitle>+ </ModalHeader>+ <ModalBody>+ <Alert variant="destructive">+ <LuTriangleAlert className="h-4 w-4" />+ <AlertTitle>RFQ has no suppliers</AlertTitle>+ <AlertDescription>+ In order to send this RFQ to suppliers, you must first add+ suppliers to the RFQ.+ </AlertDescription>+ </Alert>+ </ModalBody>+ <ModalFooter>+ <Button onClick={onClose}>OK</Button>+ </ModalFooter>+ </ModalContent>+ </Modal>+ );+}++function ConvertToSupplierQuotesModal({+ lines,+ suppliers,+ rfqId,+ onClose+}: {+ lines: PurchasingRFQLine[];+ suppliers: {+ id: string;+ supplierId: string;+ supplier: { id: string; name: string };+ }[];+ rfqId: string;+ onClose: () => void;+}) {+ const fetcher = useFetcher<{ error: string | null }>();+ const isLoading = fetcher.state !== "idle";++ useEffect(() => {+ if (fetcher.state === "loading") {+ onClose();+ }+ }, [fetcher.state, onClose]);++ return (+ <Modal+ open+ onOpenChange={(open) => {+ if (!open) {+ onClose();+ }+ }}+ >+ <ModalContent>+ <ModalHeader>+ <ModalTitle>Create Supplier Quotes</ModalTitle>+ <ModalDescription>+ This will create supplier quotes for all suppliers in this RFQ.+ </ModalDescription>+ </ModalHeader>++ <ModalBody>+ <Alert variant="default">+ <AlertTitle>+ Creating {suppliers.length} Supplier Quote(s)+ </AlertTitle>+ <AlertDescription>+ Supplier quotes will be created for the following suppliers:+ <ul className="list-disc py-2 pl-4">+ {suppliers.map((s) => (+ <li key={s.id}>{s.supplier?.name}</li>+ ))}+ </ul>+ Each quote will include {lines.length} line item(s) from this RFQ.+ </AlertDescription>+ </Alert>+ </ModalBody>++ <ModalFooter>+ <Button variant="secondary" onClick={onClose}>+ Cancel+ </Button>+ <fetcher.Form+ method="post"+ action={path.to.purchasingRfqConvert(rfqId)}+ >+ <Button isDisabled={isLoading} type="submit" isLoading={isLoading}>+ Create Supplier Quotes+ </Button>+ </fetcher.Form>+ </ModalFooter>+ </ModalContent>+ </Modal>+ );+}diff --git a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQLineDocuments.tsx b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQLineDocuments.tsxnew file mode 100644index 0000000000..7e57110c03--- /dev/null+++ b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQLineDocuments.tsx@@ -0,0 +1,313 @@+import { useCarbon } from "@carbon/auth";+import {+ Card,+ CardAction,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+ File,+ HStack,+ IconButton,+ Table,+ Tbody,+ Td,+ Th,+ Thead,+ Tr,+ toast+} from "@carbon/react";+import { convertKbToString } from "@carbon/utils";+import type { FileObject } from "@supabase/storage-js";+import type { ChangeEvent } from "react";+import { useCallback } from "react";+import { LuEllipsisVertical, LuUpload } from "react-icons/lu";+import { useRevalidator } from "react-router";+import { DocumentPreview, FileDropzone } from "~/components";+import DocumentIcon from "~/components/DocumentIcon";+import { usePermissions, useUser } from "~/hooks";+import { getDocumentType } from "~/modules/shared";+import { path } from "~/utils/path";+import { stripSpecialCharacters } from "~/utils/string";++const usePurchasingRFQLineDocuments = ({+ id,+ lineId,+ itemId+}: {+ id: string;+ lineId: string;+ itemId?: string | null;+}) => {+ const permissions = usePermissions();+ const revalidator = useRevalidator();+ const { carbon } = useCarbon();+ const { company } = useUser();++ const canDelete = permissions.can("delete", "purchasing");+ const canUpdate = permissions.can("update", "purchasing");++ const getPath = useCallback(+ (file: { name: string }) => {+ return `${company.id}/purchasing-rfq/${lineId}/${stripSpecialCharacters(+ file.name+ )}`;+ },+ [company.id, lineId]+ );++ const deleteFile = useCallback(+ async (file: FileObject) => {+ const fileDelete = await carbon?.storage+ .from("private")+ .remove([getPath(file)]);++ if (!fileDelete || fileDelete.error) {+ toast.error(fileDelete?.error?.message || "Error deleting file");+ return;+ }++ toast.success(`${file.name} deleted successfully`);+ revalidator.revalidate();+ },+ [getPath, carbon?.storage, revalidator]+ );++ const download = useCallback(+ async (file: FileObject) => {+ const url = path.to.file.previewFile(`private/${getPath(file)}`);+ try {+ const response = await fetch(url);+ const blob = await response.blob();+ const blobUrl = window.URL.createObjectURL(blob);+ const a = document.createElement("a");+ document.body.appendChild(a);+ a.href = blobUrl;+ a.download = file.name;+ a.click();+ window.URL.revokeObjectURL(blobUrl);+ document.body.removeChild(a);+ } catch (error) {+ toast.error("Error downloading file");+ console.error(error);+ }+ },+ [getPath]+ );++ const upload = useCallback(+ async (files: File[]) => {+ if (!carbon) {+ toast.error("Carbon client not available");+ return;+ }++ for (const file of files) {+ const fileName = getPath(file);++ const fileUpload = await carbon.storage+ .from("private")+ .upload(fileName, file, {+ cacheControl: `${12 * 60 * 60}`,+ upsert: true+ });++ if (fileUpload.error) {+ toast.error(`Failed to upload file: ${file.name}`);+ }+ }+ revalidator.revalidate();+ },+ [getPath, carbon, revalidator]+ );++ return {+ canDelete,+ canUpdate,+ deleteFile,+ download,+ getPath,+ upload+ };+};++type PurchasingRFQLineDocumentsProps = {+ files: FileObject[];+ id: string;+ lineId: string;+ itemId?: string | null;+ type: string;+};++const PurchasingRFQLineDocuments = ({+ files,+ id,+ lineId,+ itemId,+ type+}: PurchasingRFQLineDocumentsProps) => {+ const { canDelete, download, deleteFile, getPath, upload } =+ usePurchasingRFQLineDocuments({+ id,+ lineId,+ itemId+ });++ const onDrop = useCallback(+ (acceptedFiles: File[]) => {+ upload(acceptedFiles);+ },+ [upload]+ );++ return (+ <>+ <Card className="flex-grow">+ <HStack className="justify-between items-start">+ <CardHeader>+ <CardTitle>Files</CardTitle>+ <CardDescription>RFQ line documents</CardDescription>+ </CardHeader>+ <CardAction>+ <PurchasingRFQLineDocumentForm+ id={id}+ lineId={lineId}+ itemId={itemId}+ />+ </CardAction>+ </HStack>+ <CardContent>+ <Table>+ <Thead>+ <Tr>+ <Th>Name</Th>+ <Th>Size</Th>+ <Th />+ </Tr>+ </Thead>+ <Tbody>+ {files.map((file) => {+ const docType = getDocumentType(file.name);+ return (+ <Tr key={file.id}>+ <Td>+ <HStack>+ <DocumentIcon type={docType} />+ <span+ className="font-medium cursor-pointer"+ onClick={() => {+ if (["PDF", "Image"].includes(docType)) {+ window.open(+ path.to.file.previewFile(+ `private/${getPath(file)}`+ ),+ "_blank"+ );+ } else {+ download(file);+ }+ }}+ >+ {["PDF", "Image"].includes(docType) ? (+ <DocumentPreview+ bucket="private"+ pathToFile={getPath(file)}+ type={docType as "PDF" | "Image"}+ >+ {file.name}+ </DocumentPreview>+ ) : (+ file.name+ )}+ </span>+ </HStack>+ </Td>+ <Td>+ {convertKbToString(+ Math.floor((file.metadata?.size ?? 0) / 1024)+ )}+ </Td>+ <Td>+ <div className="flex justify-end w-full">+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <IconButton+ aria-label="More"+ icon={<LuEllipsisVertical />}+ variant="secondary"+ />+ </DropdownMenuTrigger>+ <DropdownMenuContent>+ <DropdownMenuItem onClick={() => download(file)}>+ Download+ </DropdownMenuItem>+ <DropdownMenuItem+ destructive+ disabled={!canDelete}+ onClick={() => deleteFile(file)}+ >+ Delete+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </div>+ </Td>+ </Tr>+ );+ })}+ {files.length === 0 && (+ <Tr>+ <Td+ colSpan={3}+ className="py-8 text-muted-foreground text-center"+ >+ No files+ </Td>+ </Tr>+ )}+ </Tbody>+ </Table>+ <FileDropzone onDrop={onDrop} />+ </CardContent>+ </Card>+ </>+ );+};++export default PurchasingRFQLineDocuments;++type PurchasingRFQLineDocumentFormProps = {+ id: string;+ lineId: string;+ itemId?: string | null;+};++const PurchasingRFQLineDocumentForm = ({+ id,+ lineId,+ itemId+}: PurchasingRFQLineDocumentFormProps) => {+ const permissions = usePermissions();+ const { upload } = usePurchasingRFQLineDocuments({ id, lineId, itemId });++ const uploadFiles = async (e: ChangeEvent<HTMLInputElement>) => {+ if (e.target.files) {+ upload(Array.from(e.target.files));+ }+ };++ return (+ <File+ isDisabled={!permissions.can("update", "purchasing")}+ leftIcon={<LuUpload />}+ onChange={uploadFiles}+ multiple+ >+ New+ </File>+ );+};diff --git a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQLineForm.tsx b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQLineForm.tsxnew file mode 100644index 0000000000..4cb0951634--- /dev/null+++ b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQLineForm.tsx@@ -0,0 +1,280 @@+import { useCarbon } from "@carbon/auth";+import { ValidatedForm } from "@carbon/form";+import {+ Badge,+ CardAction,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuIcon,+ DropdownMenuItem,+ DropdownMenuTrigger,+ HStack,+ IconButton,+ ModalCard,+ ModalCardBody,+ ModalCardContent,+ ModalCardDescription,+ ModalCardFooter,+ ModalCardHeader,+ ModalCardProvider,+ ModalCardTitle,+ toast,+ useDisclosure,+ VStack+} from "@carbon/react";+import { useState } from "react";+import { BsThreeDotsVertical } from "react-icons/bs";+import { LuTrash } from "react-icons/lu";+import { useParams } from "react-router";+import type { z } from "zod";+import {+ ArrayNumeric,+ CustomFormFields,+ Hidden,+ InputControlled,+ Item,+ Submit,+ UnitOfMeasure+} from "~/components/Form";+import { usePermissions, useRouteData, useUser } from "~/hooks";+import { path } from "~/utils/path";+import { purchasingRfqLineValidator } from "../../purchasing.models";+import type { PurchasingRFQ, PurchasingRFQLine } from "../../types";+import DeletePurchasingRFQLine from "./DeletePurchasingRFQLine";++type PurchasingRFQLineFormProps = {+ initialValues: z.infer<typeof purchasingRfqLineValidator>;+ type?: "card" | "modal";+ onClose?: () => void;+};++const PurchasingRFQLineForm = ({+ initialValues,+ type,+ onClose+}: PurchasingRFQLineFormProps) => {+ const permissions = usePermissions();+ const { company } = useUser();+ const { carbon } = useCarbon();++ const { rfqId } = useParams();++ if (!rfqId) throw new Error("rfqId not found");++ const routeData = useRouteData<{+ rfqSummary: PurchasingRFQ;+ }>(path.to.purchasingRfq(rfqId));++ const isEditable = ["Draft"].includes(routeData?.rfqSummary?.status ?? "");++ const isEditing = initialValues.id !== undefined;++ const [itemData, setItemData] = useState<{+ partNumber: string;+ partRevision: string;+ itemId: string;+ description: string;+ unitOfMeasureCode: string;+ }>({+ partNumber: initialValues.partNumber ?? "",+ partRevision: initialValues.partRevision ?? "",+ itemId: initialValues.itemId ?? "",+ description: initialValues.description ?? "",+ unitOfMeasureCode: initialValues.unitOfMeasureCode ?? "EA"+ });++ const onItemChange = async (itemId: string) => {+ if (!carbon) return;++ const item = await carbon+ .from("item")+ .select("name, unitOfMeasureCode")+ .eq("id", itemId)+ .eq("companyId", company.id)+ .single();++ if (item.error) {+ toast.error("Failed to load item details");+ return;+ }++ const newItemData = {+ ...itemData,+ itemId,+ description: item.data?.name ?? "",+ unitOfMeasureCode: item.data?.unitOfMeasureCode ?? "EA"+ };++ setItemData(newItemData);+ };++ const deleteDisclosure = useDisclosure();++ return (+ <>+ <ModalCardProvider type={type}>+ <ModalCard+ onClose={onClose}+ isCollapsible={isEditing}+ defaultCollapsed={false}+ >+ <ModalCardContent>+ <ValidatedForm+ defaultValues={initialValues}+ validator={purchasingRfqLineValidator}+ method="post"+ action={+ isEditing+ ? path.to.purchasingRfqLine(rfqId, initialValues.id!)+ : path.to.newPurchasingRFQLine(rfqId)+ }+ className="w-full"+ onSubmit={() => {+ if (type === "modal") onClose?.();+ }}+ >+ <HStack className="w-full justify-between items-start">+ <ModalCardHeader>+ <ModalCardTitle>+ {isEditing+ ? `${itemData?.partNumber}${+ itemData?.partRevision+ ? `.${itemData?.partRevision}`+ : ""+ }`+ : "New RFQ Line"}+ </ModalCardTitle>+ <ModalCardDescription>+ {isEditing ? (+ <div className="flex flex-col items-start gap-1">+ <span>{itemData?.description}</span>+ <div className="flex items-center gap-2">+ <Badge variant="outline">+ {initialValues?.quantity?.join(", ")}+ </Badge>+ </div>+ </div>+ ) : (+ "An RFQ line contains part and quantity information about the requested item"+ )}+ </ModalCardDescription>+ </ModalCardHeader>+ {isEditing && permissions.can("update", "purchasing") && (+ <CardAction className="pr-12">+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <IconButton+ icon={<BsThreeDotsVertical />}+ aria-label="More"+ variant="ghost"+ />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem+ disabled={!isEditable}+ onClick={deleteDisclosure.onOpen}+ >+ <DropdownMenuIcon icon={<LuTrash />} />+ Delete Line+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </CardAction>+ )}+ </HStack>+ <ModalCardBody>+ <Hidden name="id" />+ <Hidden name="purchasingRfqId" />+ <Hidden name="order" />+ <VStack>+ <div className="grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-3">+ <div className="col-span-2 grid w-full gap-x-8 gap-y-4 grid-cols-1 lg:grid-cols-2 auto-rows-min">+ <InputControlled+ name="partNumber"+ label="Part Number"+ value={itemData.partNumber}+ onChange={(newValue) => {+ setItemData((d) => ({+ ...d,+ partNumber: newValue+ }));+ }}+ autoFocus+ />+ <InputControlled+ name="partRevision"+ label="Part Revision"+ value={itemData.partRevision}+ onChange={(newValue) => {+ setItemData((d) => ({+ ...d,+ partRevision: newValue+ }));+ }}+ />+ <Item+ name="itemId"+ label="Part"+ type="Part"+ value={itemData.itemId}+ includeInactive+ onChange={(value) => {+ onItemChange(value?.value as string);+ }}+ />+ <InputControlled+ name="description"+ label="Description"+ value={itemData.description}+ isReadOnly={!!itemData.itemId}+ />+ <UnitOfMeasure+ name="unitOfMeasureCode"+ value={itemData.unitOfMeasureCode}+ onChange={(newValue) =>+ setItemData((d) => ({+ ...d,+ unitOfMeasureCode: newValue?.value ?? "EA"+ }))+ }+ />++ <CustomFormFields table="purchasingRfqLine" />+ </div>+ <div className="flex gap-y-4">+ <ArrayNumeric+ name="quantity"+ label="Quantity"+ defaults={[1, 25, 50, 100]}+ />+ </div>+ </div>+ </VStack>+ </ModalCardBody>+ <ModalCardFooter>+ <Submit+ isDisabled={+ !isEditable ||+ (isEditing+ ? !permissions.can("update", "purchasing")+ : !permissions.can("create", "purchasing"))+ }+ >+ Save+ </Submit>+ </ModalCardFooter>+ </ValidatedForm>+ </ModalCardContent>+ </ModalCard>+ </ModalCardProvider>+ {isEditing && deleteDisclosure.isOpen && (+ <DeletePurchasingRFQLine+ line={initialValues as PurchasingRFQLine}+ onCancel={deleteDisclosure.onClose}+ />+ )}+ </>+ );+};++export default PurchasingRFQLineForm;diff --git a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQLineNotes.tsx b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQLineNotes.tsxnew file mode 100644index 0000000000..f5e0c10627--- /dev/null+++ b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQLineNotes.tsx@@ -0,0 +1,173 @@+import { useCarbon } from "@carbon/auth";+import type { JSONContent } from "@carbon/react";+import {+ Card,+ CardAction,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,+ generateHTML,+ HStack,+ Tabs,+ TabsContent,+ TabsList,+ TabsTrigger,+ toast,+ useDebounce+} from "@carbon/react";+import { Editor } from "@carbon/react/Editor";+import { getLocalTimeZone, today } from "@internationalized/date";+import { nanoid } from "nanoid";+import { useState } from "react";+import { usePermissions, useUser } from "~/hooks";+import { getPrivateUrl } from "~/utils/path";++const PurchasingRFQLineNotes = ({+ id,+ table,+ title,+ subTitle,+ internalNotes: initialInternalNotes,+ externalNotes: initialExternalNotes+}: {+ id: string | null;+ table: "purchasingRfqLine";+ title: string;+ subTitle: string;+ internalNotes?: JSONContent;+ externalNotes?: JSONContent;+}) => {+ const {+ id: userId,+ company: { id: companyId }+ } = useUser();+ const { carbon } = useCarbon();+ const permissions = usePermissions();+ const isEmployee = permissions.is("employee");+ const [tab, setTab] = useState(isEmployee ? "internal" : "external");+ const [internalNotes, setInternalNotes] = useState(+ initialInternalNotes ?? {}+ );+ const [externalNotes, setExternalNotes] = useState(+ initialExternalNotes ?? {}+ );++ const onUploadImage = async (file: File) => {+ const fileType = file.name.split(".").pop();+ const fileName = `${companyId}/purchasing-rfq-line/${id}/${nanoid()}.${fileType}`;++ const result = await carbon?.storage.from("private").upload(fileName, file);++ if (result?.error) {+ toast.error("Failed to upload image");+ throw new Error(result.error.message);+ }++ if (!result?.data) {+ throw new Error("Failed to upload image");+ }++ return getPrivateUrl(result.data.path);+ };++ const onUpdateExternalNotes = useDebounce(+ async (content: JSONContent) => {+ await carbon+ ?.from(table)+ .update({+ externalNotes: content,+ updatedAt: today(getLocalTimeZone()).toString(),+ updatedBy: userId+ })+ .eq("id", id!);+ },+ 2500,+ true+ );++ const onUpdateInternalNotes = useDebounce(+ async (content: JSONContent) => {+ await carbon+ ?.from(table)+ .update({+ internalNotes: content,+ updatedAt: today(getLocalTimeZone()).toString(),+ updatedBy: userId+ })+ .eq("id", id!);+ },+ 2500,+ true+ );++ if (!id) return null;++ return (+ <>+ <Card>+ <Tabs value={tab} onValueChange={setTab}>+ <HStack className="w-full justify-between">+ <CardHeader>+ <CardTitle>{title}</CardTitle>+ <CardDescription>+ {subTitle} -{" "}+ {tab === "internal" ? "Internal Notes" : "External Notes"}+ </CardDescription>+ </CardHeader>+ <CardAction>+ {isEmployee && (+ <TabsList>+ <TabsTrigger value="internal">Internal</TabsTrigger>+ <TabsTrigger value="external">External</TabsTrigger>+ </TabsList>+ )}+ </CardAction>+ </HStack>+ <CardContent>+ <TabsContent value="internal">+ {permissions.can("update", "purchasing") ? (+ <Editor+ initialValue={(internalNotes ?? {}) as JSONContent}+ onUpload={onUploadImage}+ onChange={(value) => {+ setInternalNotes(value);+ onUpdateInternalNotes(value);+ }}+ />+ ) : (+ <div+ className="prose dark:prose-invert"+ dangerouslySetInnerHTML={{+ __html: generateHTML(internalNotes as JSONContent)+ }}+ />+ )}+ </TabsContent>+ <TabsContent value="external">+ {permissions.can("update", "purchasing") ? (+ <Editor+ initialValue={(externalNotes ?? {}) as JSONContent}+ onUpload={onUploadImage}+ onChange={(value) => {+ setExternalNotes(value);+ onUpdateExternalNotes(value);+ }}+ />+ ) : (+ <div+ className="prose dark:prose-invert"+ dangerouslySetInnerHTML={{+ __html: generateHTML(externalNotes as JSONContent)+ }}+ />+ )}+ </TabsContent>+ </CardContent>+ </Tabs>+ </Card>+ </>+ );+};++export default PurchasingRFQLineNotes;diff --git a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQProperties.tsx b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQProperties.tsxnew file mode 100644index 0000000000..e7d9244ec0--- /dev/null+++ b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQProperties.tsx@@ -0,0 +1,321 @@+import type { Json } from "@carbon/database";+import { CreatableMultiSelect, DatePicker, ValidatedForm } from "@carbon/form";+import {+ Button,+ HStack,+ Tooltip,+ TooltipContent,+ TooltipTrigger,+ toast,+ useDisclosure,+ VStack+} from "@carbon/react";+import { useCallback, useEffect, useMemo, useState } from "react";+import { LuCopy, LuLink } from "react-icons/lu";+import { useFetcher, useParams } from "react-router";+import { z } from "zod";+import { zfd } from "zod-form-data";+import { Assignee, useOptimisticAssignment } from "~/components";+import { Employee, Location } from "~/components/Form";+import CustomFormInlineFields from "~/components/Form/CustomFormInlineFields";+import { usePermissions, useRouteData } from "~/hooks";+import type { action } from "~/routes/x+/items+/update";+import { useSuppliers } from "~/stores";+import { path } from "~/utils/path";+import { copyToClipboard } from "~/utils/string";+import type { PurchasingRFQ, PurchasingRFQSupplier } from "../../types";+import { SupplierForm } from "../Supplier";++const PurchasingRFQProperties = () => {+ const { rfqId } = useParams();+ if (!rfqId) throw new Error("rfqId not found");++ const routeData = useRouteData<{+ rfqSummary: PurchasingRFQ;+ suppliers: PurchasingRFQSupplier[];+ }>(path.to.purchasingRfq(rfqId));++ const newSupplierModal = useDisclosure();+ const [created, setCreated] = useState<string>("");++ const [allSuppliers] = useSuppliers();+ const supplierOptions = useMemo(() => {+ return (+ allSuppliers.map((c) => ({+ value: c.id,+ label: c.name+ })) ?? []+ );+ }, [allSuppliers]);++ // Get current supplier IDs from the RFQ+ const currentSupplierIds = useMemo(() => {+ return (+ (routeData?.suppliers+ ?.map((s) => s.supplierId)+ .filter(Boolean) as string[]) ?? []+ );+ }, [routeData?.suppliers]);++ const fetcher = useFetcher<typeof action>();+ useEffect(() => {+ if (fetcher.data?.error) {+ toast.error(fetcher.data.error.message);+ }+ }, [fetcher.data]);++ // biome-ignore lint/correctness/useExhaustiveDependencies: suppressed due to migration+ const onUpdate = useCallback(+ (field: keyof PurchasingRFQ, value: string | null) => {+ if (value === routeData?.rfqSummary[field]) {+ return;+ }+ const formData = new FormData();++ formData.append("ids", rfqId);+ formData.append("field", field);+ formData.append("value", value ?? "");+ fetcher.submit(formData, {+ method: "post",+ action: path.to.purchasingRfqDetails(rfqId)+ });+ },++ [rfqId, routeData?.rfqSummary]+ );++ // biome-ignore lint/correctness/useExhaustiveDependencies: suppressed due to migration+ const onUpdateCustomFields = useCallback(+ (value: string) => {+ const formData = new FormData();++ formData.append("ids", rfqId);+ formData.append("table", "purchasingRfq");+ formData.append("value", value);++ fetcher.submit(formData, {+ method: "post",+ action: path.to.customFields+ });+ },++ [rfqId]+ );++ // biome-ignore lint/correctness/useExhaustiveDependencies: suppressed due to migration+ const onUpdateSuppliers = useCallback(+ (supplierIds: string[]) => {+ const formData = new FormData();++ formData.append("purchasingRfqId", rfqId);+ supplierIds.forEach((id) => formData.append("supplierIds", id));++ fetcher.submit(formData, {+ method: "post",+ action: path.to.purchasingRfqSuppliers(rfqId)+ });+ },++ [rfqId]+ );++ const optimisticAssignment = useOptimisticAssignment({+ id: rfqId,+ table: "purchasingRfq"+ });+ const assignee =+ optimisticAssignment !== undefined+ ? optimisticAssignment+ : routeData?.rfqSummary?.assignee;+ const permissions = usePermissions();++ const isDisabled =+ !permissions.can("update", "purchasing") ||+ !["Draft"].includes(routeData?.rfqSummary?.status ?? "");++ return (+ <VStack+ spacing={4}+ className="w-96 bg-card h-full overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent border-l border-border px-4 py-2 text-sm"+ >+ <VStack spacing={4}>+ <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={() =>+ copyToClipboard(+ window.location.origin ++ path.to.purchasingRfqDetails(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={() =>+ copyToClipboard(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>++ <Assignee+ id={rfqId}+ table="purchasingRfq"+ value={assignee ?? ""}+ variant="inline"+ isReadOnly={!permissions.can("update", "purchasing")}+ />++ <ValidatedForm+ defaultValues={{+ rfqDate: routeData?.rfqSummary?.rfqDate ?? ""+ }}+ validator={z.object({+ rfqDate: z.string().min(1, { message: "RFQ Date is required" })+ })}+ className="w-full"+ >+ <DatePicker+ name="rfqDate"+ label="RFQ Date"+ inline+ onChange={(date) => {+ onUpdate("rfqDate", date);+ }}+ />+ </ValidatedForm>++ <ValidatedForm+ defaultValues={{+ expirationDate: routeData?.rfqSummary?.expirationDate ?? ""+ }}+ validator={z.object({+ expirationDate: zfd.text(z.string().optional())+ })}+ className="w-full"+ >+ <DatePicker+ name="expirationDate"+ label="Expiration Date"+ inline+ onChange={(date) => {+ onUpdate("expirationDate", date);+ }}+ />+ </ValidatedForm>++ <ValidatedForm+ defaultValues={{+ locationId: routeData?.rfqSummary?.locationId ?? undefined+ }}+ validator={z.object({+ locationId: z.string().min(1, { message: "Location is required" })+ })}+ className="w-full"+ >+ <Location+ label="RFQ Location"+ name="locationId"+ inline+ isReadOnly={isDisabled}+ onChange={(value) => {+ if (value?.value) {+ onUpdate("locationId", value.value);+ }+ }}+ />+ </ValidatedForm>++ <ValidatedForm+ defaultValues={{+ employeeId: routeData?.rfqSummary?.employeeId ?? undefined+ }}+ validator={z.object({+ employeeId: zfd.text(z.string().optional())+ })}+ className="w-full"+ >+ <Employee+ name="employeeId"+ label="Buyer"+ inline+ isReadOnly={isDisabled}+ onChange={(value) => {+ if (value?.value) {+ onUpdate("employeeId", value.value);+ }+ }}+ />+ </ValidatedForm>++ <div className="w-full">+ <CreatableMultiSelect+ name="supplierIds"+ label="Suppliers"+ options={supplierOptions}+ value={currentSupplierIds}+ isReadOnly={isDisabled}+ onChange={(selected) => {+ onUpdateSuppliers(selected);+ }}+ onCreateOption={(option) => {+ newSupplierModal.onOpen();+ setCreated(option);+ }}+ />+ {newSupplierModal.isOpen && (+ <SupplierForm+ type="modal"+ onClose={() => {+ setCreated("");+ newSupplierModal.onClose();+ }}+ initialValues={{+ name: created+ }}+ />+ )}+ </div>++ <CustomFormInlineFields+ customFields={+ (routeData?.rfqSummary?.customFields ?? {}) as Record<string, Json>+ }+ table="purchasingRfq"+ tags={[]}+ onUpdate={onUpdateCustomFields}+ isDisabled={isDisabled}+ />+ </VStack>+ );+};++export default PurchasingRFQProperties;diff --git a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQStatus.tsx b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQStatus.tsxnew file mode 100644index 0000000000..728b305d9a--- /dev/null+++ b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQStatus.tsx@@ -0,0 +1,23 @@+import { Status } from "@carbon/react";+import type { purchasingRfqStatusType } from "../../purchasing.models";++type PurchasingRFQStatusProps = {+ status?: (typeof purchasingRfqStatusType)[number] | null;+};++const PurchasingRFQStatus = ({ status }: PurchasingRFQStatusProps) => {+ switch (status) {+ case "Draft":+ return <Status color="gray">{status}</Status>;+ case "Ready for request":+ return <Status color="blue">Ready for request</Status>;+ case "Requested":+ return <Status color="green">{status}</Status>;+ case "Closed":+ return <Status color="red">{status}</Status>;+ default:+ return null;+ }+};++export default PurchasingRFQStatus;diff --git a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQsTable.tsx b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQsTable.tsxnew file mode 100644index 0000000000..862b7403ab--- /dev/null+++ b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQsTable.tsx@@ -0,0 +1,268 @@+import { HStack, MenuIcon, MenuItem, useDisclosure } from "@carbon/react";+import { formatDate } from "@carbon/utils";+import type { ColumnDef } from "@tanstack/react-table";+import { memo, useMemo, useState } from "react";+import {+ LuBookMarked,+ LuCalendar,+ LuContainer,+ LuMap,+ LuPencil,+ LuStar,+ LuTrash,+ LuUser+} from "react-icons/lu";+import { useNavigate } from "react-router";+import { EmployeeAvatar, Hyperlink, New, Table } from "~/components";+import { Enumerable } from "~/components/Enumerable";+import { ConfirmDelete } from "~/components/Modals";+import { usePermissions } from "~/hooks";+import { useCustomColumns } from "~/hooks/useCustomColumns";+import { usePeople } from "~/stores";+import { path } from "~/utils/path";+import { purchasingRfqStatusType } from "../../purchasing.models";+import type { PurchasingRFQ } from "../../types";+import { PurchasingRFQStatus } from ".";++type PurchasingRFQsTableProps = {+ data: PurchasingRFQ[];+ count: number;+};++const PurchasingRFQsTable = memo(+ ({ data, count }: PurchasingRFQsTableProps) => {+ const permissions = usePermissions();+ const navigate = useNavigate();++ const [selectedPurchasingRFQ, setSelectedPurchasingRFQ] =+ useState<PurchasingRFQ | null>(null);+ const deletePurchasingRFQModal = useDisclosure();++ // const [suppliers] = useSuppliers();+ const [people] = usePeople();++ const customColumns = useCustomColumns<PurchasingRFQ>("purchasingRfq");+ const columns = useMemo<ColumnDef<PurchasingRFQ>[]>(() => {+ const defaultColumns: ColumnDef<PurchasingRFQ>[] = [+ {+ accessorKey: "rfqId",+ header: "RFQ Number",+ cell: ({ row }) => (+ <HStack>+ <Hyperlink to={path.to.purchasingRfqDetails(row.original.id!)}>+ {row.original.rfqId}+ </Hyperlink>+ </HStack>+ ),+ meta: {+ icon: <LuBookMarked />+ }+ },+ {+ accessorKey: "supplierCount",+ header: "Suppliers",+ cell: (item) => {+ const count = item.getValue<number>();+ return <span>{count ?? 0}</span>;+ },+ meta: {+ icon: <LuContainer />+ }+ },+ {+ accessorKey: "status",+ header: "Status",+ cell: (item) => {+ const status =+ item.getValue<(typeof purchasingRfqStatusType)[number]>();+ return <PurchasingRFQStatus status={status} />;+ },+ meta: {+ filter: {+ type: "static",+ options: purchasingRfqStatusType.map((status) => ({+ value: status,+ label: <PurchasingRFQStatus status={status} />+ }))+ },+ pluralHeader: "Statuses",+ icon: <LuStar />+ }+ },+ {+ accessorKey: "rfqDate",+ header: "RFQ Date",+ cell: (item) => formatDate(item.getValue<string>()),+ meta: {+ icon: <LuCalendar />+ }+ },+ {+ accessorKey: "expirationDate",+ header: "Due Date",+ cell: (item) => formatDate(item.getValue<string>()),+ meta: {+ icon: <LuCalendar />+ }+ },+ {+ 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+ }))+ },+ icon: <LuUser />+ }+ },+ {+ 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+ }))+ },+ icon: <LuUser />+ }+ },+ {+ accessorKey: "locationName",+ header: "Location",+ cell: (item) => <Enumerable value={item.getValue<string>()} />,+ meta: {+ filter: {+ type: "fetcher",+ endpoint: path.to.api.locations,+ transform: (data: { id: string; name: string }[] | null) =>+ data?.map(({ name }) => ({+ value: name,+ label: <Enumerable value={name} />+ })) ?? []+ },+ icon: <LuMap />+ }+ },+ {+ accessorKey: "createdAt",+ header: "Created At",+ cell: (item) => formatDate(item.getValue<string>()),+ meta: {+ icon: <LuCalendar />+ }+ },+ {+ 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+ }))+ },+ icon: <LuUser />+ }+ },+ {+ accessorKey: "updatedAt",+ header: "Updated At",+ cell: (item) => formatDate(item.getValue<string>()),+ meta: {+ icon: <LuCalendar />+ }+ }+ ];++ return [...defaultColumns, ...customColumns];+ }, [people, customColumns]);++ const renderContextMenu = useMemo(() => {+ return (row: PurchasingRFQ) => (+ <>+ <MenuItem+ onClick={() => navigate(path.to.purchasingRfqDetails(row.id!))}+ >+ <MenuIcon icon={<LuPencil />} />+ Edit+ </MenuItem>+ <MenuItem+ destructive+ disabled={!permissions.can("delete", "purchasing")}+ onClick={() => {+ setSelectedPurchasingRFQ(row);+ deletePurchasingRFQModal.onOpen();+ }}+ >+ <MenuIcon icon={<LuTrash />} />+ Delete+ </MenuItem>+ </>+ );+ }, [deletePurchasingRFQModal, navigate, permissions]);++ return (+ <>+ <Table<PurchasingRFQ>+ count={count}+ columns={columns}+ data={data}+ defaultColumnPinning={{+ left: ["rfqId"]+ }}+ defaultColumnVisibility={{+ createdAt: false,+ updatedAt: false,+ updatedBy: false+ }}+ primaryAction={+ permissions.can("create", "purchasing") && (+ <New label="RFQ" to={path.to.newPurchasingRFQ} />+ )+ }+ renderContextMenu={renderContextMenu}+ title="RFQs"+ table="purchasingRfq"+ withSavedView+ />+ {selectedPurchasingRFQ && selectedPurchasingRFQ.id && (+ <ConfirmDelete+ action={path.to.deletePurchasingRfq(selectedPurchasingRFQ.id)}+ isOpen={deletePurchasingRFQModal.isOpen}+ name={selectedPurchasingRFQ.rfqId!}+ text={`Are you sure you want to delete ${selectedPurchasingRFQ.rfqId!}? This cannot be undone.`}+ onCancel={() => {+ deletePurchasingRFQModal.onClose();+ setSelectedPurchasingRFQ(null);+ }}+ onSubmit={() => {+ deletePurchasingRFQModal.onClose();+ setSelectedPurchasingRFQ(null);+ }}+ />+ )}+ </>+ );+ }+);++PurchasingRFQsTable.displayName = "PurchasingRFQsTable";++export default PurchasingRFQsTable;diff --git a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/index.ts b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/index.tsnew file mode 100644index 0000000000..60c51ae490--- /dev/null+++ b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/index.ts@@ -0,0 +1,10 @@+export { default as DeletePurchasingRFQLine } from "./DeletePurchasingRFQLine";+export { default as PurchasingRFQExplorer } from "./PurchasingRFQExplorer";+export { default as PurchasingRFQForm } from "./PurchasingRFQForm";+export { default as PurchasingRFQHeader } from "./PurchasingRFQHeader";+export { default as PurchasingRFQLineDocuments } from "./PurchasingRFQLineDocuments";+export { default as PurchasingRFQLineForm } from "./PurchasingRFQLineForm";+export { default as PurchasingRFQLineNotes } from "./PurchasingRFQLineNotes";+export { default as PurchasingRFQProperties } from "./PurchasingRFQProperties";+export { default as PurchasingRFQStatus } from "./PurchasingRFQStatus";+export { default as PurchasingRFQsTable } from "./PurchasingRFQsTable";diff --git a/apps/erp/app/modules/purchasing/ui/SupplierInteraction/SupplierInteractionDocuments.tsx b/apps/erp/app/modules/purchasing/ui/SupplierInteraction/SupplierInteractionDocuments.tsxindex ee491001ee..b3bc53382d 100644--- a/apps/erp/app/modules/purchasing/ui/SupplierInteraction/SupplierInteractionDocuments.tsx+++ b/apps/erp/app/modules/purchasing/ui/SupplierInteraction/SupplierInteractionDocuments.tsx@@ -38,7 +38,11 @@ type SupplierInteractionDocumentsProps = {attachments: FileObject[];id: string;interactionId: string;- type: "Supplier Quote" | "Purchase Order" | "Purchase Invoice";+ type:+ | "Supplier Quote"+ | "Purchase Order"+ | "Purchase Invoice"+ | "Purchasing RFQ";};const SupplierInteractionDocuments = ({@@ -172,7 +176,11 @@ const SupplierInteractionDocuments = ({type SupplierInteractionDocumentFormProps = {interactionId: string;id: string;- type: "Supplier Quote" | "Purchase Order" | "Purchase Invoice";+ type:+ | "Supplier Quote"+ | "Purchase Order"+ | "Purchase Invoice"+ | "Purchasing RFQ";};export const useSupplierInteractionDocuments = ({diff --git a/apps/erp/app/modules/purchasing/ui/SupplierInteraction/SupplierInteractionNotes.tsx b/apps/erp/app/modules/purchasing/ui/SupplierInteraction/SupplierInteractionNotes.tsxindex 0b5a71017b..df0a2c17b9 100644--- a/apps/erp/app/modules/purchasing/ui/SupplierInteraction/SupplierInteractionNotes.tsx+++ b/apps/erp/app/modules/purchasing/ui/SupplierInteraction/SupplierInteractionNotes.tsx@@ -31,7 +31,12 @@ const SupplierInteractionNotes = ({externalNotes: initialExternalNotes}: {id: string | null;- table: "supplierQuote" | "purchaseOrder" | "receipt" | "purchaseInvoice";+ table:+ | "supplierQuote"+ | "purchaseOrder"+ | "receipt"+ | "purchaseInvoice"+ | "purchasingRfq";title: string;internalNotes?: JSONContent;externalNotes?: JSONContent;diff --git a/apps/erp/app/modules/purchasing/ui/SupplierInteraction/SupplierInteractionState.tsx b/apps/erp/app/modules/purchasing/ui/SupplierInteraction/SupplierInteractionState.tsxindex bf661132ae..3a70469f37 100644--- a/apps/erp/app/modules/purchasing/ui/SupplierInteraction/SupplierInteractionState.tsx+++ b/apps/erp/app/modules/purchasing/ui/SupplierInteraction/SupplierInteractionState.tsx@@ -10,43 +10,29 @@ import { Link, useNavigate } from "react-router";import { path } from "~/utils/path";import type { SupplierInteraction } from "../../types";-function getSupplierInteractionStarted(- interaction: SupplierInteraction,- state: string-) {- switch (state) {- // case "RFQ":- // return interaction.purchaseRfqs.length > 0;- case "Quote":- return interaction.supplierQuotes.length > 0;- case "Order":- return interaction.purchaseOrders.length > 0;- // case "Invoice":- // return interaction.purchaseInvoices.length > 0;- }-}+type LinkedPurchasingRFQ = {+ id: string;+ rfqId?: string;+ status?: string;+};-function getSupplierInteractionCompleted(- interaction: SupplierInteraction,- state: string-) {- switch (state) {- // case "RFQ":- // return (- // interaction.purchaseRfqs?.[0]?.completedDate &&- // interaction.purchaseRfqs?.[0]?.completedDate !== null- // );- case "Quote":- return interaction.supplierQuotes.length > 0;- case "Order":- return interaction.purchaseOrders?.[0]?.status === "Completed";- // case "Invoice":- // return (- // interaction.purchaseInvoices?.[0]?.completedDate &&- // interaction.purchaseInvoices?.[0]?.completedDate !== null- // );- }-}+type LinkedSupplierQuote = {+ id: string;+ supplierQuoteId?: string;+ revisionId?: number;+ status?: string;+ supplierId?: string;+ supplier?: { name: string } | null;+};++type SupplierInteractionStateProps = {+ // For use from supplier quote / purchase order (has interaction)+ interaction?: SupplierInteraction | null;+ purchasingRfqs?: LinkedPurchasingRFQ[];+ // For use from purchasing RFQ (has current RFQ)+ currentRfq?: LinkedPurchasingRFQ | null;+ linkedQuotes?: LinkedSupplierQuote[];+};function getSupplierInteractionIcon(state: string) {switch (state) {@@ -63,126 +49,65 @@ function getSupplierInteractionIcon(state: string) {}}-function getPath(interaction: SupplierInteraction, state: string) {- switch (state) {- // case "RFQ":- // return path.to.purchaseRfqDetails(interaction.purchaseRfqs?.[0]?.id!);- case "Quote":- return path.to.supplierQuoteDetails(interaction.supplierQuotes?.[0]?.id!);- case "Order":- return path.to.purchaseOrderDetails(interaction.purchaseOrders?.[0]?.id!);- case "Invoice":- return path.to.purchaseInvoiceDetails(- interaction.purchaseInvoices?.[0]?.id!- );- }-}--function getIsCurrent(- interaction: SupplierInteraction,- pathname: string,- state: string-) {- switch (state) {- // case "RFQ":- // return interaction.purchaseRfqs.some((rfq) =>- // pathname.includes(path.to.purchaseRfqDetails(rfq.id!))- // );- case "Quote":- return interaction.supplierQuotes.some((quote) =>- pathname.includes(path.to.supplierQuoteDetails(quote.id!))- );- case "Order":- return interaction.purchaseOrders.some((order) =>- pathname.includes(path.to.purchaseOrderDetails(order.id!))- );- case "Invoice":- return interaction.purchaseInvoices.some((invoice) =>- pathname.includes(path.to.purchaseInvoiceDetails(invoice.id!))- );- default:- return false;- }-}--function getItems(interaction: SupplierInteraction, state: string) {- switch (state) {- // case "RFQ":- // return interaction.purchaseRfqs.map((rfq) => ({- // id: rfq.id!,- // label: rfq.rfqId- // ? `${rfq.rfqId}${- // rfq.revisionId && rfq.revisionId > 0 ? `-${rfq.revisionId}` : ""- // }`- // : `RFQ ${rfq.id}`,- // path: path.to.purchaseRfqDetails(rfq.id!),- // }));- case "Quote":- return interaction.supplierQuotes.map((quote) => ({- id: quote.id!,- label: quote.supplierQuoteId- ? `${quote.supplierQuoteId}${- quote.revisionId && quote.revisionId > 0- ? `-${quote.revisionId}`- : ""- }`- : `Quote ${quote.id}`,- path: path.to.supplierQuoteDetails(quote.id!)- }));- case "Order":- return interaction.purchaseOrders.map((order) => ({- id: order.id!,- label: order.purchaseOrderId- ? `${order.purchaseOrderId}${- order.revisionId && order.revisionId > 0- ? `-${order.revisionId}`- : ""- }`- : `Order ${order.id}`,- path: path.to.purchaseOrderDetails(order.id!)- }));- case "Invoice":- return interaction.purchaseInvoices.map((invoice) => ({- id: invoice.id!,- label: invoice.invoiceId- ? `${invoice.invoiceId}`- : `Invoice ${invoice.id}`,- path: path.to.purchaseInvoiceDetails(invoice.id!)- }));- default:- return [];- }-}-const states = ["RFQ", "Quote", "Order", "Invoice"];const SupplierInteractionState = ({- interaction-}: {- interaction: SupplierInteraction;-}) => {+ interaction,+ purchasingRfqs = [],+ currentRfq,+ linkedQuotes = []+}: SupplierInteractionStateProps) => {const { pathname } = useOptimisticLocation();const navigate = useNavigate();+ // Determine if we're in "RFQ mode" (viewing from purchasing RFQ) or "interaction mode" (viewing from quote/order)+ const isRfqMode = currentRfq !== undefined && currentRfq !== null;++ // Combine RFQ sources: currentRfq for RFQ mode, purchasingRfqs for interaction mode+ const rfqs = isRfqMode ? [currentRfq] : purchasingRfqs;+ const hasRfqs = rfqs.length > 0;++ // Combine quote sources: linkedQuotes for RFQ mode, interaction.supplierQuotes for interaction mode+ const quotes = isRfqMode+ ? linkedQuotes+ : (interaction?.supplierQuotes?.map((q) => ({+ id: q.id!,+ supplierQuoteId: q.supplierQuoteId ?? undefined,+ revisionId: q.revisionId ?? undefined,+ status: q.status ?? undefined+ })) ?? []);+ const hasQuotes = quotes.length > 0;++ // Orders and invoices only from interaction+ const orders = interaction?.purchaseOrders ?? [];+ const hasOrders = orders.length > 0;+ // const invoices = interaction?.purchaseInvoices ?? [];++ // Determine which states to show+ const statesToShow = hasRfqs ? ["RFQ", "Quote", "Order"] : ["Quote", "Order"];+return (<Menubar>{states- .filter((state) => ["Quote", "Order"].includes(state))- .map((state, index) => {- const isStarted = getSupplierInteractionStarted(interaction, state);- const isCompleted = getSupplierInteractionCompleted(- interaction,- state- );- const isCurrent = getIsCurrent(interaction, pathname, state);+ .filter((state) => statesToShow.includes(state))+ .map((state) => {const Icon = getSupplierInteractionIcon(state);- const to = getPath(interaction, state);- const items = getItems(interaction, state);- const hasMultipleItems = items.length > 1;- if (isStarted && to) {- if (hasMultipleItems) {- const Icon = getSupplierInteractionIcon(state);+ // RFQ State+ if (state === "RFQ" && hasRfqs) {+ const rfqItems = rfqs.map((rfq) => ({+ id: rfq.id!,+ label: rfq.rfqId ? rfq.rfqId : `RFQ ${rfq.id}`,+ path: path.to.purchasingRfqDetails(rfq.id!)+ }));++ const firstPath = rfqItems[0]?.path;+ const hasMultiple = rfqItems.length > 1;+ const isCurrent = rfqItems.some((item) =>+ pathname.includes(path.to.purchasingRfq(item.id))+ );++ if (hasMultiple) {return (<SplitButtonkey={state}@@ -195,13 +120,13 @@ const SupplierInteractionState = ({/>}variant="ghost"- onClick={() => navigate(to)}- dropdownItems={items.map((item) => ({+ onClick={() => navigate(firstPath)}+ dropdownItems={rfqItems.map((item) => ({label: item.label,onClick: () => navigate(item.path)}))}>- {state}+ RFQ</SplitButton>);} else {@@ -219,29 +144,149 @@ const SupplierInteractionState = ({variant="ghost"asChild>- <Link to={to}>{state}</Link>+ <Link to={firstPath}>RFQ</Link></Button>);}- } else {- return (- <Button- key={state}- variant="ghost"- isDisabled- leftIcon={- <Icon- className={cn(- isCompleted && "text-emerald-500",- !isCurrent && "opacity-80 hover:opacity-100"- )}- />- }- >- {state}- </Button>+ }++ // Quote State+ if (state === "Quote" && hasQuotes) {+ const quoteItems = quotes.map((quote) => ({+ id: quote.id!,+ label: quote.supplierQuoteId+ ? `${quote.supplierQuoteId}${+ quote.revisionId && quote.revisionId > 0+ ? `-${quote.revisionId}`+ : ""+ }`+ : `Quote ${quote.id}`,+ path: path.to.supplierQuoteDetails(quote.id!)+ }));++ const firstPath = quoteItems[0]?.path;+ const hasMultiple = quoteItems.length > 1;+ const isCurrent = quoteItems.some((item) =>+ pathname.includes(item.path));++ if (hasMultiple) {+ return (+ <SplitButton+ key={state}+ leftIcon={+ <Icon+ className={cn(+ isCurrent && "text-emerald-500",+ !isCurrent && "opacity-80 hover:opacity-100"+ )}+ />+ }+ variant="ghost"+ onClick={() => navigate(firstPath)}+ dropdownItems={quoteItems.map((item) => ({+ label: item.label,+ onClick: () => navigate(item.path)+ }))}+ >+ Quote+ </SplitButton>+ );+ } else {+ return (+ <Button+ key={state}+ leftIcon={+ <Icon+ className={cn(+ isCurrent && "text-emerald-500",+ !isCurrent && "opacity-80 hover:opacity-100"+ )}+ />+ }+ variant="ghost"+ asChild+ >+ <Link to={firstPath}>Quote</Link>+ </Button>+ );+ }+ }++ // Order State+ if (state === "Order" && hasOrders) {+ const orderItems = orders.map((order) => ({+ id: order.id!,+ label: order.purchaseOrderId+ ? `${order.purchaseOrderId}${+ order.revisionId && order.revisionId > 0+ ? `-${order.revisionId}`+ : ""+ }`+ : `Order ${order.id}`,+ path: path.to.purchaseOrderDetails(order.id!)+ }));++ const firstPath = orderItems[0]?.path;+ const hasMultiple = orderItems.length > 1;+ const isCurrent = orderItems.some((item) =>+ pathname.includes(item.path)+ );++ if (hasMultiple) {+ return (+ <SplitButton+ key={state}+ leftIcon={+ <Icon+ className={cn(+ isCurrent && "text-emerald-500",+ !isCurrent && "opacity-80 hover:opacity-100"+ )}+ />+ }+ variant="ghost"+ onClick={() => navigate(firstPath)}+ dropdownItems={orderItems.map((item) => ({+ label: item.label,+ onClick: () => navigate(item.path)+ }))}+ >+ Order+ </SplitButton>+ );+ } else {+ return (+ <Button+ key={state}+ leftIcon={+ <Icon+ className={cn(+ isCurrent && "text-emerald-500",+ !isCurrent && "opacity-80 hover:opacity-100"+ )}+ />+ }+ variant="ghost"+ asChild+ >+ <Link to={firstPath}>Order</Link>+ </Button>+ );+ }}++ // Disabled states+ return (+ <Button+ key={state}+ variant="ghost"+ isDisabled+ leftIcon={<Icon className="opacity-50" />}+ >+ {state}+ </Button>+ );})}</Menubar>);diff --git a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteCompareDrawer.tsx b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteCompareDrawer.tsxnew file mode 100644index 0000000000..257742f4ef--- /dev/null+++ b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteCompareDrawer.tsx@@ -0,0 +1,804 @@+import {+ Badge,+ Button,+ cn,+ Drawer,+ DrawerBody,+ DrawerContent,+ DrawerFooter,+ DrawerHeader,+ DrawerTitle,+ Heading,+ HStack,+ RadioGroup,+ RadioGroupItem,+ ScrollArea,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Spinner,+ Table,+ Tbody,+ Td,+ Th,+ Thead,+ Tr,+ VStack+} from "@carbon/react";+import { useEffect, useMemo, useState } from "react";+import { LuArrowLeft, LuImage, LuStar } from "react-icons/lu";+import { Form, useFetcher, useNavigation } from "react-router";+import type { z } from "zod";+import { useUser } from "~/hooks";+import { useCurrencyFormatter } from "~/hooks/useCurrencyFormatter";+import { getPrivateUrl, path } from "~/utils/path";+import type { selectedLineSchema } from "../../purchasing.models";+import type { SupplierQuoteLine, SupplierQuoteLinePrice } from "../../types";++type SelectedLine = z.infer<typeof selectedLineSchema>;++// Type for quotes returned from comparison API (includes supplier info)+type ComparisonQuote = {+ id: string | null;+ supplierQuoteId: string | null;+ revisionId: number | null;+ status: string | null;+ supplierId: string | null;+ currencyCode: string | null;+ exchangeRate: number | null;+ supplier: { name: string } | null;+};++type ComparisonData = {+ quotes: ComparisonQuote[];+ lines: SupplierQuoteLine[];+ prices: SupplierQuoteLinePrice[];+};++type SupplierQuoteCompareDrawerProps = {+ isOpen: boolean;+ onClose: () => void;+ purchasingRfqId: string;+};++type DrawerStep = "compare" | "select-items";++const SupplierQuoteCompareDrawer = ({+ isOpen,+ onClose,+ purchasingRfqId+}: SupplierQuoteCompareDrawerProps) => {+ const [step, setStep] = useState<DrawerStep>("compare");+ const [selectedQuoteId, setSelectedQuoteId] = useState<string | null>(null);+ const [selectedQuantityTier, setSelectedQuantityTier] = useState<+ number | null+ >(null);+ const [selectedLines, setSelectedLines] = useState<+ Record<string, SelectedLine>+ >({});++ const fetcher = useFetcher<ComparisonData>();+ const navigation = useNavigation();+ const isSubmitting = navigation.state !== "idle";++ const { company } = useUser();+ const baseCurrency = company?.baseCurrencyCode ?? "USD";+ const formatter = useCurrencyFormatter({ currency: baseCurrency });++ // Load comparison data when drawer opens+ useEffect(() => {+ if (+ isOpen &&+ purchasingRfqId &&+ fetcher.state === "idle" &&+ !fetcher.data+ ) {+ fetcher.load(path.to.purchasingRfqCompare(purchasingRfqId));+ }+ }, [isOpen, purchasingRfqId, fetcher]);++ // Reset state when drawer closes+ useEffect(() => {+ if (!isOpen) {+ setStep("compare");+ setSelectedQuoteId(null);+ setSelectedQuantityTier(null);+ setSelectedLines({});+ }+ }, [isOpen]);++ const quotes = fetcher.data?.quotes ?? [];+ const lines = fetcher.data?.lines ?? [];+ const prices = fetcher.data?.prices ?? [];++ // Get all unique quantity tiers across all quotes+ const quantityTiers = useMemo(() => {+ const tiers = new Set<number>();+ for (const price of prices) {+ tiers.add(price.quantity);+ }+ return Array.from(tiers).sort((a, b) => a - b);+ }, [prices]);++ // Set default quantity tier to first available+ useEffect(() => {+ if (quantityTiers.length > 0 && selectedQuantityTier === null) {+ setSelectedQuantityTier(quantityTiers[0]);+ }+ }, [quantityTiers, selectedQuantityTier]);++ const selectedQuote = useMemo(+ () => quotes.find((q) => q.id === selectedQuoteId),+ [quotes, selectedQuoteId]+ );++ const selectedQuoteLines = useMemo(+ () => lines.filter((l) => l.supplierQuoteId === selectedQuoteId),+ [lines, selectedQuoteId]+ );++ const selectedQuotePrices = useMemo(+ () => prices.filter((p) => p.supplierQuoteId === selectedQuoteId),+ [prices, selectedQuoteId]+ );++ const handleQuoteSelect = (quoteId: string) => {+ setSelectedQuoteId(quoteId);+ };++ const handleProceedToSelectItems = () => {+ if (selectedQuoteId) {+ setStep("select-items");+ }+ };++ const handleBackToCompare = () => {+ setStep("compare");+ setSelectedLines({});+ };++ // Calculate order total from selected line items+ const orderTotal = useMemo(() => {+ let total = 0;+ for (const pricing of Object.values(selectedLines)) {+ total +=+ pricing.supplierUnitPrice * pricing.quantity ++ pricing.supplierShippingCost ++ pricing.supplierTaxAmount;+ }+ return total;+ }, [selectedLines]);++ const isLoading = fetcher.state === "loading";++ return (+ <Drawer+ open={isOpen}+ onOpenChange={(open) => {+ if (!open) {+ onClose();+ }+ }}+ >+ <DrawerContent size="full">+ <DrawerHeader>+ <HStack className="w-full justify-between">+ <HStack>+ {step === "select-items" && (+ <Button+ variant="ghost"+ size="sm"+ leftIcon={<LuArrowLeft />}+ onClick={handleBackToCompare}+ >+ Back+ </Button>+ )}+ <DrawerTitle>+ {step === "compare"+ ? "Compare Supplier Quotes"+ : `Create Order from ${selectedQuote?.supplier?.name ?? selectedQuote?.supplierQuoteId}`}+ </DrawerTitle>+ </HStack>++ {/* Quantity tier selector in Step 1 */}+ {step === "compare" && quantityTiers.length > 1 && (+ <HStack>+ <span className="text-sm text-muted-foreground">+ Compare at quantity:+ </span>+ <Select+ value={String(selectedQuantityTier ?? "")}+ onValueChange={(value) =>+ setSelectedQuantityTier(Number(value))+ }+ >+ <SelectTrigger className="w-[120px]">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {quantityTiers.map((qty) => (+ <SelectItem key={qty} value={String(qty)}>+ {qty}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </HStack>+ )}+ </HStack>+ </DrawerHeader>++ <DrawerBody>+ {isLoading ? (+ <div className="flex w-full h-full items-center justify-center">+ <Spinner className="h-10 w-10" />+ </div>+ ) : quotes.length === 0 ? (+ <div className="flex w-full h-full items-center justify-center">+ <VStack spacing={2} className="text-center">+ <Heading size="h4">No Active Quotes</Heading>+ <p className="text-muted-foreground">+ There are no active supplier quotes to compare for this RFQ.+ </p>+ </VStack>+ </div>+ ) : step === "compare" ? (+ <ComparisonView+ quotes={quotes}+ lines={lines}+ prices={prices}+ selectedQuoteId={selectedQuoteId}+ selectedQuantityTier={selectedQuantityTier}+ onQuoteSelect={handleQuoteSelect}+ formatter={formatter}+ />+ ) : (+ <LineSelectionView+ quote={selectedQuote!}+ lines={selectedQuoteLines}+ prices={selectedQuotePrices}+ selectedLines={selectedLines}+ setSelectedLines={setSelectedLines}+ formatter={formatter}+ />+ )}+ </DrawerBody>++ <DrawerFooter>+ <HStack className="w-full justify-between">+ <Button variant="secondary" onClick={onClose}>+ Cancel+ </Button>++ {step === "compare" ? (+ <Button+ onClick={handleProceedToSelectItems}+ isDisabled={!selectedQuoteId}+ >+ Select Items →+ </Button>+ ) : (+ <Form+ action={path.to.convertSupplierQuoteToOrder(selectedQuoteId!)}+ method="post"+ >+ <input+ type="hidden"+ name="selectedLines"+ value={JSON.stringify(selectedLines)}+ />+ <Button+ type="submit"+ isDisabled={+ isSubmitting || Object.keys(selectedLines).length === 0+ }+ isLoading={isSubmitting}+ >+ Create Order ({formatter.format(orderTotal)})+ </Button>+ </Form>+ )}+ </HStack>+ </DrawerFooter>+ </DrawerContent>+ </Drawer>+ );+};++export default SupplierQuoteCompareDrawer;++// --- Comparison View Component ---++type ComparisonViewProps = {+ quotes: ComparisonQuote[];+ lines: SupplierQuoteLine[];+ prices: SupplierQuoteLinePrice[];+ selectedQuoteId: string | null;+ selectedQuantityTier: number | null;+ onQuoteSelect: (quoteId: string) => void;+ formatter: Intl.NumberFormat;+};++const ComparisonView = ({+ quotes,+ lines,+ prices,+ selectedQuoteId,+ selectedQuantityTier,+ onQuoteSelect,+ formatter+}: ComparisonViewProps) => {+ // Group lines and prices by quote, filtered by selected quantity tier+ const quoteData = useMemo(() => {+ return quotes.map((quote) => {+ const quoteLines = lines.filter((l) => l.supplierQuoteId === quote.id);+ const quotePrices = prices.filter((p) => p.supplierQuoteId === quote.id);++ // Calculate quote total for selected quantity tier+ let total = 0;+ let minLeadTime = Infinity;+ let maxLeadTime = 0;+ let hasMatchingTier = false;++ for (const line of quoteLines) {+ // Find price matching selected quantity tier, or closest available+ const linePrices = quotePrices.filter(+ (p) => p.supplierQuoteLineId === line.id+ );++ const matchingPrice = selectedQuantityTier+ ? linePrices.find((p) => p.quantity === selectedQuantityTier)+ : linePrices[0];++ if (matchingPrice) {+ hasMatchingTier = true;+ total +=+ (matchingPrice.supplierUnitPrice ?? 0) * matchingPrice.quantity ++ (matchingPrice.supplierShippingCost ?? 0) ++ (matchingPrice.supplierTaxAmount ?? 0);++ if (+ matchingPrice.leadTime !== null &&+ matchingPrice.leadTime !== undefined+ ) {+ minLeadTime = Math.min(minLeadTime, matchingPrice.leadTime);+ maxLeadTime = Math.max(maxLeadTime, matchingPrice.leadTime);+ }+ }+ }++ return {+ quote,+ lines: quoteLines,+ prices: quotePrices,+ total,+ hasMatchingTier,+ leadTimeRange:+ minLeadTime === Infinity+ ? null+ : minLeadTime === maxLeadTime+ ? `${minLeadTime} days`+ : `${minLeadTime}-${maxLeadTime} days`+ };+ });+ }, [quotes, lines, prices, selectedQuantityTier]);++ // Find best total for highlighting+ const bestTotal = useMemo(() => {+ const totals = quoteData+ .filter((q) => q.hasMatchingTier)+ .map((q) => q.total)+ .filter((t) => t > 0);+ return totals.length > 0 ? Math.min(...totals) : null;+ }, [quoteData]);++ // Get unique items across all quotes for the comparison matrix+ const uniqueItems = useMemo(() => {+ const itemMap = new Map<+ string,+ { itemReadableId: string; description: string }+ >();+ for (const line of lines) {+ if (line.itemReadableId && !itemMap.has(line.itemReadableId)) {+ itemMap.set(line.itemReadableId, {+ itemReadableId: line.itemReadableId,+ description: line.description ?? ""+ });+ }+ }+ return Array.from(itemMap.values());+ }, [lines]);++ return (+ <ScrollArea className="h-[calc(100dvh-180px)]">+ <VStack spacing={8}>+ {/* Quote Summary Cards */}+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 w-full">+ <RadioGroup+ value={selectedQuoteId ?? ""}+ onValueChange={onQuoteSelect}+ className="contents"+ >+ {quoteData.map(+ ({ quote, total, leadTimeRange, hasMatchingTier }) => (+ <label+ key={quote.id}+ htmlFor={`quote-${quote.id}`}+ className={cn(+ "relative flex flex-col p-4 rounded-lg border-2 cursor-pointer transition-all",+ selectedQuoteId === quote.id+ ? "border-primary bg-primary/5"+ : "border-border hover:border-muted-foreground/50",+ !hasMatchingTier && "opacity-50"+ )}+ >+ <div className="absolute top-3 right-3">+ <RadioGroupItem+ value={quote.id!}+ id={`quote-${quote.id}`}+ />+ </div>++ <VStack spacing={2} className="items-start">+ <div>+ <Heading size="h4">+ {quote.supplier?.name ?? "Unknown Supplier"}+ </Heading>+ <span className="text-sm text-muted-foreground">+ {quote.supplierQuoteId}+ </span>+ </div>++ <Badge variant="secondary">{quote.status}</Badge>++ <div className="w-full pt-2 border-t space-y-1">+ <HStack className="justify-between">+ <span className="text-sm text-muted-foreground">+ Total:+ </span>+ <HStack spacing={1}>+ {total === bestTotal && total > 0 && (+ <LuStar className="h-4 w-4 text-yellow-500 fill-yellow-500" />+ )}+ <span+ className={cn(+ "font-semibold",+ total === bestTotal &&+ total > 0 &&+ "text-green-600"+ )}+ >+ {hasMatchingTier ? formatter.format(total) : "N/A"}+ </span>+ </HStack>+ </HStack>++ {leadTimeRange && (+ <HStack className="justify-between">+ <span className="text-sm text-muted-foreground">+ Lead Time:+ </span>+ <span className="text-sm">{leadTimeRange}</span>+ </HStack>+ )}++ {!hasMatchingTier && (+ <span className="text-xs text-amber-600">+ No pricing for selected quantity+ </span>+ )}+ </div>+ </VStack>+ </label>+ )+ )}+ </RadioGroup>+ </div>++ {/* Line Item Comparison Matrix */}+ {uniqueItems.length > 0 && (+ <VStack spacing={2} className="w-full">+ <Heading size="h4" className="self-start">+ Line Item Comparison+ </Heading>++ <div className="w-full overflow-x-auto">+ <Table>+ <Thead>+ <Tr>+ <Th className="min-w-[150px]">Item</Th>+ {quotes.map((quote) => (+ <Th key={quote.id} className="min-w-[180px] text-center">+ {quote.supplier?.name ?? "Unknown"}+ </Th>+ ))}+ </Tr>+ </Thead>+ <Tbody>+ {uniqueItems.map((item) => {+ // Find best price for this item at selected quantity tier+ const itemPrices = quotes.map((quote) => {+ const quoteLine = lines.find(+ (l) =>+ l.supplierQuoteId === quote.id &&+ l.itemReadableId === item.itemReadableId+ );+ if (!quoteLine) return null;++ const linePrices = prices.filter(+ (p) => p.supplierQuoteLineId === quoteLine.id+ );+ const matchingPrice = selectedQuantityTier+ ? linePrices.find(+ (p) => p.quantity === selectedQuantityTier+ )+ : linePrices[0];++ return matchingPrice?.supplierUnitPrice ?? null;+ });++ const validPrices = itemPrices.filter(+ (p): p is number => p !== null && p > 0+ );+ const bestPrice =+ validPrices.length > 0 ? Math.min(...validPrices) : null;++ return (+ <Tr key={item.itemReadableId}>+ <Td>+ <VStack spacing={0} className="items-start">+ <span className="font-medium">+ {item.itemReadableId}+ </span>+ <span className="text-xs text-muted-foreground truncate max-w-[140px]">+ {item.description}+ </span>+ </VStack>+ </Td>+ {quotes.map((quote) => {+ const quoteLine = lines.find(+ (l) =>+ l.supplierQuoteId === quote.id &&+ l.itemReadableId === item.itemReadableId+ );+ if (!quoteLine) {+ return (+ <Td key={quote.id} className="text-center">+ <span className="text-muted-foreground">—</span>+ </Td>+ );+ }++ const linePrices = prices.filter(+ (p) => p.supplierQuoteLineId === quoteLine.id+ );+ const linePrice = selectedQuantityTier+ ? linePrices.find(+ (p) => p.quantity === selectedQuantityTier+ )+ : linePrices[0];++ if (!linePrice) {+ return (+ <Td key={quote.id} className="text-center">+ <span className="text-muted-foreground text-xs">+ N/A+ </span>+ </Td>+ );+ }++ const isBest =+ linePrice.supplierUnitPrice === bestPrice &&+ bestPrice !== null;++ return (+ <Td key={quote.id} className="text-center">+ <VStack spacing={0}>+ <HStack spacing={1} className="justify-center">+ {isBest && (+ <LuStar className="h-3 w-3 text-yellow-500 fill-yellow-500" />+ )}+ <span+ className={cn(+ "font-medium",+ isBest && "text-green-600"+ )}+ >+ {formatter.format(+ linePrice.supplierUnitPrice ?? 0+ )}+ /ea+ </span>+ </HStack>+ <span className="text-xs text-muted-foreground">+ {linePrice.leadTime ?? 0} days+ </span>+ </VStack>+ </Td>+ );+ })}+ </Tr>+ );+ })}+ </Tbody>+ </Table>+ </div>+ </VStack>+ )}+ </VStack>+ </ScrollArea>+ );+};++// --- Line Selection View Component (matching existing drawer) ---++type LineSelectionViewProps = {+ quote: ComparisonQuote;+ lines: SupplierQuoteLine[];+ prices: SupplierQuoteLinePrice[];+ selectedLines: Record<string, SelectedLine>;+ setSelectedLines: React.Dispatch<+ React.SetStateAction<Record<string, SelectedLine>>+ >;+ formatter: Intl.NumberFormat;+};++const LineSelectionView = ({+ lines,+ prices,+ selectedLines,+ setSelectedLines,+ formatter+}: LineSelectionViewProps) => {+ const pricingByLine = useMemo(+ () =>+ lines.reduce<Record<string, SupplierQuoteLinePrice[]>>((acc, line) => {+ acc[line.id!] = prices.filter((p) => p.supplierQuoteLineId === line.id);+ return acc;+ }, {}),+ [lines, prices]+ );++ return (+ <ScrollArea className="h-[calc(100dvh-180px)]">+ <VStack spacing={8}>+ {lines.map((line) => (+ <VStack key={line.id}>+ <HStack spacing={2} className="items-start">+ {line.thumbnailPath ? (+ <img+ alt={line.itemReadableId!}+ className="w-24 h-24 bg-gradient-to-bl from-muted to-muted/40 rounded-lg"+ src={getPrivateUrl(line.thumbnailPath)}+ />+ ) : (+ <div className="w-24 h-24 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4">+ <LuImage className="w-16 h-16 text-muted-foreground" />+ </div>+ )}++ <VStack spacing={0}>+ <Heading>{line.itemReadableId}</Heading>+ <span className="text-muted-foreground text-base truncate">+ {line.description}+ </span>+ </VStack>+ </HStack>++ <LinePricingOptions+ line={line}+ options={pricingByLine[line.id!] ?? []}+ formatter={formatter}+ selectedLines={selectedLines}+ setSelectedLines={setSelectedLines}+ />+ </VStack>+ ))}+ </VStack>+ </ScrollArea>+ );+};++// --- Line Pricing Options (matching existing drawer pattern) ---++type LinePricingOptionsProps = {+ line: SupplierQuoteLine;+ options: SupplierQuoteLinePrice[];+ formatter: Intl.NumberFormat;+ selectedLines: Record<string, SelectedLine>;+ setSelectedLines: React.Dispatch<+ React.SetStateAction<Record<string, SelectedLine>>+ >;+};++const LinePricingOptions = ({+ line,+ options,+ formatter,+ selectedLines,+ setSelectedLines+}: LinePricingOptionsProps) => {+ const selectedValue = selectedLines[line.id!]?.quantity?.toString() ?? "";++ return (+ <RadioGroup+ className="w-full"+ value={selectedValue}+ onValueChange={(value) => {+ const selectedOption = options.find(+ (opt) => opt.quantity.toString() === value+ );+ if (selectedOption) {+ setSelectedLines((prev) => ({+ ...prev,+ [line.id!]: {+ quantity: selectedOption.quantity,+ unitPrice: selectedOption.unitPrice ?? 0,+ supplierUnitPrice: selectedOption.supplierUnitPrice ?? 0,+ supplierShippingCost: selectedOption.supplierShippingCost ?? 0,+ shippingCost: selectedOption.shippingCost ?? 0,+ leadTime: selectedOption.leadTime ?? 0,+ supplierTaxAmount: selectedOption.supplierTaxAmount ?? 0+ }+ }));+ }+ }}+ >+ <Table>+ <Thead>+ <Tr>+ <Th></Th>+ <Th>Quantity</Th>+ <Th>Unit Price</Th>+ <Th>Shipping</Th>+ <Th>Lead Time</Th>+ <Th>Tax</Th>+ <Th>Total Price</Th>+ </Tr>+ </Thead>+ <Tbody>+ {!Array.isArray(options) || options.length === 0 ? (+ <Tr>+ <Td colSpan={7} className="text-center py-8">+ No pricing options found+ </Td>+ </Tr>+ ) : (+ options.map((option) => (+ <Tr key={option.quantity}>+ <Td>+ <RadioGroupItem+ value={option.quantity.toString()}+ id={`${line.id}:${option.quantity.toString()}`}+ />+ <label+ htmlFor={`${line.id}:${option.quantity.toString()}`}+ className="sr-only"+ >+ {option.quantity}+ </label>+ </Td>+ <Td>{option.quantity}</Td>+ <Td>{formatter.format(option.supplierUnitPrice ?? 0)}</Td>+ <Td>{formatter.format(option.supplierShippingCost ?? 0)}</Td>+ <Td>{option.leadTime ?? 0} days</Td>+ <Td>{formatter.format(option.supplierTaxAmount ?? 0)}</Td>+ <Td>+ {formatter.format(+ (option.supplierUnitPrice ?? 0) * option.quantity ++ (option.supplierShippingCost ?? 0) ++ (option.supplierTaxAmount ?? 0)+ )}+ </Td>+ </Tr>+ ))+ )}+ </Tbody>+ </Table>+ </RadioGroup>+ );+};diff --git a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteHeader.tsx b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteHeader.tsxindex 5c96ce40a5..474102aa6a 100644--- a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteHeader.tsx+++ b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteHeader.tsx@@ -33,6 +33,7 @@ import {LuEllipsisVertical,LuExternalLink,LuEye,+ LuGitCompare,LuLoaderCircle,LuPanelLeft,LuPanelRight,@@ -56,6 +57,7 @@ import type {SupplierQuoteLine,SupplierQuoteLinePrice} from "../../types";+import SupplierQuoteCompareDrawer from "./SupplierQuoteCompareDrawer";import SupplierQuoteSendModal from "./SupplierQuoteSendModal";import SupplierQuoteStatus from "./SupplierQuoteStatus";import SupplierQuoteToOrderDrawer from "./SupplierQuoteToOrderDrawer";@@ -72,12 +74,14 @@ const SupplierQuoteHeader = () => {lines: SupplierQuoteLine[];interaction: SupplierInteraction;prices: SupplierQuoteLinePrice[];+ purchasingRfqs: { id: string; rfqId: string; status: string }[];}>(path.to.supplierQuote(id));const isOutsideProcessing =routeData?.quote?.supplierQuoteType === "Outside Processing";const convertToOrderModal = useDisclosure();+ const compareModal = useDisclosure();const deleteModal = useDisclosure();const shareModal = useDisclosure();const finalizeModal = useDisclosure();@@ -92,6 +96,9 @@ const SupplierQuoteHeader = () => {const editableStatuses = ["Draft", "Declined"];const isEditableStatus = editableStatuses.includes(quoteStatus);+ // Get the first linked RFQ ID for comparison+ const linkedRfqId = routeData?.purchasingRfqs?.[0]?.id ?? null;+const canSend =isEditableStatus && permissions.can("update", "purchasing") && hasLines;@@ -215,6 +222,16 @@ const SupplierQuoteHeader = () => {</Button>)}+ {routeData?.quote?.status === "Active" && linkedRfqId && (+ <Button+ variant="secondary"+ leftIcon={<LuGitCompare />}+ onClick={compareModal.onOpen}+ >+ Compare+ </Button>+ )}+{routeData?.quote?.status === "Draft" && (<statusFetcher.Formmethod="post"@@ -317,6 +334,13 @@ const SupplierQuoteHeader = () => {onClose={shareModal.onClose}isOpen={shareModal.isOpen}/>+ {compareModal.isOpen && linkedRfqId && (+ <SupplierQuoteCompareDrawer+ isOpen={compareModal.isOpen}+ onClose={compareModal.onClose}+ purchasingRfqId={linkedRfqId}+ />+ )}</>);};diff --git a/apps/erp/app/modules/purchasing/ui/SupplierQuote/index.ts b/apps/erp/app/modules/purchasing/ui/SupplierQuote/index.tsindex 9c681eb124..fb6f6492ea 100644--- a/apps/erp/app/modules/purchasing/ui/SupplierQuote/index.ts+++ b/apps/erp/app/modules/purchasing/ui/SupplierQuote/index.ts@@ -1,4 +1,5 @@import DeleteSupplierQuoteLine from "./DeleteSupplierQuoteLine";+import SupplierQuoteCompareDrawer from "./SupplierQuoteCompareDrawer";import SupplierQuoteForm from "./SupplierQuoteForm";import SupplierQuoteHeader from "./SupplierQuoteHeader";import SupplierQuoteLineForm from "./SupplierQuoteLineForm";@@ -9,6 +10,7 @@ import SupplierQuotesTable from "./SupplierQuotesTable";export {DeleteSupplierQuoteLine,+ SupplierQuoteCompareDrawer,SupplierQuoteForm,SupplierQuoteHeader,SupplierQuoteLineForm,diff --git a/apps/erp/app/modules/purchasing/ui/usePurchasingSubmodules.tsx b/apps/erp/app/modules/purchasing/ui/usePurchasingSubmodules.tsxindex 7566ac3fb6..ce272ffcc6 100644--- a/apps/erp/app/modules/purchasing/ui/usePurchasingSubmodules.tsx+++ b/apps/erp/app/modules/purchasing/ui/usePurchasingSubmodules.tsx@@ -1,6 +1,7 @@import {LuContainer,LuCreditCard,+ LuFileText,LuLayoutList,LuPackageSearch,LuShapes,@@ -22,6 +23,12 @@ const purchasingRoutes: AuthenticatedRouteGroup[] = [icon: <LuContainer />,table: "supplier"},+ {+ name: "RFQs",+ to: path.to.purchasingRfqs,+ icon: <LuFileText />,+ table: "purchasingRfq"+ },{name: "Quotes",to: path.to.supplierQuotes,diff --git a/apps/erp/app/routes/x+/purchase-order+/$orderId.details.tsx b/apps/erp/app/routes/x+/purchase-order+/$orderId.details.tsxindex f4f14d2c9b..34cf8c2747 100644--- a/apps/erp/app/routes/x+/purchase-order+/$orderId.details.tsx+++ b/apps/erp/app/routes/x+/purchase-order+/$orderId.details.tsx@@ -122,6 +122,11 @@ export default function PurchaseOrderBasicRoute() {lines: PurchaseOrderLine[];files: Promise<FileObject[]>;interaction: SupplierInteraction;+ purchasingRfqs: {+ id: string;+ rfqId?: string;+ status?: string;+ }[];}>(path.to.purchaseOrder(orderId));if (!orderData) throw new Error("Could not find order data");@@ -183,7 +188,10 @@ export default function PurchaseOrderBasicRoute() {return (<>- <SupplierInteractionState interaction={orderData.interaction} />+ <SupplierInteractionState+ interaction={orderData.interaction}+ purchasingRfqs={orderData.purchasingRfqs ?? []}+ /><PurchaseOrderSummary onEditShippingCost={handleEditShippingCost} /><SupplierInteractionNoteskey={`notes-${initialValues.id}`}diff --git a/apps/erp/app/routes/x+/purchase-order+/$orderId.tsx b/apps/erp/app/routes/x+/purchase-order+/$orderId.tsxindex a8d743e721..17b5be53d9 100644--- a/apps/erp/app/routes/x+/purchase-order+/$orderId.tsx+++ b/apps/erp/app/routes/x+/purchase-order+/$orderId.tsx@@ -6,6 +6,7 @@ import type { LoaderFunctionArgs } from "react-router";import { Outlet, redirect, useParams } from "react-router";import { PanelProvider, ResizablePanels } from "~/components/Layout/Panels";import {+ getLinkedPurchasingRfqsForInteraction,getPurchaseOrder,getPurchaseOrderDelivery,getPurchaseOrderLines,@@ -67,13 +68,23 @@ export async function loader({ request, params }: LoaderFunctionArgs) {throw redirect(path.to.purchaseOrders);}- const [supplier, interaction] = await Promise.all([+ const [supplier, interaction, linkedRfqs] = await Promise.all([purchaseOrder.data?.supplierId? getSupplier(client, purchaseOrder.data.supplierId): null,- getSupplierInteraction(client, purchaseOrder.data.supplierInteractionId)+ getSupplierInteraction(client, purchaseOrder.data.supplierInteractionId),+ purchaseOrder.data.supplierInteractionId+ ? getLinkedPurchasingRfqsForInteraction(+ client,+ purchaseOrder.data.supplierInteractionId+ )+ : { data: [] }]);+ // Extract purchasing RFQs from the linked data+ const purchasingRfqs =+ linkedRfqs.data?.map((link) => link.purchasingRfq).filter(Boolean) ?? [];+return {purchaseOrder: purchaseOrder.data,purchaseOrderDelivery: purchaseOrderDelivery.data,@@ -84,7 +95,8 @@ export async function loader({ request, params }: LoaderFunctionArgs) {purchaseOrder.data.supplierInteractionId!),interaction: interaction?.data,- supplier: supplier?.data ?? null+ supplier: supplier?.data ?? null,+ purchasingRfqs};}diff --git a/apps/erp/app/routes/x+/purchasing+/rfqs.tsx b/apps/erp/app/routes/x+/purchasing+/rfqs.tsxnew file mode 100644index 0000000000..230cd29bcc--- /dev/null+++ b/apps/erp/app/routes/x+/purchasing+/rfqs.tsx@@ -0,0 +1,63 @@+import { error } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { VStack } from "@carbon/react";+import type { LoaderFunctionArgs } from "react-router";+import { Outlet, redirect, useLoaderData } from "react-router";+import { getPurchasingRFQs } from "~/modules/purchasing";+import { PurchasingRFQsTable } from "~/modules/purchasing/ui/PurchasingRfq";+import type { Handle } from "~/utils/handle";+import { path } from "~/utils/path";+import { getGenericQueryFilters } from "~/utils/query";++export const handle: Handle = {+ breadcrumb: "RFQs",+ to: path.to.purchasingRfqs+};++export async function loader({ request }: LoaderFunctionArgs) {+ const { client, companyId } = await requirePermissions(request, {+ view: "purchasing",+ bypassRls: true+ });++ const url = new URL(request.url);+ const searchParams = new URLSearchParams(url.search);+ const search = searchParams.get("search");++ const { limit, offset, sorts, filters } =+ getGenericQueryFilters(searchParams);++ const [rfqs] = await Promise.all([+ getPurchasingRFQs(client, companyId, {+ search,+ limit,+ offset,+ sorts,+ filters+ })+ ]);++ if (rfqs.error) {+ redirect(+ path.to.authenticatedRoot,+ await flash(request, error(rfqs.error, "Failed to fetch RFQs"))+ );+ }++ return {+ count: rfqs.count ?? 0,+ rfqs: rfqs.data ?? []+ };+}++export default function PurchasingRFQsRoute() {+ const { count, rfqs } = useLoaderData<typeof loader>();++ return (+ <VStack spacing={0} className="h-full">+ <PurchasingRFQsTable data={rfqs} count={count} />+ <Outlet />+ </VStack>+ );+}diff --git a/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.$lineId.delete.tsx b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.$lineId.delete.tsxnew file mode 100644index 0000000000..7b06155c35--- /dev/null+++ b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.$lineId.delete.tsx@@ -0,0 +1,31 @@+import { assertIsPost, error } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { type ActionFunctionArgs, redirect } from "react-router";+import { deletePurchasingRFQLine } from "~/modules/purchasing";+import { path } from "~/utils/path";++export async function action({ request, params }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client } = await requirePermissions(request, {+ delete: "purchasing"+ });++ const { rfqId, lineId } = params;+ if (!rfqId) {+ throw new Error("rfqId not found");+ }+ if (!lineId) {+ throw new Error("lineId not found");+ }++ const deleteLine = await deletePurchasingRFQLine(client, lineId);+ if (deleteLine.error) {+ throw redirect(+ path.to.purchasingRfqLine(rfqId, lineId),+ await flash(request, error(deleteLine.error, "Failed to delete RFQ line"))+ );+ }++ throw redirect(path.to.purchasingRfq(rfqId));+}diff --git a/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.$lineId.details.tsx b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.$lineId.details.tsxnew file mode 100644index 0000000000..c8e98bf752--- /dev/null+++ b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.$lineId.details.tsx@@ -0,0 +1,169 @@+import { assertIsPost, error, getCarbonServiceRole } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { validationError, validator } from "@carbon/form";+import type { JSONContent } from "@carbon/react";+import { Spinner } from "@carbon/react";+import { Fragment, Suspense } from "react";+import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";+import {+ Await,+ Outlet,+ redirect,+ useLoaderData,+ useParams+} from "react-router";+import { CadModel } from "~/components";+import { usePermissions } from "~/hooks";+import {+ getPurchasingRFQLine,+ getPurchasingRFQLineDocuments,+ purchasingRfqLineValidator,+ upsertPurchasingRFQLine+} from "~/modules/purchasing";+import {+ PurchasingRFQLineDocuments,+ PurchasingRFQLineForm,+ PurchasingRFQLineNotes+} from "~/modules/purchasing/ui/PurchasingRfq";+import { setCustomFields } from "~/utils/form";+import { path } from "~/utils/path";++export const loader = async ({ request, params }: LoaderFunctionArgs) => {+ const { companyId } = await requirePermissions(request, {+ view: "purchasing"+ });++ const { rfqId, lineId } = params;+ if (!rfqId) throw new Error("Could not find rfqId");+ if (!lineId) throw new Error("Could not find lineId");++ const serviceRole = await getCarbonServiceRole();++ const [line] = await Promise.all([getPurchasingRFQLine(serviceRole, lineId)]);++ if (line.error) {+ throw redirect(+ path.to.purchasingRfq(rfqId),+ await flash(request, error(line.error, "Failed to load line"))+ );+ }++ const itemId = line.data.itemId;++ return {+ line: line.data,+ files: getPurchasingRFQLineDocuments(serviceRole, companyId, lineId, itemId)+ };+};++export async function action({ request, params }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client, companyId, userId } = await requirePermissions(request, {+ update: "purchasing"+ });++ const { rfqId, lineId } = params;+ if (!rfqId) throw new Error("Could not find rfqId");+ if (!lineId) throw new Error("Could not find lineId");++ const formData = await request.formData();++ const validation = await validator(purchasingRfqLineValidator).validate(+ formData+ );++ if (validation.error) {+ return validationError(validation.error);+ }++ // biome-ignore lint/correctness/noUnusedVariables: suppressed due to migration+ const { id, ...d } = validation.data;++ const updateLine = await upsertPurchasingRFQLine(client, {+ id: lineId,+ ...d,+ companyId,+ updatedBy: userId,+ customFields: setCustomFields(formData)+ });++ if (updateLine.error) {+ throw redirect(+ path.to.purchasingRfqLine(rfqId, lineId),+ await flash(request, error(updateLine.error, "Failed to update RFQ line"))+ );+ }++ throw redirect(path.to.purchasingRfqLine(rfqId, lineId));+}++export default function PurchasingRFQLine() {+ const { line, files } = useLoaderData<typeof loader>();++ const permissions = usePermissions();++ const { rfqId, lineId } = useParams();+ if (!rfqId) throw new Error("Could not find rfqId");+ if (!lineId) throw new Error("Could not find lineId");++ const initialValues = {+ ...line,+ id: line.id ?? undefined,+ purchasingRfqId: line.purchasingRfqId ?? "",+ partNumber: line.partNumber ?? "",+ partRevision: line.partRevision ?? "",+ description: line.description ?? "",+ itemId: line.itemId ?? "",+ quantity: line.quantity ?? [1],+ order: line.order ?? 1,+ unitOfMeasureCode: line.unitOfMeasureCode ?? ""+ };++ return (+ <Fragment key={lineId}>+ <PurchasingRFQLineForm key={lineId} initialValues={initialValues} />+ <PurchasingRFQLineNotes+ id={line.id}+ table="purchasingRfqLine"+ title="Notes"+ subTitle={line.partNumber ?? ""}+ internalNotes={line.internalNotes as JSONContent}+ externalNotes={line.externalNotes as JSONContent}+ />++ <Suspense+ fallback={+ <div className="flex w-full h-full rounded bg-gradient-to-tr from-background to-card items-center justify-center">+ <Spinner className="h-10 w-10" />+ </div>+ }+ >+ <Await resolve={files}>+ {(resolvedFiles) => (+ <PurchasingRFQLineDocuments+ files={resolvedFiles ?? []}+ id={rfqId}+ lineId={lineId}+ itemId={line?.itemId}+ type="Request for Quote"+ />+ )}+ </Await>+ </Suspense>+ <CadModel+ isReadOnly={!permissions.can("update", "purchasing")}+ metadata={{+ purchasingRfqLineId: line.id ?? undefined,+ itemId: line.itemId ?? undefined+ }}+ modelPath={line?.modelPath ?? null}+ title="CAD Model"+ uploadClassName="aspect-square min-h-[420px] max-h-[70vh]"+ viewerClassName="aspect-square min-h-[420px] max-h-[70vh]"+ />++ <Outlet />+ </Fragment>+ );+}diff --git a/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.compare.tsx b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.compare.tsxnew file mode 100644index 0000000000..9140cadb17--- /dev/null+++ b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.compare.tsx@@ -0,0 +1,20 @@+import { getCarbonServiceRole } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import type { LoaderFunctionArgs } from "react-router";+import { getSupplierQuotesForComparison } from "~/modules/purchasing";++export async function loader({ request, params }: LoaderFunctionArgs) {+ await requirePermissions(request, { view: "purchasing" });++ const { rfqId } = params;+ if (!rfqId) throw new Error("rfqId not found");++ const serviceRole = getCarbonServiceRole();+ const comparison = await getSupplierQuotesForComparison(serviceRole, rfqId);++ return {+ quotes: comparison.data?.quotes ?? [],+ lines: comparison.data?.lines ?? [],+ prices: comparison.data?.prices ?? []+ };+}diff --git a/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.convert.tsx b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.convert.tsxnew file mode 100644index 0000000000..6eb78acebe--- /dev/null+++ b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.convert.tsx@@ -0,0 +1,150 @@+import { assertIsPost, error, success } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import type { ActionFunctionArgs } from "react-router";+import { redirect } from "react-router";+import {+ getPurchasingRFQ,+ getPurchasingRFQLines,+ getPurchasingRFQSuppliers,+ updatePurchasingRFQStatus,+ upsertSupplierQuote,+ upsertSupplierQuoteLine+} from "~/modules/purchasing";+import { getNextSequence } from "~/modules/settings";+import { path } from "~/utils/path";++export async function action({ request, params }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client, companyId, userId } = await requirePermissions(request, {+ create: "purchasing"+ });++ const { rfqId } = params;+ if (!rfqId) throw new Error("Could not find rfqId");++ // Get RFQ, lines, and suppliers+ const [rfqResult, linesResult, suppliersResult] = await Promise.all([+ getPurchasingRFQ(client, rfqId),+ getPurchasingRFQLines(client, rfqId),+ getPurchasingRFQSuppliers(client, rfqId)+ ]);++ if (rfqResult.error) {+ throw redirect(+ path.to.purchasingRfqDetails(rfqId),+ await flash(request, error(rfqResult.error, "Failed to load RFQ"))+ );+ }++ if (linesResult.error) {+ throw redirect(+ path.to.purchasingRfqDetails(rfqId),+ await flash(request, error(linesResult.error, "Failed to load RFQ lines"))+ );+ }++ if (suppliersResult.error) {+ throw redirect(+ path.to.purchasingRfqDetails(rfqId),+ await flash(+ request,+ error(suppliersResult.error, "Failed to load RFQ suppliers")+ )+ );+ }++ // const rfq = rfqResult.data;+ const lines = linesResult.data ?? [];+ const suppliers = suppliersResult.data ?? [];++ if (suppliers.length === 0) {+ throw redirect(+ path.to.purchasingRfqDetails(rfqId),+ await flash(request, error(null, "No suppliers found for this RFQ"))+ );+ }++ if (lines.length === 0) {+ throw redirect(+ path.to.purchasingRfqDetails(rfqId),+ await flash(request, error(null, "No line items found for this RFQ"))+ );+ }++ // Create a supplier quote for each supplier+ const createdQuotes: string[] = [];++ for (const rfqSupplier of suppliers) {+ const supplierId = rfqSupplier.supplierId;++ // Get next sequence number for the supplier quote+ const sequence = await getNextSequence(client, "supplierQuote", companyId);+ if (sequence.error || !sequence.data) {+ console.error("Failed to get sequence:", sequence.error);+ continue;+ }++ // Create the supplier quote+ const quoteResult = await upsertSupplierQuote(client, {+ supplierQuoteId: sequence.data,+ supplierQuoteType: "Purchase",+ supplierId,+ quotedDate: new Date().toISOString().split("T")[0],+ companyId,+ createdBy: userId+ });++ if (quoteResult.error || !quoteResult.data) {+ console.error("Failed to create supplier quote:", quoteResult.error);+ continue;+ }++ const supplierQuoteId = quoteResult.data.id;+ createdQuotes.push(supplierQuoteId);++ // Create quote lines for each RFQ line that has an itemId+ for (const line of lines) {+ // Skip lines without an itemId since supplierQuoteLine.itemId is NOT NULL+ if (!line.itemId) {+ console.warn("Skipping line without itemId:", line.id);+ continue;+ }++ const uom = line.unitOfMeasureCode ?? "EA";++ await upsertSupplierQuoteLine(client, {+ supplierQuoteId,+ itemId: line.itemId,+ description: line.description ?? "",+ quantity: line.quantity ?? [1],+ inventoryUnitOfMeasureCode: uom,+ purchaseUnitOfMeasureCode: uom,+ companyId,+ createdBy: userId+ });+ }++ // Link RFQ to supplier quote+ await client.from("purchasingRfqToSupplierQuote").insert({+ purchasingRfqId: rfqId,+ supplierQuoteId,+ companyId+ });+ }++ // Update RFQ status to Received+ await updatePurchasingRFQStatus(client, {+ id: rfqId,+ status: "Received",+ updatedBy: userId+ });++ throw redirect(+ path.to.purchasingRfq(rfqId),+ await flash(+ request,+ success(`Created ${createdQuotes.length} supplier quote(s)`)+ )+ );+}diff --git a/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.delete.tsx b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.delete.tsxnew file mode 100644index 0000000000..3713c307d7--- /dev/null+++ b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.delete.tsx@@ -0,0 +1,31 @@+import { assertIsPost, error } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import type { ActionFunctionArgs } from "react-router";+import { data, redirect } from "react-router";+import { deletePurchasingRFQ } from "~/modules/purchasing";+import { path } from "~/utils/path";++export async function action({ request, params }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client } = await requirePermissions(request, {+ delete: "purchasing"+ });++ const { rfqId } = params;+ if (!rfqId) throw new Error("Could not find rfqId");++ const purchasingRfqDelete = await deletePurchasingRFQ(client, rfqId);++ if (purchasingRfqDelete.error) {+ return data(+ path.to.purchasingRfqs,+ await flash(+ request,+ error(purchasingRfqDelete.error, purchasingRfqDelete.error.message)+ )+ );+ }++ throw redirect(path.to.purchasingRfqs);+}diff --git a/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.details.tsx b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.details.tsxnew file mode 100644index 0000000000..4233550eff--- /dev/null+++ b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.details.tsx@@ -0,0 +1,150 @@+import { assertIsPost, error, success } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { validationError, validator } from "@carbon/form";+import type { JSONContent } from "@carbon/react";+import { Spinner, VStack } from "@carbon/react";+import type { FileObject } from "@supabase/storage-js";+import { Suspense } from "react";+import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";+import { Await, redirect, useLoaderData, useParams } from "react-router";+import { useRouteData } from "~/hooks";+import type { PurchasingRFQ, PurchasingRFQLine } from "~/modules/purchasing";+import {+ getPurchasingRFQ,+ purchasingRfqValidator,+ upsertPurchasingRFQ+} from "~/modules/purchasing";+import {+ SupplierInteractionDocuments,+ SupplierInteractionNotes+} from "~/modules/purchasing/ui/SupplierInteraction";+import SupplierInteractionState from "~/modules/purchasing/ui/SupplierInteraction/SupplierInteractionState";+import { setCustomFields } from "~/utils/form";+import { path } from "~/utils/path";++export async function loader({ request, params }: LoaderFunctionArgs) {+ const { client } = await requirePermissions(request, {+ view: "purchasing"+ });++ const { rfqId } = params;+ if (!rfqId) throw new Error("Could not find rfqId");++ const rfq = await getPurchasingRFQ(client, rfqId);+ if (rfq.error) {+ throw redirect(+ path.to.purchasingRfqs,+ await flash(request, error(rfq.error, "Failed to load RFQ"))+ );+ }++ return {+ internalNotes: (rfq.data?.internalNotes ?? {}) as JSONContent,+ externalNotes: (rfq.data?.externalNotes ?? {}) as JSONContent+ };+}++export async function action({ request, params }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client, companyId, userId } = await requirePermissions(request, {+ update: "purchasing"+ });++ const { rfqId: id } = params;+ if (!id) throw new Error("Could not find id");++ const formData = await request.formData();+ const validation = await validator(purchasingRfqValidator).validate(formData);++ if (validation.error) {+ return validationError(validation.error);+ }++ const { rfqId, ...d } = validation.data;+ if (!rfqId) throw new Error("Could not find rfqId");++ const update = await upsertPurchasingRFQ(client, {+ id,+ rfqId,+ ...d,+ companyId,+ customFields: setCustomFields(formData),+ updatedBy: userId+ });+ if (update.error) {+ throw redirect(+ path.to.purchasingRfq(id),+ await flash(request, error(update.error, "Failed to update RFQ"))+ );+ }++ throw redirect(+ path.to.purchasingRfq(id),+ await flash(request, success("Updated RFQ"))+ );+}++type LinkedSupplierQuote = {+ id: string;+ supplierQuoteId?: string;+ revisionId?: number;+ status?: string;+ supplierId?: string;+ supplier?: { name: string } | null;+};++export default function PurchasingRFQDetailsRoute() {+ const { internalNotes, externalNotes } = useLoaderData<typeof loader>();+ const { rfqId } = useParams();+ if (!rfqId) throw new Error("Could not find rfqId");++ const rfqData = useRouteData<{+ rfqSummary: PurchasingRFQ;+ lines: PurchasingRFQLine[];+ files: Promise<FileObject[]>;+ linkedQuotes: LinkedSupplierQuote[];+ }>(path.to.purchasingRfq(rfqId));++ if (!rfqData) throw new Error("Could not find rfq data");++ return (+ <VStack spacing={2}>+ <SupplierInteractionState+ currentRfq={{+ id: rfqData.rfqSummary.id!,+ rfqId: rfqData.rfqSummary.rfqId ?? undefined,+ status: rfqData.rfqSummary.status ?? undefined+ }}+ linkedQuotes={rfqData.linkedQuotes ?? []}+ />+ <SupplierInteractionNotes+ key={`notes-${rfqId}`}+ id={rfqData.rfqSummary.id}+ table="purchasingRfq"+ title="Notes"+ internalNotes={internalNotes}+ externalNotes={externalNotes}+ />+ <Suspense+ key={`documents-${rfqId}`}+ fallback={+ <div className="flex w-full min-h-[480px] h-full rounded bg-gradient-to-tr from-background to-card items-center justify-center">+ <Spinner className="h-10 w-10" />+ </div>+ }+ >+ <Await resolve={rfqData.files}>+ {(resolvedFiles) => (+ <SupplierInteractionDocuments+ interactionId={rfqId}+ attachments={resolvedFiles}+ id={rfqId}+ type="Purchasing RFQ"+ />+ )}+ </Await>+ </Suspense>+ </VStack>+ );+}diff --git a/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.new.tsx b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.new.tsxnew file mode 100644index 0000000000..2bd8265a9c--- /dev/null+++ b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.new.tsx@@ -0,0 +1,58 @@+import { assertIsPost, error } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { validationError, validator } from "@carbon/form";+import { type ActionFunctionArgs, redirect } from "react-router";+import {+ purchasingRfqLineValidator,+ upsertPurchasingRFQLine+} from "~/modules/purchasing";+import { setCustomFields } from "~/utils/form";+import { path } from "~/utils/path";++export async function action({ request, params }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client, companyId, userId } = await requirePermissions(request, {+ create: "purchasing"+ });++ const { rfqId } = params;+ if (!rfqId) {+ throw new Error("rfqId not found");+ }++ const formData = await request.formData();+ const validation = await validator(purchasingRfqLineValidator).validate(+ formData+ );++ if (validation.error) {+ return validationError(validation.error);+ }++ // biome-ignore lint/correctness/noUnusedVariables: suppressed due to migration+ const { id, ...d } = validation.data;++ const insertLine = await upsertPurchasingRFQLine(client, {+ ...d,+ companyId,+ createdBy: userId,+ customFields: setCustomFields(formData)+ });+ if (insertLine.error) {+ throw redirect(+ path.to.purchasingRfq(rfqId),+ await flash(request, error(insertLine.error, "Failed to insert RFQ line"))+ );+ }++ const lineId = insertLine.data?.id;+ if (!lineId) {+ throw redirect(+ path.to.purchasingRfqDetails(rfqId),+ await flash(request, error(insertLine, "Failed to insert RFQ line"))+ );+ }++ throw redirect(path.to.purchasingRfqLine(rfqId, lineId));+}diff --git a/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.status.tsx b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.status.tsxnew file mode 100644index 0000000000..5ff7e71d1c--- /dev/null+++ b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.status.tsx@@ -0,0 +1,51 @@+import { assertIsPost, error, success } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import type { ActionFunctionArgs } from "react-router";+import { redirect } from "react-router";+import {+ purchasingRfqStatusType,+ updatePurchasingRFQStatus+} from "~/modules/purchasing";+import { path } from "~/utils/path";++export async function action({ request, params }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client, userId } = await requirePermissions(request, {+ update: "purchasing"+ });++ const { rfqId: id } = params;+ if (!id) throw new Error("Could not find id");++ const formData = await request.formData();+ const status = formData.get(+ "status"+ ) as (typeof purchasingRfqStatusType)[number];++ if (!status || !purchasingRfqStatusType.includes(status)) {+ throw redirect(+ path.to.purchasingRfq(id),+ await flash(request, error(null, "Invalid status"))+ );+ }++ const update = await updatePurchasingRFQStatus(client, {+ id,+ status,+ assignee: status === "Closed" ? null : undefined,+ updatedBy: userId+ });++ if (update.error) {+ throw redirect(+ path.to.purchasingRfq(id),+ await flash(request, error(update.error, "Failed to update RFQ status"))+ );+ }++ throw redirect(+ path.to.purchasingRfq(id),+ await flash(request, success("Updated RFQ status"))+ );+}diff --git a/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.suppliers.tsx b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.suppliers.tsxnew file mode 100644index 0000000000..befeb330f7--- /dev/null+++ b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.suppliers.tsx@@ -0,0 +1,52 @@+import { assertIsPost, error, success } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { validationError, validator } from "@carbon/form";+import type { ActionFunctionArgs } from "react-router";+import { redirect } from "react-router";+import {+ purchasingRfqSuppliersValidator,+ upsertPurchasingRFQSuppliers+} from "~/modules/purchasing";+import { path } from "~/utils/path";++export async function action({ request, params }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client, companyId, userId } = await requirePermissions(request, {+ update: "purchasing"+ });++ const { rfqId: id } = params;+ if (!id) throw new Error("Could not find id");++ const formData = await request.formData();+ const validation = await validator(purchasingRfqSuppliersValidator).validate(+ formData+ );++ if (validation.error) {+ return validationError(validation.error);+ }++ const { purchasingRfqId, supplierIds } = validation.data;++ const update = await upsertPurchasingRFQSuppliers(+ client,+ purchasingRfqId,+ supplierIds,+ companyId,+ userId+ );++ if (update.error) {+ throw redirect(+ path.to.purchasingRfq(id),+ await flash(request, error(update.error, "Failed to update suppliers"))+ );+ }++ throw redirect(+ path.to.purchasingRfq(id),+ await flash(request, success("Updated suppliers"))+ );+}diff --git a/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.tsx b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.tsxnew file mode 100644index 0000000000..052a2fb8e5--- /dev/null+++ b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.tsx@@ -0,0 +1,114 @@+import { error, getCarbonServiceRole } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { type JSONContent, VStack } from "@carbon/react";+import type { LoaderFunctionArgs } from "react-router";+import { Outlet, redirect, useParams } from "react-router";+import { PanelProvider, ResizablePanels } from "~/components/Layout/Panels";+import type { PurchasingRFQLine } from "~/modules/purchasing";+import {+ getLinkedSupplierQuotes,+ getPurchasingRFQ,+ getPurchasingRFQLines,+ getPurchasingRFQSuppliers,+ getSupplierInteractionDocuments+} from "~/modules/purchasing";+import {+ PurchasingRFQExplorer,+ PurchasingRFQHeader,+ PurchasingRFQProperties+} from "~/modules/purchasing/ui/PurchasingRfq";+import type { Handle } from "~/utils/handle";+import { path } from "~/utils/path";++export const handle: Handle = {+ breadcrumb: "RFQs",+ to: path.to.purchasingRfqs+};++export async function loader({ request, params }: LoaderFunctionArgs) {+ const { companyId } = await requirePermissions(request, {+ view: "purchasing"+ });++ const { rfqId } = params;+ if (!rfqId) throw new Error("Could not find rfqId");++ const serviceRole = await getCarbonServiceRole();++ const [rfqSummary, lines, suppliers, linkedQuotes] = await Promise.all([+ getPurchasingRFQ(serviceRole, rfqId),+ getPurchasingRFQLines(serviceRole, rfqId),+ getPurchasingRFQSuppliers(serviceRole, rfqId),+ getLinkedSupplierQuotes(serviceRole, rfqId)+ ]);++ if (rfqSummary.error) {+ throw redirect(+ path.to.purchasingRfqs,+ await flash(+ request,+ error(rfqSummary.error, "Failed to load purchasing RFQ summary")+ )+ );+ }++ if (lines.error) {+ throw redirect(+ path.to.purchasingRfqs,+ await flash(request, error(lines.error, "Failed to load RFQ lines"))+ );+ }++ // Extract supplier quotes from the linked data+ const supplierQuotes =+ linkedQuotes.data?.map((link) => link.supplierQuote).filter(Boolean) ?? [];++ return {+ rfqSummary: rfqSummary.data,+ lines:+ lines.data.map((line: PurchasingRFQLine) => ({+ ...line,+ id: line.id ?? "",+ order: line.order ?? 0,+ unitOfMeasureCode: line.unitOfMeasureCode ?? "",+ description: line.description ?? "",+ externalNotes: (line.externalNotes ?? {}) as JSONContent,+ internalNotes: (line.internalNotes ?? {}) as JSONContent,+ itemId: line.itemId ?? "",+ quantity: line.quantity ?? [1]+ })) ?? [],+ suppliers: suppliers.data ?? [],+ linkedQuotes: supplierQuotes,+ // Use rfqId as the interaction ID for document storage+ files: getSupplierInteractionDocuments(serviceRole, companyId, rfqId)+ };+}++export default function PurchasingRFQRoute() {+ const { rfqId } = useParams();+ if (!rfqId) throw new Error("Could not find rfqId");++ return (+ <PanelProvider>+ <div className="flex flex-col h-[calc(100dvh-49px)] overflow-hidden w-full">+ <PurchasingRFQHeader />+ <div className="flex h-[calc(100dvh-99px)] overflow-hidden w-full">+ <div className="flex flex-grow overflow-hidden">+ <ResizablePanels+ explorer={<PurchasingRFQExplorer />}+ content={+ <div className="h-[calc(100dvh-99px)] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <VStack spacing={2} className="p-2">+ <Outlet />+ </VStack>+ </div>+ }+ properties={<PurchasingRFQProperties />}+ />+ </div>+ </div>+ </div>+ </PanelProvider>+ );+}diff --git a/apps/erp/app/routes/x+/purchasing-rfq+/new.tsx b/apps/erp/app/routes/x+/purchasing-rfq+/new.tsxnew file mode 100644index 0000000000..57b78f8fc8--- /dev/null+++ b/apps/erp/app/routes/x+/purchasing-rfq+/new.tsx@@ -0,0 +1,126 @@+import { assertIsPost, error } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { validationError, validator } from "@carbon/form";+import { getLocalTimeZone, today } from "@internationalized/date";+import type { ActionFunctionArgs } from "react-router";+import { redirect } from "react-router";+import { useUser } from "~/hooks";+import type { PurchasingRFQStatusType } from "~/modules/purchasing";+import {+ purchasingRfqValidator,+ upsertPurchasingRFQ,+ upsertPurchasingRFQSuppliers+} from "~/modules/purchasing";+import { PurchasingRFQForm } from "~/modules/purchasing/ui/PurchasingRfq";+import { getNextSequence } from "~/modules/settings";+import { setCustomFields } from "~/utils/form";+import type { Handle } from "~/utils/handle";+import { path } from "~/utils/path";++export const handle: Handle = {+ breadcrumb: "RFQs",+ to: path.to.purchasingRfqs+};++export async function action({ request }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client, companyId, userId } = await requirePermissions(request, {+ create: "purchasing"+ });++ const formData = await request.formData();+ const validation = await validator(purchasingRfqValidator).validate(formData);++ if (validation.error) {+ return validationError(validation.error);+ }++ let rfqId = validation.data.rfqId;+ const useNextSequence = !rfqId;++ if (useNextSequence) {+ const nextSequence = await getNextSequence(+ client,+ "purchasingRfq",+ companyId+ );+ if (nextSequence.error) {+ throw redirect(+ path.to.newPurchasingRFQ,+ await flash(+ request,+ error(nextSequence.error, "Failed to get next sequence")+ )+ );+ }+ rfqId = nextSequence.data;+ }++ if (!rfqId) throw new Error("rfqId is not defined");++ // Extract supplier IDs+ const { supplierIds, ...rfqData } = validation.data;++ const createPurchasingRFQ = await upsertPurchasingRFQ(client, {+ ...rfqData,+ rfqId,+ companyId,+ createdBy: userId,+ customFields: setCustomFields(formData)+ });++ if (createPurchasingRFQ.error || !createPurchasingRFQ.data) {+ throw redirect(+ path.to.purchasingRfqs,+ await flash(+ request,+ error(createPurchasingRFQ.error, "Failed to insert RFQ")+ )+ );+ }++ const rfq = createPurchasingRFQ.data;++ // Create supplier associations+ if (supplierIds && supplierIds.length > 0) {+ const suppliersResult = await upsertPurchasingRFQSuppliers(+ client,+ rfq.id,+ supplierIds,+ companyId,+ userId+ );+ if (suppliersResult.error) {+ throw redirect(+ path.to.purchasingRfqs,+ await flash(+ request,+ error(suppliersResult.error, "Failed to assign suppliers")+ )+ );+ }+ }++ throw redirect(path.to.purchasingRfq(rfq.id));+}++export default function PurchasingRFQNewRoute() {+ const { id: userId, defaults } = useUser();+ const initialValues = {+ expirationDate: "",+ id: undefined,+ locationId: defaults?.locationId ?? "",+ rfqDate: today(getLocalTimeZone()).toString(),+ rfqId: undefined,+ status: "Draft" as PurchasingRFQStatusType,+ employeeId: userId,+ supplierIds: [] as string[]+ };++ return (+ <div className="max-w-4xl w-full p-2 sm:p-0 mx-auto mt-0 md:mt-8">+ <PurchasingRFQForm initialValues={initialValues} />+ </div>+ );+}diff --git a/apps/erp/app/routes/x+/supplier-quote+/$id.details.tsx b/apps/erp/app/routes/x+/supplier-quote+/$id.details.tsxindex 52d3bc2305..db460ce1cc 100644--- a/apps/erp/app/routes/x+/supplier-quote+/$id.details.tsx+++ b/apps/erp/app/routes/x+/supplier-quote+/$id.details.tsx@@ -97,6 +97,11 @@ export default function SupplierQuoteDetailsRoute() {quote: SupplierQuote;files: Promise<(FileObject & { quoteLineId: string | null })[]>;interaction: SupplierInteraction;+ purchasingRfqs: {+ id: string;+ rfqId?: string;+ status?: string;+ }[];}>(path.to.supplierQuote(id));if (!routeData) throw new Error("Could not find quote data");@@ -117,7 +122,10 @@ export default function SupplierQuoteDetailsRoute() {return (<>- <SupplierInteractionState interaction={routeData.interaction} />+ <SupplierInteractionState+ interaction={routeData.interaction}+ purchasingRfqs={routeData.purchasingRfqs ?? []}+ /><SupplierQuoteSummary /><SupplierInteractionNoteskey={`notes-${initialValues.id}`}diff --git a/apps/erp/app/routes/x+/supplier-quote+/$id.tsx b/apps/erp/app/routes/x+/supplier-quote+/$id.tsxindex e1d47db362..b7fec7e446 100644--- a/apps/erp/app/routes/x+/supplier-quote+/$id.tsx+++ b/apps/erp/app/routes/x+/supplier-quote+/$id.tsx@@ -7,6 +7,7 @@ import { Outlet, redirect, useParams } from "react-router";import { PanelProvider, ResizablePanels } from "~/components/Layout/Panels";import { getCurrencyByCode } from "~/modules/accounting";import {+ getLinkedPurchasingRfqs,getSupplierInteraction,getSupplierInteractionDocuments,getSupplierQuote,@@ -36,10 +37,11 @@ export async function loader({ request, params }: LoaderFunctionArgs) {if (!id) throw new Error("Could not find id");const serviceRole = await getCarbonServiceRole();- const [quote, lines, prices] = await Promise.all([+ const [quote, lines, prices, linkedRfqs] = await Promise.all([getSupplierQuote(serviceRole, id),getSupplierQuoteLines(serviceRole, id),- getSupplierQuoteLinePricesByQuoteId(serviceRole, id)+ getSupplierQuoteLinePricesByQuoteId(serviceRole, id),+ getLinkedPurchasingRfqs(serviceRole, id)]);if (quote.error) {@@ -72,6 +74,10 @@ export async function loader({ request, params }: LoaderFunctionArgs) {exchangeRate = presentationCurrency.data.exchangeRate;}+ // Extract purchasing RFQs from the linked data+ const purchasingRfqs =+ linkedRfqs.data?.map((link) => link.purchasingRfq).filter(Boolean) ?? [];+return {quote: quote.data,lines: lines.data ?? [],@@ -82,7 +88,8 @@ export async function loader({ request, params }: LoaderFunctionArgs) {quote.data.supplierInteractionId!),interaction: supplierInteraction.data,- exchangeRate+ exchangeRate,+ purchasingRfqs};}diff --git a/apps/erp/app/utils/path.ts b/apps/erp/app/utils/path.tsindex d86ee7f553..dca75f1bae 100644--- a/apps/erp/app/utils/path.ts+++ b/apps/erp/app/utils/path.ts@@ -1413,7 +1413,34 @@ export const path = {salesRfqStatus: (id: string) => generatePath(`${x}/sales-rfq/${id}/status`),salesRfqs: `${x}/sales/rfqs`,salesSettings: `${x}/settings/sales`,++ // Purchasing RFQ paths+ purchasingRfq: (id: string) => generatePath(`${x}/purchasing-rfq/${id}/d`),+ purchasingRfqDetails: (id: string) =>+ generatePath(`${x}/purchasing-rfq/${id}/details`),+ purchasingRfqFavorite: `${x}/purchasing/rfqs/favorite`,+ purchasingRfqLine: (id: string, lineId: string) =>+ generatePath(`${x}/purchasing-rfq/${id}/${lineId}/details`),+ purchasingRfqRoot: `${x}/purchasing-rfq`,+ purchasingRfqStatus: (id: string) =>+ generatePath(`${x}/purchasing-rfq/${id}/status`),+ purchasingRfqs: `${x}/purchasing/rfqs`,+ newPurchasingRFQ: `${x}/purchasing-rfq/new`,+ newPurchasingRFQLine: (id: string) =>+ generatePath(`${x}/purchasing-rfq/${id}/new`),+ deletePurchasingRfq: (id: string) =>+ generatePath(`${x}/purchasing-rfq/${id}/delete`),+ deletePurchasingRfqLine: (id: string, lineId: string) =>+ generatePath(`${x}/purchasing-rfq/${id}/${lineId}/delete`),+ purchasingRfqConvert: (id: string) =>+ generatePath(`${x}/purchasing-rfq/${id}/convert`),+ purchasingRfqCompare: (id: string) =>+ generatePath(`${x}/purchasing-rfq/${id}/compare`),+ purchasingRfqSuppliers: (id: string) =>+ generatePath(`${x}/purchasing-rfq/${id}/suppliers`),+saveViews: `${x}/shared/views`,+saveViewOrder: `${x}/shared/view/order`,scheduleOperation: `${x}/schedule/operations`,scheduleOperationUpdate: `${x}/schedule/operations/update`,diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.tsindex bbb499b68a..961df6fb0a 100644--- a/packages/database/src/swagger-docs-schema.ts+++ b/packages/database/src/swagger-docs-schema.ts@@ -408,6 +408,114 @@ export default {tags: ["accountCategory"],},},+ "/purchasingRfqLines": {+ get: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.id",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.purchasingRfqId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.itemId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.partNumber",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.partRevision",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.description",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.quantity",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.unitOfMeasureCode",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.order",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.internalNotes",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.externalNotes",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.customFields",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.updatedBy",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.itemName",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.itemReadableId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.itemType",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.thumbnailPath",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLines.modelPath",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/order",+ },+ {+ $ref: "#/parameters/range",+ },+ {+ $ref: "#/parameters/rangeUnit",+ },+ {+ $ref: "#/parameters/offset",+ },+ {+ $ref: "#/parameters/limit",+ },+ {+ $ref: "#/parameters/preferCount",+ },+ ],+ responses: {+ "200": {+ description: "OK",+ schema: {+ items: {+ $ref: "#/definitions/purchasingRfqLines",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",+ },+ },+ tags: ["purchasingRfqLines"],+ },+ },"/noQuoteReason": {get: {parameters: [@@ -12159,6 +12267,249 @@ export default {tags: ["department"],},},+ "/purchasingRfqLine": {+ get: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.id",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.purchasingRfqId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.itemId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.partNumber",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.partRevision",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.description",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.quantity",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.unitOfMeasureCode",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.order",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.internalNotes",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.externalNotes",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.customFields",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.updatedBy",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/order",+ },+ {+ $ref: "#/parameters/range",+ },+ {+ $ref: "#/parameters/rangeUnit",+ },+ {+ $ref: "#/parameters/offset",+ },+ {+ $ref: "#/parameters/limit",+ },+ {+ $ref: "#/parameters/preferCount",+ },+ ],+ responses: {+ "200": {+ description: "OK",+ schema: {+ items: {+ $ref: "#/definitions/purchasingRfqLine",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",+ },+ },+ tags: ["purchasingRfqLine"],+ },+ post: {+ parameters: [+ {+ $ref: "#/parameters/body.purchasingRfqLine",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/preferPost",+ },+ ],+ responses: {+ "201": {+ description: "Created",+ },+ },+ tags: ["purchasingRfqLine"],+ },+ delete: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.id",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.purchasingRfqId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.itemId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.partNumber",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.partRevision",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.description",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.quantity",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.unitOfMeasureCode",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.order",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.internalNotes",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.externalNotes",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.customFields",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.updatedBy",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["purchasingRfqLine"],+ },+ patch: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.id",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.purchasingRfqId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.itemId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.partNumber",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.partRevision",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.description",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.quantity",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.unitOfMeasureCode",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.order",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.internalNotes",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.externalNotes",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.customFields",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqLine.updatedBy",+ },+ {+ $ref: "#/parameters/body.purchasingRfqLine",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["purchasingRfqLine"],+ },+ },"/salesInvoiceLocations": {get: {parameters: [@@ -13218,6 +13569,9 @@ export default {{$ref: "#/parameters/rowFilter.configurationParameter.updatedBy",},+ {+ $ref: "#/parameters/rowFilter.configurationParameter.materialFormFilterId",+ },{$ref: "#/parameters/select",},@@ -13316,6 +13670,9 @@ export default {{$ref: "#/parameters/rowFilter.configurationParameter.updatedBy",},+ {+ $ref: "#/parameters/rowFilter.configurationParameter.materialFormFilterId",+ },{$ref: "#/parameters/preferReturn",},@@ -13368,6 +13725,9 @@ export default {{$ref: "#/parameters/rowFilter.configurationParameter.updatedBy",},+ {+ $ref: "#/parameters/rowFilter.configurationParameter.materialFormFilterId",+ },{$ref: "#/parameters/body.configurationParameter",},@@ -15687,65 +16047,59 @@ export default {tags: ["supplierShipping"],},},- "/workCenters": {+ "/purchasingRfq": {get: {parameters: [{- $ref: "#/parameters/rowFilter.workCenters.id",+ $ref: "#/parameters/rowFilter.purchasingRfq.id",},{- $ref: "#/parameters/rowFilter.workCenters.name",+ $ref: "#/parameters/rowFilter.purchasingRfq.rfqId",},{- $ref: "#/parameters/rowFilter.workCenters.description",- },- {- $ref: "#/parameters/rowFilter.workCenters.laborRate",+ $ref: "#/parameters/rowFilter.purchasingRfq.revisionId",},{- $ref: "#/parameters/rowFilter.workCenters.defaultStandardFactor",- },- {- $ref: "#/parameters/rowFilter.workCenters.locationId",+ $ref: "#/parameters/rowFilter.purchasingRfq.status",},{- $ref: "#/parameters/rowFilter.workCenters.requiredAbilityId",+ $ref: "#/parameters/rowFilter.purchasingRfq.employeeId",},{- $ref: "#/parameters/rowFilter.workCenters.active",+ $ref: "#/parameters/rowFilter.purchasingRfq.rfqDate",},{- $ref: "#/parameters/rowFilter.workCenters.companyId",+ $ref: "#/parameters/rowFilter.purchasingRfq.expirationDate",},{- $ref: "#/parameters/rowFilter.workCenters.customFields",+ $ref: "#/parameters/rowFilter.purchasingRfq.internalNotes",},{- $ref: "#/parameters/rowFilter.workCenters.createdBy",+ $ref: "#/parameters/rowFilter.purchasingRfq.notes",},{- $ref: "#/parameters/rowFilter.workCenters.createdAt",+ $ref: "#/parameters/rowFilter.purchasingRfq.locationId",},{- $ref: "#/parameters/rowFilter.workCenters.updatedBy",+ $ref: "#/parameters/rowFilter.purchasingRfq.assignee",},{- $ref: "#/parameters/rowFilter.workCenters.updatedAt",+ $ref: "#/parameters/rowFilter.purchasingRfq.companyId",},{- $ref: "#/parameters/rowFilter.workCenters.machineRate",+ $ref: "#/parameters/rowFilter.purchasingRfq.customFields",},{- $ref: "#/parameters/rowFilter.workCenters.overheadRate",+ $ref: "#/parameters/rowFilter.purchasingRfq.createdAt",},{- $ref: "#/parameters/rowFilter.workCenters.tags",+ $ref: "#/parameters/rowFilter.purchasingRfq.createdBy",},{- $ref: "#/parameters/rowFilter.workCenters.locationName",+ $ref: "#/parameters/rowFilter.purchasingRfq.updatedAt",},{- $ref: "#/parameters/rowFilter.workCenters.processes",+ $ref: "#/parameters/rowFilter.purchasingRfq.updatedBy",},{$ref: "#/parameters/select",@@ -15774,7 +16128,7 @@ export default {description: "OK",schema: {items: {- $ref: "#/definitions/workCenters",+ $ref: "#/definitions/purchasingRfq",},type: "array",},@@ -15783,66 +16137,12 @@ export default {description: "Partial Content",},},- tags: ["workCenters"],- },- },- "/contractorAbility": {- get: {- parameters: [- {- $ref: "#/parameters/rowFilter.contractorAbility.contractorId",- },- {- $ref: "#/parameters/rowFilter.contractorAbility.abilityId",- },- {- $ref: "#/parameters/rowFilter.contractorAbility.createdBy",- },- {- $ref: "#/parameters/rowFilter.contractorAbility.createdAt",- },- {- $ref: "#/parameters/select",- },- {- $ref: "#/parameters/order",- },- {- $ref: "#/parameters/range",- },- {- $ref: "#/parameters/rangeUnit",- },- {- $ref: "#/parameters/offset",- },- {- $ref: "#/parameters/limit",- },- {- $ref: "#/parameters/preferCount",- },- ],- responses: {- "200": {- description: "OK",- schema: {- items: {- $ref: "#/definitions/contractorAbility",- },- type: "array",- },- },- "206": {- description: "Partial Content",- },- },- tags: ["contractorAbility"],+ tags: ["purchasingRfq"],},post: {parameters: [{- $ref: "#/parameters/body.contractorAbility",+ $ref: "#/parameters/body.purchasingRfq",},{$ref: "#/parameters/select",@@ -15856,189 +16156,127 @@ export default {description: "Created",},},- tags: ["contractorAbility"],+ tags: ["purchasingRfq"],},delete: {parameters: [{- $ref: "#/parameters/rowFilter.contractorAbility.contractorId",- },- {- $ref: "#/parameters/rowFilter.contractorAbility.abilityId",- },- {- $ref: "#/parameters/rowFilter.contractorAbility.createdBy",+ $ref: "#/parameters/rowFilter.purchasingRfq.id",},{- $ref: "#/parameters/rowFilter.contractorAbility.createdAt",+ $ref: "#/parameters/rowFilter.purchasingRfq.rfqId",},{- $ref: "#/parameters/preferReturn",- },- ],- responses: {- "204": {- description: "No Content",+ $ref: "#/parameters/rowFilter.purchasingRfq.revisionId",},- },- tags: ["contractorAbility"],- },- patch: {- parameters: [{- $ref: "#/parameters/rowFilter.contractorAbility.contractorId",+ $ref: "#/parameters/rowFilter.purchasingRfq.status",},{- $ref: "#/parameters/rowFilter.contractorAbility.abilityId",+ $ref: "#/parameters/rowFilter.purchasingRfq.employeeId",},{- $ref: "#/parameters/rowFilter.contractorAbility.createdBy",+ $ref: "#/parameters/rowFilter.purchasingRfq.rfqDate",},{- $ref: "#/parameters/rowFilter.contractorAbility.createdAt",+ $ref: "#/parameters/rowFilter.purchasingRfq.expirationDate",},{- $ref: "#/parameters/body.contractorAbility",+ $ref: "#/parameters/rowFilter.purchasingRfq.internalNotes",},{- $ref: "#/parameters/preferReturn",+ $ref: "#/parameters/rowFilter.purchasingRfq.notes",},- ],- responses: {- "204": {- description: "No Content",- },- },- tags: ["contractorAbility"],- },- },- "/trainingCompletion": {- get: {- parameters: [{- $ref: "#/parameters/rowFilter.trainingCompletion.id",+ $ref: "#/parameters/rowFilter.purchasingRfq.locationId",},{- $ref: "#/parameters/rowFilter.trainingCompletion.trainingAssignmentId",+ $ref: "#/parameters/rowFilter.purchasingRfq.assignee",},{- $ref: "#/parameters/rowFilter.trainingCompletion.employeeId",+ $ref: "#/parameters/rowFilter.purchasingRfq.companyId",},{- $ref: "#/parameters/rowFilter.trainingCompletion.companyId",+ $ref: "#/parameters/rowFilter.purchasingRfq.customFields",},{- $ref: "#/parameters/rowFilter.trainingCompletion.completedAt",+ $ref: "#/parameters/rowFilter.purchasingRfq.createdAt",},{- $ref: "#/parameters/rowFilter.trainingCompletion.completedBy",+ $ref: "#/parameters/rowFilter.purchasingRfq.createdBy",},{- $ref: "#/parameters/rowFilter.trainingCompletion.createdAt",+ $ref: "#/parameters/rowFilter.purchasingRfq.updatedAt",},{- $ref: "#/parameters/rowFilter.trainingCompletion.createdBy",+ $ref: "#/parameters/rowFilter.purchasingRfq.updatedBy",},{- $ref: "#/parameters/rowFilter.trainingCompletion.updatedAt",- },- {- $ref: "#/parameters/rowFilter.trainingCompletion.updatedBy",- },- {- $ref: "#/parameters/rowFilter.trainingCompletion.period",- },- {- $ref: "#/parameters/select",- },- {- $ref: "#/parameters/order",+ $ref: "#/parameters/preferReturn",},- {- $ref: "#/parameters/range",+ ],+ responses: {+ "204": {+ description: "No Content",},+ },+ tags: ["purchasingRfq"],+ },+ patch: {+ parameters: [{- $ref: "#/parameters/rangeUnit",+ $ref: "#/parameters/rowFilter.purchasingRfq.id",},{- $ref: "#/parameters/offset",+ $ref: "#/parameters/rowFilter.purchasingRfq.rfqId",},{- $ref: "#/parameters/limit",+ $ref: "#/parameters/rowFilter.purchasingRfq.revisionId",},{- $ref: "#/parameters/preferCount",- },- ],- responses: {- "200": {- description: "OK",- schema: {- items: {- $ref: "#/definitions/trainingCompletion",- },- type: "array",- },- },- "206": {- description: "Partial Content",+ $ref: "#/parameters/rowFilter.purchasingRfq.status",},- },- tags: ["trainingCompletion"],- },- post: {- parameters: [{- $ref: "#/parameters/body.trainingCompletion",+ $ref: "#/parameters/rowFilter.purchasingRfq.employeeId",},{- $ref: "#/parameters/select",+ $ref: "#/parameters/rowFilter.purchasingRfq.rfqDate",},{- $ref: "#/parameters/preferPost",+ $ref: "#/parameters/rowFilter.purchasingRfq.expirationDate",},- ],- responses: {- "201": {- description: "Created",- },- },- tags: ["trainingCompletion"],- },- delete: {- parameters: [{- $ref: "#/parameters/rowFilter.trainingCompletion.id",+ $ref: "#/parameters/rowFilter.purchasingRfq.internalNotes",},{- $ref: "#/parameters/rowFilter.trainingCompletion.trainingAssignmentId",+ $ref: "#/parameters/rowFilter.purchasingRfq.notes",},{- $ref: "#/parameters/rowFilter.trainingCompletion.employeeId",+ $ref: "#/parameters/rowFilter.purchasingRfq.locationId",},{- $ref: "#/parameters/rowFilter.trainingCompletion.companyId",+ $ref: "#/parameters/rowFilter.purchasingRfq.assignee",},{- $ref: "#/parameters/rowFilter.trainingCompletion.completedAt",+ $ref: "#/parameters/rowFilter.purchasingRfq.companyId",},{- $ref: "#/parameters/rowFilter.trainingCompletion.completedBy",+ $ref: "#/parameters/rowFilter.purchasingRfq.customFields",},{- $ref: "#/parameters/rowFilter.trainingCompletion.createdAt",+ $ref: "#/parameters/rowFilter.purchasingRfq.createdAt",},{- $ref: "#/parameters/rowFilter.trainingCompletion.createdBy",+ $ref: "#/parameters/rowFilter.purchasingRfq.createdBy",},{- $ref: "#/parameters/rowFilter.trainingCompletion.updatedAt",+ $ref: "#/parameters/rowFilter.purchasingRfq.updatedAt",},{- $ref: "#/parameters/rowFilter.trainingCompletion.updatedBy",+ $ref: "#/parameters/rowFilter.purchasingRfq.updatedBy",},{- $ref: "#/parameters/rowFilter.trainingCompletion.period",+ $ref: "#/parameters/body.purchasingRfq",},{$ref: "#/parameters/preferReturn",@@ -16049,84 +16287,449 @@ export default {description: "No Content",},},- tags: ["trainingCompletion"],+ tags: ["purchasingRfq"],},- patch: {+ },+ "/workCenters": {+ get: {parameters: [{- $ref: "#/parameters/rowFilter.trainingCompletion.id",- },- {- $ref: "#/parameters/rowFilter.trainingCompletion.trainingAssignmentId",- },- {- $ref: "#/parameters/rowFilter.trainingCompletion.employeeId",+ $ref: "#/parameters/rowFilter.workCenters.id",},{- $ref: "#/parameters/rowFilter.trainingCompletion.companyId",+ $ref: "#/parameters/rowFilter.workCenters.name",},{- $ref: "#/parameters/rowFilter.trainingCompletion.completedAt",+ $ref: "#/parameters/rowFilter.workCenters.description",},{- $ref: "#/parameters/rowFilter.trainingCompletion.completedBy",+ $ref: "#/parameters/rowFilter.workCenters.laborRate",},{- $ref: "#/parameters/rowFilter.trainingCompletion.createdAt",+ $ref: "#/parameters/rowFilter.workCenters.defaultStandardFactor",},{- $ref: "#/parameters/rowFilter.trainingCompletion.createdBy",+ $ref: "#/parameters/rowFilter.workCenters.locationId",},{- $ref: "#/parameters/rowFilter.trainingCompletion.updatedAt",+ $ref: "#/parameters/rowFilter.workCenters.requiredAbilityId",},{- $ref: "#/parameters/rowFilter.trainingCompletion.updatedBy",+ $ref: "#/parameters/rowFilter.workCenters.active",},{- $ref: "#/parameters/rowFilter.trainingCompletion.period",+ $ref: "#/parameters/rowFilter.workCenters.companyId",},{- $ref: "#/parameters/body.trainingCompletion",+ $ref: "#/parameters/rowFilter.workCenters.customFields",},{- $ref: "#/parameters/preferReturn",- },- ],- responses: {- "204": {- description: "No Content",+ $ref: "#/parameters/rowFilter.workCenters.createdBy",},- },- tags: ["trainingCompletion"],- },- },- "/nonConformanceCustomer": {- get: {- parameters: [{- $ref: "#/parameters/rowFilter.nonConformanceCustomer.id",+ $ref: "#/parameters/rowFilter.workCenters.createdAt",},{- $ref: "#/parameters/rowFilter.nonConformanceCustomer.nonConformanceId",+ $ref: "#/parameters/rowFilter.workCenters.updatedBy",},{- $ref: "#/parameters/rowFilter.nonConformanceCustomer.customerId",+ $ref: "#/parameters/rowFilter.workCenters.updatedAt",},{- $ref: "#/parameters/rowFilter.nonConformanceCustomer.companyId",+ $ref: "#/parameters/rowFilter.workCenters.machineRate",},{- $ref: "#/parameters/rowFilter.nonConformanceCustomer.createdAt",+ $ref: "#/parameters/rowFilter.workCenters.overheadRate",},{- $ref: "#/parameters/rowFilter.nonConformanceCustomer.createdBy",+ $ref: "#/parameters/rowFilter.workCenters.tags",},{- $ref: "#/parameters/rowFilter.nonConformanceCustomer.updatedAt",+ $ref: "#/parameters/rowFilter.workCenters.locationName",},{- $ref: "#/parameters/rowFilter.nonConformanceCustomer.updatedBy",+ $ref: "#/parameters/rowFilter.workCenters.processes",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/order",+ },+ {+ $ref: "#/parameters/range",+ },+ {+ $ref: "#/parameters/rangeUnit",+ },+ {+ $ref: "#/parameters/offset",+ },+ {+ $ref: "#/parameters/limit",+ },+ {+ $ref: "#/parameters/preferCount",+ },+ ],+ responses: {+ "200": {+ description: "OK",+ schema: {+ items: {+ $ref: "#/definitions/workCenters",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",+ },+ },+ tags: ["workCenters"],+ },+ },+ "/contractorAbility": {+ get: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.contractorAbility.contractorId",+ },+ {+ $ref: "#/parameters/rowFilter.contractorAbility.abilityId",+ },+ {+ $ref: "#/parameters/rowFilter.contractorAbility.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.contractorAbility.createdAt",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/order",+ },+ {+ $ref: "#/parameters/range",+ },+ {+ $ref: "#/parameters/rangeUnit",+ },+ {+ $ref: "#/parameters/offset",+ },+ {+ $ref: "#/parameters/limit",+ },+ {+ $ref: "#/parameters/preferCount",+ },+ ],+ responses: {+ "200": {+ description: "OK",+ schema: {+ items: {+ $ref: "#/definitions/contractorAbility",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",+ },+ },+ tags: ["contractorAbility"],+ },+ post: {+ parameters: [+ {+ $ref: "#/parameters/body.contractorAbility",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/preferPost",+ },+ ],+ responses: {+ "201": {+ description: "Created",+ },+ },+ tags: ["contractorAbility"],+ },+ delete: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.contractorAbility.contractorId",+ },+ {+ $ref: "#/parameters/rowFilter.contractorAbility.abilityId",+ },+ {+ $ref: "#/parameters/rowFilter.contractorAbility.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.contractorAbility.createdAt",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["contractorAbility"],+ },+ patch: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.contractorAbility.contractorId",+ },+ {+ $ref: "#/parameters/rowFilter.contractorAbility.abilityId",+ },+ {+ $ref: "#/parameters/rowFilter.contractorAbility.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.contractorAbility.createdAt",+ },+ {+ $ref: "#/parameters/body.contractorAbility",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["contractorAbility"],+ },+ },+ "/trainingCompletion": {+ get: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.id",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.trainingAssignmentId",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.employeeId",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.completedAt",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.completedBy",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.updatedBy",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.period",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/order",+ },+ {+ $ref: "#/parameters/range",+ },+ {+ $ref: "#/parameters/rangeUnit",+ },+ {+ $ref: "#/parameters/offset",+ },+ {+ $ref: "#/parameters/limit",+ },+ {+ $ref: "#/parameters/preferCount",+ },+ ],+ responses: {+ "200": {+ description: "OK",+ schema: {+ items: {+ $ref: "#/definitions/trainingCompletion",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",+ },+ },+ tags: ["trainingCompletion"],+ },+ post: {+ parameters: [+ {+ $ref: "#/parameters/body.trainingCompletion",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/preferPost",+ },+ ],+ responses: {+ "201": {+ description: "Created",+ },+ },+ tags: ["trainingCompletion"],+ },+ delete: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.id",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.trainingAssignmentId",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.employeeId",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.completedAt",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.completedBy",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.updatedBy",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.period",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["trainingCompletion"],+ },+ patch: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.id",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.trainingAssignmentId",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.employeeId",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.completedAt",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.completedBy",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.updatedBy",+ },+ {+ $ref: "#/parameters/rowFilter.trainingCompletion.period",+ },+ {+ $ref: "#/parameters/body.trainingCompletion",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["trainingCompletion"],+ },+ },+ "/nonConformanceCustomer": {+ get: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.nonConformanceCustomer.id",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceCustomer.nonConformanceId",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceCustomer.customerId",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceCustomer.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceCustomer.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceCustomer.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceCustomer.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceCustomer.updatedBy",},{$ref: "#/parameters/select",@@ -16911,7 +17514,169 @@ export default {description: "OK",schema: {items: {- $ref: "#/definitions/suggestion",+ $ref: "#/definitions/suggestion",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",+ },+ },+ tags: ["suggestion"],+ },+ post: {+ parameters: [+ {+ $ref: "#/parameters/body.suggestion",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/preferPost",+ },+ ],+ responses: {+ "201": {+ description: "Created",+ },+ },+ tags: ["suggestion"],+ },+ delete: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.suggestion.id",+ },+ {+ $ref: "#/parameters/rowFilter.suggestion.suggestion",+ },+ {+ $ref: "#/parameters/rowFilter.suggestion.emoji",+ },+ {+ $ref: "#/parameters/rowFilter.suggestion.path",+ },+ {+ $ref: "#/parameters/rowFilter.suggestion.attachmentPath",+ },+ {+ $ref: "#/parameters/rowFilter.suggestion.tags",+ },+ {+ $ref: "#/parameters/rowFilter.suggestion.userId",+ },+ {+ $ref: "#/parameters/rowFilter.suggestion.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.suggestion.createdAt",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["suggestion"],+ },+ patch: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.suggestion.id",+ },+ {+ $ref: "#/parameters/rowFilter.suggestion.suggestion",+ },+ {+ $ref: "#/parameters/rowFilter.suggestion.emoji",+ },+ {+ $ref: "#/parameters/rowFilter.suggestion.path",+ },+ {+ $ref: "#/parameters/rowFilter.suggestion.attachmentPath",+ },+ {+ $ref: "#/parameters/rowFilter.suggestion.tags",+ },+ {+ $ref: "#/parameters/rowFilter.suggestion.userId",+ },+ {+ $ref: "#/parameters/rowFilter.suggestion.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.suggestion.createdAt",+ },+ {+ $ref: "#/parameters/body.suggestion",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["suggestion"],+ },+ },+ "/purchasingRfqSupplier": {+ get: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.id",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.purchasingRfqId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.supplierId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.createdBy",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/order",+ },+ {+ $ref: "#/parameters/range",+ },+ {+ $ref: "#/parameters/rangeUnit",+ },+ {+ $ref: "#/parameters/offset",+ },+ {+ $ref: "#/parameters/limit",+ },+ {+ $ref: "#/parameters/preferCount",+ },+ ],+ responses: {+ "200": {+ description: "OK",+ schema: {+ items: {+ $ref: "#/definitions/purchasingRfqSupplier",},type: "array",},@@ -16920,12 +17685,12 @@ export default {description: "Partial Content",},},- tags: ["suggestion"],+ tags: ["purchasingRfqSupplier"],},post: {parameters: [{- $ref: "#/parameters/body.suggestion",+ $ref: "#/parameters/body.purchasingRfqSupplier",},{$ref: "#/parameters/select",@@ -16939,36 +17704,27 @@ export default {description: "Created",},},- tags: ["suggestion"],+ tags: ["purchasingRfqSupplier"],},delete: {parameters: [{- $ref: "#/parameters/rowFilter.suggestion.id",- },- {- $ref: "#/parameters/rowFilter.suggestion.suggestion",+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.id",},{- $ref: "#/parameters/rowFilter.suggestion.emoji",- },- {- $ref: "#/parameters/rowFilter.suggestion.path",+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.purchasingRfqId",},{- $ref: "#/parameters/rowFilter.suggestion.attachmentPath",- },- {- $ref: "#/parameters/rowFilter.suggestion.tags",+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.supplierId",},{- $ref: "#/parameters/rowFilter.suggestion.userId",+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.companyId",},{- $ref: "#/parameters/rowFilter.suggestion.companyId",+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.createdAt",},{- $ref: "#/parameters/rowFilter.suggestion.createdAt",+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.createdBy",},{$ref: "#/parameters/preferReturn",@@ -16979,39 +17735,30 @@ export default {description: "No Content",},},- tags: ["suggestion"],+ tags: ["purchasingRfqSupplier"],},patch: {parameters: [{- $ref: "#/parameters/rowFilter.suggestion.id",- },- {- $ref: "#/parameters/rowFilter.suggestion.suggestion",- },- {- $ref: "#/parameters/rowFilter.suggestion.emoji",+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.id",},{- $ref: "#/parameters/rowFilter.suggestion.path",+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.purchasingRfqId",},{- $ref: "#/parameters/rowFilter.suggestion.attachmentPath",+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.supplierId",},{- $ref: "#/parameters/rowFilter.suggestion.tags",+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.companyId",},{- $ref: "#/parameters/rowFilter.suggestion.userId",- },- {- $ref: "#/parameters/rowFilter.suggestion.companyId",+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.createdAt",},{- $ref: "#/parameters/rowFilter.suggestion.createdAt",+ $ref: "#/parameters/rowFilter.purchasingRfqSupplier.createdBy",},{- $ref: "#/parameters/body.suggestion",+ $ref: "#/parameters/body.purchasingRfqSupplier",},{$ref: "#/parameters/preferReturn",@@ -17022,7 +17769,7 @@ export default {description: "No Content",},},- tags: ["suggestion"],+ tags: ["purchasingRfqSupplier"],},},"/demandActual": {@@ -22698,7 +23445,226 @@ export default {description: "OK",schema: {items: {- $ref: "#/definitions/nonConformanceWorkflow",+ $ref: "#/definitions/nonConformanceWorkflow",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",+ },+ },+ tags: ["nonConformanceWorkflow"],+ },+ post: {+ parameters: [+ {+ $ref: "#/parameters/body.nonConformanceWorkflow",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/preferPost",+ },+ ],+ responses: {+ "201": {+ description: "Created",+ },+ },+ tags: ["nonConformanceWorkflow"],+ },+ delete: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.id",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.name",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.description",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.content",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.priority",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.source",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.approvalRequirements",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.active",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.tags",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.updatedBy",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.requiredActionIds",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["nonConformanceWorkflow"],+ },+ patch: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.id",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.name",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.description",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.content",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.priority",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.source",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.approvalRequirements",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.active",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.tags",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.updatedBy",+ },+ {+ $ref: "#/parameters/rowFilter.nonConformanceWorkflow.requiredActionIds",+ },+ {+ $ref: "#/parameters/body.nonConformanceWorkflow",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["nonConformanceWorkflow"],+ },+ },+ "/qualityDocument": {+ get: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.qualityDocument.id",+ },+ {+ $ref: "#/parameters/rowFilter.qualityDocument.name",+ },+ {+ $ref: "#/parameters/rowFilter.qualityDocument.description",+ },+ {+ $ref: "#/parameters/rowFilter.qualityDocument.version",+ },+ {+ $ref: "#/parameters/rowFilter.qualityDocument.status",+ },+ {+ $ref: "#/parameters/rowFilter.qualityDocument.content",+ },+ {+ $ref: "#/parameters/rowFilter.qualityDocument.assignee",+ },+ {+ $ref: "#/parameters/rowFilter.qualityDocument.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.qualityDocument.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.qualityDocument.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.qualityDocument.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.qualityDocument.updatedBy",+ },+ {+ $ref: "#/parameters/rowFilter.qualityDocument.tags",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/order",+ },+ {+ $ref: "#/parameters/range",+ },+ {+ $ref: "#/parameters/rangeUnit",+ },+ {+ $ref: "#/parameters/offset",+ },+ {+ $ref: "#/parameters/limit",+ },+ {+ $ref: "#/parameters/preferCount",+ },+ ],+ responses: {+ "200": {+ description: "OK",+ schema: {+ items: {+ $ref: "#/definitions/qualityDocument",},type: "array",},@@ -22707,12 +23673,12 @@ export default {description: "Partial Content",},},- tags: ["nonConformanceWorkflow"],+ tags: ["qualityDocument"],},post: {parameters: [{- $ref: "#/parameters/body.nonConformanceWorkflow",+ $ref: "#/parameters/body.qualityDocument",},{$ref: "#/parameters/select",@@ -22726,54 +23692,48 @@ export default {description: "Created",},},- tags: ["nonConformanceWorkflow"],+ tags: ["qualityDocument"],},delete: {parameters: [{- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.id",- },- {- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.name",- },- {- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.description",+ $ref: "#/parameters/rowFilter.qualityDocument.id",},{- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.content",+ $ref: "#/parameters/rowFilter.qualityDocument.name",},{- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.priority",+ $ref: "#/parameters/rowFilter.qualityDocument.description",},{- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.source",+ $ref: "#/parameters/rowFilter.qualityDocument.version",},{- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.approvalRequirements",+ $ref: "#/parameters/rowFilter.qualityDocument.status",},{- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.active",+ $ref: "#/parameters/rowFilter.qualityDocument.content",},{- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.tags",+ $ref: "#/parameters/rowFilter.qualityDocument.assignee",},{- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.companyId",+ $ref: "#/parameters/rowFilter.qualityDocument.companyId",},{- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.createdAt",+ $ref: "#/parameters/rowFilter.qualityDocument.createdAt",},{- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.createdBy",+ $ref: "#/parameters/rowFilter.qualityDocument.createdBy",},{- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.updatedAt",+ $ref: "#/parameters/rowFilter.qualityDocument.updatedAt",},{- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.updatedBy",+ $ref: "#/parameters/rowFilter.qualityDocument.updatedBy",},{- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.requiredActionIds",+ $ref: "#/parameters/rowFilter.qualityDocument.tags",},{$ref: "#/parameters/preferReturn",@@ -22784,72 +23744,9 @@ export default {description: "No Content",},},- tags: ["nonConformanceWorkflow"],+ tags: ["qualityDocument"],},patch: {- parameters: [- {- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.id",- },- {- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.name",- },- {- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.description",- },- {- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.content",- },- {- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.priority",- },- {- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.source",- },- {- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.approvalRequirements",- },- {- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.active",- },- {- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.tags",- },- {- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.companyId",- },- {- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.createdAt",- },- {- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.createdBy",- },- {- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.updatedAt",- },- {- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.updatedBy",- },- {- $ref: "#/parameters/rowFilter.nonConformanceWorkflow.requiredActionIds",- },- {- $ref: "#/parameters/body.nonConformanceWorkflow",- },- {- $ref: "#/parameters/preferReturn",- },- ],- responses: {- "204": {- description: "No Content",- },- },- tags: ["nonConformanceWorkflow"],- },- },- "/qualityDocument": {- get: {parameters: [{$ref: "#/parameters/rowFilter.qualityDocument.id",@@ -22890,169 +23787,121 @@ export default {{$ref: "#/parameters/rowFilter.qualityDocument.tags",},- {- $ref: "#/parameters/select",- },- {- $ref: "#/parameters/order",- },- {- $ref: "#/parameters/range",- },- {- $ref: "#/parameters/rangeUnit",- },- {- $ref: "#/parameters/offset",- },- {- $ref: "#/parameters/limit",- },- {- $ref: "#/parameters/preferCount",- },- ],- responses: {- "200": {- description: "OK",- schema: {- items: {- $ref: "#/definitions/qualityDocument",- },- type: "array",- },- },- "206": {- description: "Partial Content",- },- },- tags: ["qualityDocument"],- },- post: {- parameters: [{$ref: "#/parameters/body.qualityDocument",},{- $ref: "#/parameters/select",- },- {- $ref: "#/parameters/preferPost",+ $ref: "#/parameters/preferReturn",},],responses: {- "201": {- description: "Created",+ "204": {+ description: "No Content",},},tags: ["qualityDocument"],},- delete: {+ },+ "/purchasingRfqs": {+ get: {parameters: [{- $ref: "#/parameters/rowFilter.qualityDocument.id",- },- {- $ref: "#/parameters/rowFilter.qualityDocument.name",- },- {- $ref: "#/parameters/rowFilter.qualityDocument.description",+ $ref: "#/parameters/rowFilter.purchasingRfqs.id",},{- $ref: "#/parameters/rowFilter.qualityDocument.version",+ $ref: "#/parameters/rowFilter.purchasingRfqs.rfqId",},{- $ref: "#/parameters/rowFilter.qualityDocument.status",+ $ref: "#/parameters/rowFilter.purchasingRfqs.revisionId",},{- $ref: "#/parameters/rowFilter.qualityDocument.content",+ $ref: "#/parameters/rowFilter.purchasingRfqs.status",},{- $ref: "#/parameters/rowFilter.qualityDocument.assignee",+ $ref: "#/parameters/rowFilter.purchasingRfqs.employeeId",},{- $ref: "#/parameters/rowFilter.qualityDocument.companyId",+ $ref: "#/parameters/rowFilter.purchasingRfqs.rfqDate",},{- $ref: "#/parameters/rowFilter.qualityDocument.createdAt",+ $ref: "#/parameters/rowFilter.purchasingRfqs.expirationDate",},{- $ref: "#/parameters/rowFilter.qualityDocument.createdBy",+ $ref: "#/parameters/rowFilter.purchasingRfqs.internalNotes",},{- $ref: "#/parameters/rowFilter.qualityDocument.updatedAt",+ $ref: "#/parameters/rowFilter.purchasingRfqs.notes",},{- $ref: "#/parameters/rowFilter.qualityDocument.updatedBy",+ $ref: "#/parameters/rowFilter.purchasingRfqs.locationId",},{- $ref: "#/parameters/rowFilter.qualityDocument.tags",+ $ref: "#/parameters/rowFilter.purchasingRfqs.assignee",},{- $ref: "#/parameters/preferReturn",+ $ref: "#/parameters/rowFilter.purchasingRfqs.companyId",},- ],- responses: {- "204": {- description: "No Content",- },- },- tags: ["qualityDocument"],- },- patch: {- parameters: [{- $ref: "#/parameters/rowFilter.qualityDocument.id",+ $ref: "#/parameters/rowFilter.purchasingRfqs.customFields",},{- $ref: "#/parameters/rowFilter.qualityDocument.name",+ $ref: "#/parameters/rowFilter.purchasingRfqs.createdAt",},{- $ref: "#/parameters/rowFilter.qualityDocument.description",+ $ref: "#/parameters/rowFilter.purchasingRfqs.createdBy",},{- $ref: "#/parameters/rowFilter.qualityDocument.version",+ $ref: "#/parameters/rowFilter.purchasingRfqs.updatedAt",},{- $ref: "#/parameters/rowFilter.qualityDocument.status",+ $ref: "#/parameters/rowFilter.purchasingRfqs.updatedBy",},{- $ref: "#/parameters/rowFilter.qualityDocument.content",+ $ref: "#/parameters/rowFilter.purchasingRfqs.locationName",},{- $ref: "#/parameters/rowFilter.qualityDocument.assignee",+ $ref: "#/parameters/rowFilter.purchasingRfqs.supplierCount",},{- $ref: "#/parameters/rowFilter.qualityDocument.companyId",+ $ref: "#/parameters/rowFilter.purchasingRfqs.favorite",},{- $ref: "#/parameters/rowFilter.qualityDocument.createdAt",+ $ref: "#/parameters/select",},{- $ref: "#/parameters/rowFilter.qualityDocument.createdBy",+ $ref: "#/parameters/order",},{- $ref: "#/parameters/rowFilter.qualityDocument.updatedAt",+ $ref: "#/parameters/range",},{- $ref: "#/parameters/rowFilter.qualityDocument.updatedBy",+ $ref: "#/parameters/rangeUnit",},{- $ref: "#/parameters/rowFilter.qualityDocument.tags",+ $ref: "#/parameters/offset",},{- $ref: "#/parameters/body.qualityDocument",+ $ref: "#/parameters/limit",},{- $ref: "#/parameters/preferReturn",+ $ref: "#/parameters/preferCount",},],responses: {- "204": {- description: "No Content",+ "200": {+ description: "OK",+ schema: {+ items: {+ $ref: "#/definitions/purchasingRfqs",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",},},- tags: ["qualityDocument"],+ tags: ["purchasingRfqs"],},},"/postingGroupSales": {@@ -23586,7 +24435,55 @@ export default {description: "OK",schema: {items: {- $ref: "#/definitions/materialFinishes",+ $ref: "#/definitions/materialFinishes",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",+ },+ },+ tags: ["materialFinishes"],+ },+ },+ "/purchasingRfqFavorite": {+ get: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.purchasingRfqFavorite.rfqId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqFavorite.userId",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/order",+ },+ {+ $ref: "#/parameters/range",+ },+ {+ $ref: "#/parameters/rangeUnit",+ },+ {+ $ref: "#/parameters/offset",+ },+ {+ $ref: "#/parameters/limit",+ },+ {+ $ref: "#/parameters/preferCount",+ },+ ],+ responses: {+ "200": {+ description: "OK",+ schema: {+ items: {+ $ref: "#/definitions/purchasingRfqFavorite",},type: "array",},@@ -23595,7 +24492,67 @@ export default {description: "Partial Content",},},- tags: ["materialFinishes"],+ tags: ["purchasingRfqFavorite"],+ },+ post: {+ parameters: [+ {+ $ref: "#/parameters/body.purchasingRfqFavorite",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/preferPost",+ },+ ],+ responses: {+ "201": {+ description: "Created",+ },+ },+ tags: ["purchasingRfqFavorite"],+ },+ delete: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.purchasingRfqFavorite.rfqId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqFavorite.userId",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["purchasingRfqFavorite"],+ },+ patch: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.purchasingRfqFavorite.rfqId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqFavorite.userId",+ },+ {+ $ref: "#/parameters/body.purchasingRfqFavorite",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["purchasingRfqFavorite"],},},"/maintenanceDispatch": {@@ -31404,6 +32361,123 @@ export default {tags: ["materialForm"],},},+ "/purchasingRfqToPurchaseOrder": {+ get: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.purchasingRfqToPurchaseOrder.purchasingRfqId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqToPurchaseOrder.purchaseOrderId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqToPurchaseOrder.companyId",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/order",+ },+ {+ $ref: "#/parameters/range",+ },+ {+ $ref: "#/parameters/rangeUnit",+ },+ {+ $ref: "#/parameters/offset",+ },+ {+ $ref: "#/parameters/limit",+ },+ {+ $ref: "#/parameters/preferCount",+ },+ ],+ responses: {+ "200": {+ description: "OK",+ schema: {+ items: {+ $ref: "#/definitions/purchasingRfqToPurchaseOrder",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",+ },+ },+ tags: ["purchasingRfqToPurchaseOrder"],+ },+ post: {+ parameters: [+ {+ $ref: "#/parameters/body.purchasingRfqToPurchaseOrder",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/preferPost",+ },+ ],+ responses: {+ "201": {+ description: "Created",+ },+ },+ tags: ["purchasingRfqToPurchaseOrder"],+ },+ delete: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.purchasingRfqToPurchaseOrder.purchasingRfqId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqToPurchaseOrder.purchaseOrderId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqToPurchaseOrder.companyId",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["purchasingRfqToPurchaseOrder"],+ },+ patch: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.purchasingRfqToPurchaseOrder.purchasingRfqId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqToPurchaseOrder.purchaseOrderId",+ },+ {+ $ref: "#/parameters/rowFilter.purchasingRfqToPurchaseOrder.companyId",+ },+ {+ $ref: "#/parameters/body.purchasingRfqToPurchaseOrder",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["purchasingRfqToPurchaseOrder"],+ },+ },"/maintenanceDispatchEvent": {get: {parameters: [@@ -34147,63 +35221,133 @@ export default {$ref: "#/parameters/rowFilter.jobOperationStep.nonConformanceInvestigationId",},{- $ref: "#/parameters/select",- },- {- $ref: "#/parameters/order",- },- {- $ref: "#/parameters/range",- },- {- $ref: "#/parameters/rangeUnit",- },- {- $ref: "#/parameters/offset",- },- {- $ref: "#/parameters/limit",- },- {- $ref: "#/parameters/preferCount",- },- ],- responses: {- "200": {- description: "OK",- schema: {- items: {- $ref: "#/definitions/jobOperationStep",- },- type: "array",- },- },- "206": {- description: "Partial Content",- },- },- tags: ["jobOperationStep"],- },- post: {- parameters: [- {- $ref: "#/parameters/body.jobOperationStep",- },- {- $ref: "#/parameters/select",- },- {- $ref: "#/parameters/preferPost",+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/order",+ },+ {+ $ref: "#/parameters/range",+ },+ {+ $ref: "#/parameters/rangeUnit",+ },+ {+ $ref: "#/parameters/offset",+ },+ {+ $ref: "#/parameters/limit",+ },+ {+ $ref: "#/parameters/preferCount",+ },+ ],+ responses: {+ "200": {+ description: "OK",+ schema: {+ items: {+ $ref: "#/definitions/jobOperationStep",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",+ },+ },+ tags: ["jobOperationStep"],+ },+ post: {+ parameters: [+ {+ $ref: "#/parameters/body.jobOperationStep",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/preferPost",+ },+ ],+ responses: {+ "201": {+ description: "Created",+ },+ },+ tags: ["jobOperationStep"],+ },+ delete: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.id",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.name",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.required",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.sortOrder",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.type",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.unitOfMeasureCode",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.minValue",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.maxValue",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.listValues",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.fileTypes",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.operationId",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.updatedBy",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.description",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.nonConformanceActionId",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationStep.nonConformanceInvestigationId",+ },+ {+ $ref: "#/parameters/preferReturn",},],responses: {- "201": {- description: "Created",+ "204": {+ description: "No Content",},},tags: ["jobOperationStep"],},- delete: {+ patch: {parameters: [{$ref: "#/parameters/rowFilter.jobOperationStep.id",@@ -34262,6 +35406,9 @@ export default {{$ref: "#/parameters/rowFilter.jobOperationStep.nonConformanceInvestigationId",},+ {+ $ref: "#/parameters/body.jobOperationStep",+ },{$ref: "#/parameters/preferReturn",},@@ -34273,67 +35420,111 @@ export default {},tags: ["jobOperationStep"],},- patch: {+ },+ "/purchasingRfqToSupplierQuote": {+ get: {parameters: [{- $ref: "#/parameters/rowFilter.jobOperationStep.id",+ $ref: "#/parameters/rowFilter.purchasingRfqToSupplierQuote.purchasingRfqId",},{- $ref: "#/parameters/rowFilter.jobOperationStep.name",+ $ref: "#/parameters/rowFilter.purchasingRfqToSupplierQuote.supplierQuoteId",},{- $ref: "#/parameters/rowFilter.jobOperationStep.required",+ $ref: "#/parameters/rowFilter.purchasingRfqToSupplierQuote.companyId",},{- $ref: "#/parameters/rowFilter.jobOperationStep.sortOrder",+ $ref: "#/parameters/select",},{- $ref: "#/parameters/rowFilter.jobOperationStep.type",+ $ref: "#/parameters/order",},{- $ref: "#/parameters/rowFilter.jobOperationStep.unitOfMeasureCode",+ $ref: "#/parameters/range",},{- $ref: "#/parameters/rowFilter.jobOperationStep.minValue",+ $ref: "#/parameters/rangeUnit",},{- $ref: "#/parameters/rowFilter.jobOperationStep.maxValue",+ $ref: "#/parameters/offset",},{- $ref: "#/parameters/rowFilter.jobOperationStep.listValues",+ $ref: "#/parameters/limit",},{- $ref: "#/parameters/rowFilter.jobOperationStep.fileTypes",+ $ref: "#/parameters/preferCount",+ },+ ],+ responses: {+ "200": {+ description: "OK",+ schema: {+ items: {+ $ref: "#/definitions/purchasingRfqToSupplierQuote",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",},+ },+ tags: ["purchasingRfqToSupplierQuote"],+ },+ post: {+ parameters: [{- $ref: "#/parameters/rowFilter.jobOperationStep.operationId",+ $ref: "#/parameters/body.purchasingRfqToSupplierQuote",},{- $ref: "#/parameters/rowFilter.jobOperationStep.companyId",+ $ref: "#/parameters/select",},{- $ref: "#/parameters/rowFilter.jobOperationStep.createdAt",+ $ref: "#/parameters/preferPost",+ },+ ],+ responses: {+ "201": {+ description: "Created",},+ },+ tags: ["purchasingRfqToSupplierQuote"],+ },+ delete: {+ parameters: [{- $ref: "#/parameters/rowFilter.jobOperationStep.createdBy",+ $ref: "#/parameters/rowFilter.purchasingRfqToSupplierQuote.purchasingRfqId",},{- $ref: "#/parameters/rowFilter.jobOperationStep.updatedAt",+ $ref: "#/parameters/rowFilter.purchasingRfqToSupplierQuote.supplierQuoteId",},{- $ref: "#/parameters/rowFilter.jobOperationStep.updatedBy",+ $ref: "#/parameters/rowFilter.purchasingRfqToSupplierQuote.companyId",},{- $ref: "#/parameters/rowFilter.jobOperationStep.description",+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["purchasingRfqToSupplierQuote"],+ },+ patch: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.purchasingRfqToSupplierQuote.purchasingRfqId",},{- $ref: "#/parameters/rowFilter.jobOperationStep.nonConformanceActionId",+ $ref: "#/parameters/rowFilter.purchasingRfqToSupplierQuote.supplierQuoteId",},{- $ref: "#/parameters/rowFilter.jobOperationStep.nonConformanceInvestigationId",+ $ref: "#/parameters/rowFilter.purchasingRfqToSupplierQuote.companyId",},{- $ref: "#/parameters/body.jobOperationStep",+ $ref: "#/parameters/body.purchasingRfqToSupplierQuote",},{$ref: "#/parameters/preferReturn",@@ -34344,7 +35535,7 @@ export default {description: "No Content",},},- tags: ["jobOperationStep"],+ tags: ["purchasingRfqToSupplierQuote"],},},"/receiptLine": {@@ -63066,6 +64257,41 @@ export default {tags: ["(rpc) xid_encode"],},},+ "/rpc/populate_sales_search_results": {+ post: {+ parameters: [+ {+ in: "body",+ name: "args",+ required: true,+ schema: {+ properties: {+ p_company_id: {+ format: "text",+ type: "string",+ },+ },+ required: ["p_company_id"],+ type: "object",+ },+ },+ {+ $ref: "#/parameters/preferParams",+ },+ ],+ produces: [+ "application/json",+ "application/vnd.pgrst.object+json;nulls=stripped",+ "application/vnd.pgrst.object+json",+ ],+ responses: {+ "200": {+ description: "OK",+ },+ },+ tags: ["(rpc) populate_sales_search_results"],+ },+ },"/rpc/get_direct_descendants_of_tracked_entity": {post: {parameters: [@@ -65065,6 +66291,118 @@ export default {},type: "object",},+ purchasingRfqLines: {+ properties: {+ id: {+ description: "Note:\nThis is a Primary Key.<pk/>",+ format: "text",+ type: "string",+ },+ purchasingRfqId: {+ description:+ "Note:\nThis is a Foreign Key to `purchasingRfq.id`.<fk table='purchasingRfq' column='id'/>",+ format: "text",+ type: "string",+ },+ itemId: {+ description:+ "Note:\nThis is a Foreign Key to `item.id`.<fk table='item' column='id'/>",+ format: "text",+ type: "string",+ },+ partNumber: {+ format: "text",+ type: "string",+ },+ partRevision: {+ format: "text",+ type: "string",+ },+ description: {+ format: "text",+ type: "string",+ },+ quantity: {+ format: "numeric[]",+ items: {+ type: "number",+ },+ type: "array",+ },+ unitOfMeasureCode: {+ format: "text",+ type: "string",+ },+ order: {+ format: "double precision",+ type: "number",+ },+ internalNotes: {+ format: "json",+ },+ externalNotes: {+ format: "json",+ },+ companyId: {+ description:+ "Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",+ format: "text",+ type: "string",+ },+ customFields: {+ format: "jsonb",+ },+ createdAt: {+ format: "timestamp with time zone",+ type: "string",+ },+ createdBy: {+ description:+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ format: "text",+ type: "string",+ },+ updatedAt: {+ format: "timestamp with time zone",+ type: "string",+ },+ updatedBy: {+ description:+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ format: "text",+ type: "string",+ },+ itemName: {+ format: "text",+ type: "string",+ },+ itemReadableId: {+ format: "text",+ type: "string",+ },+ itemType: {+ enum: [+ "Part",+ "Material",+ "Tool",+ "Service",+ "Consumable",+ "Fixture",+ ],+ format: 'public."itemType"',+ type: "string",+ },+ thumbnailPath: {+ format: "text",+ type: "string",+ },+ modelPath: {+ format: "text",+ type: "string",+ },+ },+ type: "object",+ },noQuoteReason: {required: ["id", "name", "companyId", "createdAt", "createdBy"],properties: {@@ -68497,7 +69835,7 @@ export default {properties: {id: {description:- "Note:\nThis is a Foreign Key to `supplierLocation.id`.<fk table='supplierLocation' column='id'/>",+ "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `supplierLocation.id`.<fk table='supplierLocation' column='id'/>",format: "text",type: "string",},@@ -68546,7 +69884,7 @@ export default {},supplierLocationId: {description:- "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `supplierLocation.id`.<fk table='supplierLocation' column='id'/>",+ "Note:\nThis is a Foreign Key to `supplierLocation.id`.<fk table='supplierLocation' column='id'/>",format: "text",type: "string",},@@ -70639,6 +71977,101 @@ export default {},type: "object",},+ purchasingRfqLine: {+ required: [+ "id",+ "purchasingRfqId",+ "unitOfMeasureCode",+ "order",+ "companyId",+ "createdBy",+ ],+ properties: {+ id: {+ default: "public.xid()",+ description: "Note:\nThis is a Primary Key.<pk/>",+ format: "text",+ type: "string",+ },+ purchasingRfqId: {+ description:+ "Note:\nThis is a Foreign Key to `purchasingRfq.id`.<fk table='purchasingRfq' column='id'/>",+ format: "text",+ type: "string",+ },+ itemId: {+ description:+ "Note:\nThis is a Foreign Key to `item.id`.<fk table='item' column='id'/>",+ format: "text",+ type: "string",+ },+ partNumber: {+ format: "text",+ type: "string",+ },+ partRevision: {+ format: "text",+ type: "string",+ },+ description: {+ format: "text",+ type: "string",+ },+ quantity: {+ format: "numeric[]",+ items: {+ type: "number",+ },+ type: "array",+ },+ unitOfMeasureCode: {+ format: "text",+ type: "string",+ },+ order: {+ default: 0,+ format: "double precision",+ type: "number",+ },+ internalNotes: {+ format: "json",+ },+ externalNotes: {+ format: "json",+ },+ companyId: {+ description:+ "Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",+ format: "text",+ type: "string",+ },+ customFields: {+ format: "jsonb",+ },+ createdAt: {+ default: "now()",+ format: "timestamp with time zone",+ type: "string",+ },+ createdBy: {+ description:+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ format: "text",+ type: "string",+ },+ updatedAt: {+ format: "timestamp with time zone",+ type: "string",+ },+ updatedBy: {+ description:+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ format: "text",+ type: "string",+ },+ },+ type: "object",+ },salesInvoiceLocations: {properties: {id: {@@ -71267,6 +72700,12 @@ export default {format: "text",type: "string",},+ materialFormFilterId: {+ description:+ "Note:\nThis is a Foreign Key to `materialForm.id`.<fk table='materialForm' column='id'/>",+ format: "text",+ type: "string",+ },},type: "object",},@@ -72338,6 +73777,97 @@ export default {},type: "object",},+ purchasingRfq: {+ required: ["id", "rfqId", "revisionId", "status", "rfqDate", "companyId"],+ properties: {+ id: {+ default: "public.xid()",+ description: "Note:\nThis is a Primary Key.<pk/>",+ format: "text",+ type: "string",+ },+ rfqId: {+ format: "text",+ type: "string",+ },+ revisionId: {+ default: 0,+ format: "integer",+ type: "integer",+ },+ status: {+ default: "Draft",+ enum: ["Draft", "Ready for request", "Requested", "Closed"],+ format: 'public."purchasingRfqStatus"',+ type: "string",+ },+ employeeId: {+ description:+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ format: "text",+ type: "string",+ },+ rfqDate: {+ format: "date",+ type: "string",+ },+ expirationDate: {+ format: "date",+ type: "string",+ },+ internalNotes: {+ format: "text",+ type: "string",+ },+ notes: {+ format: "json",+ },+ locationId: {+ description:+ "Note:\nThis is a Foreign Key to `location.id`.<fk table='location' column='id'/>",+ format: "text",+ type: "string",+ },+ assignee: {+ description:+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ format: "text",+ type: "string",+ },+ companyId: {+ description:+ "Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",+ format: "text",+ type: "string",+ },+ customFields: {+ format: "jsonb",+ },+ createdAt: {+ default: "now()",+ format: "timestamp with time zone",+ type: "string",+ },+ createdBy: {+ description:+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ format: "text",+ type: "string",+ },+ updatedAt: {+ default: "now()",+ format: "timestamp with time zone",+ type: "string",+ },+ updatedBy: {+ description:+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ format: "text",+ type: "string",+ },+ },+ type: "object",+ },workCenters: {properties: {id: {@@ -72935,6 +74465,47 @@ export default {},type: "object",},+ purchasingRfqSupplier: {+ required: ["id", "purchasingRfqId", "supplierId", "companyId"],+ properties: {+ id: {+ default: "public.xid()",+ description: "Note:\nThis is a Primary Key.<pk/>",+ format: "text",+ type: "string",+ },+ purchasingRfqId: {+ description:+ "Note:\nThis is a Foreign Key to `purchasingRfq.id`.<fk table='purchasingRfq' column='id'/>",+ format: "text",+ type: "string",+ },+ supplierId: {+ description:+ "Note:\nThis is a Foreign Key to `supplier.id`.<fk table='supplier' column='id'/>",+ format: "text",+ type: "string",+ },+ companyId: {+ description:+ "Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",+ format: "text",+ type: "string",+ },+ createdAt: {+ default: "now()",+ format: "timestamp with time zone",+ type: "string",+ },+ createdBy: {+ description:+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ format: "text",+ type: "string",+ },+ },+ type: "object",+ },demandActual: {required: ["itemId",@@ -75537,6 +77108,103 @@ export default {},type: "object",},+ purchasingRfqs: {+ properties: {+ id: {+ description: "Note:\nThis is a Primary Key.<pk/>",+ format: "text",+ type: "string",+ },+ rfqId: {+ format: "text",+ type: "string",+ },+ revisionId: {+ format: "integer",+ type: "integer",+ },+ status: {+ enum: ["Draft", "Ready for request", "Requested", "Closed"],+ format: 'public."purchasingRfqStatus"',+ type: "string",+ },+ employeeId: {+ description:+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ format: "text",+ type: "string",+ },+ rfqDate: {+ format: "date",+ type: "string",+ },+ expirationDate: {+ format: "date",+ type: "string",+ },+ internalNotes: {+ format: "text",+ type: "string",+ },+ notes: {+ format: "json",+ },+ locationId: {+ description:+ "Note:\nThis is a Foreign Key to `location.id`.<fk table='location' column='id'/>",+ format: "text",+ type: "string",+ },+ assignee: {+ description:+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ format: "text",+ type: "string",+ },+ companyId: {+ description:+ "Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",+ format: "text",+ type: "string",+ },+ customFields: {+ format: "jsonb",+ },+ createdAt: {+ format: "timestamp with time zone",+ type: "string",+ },+ createdBy: {+ description:+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ format: "text",+ type: "string",+ },+ updatedAt: {+ format: "timestamp with time zone",+ type: "string",+ },+ updatedBy: {+ description:+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ format: "text",+ type: "string",+ },+ locationName: {+ format: "text",+ type: "string",+ },+ supplierCount: {+ format: "bigint",+ type: "integer",+ },+ favorite: {+ format: "boolean",+ type: "boolean",+ },+ },+ type: "object",+ },postingGroupSales: {required: ["id",@@ -75711,6 +77379,24 @@ export default {},type: "object",},+ purchasingRfqFavorite: {+ required: ["rfqId", "userId"],+ properties: {+ rfqId: {+ description:+ "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `purchasingRfq.id`.<fk table='purchasingRfq' column='id'/>",+ format: "text",+ type: "string",+ },+ userId: {+ description:+ "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ format: "text",+ type: "string",+ },+ },+ type: "object",+ },maintenanceDispatch: {required: ["id",@@ -79348,6 +81034,30 @@ export default {},type: "object",},+ purchasingRfqToPurchaseOrder: {+ required: ["purchasingRfqId", "purchaseOrderId", "companyId"],+ properties: {+ purchasingRfqId: {+ description:+ "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `purchasingRfq.id`.<fk table='purchasingRfq' column='id'/>",+ format: "text",+ type: "string",+ },+ purchaseOrderId: {+ description:+ "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `purchaseOrder.id`.<fk table='purchaseOrder' column='id'/>",+ format: "text",+ type: "string",+ },+ companyId: {+ description:+ "Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",+ format: "text",+ type: "string",+ },+ },+ type: "object",+ },maintenanceDispatchEvent: {required: ["id",@@ -80889,6 +82599,30 @@ export default {},type: "object",},+ purchasingRfqToSupplierQuote: {+ required: ["purchasingRfqId", "supplierQuoteId", "companyId"],+ properties: {+ purchasingRfqId: {+ description:+ "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `purchasingRfq.id`.<fk table='purchasingRfq' column='id'/>",+ format: "text",+ type: "string",+ },+ supplierQuoteId: {+ description:+ "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `supplierQuote.id`.<fk table='supplierQuote' column='id'/>",+ format: "text",+ type: "string",+ },+ companyId: {+ description:+ "Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",+ format: "text",+ type: "string",+ },+ },+ type: "object",+ },receiptLine: {required: ["id",@@ -93926,6 +95660,147 @@ export default {in: "query",type: "string",},+ "body.purchasingRfqLines": {+ name: "purchasingRfqLines",+ description: "purchasingRfqLines",+ required: false,+ in: "body",+ schema: {+ $ref: "#/definitions/purchasingRfqLines",+ },+ },+ "rowFilter.purchasingRfqLines.id": {+ name: "id",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.purchasingRfqId": {+ name: "purchasingRfqId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.itemId": {+ name: "itemId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.partNumber": {+ name: "partNumber",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.partRevision": {+ name: "partRevision",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.description": {+ name: "description",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.quantity": {+ name: "quantity",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.unitOfMeasureCode": {+ name: "unitOfMeasureCode",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.order": {+ name: "order",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.internalNotes": {+ name: "internalNotes",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.externalNotes": {+ name: "externalNotes",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.companyId": {+ name: "companyId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.customFields": {+ name: "customFields",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.createdAt": {+ name: "createdAt",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.createdBy": {+ name: "createdBy",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.updatedAt": {+ name: "updatedAt",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.updatedBy": {+ name: "updatedBy",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.itemName": {+ name: "itemName",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.itemReadableId": {+ name: "itemReadableId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.itemType": {+ name: "itemType",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.thumbnailPath": {+ name: "thumbnailPath",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLines.modelPath": {+ name: "modelPath",+ required: false,+ in: "query",+ type: "string",+ },"body.noQuoteReason": {name: "noQuoteReason",description: "noQuoteReason",@@ -100304,6 +102179,117 @@ export default {in: "query",type: "string",},+ "body.purchasingRfqLine": {+ name: "purchasingRfqLine",+ description: "purchasingRfqLine",+ required: false,+ in: "body",+ schema: {+ $ref: "#/definitions/purchasingRfqLine",+ },+ },+ "rowFilter.purchasingRfqLine.id": {+ name: "id",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLine.purchasingRfqId": {+ name: "purchasingRfqId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLine.itemId": {+ name: "itemId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLine.partNumber": {+ name: "partNumber",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLine.partRevision": {+ name: "partRevision",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLine.description": {+ name: "description",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLine.quantity": {+ name: "quantity",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLine.unitOfMeasureCode": {+ name: "unitOfMeasureCode",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLine.order": {+ name: "order",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLine.internalNotes": {+ name: "internalNotes",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLine.externalNotes": {+ name: "externalNotes",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLine.companyId": {+ name: "companyId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLine.customFields": {+ name: "customFields",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLine.createdAt": {+ name: "createdAt",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLine.createdBy": {+ name: "createdBy",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLine.updatedAt": {+ name: "updatedAt",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqLine.updatedBy": {+ name: "updatedBy",+ required: false,+ in: "query",+ type: "string",+ },"body.salesInvoiceLocations": {name: "salesInvoiceLocations",description: "salesInvoiceLocations",@@ -100991,6 +102977,12 @@ export default {in: "query",type: "string",},+ "rowFilter.configurationParameter.materialFormFilterId": {+ name: "materialFormFilterId",+ required: false,+ in: "query",+ type: "string",+ },"body.nonConformanceReceiptLine": {name: "nonConformanceReceiptLine",description: "nonConformanceReceiptLine",@@ -102179,6 +104171,117 @@ export default {in: "query",type: "string",},+ "body.purchasingRfq": {+ name: "purchasingRfq",+ description: "purchasingRfq",+ required: false,+ in: "body",+ schema: {+ $ref: "#/definitions/purchasingRfq",+ },+ },+ "rowFilter.purchasingRfq.id": {+ name: "id",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfq.rfqId": {+ name: "rfqId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfq.revisionId": {+ name: "revisionId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfq.status": {+ name: "status",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfq.employeeId": {+ name: "employeeId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfq.rfqDate": {+ name: "rfqDate",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfq.expirationDate": {+ name: "expirationDate",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfq.internalNotes": {+ name: "internalNotes",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfq.notes": {+ name: "notes",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfq.locationId": {+ name: "locationId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfq.assignee": {+ name: "assignee",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfq.companyId": {+ name: "companyId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfq.customFields": {+ name: "customFields",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfq.createdAt": {+ name: "createdAt",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfq.createdBy": {+ name: "createdBy",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfq.updatedAt": {+ name: "updatedAt",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfq.updatedBy": {+ name: "updatedBy",+ required: false,+ in: "query",+ type: "string",+ },"body.workCenters": {name: "workCenters",description: "workCenters",@@ -102827,6 +104930,51 @@ export default {in: "query",type: "string",},+ "body.purchasingRfqSupplier": {+ name: "purchasingRfqSupplier",+ description: "purchasingRfqSupplier",+ required: false,+ in: "body",+ schema: {+ $ref: "#/definitions/purchasingRfqSupplier",+ },+ },+ "rowFilter.purchasingRfqSupplier.id": {+ name: "id",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqSupplier.purchasingRfqId": {+ name: "purchasingRfqId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqSupplier.supplierId": {+ name: "supplierId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqSupplier.companyId": {+ name: "companyId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqSupplier.createdAt": {+ name: "createdAt",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqSupplier.createdBy": {+ name: "createdBy",+ required: false,+ in: "query",+ type: "string",+ },"body.demandActual": {name: "demandActual",description: "demandActual",@@ -105759,6 +107907,135 @@ export default {in: "query",type: "string",},+ "body.purchasingRfqs": {+ name: "purchasingRfqs",+ description: "purchasingRfqs",+ required: false,+ in: "body",+ schema: {+ $ref: "#/definitions/purchasingRfqs",+ },+ },+ "rowFilter.purchasingRfqs.id": {+ name: "id",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.rfqId": {+ name: "rfqId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.revisionId": {+ name: "revisionId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.status": {+ name: "status",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.employeeId": {+ name: "employeeId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.rfqDate": {+ name: "rfqDate",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.expirationDate": {+ name: "expirationDate",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.internalNotes": {+ name: "internalNotes",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.notes": {+ name: "notes",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.locationId": {+ name: "locationId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.assignee": {+ name: "assignee",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.companyId": {+ name: "companyId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.customFields": {+ name: "customFields",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.createdAt": {+ name: "createdAt",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.createdBy": {+ name: "createdBy",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.updatedAt": {+ name: "updatedAt",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.updatedBy": {+ name: "updatedBy",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.locationName": {+ name: "locationName",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.supplierCount": {+ name: "supplierCount",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqs.favorite": {+ name: "favorite",+ required: false,+ in: "query",+ type: "string",+ },"body.postingGroupSales": {name: "postingGroupSales",description: "postingGroupSales",@@ -105969,6 +108246,27 @@ export default {in: "query",type: "string",},+ "body.purchasingRfqFavorite": {+ name: "purchasingRfqFavorite",+ description: "purchasingRfqFavorite",+ required: false,+ in: "body",+ schema: {+ $ref: "#/definitions/purchasingRfqFavorite",+ },+ },+ "rowFilter.purchasingRfqFavorite.rfqId": {+ name: "rfqId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqFavorite.userId": {+ name: "userId",+ required: false,+ in: "query",+ type: "string",+ },"body.maintenanceDispatch": {name: "maintenanceDispatch",description: "maintenanceDispatch",@@ -110007,6 +112305,33 @@ export default {in: "query",type: "string",},+ "body.purchasingRfqToPurchaseOrder": {+ name: "purchasingRfqToPurchaseOrder",+ description: "purchasingRfqToPurchaseOrder",+ required: false,+ in: "body",+ schema: {+ $ref: "#/definitions/purchasingRfqToPurchaseOrder",+ },+ },+ "rowFilter.purchasingRfqToPurchaseOrder.purchasingRfqId": {+ name: "purchasingRfqId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqToPurchaseOrder.purchaseOrderId": {+ name: "purchaseOrderId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqToPurchaseOrder.companyId": {+ name: "companyId",+ required: false,+ in: "query",+ type: "string",+ },"body.maintenanceDispatchEvent": {name: "maintenanceDispatchEvent",description: "maintenanceDispatchEvent",@@ -111819,6 +114144,33 @@ export default {in: "query",type: "string",},+ "body.purchasingRfqToSupplierQuote": {+ name: "purchasingRfqToSupplierQuote",+ description: "purchasingRfqToSupplierQuote",+ required: false,+ in: "body",+ schema: {+ $ref: "#/definitions/purchasingRfqToSupplierQuote",+ },+ },+ "rowFilter.purchasingRfqToSupplierQuote.purchasingRfqId": {+ name: "purchasingRfqId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqToSupplierQuote.supplierQuoteId": {+ name: "supplierQuoteId",+ required: false,+ in: "query",+ type: "string",+ },+ "rowFilter.purchasingRfqToSupplierQuote.companyId": {+ name: "companyId",+ required: false,+ in: "query",+ type: "string",+ },"body.receiptLine": {name: "receiptLine",description: "receiptLine",diff --git a/packages/database/src/types.ts b/packages/database/src/types.tsindex 30e2023b66..ddcf9cfa59 100644--- a/packages/database/src/types.ts+++ b/packages/database/src/types.ts@@ -10280,7 +10280,6 @@ export type Database = {}jobMaterial: {Row: {- bomId: string | nullcompanyId: stringcreatedAt: stringcreatedBy: string@@ -10310,7 +10309,6 @@ export type Database = {updatedBy: string | null}Insert: {- bomId?: string | nullcompanyId: stringcreatedAt?: stringcreatedBy: string@@ -10340,7 +10338,6 @@ export type Database = {updatedBy?: string | null}Update: {- bomId?: string | nullcompanyId?: stringcreatedAt?: stringcreatedBy?: string@@ -15188,7 +15185,6 @@ export type Database = {}methodMaterial: {Row: {- bomId: string | nullcompanyId: stringcreatedAt: stringcreatedBy: string@@ -15212,7 +15208,6 @@ export type Database = {updatedBy: string | null}Insert: {- bomId?: string | nullcompanyId: stringcreatedAt?: stringcreatedBy: string@@ -15236,7 +15231,6 @@ export type Database = {updatedBy?: string | null}Update: {- bomId?: string | nullcompanyId?: stringcreatedAt?: stringcreatedBy?: string@@ -19907,21 +19901,21 @@ export type Database = {opportunity: {Row: {companyId: string- customerId: string+ customerId: string | nullid: stringpurchaseOrderDocumentPath: string | nullrequestForQuoteDocumentPath: string | null}Insert: {companyId: string- customerId: string+ customerId?: string | nullid?: stringpurchaseOrderDocumentPath?: string | nullrequestForQuoteDocumentPath?: string | null}Update: {companyId?: string- customerId?: string+ customerId?: string | nullid?: stringpurchaseOrderDocumentPath?: string | nullrequestForQuoteDocumentPath?: string | null@@ -24936,6 +24930,819 @@ export type Database = {},]}+ purchasingRfq: {+ Row: {+ assignee: string | null+ companyId: string+ createdAt: string | null+ createdBy: string | null+ customFields: Json | null+ employeeId: string | null+ expirationDate: string | null+ id: string+ internalNotes: string | null+ locationId: string | null+ notes: Json | null+ revisionId: number+ rfqDate: string+ rfqId: string+ status: Database["public"]["Enums"]["purchasingRfqStatus"]+ updatedAt: string | null+ updatedBy: string | null+ }+ Insert: {+ assignee?: string | null+ companyId: string+ createdAt?: string | null+ createdBy?: string | null+ customFields?: Json | null+ employeeId?: string | null+ expirationDate?: string | null+ id?: string+ internalNotes?: string | null+ locationId?: string | null+ notes?: Json | null+ revisionId?: number+ rfqDate: string+ rfqId: string+ status?: Database["public"]["Enums"]["purchasingRfqStatus"]+ updatedAt?: string | null+ updatedBy?: string | null+ }+ Update: {+ assignee?: string | null+ companyId?: string+ createdAt?: string | null+ createdBy?: string | null+ customFields?: Json | null+ employeeId?: string | null+ expirationDate?: string | null+ id?: string+ internalNotes?: string | null+ locationId?: string | null+ notes?: Json | null+ revisionId?: number+ rfqDate?: string+ rfqId?: string+ status?: Database["public"]["Enums"]["purchasingRfqStatus"]+ updatedAt?: string | null+ updatedBy?: string | null+ }+ Relationships: [+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfq_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "companies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "customFieldTables"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfq_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "integrations"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfq_locationId_fkey"+ columns: ["locationId"]+ isOneToOne: false+ referencedRelation: "location"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }+ purchasingRfqFavorite: {+ Row: {+ rfqId: string+ userId: string+ }+ Insert: {+ rfqId: string+ userId: string+ }+ Update: {+ rfqId?: string+ userId?: string+ }+ Relationships: [+ {+ foreignKeyName: "purchasingRfqFavorites_purchasingRfqId_fkey"+ columns: ["rfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfq"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqFavorites_purchasingRfqId_fkey"+ columns: ["rfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfqs"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqFavorites_userId_fkey"+ columns: ["userId"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqFavorites_userId_fkey"+ columns: ["userId"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqFavorites_userId_fkey"+ columns: ["userId"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqFavorites_userId_fkey"+ columns: ["userId"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqFavorites_userId_fkey"+ columns: ["userId"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }+ purchasingRfqLine: {+ Row: {+ companyId: string+ createdAt: string | null+ createdBy: string+ customFields: Json | null+ description: string | null+ externalNotes: Json | null+ id: string+ internalNotes: Json | null+ itemId: string | null+ order: number+ partNumber: string | null+ partRevision: string | null+ purchasingRfqId: string+ quantity: number[] | null+ unitOfMeasureCode: string+ updatedAt: string | null+ updatedBy: string | null+ }+ Insert: {+ companyId: string+ createdAt?: string | null+ createdBy: string+ customFields?: Json | null+ description?: string | null+ externalNotes?: Json | null+ id?: string+ internalNotes?: Json | null+ itemId?: string | null+ order?: number+ partNumber?: string | null+ partRevision?: string | null+ purchasingRfqId: string+ quantity?: number[] | null+ unitOfMeasureCode: string+ updatedAt?: string | null+ updatedBy?: string | null+ }+ Update: {+ companyId?: string+ createdAt?: string | null+ createdBy?: string+ customFields?: Json | null+ description?: string | null+ externalNotes?: Json | null+ id?: string+ internalNotes?: Json | null+ itemId?: string | null+ order?: number+ partNumber?: string | null+ partRevision?: string | null+ purchasingRfqId?: string+ quantity?: number[] | null+ unitOfMeasureCode?: string+ updatedAt?: string | null+ updatedBy?: string | null+ }+ Relationships: [+ {+ foreignKeyName: "purchasingRfqLine_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "companies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "customFieldTables"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqLine_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "integrations"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "consumables"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "item"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "materials"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "parts"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "tools"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfq"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfqs"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_unitOfMeasureCode_fkey"+ columns: ["unitOfMeasureCode", "companyId"]+ isOneToOne: false+ referencedRelation: "unitOfMeasure"+ referencedColumns: ["code", "companyId"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }+ purchasingRfqSupplier: {+ Row: {+ companyId: string+ createdAt: string | null+ createdBy: string | null+ id: string+ purchasingRfqId: string+ supplierId: string+ }+ Insert: {+ companyId: string+ createdAt?: string | null+ createdBy?: string | null+ id?: string+ purchasingRfqId: string+ supplierId: string+ }+ Update: {+ companyId?: string+ createdAt?: string | null+ createdBy?: string | null+ id?: string+ purchasingRfqId?: string+ supplierId?: string+ }+ Relationships: [+ {+ foreignKeyName: "purchasingRfqSupplier_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "companies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "customFieldTables"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "integrations"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfq"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfqs"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_supplierId_fkey"+ columns: ["supplierId"]+ isOneToOne: false+ referencedRelation: "contractors"+ referencedColumns: ["supplierId"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_supplierId_fkey"+ columns: ["supplierId"]+ isOneToOne: false+ referencedRelation: "partners"+ referencedColumns: ["supplierId"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_supplierId_fkey"+ columns: ["supplierId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderSuppliers"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_supplierId_fkey"+ columns: ["supplierId"]+ isOneToOne: false+ referencedRelation: "supplier"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_supplierId_fkey"+ columns: ["supplierId"]+ isOneToOne: false+ referencedRelation: "suppliers"+ referencedColumns: ["id"]+ },+ ]+ }+ purchasingRfqToPurchaseOrder: {+ Row: {+ companyId: string+ purchaseOrderId: string+ purchasingRfqId: string+ }+ Insert: {+ companyId: string+ purchaseOrderId: string+ purchasingRfqId: string+ }+ Update: {+ companyId?: string+ purchaseOrderId?: string+ purchasingRfqId?: string+ }+ Relationships: [+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "companies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "customFieldTables"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "integrations"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrder"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLocations"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrders"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfq"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfqs"+ referencedColumns: ["id"]+ },+ ]+ }+ purchasingRfqToSupplierQuote: {+ Row: {+ companyId: string+ purchasingRfqId: string+ supplierQuoteId: string+ }+ Insert: {+ companyId: string+ purchasingRfqId: string+ supplierQuoteId: string+ }+ Update: {+ companyId?: string+ purchasingRfqId?: string+ supplierQuoteId?: string+ }+ Relationships: [+ {+ foreignKeyName: "purchasingRfqToSupplierQuote_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "companies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToSupplierQuote_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToSupplierQuote_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "customFieldTables"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqToSupplierQuote_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "integrations"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqToSupplierQuote_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfq"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToSupplierQuote_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfqs"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToSupplierQuote_supplierQuoteId_fkey"+ columns: ["supplierQuoteId"]+ isOneToOne: false+ referencedRelation: "supplierQuote"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToSupplierQuote_supplierQuoteId_fkey"+ columns: ["supplierQuoteId"]+ isOneToOne: false+ referencedRelation: "supplierQuotes"+ referencedColumns: ["id"]+ },+ ]+ }qualityDocument: {Row: {assignee: string | null@@ -26495,7 +27302,6 @@ export type Database = {}quoteMaterial: {Row: {- bomId: string | nullcompanyId: stringcreatedAt: stringcreatedBy: string@@ -26522,7 +27328,6 @@ export type Database = {updatedBy: string | null}Insert: {- bomId?: string | nullcompanyId: stringcreatedAt?: stringcreatedBy: string@@ -26549,7 +27354,6 @@ export type Database = {updatedBy?: string | null}Update: {- bomId?: string | nullcompanyId?: stringcreatedAt?: stringcreatedBy?: string@@ -31334,174 +32138,6 @@ export type Database = {},]}- searchIndex_BJiGdDNuetJ1iyE8USN7AD: {- Row: {- createdAt: string- description: string | null- entityId: string- entityType: string- id: number- link: string- metadata: Json | null- searchVector: unknown- tags: string[] | null- title: string- updatedAt: string | null- }- Insert: {- createdAt?: string- description?: string | null- entityId: string- entityType: string- id?: number- link: string- metadata?: Json | null- searchVector?: unknown- tags?: string[] | null- title: string- updatedAt?: string | null- }- Update: {- createdAt?: string- description?: string | null- entityId?: string- entityType?: string- id?: number- link?: string- metadata?: Json | null- searchVector?: unknown- tags?: string[] | null- title?: string- updatedAt?: string | null- }- Relationships: []- }- searchIndex_L4saDKMCpFQurK9c3bEr1G: {- Row: {- createdAt: string- description: string | null- entityId: string- entityType: string- id: number- link: string- metadata: Json | null- searchVector: unknown- tags: string[] | null- title: string- updatedAt: string | null- }- Insert: {- createdAt?: string- description?: string | null- entityId: string- entityType: string- id?: number- link: string- metadata?: Json | null- searchVector?: unknown- tags?: string[] | null- title: string- updatedAt?: string | null- }- Update: {- createdAt?: string- description?: string | null- entityId?: string- entityType?: string- id?: number- link?: string- metadata?: Json | null- searchVector?: unknown- tags?: string[] | null- title?: string- updatedAt?: string | null- }- Relationships: []- }- searchIndex_Nrc78GJXti5gro8G5m3k9u: {- Row: {- createdAt: string- description: string | null- entityId: string- entityType: string- id: number- link: string- metadata: Json | null- searchVector: unknown- tags: string[] | null- title: string- updatedAt: string | null- }- Insert: {- createdAt?: string- description?: string | null- entityId: string- entityType: string- id?: number- link: string- metadata?: Json | null- searchVector?: unknown- tags?: string[] | null- title: string- updatedAt?: string | null- }- Update: {- createdAt?: string- description?: string | null- entityId?: string- entityType?: string- id?: number- link?: string- metadata?: Json | null- searchVector?: unknown- tags?: string[] | null- title?: string- updatedAt?: string | null- }- Relationships: []- }- searchIndex_TzPMV5bvte7aRhGwLwmjs9: {- Row: {- createdAt: string- description: string | null- entityId: string- entityType: string- id: number- link: string- metadata: Json | null- searchVector: unknown- tags: string[] | null- title: string- updatedAt: string | null- }- Insert: {- createdAt?: string- description?: string | null- entityId: string- entityType: string- id?: number- link: string- metadata?: Json | null- searchVector?: unknown- tags?: string[] | null- title: string- updatedAt?: string | null- }- Update: {- createdAt?: string- description?: string | null- entityId?: string- entityType?: string- id?: number- link?: string- metadata?: Json | null- searchVector?: unknown- tags?: string[] | null- title?: string- updatedAt?: string | null- }- Relationships: []- }searchIndexRegistry: {Row: {companyId: string@@ -42916,7 +43552,6 @@ export type Database = {}jobMaterialWithMakeMethodId: {Row: {- bomId: string | nullcompanyId: string | nullcreatedAt: string | nullcreatedBy: string | null@@ -42943,6 +43578,7 @@ export type Database = {requiresSerialTracking: boolean | nullscrapQuantity: number | nullshelfId: string | null+ shelfName: string | nullunitCost: number | nullunitOfMeasureCode: string | nullupdatedAt: string | null@@ -46928,14 +47564,14 @@ export type Database = {Relationships: [{foreignKeyName: "address_countryCode_fkey"- columns: ["supplierCountryCode"]+ columns: ["customerCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]},{foreignKeyName: "address_countryCode_fkey"- columns: ["customerCountryCode"]+ columns: ["supplierCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]@@ -47307,6 +47943,389 @@ export type Database = {},]}+ purchasingRfqLines: {+ Row: {+ companyId: string | null+ createdAt: string | null+ createdBy: string | null+ customFields: Json | null+ description: string | null+ externalNotes: Json | null+ id: string | null+ internalNotes: Json | null+ itemId: string | null+ itemName: string | null+ itemReadableId: string | null+ itemType: Database["public"]["Enums"]["itemType"] | null+ modelPath: string | null+ order: number | null+ partNumber: string | null+ partRevision: string | null+ purchasingRfqId: string | null+ quantity: number[] | null+ thumbnailPath: string | null+ unitOfMeasureCode: string | null+ updatedAt: string | null+ updatedBy: string | null+ }+ Relationships: [+ {+ foreignKeyName: "purchasingRfqLine_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "companies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "customFieldTables"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqLine_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "integrations"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "consumables"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "item"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "materials"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "parts"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "tools"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfq"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfqs"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_unitOfMeasureCode_fkey"+ columns: ["unitOfMeasureCode", "companyId"]+ isOneToOne: false+ referencedRelation: "unitOfMeasure"+ referencedColumns: ["code", "companyId"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }+ purchasingRfqs: {+ Row: {+ assignee: string | null+ companyId: string | null+ createdAt: string | null+ createdBy: string | null+ customFields: Json | null+ employeeId: string | null+ expirationDate: string | null+ favorite: boolean | null+ id: string | null+ internalNotes: string | null+ locationId: string | null+ locationName: string | null+ notes: Json | null+ revisionId: number | null+ rfqDate: string | null+ rfqId: string | null+ status: Database["public"]["Enums"]["purchasingRfqStatus"] | null+ supplierCount: number | null+ updatedAt: string | null+ updatedBy: string | null+ }+ Relationships: [+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfq_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "companies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "customFieldTables"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfq_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "integrations"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfq_locationId_fkey"+ columns: ["locationId"]+ isOneToOne: false+ referencedRelation: "location"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }qualityActions: {Row: {actionType: string | null@@ -48154,7 +49173,6 @@ export type Database = {}quoteMaterialWithMakeMethodId: {Row: {- bomId: string | nullcompanyId: string | nullcreatedAt: string | nullcreatedBy: string | null@@ -49620,14 +50638,14 @@ export type Database = {Relationships: [{foreignKeyName: "address_countryCode_fkey"- columns: ["invoiceCountryCode"]+ columns: ["customerCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]},{foreignKeyName: "address_countryCode_fkey"- columns: ["customerCountryCode"]+ columns: ["invoiceCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]@@ -53373,7 +54391,6 @@ export type Database = {get_job_method: {Args: { jid: string }Returns: {- bomId: stringdescription: stringisRoot: booleanitemId: string@@ -53397,7 +54414,6 @@ export type Database = {get_job_methods_by_method_id: {Args: { mid: string }Returns: {- bomId: stringdescription: stringisRoot: booleanitemId: string@@ -53695,7 +54711,6 @@ export type Database = {get_method_tree: {Args: { uid: string }Returns: {- bomId: stringdescription: stringexternalId: JsonisRoot: boolean@@ -54033,7 +55048,6 @@ export type Database = {get_quote_methods: {Args: { qid: string }Returns: {- bomId: stringdescription: stringexternalId: JsonisRoot: boolean@@ -54059,7 +55073,6 @@ export type Database = {get_quote_methods_by_method_id: {Args: { mid: string }Returns: {- bomId: stringdescription: stringexternalId: JsonisRoot: boolean@@ -54415,6 +55428,10 @@ export type Database = {Args: { p_company_id: string }Returns: undefined}+ populate_sales_search_results: {+ Args: { p_company_id: string }+ Returns: undefined+ }search_company_index: {Args: {p_company_id: string@@ -54816,6 +55833,11 @@ export type Database = {purchasePriceUpdateTiming:| "Purchase Invoice Post"| "Purchase Order Finalize"+ purchasingRfqStatus:+ | "Draft"+ | "Ready for request"+ | "Requested"+ | "Closed"qualityDocumentStatus: "Draft" | "Active" | "Archived"quoteLineStatus: "Not Started" | "In Progress" | "Complete" | "No Quote"quoteStatus:@@ -55955,6 +56977,12 @@ export const Constants = {"Purchase Invoice Post","Purchase Order Finalize",],+ purchasingRfqStatus: [+ "Draft",+ "Ready for request",+ "Requested",+ "Closed",+ ],qualityDocumentStatus: ["Draft", "Active", "Archived"],quoteLineStatus: ["Not Started", "In Progress", "Complete", "No Quote"],quoteStatus: [diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.tsindex 30e2023b66..ddcf9cfa59 100644--- a/packages/database/supabase/functions/lib/types.ts+++ b/packages/database/supabase/functions/lib/types.ts@@ -10280,7 +10280,6 @@ export type Database = {}jobMaterial: {Row: {- bomId: string | nullcompanyId: stringcreatedAt: stringcreatedBy: string@@ -10310,7 +10309,6 @@ export type Database = {updatedBy: string | null}Insert: {- bomId?: string | nullcompanyId: stringcreatedAt?: stringcreatedBy: string@@ -10340,7 +10338,6 @@ export type Database = {updatedBy?: string | null}Update: {- bomId?: string | nullcompanyId?: stringcreatedAt?: stringcreatedBy?: string@@ -15188,7 +15185,6 @@ export type Database = {}methodMaterial: {Row: {- bomId: string | nullcompanyId: stringcreatedAt: stringcreatedBy: string@@ -15212,7 +15208,6 @@ export type Database = {updatedBy: string | null}Insert: {- bomId?: string | nullcompanyId: stringcreatedAt?: stringcreatedBy: string@@ -15236,7 +15231,6 @@ export type Database = {updatedBy?: string | null}Update: {- bomId?: string | nullcompanyId?: stringcreatedAt?: stringcreatedBy?: string@@ -19907,21 +19901,21 @@ export type Database = {opportunity: {Row: {companyId: string- customerId: string+ customerId: string | nullid: stringpurchaseOrderDocumentPath: string | nullrequestForQuoteDocumentPath: string | null}Insert: {companyId: string- customerId: string+ customerId?: string | nullid?: stringpurchaseOrderDocumentPath?: string | nullrequestForQuoteDocumentPath?: string | null}Update: {companyId?: string- customerId?: string+ customerId?: string | nullid?: stringpurchaseOrderDocumentPath?: string | nullrequestForQuoteDocumentPath?: string | null@@ -24936,6 +24930,819 @@ export type Database = {},]}+ purchasingRfq: {+ Row: {+ assignee: string | null+ companyId: string+ createdAt: string | null+ createdBy: string | null+ customFields: Json | null+ employeeId: string | null+ expirationDate: string | null+ id: string+ internalNotes: string | null+ locationId: string | null+ notes: Json | null+ revisionId: number+ rfqDate: string+ rfqId: string+ status: Database["public"]["Enums"]["purchasingRfqStatus"]+ updatedAt: string | null+ updatedBy: string | null+ }+ Insert: {+ assignee?: string | null+ companyId: string+ createdAt?: string | null+ createdBy?: string | null+ customFields?: Json | null+ employeeId?: string | null+ expirationDate?: string | null+ id?: string+ internalNotes?: string | null+ locationId?: string | null+ notes?: Json | null+ revisionId?: number+ rfqDate: string+ rfqId: string+ status?: Database["public"]["Enums"]["purchasingRfqStatus"]+ updatedAt?: string | null+ updatedBy?: string | null+ }+ Update: {+ assignee?: string | null+ companyId?: string+ createdAt?: string | null+ createdBy?: string | null+ customFields?: Json | null+ employeeId?: string | null+ expirationDate?: string | null+ id?: string+ internalNotes?: string | null+ locationId?: string | null+ notes?: Json | null+ revisionId?: number+ rfqDate?: string+ rfqId?: string+ status?: Database["public"]["Enums"]["purchasingRfqStatus"]+ updatedAt?: string | null+ updatedBy?: string | null+ }+ Relationships: [+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfq_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "companies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "customFieldTables"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfq_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "integrations"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfq_locationId_fkey"+ columns: ["locationId"]+ isOneToOne: false+ referencedRelation: "location"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }+ purchasingRfqFavorite: {+ Row: {+ rfqId: string+ userId: string+ }+ Insert: {+ rfqId: string+ userId: string+ }+ Update: {+ rfqId?: string+ userId?: string+ }+ Relationships: [+ {+ foreignKeyName: "purchasingRfqFavorites_purchasingRfqId_fkey"+ columns: ["rfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfq"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqFavorites_purchasingRfqId_fkey"+ columns: ["rfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfqs"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqFavorites_userId_fkey"+ columns: ["userId"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqFavorites_userId_fkey"+ columns: ["userId"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqFavorites_userId_fkey"+ columns: ["userId"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqFavorites_userId_fkey"+ columns: ["userId"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqFavorites_userId_fkey"+ columns: ["userId"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }+ purchasingRfqLine: {+ Row: {+ companyId: string+ createdAt: string | null+ createdBy: string+ customFields: Json | null+ description: string | null+ externalNotes: Json | null+ id: string+ internalNotes: Json | null+ itemId: string | null+ order: number+ partNumber: string | null+ partRevision: string | null+ purchasingRfqId: string+ quantity: number[] | null+ unitOfMeasureCode: string+ updatedAt: string | null+ updatedBy: string | null+ }+ Insert: {+ companyId: string+ createdAt?: string | null+ createdBy: string+ customFields?: Json | null+ description?: string | null+ externalNotes?: Json | null+ id?: string+ internalNotes?: Json | null+ itemId?: string | null+ order?: number+ partNumber?: string | null+ partRevision?: string | null+ purchasingRfqId: string+ quantity?: number[] | null+ unitOfMeasureCode: string+ updatedAt?: string | null+ updatedBy?: string | null+ }+ Update: {+ companyId?: string+ createdAt?: string | null+ createdBy?: string+ customFields?: Json | null+ description?: string | null+ externalNotes?: Json | null+ id?: string+ internalNotes?: Json | null+ itemId?: string | null+ order?: number+ partNumber?: string | null+ partRevision?: string | null+ purchasingRfqId?: string+ quantity?: number[] | null+ unitOfMeasureCode?: string+ updatedAt?: string | null+ updatedBy?: string | null+ }+ Relationships: [+ {+ foreignKeyName: "purchasingRfqLine_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "companies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "customFieldTables"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqLine_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "integrations"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "consumables"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "item"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "materials"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "parts"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "tools"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfq"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfqs"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_unitOfMeasureCode_fkey"+ columns: ["unitOfMeasureCode", "companyId"]+ isOneToOne: false+ referencedRelation: "unitOfMeasure"+ referencedColumns: ["code", "companyId"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }+ purchasingRfqSupplier: {+ Row: {+ companyId: string+ createdAt: string | null+ createdBy: string | null+ id: string+ purchasingRfqId: string+ supplierId: string+ }+ Insert: {+ companyId: string+ createdAt?: string | null+ createdBy?: string | null+ id?: string+ purchasingRfqId: string+ supplierId: string+ }+ Update: {+ companyId?: string+ createdAt?: string | null+ createdBy?: string | null+ id?: string+ purchasingRfqId?: string+ supplierId?: string+ }+ Relationships: [+ {+ foreignKeyName: "purchasingRfqSupplier_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "companies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "customFieldTables"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "integrations"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfq"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfqs"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_supplierId_fkey"+ columns: ["supplierId"]+ isOneToOne: false+ referencedRelation: "contractors"+ referencedColumns: ["supplierId"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_supplierId_fkey"+ columns: ["supplierId"]+ isOneToOne: false+ referencedRelation: "partners"+ referencedColumns: ["supplierId"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_supplierId_fkey"+ columns: ["supplierId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderSuppliers"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_supplierId_fkey"+ columns: ["supplierId"]+ isOneToOne: false+ referencedRelation: "supplier"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqSupplier_supplierId_fkey"+ columns: ["supplierId"]+ isOneToOne: false+ referencedRelation: "suppliers"+ referencedColumns: ["id"]+ },+ ]+ }+ purchasingRfqToPurchaseOrder: {+ Row: {+ companyId: string+ purchaseOrderId: string+ purchasingRfqId: string+ }+ Insert: {+ companyId: string+ purchaseOrderId: string+ purchasingRfqId: string+ }+ Update: {+ companyId?: string+ purchaseOrderId?: string+ purchasingRfqId?: string+ }+ Relationships: [+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "companies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "customFieldTables"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "integrations"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrder"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrderLocations"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_purchaseOrderId_fkey"+ columns: ["purchaseOrderId"]+ isOneToOne: false+ referencedRelation: "purchaseOrders"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfq"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToPurchaseOrder_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfqs"+ referencedColumns: ["id"]+ },+ ]+ }+ purchasingRfqToSupplierQuote: {+ Row: {+ companyId: string+ purchasingRfqId: string+ supplierQuoteId: string+ }+ Insert: {+ companyId: string+ purchasingRfqId: string+ supplierQuoteId: string+ }+ Update: {+ companyId?: string+ purchasingRfqId?: string+ supplierQuoteId?: string+ }+ Relationships: [+ {+ foreignKeyName: "purchasingRfqToSupplierQuote_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "companies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToSupplierQuote_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToSupplierQuote_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "customFieldTables"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqToSupplierQuote_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "integrations"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqToSupplierQuote_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfq"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToSupplierQuote_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfqs"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToSupplierQuote_supplierQuoteId_fkey"+ columns: ["supplierQuoteId"]+ isOneToOne: false+ referencedRelation: "supplierQuote"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqToSupplierQuote_supplierQuoteId_fkey"+ columns: ["supplierQuoteId"]+ isOneToOne: false+ referencedRelation: "supplierQuotes"+ referencedColumns: ["id"]+ },+ ]+ }qualityDocument: {Row: {assignee: string | null@@ -26495,7 +27302,6 @@ export type Database = {}quoteMaterial: {Row: {- bomId: string | nullcompanyId: stringcreatedAt: stringcreatedBy: string@@ -26522,7 +27328,6 @@ export type Database = {updatedBy: string | null}Insert: {- bomId?: string | nullcompanyId: stringcreatedAt?: stringcreatedBy: string@@ -26549,7 +27354,6 @@ export type Database = {updatedBy?: string | null}Update: {- bomId?: string | nullcompanyId?: stringcreatedAt?: stringcreatedBy?: string@@ -31334,174 +32138,6 @@ export type Database = {},]}- searchIndex_BJiGdDNuetJ1iyE8USN7AD: {- Row: {- createdAt: string- description: string | null- entityId: string- entityType: string- id: number- link: string- metadata: Json | null- searchVector: unknown- tags: string[] | null- title: string- updatedAt: string | null- }- Insert: {- createdAt?: string- description?: string | null- entityId: string- entityType: string- id?: number- link: string- metadata?: Json | null- searchVector?: unknown- tags?: string[] | null- title: string- updatedAt?: string | null- }- Update: {- createdAt?: string- description?: string | null- entityId?: string- entityType?: string- id?: number- link?: string- metadata?: Json | null- searchVector?: unknown- tags?: string[] | null- title?: string- updatedAt?: string | null- }- Relationships: []- }- searchIndex_L4saDKMCpFQurK9c3bEr1G: {- Row: {- createdAt: string- description: string | null- entityId: string- entityType: string- id: number- link: string- metadata: Json | null- searchVector: unknown- tags: string[] | null- title: string- updatedAt: string | null- }- Insert: {- createdAt?: string- description?: string | null- entityId: string- entityType: string- id?: number- link: string- metadata?: Json | null- searchVector?: unknown- tags?: string[] | null- title: string- updatedAt?: string | null- }- Update: {- createdAt?: string- description?: string | null- entityId?: string- entityType?: string- id?: number- link?: string- metadata?: Json | null- searchVector?: unknown- tags?: string[] | null- title?: string- updatedAt?: string | null- }- Relationships: []- }- searchIndex_Nrc78GJXti5gro8G5m3k9u: {- Row: {- createdAt: string- description: string | null- entityId: string- entityType: string- id: number- link: string- metadata: Json | null- searchVector: unknown- tags: string[] | null- title: string- updatedAt: string | null- }- Insert: {- createdAt?: string- description?: string | null- entityId: string- entityType: string- id?: number- link: string- metadata?: Json | null- searchVector?: unknown- tags?: string[] | null- title: string- updatedAt?: string | null- }- Update: {- createdAt?: string- description?: string | null- entityId?: string- entityType?: string- id?: number- link?: string- metadata?: Json | null- searchVector?: unknown- tags?: string[] | null- title?: string- updatedAt?: string | null- }- Relationships: []- }- searchIndex_TzPMV5bvte7aRhGwLwmjs9: {- Row: {- createdAt: string- description: string | null- entityId: string- entityType: string- id: number- link: string- metadata: Json | null- searchVector: unknown- tags: string[] | null- title: string- updatedAt: string | null- }- Insert: {- createdAt?: string- description?: string | null- entityId: string- entityType: string- id?: number- link: string- metadata?: Json | null- searchVector?: unknown- tags?: string[] | null- title: string- updatedAt?: string | null- }- Update: {- createdAt?: string- description?: string | null- entityId?: string- entityType?: string- id?: number- link?: string- metadata?: Json | null- searchVector?: unknown- tags?: string[] | null- title?: string- updatedAt?: string | null- }- Relationships: []- }searchIndexRegistry: {Row: {companyId: string@@ -42916,7 +43552,6 @@ export type Database = {}jobMaterialWithMakeMethodId: {Row: {- bomId: string | nullcompanyId: string | nullcreatedAt: string | nullcreatedBy: string | null@@ -42943,6 +43578,7 @@ export type Database = {requiresSerialTracking: boolean | nullscrapQuantity: number | nullshelfId: string | null+ shelfName: string | nullunitCost: number | nullunitOfMeasureCode: string | nullupdatedAt: string | null@@ -46928,14 +47564,14 @@ export type Database = {Relationships: [{foreignKeyName: "address_countryCode_fkey"- columns: ["supplierCountryCode"]+ columns: ["customerCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]},{foreignKeyName: "address_countryCode_fkey"- columns: ["customerCountryCode"]+ columns: ["supplierCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]@@ -47307,6 +47943,389 @@ export type Database = {},]}+ purchasingRfqLines: {+ Row: {+ companyId: string | null+ createdAt: string | null+ createdBy: string | null+ customFields: Json | null+ description: string | null+ externalNotes: Json | null+ id: string | null+ internalNotes: Json | null+ itemId: string | null+ itemName: string | null+ itemReadableId: string | null+ itemType: Database["public"]["Enums"]["itemType"] | null+ modelPath: string | null+ order: number | null+ partNumber: string | null+ partRevision: string | null+ purchasingRfqId: string | null+ quantity: number[] | null+ thumbnailPath: string | null+ unitOfMeasureCode: string | null+ updatedAt: string | null+ updatedBy: string | null+ }+ Relationships: [+ {+ foreignKeyName: "purchasingRfqLine_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "companies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "customFieldTables"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqLine_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "integrations"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "consumables"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "item"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "materials"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "parts"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "tools"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfq"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_purchasingRfqId_fkey"+ columns: ["purchasingRfqId"]+ isOneToOne: false+ referencedRelation: "purchasingRfqs"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_unitOfMeasureCode_fkey"+ columns: ["unitOfMeasureCode", "companyId"]+ isOneToOne: false+ referencedRelation: "unitOfMeasure"+ referencedColumns: ["code", "companyId"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfqLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }+ purchasingRfqs: {+ Row: {+ assignee: string | null+ companyId: string | null+ createdAt: string | null+ createdBy: string | null+ customFields: Json | null+ employeeId: string | null+ expirationDate: string | null+ favorite: boolean | null+ id: string | null+ internalNotes: string | null+ locationId: string | null+ locationName: string | null+ notes: Json | null+ revisionId: number | null+ rfqDate: string | null+ rfqId: string | null+ status: Database["public"]["Enums"]["purchasingRfqStatus"] | null+ supplierCount: number | null+ updatedAt: string | null+ updatedBy: string | null+ }+ Relationships: [+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_assigneeId_fkey"+ columns: ["assignee"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfq_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "companies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "customFieldTables"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfq_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "integrations"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_employeeId_fkey"+ columns: ["employeeId"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "purchasingRfq_locationId_fkey"+ columns: ["locationId"]+ isOneToOne: false+ referencedRelation: "location"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "purchasingRfq_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }qualityActions: {Row: {actionType: string | null@@ -48154,7 +49173,6 @@ export type Database = {}quoteMaterialWithMakeMethodId: {Row: {- bomId: string | nullcompanyId: string | nullcreatedAt: string | nullcreatedBy: string | null@@ -49620,14 +50638,14 @@ export type Database = {Relationships: [{foreignKeyName: "address_countryCode_fkey"- columns: ["invoiceCountryCode"]+ columns: ["customerCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]},{foreignKeyName: "address_countryCode_fkey"- columns: ["customerCountryCode"]+ columns: ["invoiceCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]@@ -53373,7 +54391,6 @@ export type Database = {get_job_method: {Args: { jid: string }Returns: {- bomId: stringdescription: stringisRoot: booleanitemId: string@@ -53397,7 +54414,6 @@ export type Database = {get_job_methods_by_method_id: {Args: { mid: string }Returns: {- bomId: stringdescription: stringisRoot: booleanitemId: string@@ -53695,7 +54711,6 @@ export type Database = {get_method_tree: {Args: { uid: string }Returns: {- bomId: stringdescription: stringexternalId: JsonisRoot: boolean@@ -54033,7 +55048,6 @@ export type Database = {get_quote_methods: {Args: { qid: string }Returns: {- bomId: stringdescription: stringexternalId: JsonisRoot: boolean@@ -54059,7 +55073,6 @@ export type Database = {get_quote_methods_by_method_id: {Args: { mid: string }Returns: {- bomId: stringdescription: stringexternalId: JsonisRoot: boolean@@ -54415,6 +55428,10 @@ export type Database = {Args: { p_company_id: string }Returns: undefined}+ populate_sales_search_results: {+ Args: { p_company_id: string }+ Returns: undefined+ }search_company_index: {Args: {p_company_id: string@@ -54816,6 +55833,11 @@ export type Database = {purchasePriceUpdateTiming:| "Purchase Invoice Post"| "Purchase Order Finalize"+ purchasingRfqStatus:+ | "Draft"+ | "Ready for request"+ | "Requested"+ | "Closed"qualityDocumentStatus: "Draft" | "Active" | "Archived"quoteLineStatus: "Not Started" | "In Progress" | "Complete" | "No Quote"quoteStatus:@@ -55955,6 +56977,12 @@ export const Constants = {"Purchase Invoice Post","Purchase Order Finalize",],+ purchasingRfqStatus: [+ "Draft",+ "Ready for request",+ "Requested",+ "Closed",+ ],qualityDocumentStatus: ["Draft", "Active", "Archived"],quoteLineStatus: ["Not Started", "In Progress", "Complete", "No Quote"],quoteStatus: [diff --git a/packages/database/supabase/migrations/20260115143000_purchasing-rfq.sql b/packages/database/supabase/migrations/20260115143000_purchasing-rfq.sqlnew file mode 100644index 0000000000..f47c7ecccb--- /dev/null+++ b/packages/database/supabase/migrations/20260115143000_purchasing-rfq.sql@@ -0,0 +1,334 @@+-- Purchasing RFQ Status Enum+CREATE TYPE "purchasingRfqStatus" AS ENUM (+ 'Draft',+ 'Ready for request',+ 'Requested',+ 'Closed'+);++-- Custom Field Table Entries+INSERT INTO "customFieldTable" ("table", "name", "module")+VALUES ('purchasingRfq', 'Purchasing RFQ', 'Purchasing')+ON CONFLICT DO NOTHING;++INSERT INTO "customFieldTable" ("table", "name", "module")+VALUES ('purchasingRfqLine', 'Purchasing RFQ Line', 'Purchasing')+ON CONFLICT DO NOTHING;++-- Sequence for Purchasing RFQ+INSERT INTO "sequence" ("table", "name", "prefix", "suffix", "next", "size", "step", "companyId")+SELECT+ 'purchasingRfq',+ 'Purchasing RFQ',+ 'PRFQ',+ NULL,+ 0,+ 6,+ 1,+ "id"+FROM "company"+ON CONFLICT DO NOTHING;++-- Main Purchasing RFQ Table+CREATE TABLE "purchasingRfq" (+ "id" TEXT NOT NULL DEFAULT xid(),+ "rfqId" TEXT NOT NULL,+ "revisionId" INTEGER NOT NULL DEFAULT 0,+ "status" "purchasingRfqStatus" NOT NULL DEFAULT 'Draft',+ "employeeId" TEXT,+ "rfqDate" DATE NOT NULL,+ "expirationDate" DATE,+ "internalNotes" TEXT,+ "notes" JSON DEFAULT '{}',+ "locationId" TEXT,+ "assignee" TEXT,+ "companyId" TEXT NOT NULL,+ "customFields" JSONB,+ "createdAt" TIMESTAMP WITH TIME ZONE DEFAULT now(),+ "createdBy" TEXT,+ "updatedAt" TIMESTAMP WITH TIME ZONE DEFAULT now(),+ "updatedBy" TEXT,++ CONSTRAINT "purchasingRfq_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "purchasingRfq_rfqId_companyId_key" UNIQUE ("rfqId", "companyId"),+ CONSTRAINT "purchasingRfq_employeeId_fkey" FOREIGN KEY ("employeeId") REFERENCES "user" ("id") ON DELETE SET NULL,+ CONSTRAINT "purchasingRfq_locationId_fkey" FOREIGN KEY ("locationId") REFERENCES "location" ("id") ON DELETE SET NULL,+ CONSTRAINT "purchasingRfq_assigneeId_fkey" FOREIGN KEY ("assignee") REFERENCES "user" ("id") ON DELETE SET NULL,+ CONSTRAINT "purchasingRfq_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE CASCADE,+ CONSTRAINT "purchasingRfq_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user" ("id") ON DELETE SET NULL,+ CONSTRAINT "purchasingRfq_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE SET NULL+);++CREATE INDEX "purchasingRfq_companyId_idx" ON "purchasingRfq" ("companyId");+CREATE INDEX "purchasingRfq_rfqId_idx" ON "purchasingRfq" ("rfqId");+CREATE INDEX "purchasingRfq_status_idx" ON "purchasingRfq" ("status", "companyId");++ALTER TABLE "purchasingRfq" ENABLE ROW LEVEL SECURITY;++CREATE POLICY "Employees with purchasing_view can view purchasingRfq"+ ON "purchasingRfq" FOR SELECT USING (+ has_company_permission('purchasing_view', "companyId") AND+ has_role('employee', "companyId")+ );++CREATE POLICY "Employees with purchasing_create can insert purchasingRfq"+ ON "purchasingRfq" FOR INSERT WITH CHECK (+ has_company_permission('purchasing_create', "companyId") AND+ has_role('employee', "companyId")+ );++CREATE POLICY "Employees with purchasing_update can update purchasingRfq"+ ON "purchasingRfq" FOR UPDATE USING (+ has_company_permission('purchasing_update', "companyId") AND+ has_role('employee', "companyId")+ );++CREATE POLICY "Employees with purchasing_delete can delete purchasingRfq"+ ON "purchasingRfq" FOR DELETE USING (+ has_company_permission('purchasing_delete', "companyId") AND+ has_role('employee', "companyId")+ );++-- Purchasing RFQ Supplier Join Table+CREATE TABLE "purchasingRfqSupplier" (+ "id" TEXT NOT NULL DEFAULT xid(),+ "purchasingRfqId" TEXT NOT NULL,+ "supplierId" TEXT NOT NULL,+ "companyId" TEXT NOT NULL,+ "createdAt" TIMESTAMP WITH TIME ZONE DEFAULT now(),+ "createdBy" TEXT,++ CONSTRAINT "purchasingRfqSupplier_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "purchasingRfqSupplier_unique" UNIQUE ("purchasingRfqId", "supplierId"),+ CONSTRAINT "purchasingRfqSupplier_purchasingRfqId_fkey" FOREIGN KEY ("purchasingRfqId") REFERENCES "purchasingRfq" ("id") ON DELETE CASCADE,+ CONSTRAINT "purchasingRfqSupplier_supplierId_fkey" FOREIGN KEY ("supplierId") REFERENCES "supplier" ("id") ON DELETE CASCADE,+ CONSTRAINT "purchasingRfqSupplier_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE CASCADE,+ CONSTRAINT "purchasingRfqSupplier_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user" ("id") ON DELETE SET NULL+);++CREATE INDEX "purchasingRfqSupplier_purchasingRfqId_idx" ON "purchasingRfqSupplier" ("purchasingRfqId");+CREATE INDEX "purchasingRfqSupplier_supplierId_idx" ON "purchasingRfqSupplier" ("supplierId");++ALTER TABLE "purchasingRfqSupplier" ENABLE ROW LEVEL SECURITY;++CREATE POLICY "Employees with purchasing_view can view purchasingRfqSupplier"+ ON "purchasingRfqSupplier" FOR SELECT USING (+ has_company_permission('purchasing_view', "companyId") AND+ has_role('employee', "companyId")+ );++CREATE POLICY "Employees with purchasing_create can insert purchasingRfqSupplier"+ ON "purchasingRfqSupplier" FOR INSERT WITH CHECK (+ has_company_permission('purchasing_create', "companyId") AND+ has_role('employee', "companyId")+ );++CREATE POLICY "Employees with purchasing_update can update purchasingRfqSupplier"+ ON "purchasingRfqSupplier" FOR UPDATE USING (+ has_company_permission('purchasing_update', "companyId") AND+ has_role('employee', "companyId")+ );++CREATE POLICY "Employees with purchasing_delete can delete purchasingRfqSupplier"+ ON "purchasingRfqSupplier" FOR DELETE USING (+ has_company_permission('purchasing_delete', "companyId") AND+ has_role('employee', "companyId")+ );++-- Purchasing RFQ Line Table+CREATE TABLE "purchasingRfqLine" (+ "id" TEXT NOT NULL DEFAULT xid(),+ "purchasingRfqId" TEXT NOT NULL,+ "itemId" TEXT,+ "partNumber" TEXT,+ "partRevision" TEXT,+ "description" TEXT,+ "quantity" NUMERIC(20, 2)[] DEFAULT ARRAY[1]::NUMERIC(20, 2)[],+ "unitOfMeasureCode" TEXT NOT NULL,+ "order" DOUBLE PRECISION NOT NULL DEFAULT 0,+ "internalNotes" JSON DEFAULT '{}',+ "externalNotes" JSON DEFAULT '{}',+ "companyId" TEXT NOT NULL,+ "customFields" JSONB DEFAULT '{}',+ "createdAt" TIMESTAMP WITH TIME ZONE DEFAULT now(),+ "createdBy" TEXT NOT NULL,+ "updatedAt" TIMESTAMP WITH TIME ZONE,+ "updatedBy" TEXT,++ CONSTRAINT "purchasingRfqLine_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "purchasingRfqLine_purchasingRfqId_fkey" FOREIGN KEY ("purchasingRfqId") REFERENCES "purchasingRfq" ("id") ON DELETE CASCADE,+ CONSTRAINT "purchasingRfqLine_itemId_fkey" FOREIGN KEY ("itemId") REFERENCES "item" ("id") ON UPDATE CASCADE ON DELETE RESTRICT,+ CONSTRAINT "purchasingRfqLine_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE CASCADE,+ CONSTRAINT "purchasingRfqLine_unitOfMeasureCode_fkey" FOREIGN KEY ("unitOfMeasureCode", "companyId") REFERENCES "unitOfMeasure" ("code", "companyId") ON DELETE RESTRICT,+ CONSTRAINT "purchasingRfqLine_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user" ("id") ON DELETE RESTRICT,+ CONSTRAINT "purchasingRfqLine_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE SET NULL,+ CONSTRAINT "purchasingRfqLine_quantity_check" CHECK (array_length("quantity", 1) > 0)+);++CREATE INDEX "purchasingRfqLine_purchasingRfqId_idx" ON "purchasingRfqLine" ("purchasingRfqId");++ALTER TABLE "purchasingRfqLine" ENABLE ROW LEVEL SECURITY;++CREATE POLICY "Employees with purchasing_view can view purchasingRfqLine"+ ON "purchasingRfqLine" FOR SELECT USING (+ has_company_permission('purchasing_view', "companyId") AND+ has_role('employee', "companyId")+ );++CREATE POLICY "Employees with purchasing_create can insert purchasingRfqLine"+ ON "purchasingRfqLine" FOR INSERT WITH CHECK (+ has_company_permission('purchasing_create', "companyId") AND+ has_role('employee', "companyId")+ );++CREATE POLICY "Employees with purchasing_update can update purchasingRfqLine"+ ON "purchasingRfqLine" FOR UPDATE USING (+ has_company_permission('purchasing_update', "companyId") AND+ has_role('employee', "companyId")+ );++CREATE POLICY "Employees with purchasing_delete can delete purchasingRfqLine"+ ON "purchasingRfqLine" FOR DELETE USING (+ has_company_permission('purchasing_delete', "companyId") AND+ has_role('employee', "companyId")+ );++-- Relationship Tables+CREATE TABLE "purchasingRfqToSupplierQuote" (+ "purchasingRfqId" TEXT NOT NULL,+ "supplierQuoteId" TEXT NOT NULL,+ "companyId" TEXT NOT NULL,++ PRIMARY KEY ("purchasingRfqId", "supplierQuoteId"),+ FOREIGN KEY ("purchasingRfqId") REFERENCES "purchasingRfq" ("id") ON DELETE CASCADE,+ FOREIGN KEY ("supplierQuoteId") REFERENCES "supplierQuote" ("id") ON DELETE CASCADE,+ FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE CASCADE+);++CREATE INDEX "purchasingRfqToSupplierQuote_companyId_idx" ON "purchasingRfqToSupplierQuote" ("companyId");++ALTER TABLE "purchasingRfqToSupplierQuote" ENABLE ROW LEVEL SECURITY;++CREATE POLICY "Employees with purchasing_view can view purchasingRfqToSupplierQuote"+ ON "purchasingRfqToSupplierQuote" FOR SELECT USING (+ has_company_permission('purchasing_view', "companyId") AND+ has_role('employee', "companyId")+ );++CREATE POLICY "Employees with purchasing_create can insert purchasingRfqToSupplierQuote"+ ON "purchasingRfqToSupplierQuote" FOR INSERT WITH CHECK (+ has_company_permission('purchasing_create', "companyId") AND+ has_role('employee', "companyId")+ );++CREATE TABLE "purchasingRfqToPurchaseOrder" (+ "purchasingRfqId" TEXT NOT NULL,+ "purchaseOrderId" TEXT NOT NULL,+ "companyId" TEXT NOT NULL,++ PRIMARY KEY ("purchasingRfqId", "purchaseOrderId"),+ FOREIGN KEY ("purchasingRfqId") REFERENCES "purchasingRfq" ("id") ON DELETE CASCADE,+ FOREIGN KEY ("purchaseOrderId") REFERENCES "purchaseOrder" ("id") ON DELETE CASCADE,+ FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE CASCADE+);++CREATE INDEX "purchasingRfqToPurchaseOrder_companyId_idx" ON "purchasingRfqToPurchaseOrder" ("companyId");++ALTER TABLE "purchasingRfqToPurchaseOrder" ENABLE ROW LEVEL SECURITY;++CREATE POLICY "Employees with purchasing_view can view purchasingRfqToPurchaseOrder"+ ON "purchasingRfqToPurchaseOrder" FOR SELECT USING (+ has_company_permission('purchasing_view', "companyId") AND+ has_role('employee', "companyId")+ );++CREATE POLICY "Employees with purchasing_create can insert purchasingRfqToPurchaseOrder"+ ON "purchasingRfqToPurchaseOrder" FOR INSERT WITH CHECK (+ has_company_permission('purchasing_create', "companyId") AND+ has_role('employee', "companyId")+ );++-- Favorites Table+CREATE TABLE "purchasingRfqFavorite" (+ "rfqId" TEXT NOT NULL,+ "userId" TEXT NOT NULL,++ CONSTRAINT "purchasingRfqFavorites_pkey" PRIMARY KEY ("rfqId", "userId"),+ CONSTRAINT "purchasingRfqFavorites_purchasingRfqId_fkey" FOREIGN KEY ("rfqId") REFERENCES "purchasingRfq"("id") ON DELETE CASCADE,+ CONSTRAINT "purchasingRfqFavorites_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE+);++CREATE INDEX "purchasingRfqFavorites_userId_idx" ON "purchasingRfqFavorite" ("userId");+CREATE INDEX "purchasingRfqFavorites_purchasingRfqId_idx" ON "purchasingRfqFavorite" ("rfqId");++ALTER TABLE "purchasingRfqFavorite" ENABLE ROW LEVEL SECURITY;++CREATE POLICY "Users can view their own purchasingRfq favorites" ON "purchasingRfqFavorite"+ FOR SELECT USING (+ auth.uid()::text = "userId"+ );++CREATE POLICY "Users can create their own purchasingRfq favorites" ON "purchasingRfqFavorite"+ FOR INSERT WITH CHECK (+ auth.uid()::text = "userId"+ );++CREATE POLICY "Users can delete their own purchasingRfq favorites" ON "purchasingRfqFavorite"+ FOR DELETE USING (+ auth.uid()::text = "userId"+ );++-- Views+CREATE OR REPLACE VIEW "purchasingRfqs" WITH(SECURITY_INVOKER=true) AS+ SELECT+ rfq.*,+ l."name" AS "locationName",+ (SELECT COUNT(*) FROM "purchasingRfqSupplier" rs WHERE rs."purchasingRfqId" = rfq.id) AS "supplierCount",+ EXISTS(SELECT 1 FROM "purchasingRfqFavorite" rf WHERE rf."rfqId" = rfq.id AND rf."userId" = auth.uid()::text) AS favorite+ FROM "purchasingRfq" rfq+ LEFT JOIN "location" l ON l.id = rfq."locationId";++CREATE OR REPLACE VIEW "purchasingRfqLines" WITH(SECURITY_INVOKER=true) AS+ SELECT+ prl.*,+ i."name" as "itemName",+ i."readableId" AS "itemReadableId",+ i."type" AS "itemType",+ i."thumbnailPath",+ mu."modelPath"+ FROM "purchasingRfqLine" prl+ LEFT JOIN "item" i ON i.id = prl."itemId"+ LEFT JOIN "modelUpload" mu ON mu.id = i."modelUploadId";++-- Storage Policies for Documents+CREATE POLICY "Purchasing RFQ documents view requires purchasing_view" ON storage.objects+FOR SELECT USING (+ bucket_id = 'private'+ AND has_role('employee', (storage.foldername(name))[1])+ AND has_company_permission('purchasing_view', (storage.foldername(name))[1])+ AND (storage.foldername(name))[2] = 'purchasing-rfq'+);++CREATE POLICY "Purchasing RFQ documents insert requires purchasing_create" ON storage.objects+FOR INSERT WITH CHECK (+ bucket_id = 'private'+ AND has_role('employee', (storage.foldername(name))[1])+ AND has_company_permission('purchasing_create', (storage.foldername(name))[1])+ AND (storage.foldername(name))[2] = 'purchasing-rfq'+);++CREATE POLICY "Purchasing RFQ documents update requires purchasing_update" ON storage.objects+FOR UPDATE USING (+ bucket_id = 'private'+ AND has_role('employee', (storage.foldername(name))[1])+ AND has_company_permission('purchasing_update', (storage.foldername(name))[1])+ AND (storage.foldername(name))[2] = 'purchasing-rfq'+);++CREATE POLICY "Purchasing RFQ documents delete requires purchasing_delete" ON storage.objects+FOR DELETE USING (+ bucket_id = 'private'+ AND has_role('employee', (storage.foldername(name))[1])+ AND has_company_permission('purchasing_delete', (storage.foldername(name))[1])+ AND (storage.foldername(name))[2] = 'purchasing-rfq'+);