Skip to content

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

feat: add thumbnails to kanban views

Brad Barbinfad64c5bb622
diff --git a/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ColumnCard.tsx b/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ColumnCard.tsx
index 88c84d105c..875cfafec4 100644
--- a/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ColumnCard.tsx
+++ b/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ColumnCard.tsx
@@ -75,7 +75,7 @@ export function ColumnCard({
};
const variants = cva(
- "w-[350px] max-w-full bg-primary-foreground flex flex-col flex-shrink-0 snap-center rounded-none",
+ "w-[350px] max-w-full flex flex-col flex-shrink-0 snap-center rounded-none from-card/50 via-card/50 to-card",
{
variants: {
dragging: {
diff --git a/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ItemCard.tsx b/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ItemCard.tsx
index 1804bc550a..f9d691ca25 100644
--- a/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ItemCard.tsx
+++ b/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ItemCard.tsx
@@ -38,7 +38,7 @@ import { InProgressStatusIcon } from "~/assets/icons/InProgressStatusIcon";
import { TodoStatusIcon } from "~/assets/icons/TodoStatusIcon";
import { CustomerAvatar, EmployeeAvatarGroup } from "~/components";
-import { path } from "~/utils/path";
+import { getPrivateUrl, path } from "~/utils/path";
import { getDeadlineIcon, getDeadlineText } from "../../../Jobs/Deadline";
import type { DisplaySettings, Item, ItemDragData } from "../types";
@@ -101,6 +101,7 @@ export function ItemCard({
showProgress,
showStatus,
showSalesOrder,
+ showThumbnail,
}: ItemCardProps) {
const {
setNodeRef,
@@ -215,6 +216,15 @@ export function ItemCard({
)}
</CardHeader>
<CardContent className="p-3 space-y-2 text-left whitespace-pre-wrap text-sm">
+ {showThumbnail && item.thumbnailPath && (
+ <div className="flex justify-center">
+ <img
+ src={getPrivateUrl(item.thumbnailPath)}
+ alt={item.title}
+ className="w-full h-auto rounded-lg"
+ />
+ </div>
+ )}
{showDescription && item.description && (
<HStack className="justify-start space-x-2">
<LuClipboardCheck className="text-muted-foreground" />
diff --git a/apps/carbon/app/modules/production/ui/Schedule/Kanban/types.ts b/apps/carbon/app/modules/production/ui/Schedule/Kanban/types.ts
index 2d04ba622b..c8629e06eb 100644
--- a/apps/carbon/app/modules/production/ui/Schedule/Kanban/types.ts
+++ b/apps/carbon/app/modules/production/ui/Schedule/Kanban/types.ts
@@ -25,6 +25,7 @@ export type DisplaySettings = {
showProgress: boolean;
showStatus: boolean;
showSalesOrder: boolean;
+ showThumbnail: boolean;
};
export type DraggableData = ColumnDragData | ItemDragData;
@@ -56,6 +57,7 @@ const itemValidator = z.object({
setupDuration: z.number().optional(),
laborDuration: z.number().optional(),
machineDuration: z.number().optional(),
+ thumbnailPath: z.string().optional(),
});
export type Item = z.infer<typeof itemValidator>;
diff --git a/apps/carbon/app/routes/x+/schedule+/index.tsx b/apps/carbon/app/routes/x+/schedule+/index.tsx
index c8019e9a6f..17a8b1b84a 100644
--- a/apps/carbon/app/routes/x+/schedule+/index.tsx
+++ b/apps/carbon/app/routes/x+/schedule+/index.tsx
@@ -219,6 +219,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
setupDuration: operation.setupDuration,
laborDuration: operation.laborDuration,
machineDuration: operation.machineDuration,
+ thumbnailPath: op.thumbnailPath,
};
}) ?? []) satisfies Item[],
processes: processes.data ?? [],
@@ -343,6 +344,7 @@ export default function ScheduleRoute() {
showProgress
showStatus
showSalesOrder
+ showThumbnail
/>
)}
</ClientOnly>
diff --git a/apps/carbon/app/styles/tailwind.css b/apps/carbon/app/styles/tailwind.css
index c39b594a74..76fbdd3c4d 100644
--- a/apps/carbon/app/styles/tailwind.css
+++ b/apps/carbon/app/styles/tailwind.css
@@ -14,6 +14,32 @@
background: transparent;
}
+@layer base {
+ :root {
+ --header-height: 52px;
+
+ --sidebar-background: 0 0% 98%;
+ --sidebar-foreground: 240 5.3% 26.1%;
+ --sidebar-primary: 240 5.9% 10%;
+ --sidebar-primary-foreground: 0 0% 98%;
+ --sidebar-accent: 240 4.8% 95.9%;
+ --sidebar-accent-foreground: 240 5.9% 10%;
+ --sidebar-border: 220 13% 91%;
+ --sidebar-ring: 217.2 91.2% 59.8%;
+ }
+
+ .dark {
+ --sidebar-background: 240 5.9% 10%;
+ --sidebar-foreground: 240 4.8% 95.9%;
+ --sidebar-primary: 224.3 76.3% 48%;
+ --sidebar-primary-foreground: 0 0% 100%;
+ --sidebar-accent: 240 3.7% 15.9%;
+ --sidebar-accent-foreground: 240 4.8% 95.9%;
+ --sidebar-border: 240 3.7% 15.9%;
+ --sidebar-ring: 217.2 91.2% 59.8%;
+ }
+}
+
@layer base {
* {
@apply border-border;
diff --git a/apps/mes/app/components/Kanban/components/ColumnCard.tsx b/apps/mes/app/components/Kanban/components/ColumnCard.tsx
index 46d57a964e..4b8ba4e454 100644
--- a/apps/mes/app/components/Kanban/components/ColumnCard.tsx
+++ b/apps/mes/app/components/Kanban/components/ColumnCard.tsx
@@ -64,7 +64,7 @@ export function ColumnCard({
};
const variants = cva(
- "w-[350px] max-w-full bg-primary-foreground flex flex-col flex-shrink-0 snap-center rounded-none",
+ "w-[350px] max-w-full bg-primary-foreground flex flex-col flex-shrink-0 snap-center rounded-none from-card/50 via-card/50",
{
variants: {
dragging: {
diff --git a/apps/mes/app/components/Kanban/components/ItemCard.tsx b/apps/mes/app/components/Kanban/components/ItemCard.tsx
index 122fcd848f..e3129ff8dd 100644
--- a/apps/mes/app/components/Kanban/components/ItemCard.tsx
+++ b/apps/mes/app/components/Kanban/components/ItemCard.tsx
@@ -83,6 +83,7 @@ export function ItemCard({
showProgress,
showStatus,
showSalesOrder,
+ showThumbnail,
}: ItemCardProps) {
const isOverdue =
item.deadlineType !== "No Deadline" && item.dueDate
@@ -139,6 +140,15 @@ export function ItemCard({
)}
</CardHeader>
<CardContent className="p-3 space-y-2 text-left whitespace-pre-wrap text-sm">
+ {showThumbnail && item.thumbnailPath && (
+ <div className="flex justify-center">
+ <img
+ src={item.thumbnailPath}
+ alt={item.title}
+ className="w-full max-w-[200px] h-auto"
+ />
+ </div>
+ )}
{showDescription && item.description && (
<HStack className="justify-start space-x-2">
<LuClipboardCheck className="text-muted-foreground" />
diff --git a/apps/mes/app/components/Kanban/types.ts b/apps/mes/app/components/Kanban/types.ts
index 0db55cf9fd..201b80a199 100644
--- a/apps/mes/app/components/Kanban/types.ts
+++ b/apps/mes/app/components/Kanban/types.ts
@@ -24,6 +24,7 @@ export type DisplaySettings = {
showProgress: boolean;
showStatus: boolean;
showSalesOrder: boolean;
+ showThumbnail: boolean;
};
export type DraggableData = ColumnDragData | ItemDragData;
@@ -47,6 +48,7 @@ const itemValidator = z.object({
salesOrderReadableId: z.string().optional(),
salesOrderId: z.string().optional(),
salesOrderLineId: z.string().optional(),
+ thumbnailPath: z.string().optional(),
});
export type Item = z.infer<typeof itemValidator>;
diff --git a/apps/mes/app/routes/x+/operations.tsx b/apps/mes/app/routes/x+/operations.tsx
index 2298cef1af..f5acaeaea4 100644
--- a/apps/mes/app/routes/x+/operations.tsx
+++ b/apps/mes/app/routes/x+/operations.tsx
@@ -190,6 +190,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
salesOrderId: op.salesOrderId,
salesOrderLineId: op.salesOrderLineId,
status: op.operationStatus,
+ thumbnailPath: op.thumbnailPath,
};
}) ?? []) satisfies Item[],
processes: processes.data ?? [],
@@ -284,6 +285,7 @@ export default function Operations() {
showProgress={false}
showStatus
showSalesOrder={false}
+ showThumbnail
/>
)}
</ClientOnly>
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 6e54774bf8..ad6488be9a 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -13395,7 +13395,6 @@ export type Database = {
externalNotes: Json | null
id: string
internalNotes: Json | null
- notes: string | null
orderDate: string
purchaseOrderId: string
revisionId: number
@@ -13405,7 +13404,6 @@ export type Database = {
supplierLocationId: string | null
supplierReference: string | null
tags: string[] | null
- type: Database["public"]["Enums"]["purchaseOrderType"]
updatedAt: string | null
updatedBy: string | null
}
@@ -13423,7 +13421,6 @@ export type Database = {
externalNotes?: Json | null
id?: string
internalNotes?: Json | null
- notes?: string | null
orderDate?: string
purchaseOrderId: string
revisionId?: number
@@ -13433,7 +13430,6 @@ export type Database = {
supplierLocationId?: string | null
supplierReference?: string | null
tags?: string[] | null
- type: Database["public"]["Enums"]["purchaseOrderType"]
updatedAt?: string | null
updatedBy?: string | null
}
@@ -13451,7 +13447,6 @@ export type Database = {
externalNotes?: Json | null
id?: string
internalNotes?: Json | null
- notes?: string | null
orderDate?: string
purchaseOrderId?: string
revisionId?: number
@@ -13461,7 +13456,6 @@ export type Database = {
supplierLocationId?: string | null
supplierReference?: string | null
tags?: string[] | null
- type?: Database["public"]["Enums"]["purchaseOrderType"]
updatedAt?: string | null
updatedBy?: string | null
}
@@ -13947,13 +13941,17 @@ export type Database = {
createdBy: string
customFields: Json | null
description: string | null
+ exchangeRate: number | null
+ extendedPrice: number | null
+ externalNotes: Json | null
id: string
+ internalNotes: Json | null
inventoryUnitOfMeasureCode: string | null
invoicedComplete: boolean
itemId: string | null
itemReadableId: string | null
locationId: string | null
- notes: Json | null
+ modelUploadId: string | null
purchaseOrderId: string
purchaseOrderLineType: Database["public"]["Enums"]["purchaseOrderLineType"]
purchaseQuantity: number | null
@@ -13966,7 +13964,14 @@ export type Database = {
requiresInspection: boolean
setupPrice: number | null
shelfId: string | null
+ shippingCost: number | null
+ supplierExtendedPrice: number | null
+ supplierShippingCost: number
+ supplierTaxAmount: number
+ supplierUnitPrice: number | null
tags: string[] | null
+ taxAmount: number | null
+ taxPercent: number | null
unitPrice: number | null
updatedAt: string | null
updatedBy: string | null
@@ -13980,13 +13985,17 @@ export type Database = {
createdBy: string
customFields?: Json | null
description?: string | null
+ exchangeRate?: number | null
+ extendedPrice?: number | null
+ externalNotes?: Json | null
id?: string
+ internalNotes?: Json | null
inventoryUnitOfMeasureCode?: string | null
invoicedComplete?: boolean
itemId?: string | null
itemReadableId?: string | null
locationId?: string | null
- notes?: Json | null
+ modelUploadId?: string | null
purchaseOrderId: string
purchaseOrderLineType: Database["public"]["Enums"]["purchaseOrderLineType"]
purchaseQuantity?: number | null
@@ -13999,7 +14008,14 @@ export type Database = {
requiresInspection?: boolean
setupPrice?: number | null
shelfId?: string | null
+ shippingCost?: number | null
+ supplierExtendedPrice?: number | null
+ supplierShippingCost?: number
+ supplierTaxAmount?: number
+ supplierUnitPrice?: number | null
tags?: string[] | null
+ taxAmount?: number | null
+ taxPercent?: number | null
unitPrice?: number | null
updatedAt?: string | null
updatedBy?: string | null
@@ -14013,13 +14029,17 @@ export type Database = {
createdBy?: string
customFields?: Json | null
description?: string | null
+ exchangeRate?: number | null
+ extendedPrice?: number | null
+ externalNotes?: Json | null
id?: string
+ internalNotes?: Json | null
inventoryUnitOfMeasureCode?: string | null
invoicedComplete?: boolean
itemId?: string | null
itemReadableId?: string | null
locationId?: string | null
- notes?: Json | null
+ modelUploadId?: string | null
purchaseOrderId?: string
purchaseOrderLineType?: Database["public"]["Enums"]["purchaseOrderLineType"]
purchaseQuantity?: number | null
@@ -14032,7 +14052,14 @@ export type Database = {
requiresInspection?: boolean
setupPrice?: number | null
shelfId?: string | null
+ shippingCost?: number | null
+ supplierExtendedPrice?: number | null
+ supplierShippingCost?: number
+ supplierTaxAmount?: number
+ supplierUnitPrice?: number | null
tags?: string[] | null
+ taxAmount?: number | null
+ taxPercent?: number | null
unitPrice?: number | null
updatedAt?: string | null
updatedBy?: string | null
@@ -14101,6 +14128,34 @@ export type Database = {
referencedRelation: "item"
referencedColumns: ["id"]
},
+ {
+ foreignKeyName: "purchaseOrderLine_modelUploadId_fkey"
+ columns: ["modelUploadId"]
+ isOneToOne: false
+ referencedRelation: "jobs"
+ referencedColumns: ["modelId"]
+ },
+ {
+ foreignKeyName: "purchaseOrderLine_modelUploadId_fkey"
+ columns: ["modelUploadId"]
+ isOneToOne: false
+ referencedRelation: "modelUpload"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "purchaseOrderLine_modelUploadId_fkey"
+ columns: ["modelUploadId"]
+ isOneToOne: false
+ referencedRelation: "parts"
+ referencedColumns: ["modelId"]
+ },
+ {
+ foreignKeyName: "purchaseOrderLine_modelUploadId_fkey"
+ columns: ["modelUploadId"]
+ isOneToOne: false
+ referencedRelation: "salesRfqLines"
+ referencedColumns: ["modelId"]
+ },
{
foreignKeyName: "purchaseOrderLine_purchaseOrderId_fkey"
columns: ["purchaseOrderId"]
@@ -20034,6 +20089,7 @@ export type Database = {
supplierTypeId: string | null
tags: string[] | null
taxId: string | null
+ taxPercent: number
updatedAt: string | null
updatedBy: string | null
website: string | null
@@ -20056,6 +20112,7 @@ export type Database = {
supplierTypeId?: string | null
tags?: string[] | null
taxId?: string | null
+ taxPercent?: number
updatedAt?: string | null
updatedBy?: string | null
website?: string | null
@@ -20078,6 +20135,7 @@ export type Database = {
supplierTypeId?: string | null
tags?: string[] | null
taxId?: string | null
+ taxPercent?: number
updatedAt?: string | null
updatedBy?: string | null
website?: string | null
@@ -27299,13 +27357,18 @@ export type Database = {
Row: {
accountNumber: string | null
assetId: string | null
+ autodeskUrn: string | null
companyId: string | null
conversionFactor: number | null
createdAt: string | null
createdBy: string | null
customFields: Json | null
description: string | null
+ exchangeRate: number | null
+ extendedPrice: number | null
+ externalNotes: Json | null
id: string | null
+ internalNotes: Json | null
inventoryUnitOfMeasureCode: string | null
invoicedComplete: boolean | null
itemDescription: string | null
@@ -27313,6 +27376,11 @@ export type Database = {
itemName: string | null
itemReadableId: string | null
locationId: string | null
+ modelId: string | null
+ modelName: string | null
+ modelPath: string | null
+ modelSize: number | null
+ modelUploadId: string | null
purchaseOrderId: string | null
purchaseOrderLineType:
| Database["public"]["Enums"]["purchaseOrderLineType"]
@@ -27327,49 +27395,22 @@ export type Database = {
requiresInspection: boolean | null
setupPrice: number | null
shelfId: string | null
- supplierId: string | null
+ shippingCost: number | null
+ supplierExtendedPrice: number | null
supplierPartId: string | null
+ supplierShippingCost: number | null
+ supplierTaxAmount: number | null
+ supplierUnitPrice: number | null
tags: string[] | null
+ taxAmount: number | null
+ taxPercent: number | null
+ thumbnailPath: string | null
+ unitCost: number | null
unitPrice: number | null
updatedAt: string | null
updatedBy: string | null
}
Relationships: [
- {
- foreignKeyName: "purchaseOrder_supplierId_fkey"
- columns: ["supplierId"]
- isOneToOne: false
- referencedRelation: "supplier"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "purchaseOrder_supplierId_fkey"
- columns: ["supplierId"]
- isOneToOne: false
- referencedRelation: "contractors"
- referencedColumns: ["supplierId"]
- },
- {
- foreignKeyName: "purchaseOrder_supplierId_fkey"
- columns: ["supplierId"]
- isOneToOne: false
- referencedRelation: "partners"
- referencedColumns: ["supplierId"]
- },
- {
- foreignKeyName: "purchaseOrder_supplierId_fkey"
- columns: ["supplierId"]
- isOneToOne: false
- referencedRelation: "purchaseOrderSuppliers"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "purchaseOrder_supplierId_fkey"
- columns: ["supplierId"]
- isOneToOne: false
- referencedRelation: "suppliers"
- referencedColumns: ["id"]
- },
{
foreignKeyName: "purchaseOrderLine_accountNumber_fkey"
columns: ["accountNumber", "companyId"]
@@ -27433,6 +27474,34 @@ export type Database = {
referencedRelation: "item"
referencedColumns: ["id"]
},
+ {
+ foreignKeyName: "purchaseOrderLine_modelUploadId_fkey"
+ columns: ["modelUploadId"]
+ isOneToOne: false
+ referencedRelation: "modelUpload"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "purchaseOrderLine_modelUploadId_fkey"
+ columns: ["modelUploadId"]
+ isOneToOne: false
+ referencedRelation: "jobs"
+ referencedColumns: ["modelId"]
+ },
+ {
+ foreignKeyName: "purchaseOrderLine_modelUploadId_fkey"
+ columns: ["modelUploadId"]
+ isOneToOne: false
+ referencedRelation: "parts"
+ referencedColumns: ["modelId"]
+ },
+ {
+ foreignKeyName: "purchaseOrderLine_modelUploadId_fkey"
+ columns: ["modelUploadId"]
+ isOneToOne: false
+ referencedRelation: "salesRfqLines"
+ referencedColumns: ["modelId"]
+ },
{
foreignKeyName: "purchaseOrderLine_purchaseOrderId_fkey"
columns: ["purchaseOrderId"]
@@ -27561,30 +27630,32 @@ export type Database = {
createdBy: string | null
currencyCode: string | null
customFields: Json | null
+ deliveryDate: string | null
dropShipment: boolean | null
exchangeRate: number | null
exchangeRateUpdatedAt: string | null
externalNotes: Json | null
id: string | null
internalNotes: Json | null
+ itemType: Database["public"]["Enums"]["itemType"] | null
locationId: string | null
locationName: string | null
- notes: string | null
orderDate: string | null
- paymentTermName: string | null
+ orderTotal: number | null
+ paymentTermId: string | null
purchaseOrderId: string | null
receiptPromisedDate: string | null
receiptRequestedDate: string | null
revisionId: number | null
- shippingMethodName: string | null
- shippingTermName: string | null
+ shippingMethodId: string | null
+ shippingTermId: string | null
status: Database["public"]["Enums"]["purchaseOrderStatus"] | null
supplierContactId: string | null
supplierId: string | null
supplierLocationId: string | null
supplierReference: string | null
tags: string[] | null
- type: Database["public"]["Enums"]["purchaseOrderType"] | null
+ thumbnailPath: string | null
updatedAt: string | null
updatedBy: string | null
}
@@ -27813,6 +27884,27 @@ export type Database = {
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
},
+ {
+ foreignKeyName: "purchaseOrderDelivery_shippingMethodId_fkey"
+ columns: ["shippingMethodId"]
+ isOneToOne: false
+ referencedRelation: "shippingMethod"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "purchaseOrderDelivery_shippingTermId_fkey"
+ columns: ["shippingTermId"]
+ isOneToOne: false
+ referencedRelation: "shippingTerm"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "purchaseOrderPayment_paymentTermId_fkey"
+ columns: ["paymentTermId"]
+ isOneToOne: false
+ referencedRelation: "paymentTerm"
+ referencedColumns: ["id"]
+ },
]
}
purchaseOrderSuppliers: {
@@ -30779,6 +30871,7 @@ export type Database = {
supplierTypeId: string | null
tags: string[] | null
taxId: string | null
+ taxPercent: number | null
type: string | null
updatedAt: string | null
updatedBy: string | null
@@ -31487,6 +31580,7 @@ export type Database = {
operationQuantity: number
quantityComplete: number
quantityScrapped: number
+ thumbnailPath: string
}[]
}
get_claims: {
@@ -32279,7 +32373,6 @@ export type Database = {
owner_id: string | null
path_tokens: string[] | null
updated_at: string | null
- user_metadata: Json | null
version: string | null
}
Insert: {
@@ -32293,7 +32386,6 @@ export type Database = {
owner_id?: string | null
path_tokens?: string[] | null
updated_at?: string | null
- user_metadata?: Json | null
version?: string | null
}
Update: {
@@ -32307,7 +32399,6 @@ export type Database = {
owner_id?: string | null
path_tokens?: string[] | null
updated_at?: string | null
- user_metadata?: Json | null
version?: string | null
}
Relationships: [
@@ -32329,7 +32420,6 @@ export type Database = {
key: string
owner_id: string | null
upload_signature: string
- user_metadata: Json | null
version: string
}
Insert: {
@@ -32340,7 +32430,6 @@ export type Database = {
key: string
owner_id?: string | null
upload_signature: string
- user_metadata?: Json | null
version: string
}
Update: {
@@ -32351,7 +32440,6 @@ export type Database = {
key?: string
owner_id?: string | null
upload_signature?: string
- user_metadata?: Json | null
version?: string
}
Relationships: [
@@ -32488,10 +32576,6 @@ export type Database = {
updated_at: string
}[]
}
- operation: {
- Args: Record<PropertyKey, never>
- Returns: string
- }
search: {
Args: {
prefix: string
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 6e54774bf8..ad6488be9a 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -13395,7 +13395,6 @@ export type Database = {
externalNotes: Json | null
id: string
internalNotes: Json | null
- notes: string | null
orderDate: string
purchaseOrderId: string
revisionId: number
@@ -13405,7 +13404,6 @@ export type Database = {
supplierLocationId: string | null
supplierReference: string | null
tags: string[] | null
- type: Database["public"]["Enums"]["purchaseOrderType"]
updatedAt: string | null
updatedBy: string | null
}
@@ -13423,7 +13421,6 @@ export type Database = {
externalNotes?: Json | null
id?: string
internalNotes?: Json | null
- notes?: string | null
orderDate?: string
purchaseOrderId: string
revisionId?: number
@@ -13433,7 +13430,6 @@ export type Database = {
supplierLocationId?: string | null
supplierReference?: string | null
tags?: string[] | null
- type: Database["public"]["Enums"]["purchaseOrderType"]
updatedAt?: string | null
updatedBy?: string | null
}
@@ -13451,7 +13447,6 @@ export type Database = {
externalNotes?: Json | null
id?: string
internalNotes?: Json | null
- notes?: string | null
orderDate?: string
purchaseOrderId?: string
revisionId?: number
@@ -13461,7 +13456,6 @@ export type Database = {
supplierLocationId?: string | null
supplierReference?: string | null
tags?: string[] | null
- type?: Database["public"]["Enums"]["purchaseOrderType"]
updatedAt?: string | null
updatedBy?: string | null
}
@@ -13947,13 +13941,17 @@ export type Database = {
createdBy: string
customFields: Json | null
description: string | null
+ exchangeRate: number | null
+ extendedPrice: number | null
+ externalNotes: Json | null
id: string
+ internalNotes: Json | null
inventoryUnitOfMeasureCode: string | null
invoicedComplete: boolean
itemId: string | null
itemReadableId: string | null
locationId: string | null
- notes: Json | null
+ modelUploadId: string | null
purchaseOrderId: string
purchaseOrderLineType: Database["public"]["Enums"]["purchaseOrderLineType"]
purchaseQuantity: number | null
@@ -13966,7 +13964,14 @@ export type Database = {
requiresInspection: boolean
setupPrice: number | null
shelfId: string | null
+ shippingCost: number | null
+ supplierExtendedPrice: number | null
+ supplierShippingCost: number
+ supplierTaxAmount: number
+ supplierUnitPrice: number | null
tags: string[] | null
+ taxAmount: number | null
+ taxPercent: number | null
unitPrice: number | null
updatedAt: string | null
updatedBy: string | null
@@ -13980,13 +13985,17 @@ export type Database = {
createdBy: string
customFields?: Json | null
description?: string | null
+ exchangeRate?: number | null
+ extendedPrice?: number | null
+ externalNotes?: Json | null
id?: string
+ internalNotes?: Json | null
inventoryUnitOfMeasureCode?: string | null
invoicedComplete?: boolean
itemId?: string | null
itemReadableId?: string | null
locationId?: string | null
- notes?: Json | null
+ modelUploadId?: string | null
purchaseOrderId: string
purchaseOrderLineType: Database["public"]["Enums"]["purchaseOrderLineType"]
purchaseQuantity?: number | null
@@ -13999,7 +14008,14 @@ export type Database = {
requiresInspection?: boolean
setupPrice?: number | null
shelfId?: string | null
+ shippingCost?: number | null
+ supplierExtendedPrice?: number | null
+ supplierShippingCost?: number
+ supplierTaxAmount?: number
+ supplierUnitPrice?: number | null
tags?: string[] | null
+ taxAmount?: number | null
+ taxPercent?: number | null
unitPrice?: number | null
updatedAt?: string | null
updatedBy?: string | null
@@ -14013,13 +14029,17 @@ export type Database = {
createdBy?: string
customFields?: Json | null
description?: string | null
+ exchangeRate?: number | null
+ extendedPrice?: number | null
+ externalNotes?: Json | null
id?: string
+ internalNotes?: Json | null
inventoryUnitOfMeasureCode?: string | null
invoicedComplete?: boolean
itemId?: string | null
itemReadableId?: string | null
locationId?: string | null
- notes?: Json | null
+ modelUploadId?: string | null
purchaseOrderId?: string
purchaseOrderLineType?: Database["public"]["Enums"]["purchaseOrderLineType"]
purchaseQuantity?: number | null
@@ -14032,7 +14052,14 @@ export type Database = {
requiresInspection?: boolean
setupPrice?: number | null
shelfId?: string | null
+ shippingCost?: number | null
+ supplierExtendedPrice?: number | null
+ supplierShippingCost?: number
+ supplierTaxAmount?: number
+ supplierUnitPrice?: number | null
tags?: string[] | null
+ taxAmount?: number | null
+ taxPercent?: number | null
unitPrice?: number | null
updatedAt?: string | null
updatedBy?: string | null
@@ -14101,6 +14128,34 @@ export type Database = {
referencedRelation: "item"
referencedColumns: ["id"]
},
+ {
+ foreignKeyName: "purchaseOrderLine_modelUploadId_fkey"
+ columns: ["modelUploadId"]
+ isOneToOne: false
+ referencedRelation: "jobs"
+ referencedColumns: ["modelId"]
+ },
+ {
+ foreignKeyName: "purchaseOrderLine_modelUploadId_fkey"
+ columns: ["modelUploadId"]
+ isOneToOne: false
+ referencedRelation: "modelUpload"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "purchaseOrderLine_modelUploadId_fkey"
+ columns: ["modelUploadId"]
+ isOneToOne: false
+ referencedRelation: "parts"
+ referencedColumns: ["modelId"]
+ },
+ {
+ foreignKeyName: "purchaseOrderLine_modelUploadId_fkey"
+ columns: ["modelUploadId"]
+ isOneToOne: false
+ referencedRelation: "salesRfqLines"
+ referencedColumns: ["modelId"]
+ },
{
foreignKeyName: "purchaseOrderLine_purchaseOrderId_fkey"
columns: ["purchaseOrderId"]
@@ -20034,6 +20089,7 @@ export type Database = {
supplierTypeId: string | null
tags: string[] | null
taxId: string | null
+ taxPercent: number
updatedAt: string | null
updatedBy: string | null
website: string | null
@@ -20056,6 +20112,7 @@ export type Database = {
supplierTypeId?: string | null
tags?: string[] | null
taxId?: string | null
+ taxPercent?: number
updatedAt?: string | null
updatedBy?: string | null
website?: string | null
@@ -20078,6 +20135,7 @@ export type Database = {
supplierTypeId?: string | null
tags?: string[] | null
taxId?: string | null
+ taxPercent?: number
updatedAt?: string | null
updatedBy?: string | null
website?: string | null
@@ -27299,13 +27357,18 @@ export type Database = {
Row: {
accountNumber: string | null
assetId: string | null
+ autodeskUrn: string | null
companyId: string | null
conversionFactor: number | null
createdAt: string | null
createdBy: string | null
customFields: Json | null
description: string | null
+ exchangeRate: number | null
+ extendedPrice: number | null
+ externalNotes: Json | null
id: string | null
+ internalNotes: Json | null
inventoryUnitOfMeasureCode: string | null
invoicedComplete: boolean | null
itemDescription: string | null
@@ -27313,6 +27376,11 @@ export type Database = {
itemName: string | null
itemReadableId: string | null
locationId: string | null
+ modelId: string | null
+ modelName: string | null
+ modelPath: string | null
+ modelSize: number | null
+ modelUploadId: string | null
purchaseOrderId: string | null
purchaseOrderLineType:
| Database["public"]["Enums"]["purchaseOrderLineType"]
@@ -27327,49 +27395,22 @@ export type Database = {
requiresInspection: boolean | null
setupPrice: number | null
shelfId: string | null
- supplierId: string | null
+ shippingCost: number | null
+ supplierExtendedPrice: number | null
supplierPartId: string | null
+ supplierShippingCost: number | null
+ supplierTaxAmount: number | null
+ supplierUnitPrice: number | null
tags: string[] | null
+ taxAmount: number | null
+ taxPercent: number | null
+ thumbnailPath: string | null
+ unitCost: number | null
unitPrice: number | null
updatedAt: string | null
updatedBy: string | null
}
Relationships: [
- {
- foreignKeyName: "purchaseOrder_supplierId_fkey"
- columns: ["supplierId"]
- isOneToOne: false
- referencedRelation: "supplier"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "purchaseOrder_supplierId_fkey"
- columns: ["supplierId"]
- isOneToOne: false
- referencedRelation: "contractors"
- referencedColumns: ["supplierId"]
- },
- {
- foreignKeyName: "purchaseOrder_supplierId_fkey"
- columns: ["supplierId"]
- isOneToOne: false
- referencedRelation: "partners"
- referencedColumns: ["supplierId"]
- },
- {
- foreignKeyName: "purchaseOrder_supplierId_fkey"
- columns: ["supplierId"]
- isOneToOne: false
- referencedRelation: "purchaseOrderSuppliers"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "purchaseOrder_supplierId_fkey"
- columns: ["supplierId"]
- isOneToOne: false
- referencedRelation: "suppliers"
- referencedColumns: ["id"]
- },
{
foreignKeyName: "purchaseOrderLine_accountNumber_fkey"
columns: ["accountNumber", "companyId"]
@@ -27433,6 +27474,34 @@ export type Database = {
referencedRelation: "item"
referencedColumns: ["id"]
},
+ {
+ foreignKeyName: "purchaseOrderLine_modelUploadId_fkey"
+ columns: ["modelUploadId"]
+ isOneToOne: false
+ referencedRelation: "modelUpload"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "purchaseOrderLine_modelUploadId_fkey"
+ columns: ["modelUploadId"]
+ isOneToOne: false
+ referencedRelation: "jobs"
+ referencedColumns: ["modelId"]
+ },
+ {
+ foreignKeyName: "purchaseOrderLine_modelUploadId_fkey"
+ columns: ["modelUploadId"]
+ isOneToOne: false
+ referencedRelation: "parts"
+ referencedColumns: ["modelId"]
+ },
+ {
+ foreignKeyName: "purchaseOrderLine_modelUploadId_fkey"
+ columns: ["modelUploadId"]
+ isOneToOne: false
+ referencedRelation: "salesRfqLines"
+ referencedColumns: ["modelId"]
+ },
{
foreignKeyName: "purchaseOrderLine_purchaseOrderId_fkey"
columns: ["purchaseOrderId"]
@@ -27561,30 +27630,32 @@ export type Database = {
createdBy: string | null
currencyCode: string | null
customFields: Json | null
+ deliveryDate: string | null
dropShipment: boolean | null
exchangeRate: number | null
exchangeRateUpdatedAt: string | null
externalNotes: Json | null
id: string | null
internalNotes: Json | null
+ itemType: Database["public"]["Enums"]["itemType"] | null
locationId: string | null
locationName: string | null
- notes: string | null
orderDate: string | null
- paymentTermName: string | null
+ orderTotal: number | null
+ paymentTermId: string | null
purchaseOrderId: string | null
receiptPromisedDate: string | null
receiptRequestedDate: string | null
revisionId: number | null
- shippingMethodName: string | null
- shippingTermName: string | null
+ shippingMethodId: string | null
+ shippingTermId: string | null
status: Database["public"]["Enums"]["purchaseOrderStatus"] | null
supplierContactId: string | null
supplierId: string | null
supplierLocationId: string | null
supplierReference: string | null
tags: string[] | null
- type: Database["public"]["Enums"]["purchaseOrderType"] | null
+ thumbnailPath: string | null
updatedAt: string | null
updatedBy: string | null
}
@@ -27813,6 +27884,27 @@ export type Database = {
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
},
+ {
+ foreignKeyName: "purchaseOrderDelivery_shippingMethodId_fkey"
+ columns: ["shippingMethodId"]
+ isOneToOne: false
+ referencedRelation: "shippingMethod"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "purchaseOrderDelivery_shippingTermId_fkey"
+ columns: ["shippingTermId"]
+ isOneToOne: false
+ referencedRelation: "shippingTerm"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "purchaseOrderPayment_paymentTermId_fkey"
+ columns: ["paymentTermId"]
+ isOneToOne: false
+ referencedRelation: "paymentTerm"
+ referencedColumns: ["id"]
+ },
]
}
purchaseOrderSuppliers: {
@@ -30779,6 +30871,7 @@ export type Database = {
supplierTypeId: string | null
tags: string[] | null
taxId: string | null
+ taxPercent: number | null
type: string | null
updatedAt: string | null
updatedBy: string | null
@@ -31487,6 +31580,7 @@ export type Database = {
operationQuantity: number
quantityComplete: number
quantityScrapped: number
+ thumbnailPath: string
}[]
}
get_claims: {
@@ -32279,7 +32373,6 @@ export type Database = {
owner_id: string | null
path_tokens: string[] | null
updated_at: string | null
- user_metadata: Json | null
version: string | null
}
Insert: {
@@ -32293,7 +32386,6 @@ export type Database = {
owner_id?: string | null
path_tokens?: string[] | null
updated_at?: string | null
- user_metadata?: Json | null
version?: string | null
}
Update: {
@@ -32307,7 +32399,6 @@ export type Database = {
owner_id?: string | null
path_tokens?: string[] | null
updated_at?: string | null
- user_metadata?: Json | null
version?: string | null
}
Relationships: [
@@ -32329,7 +32420,6 @@ export type Database = {
key: string
owner_id: string | null
upload_signature: string
- user_metadata: Json | null
version: string
}
Insert: {
@@ -32340,7 +32430,6 @@ export type Database = {
key: string
owner_id?: string | null
upload_signature: string
- user_metadata?: Json | null
version: string
}
Update: {
@@ -32351,7 +32440,6 @@ export type Database = {
key?: string
owner_id?: string | null
upload_signature?: string
- user_metadata?: Json | null
version?: string
}
Relationships: [
@@ -32488,10 +32576,6 @@ export type Database = {
updated_at: string
}[]
}
- operation: {
- Args: Record<PropertyKey, never>
- Returns: string
- }
search: {
Args: {
prefix: string
diff --git a/packages/database/supabase/migrations/20241211143656_add-image-to-kanban.sql b/packages/database/supabase/migrations/20241211143656_add-image-to-kanban.sql
new file mode 100644
index 0000000000..d53196232d
--- /dev/null
+++ b/packages/database/supabase/migrations/20241211143656_add-image-to-kanban.sql
@@ -0,0 +1,110 @@
+DROP FUNCTION IF EXISTS get_active_job_operations_by_location;
+CREATE OR REPLACE FUNCTION get_active_job_operations_by_location(
+ location_id TEXT,
+ work_center_ids TEXT[]
+)
+RETURNS TABLE (
+ "id" TEXT,
+ "jobId" TEXT,
+ "operationOrder" DOUBLE PRECISION,
+ "priority" DOUBLE PRECISION,
+ "processId" TEXT,
+ "workCenterId" TEXT,
+ "description" TEXT,
+ "setupTime" NUMERIC(10,2),
+ "setupUnit" factor,
+ "laborTime" NUMERIC(10,2),
+ "laborUnit" factor,
+ "machineTime" NUMERIC(10,2),
+ "machineUnit" factor,
+ "operationOrderType" "methodOperationOrder",
+ "jobMakeMethodId" TEXT,
+ "jobReadableId" TEXT,
+ "jobStatus" "jobStatus",
+ "jobDueDate" DATE,
+ "jobDeadlineType" "deadlineType",
+ "jobCustomerId" TEXT,
+ "salesOrderReadableId" TEXT,
+ "salesOrderId" TEXT,
+ "salesOrderLineId" TEXT,
+ "parentMaterialId" TEXT,
+ "itemReadableId" TEXT,
+ "operationStatus" "jobOperationStatus",
+ "operationQuantity" NUMERIC(10,2),
+ "quantityComplete" NUMERIC(10,2),
+ "quantityScrapped" NUMERIC(10,2),
+ "thumbnailPath" TEXT
+)
+SECURITY INVOKER
+AS $$
+BEGIN
+ RETURN QUERY
+ WITH relevant_jobs AS (
+ SELECT
+ j."id",
+ j."jobId",
+ j."status",
+ j."dueDate",
+ j."deadlineType",
+ j."customerId",
+ so."salesOrderId" AS "salesOrderReadableId",
+ so."id" AS "salesOrderId",
+ j."salesOrderLineId",
+ COALESCE(j."modelUploadId", i."modelUploadId") AS model_upload_id
+ FROM "job" j
+ INNER JOIN "item" i ON j."itemId" = i."id"
+ LEFT JOIN "salesOrderLine" sol ON sol."id" = j."salesOrderLineId"
+ LEFT JOIN "salesOrder" so ON so."id" = sol."salesOrderId"
+ WHERE j."locationId" = location_id
+ AND (j."status" = 'Ready' OR j."status" = 'In Progress' OR j."status" = 'Paused')
+ )
+ SELECT
+ jo."id",
+ jo."jobId",
+ jo."order" AS "operationOrder",
+ jo."priority",
+ jo."processId",
+ jo."workCenterId",
+ jo."description",
+ jo."setupTime",
+ jo."setupUnit",
+ jo."laborTime",
+ jo."laborUnit",
+ jo."machineTime",
+ jo."machineUnit",
+ jo."operationOrder" AS "operationOrderType",
+ jo."jobMakeMethodId",
+ rj."jobId" AS "jobReadableId",
+ rj."status" AS "jobStatus",
+ rj."dueDate" AS "jobDueDate",
+ rj."deadlineType" AS "jobDeadlineType",
+ rj."customerId" AS "jobCustomerId",
+ rj."salesOrderReadableId",
+ rj."salesOrderId",
+ rj."salesOrderLineId",
+ jmm."parentMaterialId",
+ i."readableId" as "itemReadableId",
+ CASE
+ WHEN rj."status" = 'Paused' THEN 'Paused'
+ ELSE jo."status"
+ END AS "operationStatus",
+ jo."operationQuantity",
+ jo."quantityComplete",
+ jo."quantityScrapped",
+ CASE
+ WHEN i."thumbnailPath" IS NULL AND mu."thumbnailPath" IS NOT NULL THEN mu."thumbnailPath"
+ ELSE i."thumbnailPath"
+ END as "thumbnailPath"
+ FROM "jobOperation" jo
+ JOIN relevant_jobs rj ON rj.id = jo."jobId"
+ LEFT JOIN "jobMakeMethod" jmm ON jo."jobMakeMethodId" = jmm.id
+ LEFT JOIN "item" i ON jmm."itemId" = i.id
+ LEFT JOIN "modelUpload" mu ON mu.id = rj.model_upload_id
+ WHERE CASE
+ WHEN array_length(work_center_ids, 1) > 0 THEN
+ jo."workCenterId" = ANY(work_center_ids) AND jo."status" != 'Done' AND jo."status" != 'Canceled'
+ ELSE jo."status" != 'Done' AND jo."status" != 'Canceled'
+ END
+ ORDER BY jo."priority";
+END;
+$$ LANGUAGE plpgsql;
\ No newline at end of file