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 material form filter to configured parameter

Brad Barbin5c72d9517ed7
diff --git a/apps/erp/app/components/Configurator/ConfiguratorForm/ConfiguratorForm.ee.tsx b/apps/erp/app/components/Configurator/ConfiguratorForm/ConfiguratorForm.ee.tsx
index 6f84e803be..ec5ca58267 100644
--- a/apps/erp/app/components/Configurator/ConfiguratorForm/ConfiguratorForm.ee.tsx
+++ b/apps/erp/app/components/Configurator/ConfiguratorForm/ConfiguratorForm.ee.tsx
@@ -23,10 +23,12 @@ import {
SelectTrigger,
SelectValue,
Switch,
- toast
+ toast,
+ useMount
} from "@carbon/react";
import { createContext, useContext, useEffect, useMemo, useState } from "react";
import { LuChevronDown, LuChevronUp, LuTriangleAlert } from "react-icons/lu";
+import { useFetcher } from "react-router";
import { z } from "zod";
import { zfd } from "zod-form-data";
import type {
@@ -35,6 +37,7 @@ import type {
MaterialConfigurationData
} from "~/modules/items/types";
import { useMaterials } from "~/stores/items";
+import { path } from "~/utils/path";
interface FormData {
[key: string]: string | number | boolean | MaterialConfigurationData;
@@ -83,9 +86,35 @@ function generateConfigurationSchema(parameters: ConfigurationParameter[]) {
return z.object(schemaFields);
}
+type MaterialOption = {
+ id: string;
+ name: string;
+ readableIdWithRevision: string;
+};
+
+function useMaterialsWithFilter(materialFormFilterId?: string | null) {
+ const allMaterials = useMaterials();
+ const materialsFetcher = useFetcher<{ data: MaterialOption[] }>();
+
+ useMount(() => {
+ if (materialFormFilterId) {
+ materialsFetcher.load(path.to.api.materials(materialFormFilterId));
+ }
+ });
+
+ const materials = useMemo(() => {
+ if (materialFormFilterId && materialsFetcher.data?.data) {
+ return materialsFetcher.data.data;
+ }
+ return allMaterials;
+ }, [materialFormFilterId, materialsFetcher.data?.data, allMaterials]);
+
+ return materials;
+}
+
function ParameterField({ parameter }: ParameterFieldProps) {
const { formData, setFormData } = useConfigurator();
- const materials = useMaterials();
+ const materials = useMaterialsWithFilter(parameter.materialFormFilterId);
const handleChange = (value: string | number | boolean) => {
setFormData({ ...formData, [parameter.key]: value });
diff --git a/apps/erp/app/modules/items/items.models.ts b/apps/erp/app/modules/items/items.models.ts
index 061bc87984..ec838e0a5a 100644
--- a/apps/erp/app/modules/items/items.models.ts
+++ b/apps/erp/app/modules/items/items.models.ts
@@ -112,7 +112,8 @@ export const configurationParameterValidator = z
label: z.string().min(1, { message: "Label is required" }),
dataType: z.enum([...configurationParameterDataTypes, "date"]),
listOptions: z.string().min(1).array().optional(),
- configurationParameterGroupId: z.string().optional()
+ configurationParameterGroupId: z.string().optional(),
+ materialFormFilterId: zfd.text(z.string().optional())
})
.refine(
(data) => {
diff --git a/apps/erp/app/modules/items/ui/Parts/ConfigurationParameters.tsx b/apps/erp/app/modules/items/ui/Parts/ConfigurationParameters.tsx
index 7d385129d3..a10e3c4f5d 100644
--- a/apps/erp/app/modules/items/ui/Parts/ConfigurationParameters.tsx
+++ b/apps/erp/app/modules/items/ui/Parts/ConfigurationParameters.tsx
@@ -1,5 +1,6 @@
import {
Array as ArrayInput,
+ Combobox,
Hidden,
Input,
Select,
@@ -68,6 +69,8 @@ import {
import { useFetcher, useFetchers, useParams, useSubmit } from "react-router";
import { EmployeeAvatar } from "~/components";
import { ConfiguratorDataTypeIcon } from "~/components/Configurator/Icons";
+import { Enumerable } from "~/components/Enumerable";
+import { useShape } from "~/components/Form/Shape";
import { ConfirmDelete } from "~/components/Modals";
import type { ConfigurationParameter } from "~/modules/items";
import {
@@ -95,14 +98,17 @@ export default function ConfigurationParametersForm({
}) {
const {
isList,
+ isMaterial,
itemId,
key,
onChangeCheckForListType,
setKey,
setIsList,
+ setIsMaterial,
updateKey
} = useConfigurationParameters();
+ const materialShapeOptions = useShape();
const submit = useSubmit();
const fetcher = useFetcher<typeof configurationParameterAction>();
@@ -188,6 +194,7 @@ export default function ConfigurationParametersForm({
onSubmit={() => {
setKey("");
setIsList(false);
+ setIsMaterial(false);
}}
defaultValues={{
itemId: itemId,
@@ -195,7 +202,8 @@ export default function ConfigurationParametersForm({
label: "",
dataType: "numeric",
listOptions: [],
- configurationParameterGroupId: undefined
+ configurationParameterGroupId: undefined,
+ materialFormFilterId: ""
}}
className="w-full"
>
@@ -236,6 +244,18 @@ export default function ConfigurationParametersForm({
{isList && (
<ArrayInput name="listOptions" label="List Parameters" />
)}
+ {isMaterial && (
+ <Combobox
+ name="materialFormFilterId"
+ label="Material Shape"
+ isClearable
+ isOptional
+ options={materialShapeOptions.map((shape) => ({
+ label: <Enumerable value={shape.label} />,
+ value: shape.value
+ }))}
+ />
+ )}
</div>
<HStack spacing={2}>
<Submit
@@ -777,9 +797,10 @@ function ConfigurableParameter({
parameter: ConfigurationParameter;
isOverlay?: boolean;
}) {
- const { isList, key, onChangeCheckForListType, updateKey } =
+ const { isList, isMaterial, key, onChangeCheckForListType, updateKey } =
useConfigurationParameters(parameter);
+ const materialShapeOptions = useShape();
const disclosure = useDisclosure();
const deleteParameterDisclosure = useDisclosure();
const submitted = useRef(false);
@@ -846,7 +867,8 @@ function ConfigurableParameter({
key: parameter.key,
label: parameter.label,
dataType: parameter.dataType,
- listOptions: parameter.listOptions ?? []
+ listOptions: parameter.listOptions ?? [],
+ materialFormFilterId: parameter.materialFormFilterId ?? undefined
}}
>
<Hidden name="id" />
@@ -886,6 +908,18 @@ function ConfigurableParameter({
{isList && (
<ArrayInput name="listOptions" label="List Parameters" />
)}
+ {isMaterial && (
+ <Combobox
+ name="materialFormFilterId"
+ label="Material Shape"
+ isOptional
+ isClearable
+ options={materialShapeOptions.map((shape) => ({
+ label: <Enumerable value={shape.label} />,
+ value: shape.value
+ }))}
+ />
+ )}
</div>
<HStack className="w-full justify-end" spacing={2}>
<Button variant="secondary" onClick={disclosure.onClose}>
@@ -1042,7 +1076,9 @@ function useConfigurationParameters(parameter?: ConfigurationParameter) {
if (!itemId) throw new Error("Could not find itemId");
const [key, setKey] = useState(parameter?.key ?? "");
const [isList, setIsList] = useState(parameter?.dataType === "list");
-
+ const [isMaterial, setIsMaterial] = useState(
+ parameter?.dataType === "material"
+ );
const onChangeCheckForListType = (
newValue: {
value: string;
@@ -1052,6 +1088,7 @@ function useConfigurationParameters(parameter?: ConfigurationParameter) {
if (!newValue) return;
const type = newValue.value;
setIsList(type === "list");
+ setIsMaterial(type === "material");
};
const updateKey = (e: React.ChangeEvent<HTMLInputElement>) => {
@@ -1067,10 +1104,12 @@ function useConfigurationParameters(parameter?: ConfigurationParameter) {
return {
key,
isList,
+ isMaterial,
itemId,
onChangeCheckForListType,
setKey,
setIsList,
+ setIsMaterial,
updateKey
};
}
diff --git a/apps/erp/app/routes/api+/items.materials.ts b/apps/erp/app/routes/api+/items.materials.ts
new file mode 100644
index 0000000000..65470cccf5
--- /dev/null
+++ b/apps/erp/app/routes/api+/items.materials.ts
@@ -0,0 +1,22 @@
+import { requirePermissions } from "@carbon/auth/auth.server";
+import type { LoaderFunctionArgs } from "react-router";
+
+export async function loader({ request }: LoaderFunctionArgs) {
+ const { client, companyId } = await requirePermissions(request, {});
+
+ const url = new URL(request.url);
+ const materialFormId = url.searchParams.get("materialFormId");
+
+ let query = client
+ .from("materials")
+ .select("id, name, readableIdWithRevision, materialFormId")
+ .or(`companyId.eq.${companyId},companyId.is.null`)
+ .eq("active", true)
+ .order("name");
+
+ if (materialFormId) {
+ query = query.eq("materialFormId", materialFormId);
+ }
+
+ return query;
+}
diff --git a/apps/erp/app/utils/path.ts b/apps/erp/app/utils/path.ts
index d650651e38..d86ee7f553 100644
--- a/apps/erp/app/utils/path.ts
+++ b/apps/erp/app/utils/path.ts
@@ -83,6 +83,10 @@ export const path = {
materialFinishes: (substanceId: string) =>
generatePath(`${api}/items/finishes/${substanceId}`),
materialForms: `${api}/items/forms`,
+ materials: (materialFormId?: string) =>
+ generatePath(
+ `${api}/items/materials${materialFormId ? `?materialFormId=${materialFormId}` : ""}`
+ ),
materialGrades: (substanceId: string) =>
generatePath(`${api}/items/grades/${substanceId}`),
materialTypes: (substanceId: string, formId: string) =>
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index aff5043295..30e2023b66 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -2441,6 +2441,7 @@ export type Database = {
key: string
label: string
listOptions: string[] | null
+ materialFormFilterId: string | null
sortOrder: number
updatedAt: string | null
updatedBy: string | null
@@ -2456,6 +2457,7 @@ export type Database = {
key: string
label: string
listOptions?: string[] | null
+ materialFormFilterId?: string | null
sortOrder?: number
updatedAt?: string | null
updatedBy?: string | null
@@ -2471,6 +2473,7 @@ export type Database = {
key?: string
label?: string
listOptions?: string[] | null
+ materialFormFilterId?: string | null
sortOrder?: number
updatedAt?: string | null
updatedBy?: string | null
@@ -2581,6 +2584,13 @@ export type Database = {
referencedRelation: "tools"
referencedColumns: ["id"]
},
+ {
+ foreignKeyName: "configurationParameter_materialFormFilterId_fkey"
+ columns: ["materialFormFilterId"]
+ isOneToOne: false
+ referencedRelation: "materialForm"
+ referencedColumns: ["id"]
+ },
{
foreignKeyName: "configurationParameter_updatedBy_fkey"
columns: ["updatedBy"]
@@ -10270,6 +10280,7 @@ export type Database = {
}
jobMaterial: {
Row: {
+ bomId: string | null
companyId: string
createdAt: string
createdBy: string
@@ -10299,6 +10310,7 @@ export type Database = {
updatedBy: string | null
}
Insert: {
+ bomId?: string | null
companyId: string
createdAt?: string
createdBy: string
@@ -10328,6 +10340,7 @@ export type Database = {
updatedBy?: string | null
}
Update: {
+ bomId?: string | null
companyId?: string
createdAt?: string
createdBy?: string
@@ -15175,6 +15188,7 @@ export type Database = {
}
methodMaterial: {
Row: {
+ bomId: string | null
companyId: string
createdAt: string
createdBy: string
@@ -15198,6 +15212,7 @@ export type Database = {
updatedBy: string | null
}
Insert: {
+ bomId?: string | null
companyId: string
createdAt?: string
createdBy: string
@@ -15221,6 +15236,7 @@ export type Database = {
updatedBy?: string | null
}
Update: {
+ bomId?: string | null
companyId?: string
createdAt?: string
createdBy?: string
@@ -19891,21 +19907,21 @@ export type Database = {
opportunity: {
Row: {
companyId: string
- customerId: string | null
+ customerId: string
id: string
purchaseOrderDocumentPath: string | null
requestForQuoteDocumentPath: string | null
}
Insert: {
companyId: string
- customerId?: string | null
+ customerId: string
id?: string
purchaseOrderDocumentPath?: string | null
requestForQuoteDocumentPath?: string | null
}
Update: {
companyId?: string
- customerId?: string | null
+ customerId?: string
id?: string
purchaseOrderDocumentPath?: string | null
requestForQuoteDocumentPath?: string | null
@@ -26479,6 +26495,7 @@ export type Database = {
}
quoteMaterial: {
Row: {
+ bomId: string | null
companyId: string
createdAt: string
createdBy: string
@@ -26505,6 +26522,7 @@ export type Database = {
updatedBy: string | null
}
Insert: {
+ bomId?: string | null
companyId: string
createdAt?: string
createdBy: string
@@ -26531,6 +26549,7 @@ export type Database = {
updatedBy?: string | null
}
Update: {
+ bomId?: string | null
companyId?: string
createdAt?: string
createdBy?: string
@@ -31315,6 +31334,174 @@ export type Database = {
},
]
}
+ searchIndex_BJiGdDNuetJ1iyE8USN7AD: {
+ Row: {
+ createdAt: string
+ description: string | null
+ entityId: string
+ entityType: string
+ id: number
+ link: string
+ metadata: Json | null
+ searchVector: unknown
+ tags: string[] | null
+ title: string
+ updatedAt: string | null
+ }
+ Insert: {
+ createdAt?: string
+ description?: string | null
+ entityId: string
+ entityType: string
+ id?: number
+ link: string
+ metadata?: Json | null
+ searchVector?: unknown
+ tags?: string[] | null
+ title: string
+ updatedAt?: string | null
+ }
+ Update: {
+ createdAt?: string
+ description?: string | null
+ entityId?: string
+ entityType?: string
+ id?: number
+ link?: string
+ metadata?: Json | null
+ searchVector?: unknown
+ tags?: string[] | null
+ title?: string
+ updatedAt?: string | null
+ }
+ Relationships: []
+ }
+ searchIndex_L4saDKMCpFQurK9c3bEr1G: {
+ Row: {
+ createdAt: string
+ description: string | null
+ entityId: string
+ entityType: string
+ id: number
+ link: string
+ metadata: Json | null
+ searchVector: unknown
+ tags: string[] | null
+ title: string
+ updatedAt: string | null
+ }
+ Insert: {
+ createdAt?: string
+ description?: string | null
+ entityId: string
+ entityType: string
+ id?: number
+ link: string
+ metadata?: Json | null
+ searchVector?: unknown
+ tags?: string[] | null
+ title: string
+ updatedAt?: string | null
+ }
+ Update: {
+ createdAt?: string
+ description?: string | null
+ entityId?: string
+ entityType?: string
+ id?: number
+ link?: string
+ metadata?: Json | null
+ searchVector?: unknown
+ tags?: string[] | null
+ title?: string
+ updatedAt?: string | null
+ }
+ Relationships: []
+ }
+ searchIndex_Nrc78GJXti5gro8G5m3k9u: {
+ Row: {
+ createdAt: string
+ description: string | null
+ entityId: string
+ entityType: string
+ id: number
+ link: string
+ metadata: Json | null
+ searchVector: unknown
+ tags: string[] | null
+ title: string
+ updatedAt: string | null
+ }
+ Insert: {
+ createdAt?: string
+ description?: string | null
+ entityId: string
+ entityType: string
+ id?: number
+ link: string
+ metadata?: Json | null
+ searchVector?: unknown
+ tags?: string[] | null
+ title: string
+ updatedAt?: string | null
+ }
+ Update: {
+ createdAt?: string
+ description?: string | null
+ entityId?: string
+ entityType?: string
+ id?: number
+ link?: string
+ metadata?: Json | null
+ searchVector?: unknown
+ tags?: string[] | null
+ title?: string
+ updatedAt?: string | null
+ }
+ Relationships: []
+ }
+ searchIndex_TzPMV5bvte7aRhGwLwmjs9: {
+ Row: {
+ createdAt: string
+ description: string | null
+ entityId: string
+ entityType: string
+ id: number
+ link: string
+ metadata: Json | null
+ searchVector: unknown
+ tags: string[] | null
+ title: string
+ updatedAt: string | null
+ }
+ Insert: {
+ createdAt?: string
+ description?: string | null
+ entityId: string
+ entityType: string
+ id?: number
+ link: string
+ metadata?: Json | null
+ searchVector?: unknown
+ tags?: string[] | null
+ title: string
+ updatedAt?: string | null
+ }
+ Update: {
+ createdAt?: string
+ description?: string | null
+ entityId?: string
+ entityType?: string
+ id?: number
+ link?: string
+ metadata?: Json | null
+ searchVector?: unknown
+ tags?: string[] | null
+ title?: string
+ updatedAt?: string | null
+ }
+ Relationships: []
+ }
searchIndexRegistry: {
Row: {
companyId: string
@@ -42729,6 +42916,7 @@ export type Database = {
}
jobMaterialWithMakeMethodId: {
Row: {
+ bomId: string | null
companyId: string | null
createdAt: string | null
createdBy: string | null
@@ -42755,7 +42943,6 @@ export type Database = {
requiresSerialTracking: boolean | null
scrapQuantity: number | null
shelfId: string | null
- shelfName: string | null
unitCost: number | null
unitOfMeasureCode: string | null
updatedAt: string | null
@@ -45361,14 +45548,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"]
@@ -46741,14 +46928,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -47967,6 +48154,7 @@ export type Database = {
}
quoteMaterialWithMakeMethodId: {
Row: {
+ bomId: string | null
companyId: string | null
createdAt: string | null
createdBy: string | null
@@ -49432,14 +49620,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["invoiceCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["invoiceCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -49975,14 +50163,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"]
@@ -53185,6 +53373,7 @@ export type Database = {
get_job_method: {
Args: { jid: string }
Returns: {
+ bomId: string
description: string
isRoot: boolean
itemId: string
@@ -53208,6 +53397,7 @@ export type Database = {
get_job_methods_by_method_id: {
Args: { mid: string }
Returns: {
+ bomId: string
description: string
isRoot: boolean
itemId: string
@@ -53505,6 +53695,7 @@ export type Database = {
get_method_tree: {
Args: { uid: string }
Returns: {
+ bomId: string
description: string
externalId: Json
isRoot: boolean
@@ -53842,6 +54033,7 @@ export type Database = {
get_quote_methods: {
Args: { qid: string }
Returns: {
+ bomId: string
description: string
externalId: Json
isRoot: boolean
@@ -53867,6 +54059,7 @@ export type Database = {
get_quote_methods_by_method_id: {
Args: { mid: string }
Returns: {
+ bomId: string
description: string
externalId: Json
isRoot: boolean
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index aff5043295..30e2023b66 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -2441,6 +2441,7 @@ export type Database = {
key: string
label: string
listOptions: string[] | null
+ materialFormFilterId: string | null
sortOrder: number
updatedAt: string | null
updatedBy: string | null
@@ -2456,6 +2457,7 @@ export type Database = {
key: string
label: string
listOptions?: string[] | null
+ materialFormFilterId?: string | null
sortOrder?: number
updatedAt?: string | null
updatedBy?: string | null
@@ -2471,6 +2473,7 @@ export type Database = {
key?: string
label?: string
listOptions?: string[] | null
+ materialFormFilterId?: string | null
sortOrder?: number
updatedAt?: string | null
updatedBy?: string | null
@@ -2581,6 +2584,13 @@ export type Database = {
referencedRelation: "tools"
referencedColumns: ["id"]
},
+ {
+ foreignKeyName: "configurationParameter_materialFormFilterId_fkey"
+ columns: ["materialFormFilterId"]
+ isOneToOne: false
+ referencedRelation: "materialForm"
+ referencedColumns: ["id"]
+ },
{
foreignKeyName: "configurationParameter_updatedBy_fkey"
columns: ["updatedBy"]
@@ -10270,6 +10280,7 @@ export type Database = {
}
jobMaterial: {
Row: {
+ bomId: string | null
companyId: string
createdAt: string
createdBy: string
@@ -10299,6 +10310,7 @@ export type Database = {
updatedBy: string | null
}
Insert: {
+ bomId?: string | null
companyId: string
createdAt?: string
createdBy: string
@@ -10328,6 +10340,7 @@ export type Database = {
updatedBy?: string | null
}
Update: {
+ bomId?: string | null
companyId?: string
createdAt?: string
createdBy?: string
@@ -15175,6 +15188,7 @@ export type Database = {
}
methodMaterial: {
Row: {
+ bomId: string | null
companyId: string
createdAt: string
createdBy: string
@@ -15198,6 +15212,7 @@ export type Database = {
updatedBy: string | null
}
Insert: {
+ bomId?: string | null
companyId: string
createdAt?: string
createdBy: string
@@ -15221,6 +15236,7 @@ export type Database = {
updatedBy?: string | null
}
Update: {
+ bomId?: string | null
companyId?: string
createdAt?: string
createdBy?: string
@@ -19891,21 +19907,21 @@ export type Database = {
opportunity: {
Row: {
companyId: string
- customerId: string | null
+ customerId: string
id: string
purchaseOrderDocumentPath: string | null
requestForQuoteDocumentPath: string | null
}
Insert: {
companyId: string
- customerId?: string | null
+ customerId: string
id?: string
purchaseOrderDocumentPath?: string | null
requestForQuoteDocumentPath?: string | null
}
Update: {
companyId?: string
- customerId?: string | null
+ customerId?: string
id?: string
purchaseOrderDocumentPath?: string | null
requestForQuoteDocumentPath?: string | null
@@ -26479,6 +26495,7 @@ export type Database = {
}
quoteMaterial: {
Row: {
+ bomId: string | null
companyId: string
createdAt: string
createdBy: string
@@ -26505,6 +26522,7 @@ export type Database = {
updatedBy: string | null
}
Insert: {
+ bomId?: string | null
companyId: string
createdAt?: string
createdBy: string
@@ -26531,6 +26549,7 @@ export type Database = {
updatedBy?: string | null
}
Update: {
+ bomId?: string | null
companyId?: string
createdAt?: string
createdBy?: string
@@ -31315,6 +31334,174 @@ export type Database = {
},
]
}
+ searchIndex_BJiGdDNuetJ1iyE8USN7AD: {
+ Row: {
+ createdAt: string
+ description: string | null
+ entityId: string
+ entityType: string
+ id: number
+ link: string
+ metadata: Json | null
+ searchVector: unknown
+ tags: string[] | null
+ title: string
+ updatedAt: string | null
+ }
+ Insert: {
+ createdAt?: string
+ description?: string | null
+ entityId: string
+ entityType: string
+ id?: number
+ link: string
+ metadata?: Json | null
+ searchVector?: unknown
+ tags?: string[] | null
+ title: string
+ updatedAt?: string | null
+ }
+ Update: {
+ createdAt?: string
+ description?: string | null
+ entityId?: string
+ entityType?: string
+ id?: number
+ link?: string
+ metadata?: Json | null
+ searchVector?: unknown
+ tags?: string[] | null
+ title?: string
+ updatedAt?: string | null
+ }
+ Relationships: []
+ }
+ searchIndex_L4saDKMCpFQurK9c3bEr1G: {
+ Row: {
+ createdAt: string
+ description: string | null
+ entityId: string
+ entityType: string
+ id: number
+ link: string
+ metadata: Json | null
+ searchVector: unknown
+ tags: string[] | null
+ title: string
+ updatedAt: string | null
+ }
+ Insert: {
+ createdAt?: string
+ description?: string | null
+ entityId: string
+ entityType: string
+ id?: number
+ link: string
+ metadata?: Json | null
+ searchVector?: unknown
+ tags?: string[] | null
+ title: string
+ updatedAt?: string | null
+ }
+ Update: {
+ createdAt?: string
+ description?: string | null
+ entityId?: string
+ entityType?: string
+ id?: number
+ link?: string
+ metadata?: Json | null
+ searchVector?: unknown
+ tags?: string[] | null
+ title?: string
+ updatedAt?: string | null
+ }
+ Relationships: []
+ }
+ searchIndex_Nrc78GJXti5gro8G5m3k9u: {
+ Row: {
+ createdAt: string
+ description: string | null
+ entityId: string
+ entityType: string
+ id: number
+ link: string
+ metadata: Json | null
+ searchVector: unknown
+ tags: string[] | null
+ title: string
+ updatedAt: string | null
+ }
+ Insert: {
+ createdAt?: string
+ description?: string | null
+ entityId: string
+ entityType: string
+ id?: number
+ link: string
+ metadata?: Json | null
+ searchVector?: unknown
+ tags?: string[] | null
+ title: string
+ updatedAt?: string | null
+ }
+ Update: {
+ createdAt?: string
+ description?: string | null
+ entityId?: string
+ entityType?: string
+ id?: number
+ link?: string
+ metadata?: Json | null
+ searchVector?: unknown
+ tags?: string[] | null
+ title?: string
+ updatedAt?: string | null
+ }
+ Relationships: []
+ }
+ searchIndex_TzPMV5bvte7aRhGwLwmjs9: {
+ Row: {
+ createdAt: string
+ description: string | null
+ entityId: string
+ entityType: string
+ id: number
+ link: string
+ metadata: Json | null
+ searchVector: unknown
+ tags: string[] | null
+ title: string
+ updatedAt: string | null
+ }
+ Insert: {
+ createdAt?: string
+ description?: string | null
+ entityId: string
+ entityType: string
+ id?: number
+ link: string
+ metadata?: Json | null
+ searchVector?: unknown
+ tags?: string[] | null
+ title: string
+ updatedAt?: string | null
+ }
+ Update: {
+ createdAt?: string
+ description?: string | null
+ entityId?: string
+ entityType?: string
+ id?: number
+ link?: string
+ metadata?: Json | null
+ searchVector?: unknown
+ tags?: string[] | null
+ title?: string
+ updatedAt?: string | null
+ }
+ Relationships: []
+ }
searchIndexRegistry: {
Row: {
companyId: string
@@ -42729,6 +42916,7 @@ export type Database = {
}
jobMaterialWithMakeMethodId: {
Row: {
+ bomId: string | null
companyId: string | null
createdAt: string | null
createdBy: string | null
@@ -42755,7 +42943,6 @@ export type Database = {
requiresSerialTracking: boolean | null
scrapQuantity: number | null
shelfId: string | null
- shelfName: string | null
unitCost: number | null
unitOfMeasureCode: string | null
updatedAt: string | null
@@ -45361,14 +45548,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"]
@@ -46741,14 +46928,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -47967,6 +48154,7 @@ export type Database = {
}
quoteMaterialWithMakeMethodId: {
Row: {
+ bomId: string | null
companyId: string | null
createdAt: string | null
createdBy: string | null
@@ -49432,14 +49620,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["invoiceCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["invoiceCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -49975,14 +50163,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"]
@@ -53185,6 +53373,7 @@ export type Database = {
get_job_method: {
Args: { jid: string }
Returns: {
+ bomId: string
description: string
isRoot: boolean
itemId: string
@@ -53208,6 +53397,7 @@ export type Database = {
get_job_methods_by_method_id: {
Args: { mid: string }
Returns: {
+ bomId: string
description: string
isRoot: boolean
itemId: string
@@ -53505,6 +53695,7 @@ export type Database = {
get_method_tree: {
Args: { uid: string }
Returns: {
+ bomId: string
description: string
externalId: Json
isRoot: boolean
@@ -53842,6 +54033,7 @@ export type Database = {
get_quote_methods: {
Args: { qid: string }
Returns: {
+ bomId: string
description: string
externalId: Json
isRoot: boolean
@@ -53867,6 +54059,7 @@ export type Database = {
get_quote_methods_by_method_id: {
Args: { mid: string }
Returns: {
+ bomId: string
description: string
externalId: Json
isRoot: boolean
diff --git a/packages/database/supabase/migrations/20260112235937_configuration-parameter-filter.sql b/packages/database/supabase/migrations/20260112235937_configuration-parameter-filter.sql
new file mode 100644
index 0000000000..e743a0456a
--- /dev/null
+++ b/packages/database/supabase/migrations/20260112235937_configuration-parameter-filter.sql
@@ -0,0 +1,7 @@
+-- Add materialFormFilterId column to configurationParameter table
+-- This allows filtering materials by form when the dataType is 'material'
+ALTER TABLE "configurationParameter"
+ADD COLUMN "materialFormFilterId" TEXT,
+ADD CONSTRAINT "configurationParameter_materialFormFilterId_fkey"
+ FOREIGN KEY ("materialFormFilterId") REFERENCES "materialForm"("id")
+ ON DELETE SET NULL ON UPDATE CASCADE;