Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix: shipment status header invoice link

Brad Barbin7d3e1d666f3b
diff --git a/apps/erp/app/components/Assignee.tsx b/apps/erp/app/components/Assignee.tsx
index f7bf2cbe13..62dae169b4 100644
--- a/apps/erp/app/components/Assignee.tsx
+++ b/apps/erp/app/components/Assignee.tsx
@@ -151,7 +151,7 @@ const Assign = forwardRef<HTMLButtonElement, AssigneeProps>(
</PopoverTrigger>
<PopoverContent
align="start"
- className="min-w-[260px] w-[--radix-popover-trigger-width] p-0"
+ className="min-w-[--radix-popover-trigger-width] p-0"
>
<Command id="assignee-options">
<CommandInput placeholder="Search..." className="h-9" />
diff --git a/apps/erp/app/components/Layout/Navigation/PrimaryNavigation.tsx b/apps/erp/app/components/Layout/Navigation/PrimaryNavigation.tsx
index 524f29a978..6be9087b67 100644
--- a/apps/erp/app/components/Layout/Navigation/PrimaryNavigation.tsx
+++ b/apps/erp/app/components/Layout/Navigation/PrimaryNavigation.tsx
@@ -112,7 +112,7 @@ const NavigationIconLink = forwardRef<
className={cn(classes, props.className)}
prefetch="intent"
>
- <link.icon className={cn(...iconClasses)} />
+ <link.icon className={cn(...iconClasses)} style={{ color: link.color }} />
<span
aria-hidden={isOpen || undefined}
diff --git a/apps/erp/app/components/Table/components/Filter/Filter.tsx b/apps/erp/app/components/Table/components/Filter/Filter.tsx
index e048c89457..8bf3ea1b3f 100644
--- a/apps/erp/app/components/Table/components/Filter/Filter.tsx
+++ b/apps/erp/app/components/Table/components/Filter/Filter.tsx
@@ -152,7 +152,7 @@ const Filter = forwardRef<HTMLButtonElement, FilterProps>(
</PopoverTrigger>
<PopoverContent
align="start"
- className="min-w-[260px] w-[--radix-popover-trigger-width] p-0"
+ className="min-w-[--radix-popover-trigger-width] p-0"
>
<Command>
<CommandInput
diff --git a/apps/erp/app/hooks/useFlags.tsx b/apps/erp/app/hooks/useFlags.tsx
index ba1862587c..f95ec5c5e2 100644
--- a/apps/erp/app/hooks/useFlags.tsx
+++ b/apps/erp/app/hooks/useFlags.tsx
@@ -2,8 +2,8 @@ import { useUser } from "./useUser";
export function useFlags() {
const user = useUser();
- const isInternal = ["carbon.us.org", "carbonos.dev"].some((email) =>
- user.email.includes(email)
+ const isInternal = ["carbon.us.org", "carbonos.dev", "blackcatlabs.xyz"].some(
+ (email) => user.email.includes(email)
);
return {
diff --git a/apps/erp/app/modules/inventory/inventory.service.ts b/apps/erp/app/modules/inventory/inventory.service.ts
index 4df12ec904..906bcbf815 100644
--- a/apps/erp/app/modules/inventory/inventory.service.ts
+++ b/apps/erp/app/modules/inventory/inventory.service.ts
@@ -410,12 +410,23 @@ export async function getShipmentFiles(
export async function getShipmentRelatedItems(
client: SupabaseClient<Database>,
- shipmentId: string
+ shipmentId: string,
+ sourceDocumentId: string
) {
+ const salesOrder = await client
+ .from("salesOrder")
+ .select("*")
+ .eq("id", sourceDocumentId)
+ .single();
+
const invoices = await client
.from("salesInvoice")
.select("*")
- .eq("shipmentId", shipmentId);
+ .or(
+ `shipmentId.eq.${shipmentId},opportunityId.eq.${
+ salesOrder.data?.opportunityId ?? ""
+ }`
+ );
return {
invoices: invoices.data ?? [],
diff --git a/apps/erp/app/modules/inventory/ui/Shipments/ShipmentHeader.tsx b/apps/erp/app/modules/inventory/ui/Shipments/ShipmentHeader.tsx
index 9a261f3ead..cd1830d9a8 100644
--- a/apps/erp/app/modules/inventory/ui/Shipments/ShipmentHeader.tsx
+++ b/apps/erp/app/modules/inventory/ui/Shipments/ShipmentHeader.tsx
@@ -159,7 +159,8 @@ const ShipmentHeader = () => {
{(relatedItems) => {
const invoices = relatedItems?.invoices || [];
return invoices.length > 0 ? (
- invoices.length === 1 ? (
+ invoices.length === 1 &&
+ invoices[0].shipmentId === shipmentId ? (
<Button
leftIcon={<LuCreditCard />}
variant={"secondary"}
diff --git a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceHeader.tsx b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceHeader.tsx
index de6b3a576b..919a5ed3b2 100644
--- a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceHeader.tsx
+++ b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceHeader.tsx
@@ -136,7 +136,7 @@ const PurchaseInvoiceHeader = () => {
return (
<>
- <div className="flex flex-shrink-0 items-center justify-between p-2 bg-card border-b border-border h-[50px] overflow-x-auto scrollbar-hide dark:border-none dark:shadow-[inset_0_0_1px_rgb(255_255_255_/_0.24),_0_0_0_0.5px_rgb(0,0,0,1),0px_0px_4px_rgba(0,_0,_0,_0.08)]">
+ <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
diff --git a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsx b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsx
index bfa88cb660..a164422896 100644
--- a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsx
+++ b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsx
@@ -143,7 +143,7 @@ const SalesInvoiceHeader = () => {
return (
<>
- <div className="flex flex-shrink-0 items-center justify-between p-2 bg-card border-b border-border h-[50px] overflow-x-auto scrollbar-hide dark:border-none dark:shadow-[inset_0_0_1px_rgb(255_255_255_/_0.24),_0_0_0_0.5px_rgb(0,0,0,1),0px_0px_4px_rgba(0,_0,_0,_0.08)]">
+ <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
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobHeader.tsx b/apps/erp/app/modules/production/ui/Jobs/JobHeader.tsx
index 9842110656..d928a82110 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobHeader.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobHeader.tsx
@@ -107,7 +107,7 @@ const JobHeader = () => {
return (
<>
- <div className="flex flex-shrink-0 items-center justify-between p-2 bg-card border-b border-border h-[50px] overflow-x-auto scrollbar-hide dark:border-none dark:shadow-[inset_0_0_1px_rgb(255_255_255_/_0.24),_0_0_0_0.5px_rgb(0,0,0,1),0px_0px_4px_rgba(0,_0,_0,_0.08)] ">
+ <div className="flex flex-shrink-0 items-center justify-between p-2 bg-card border-b h-[50px] overflow-x-auto scrollbar-hide ">
<HStack>
<IconButton
aria-label="Toggle Explorer"
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader.tsx
index 2b2e933f53..9ab9a71160 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader.tsx
@@ -84,7 +84,7 @@ const PurchaseOrderHeader = () => {
return (
<>
- <div className="flex flex-shrink-0 items-center justify-between p-2 bg-card border-b border-border h-[50px] overflow-x-auto scrollbar-hide dark:border-none dark:shadow-[inset_0_0_1px_rgb(255_255_255_/_0.24),_0_0_0_0.5px_rgb(0,0,0,1),0px_0px_4px_rgba(0,_0,_0,_0.08)]">
+ <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
diff --git a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteHeader.tsx b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteHeader.tsx
index 60e716e01c..83dbf951bd 100644
--- a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteHeader.tsx
+++ b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteHeader.tsx
@@ -41,7 +41,7 @@ const SupplierQuoteHeader = () => {
return (
<>
- <div className="flex flex-shrink-0 items-center justify-between p-2 bg-card border-b border-border h-[50px] overflow-x-auto scrollbar-hide dark:border-none dark:shadow-[inset_0_0_1px_rgb(255_255_255_/_0.24),_0_0_0_0.5px_rgb(0,0,0,1),0px_0px_4px_rgba(0,_0,_0,_0.08)]">
+ <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
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteHeader.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteHeader.tsx
index dfcfd60012..10001f0306 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteHeader.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteHeader.tsx
@@ -92,7 +92,7 @@ const QuoteHeader = () => {
return (
<>
- <div className="flex flex-shrink-0 items-center justify-between p-2 bg-card border-b border-border h-[50px] overflow-x-auto scrollbar-hide dark:border-none dark:shadow-[inset_0_0_1px_rgb(255_255_255_/_0.24),_0_0_0_0.5px_rgb(0,0,0,1),0px_0px_4px_rgba(0,_0,_0,_0.08)]">
+ <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
diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderHeader.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderHeader.tsx
index fa7ad67081..e6c81fcd79 100644
--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderHeader.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderHeader.tsx
@@ -226,7 +226,7 @@ const SalesOrderHeader = () => {
return (
<>
- <div className="flex flex-shrink-0 items-center justify-between p-2 bg-card border-b border-border h-[50px] overflow-x-auto scrollbar-hide dark:border-none dark:shadow-[inset_0_0_1px_rgb(255_255_255_/_0.24),_0_0_0_0.5px_rgb(0,0,0,1),0px_0px_4px_rgba(0,_0,_0,_0.08)]">
+ <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
diff --git a/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx b/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx
index 1360e3c311..f99f7b88d6 100644
--- a/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx
@@ -65,7 +65,7 @@ const SalesRFQHeader = () => {
const statusFetcher = useFetcher<{}>();
return (
- <div className="flex flex-shrink-0 items-center justify-between p-2 bg-card border-b border-border h-[50px] overflow-x-auto scrollbar-hide dark:border-none dark:shadow-[inset_0_0_1px_rgb(255_255_255_/_0.24),_0_0_0_0.5px_rgb(0,0,0,1),0px_0px_4px_rgba(0,_0,_0,_0.08)] ">
+ <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
diff --git a/apps/erp/app/routes/x+/_index.tsx b/apps/erp/app/routes/x+/_index.tsx
index bfc298173f..d1a2e75169 100644
--- a/apps/erp/app/routes/x+/_index.tsx
+++ b/apps/erp/app/routes/x+/_index.tsx
@@ -63,7 +63,7 @@ const ModuleCard = ({ module }: { module: Authenticated<NavItem> }) => (
prefetch="intent"
className="aspect-video flex flex-col gap-3 items-center justify-center py-8 shadow-button-base bg-gradient-to-bl from-card from-50% to-background rounded-lg text-center group ring-2 ring-transparent hover:ring-white/10 cursor-pointer hover:scale-105 transition-all duration-300"
>
- <div className="p-4 rounded-full border">
+ <div className="p-4 rounded-lg border">
<module.icon className="text-2xl" />
</div>
<span className="text-sm py-1 px-4 border border-border rounded-full group-hover:bg-accent font-medium tracking-tight">
diff --git a/apps/erp/app/routes/x+/shipment+/$shipmentId.tsx b/apps/erp/app/routes/x+/shipment+/$shipmentId.tsx
index 0dcfab937e..df04a6a1c6 100644
--- a/apps/erp/app/routes/x+/shipment+/$shipmentId.tsx
+++ b/apps/erp/app/routes/x+/shipment+/$shipmentId.tsx
@@ -51,7 +51,11 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
shipment: shipment.data,
shipmentLines: shipmentLines.data ?? [],
shipmentLineTracking: shipmentLineTracking.data ?? [],
- relatedItems: getShipmentRelatedItems(client, shipmentId),
+ relatedItems: getShipmentRelatedItems(
+ client,
+ shipmentId,
+ shipment.data?.sourceDocumentId ?? ""
+ ),
});
}
diff --git a/apps/erp/app/types/index.ts b/apps/erp/app/types/index.ts
index 98d1b23b8d..cd0fd6d9fa 100644
--- a/apps/erp/app/types/index.ts
+++ b/apps/erp/app/types/index.ts
@@ -41,7 +41,8 @@ export type ModelUpload = {
export type NavItem = Omit<Route, "icon"> & {
icon: IconType;
- color?: string;
+ backgroundColor?: string;
+ foregroundColor?: string;
};
export type Result = {
diff --git a/apps/mes/app/components/Filter/Filter.tsx b/apps/mes/app/components/Filter/Filter.tsx
index 51702fd99a..f0f29c709a 100644
--- a/apps/mes/app/components/Filter/Filter.tsx
+++ b/apps/mes/app/components/Filter/Filter.tsx
@@ -150,7 +150,7 @@ const Filter = forwardRef<HTMLButtonElement, FilterProps>(
</PopoverTrigger>
<PopoverContent
align="start"
- className="min-w-[260px] w-[--radix-popover-trigger-width] p-0"
+ className="min-w-[--radix-popover-trigger-width] p-0"
>
<Command>
<CommandInput
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index d11c9d8b03..a87baa36b5 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -2847,6 +2847,132 @@ export default {
tags: ["nonConformanceShipmentLine"],
},
},
+ "/lessonCompletion": {
+ get: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.lessonCompletion.userId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.lessonCompletion.courseId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.lessonCompletion.lessonId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.lessonCompletion.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/lessonCompletion",
+ },
+ type: "array",
+ },
+ },
+ "206": {
+ description: "Partial Content",
+ },
+ },
+ tags: ["lessonCompletion"],
+ },
+ post: {
+ parameters: [
+ {
+ $ref: "#/parameters/body.lessonCompletion",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/preferPost",
+ },
+ ],
+ responses: {
+ "201": {
+ description: "Created",
+ },
+ },
+ tags: ["lessonCompletion"],
+ },
+ delete: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.lessonCompletion.userId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.lessonCompletion.courseId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.lessonCompletion.lessonId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.lessonCompletion.createdAt",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["lessonCompletion"],
+ },
+ patch: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.lessonCompletion.userId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.lessonCompletion.courseId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.lessonCompletion.lessonId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.lessonCompletion.createdAt",
+ },
+ {
+ $ref: "#/parameters/body.lessonCompletion",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["lessonCompletion"],
+ },
+ },
"/groups": {
get: {
parameters: [
@@ -8823,6 +8949,12 @@ export default {
{
$ref: "#/parameters/rowFilter.openPurchaseOrderLines.purchaseOrderId",
},
+ {
+ $ref: "#/parameters/rowFilter.openPurchaseOrderLines.purchaseOrderReadableId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.openPurchaseOrderLines.supplierId",
+ },
{
$ref: "#/parameters/rowFilter.openPurchaseOrderLines.itemId",
},
@@ -8835,6 +8967,9 @@ export default {
{
$ref: "#/parameters/rowFilter.openPurchaseOrderLines.purchaseOrderLineType",
},
+ {
+ $ref: "#/parameters/rowFilter.openPurchaseOrderLines.dueDate",
+ },
{
$ref: "#/parameters/rowFilter.openPurchaseOrderLines.companyId",
},
@@ -8844,6 +8979,9 @@ export default {
{
$ref: "#/parameters/rowFilter.openPurchaseOrderLines.orderDate",
},
+ {
+ $ref: "#/parameters/rowFilter.openPurchaseOrderLines.status",
+ },
{
$ref: "#/parameters/rowFilter.openPurchaseOrderLines.promisedDate",
},
@@ -42489,6 +42627,150 @@ export default {
tags: ["modules"],
},
},
+ "/challengeAttempt": {
+ get: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.userId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.courseId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.passed",
+ },
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.topicId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.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/challengeAttempt",
+ },
+ type: "array",
+ },
+ },
+ "206": {
+ description: "Partial Content",
+ },
+ },
+ tags: ["challengeAttempt"],
+ },
+ post: {
+ parameters: [
+ {
+ $ref: "#/parameters/body.challengeAttempt",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/preferPost",
+ },
+ ],
+ responses: {
+ "201": {
+ description: "Created",
+ },
+ },
+ tags: ["challengeAttempt"],
+ },
+ delete: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.userId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.courseId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.passed",
+ },
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.topicId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.createdAt",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["challengeAttempt"],
+ },
+ patch: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.userId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.courseId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.passed",
+ },
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.topicId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.challengeAttempt.createdAt",
+ },
+ {
+ $ref: "#/parameters/body.challengeAttempt",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["challengeAttempt"],
+ },
+ },
"/search": {
get: {
parameters: [
@@ -56304,6 +56586,88 @@ export default {
tags: ["(rpc) update_receipt_line_batch_tracking"],
},
},
+ "/rpc/get_purchasing_planning": {
+ get: {
+ parameters: [
+ {
+ format: "text",
+ in: "query",
+ name: "company_id",
+ required: true,
+ type: "string",
+ },
+ {
+ format: "text",
+ in: "query",
+ name: "location_id",
+ required: true,
+ type: "string",
+ },
+ {
+ format: "text[]",
+ in: "query",
+ name: "periods",
+ required: true,
+ type: "string",
+ },
+ ],
+ produces: [
+ "application/json",
+ "application/vnd.pgrst.object+json;nulls=stripped",
+ "application/vnd.pgrst.object+json",
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ },
+ },
+ tags: ["(rpc) get_purchasing_planning"],
+ },
+ post: {
+ parameters: [
+ {
+ in: "body",
+ name: "args",
+ required: true,
+ schema: {
+ properties: {
+ company_id: {
+ format: "text",
+ type: "string",
+ },
+ location_id: {
+ format: "text",
+ type: "string",
+ },
+ periods: {
+ format: "text[]",
+ items: {
+ type: "string",
+ },
+ type: "array",
+ },
+ },
+ required: ["company_id", "location_id", "periods"],
+ 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) get_purchasing_planning"],
+ },
+ },
"/rpc/get_custom_field_unique_values": {
get: {
parameters: [
@@ -57794,6 +58158,33 @@ export default {
},
type: "object",
},
+ lessonCompletion: {
+ required: ["userId", "courseId", "lessonId", "createdAt"],
+ properties: {
+ 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",
+ },
+ courseId: {
+ description: "Note:\nThis is a Primary Key.<pk/>",
+ format: "text",
+ type: "string",
+ },
+ lessonId: {
+ description: "Note:\nThis is a Primary Key.<pk/>",
+ format: "text",
+ type: "string",
+ },
+ createdAt: {
+ default: "now()",
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ },
+ type: "object",
+ },
groups: {
properties: {
id: {
@@ -60619,6 +61010,16 @@ export default {
format: "text",
type: "string",
},
+ purchaseOrderReadableId: {
+ format: "text",
+ type: "string",
+ },
+ supplierId: {
+ description:
+ "Note:\nThis is a Foreign Key to `supplier.id`.<fk table='supplier' column='id'/>",
+ format: "text",
+ type: "string",
+ },
itemId: {
description:
"Note:\nThis is a Foreign Key to `item.id`.<fk table='item' column='id'/>",
@@ -60648,6 +61049,10 @@ export default {
format: 'public."purchaseOrderLineType"',
type: "string",
},
+ dueDate: {
+ format: "date",
+ type: "string",
+ },
companyId: {
format: "text",
type: "string",
@@ -60660,6 +61065,21 @@ export default {
format: "date",
type: "string",
},
+ status: {
+ enum: [
+ "Draft",
+ "To Review",
+ "Rejected",
+ "To Receive",
+ "To Receive and Invoice",
+ "To Invoice",
+ "Completed",
+ "Closed",
+ "Planned",
+ ],
+ format: 'public."purchaseOrderStatus"',
+ type: "string",
+ },
promisedDate: {
format: "date",
type: "string",
@@ -76388,6 +76808,41 @@ export default {
},
type: "object",
},
+ challengeAttempt: {
+ required: ["id", "userId", "courseId", "passed", "topicId", "createdAt"],
+ properties: {
+ id: {
+ description: "Note:\nThis is a Primary Key.<pk/>",
+ format: "integer",
+ type: "integer",
+ },
+ userId: {
+ description:
+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ courseId: {
+ format: "text",
+ type: "string",
+ },
+ passed: {
+ default: false,
+ format: "boolean",
+ type: "boolean",
+ },
+ topicId: {
+ format: "text",
+ type: "string",
+ },
+ createdAt: {
+ default: "now()",
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ },
+ type: "object",
+ },
search: {
required: ["id", "name", "link"],
properties: {
@@ -82447,6 +82902,39 @@ export default {
in: "query",
type: "string",
},
+ "body.lessonCompletion": {
+ name: "lessonCompletion",
+ description: "lessonCompletion",
+ required: false,
+ in: "body",
+ schema: {
+ $ref: "#/definitions/lessonCompletion",
+ },
+ },
+ "rowFilter.lessonCompletion.userId": {
+ name: "userId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.lessonCompletion.courseId": {
+ name: "courseId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.lessonCompletion.lessonId": {
+ name: "lessonId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.lessonCompletion.createdAt": {
+ name: "createdAt",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.groups": {
name: "groups",
description: "groups",
@@ -85651,6 +86139,18 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.openPurchaseOrderLines.purchaseOrderReadableId": {
+ name: "purchaseOrderReadableId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.openPurchaseOrderLines.supplierId": {
+ name: "supplierId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"rowFilter.openPurchaseOrderLines.itemId": {
name: "itemId",
required: false,
@@ -85675,6 +86175,12 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.openPurchaseOrderLines.dueDate": {
+ name: "dueDate",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"rowFilter.openPurchaseOrderLines.companyId": {
name: "companyId",
required: false,
@@ -85693,6 +86199,12 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.openPurchaseOrderLines.status": {
+ name: "status",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"rowFilter.openPurchaseOrderLines.promisedDate": {
name: "promisedDate",
required: false,
@@ -103453,6 +103965,51 @@ export default {
in: "query",
type: "string",
},
+ "body.challengeAttempt": {
+ name: "challengeAttempt",
+ description: "challengeAttempt",
+ required: false,
+ in: "body",
+ schema: {
+ $ref: "#/definitions/challengeAttempt",
+ },
+ },
+ "rowFilter.challengeAttempt.id": {
+ name: "id",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.challengeAttempt.userId": {
+ name: "userId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.challengeAttempt.courseId": {
+ name: "courseId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.challengeAttempt.passed": {
+ name: "passed",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.challengeAttempt.topicId": {
+ name: "topicId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.challengeAttempt.createdAt": {
+ name: "createdAt",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.search": {
name: "search",
description: "search",
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index fdd92f5b6e..fa9c967941 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -1967,63 +1967,6 @@ export type Database = {
},
]
}
- challengeCompletion: {
- Row: {
- courseId: string
- createdAt: string
- topicId: string
- userId: string
- }
- Insert: {
- courseId: string
- createdAt?: string
- topicId: string
- userId: string
- }
- Update: {
- courseId?: string
- createdAt?: string
- topicId?: string
- userId?: string
- }
- Relationships: [
- {
- foreignKeyName: "challengeCompletion_userId_fkey"
- columns: ["userId"]
- isOneToOne: false
- referencedRelation: "employees"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "challengeCompletion_userId_fkey"
- columns: ["userId"]
- isOneToOne: false
- referencedRelation: "employeesAcrossCompanies"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "challengeCompletion_userId_fkey"
- columns: ["userId"]
- isOneToOne: false
- referencedRelation: "employeeSummary"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "challengeCompletion_userId_fkey"
- columns: ["userId"]
- isOneToOne: false
- referencedRelation: "user"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "challengeCompletion_userId_fkey"
- columns: ["userId"]
- isOneToOne: false
- referencedRelation: "userDefaults"
- referencedColumns: ["userId"]
- },
- ]
- }
company: {
Row: {
addressLine1: string | null
@@ -20855,7 +20798,6 @@ export type Database = {
purchaseOrderLineType: Database["public"]["Enums"]["purchaseOrderLineType"]
purchaseQuantity: number | null
purchaseUnitOfMeasureCode: string | null
- quantity: number | null
quantityInvoiced: number | null
quantityReceived: number | null
quantityShipped: number | null
@@ -20904,7 +20846,6 @@ export type Database = {
purchaseOrderLineType: Database["public"]["Enums"]["purchaseOrderLineType"]
purchaseQuantity?: number | null
purchaseUnitOfMeasureCode?: string | null
- quantity?: number | null
quantityInvoiced?: number | null
quantityReceived?: number | null
quantityShipped?: number | null
@@ -20953,7 +20894,6 @@ export type Database = {
purchaseOrderLineType?: Database["public"]["Enums"]["purchaseOrderLineType"]
purchaseQuantity?: number | null
purchaseUnitOfMeasureCode?: string | null
- quantity?: number | null
quantityInvoiced?: number | null
quantityReceived?: number | null
quantityShipped?: number | null
@@ -42449,14 +42389,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["paymentCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["paymentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index fdd92f5b6e..fa9c967941 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -1967,63 +1967,6 @@ export type Database = {
},
]
}
- challengeCompletion: {
- Row: {
- courseId: string
- createdAt: string
- topicId: string
- userId: string
- }
- Insert: {
- courseId: string
- createdAt?: string
- topicId: string
- userId: string
- }
- Update: {
- courseId?: string
- createdAt?: string
- topicId?: string
- userId?: string
- }
- Relationships: [
- {
- foreignKeyName: "challengeCompletion_userId_fkey"
- columns: ["userId"]
- isOneToOne: false
- referencedRelation: "employees"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "challengeCompletion_userId_fkey"
- columns: ["userId"]
- isOneToOne: false
- referencedRelation: "employeesAcrossCompanies"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "challengeCompletion_userId_fkey"
- columns: ["userId"]
- isOneToOne: false
- referencedRelation: "employeeSummary"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "challengeCompletion_userId_fkey"
- columns: ["userId"]
- isOneToOne: false
- referencedRelation: "user"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "challengeCompletion_userId_fkey"
- columns: ["userId"]
- isOneToOne: false
- referencedRelation: "userDefaults"
- referencedColumns: ["userId"]
- },
- ]
- }
company: {
Row: {
addressLine1: string | null
@@ -20855,7 +20798,6 @@ export type Database = {
purchaseOrderLineType: Database["public"]["Enums"]["purchaseOrderLineType"]
purchaseQuantity: number | null
purchaseUnitOfMeasureCode: string | null
- quantity: number | null
quantityInvoiced: number | null
quantityReceived: number | null
quantityShipped: number | null
@@ -20904,7 +20846,6 @@ export type Database = {
purchaseOrderLineType: Database["public"]["Enums"]["purchaseOrderLineType"]
purchaseQuantity?: number | null
purchaseUnitOfMeasureCode?: string | null
- quantity?: number | null
quantityInvoiced?: number | null
quantityReceived?: number | null
quantityShipped?: number | null
@@ -20953,7 +20894,6 @@ export type Database = {
purchaseOrderLineType?: Database["public"]["Enums"]["purchaseOrderLineType"]
purchaseQuantity?: number | null
purchaseUnitOfMeasureCode?: string | null
- quantity?: number | null
quantityInvoiced?: number | null
quantityReceived?: number | null
quantityShipped?: number | null
@@ -42449,14 +42389,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["paymentCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["paymentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
diff --git a/packages/database/supabase/functions/mcp/tools.ts b/packages/database/supabase/functions/mcp/tools.ts
index bd0a797fc0..a18a77e700 100644
--- a/packages/database/supabase/functions/mcp/tools.ts
+++ b/packages/database/supabase/functions/mcp/tools.ts
@@ -412,11 +412,11 @@ async function getSuppliersForParts(
const [supplierParts, preferredSuppliers] = await Promise.all([
client
.from("supplierPart")
- .select("itemId, supplierId")
+ .select("itemId, supplierId, unitPrice, supplierUnitOfMeasureCode")
.in("itemId", partIds)
.eq("companyId", context.companyId),
client
- .from("itemRelationship")
+ .from("itemReplenishment")
.select("itemId, preferredSupplierId")
.in("itemId", partIds)
.eq("companyId", context.companyId),
@@ -492,8 +492,13 @@ async function getSuppliersForParts(
// Return the most frequent supplier if found
if (mostFrequentSupplierId) {
+ const supplier = supplierParts.data?.find(
+ (p) => p.supplierId === mostFrequentSupplierId
+ );
return {
id: mostFrequentSupplierId,
+ unitPrice: supplier?.unitPrice,
+ supplierUnitOfMeasureCode: supplier?.supplierUnitOfMeasureCode,
};
}
diff --git a/packages/react/src/Combobox.tsx b/packages/react/src/Combobox.tsx
index f0a2f24aa2..1603266394 100644
--- a/packages/react/src/Combobox.tsx
+++ b/packages/react/src/Combobox.tsx
@@ -113,7 +113,7 @@ const Combobox = forwardRef<HTMLButtonElement, ComboboxProps>(
</PopoverTrigger>
<PopoverContent
align="start"
- className="min-w-[260px] w-[--radix-popover-trigger-width] p-1"
+ className="min-w-[--radix-popover-trigger-width] p-1"
>
<VirtualizedCommand
options={options}
diff --git a/packages/react/src/CreateableCombobox.tsx b/packages/react/src/CreateableCombobox.tsx
index 3db250efef..5ed5b6cfb1 100644
--- a/packages/react/src/CreateableCombobox.tsx
+++ b/packages/react/src/CreateableCombobox.tsx
@@ -123,7 +123,7 @@ const CreatableCombobox = forwardRef<HTMLButtonElement, CreatableComboboxProps>(
</PopoverTrigger>
<PopoverContent
align="start"
- className="min-w-[260px] w-[--radix-popover-trigger-width] p-1"
+ className="min-w-[--radix-popover-trigger-width] max-w-[400px] p-1"
>
<VirtualizedCommand
label={label}
@@ -274,28 +274,29 @@ function VirtualizedCommand({
height: `${itemHeight}px`,
transform: `translateY(${virtualRow.start}px)`,
}}
+ className="flex items-center justify-between min-w-0"
>
{isCreateOption ? (
- <>
+ <div className="flex items-center min-w-0 flex-1">
<span>Create</span>
- <span className="ml-1 font-bold line-clamp-1">
+ <span className="ml-1 font-bold truncate">
{search.trim() === "" ? label : search}
</span>
- </>
+ </div>
) : item.helper ? (
- <div className="flex flex-col">
- <p className="line-clamp-1">{item.label}</p>
- <p className="text-xs text-muted-foreground line-clamp-1">
+ <div className="flex flex-col min-w-0 flex-1">
+ <p className="truncate">{item.label}</p>
+ <p className="text-xs text-muted-foreground truncate">
{item.helper}
</p>
</div>
) : (
- <span className="line-clamp-1">{item.label}</span>
+ <span className="truncate flex-1">{item.label}</span>
)}
{!isCreateOption && (
<LuCheck
className={cn(
- "ml-auto h-4 w-4",
+ "ml-auto h-4 w-4 flex-shrink-0",
isSelected || item.value === value
? "opacity-100"
: "opacity-0"
diff --git a/packages/react/src/CreateableMultiSelect.tsx b/packages/react/src/CreateableMultiSelect.tsx
index 8262eeca82..e0d36acdca 100644
--- a/packages/react/src/CreateableMultiSelect.tsx
+++ b/packages/react/src/CreateableMultiSelect.tsx
@@ -169,7 +169,7 @@ const CreatableMultiSelect = forwardRef<
</PopoverTrigger>
<PopoverContent
align="end"
- className="min-w-[260px] w-[--radix-popover-trigger-width] p-1"
+ className="min-w-[--radix-popover-trigger-width] p-1"
>
<VirtualizedCommand
options={options}
diff --git a/packages/react/src/MultiSelect.tsx b/packages/react/src/MultiSelect.tsx
index d6b150e704..2747b69463 100644
--- a/packages/react/src/MultiSelect.tsx
+++ b/packages/react/src/MultiSelect.tsx
@@ -184,7 +184,7 @@ const MultiSelect = forwardRef<HTMLButtonElement, MultiSelectProps>(
</PopoverTrigger>
<PopoverContent
align="end"
- className="min-w-[260px] w-[--radix-popover-trigger-width] p-1"
+ className="min-w-[--radix-popover-trigger-width] p-1"
>
<VirtualizedCommand
options={options}