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 filters to step records table

Brad Barbin8d728f5e4dd0
diff --git a/apps/erp/app/modules/production/production.service.ts b/apps/erp/app/modules/production/production.service.ts
index 4e666c9e91..26ee2dce75 100644
--- a/apps/erp/app/modules/production/production.service.ts
+++ b/apps/erp/app/modules/production/production.service.ts
@@ -941,12 +941,24 @@ export async function getJobOperationsByMethodId(
export async function getJobOperationStepRecords(
client: SupabaseClient<Database>,
jobId: string,
- args: GenericQueryFilters
+ args: GenericQueryFilters & {
+ search: string | null;
+ }
) {
let query = client.rpc("get_job_operation_step_records", {
p_job_id: jobId,
});
+ if (args.search) {
+ query = query.or(
+ `name.ilike.%${args.search}%,operationDescription.ilike.%${args.search}%`
+ );
+ }
+
+ query = setGenericQueryFilters(query, args, [
+ { column: "type", ascending: true },
+ ]);
+
return query;
}
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobOperationStepRecordsTable.tsx b/apps/erp/app/modules/production/ui/Jobs/JobOperationStepRecordsTable.tsx
index dfff846ed3..874c4e64aa 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobOperationStepRecordsTable.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobOperationStepRecordsTable.tsx
@@ -188,7 +188,12 @@ const JobOperationStepRecordsTable = memo(
type: "static",
options: procedureStepType.map((type) => ({
value: type,
- label: <ProcedureStepTypeIcon type={type} />,
+ label: (
+ <div className="flex items-center gap-2">
+ <ProcedureStepTypeIcon type={type} />
+ {type}
+ </div>
+ ),
})),
},
},
diff --git a/apps/erp/app/routes/x+/job+/$jobId.steps.tsx b/apps/erp/app/routes/x+/job+/$jobId.steps.tsx
index ab8a7689fd..f97c5dbdb5 100644
--- a/apps/erp/app/routes/x+/job+/$jobId.steps.tsx
+++ b/apps/erp/app/routes/x+/job+/$jobId.steps.tsx
@@ -23,6 +23,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const url = new URL(request.url);
const searchParams = new URLSearchParams(url.search);
+ const search = searchParams.get("search");
const { limit, offset, sorts, filters } =
getGenericQueryFilters(searchParams);
@@ -32,6 +33,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
offset,
sorts,
filters,
+ search,
});
if (stepRecords.error) {