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 revision to bom explorers

Brad Barbin808667c9ad37
diff --git a/apps/erp/app/modules/items/ui/Item/BoMExplorer.tsx b/apps/erp/app/modules/items/ui/Item/BoMExplorer.tsx
index 8af37125cc..57d1e84872 100644
--- a/apps/erp/app/modules/items/ui/Item/BoMExplorer.tsx
+++ b/apps/erp/app/modules/items/ui/Item/BoMExplorer.tsx
@@ -5,6 +5,7 @@ import {
HoverCard,
HoverCardContent,
HoverCardTrigger,
+ IconButton,
Input,
InputGroup,
InputLeftElement,
@@ -13,9 +14,14 @@ import {
useMount,
} from "@carbon/react";
import { useOptimisticLocation } from "@carbon/remix";
-import { useNavigate, useParams } from "@remix-run/react";
+import { Link, useNavigate, useParams } from "@remix-run/react";
import { useRef, useState } from "react";
-import { LuChevronDown, LuChevronRight, LuSearch } from "react-icons/lu";
+import {
+ LuChevronDown,
+ LuChevronRight,
+ LuExternalLink,
+ LuSearch,
+} from "react-icons/lu";
import { MethodIcon, MethodItemTypeIcon } from "~/components";
import type { FlatTreeItem } from "~/components/TreeView";
import { LevelLine, TreeView, useTree } from "~/components/TreeView";
@@ -25,6 +31,7 @@ import { type MethodItemType } from "~/modules/shared";
import { useBom } from "~/stores";
import { path } from "~/utils/path";
import type { Method } from "../../types";
+import { getLinkToItemDetails } from "./ItemForm";
type BoMExplorerProps = {
itemType: MethodItemType;
@@ -132,7 +139,7 @@ const BoMExplorer = ({
<div
key={node.id}
className={cn(
- "flex h-8 cursor-pointer items-center overflow-hidden rounded-sm pr-2 gap-1",
+ "flex h-8 cursor-pointer items-center overflow-hidden rounded-sm pr-2 gap-1 group/node",
state.selected
? "bg-muted hover:bg-muted/90"
: "bg-transparent hover:bg-muted/90"
@@ -242,10 +249,15 @@ export default BoMExplorer;
function NodeText({ node }: { node: FlatTreeItem<Method> }) {
return (
- <div className="flex flex-col items-start gap-0">
+ <div className="flex items-start gap-1">
<span className="text-sm truncate font-medium">
{node.data.description || node.data.itemReadableId}
</span>
+ {node.data.revision && node.data.revision !== "0" && (
+ <Badge variant="outline" className="text-xs opacity-0">
+ {node.data.revision}
+ </Badge>
+ )}
</div>
);
}
@@ -273,7 +285,22 @@ function NodePreview({ node }: { node: FlatTreeItem<Method> }) {
</span>
<HStack className="w-full justify-between">
<span>{node.data.itemReadableId}</span>
- <Copy text={node.data.itemReadableId} />
+ <HStack spacing={1}>
+ <Copy text={node.data.itemReadableId} />
+ <Link
+ to={getLinkToItemDetails(
+ node.data.itemType as "Part",
+ node.data.itemId
+ )}
+ >
+ <IconButton
+ aria-label="View Item Master"
+ size="sm"
+ variant="secondary"
+ icon={<LuExternalLink />}
+ />
+ </Link>
+ </HStack>
</HStack>
</VStack>
<VStack spacing={1}>
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobBoMExplorer.tsx b/apps/erp/app/modules/production/ui/Jobs/JobBoMExplorer.tsx
index 7ed647e46e..5940e2a329 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobBoMExplorer.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobBoMExplorer.tsx
@@ -5,6 +5,7 @@ import {
HoverCard,
HoverCardContent,
HoverCardTrigger,
+ IconButton,
Input,
InputGroup,
InputLeftElement,
@@ -15,13 +16,19 @@ import {
VStack,
cn,
} from "@carbon/react";
-import { useFetchers, useNavigate, useParams } from "@remix-run/react";
+import { Link, useFetchers, useNavigate, useParams } from "@remix-run/react";
import { useEffect, useRef, useState } from "react";
-import { LuChevronDown, LuChevronRight, LuSearch } from "react-icons/lu";
+import {
+ LuChevronDown,
+ LuChevronRight,
+ LuExternalLink,
+ LuSearch,
+} from "react-icons/lu";
import { MethodIcon, MethodItemTypeIcon } from "~/components";
import type { FlatTree, FlatTreeItem } from "~/components/TreeView";
import { LevelLine, TreeView, useTree } from "~/components/TreeView";
import { useOptimisticLocation } from "~/hooks";
+import { getLinkToItemDetails } from "~/modules/items/ui/Item/ItemForm";
import { useBom } from "~/stores";
import { path } from "~/utils/path";
import type { JobMethod } from "../../production.service";
@@ -225,6 +232,11 @@ function NodeText({ node }: { node: FlatTreeItem<JobMethod> }) {
<span className="font-medium text-sm truncate">
{node.data.description || node.data.itemReadableId}
</span>
+ {node.data.revision && node.data.revision !== "0" && (
+ <Badge variant="outline" className="text-xs">
+ {node.data.revision}
+ </Badge>
+ )}
</div>
);
}
@@ -258,7 +270,22 @@ function NodePreview({ node }: { node: FlatTreeItem<JobMethod> }) {
</span>
<HStack className="w-full justify-between">
<span>{node.data.itemReadableId}</span>
- <Copy text={node.data.itemReadableId} />
+ <HStack spacing={1}>
+ <Copy text={node.data.itemReadableId} />
+ <Link
+ to={getLinkToItemDetails(
+ node.data.itemType as "Part",
+ node.data.itemId
+ )}
+ >
+ <IconButton
+ aria-label="View Item Master"
+ size="sm"
+ variant="secondary"
+ icon={<LuExternalLink />}
+ />
+ </Link>
+ </HStack>
</HStack>
</VStack>
<VStack spacing={1}>
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteBoMExplorer.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteBoMExplorer.tsx
index 1c4ca06527..34c28751df 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteBoMExplorer.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteBoMExplorer.tsx
@@ -5,6 +5,7 @@ import {
HoverCard,
HoverCardContent,
HoverCardTrigger,
+ IconButton,
Input,
InputGroup,
InputLeftElement,
@@ -15,13 +16,19 @@ import {
VStack,
cn,
} from "@carbon/react";
-import { useFetchers, useNavigate, useParams } from "@remix-run/react";
+import { Link, useFetchers, useNavigate, useParams } from "@remix-run/react";
import { useEffect, useRef, useState } from "react";
-import { LuChevronDown, LuChevronRight, LuSearch } from "react-icons/lu";
+import {
+ LuChevronDown,
+ LuChevronRight,
+ LuExternalLink,
+ LuSearch,
+} from "react-icons/lu";
import { MethodIcon, MethodItemTypeIcon } from "~/components";
import type { FlatTree, FlatTreeItem } from "~/components/TreeView";
import { LevelLine, TreeView, useTree } from "~/components/TreeView";
import { useOptimisticLocation } from "~/hooks";
+import { getLinkToItemDetails } from "~/modules/items/ui/Item/ItemForm";
import { useBom } from "~/stores";
import { path } from "~/utils/path";
import type { QuoteMethod } from "../../types";
@@ -138,7 +145,7 @@ const QuoteBoMExplorer = ({
<div
key={node.id}
className={cn(
- "flex h-8 cursor-pointer items-center overflow-hidden rounded-sm pr-2 gap-1",
+ "flex h-8 cursor-pointer items-center overflow-hidden rounded-sm pr-2 gap-1 group/node",
state.selected
? "bg-muted hover:bg-muted/90"
: "bg-transparent hover:bg-muted/90"
@@ -233,6 +240,11 @@ function NodeText({ node }: { node: FlatTreeItem<QuoteMethod> }) {
<span className="font-medium text-sm truncate">
{node.data.description || node.data.itemReadableId}
</span>
+ {node.data.revision && node.data.revision !== "0" && (
+ <Badge variant="outline" className="text-xs">
+ {node.data.revision}
+ </Badge>
+ )}
</div>
);
}
@@ -266,7 +278,22 @@ function NodePreview({ node }: { node: FlatTreeItem<QuoteMethod> }) {
</span>
<HStack className="w-full justify-between">
<span>{node.data.itemReadableId}</span>
- <Copy text={node.data.itemReadableId} />
+ <HStack spacing={1}>
+ <Copy text={node.data.itemReadableId} />
+ <Link
+ to={getLinkToItemDetails(
+ node.data.itemType as "Part",
+ node.data.itemId
+ )}
+ >
+ <IconButton
+ aria-label="View Item Master"
+ size="sm"
+ variant="secondary"
+ icon={<LuExternalLink />}
+ />
+ </Link>
+ </HStack>
</HStack>
</VStack>
<VStack spacing={1}>
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 64684e5cac..f2c66f8e9c 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -36579,14 +36579,14 @@ export type Database = {
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["supplierLocationId"]
+ columns: ["id"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["id"]
+ columns: ["supplierLocationId"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
@@ -40680,14 +40680,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"]
@@ -43288,6 +43288,7 @@ export type Database = {
order: number
isRoot: boolean
kit: boolean
+ revision: string
}[]
}
get_job_methods_by_method_id: {
@@ -43474,6 +43475,7 @@ export type Database = {
operationId: string
isRoot: boolean
kit: boolean
+ revision: string
}[]
}
get_my_claim: {
@@ -43585,6 +43587,7 @@ export type Database = {
order: number
isRoot: boolean
kit: boolean
+ revision: string
}[]
}
get_quote_methods_by_method_id: {
@@ -43610,6 +43613,7 @@ export type Database = {
order: number
isRoot: boolean
kit: boolean
+ revision: string
}[]
}
get_recent_job_operations_by_employee: {
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 64684e5cac..f2c66f8e9c 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -36579,14 +36579,14 @@ export type Database = {
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["supplierLocationId"]
+ columns: ["id"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["id"]
+ columns: ["supplierLocationId"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
@@ -40680,14 +40680,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"]
@@ -43288,6 +43288,7 @@ export type Database = {
order: number
isRoot: boolean
kit: boolean
+ revision: string
}[]
}
get_job_methods_by_method_id: {
@@ -43474,6 +43475,7 @@ export type Database = {
operationId: string
isRoot: boolean
kit: boolean
+ revision: string
}[]
}
get_my_claim: {
@@ -43585,6 +43587,7 @@ export type Database = {
order: number
isRoot: boolean
kit: boolean
+ revision: string
}[]
}
get_quote_methods_by_method_id: {
@@ -43610,6 +43613,7 @@ export type Database = {
order: number
isRoot: boolean
kit: boolean
+ revision: string
}[]
}
get_recent_job_operations_by_employee: {
diff --git a/packages/database/supabase/migrations/20250523234547_revisions-bom-expolorer.sql b/packages/database/supabase/migrations/20250523234547_revisions-bom-expolorer.sql
new file mode 100644
index 0000000000..2e5fe52c09
--- /dev/null
+++ b/packages/database/supabase/migrations/20250523234547_revisions-bom-expolorer.sql
@@ -0,0 +1,368 @@
+DROP FUNCTION IF EXISTS get_quote_methods_by_method_id;
+CREATE OR REPLACE FUNCTION get_quote_methods_by_method_id(mid TEXT)
+RETURNS TABLE (
+ "quoteId" TEXT,
+ "quoteLineId" TEXT,
+ "methodMaterialId" TEXT,
+ "quoteMakeMethodId" TEXT,
+ "quoteMaterialMakeMethodId" TEXT,
+ "itemId" TEXT,
+ "itemReadableId" TEXT,
+ "description" TEXT,
+ "unitOfMeasureCode" TEXT,
+ "itemType" TEXT,
+ "itemTrackingType" TEXT,
+ "quantity" NUMERIC,
+ "unitCost" NUMERIC,
+ "methodType" "methodType",
+ "parentMaterialId" TEXT,
+ "order" DOUBLE PRECISION,
+ "isRoot" BOOLEAN,
+ "kit" BOOLEAN,
+ "revision" TEXT
+) AS $$
+WITH RECURSIVE material AS (
+ SELECT
+ "quoteId",
+ "quoteLineId",
+ "id",
+ "id" AS "quoteMakeMethodId",
+ 'Make'::"methodType" AS "methodType",
+ "id" AS "quoteMaterialMakeMethodId",
+ "itemId",
+ 'Part' AS "itemType",
+ 1::NUMERIC AS "quantity",
+ 0::NUMERIC AS "unitCost",
+ "parentMaterialId",
+ CAST(1 AS DOUBLE PRECISION) AS "order",
+ TRUE AS "isRoot",
+ FALSE AS "kit"
+ FROM
+ "quoteMakeMethod"
+ WHERE
+ "id" = mid
+ UNION
+ SELECT
+ child."quoteId",
+ child."quoteLineId",
+ child."id",
+ child."quoteMakeMethodId",
+ child."methodType",
+ child."quoteMaterialMakeMethodId",
+ child."itemId",
+ child."itemType",
+ child."quantity",
+ child."unitCost",
+ parent."id" AS "parentMaterialId",
+ child."order",
+ FALSE AS "isRoot",
+ child."kit"
+ FROM
+ "quoteMaterialWithMakeMethodId" child
+ INNER JOIN material parent ON parent."quoteMaterialMakeMethodId" = child."quoteMakeMethodId"
+ WHERE parent."methodType" = 'Make'
+)
+SELECT
+ material."quoteId",
+ material."quoteLineId",
+ material.id as "methodMaterialId",
+ material."quoteMakeMethodId",
+ material."quoteMaterialMakeMethodId",
+ material."itemId",
+ item."readableIdWithRevision" AS "itemReadableId",
+ item."name" AS "description",
+ item."unitOfMeasureCode",
+ material."itemType",
+ item."itemTrackingType",
+ material."quantity",
+ material."unitCost",
+ material."methodType",
+ material."parentMaterialId",
+ material."order",
+ material."isRoot",
+ material."kit",
+ item."revision"
+FROM material
+INNER JOIN item ON material."itemId" = item.id
+ORDER BY "order"
+$$ LANGUAGE sql STABLE;
+
+
+DROP FUNCTION get_method_tree;
+CREATE OR REPLACE FUNCTION get_method_tree(uid TEXT)
+RETURNS TABLE (
+ "methodMaterialId" TEXT,
+ "makeMethodId" TEXT,
+ "materialMakeMethodId" TEXT,
+ "itemId" TEXT,
+ "itemReadableId" TEXT,
+ "itemType" TEXT,
+ "description" TEXT,
+ "unitOfMeasureCode" TEXT,
+ "unitCost" NUMERIC,
+ "quantity" NUMERIC,
+ "methodType" "methodType",
+ "itemTrackingType" TEXT,
+ "parentMaterialId" TEXT,
+ "order" DOUBLE PRECISION,
+ "operationId" TEXT,
+ "isRoot" BOOLEAN,
+ "kit" BOOLEAN,
+ "revision" TEXT
+) AS $$
+WITH RECURSIVE material AS (
+ SELECT
+ "id",
+ "makeMethodId",
+ "methodType",
+ "materialMakeMethodId",
+ "itemId",
+ "itemType",
+ "quantity",
+ "makeMethodId" AS "parentMaterialId",
+ NULL AS "operationId",
+ COALESCE("order", 1) AS "order",
+ "kit"
+ FROM
+ "methodMaterial"
+ WHERE
+ "makeMethodId" = uid
+ UNION
+ SELECT
+ child."id",
+ child."makeMethodId",
+ child."methodType",
+ child."materialMakeMethodId",
+ child."itemId",
+ child."itemType",
+ child."quantity",
+ parent."id" AS "parentMaterialId",
+ child."methodOperationId" AS "operationId",
+ child."order",
+ child."kit"
+ FROM
+ "methodMaterial" child
+ INNER JOIN material parent ON parent."materialMakeMethodId" = child."makeMethodId"
+)
+SELECT
+ material.id as "methodMaterialId",
+ material."makeMethodId",
+ material."materialMakeMethodId",
+ material."itemId",
+ item."readableIdWithRevision" AS "itemReadableId",
+ material."itemType",
+ item."name" AS "description",
+ item."unitOfMeasureCode",
+ cost."unitCost",
+ material."quantity",
+ material."methodType",
+ item."itemTrackingType",
+ material."parentMaterialId",
+ material."order",
+ material."operationId",
+ false AS "isRoot",
+ material."kit",
+ item."revision"
+FROM material
+INNER JOIN item
+ ON material."itemId" = item.id
+INNER JOIN "itemCost" cost
+ ON item.id = cost."itemId"
+UNION
+SELECT
+ mm."id" AS "methodMaterialId",
+ NULL AS "makeMethodId",
+ mm.id AS "materialMakeMethodId",
+ mm."itemId",
+ item."readableIdWithRevision" AS "itemReadableId",
+ item."type"::text,
+ item."name" AS "description",
+ item."unitOfMeasureCode",
+ cost."unitCost",
+ 1 AS "quantity",
+ 'Make' AS "methodType",
+ item."itemTrackingType",
+ NULL AS "parentMaterialId",
+ CAST(1 AS DOUBLE PRECISION) AS "order",
+ NULL AS "operationId",
+ true AS "isRoot",
+ false AS "kit",
+ item."revision"
+FROM "makeMethod" mm
+INNER JOIN item
+ ON mm."itemId" = item.id
+INNER JOIN "itemCost" cost
+ ON item.id = cost."itemId"
+WHERE mm.id = uid
+ORDER BY "order"
+$$ LANGUAGE sql STABLE;
+
+
+DROP FUNCTION IF EXISTS get_quote_methods;
+CREATE OR REPLACE FUNCTION get_quote_methods(qid TEXT)
+RETURNS TABLE (
+ "quoteId" TEXT,
+ "quoteLineId" TEXT,
+ "methodMaterialId" TEXT,
+ "quoteMakeMethodId" TEXT,
+ "quoteMaterialMakeMethodId" TEXT,
+ "itemId" TEXT,
+ "itemReadableId" TEXT,
+ "description" TEXT,
+ "itemType" TEXT,
+ "quantity" NUMERIC,
+ "unitCost" NUMERIC,
+ "methodType" "methodType",
+ "parentMaterialId" TEXT,
+ "order" DOUBLE PRECISION,
+ "isRoot" BOOLEAN,
+ "kit" BOOLEAN,
+ "revision" TEXT
+) AS $$
+WITH RECURSIVE material AS (
+ SELECT
+ "quoteId",
+ "quoteLineId",
+ "id",
+ "id" AS "quoteMakeMethodId",
+ 'Make'::"methodType" AS "methodType",
+ "id" AS "quoteMaterialMakeMethodId",
+ "itemId",
+ 'Part' AS "itemType",
+ 1::NUMERIC AS "quantity",
+ 0::NUMERIC AS "unitCost",
+ "parentMaterialId",
+ CAST(1 AS DOUBLE PRECISION) AS "order",
+ TRUE AS "isRoot",
+ FALSE AS "kit"
+ FROM
+ "quoteMakeMethod"
+ WHERE
+ "quoteId" = qid
+ AND "parentMaterialId" IS NULL
+ UNION
+ SELECT
+ child."quoteId",
+ child."quoteLineId",
+ child."id",
+ child."quoteMakeMethodId",
+ child."methodType",
+ child."quoteMaterialMakeMethodId",
+ child."itemId",
+ child."itemType",
+ child."quantity",
+ child."unitCost",
+ parent."id" AS "parentMaterialId",
+ child."order",
+ FALSE AS "isRoot",
+ child."kit"
+ FROM
+ "quoteMaterialWithMakeMethodId" child
+ INNER JOIN material parent ON parent."quoteMaterialMakeMethodId" = child."quoteMakeMethodId"
+)
+SELECT
+ material."quoteId",
+ material."quoteLineId",
+ material.id as "methodMaterialId",
+ material."quoteMakeMethodId",
+ material."quoteMaterialMakeMethodId",
+ material."itemId",
+ item."readableIdWithRevision" AS "itemReadableId",
+ item."name" AS "description",
+ material."itemType",
+ material."quantity",
+ material."unitCost",
+ material."methodType",
+ material."parentMaterialId",
+ material."order",
+ material."isRoot",
+ material."kit",
+ item."revision"
+FROM material
+INNER JOIN item ON material."itemId" = item.id
+WHERE material."quoteId" = qid
+ORDER BY "order"
+$$ LANGUAGE sql STABLE;
+
+DROP FUNCTION IF EXISTS get_job_method;
+CREATE OR REPLACE FUNCTION get_job_method(jid TEXT)
+RETURNS TABLE (
+ "jobId" TEXT,
+ "methodMaterialId" TEXT,
+ "jobMakeMethodId" TEXT,
+ "jobMaterialMakeMethodId" TEXT,
+ "itemId" TEXT,
+ "itemReadableId" TEXT,
+ "description" TEXT,
+ "itemType" TEXT,
+ "quantity" NUMERIC,
+ "unitCost" NUMERIC,
+ "methodType" "methodType",
+ "parentMaterialId" TEXT,
+ "order" DOUBLE PRECISION,
+ "isRoot" BOOLEAN,
+ "kit" BOOLEAN,
+ "revision" TEXT
+) AS $$
+WITH RECURSIVE material AS (
+ SELECT
+ "jobId",
+ "id",
+ "id" AS "jobMakeMethodId",
+ 'Make'::"methodType" AS "methodType",
+ "id" AS "jobMaterialMakeMethodId",
+ "itemId",
+ 'Part' AS "itemType",
+ 1::NUMERIC AS "quantity",
+ 0::NUMERIC AS "unitCost",
+ "parentMaterialId",
+ CAST(1 AS DOUBLE PRECISION) AS "order",
+ TRUE AS "isRoot",
+ FALSE AS "kit"
+ FROM
+ "jobMakeMethod"
+ WHERE
+ "jobId" = jid
+ AND "parentMaterialId" IS NULL
+ UNION
+ SELECT
+ child."jobId",
+ child."id",
+ child."jobMakeMethodId",
+ child."methodType",
+ child."jobMaterialMakeMethodId",
+ child."itemId",
+ child."itemType",
+ child."quantity",
+ child."unitCost",
+ parent."id" AS "parentMaterialId",
+ child."order",
+ FALSE AS "isRoot",
+ child."kit"
+ FROM
+ "jobMaterialWithMakeMethodId" child
+ INNER JOIN material parent ON parent."jobMaterialMakeMethodId" = child."jobMakeMethodId"
+ WHERE parent."methodType" = 'Make'
+)
+SELECT
+ material."jobId",
+ material.id as "methodMaterialId",
+ material."jobMakeMethodId",
+ material."jobMaterialMakeMethodId",
+ material."itemId",
+ item."readableIdWithRevision" AS "itemReadableId",
+ item."name" AS "description",
+ material."itemType",
+ material."quantity",
+ material."unitCost",
+ material."methodType",
+ material."parentMaterialId",
+ material."order",
+ material."isRoot",
+ material."kit",
+ item."revision"
+FROM material
+INNER JOIN item ON material."itemId" = item.id
+WHERE material."jobId" = jid
+ORDER BY "order"
+$$ LANGUAGE sql STABLE;
\ No newline at end of file
diff --git a/packages/react/src/Badge.tsx b/packages/react/src/Badge.tsx
index f3ee13cacd..88dd32f529 100644
--- a/packages/react/src/Badge.tsx
+++ b/packages/react/src/Badge.tsx
@@ -20,7 +20,7 @@ const badgeVariants = cva(
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
destructive:
"bg-destructive text-destructive-foreground shadow:sm dark:shadow hover:bg-destructive/80",
- outline: "text-foreground",
+ outline: "text-foreground border border-border",
green:
"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/50 dark:text-emerald-400",
yellow: