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(quality): group the inspection plans table by part (#2068)

Brad Barbin8a83111cd25d
diff --git a/.claude/rules/inspection-system.md b/.claude/rules/inspection-system.md
index 763cf5a0ed..ebc8b79dd3 100644
--- a/.claude/rules/inspection-system.md
+++ b/.claude/rules/inspection-system.md
@@ -191,8 +191,15 @@ ON DELETE SET NULL) and no PDF; each feature names its PMI item
like a hand-made plan. `deleteUnusedPmiInspectionPlans` runs as the system
inside the item delete, so `parts_delete` alone can remove an unused PMI plan.
- Recreating the `inspectionDocuments` view also added the six `sampling*`
- columns added after it was first created (`d.*` is fixed at creation), so the
- plan list now reads the document's sampling default.
+ columns added after it was first created (`d.*` is fixed at creation), so
+ `getInspectionDocuments` (the `quality_getInspectionDocuments` tool) reads the
+ document's sampling default.
+- The Inspection Plans list (`/x/quality/inspection-plans`) is one row per part,
+ read from the `inspectionPlanParts` view (`getInspectionPlanParts`,
+ `20261028161842_inspection-plan-parts-view.sql`): the part, its plan count and
+ a `plans` jsonb rollup the expanded row lists, as the Change Notices list
+ lists a notice's affected items. A search expands every row and marks the
+ matches (`expandRowsFor` on the Table, `Highlight` / `searchMatches`).
- PMI ids are per-kind counters in file order, stable for one file. An extractor
change that reorders items would point an old plan's features at other items.
diff --git a/apps/erp/app/components/Highlight.tsx b/apps/erp/app/components/Highlight.tsx
new file mode 100644
index 0000000000..c9048c6750
--- /dev/null
+++ b/apps/erp/app/components/Highlight.tsx
@@ -0,0 +1,55 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
+// including ports, remain AGPLv3; serving them over a network requires releasing their source.
+
+import { Fragment } from "react";
+
+/**
+ * Where `search` occurs in `text`, ignoring case: the `[start, end)` ranges a
+ * list's ILIKE search (`searchFilter`) matched.
+ */
+export function searchMatches(
+ text: string | null | undefined,
+ search: string | null | undefined
+): [number, number][] {
+ const term = search?.trim();
+ if (!text || !term) return [];
+ const pattern = new RegExp(term.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "gi");
+ return Array.from(text.matchAll(pattern), (match) => [
+ match.index,
+ match.index + match[0].length
+ ]);
+}
+
+/** `text` with each of `ranges` (sorted, not overlapping) marked. */
+export function Highlight({
+ text,
+ ranges
+}: {
+ text: string | null | undefined;
+ ranges: [number, number][];
+}) {
+ if (!text) return null;
+ if (ranges.length === 0) return <>{text}</>;
+
+ const parts: JSX.Element[] = [];
+ let cursor = 0;
+ for (const [start, end] of ranges) {
+ if (start > cursor) {
+ parts.push(<Fragment key={cursor}>{text.slice(cursor, start)}</Fragment>);
+ }
+ parts.push(
+ <mark
+ key={start}
+ className="bg-yellow-200 dark:bg-yellow-900/50 text-inherit rounded-sm"
+ >
+ {text.slice(start, end)}
+ </mark>
+ );
+ cursor = end;
+ }
+ if (cursor < text.length) {
+ parts.push(<Fragment key={cursor}>{text.slice(cursor)}</Fragment>);
+ }
+ return <>{parts}</>;
+}
diff --git a/apps/erp/app/components/Table/Table.tsx b/apps/erp/app/components/Table/Table.tsx
index 1d067d0b7f..26911e452a 100644
--- a/apps/erp/app/components/Table/Table.tsx
+++ b/apps/erp/app/components/Table/Table.tsx
@@ -180,6 +180,9 @@ interface TableProps<T extends object> {
// A single-load list (no `infinite`) whose loader read `SINGLE_LOAD_LIMIT`
// rows: more may match, so the table says it shows only the first ones.
isTruncated?: boolean;
+ // Replaces the note under a truncated list, for one whose rows are not what
+ // its loader read (Receiving reads lines and shows orders).
+ rowLimitNote?: ReactNode;
// Optional per-row class (e.g. to highlight rows that failed validation).
getRowClassName?: (originalRow: T) => string | undefined;
rowSelection?: RowSelectionState;
@@ -200,6 +203,10 @@ interface TableProps<T extends object> {
// + toggle). Defaults to all rows. Use it so only parents with children get an
// affordance, like a tree's `hasChildren`.
canExpandRow?: (row: T) => boolean;
+ // While set, every expandable row starts expanded: a list's search, so the
+ // matches in the expanded rows show, or `true` for always. A row the user
+ // toggles keeps their choice until the value changes.
+ expandRowsFor?: string | true | null;
// Renders a full-width header row above each run of consecutive rows that
// share a key (e.g. a report grouped by date). Grouping follows `data`'s
// order, so the caller sorts by the key; `header` receives the run's rows.
@@ -359,6 +366,7 @@ const Table = <T extends object>({
infinite,
infiniteRows: controlledInfiniteRows,
isTruncated = false,
+ rowLimitNote,
getRowClassName,
rowSelection: controlledRowSelection,
onRowSelectionChange,
@@ -368,6 +376,7 @@ const Table = <T extends object>({
renderExpandedRow,
pinExpandedRows = false,
canExpandRow,
+ expandRowsFor,
groupRowsBy,
mobileLayout = "list",
mobileMenuItems
@@ -394,15 +403,30 @@ const Table = <T extends object>({
const { currentView, view } = useSavedViews();
- /* Expandable Rows (keyed by row id) */
+ /* Expandable Rows (keyed by row id): the rows the user toggled, over
+ `expandRowsFor` */
const [expandedRows, setExpandedRows] = useState<Record<string, boolean>>({});
+ const expandRowsByDefault = !!expandRowsFor;
+ const [expandedRowsFor, setExpandedRowsFor] = useState(expandRowsFor);
+ if (expandedRowsFor !== expandRowsFor) {
+ setExpandedRowsFor(expandRowsFor);
+ setExpandedRows({});
+ }
+
+ const isRowExpanded = useCallback(
+ (rowId: string) => expandedRows[rowId] ?? expandRowsByDefault,
+ [expandedRows, expandRowsByDefault]
+ );
- const toggleRowExpanded = useCallback((rowId: string) => {
- setExpandedRows((prev) => ({
- ...prev,
- [rowId]: !prev[rowId]
- }));
- }, []);
+ const toggleRowExpanded = useCallback(
+ (rowId: string) => {
+ setExpandedRows((prev) => ({
+ ...prev,
+ [rowId]: !(prev[rowId] ?? expandRowsByDefault)
+ }));
+ },
+ [expandRowsByDefault]
+ );
/* Rows: the loader's rows, then the pages loaded on scroll (`infinite`).
With `infiniteRows` the parent runs the hook, and this one stays off. */
@@ -541,7 +565,7 @@ const Table = <T extends object>({
if (renderExpandedRow) {
result.push(
...getExpandColumn<T>(
- expandedRows,
+ isRowExpanded,
toggleRowExpanded,
{
expand: t`Expand`,
@@ -566,7 +590,7 @@ const Table = <T extends object>({
withSelectableRows,
renderExpandedRow,
canExpandRow,
- expandedRows,
+ isRowExpanded,
toggleRowExpanded,
t
]);
@@ -1264,6 +1288,7 @@ const Table = <T extends object>({
withPagination={withPagination}
infinite={isInfinite ? infiniteRows : undefined}
isTruncated={isTruncated && !isInfinite}
+ rowLimitNote={rowLimitNote}
withSelectableRows={withSelectableRows}
headerActions={headerActions}
primaryAction={primaryAction}
@@ -1281,6 +1306,8 @@ const Table = <T extends object>({
allMatchingCount={allMatching?.count}
renderExpandedRow={renderExpandedRow}
canExpandRow={canExpandRow}
+ isRowExpanded={isRowExpanded}
+ toggleRowExpanded={toggleRowExpanded}
groupStarts={groupStarts}
groupHeader={groupRowsBy?.header}
totals={table
@@ -1597,7 +1624,7 @@ const Table = <T extends object>({
const rowExpandable =
!!renderExpandedRow &&
(!canExpandRow || canExpandRow(row.original));
- const isRowExpanded = rowExpandable && !!expandedRows[row.id];
+ const rowIsExpanded = rowExpandable && isRowExpanded(row.id);
const handleRowClick = rowExpandable
? () => toggleRowExpanded(row.id)
: undefined;
@@ -1686,7 +1713,7 @@ const Table = <T extends object>({
</Tr>
)}
{rowContent}
- {isRowExpanded && (
+ {rowIsExpanded && (
<Tr>
<Td
colSpan={visibleColumns.length}
@@ -1716,7 +1743,9 @@ const Table = <T extends object>({
<tbody>
<tr>
<td colSpan={visibleColumns.length} className="p-0">
- <RowLimitNote className="sticky left-0 w-fit px-4 py-3" />
+ <RowLimitNote className="sticky left-0 w-fit px-4 py-3">
+ {rowLimitNote}
+ </RowLimitNote>
</td>
</tr>
</tbody>
diff --git a/apps/erp/app/components/Table/components/Compact/CompactList.tsx b/apps/erp/app/components/Table/components/Compact/CompactList.tsx
index 9206effe5c..d500b4dfd3 100644
--- a/apps/erp/app/components/Table/components/Compact/CompactList.tsx
+++ b/apps/erp/app/components/Table/components/Compact/CompactList.tsx
@@ -78,6 +78,7 @@ export type CompactListProps<T> = {
infinite?: InfiniteRows<T>;
/** A single-load list that read `SINGLE_LOAD_LIMIT` rows (`<Table isTruncated>`). */
isTruncated?: boolean;
+ rowLimitNote?: ReactNode;
withSelectableRows: boolean;
headerActions?: ReactNode;
primaryAction?: ReactNode;
@@ -98,6 +99,9 @@ export type CompactListProps<T> = {
allMatchingCount?: number;
renderExpandedRow?: (row: T) => ReactNode;
canExpandRow?: (row: T) => boolean;
+ /** The Table's expansion state, shared with the grid (`expandRowsFor`). */
+ isRowExpanded: (rowId: string) => boolean;
+ toggleRowExpanded: (rowId: string) => void;
groupStarts: Map<string, T[]>;
groupHeader?: (rows: T[]) => ReactNode;
totals: {
@@ -126,6 +130,7 @@ export function CompactList<T>({
withPagination,
infinite,
isTruncated = false,
+ rowLimitNote,
withSelectableRows,
headerActions,
primaryAction,
@@ -143,6 +148,8 @@ export function CompactList<T>({
allMatchingCount,
renderExpandedRow,
canExpandRow,
+ isRowExpanded,
+ toggleRowExpanded,
groupStarts,
groupHeader,
totals,
@@ -198,9 +205,6 @@ export function CompactList<T>({
);
useSetAppBarOverride(override);
- /* Expandable rows */
- const [expanded, setExpanded] = useState<Record<string, boolean>>({});
-
/* Row virtualization on the list's scroll element (`<main>` on a page) */
const entries = useMemo(() => {
const list: ListEntry<T>[] = [];
@@ -362,7 +366,7 @@ export function CompactList<T>({
const { row } = entry;
const rowExpandable =
!!renderExpandedRow && (!canExpandRow || canExpandRow(row.original));
- const isExpanded = rowExpandable && !!expanded[row.id];
+ const isExpanded = rowExpandable && isRowExpanded(row.id);
const content = (
<CompactRow
row={row}
@@ -379,11 +383,7 @@ export function CompactList<T>({
rowExpandable
? {
expanded: isExpanded,
- onToggle: () =>
- setExpanded((prev) => ({
- ...prev,
- [row.id]: !prev[row.id]
- }))
+ onToggle: () => toggleRowExpanded(row.id)
}
: undefined
}
@@ -441,7 +441,9 @@ export function CompactList<T>({
</div>
<div ref={sentinelRef} aria-hidden />
{isTruncated ? (
- <RowLimitNote className="px-4 py-4 text-center text-xs" />
+ <RowLimitNote className="px-4 py-4 text-center text-xs">
+ {rowLimitNote}
+ </RowLimitNote>
) : null}
{withPagination || infinite ? (
diff --git a/apps/erp/app/components/Table/components/RowLimitNote.tsx b/apps/erp/app/components/Table/components/RowLimitNote.tsx
index e699719d99..e5a962c2b3 100644
--- a/apps/erp/app/components/Table/components/RowLimitNote.tsx
+++ b/apps/erp/app/components/Table/components/RowLimitNote.tsx
@@ -5,6 +5,7 @@
import { cn } from "@carbon/react";
import { Trans } from "@lingui/react/macro";
import { useNumberFormatter } from "@react-aria/i18n";
+import type { ReactNode } from "react";
import { SINGLE_LOAD_LIMIT } from "~/utils/pagination";
/**
@@ -12,13 +13,22 @@ import { SINGLE_LOAD_LIMIT } from "~/utils/pagination";
* (`<Table isTruncated>`): more rows may match, and only search or a filter
* reaches them.
*/
-export function RowLimitNote({ className }: { className?: string }) {
+export function RowLimitNote({
+ className,
+ children
+}: {
+ className?: string;
+ /** Replaces the default copy, for a list whose rows are not what it read. */
+ children?: ReactNode;
+}) {
const limit = useNumberFormatter().format(SINGLE_LOAD_LIMIT);
return (
<p className={cn("text-sm text-muted-foreground", className)}>
- <Trans>
- Showing the first {limit} rows. Search or filter to see the rest.
- </Trans>
+ {children ?? (
+ <Trans>
+ Showing the first {limit} rows. Search or filter to see the rest.
+ </Trans>
+ )}
</p>
);
}
diff --git a/apps/erp/app/components/Table/components/SyntheticColumns.tsx b/apps/erp/app/components/Table/components/SyntheticColumns.tsx
index 03d55f99ff..30b46f44fc 100644
--- a/apps/erp/app/components/Table/components/SyntheticColumns.tsx
+++ b/apps/erp/app/components/Table/components/SyntheticColumns.tsx
@@ -92,7 +92,7 @@ export function getActionColumn<T>(
}
export function getExpandColumn<T>(
- expandedRows: Record<string, boolean>,
+ isRowExpanded: (rowId: string) => boolean,
toggleRowExpanded: (rowId: string) => void,
labels: { expand: string; expandRow: string; collapseRow: string },
canExpandRow?: (row: T) => boolean
@@ -106,7 +106,7 @@ export function getExpandColumn<T>(
cell: ({ row }) => {
// No chevron for rows that have nothing to reveal (tree `hasChildren`).
if (canExpandRow && !canExpandRow(row.original)) return null;
- const isExpanded = expandedRows[row.id] ?? false;
+ const isExpanded = isRowExpanded(row.id);
return (
<button
type="button"
diff --git a/apps/erp/app/components/index.ts b/apps/erp/app/components/index.ts
index cc24d38e37..d58ce80522 100644
--- a/apps/erp/app/components/index.ts
+++ b/apps/erp/app/components/index.ts
@@ -23,6 +23,7 @@ import { Enumerable } from "./Enumerable";
import { EnumerableGroup } from "./EnumerableGroup";
import { ExchangeRateUpdatedAt } from "./ExchangeRateUpdatedAt";
import FileDropzone from "./FileDropzone";
+import { Highlight, searchMatches } from "./Highlight";
import Hyperlink from "./Hyperlink";
import {
MethodBadge,
@@ -83,6 +84,7 @@ export {
ExchangeRateUpdatedAt,
exportOnlyColumn,
FileDropzone,
+ Highlight,
Hyperlink,
ItemLifecycleBadge,
ItemThumbnail,
@@ -111,6 +113,7 @@ export {
SourcingTypeIcon,
SupplierAvatar,
SupplierAvatarGroup,
+ searchMatches,
Table,
TimeTypeIcon,
TrackingTypeIcon,
diff --git a/apps/erp/app/modules/inventory/AGENTS.md b/apps/erp/app/modules/inventory/AGENTS.md
index d52f5b1335..02a68b7372 100644
--- a/apps/erp/app/modules/inventory/AGENTS.md
+++ b/apps/erp/app/modules/inventory/AGENTS.md
@@ -106,7 +106,7 @@ A blocking rule is data, not an error: `post`, `create`, `setStatus` and `adjust
- `getStorageUnit(s)` / `getStorageUnitTree` / `getStorageUnitsTreeForLocation` — storage hierarchy
- `getAvailableTrackedEntities` — calls `get_available_tracked_entities` RPC
- `getReceipts` / `getReceiptLines` / `reconcileReceiptSerialEntities` — receipt management. `reconcileReceiptSerialEntities` (Kysely, its own transaction; `reconcileReceiptSerialsInTransaction` inside a caller's) drops serials beyond the received quantity (run on post, and in the same transaction as a quantity change in `updateReceiptLines`) and returns the lines still missing serials, which the post refuses
-- `getPurchaseOrderLinesToReceive` / `getOpenPurchaseOrdersForItems` / `getDraftReceiptsForPurchaseOrders` — Inventory → Receiving (`x+/inventory+/receiving.tsx`, `ui/Receiving/ReceivingTable.tsx`): find the purchase order a delivery belongs to by anything on the packing slip. Every search word must occur in `searchText` (`receivingSearchTerms`, `inventory.utils.ts`, normalizes the same way; `receivingSearchMatches` highlights what matched). Rows group by order, oldest first, so the list's sort is fixed. Receive posts to `createReceipt` (`receipt+/new.tsx`) like the PO header; an order with a Draft receipt offers that receipt instead. The route needs `view` on inventory AND purchasing: the view's rows are RLS-gated by `purchasing_view`
+- `getPurchaseOrderLinesToReceive` / `getOpenPurchaseOrdersForItems` / `getDraftReceiptsForPurchaseOrders` — Inventory → Receiving (`x+/inventory+/receiving.tsx`, `ui/Receiving/ReceivingTable.tsx`): find the purchase order a delivery belongs to by anything on the packing slip. Every search word must occur in `searchText` (`receivingSearchTerms`, `inventory.utils.ts`, normalizes the same way; `receivingSearchMatches` highlights what matched). The table is one row per order, oldest first, with its lines in the expanded row, which is always open (`expandRowsFor`), so the list's sort is fixed and the CSV is one row per order (its lines in a `Lines` column). The loader reads up to `SINGLE_LOAD_LIMIT` lines at once (a page of lines could cut an order in two); at the limit it leaves out the last order, which may be missing lines, and the table says only the oldest orders are shown (`rowLimitNote`). Receive posts to `createReceipt` (`receipt+/new.tsx`) like the PO header; an order with a Draft receipt offers that receipt instead. The route needs `view` on inventory AND purchasing: the view's rows are RLS-gated by `purchasing_view`
- `releaseReceiptSerialEntities` (`@carbon/database/receipt-serials`, shared with the receipt line split, `receiptLineSplit` in `shared.service.ts`) — the one way a receipt serial is removed, run inside a Kysely transaction: an entity with no `itemLedger` history is deleted, one with history only loses its receipt link in one set-based update. A serial box save is planned by the pure `planSerialBoxWrite` (`inventory.models.ts`)
- `getShipments` / `getShipmentLines` / `getShipmentRelatedItems` — shipment management
- `getRentalShipmentLines` / `getRentalReceiptLines` — a rental document's asset lines with their rental line, fleet asset, item and tracked entity; the `$shipmentId.tsx` / `$receiptId.tsx` loaders call them for the `'Rental Agreement'` source and pass them as `rentalLines` (sorted by asset id, else unit name) to `ShipmentRentalLineItem` / `ReceiptRentalLineItem`. Both readers order by `createdAt, id`: a document's units are inserted in one statement and share a `createdAt`
diff --git a/apps/erp/app/modules/inventory/inventory.service.ts b/apps/erp/app/modules/inventory/inventory.service.ts
index 9721633719..19c8328447 100644
--- a/apps/erp/app/modules/inventory/inventory.service.ts
+++ b/apps/erp/app/modules/inventory/inventory.service.ts
@@ -3457,6 +3457,7 @@ export async function getPickingListLines(
client: SupabaseClient<Database>,
pickingListId: string
) {
+ // The MES picking screen reads the same order: line numbers are positions.
return client
.from("pickingListLine")
.select(
@@ -3464,7 +3465,9 @@ export async function getPickingListLines(
)
.eq("pickingListId", pickingListId)
.order("jobOperationId")
- .order("itemId");
+ .order("storageUnitId")
+ .order("itemId")
+ .order("id");
}
/**
diff --git a/apps/erp/app/modules/inventory/ui/PickingLists/PickingListLines.tsx b/apps/erp/app/modules/inventory/ui/PickingLists/PickingListLines.tsx
index 2418013f44..ce3072af86 100644
--- a/apps/erp/app/modules/inventory/ui/PickingLists/PickingListLines.tsx
+++ b/apps/erp/app/modules/inventory/ui/PickingLists/PickingListLines.tsx
@@ -149,6 +149,16 @@ const PickingListLines = ({
});
}, [pickingListLines]);
+ // Numbered down the list in display order, across kits, so a line number
+ // names one line of the whole list. The MES numbers it the same way.
+ const lineNumbers = useMemo(
+ () =>
+ new Map(
+ kits.flatMap((kit) => kit.lines).map((line, i) => [line.id, i + 1])
+ ),
+ [kits]
+ );
+
if (kits.length === 0) {
return (
<Card>
@@ -172,6 +182,7 @@ const PickingListLines = ({
<PickingKitCard
key={kit.key}
kit={kit}
+ lineNumbers={lineNumbers}
pickingListId={pickingListId}
isLocked={isLocked}
recommendations={recommendations}
@@ -183,11 +194,13 @@ const PickingListLines = ({
function PickingKitCard({
kit,
+ lineNumbers,
pickingListId,
isLocked,
recommendations
}: {
kit: Kit;
+ lineNumbers: Map<string, number>;
pickingListId: string;
isLocked: boolean;
recommendations: RecommendationsPromise;
@@ -226,6 +239,7 @@ function PickingKitCard({
<Card key={line.id} className="bg-card">
<PickingListLineItem
line={line}
+ lineNumber={lineNumbers.get(line.id)}
pickingListId={pickingListId}
isLast
isLocked={isLocked}
@@ -259,6 +273,7 @@ function PickingKitCard({
<PickingListLineItem
key={line.id}
line={line}
+ lineNumber={lineNumbers.get(line.id)}
pickingListId={pickingListId}
isLast={index === kit.lines.length - 1}
isLocked={isLocked}
@@ -278,12 +293,14 @@ const phoneActionCells: ActionPresentation = {
function PickingListLineItem({
line,
+ lineNumber,
pickingListId,
isLast,
isLocked,
recommendations
}: {
line: PickingListLineData[number];
+ lineNumber?: number;
pickingListId: string;
isLast: boolean;
isLocked: boolean;
@@ -528,6 +545,9 @@ function PickingListLineItem({
isResolved && "opacity-50 group-hover:opacity-100"
)}
>
+ <span className="w-6 shrink-0 text-right text-sm tabular-nums text-muted-foreground">
+ {lineNumber}
+ </span>
<ItemThumbnail
size="xl"
thumbnailPath={null}
diff --git a/apps/erp/app/modules/inventory/ui/Receiving/ReceivingTable.tsx b/apps/erp/app/modules/inventory/ui/Receiving/ReceivingTable.tsx
index a2926298c9..e59def50e9 100644
--- a/apps/erp/app/modules/inventory/ui/Receiving/ReceivingTable.tsx
+++ b/apps/erp/app/modules/inventory/ui/Receiving/ReceivingTable.tsx
@@ -3,10 +3,10 @@
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
import { getPurchaseOrderDisplayId } from "@carbon/documents/utils";
-import { Button, Copy, HStack, VStack } from "@carbon/react";
+import { Button, HStack } from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import type { ColumnDef } from "@tanstack/react-table";
-import { Fragment, memo, useMemo } from "react";
+import { Fragment, memo, useCallback, useMemo } from "react";
import {
LuBookMarked,
LuCalendar,
@@ -14,12 +14,13 @@ import {
LuHandCoins,
LuHash,
LuMapPin,
- LuText
+ LuTruck
} from "react-icons/lu";
import { Link, useNavigation } from "react-router";
import {
DateTime,
exportOnlyColumn,
+ Highlight as HighlightRanges,
Hyperlink,
ItemThumbnail,
RevisionSuffix,
@@ -44,44 +45,72 @@ import { path } from "~/utils/path";
type ReceivingTableProps = {
rows: ReceivingRow[];
- count: number;
+ /** The loader read its line limit: more orders may match. */
+ isTruncated: boolean;
draftReceiptByOrder: Record<string, ReceivingDraftReceipt>;
};
+/** One row of the table: an order, with its lines to receive. */
+type ReceivingOrderRow = {
+ id: string;
+ purchaseOrderReadableId: string | null;
+ revisionId: number | null;
+ supplierId: string | null;
+ supplierName: string | null;
+ orderDate: string | null;
+ supplierReference: string | null;
+ trackingNumber: string | null;
+ /** The first line's, for the Location filter; the cell lists every line's. */
+ locationId: string | null;
+ locationIds: string[];
+ lines: ReceivingRow[];
+};
+
+/** The lines grouped by order, in the loader's order (oldest order first). */
+function toOrderRows(rows: ReceivingRow[]): ReceivingOrderRow[] {
+ const orders = new Map<string, ReceivingOrderRow>();
+ for (const line of rows) {
+ const order = orders.get(line.purchaseOrderId);
+ if (order) {
+ order.lines.push(line);
+ if (line.locationId && !order.locationIds.includes(line.locationId)) {
+ order.locationIds.push(line.locationId);
+ }
+ continue;
+ }
+ orders.set(line.purchaseOrderId, {
+ id: line.purchaseOrderId,
+ purchaseOrderReadableId: line.purchaseOrderReadableId,
+ revisionId: line.revisionId,
+ supplierId: line.supplierId,
+ supplierName: line.supplierName,
+ orderDate: line.orderDate,
+ supplierReference: line.supplierReference,
+ trackingNumber: line.trackingNumber,
+ locationId: line.locationId,
+ locationIds: line.locationId ? [line.locationId] : [],
+ lines: [line]
+ });
+ }
+ return [...orders.values()];
+}
+
/** "PO000036-1": the order's readable id with its revision. */
-function readableOrderId(row: ReceivingRow) {
+function readableOrderId(order: ReceivingOrderRow) {
return getPurchaseOrderDisplayId({
- purchaseOrderId: row.purchaseOrderReadableId,
- revisionId: row.revisionId
+ purchaseOrderId: order.purchaseOrderReadableId,
+ revisionId: order.revisionId
});
}
/** `text` with every part a search word matched marked. */
function Highlight({ text, terms }: { text: string | null; terms: string[] }) {
- if (!text) return null;
- const ranges = receivingSearchMatches(text, terms);
- if (ranges.length === 0) return <>{text}</>;
-
- const parts: JSX.Element[] = [];
- let cursor = 0;
- for (const [start, end] of ranges) {
- if (start > cursor) {
- parts.push(<Fragment key={cursor}>{text.slice(cursor, start)}</Fragment>);
- }
- parts.push(
- <mark
- key={start}
- className="bg-yellow-200 dark:bg-yellow-900/50 text-inherit rounded-sm"
- >
- {text.slice(start, end)}
- </mark>
- );
- cursor = end;
- }
- if (cursor < text.length) {
- parts.push(<Fragment key={cursor}>{text.slice(cursor)}</Fragment>);
- }
- return <>{parts}</>;
+ return (
+ <HighlightRanges
+ text={text}
+ ranges={text ? receivingSearchMatches(text, terms) : []}
+ />
+ );
}
/** "Also open on PO000037, PO000040", each order linked. The links are one
@@ -102,8 +131,9 @@ function AlsoOpenOn({ orders }: { orders: ReceivingOrder[] }) {
return <Trans>Also open on {links}</Trans>;
}
+/** One row per order, its lines in the expanded row, which is always open. */
const ReceivingTable = memo(
- ({ rows, count, draftReceiptByOrder }: ReceivingTableProps) => {
+ ({ rows, isTruncated, draftReceiptByOrder }: ReceivingTableProps) => {
const { t } = useLingui();
const [params] = useUrlParams();
const formatQuantity = useQuantityFormatter();
@@ -113,155 +143,86 @@ const ReceivingTable = memo(
const search = params.get("search");
const terms = useMemo(() => receivingSearchTerms(search), [search]);
- const groupRowsBy = useMemo(
- () => ({
- key: (row: ReceivingRow) => row.purchaseOrderId,
- header: (group: ReceivingRow[]) => (
- <ReceivingOrderHeader
- row={group[0]!}
- terms={terms}
- draftReceipt={draftReceiptByOrder[group[0]!.purchaseOrderId]}
- />
- )
- }),
- [terms, draftReceiptByOrder]
- );
+ const orders = useMemo(() => toOrderRows(rows), [rows]);
- const columns = useMemo<ColumnDef<ReceivingRow>[]>(
+ const columns = useMemo<ColumnDef<ReceivingOrderRow>[]>(
() => [
{
- accessorKey: "itemReadableId",
- header: t`Part`,
+ accessorKey: "purchaseOrderReadableId",
+ header: t`Purchase Order`,
cell: ({ row }) => (
- <HStack className="min-w-0">
- <ItemThumbnail
- size="sm"
- thumbnailPath={row.original.thumbnailPath}
- type={(row.original.itemType as ItemType | null) ?? undefined}
- />
- <Hyperlink
- to={path.to.purchaseOrderLine(
- row.original.purchaseOrderId,
- row.original.id
- )}
- >
- <span className="whitespace-nowrap">
- <Highlight text={row.original.itemReadableId} terms={terms} />
+ <Hyperlink to={path.to.purchaseOrderDetails(row.original.id)}>
+ <div className="flex flex-col gap-0">
+ <span className="text-sm font-medium">
+ <Highlight
+ text={row.original.purchaseOrderReadableId}
+ terms={terms}
+ />
+ <RevisionSuffix revisionId={row.original.revisionId} />
</span>
- </Hyperlink>
- </HStack>
- ),
- meta: {
- mobile: "P1",
- icon: <LuBookMarked />
- }
- },
- {
- id: "name",
- header: t`Name`,
- cell: ({ row }) => {
- const name = row.original.itemName ?? row.original.description;
- const { alsoOpenOn } = row.original;
- return (
- <VStack spacing={0} className="min-w-0 max-w-[360px]">
- <span className="truncate w-full">
- <Highlight text={name} terms={terms} />
+ <span className="text-xs text-muted-foreground">
+ <Highlight text={row.original.supplierName} terms={terms} />
</span>
- {row.original.description &&
- row.original.description !== name && (
- <span className="text-xs text-muted-foreground truncate w-full">
- <Highlight
- text={row.original.description}
- terms={terms}
- />
- </span>
- )}
- {alsoOpenOn.length > 0 && (
- <span className="text-xs text-muted-foreground truncate w-full">
- <AlsoOpenOn orders={alsoOpenOn} />
- </span>
- )}
- </VStack>
- );
- },
- meta: {
- mobile: "P2",
- icon: <LuText />,
- exportValue: (row) => row.itemName ?? row.description
- }
- },
- {
- accessorKey: "supplierPartId",
- header: t`Supplier Part`,
- cell: ({ row }) => (
- <span className="whitespace-nowrap">
- <Highlight text={row.original.supplierPartId} terms={terms} />
- </span>
+ </div>
+ </Hyperlink>
),
meta: {
- icon: <LuHash />
+ mobile: "P1",
+ icon: <LuBookMarked />,
+ exportValue: (row) => readableOrderId(row)
}
},
{
- accessorKey: "purchaseQuantity",
+ accessorKey: "orderDate",
header: t`Ordered`,
- cell: ({ row }) =>
- row.original.purchaseQuantity === null ? null : (
- <span className="whitespace-nowrap tabular-nums">
- {formatQuantity(row.original.purchaseQuantity)}{" "}
- <span className="text-muted-foreground">
- {row.original.purchaseUnitOfMeasureCode}
- </span>
- </span>
- ),
- meta: {
- icon: <LuHash />
- }
- },
- {
- accessorKey: "quantityReceived",
- header: t`Received`,
cell: ({ row }) => (
- <span className="tabular-nums">
- {formatQuantity(row.original.quantityReceived ?? 0)}
- </span>
+ <DateTime value={row.original.orderDate} variant="date" />
),
meta: {
- icon: <LuHash />
+ mobile: "P2",
+ icon: <LuCalendar />
}
},
{
- accessorKey: "quantityToReceive",
- header: t`To Receive`,
+ accessorKey: "supplierReference",
+ header: t`Supplier Reference`,
cell: ({ row }) => (
- <span className="tabular-nums font-medium">
- {formatQuantity(row.original.quantityToReceive ?? 0)}
+ <span className="whitespace-nowrap">
+ <Highlight text={row.original.supplierReference} terms={terms} />
</span>
),
meta: {
- mobile: "P3",
icon: <LuHash />
}
},
{
- accessorKey: "promisedDate",
- header: t`Promised`,
+ accessorKey: "trackingNumber",
+ header: t`Tracking`,
cell: ({ row }) => (
- <DateTime value={row.original.promisedDate} variant="date" />
+ <span className="whitespace-nowrap">
+ <Highlight text={row.original.trackingNumber} terms={terms} />
+ </span>
),
meta: {
- icon: <LuCalendar />
+ icon: <LuTruck />
}
},
{
accessorKey: "locationId",
header: t`Location`,
- cell: ({ row }) => {
- const location = locations.find(
- (option) => option.value === row.original.locationId
- );
- return location ? <Enumerable value={location.label} /> : null;
- },
+ cell: ({ row }) => (
+ <HStack spacing={1}>
+ {row.original.locationIds.map((locationId) => (
+ <Enumerable
+ key={locationId}
+ value={
+ locations.find((option) => option.value === locationId)
+ ?.label ?? null
+ }
+ />
+ ))}
+ </HStack>
+ ),
meta: {
icon: <LuMapPin />,
filter: {
@@ -272,8 +233,13 @@ const ReceivingTable = memo(
}))
},
exportValue: (row) =>
- locations.find((option) => option.value === row.locationId)
- ?.label ?? row.locationId
+ row.locationIds
+ .map(
+ (locationId) =>
+ locations.find((option) => option.value === locationId)
+ ?.label ?? locationId
+ )
+ .join(", ")
}
},
{
@@ -292,35 +258,137 @@ const ReceivingTable = memo(
exportValue: (row) => row.supplierName
}
},
- // The order each line is grouped under — the band above the rows,
- // which the CSV has no other way to carry.
- exportOnlyColumn<ReceivingRow>({
- id: "purchaseOrderReadableId",
- header: t`Purchase Order`,
- value: (row) => readableOrderId(row)
- }),
- exportOnlyColumn<ReceivingRow>({
- id: "supplierReference",
- header: t`Supplier Reference`,
- value: (row) => row.supplierReference
+ {
+ id: "receive",
+ header: () => <span className="sr-only">{t`Receipt`}</span>,
+ cell: ({ row }) => (
+ <ReceiveButton
+ purchaseOrderId={row.original.id}
+ draftReceipt={draftReceiptByOrder[row.original.id]}
+ />
+ ),
+ enableSorting: false,
+ meta: {
+ mobile: "P3",
+ filterHeader: t`Receipt`
+ }
+ },
+ // The lines are the expanded row, which the CSV cannot carry.
+ exportOnlyColumn<ReceivingOrderRow>({
+ id: "lines",
+ header: t`Lines`,
+ value: (row) =>
+ row.lines
+ .map((line) =>
+ `${line.itemReadableId ?? line.description ?? ""} × ${formatQuantity(
+ line.quantityToReceive ?? 0
+ )} ${line.purchaseUnitOfMeasureCode ?? ""}`.trim()
+ )
+ .join("; ")
})
],
- [t, terms, formatQuantity, locations, suppliers]
+ [t, terms, formatQuantity, locations, suppliers, draftReceiptByOrder]
+ );
+
+ const renderExpandedRow = useCallback(
+ (order: ReceivingOrderRow) => (
+ <div className="pl-[52px] pr-4">
+ {order.lines.map((line) => {
+ const name = line.itemName ?? line.description;
+ return (
+ <div key={line.id} className="flex gap-3 py-2 text-sm">
+ <div
+ aria-hidden
+ className="w-5 shrink-0 border-l border-border -my-2"
+ />
+ <div className="flex min-w-0 flex-1 items-center gap-3">
+ <ItemThumbnail
+ size="sm"
+ thumbnailPath={line.thumbnailPath}
+ type={(line.itemType as ItemType | null) ?? undefined}
+ />
+ <div className="flex min-w-0 flex-col gap-0">
+ <HStack spacing={2} className="min-w-0">
+ <Hyperlink
+ to={path.to.purchaseOrderLine(
+ line.purchaseOrderId,
+ line.id
+ )}
+ >
+ <span className="whitespace-nowrap font-medium">
+ <Highlight text={line.itemReadableId} terms={terms} />
+ </span>
+ </Hyperlink>
+ {line.supplierPartId && (
+ <span className="whitespace-nowrap text-xs text-muted-foreground">
+ <Highlight text={line.supplierPartId} terms={terms} />
+ </span>
+ )}
+ </HStack>
+ <span className="truncate text-xs text-muted-foreground">
+ <Highlight text={name} terms={terms} />
+ {line.description && line.description !== name && (
+ <>
+ {" · "}
+ <Highlight text={line.description} terms={terms} />
+ </>
+ )}
+ </span>
+ {line.alsoOpenOn.length > 0 && (
+ <span className="truncate text-xs text-muted-foreground">
+ <AlsoOpenOn orders={line.alsoOpenOn} />
+ </span>
+ )}
+ </div>
+ </div>
+ <div className="flex shrink-0 items-center gap-6 tabular-nums">
+ {line.purchaseQuantity !== null && (
+ <span className="whitespace-nowrap text-muted-foreground">
+ <Trans>Ordered</Trans>{" "}
+ {formatQuantity(line.purchaseQuantity)}{" "}
+ {line.purchaseUnitOfMeasureCode}
+ </span>
+ )}
+ <span className="whitespace-nowrap">
+ <span className="text-muted-foreground">
+ <Trans>To Receive</Trans>
+ </span>{" "}
+ <span className="font-medium">
+ {formatQuantity(line.quantityToReceive ?? 0)}
+ </span>
+ </span>
+ <span className="w-24 text-right text-muted-foreground">
+ <DateTime value={line.promisedDate} variant="date" />
+ </span>
+ </div>
+ </div>
+ );
+ })}
+ </div>
+ ),
+ [terms, formatQuantity]
);
return (
- <Table<ReceivingRow>
- data={rows}
+ <Table<ReceivingOrderRow>
+ data={orders}
columns={columns}
- count={count}
+ count={orders.length}
title={t`Receiving`}
getRowId={(row) => row.id}
- defaultColumnPinning={{ left: ["itemReadableId"] }}
+ defaultColumnPinning={{ right: ["receive"] }}
defaultColumnVisibility={{
- quantityReceived: false,
supplierId: false
}}
- groupRowsBy={groupRowsBy}
+ renderExpandedRow={renderExpandedRow}
+ pinExpandedRows
+ expandRowsFor={search || true}
+ isTruncated={isTruncated}
+ rowLimitNote={
+ <Trans>
+ Showing the oldest orders only. Search or filter to see the rest.
+ </Trans>
+ }
withSimpleSorting={false}
sort={null}
// The search is the page: keep the toolbar when nothing matches.
@@ -346,99 +414,51 @@ ReceivingTable.displayName = "ReceivingTable";
export default ReceivingTable;
-/** The band above each order's lines: who it is from, and how to receive it. */
-function ReceivingOrderHeader({
- row,
- terms,
+/** Receive the order, or open the Draft receipt already started for it. */
+function ReceiveButton({
+ purchaseOrderId,
draftReceipt
}: {
- row: ReceivingRow;
- terms: string[];
- /** A Draft receipt already started for the order: opened, not doubled. */
+ purchaseOrderId: string;
draftReceipt: ReceivingDraftReceipt | undefined;
}) {
- const { t } = useLingui();
const permissions = usePermissions();
const navigation = useNavigation();
const { receive } = usePurchaseOrder();
- const purchaseOrderId = row.purchaseOrderId;
- const displayId = readableOrderId(row);
const isReceiving =
navigation.state !== "idle" &&
navigation.formAction === path.to.newReceipt &&
navigation.formData?.get("sourceDocumentId") === purchaseOrderId;
- // The order on the left, its receipt on the right.
- return (
- <div className="flex items-center justify-between gap-3 px-4 py-2">
- <div className="flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1">
- <HStack spacing={1} className="shrink-0">
- <Link
- to={path.to.purchaseOrderDetails(purchaseOrderId)}
- className="whitespace-nowrap text-sm font-medium hover:underline"
- >
- <Highlight text={row.purchaseOrderReadableId} terms={terms} />
- <RevisionSuffix revisionId={row.revisionId} />
- </Link>
- <Copy text={displayId} label={t`Copy purchase order number`} />
- </HStack>
- <span className="min-w-0 truncate text-sm">
- <Highlight text={row.supplierName} terms={terms} />
- </span>
- <span className="flex min-w-0 flex-wrap items-center gap-x-3 text-xs text-muted-foreground">
- {row.orderDate && (
- <span className="whitespace-nowrap">
- <Trans>Ordered</Trans>{" "}
- <DateTime value={row.orderDate} variant="date" />
- </span>
- )}
- {row.supplierReference && (
- <span className="whitespace-nowrap">
- <Trans>Reference</Trans>{" "}
- <span className="text-foreground">
- <Highlight text={row.supplierReference} terms={terms} />
- </span>
- </span>
- )}
- {row.trackingNumber && (
- <span className="whitespace-nowrap">
- <Trans>Tracking</Trans>{" "}
- <span className="text-foreground">
- <Highlight text={row.trackingNumber} terms={terms} />
- </span>
- </span>
- )}
- </span>
- </div>
- {draftReceipt ? (
- <Button
- asChild
- size="sm"
- variant="secondary"
- leftIcon={<LuHandCoins />}
- className="shrink-0"
- >
- <Link to={path.to.receiptDetails(draftReceipt.id)}>
- {draftReceipt.receiptId}
- </Link>
- </Button>
- ) : (
- <Button
- size="sm"
- variant="secondary"
- leftIcon={<LuHandCoins />}
- className="shrink-0"
- isLoading={isReceiving}
- isDisabled={
- !permissions.can("create", "inventory") ||
- navigation.state !== "idle"
- }
- onClick={() => receive({ id: purchaseOrderId })}
+ if (draftReceipt) {
+ return (
+ <Button asChild size="sm" variant="secondary" leftIcon={<LuHandCoins />}>
+ <Link
+ to={path.to.receiptDetails(draftReceipt.id)}
+ onClick={(e) => e.stopPropagation()}
>
- <Trans>Receive</Trans>
- </Button>
- )}
- </div>
+ {draftReceipt.receiptId}
+ </Link>
+ </Button>
+ );
+ }
+
+ return (
+ <Button
+ size="sm"
+ variant="secondary"
+ leftIcon={<LuHandCoins />}
+ isLoading={isReceiving}
+ isDisabled={
+ !permissions.can("create", "inventory") || navigation.state !== "idle"
+ }
+ onClick={(e) => {
+ e.stopPropagation();
+ receive({ id: purchaseOrderId });
+ }}
+ >
+ <Trans>Receive</Trans>
+ </Button>
);
}
diff --git a/apps/erp/app/modules/items/ui/ChangeNotice/ChangeNoticesTable.tsx b/apps/erp/app/modules/items/ui/ChangeNotice/ChangeNoticesTable.tsx
index af58bf9265..e564645cc6 100644
--- a/apps/erp/app/modules/items/ui/ChangeNotice/ChangeNoticesTable.tsx
+++ b/apps/erp/app/modules/items/ui/ChangeNotice/ChangeNoticesTable.tsx
@@ -26,11 +26,19 @@ import {
LuUser
} from "react-icons/lu";
import { useNavigate } from "react-router";
-import { DateTime, EmployeeAvatar, Hyperlink, New, Table } from "~/components";
+import {
+ DateTime,
+ EmployeeAvatar,
+ Highlight,
+ Hyperlink,
+ New,
+ searchMatches,
+ Table
+} from "~/components";
import { Enumerable } from "~/components/Enumerable";
import { ConfirmDelete } from "~/components/Modals";
import type { InfiniteOptions } from "~/components/Table";
-import { usePermissions } from "~/hooks";
+import { usePermissions, useUrlParams } from "~/hooks";
import { useCustomColumns } from "~/hooks/useCustomColumns";
import { useRealtime } from "~/hooks/useRealtime";
import { useItems } from "~/stores/items";
@@ -68,6 +76,8 @@ const ChangeNoticesTable = memo(
({ data, types, count, infinite }: ChangeNoticesTableProps) => {
const navigate = useNavigate();
const { t } = useLingui();
+ const [params] = useUrlParams();
+ const search = params.get("search");
const permissions = usePermissions();
const deleteDisclosure = useDisclosure();
const [selectedChangeNotice, setSelectedChangeNotice] =
@@ -97,10 +107,16 @@ const ChangeNoticesTable = memo(
<Hyperlink to={path.to.changeNotice(row.original.id!)}>
<div className="flex flex-col gap-0">
<span className="text-sm font-medium">
- {row.original.changeOrderId}
+ <Highlight
+ text={row.original.changeOrderId}
+ ranges={searchMatches(row.original.changeOrderId, search)}
+ />
</span>
<span className="text-xs text-muted-foreground">
- {row.original.name}
+ <Highlight
+ text={row.original.name}
+ ranges={searchMatches(row.original.name, search)}
+ />
</span>
</div>
</Hyperlink>
@@ -235,7 +251,7 @@ const ChangeNoticesTable = memo(
}
];
return [...defaultColumns, ...customColumns];
- }, [customColumns, people, items, resolveItemId, types, t]);
+ }, [customColumns, people, items, resolveItemId, search, types, t]);
const canExpandRow = useCallback(
(row: ChangeNoticeListItem) => (row.itemIds?.length ?? 0) > 0,
@@ -255,6 +271,7 @@ const ChangeNoticesTable = memo(
// successor worth arrowing to.
const hasDistinctSuccessor =
!!affected.newItemId && affected.newItemId !== affected.itemId;
+ const readableId = resolveItemId(affected.itemId);
const newReadableId = hasDistinctSuccessor
? resolveItemId(affected.newItemId)
: null;
@@ -266,12 +283,20 @@ const ChangeNoticesTable = memo(
/>
<div className="flex items-center gap-2">
<span className="font-medium">
- {resolveItemId(affected.itemId)}
+ <Highlight
+ text={readableId}
+ ranges={searchMatches(readableId, search)}
+ />
</span>
{newReadableId && (
<span className="flex items-center gap-1 text-muted-foreground">
<LuArrowRight className="size-3.5 shrink-0" />
- <span>{newReadableId}</span>
+ <span>
+ <Highlight
+ text={newReadableId}
+ ranges={searchMatches(newReadableId, search)}
+ />
+ </span>
</span>
)}
<ChangeTypeBadge changeType={affected.changeType} />
@@ -282,7 +307,7 @@ const ChangeNoticesTable = memo(
</div>
);
},
- [resolveItemId]
+ [resolveItemId, search]
);
const renderContextMenu = useCallback(
@@ -334,6 +359,7 @@ const ChangeNoticesTable = memo(
renderContextMenu={renderContextMenu}
renderExpandedRow={renderExpandedRow}
canExpandRow={canExpandRow}
+ expandRowsFor={search}
defaultColumnVisibility={{ itemIds: false }}
title={t`Change Notices`}
table="changeOrder"
diff --git a/apps/erp/app/modules/quality/AGENTS.md b/apps/erp/app/modules/quality/AGENTS.md
index ababbac6b5..133f58261d 100644
--- a/apps/erp/app/modules/quality/AGENTS.md
+++ b/apps/erp/app/modules/quality/AGENTS.md
@@ -86,7 +86,7 @@ The building blocks they call (`updateIssueStatus`, `updateIssueTaskStatus`, `up
- `getIssueWorkflow` / `getIssueActionTasks` / `getIssueApprovalTasks` — workflow state
- `updateIssueStatus` / `updateIssueTaskStatus` — the bare status writes under `setIssueStatus` / `setIssueTaskStatus`
- `closeIssue` (`quality.service.ts`) — blocked while a linked supplier return is open; the 'Return to Supplier' write-off is reduced by shipped-via-return coverage (an inspection-rejected non-tracked lot was written off at the reject; its return shipment puts the units back before shipping them, so close posts nothing for it), and return-shipped entities stay Consumed (not flipped Rejected). `draftIssueSupplierReturn` drafts the linked `purchaseReturnOrder` (idempotent, supplier auto-resolution)
-- `getInspectionDocument` / `getBalloons` / `getInspectionFeatures` / `getInspectionPlan` — drawing-inspection reads (plan authoring: `getInspectionDocuments`, `upsertInspectionDocument`, `deleteInspectionDocument`, `saveInspectionDocumentAtomic`; editor UI in `ui/InspectionDocument/`, list at `/x/quality/inspection-plans`; the editor autosaves — merge logic in `ui/InspectionDocument/autosave.ts`)
+- `getInspectionDocument` / `getBalloons` / `getInspectionFeatures` / `getInspectionPlan` — drawing-inspection reads (plan authoring: `getInspectionDocuments`, `getInspectionPlanParts` (the list, one row per part from the `inspectionPlanParts` view), `upsertInspectionDocument`, `deleteInspectionDocument`, `saveInspectionDocumentAtomic`; editor UI in `ui/InspectionDocument/`, list at `/x/quality/inspection-plans`; the editor autosaves — merge logic in `ui/InspectionDocument/autosave.ts`)
- `getInspection` / `getInspections` (status + source filters) / `getInspectionTrackedEntities` — inspections
- `getInspectionSamplingPlans` / `getInspectionMeasurements` — per-inspection feature plans and grid readings
- `getItemInspectionDocumentAssignments` / `upsertItemInspectionDocumentAssignment` — Receipt-usage document assignment
diff --git a/apps/erp/app/modules/quality/quality.service.ts b/apps/erp/app/modules/quality/quality.service.ts
index 63820ccab2..52bb65c8b5 100644
--- a/apps/erp/app/modules/quality/quality.service.ts
+++ b/apps/erp/app/modules/quality/quality.service.ts
@@ -2532,6 +2532,52 @@ export async function getInspectionDocuments(
};
}
+export const INSPECTION_PLAN_PARTS_PAGING: Paging = {
+ defaultSorts: [{ column: "partReadableId", ascending: true }]
+};
+
+/** One plan in a part's `plans` rollup (the `inspectionPlanParts` view). */
+export type InspectionPlanSummary = {
+ id: string;
+ name: string | null;
+ modelUploadId: string | null;
+ createdBy: string;
+ createdAt: string;
+};
+
+/** The Inspection Plans list: one row per part, with its plans. */
+export async function getInspectionPlanParts(
+ client: SupabaseClient<Database>,
+ companyId: string,
+ args?: { search: string | null } & GenericQueryFilters
+) {
+ let query = client
+ .from("inspectionPlanParts")
+ .select("*", { count: listCount(args) })
+ .eq("companyId", companyId);
+
+ if (args?.search) {
+ query = query.or(
+ searchFilter(["partReadableId", "partName", "planNames"], args.search)
+ );
+ }
+
+ if (args) {
+ query = setGenericQueryFilters(query, args, INSPECTION_PLAN_PARTS_PAGING);
+ }
+
+ const result = await query;
+
+ return {
+ data: (result.data ?? []).map((row) => ({
+ ...row,
+ plans: (row.plans as InspectionPlanSummary[] | null) ?? []
+ })),
+ count: result.count ?? 0,
+ error: result.error
+ };
+}
+
export async function getInspectionDocumentsForItem(
client: SupabaseClient<Database>,
itemId: string,
diff --git a/apps/erp/app/modules/quality/types.ts b/apps/erp/app/modules/quality/types.ts
index edbbe849a7..8e282eadb4 100644
--- a/apps/erp/app/modules/quality/types.ts
+++ b/apps/erp/app/modules/quality/types.ts
@@ -10,10 +10,10 @@ import type {
getGauges,
getGaugeTypes,
getInspection,
- getInspectionDocuments,
getInspectionGauges,
getInspectionIssues,
getInspectionMeasurements,
+ getInspectionPlanParts,
getInspectionSamplingPlans,
getInspections,
getIssueActionTasks,
@@ -214,8 +214,8 @@ export type IssueTypeListItem = NonNullable<
// --- Inspection Documents -----------------------------------------------
-export type InspectionDocument = NonNullable<
- Awaited<ReturnType<typeof getInspectionDocuments>>["data"]
+export type InspectionPlanPart = NonNullable<
+ Awaited<ReturnType<typeof getInspectionPlanParts>>["data"]
>[number];
export type BalloonFeature = {
diff --git a/apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentTable.tsx b/apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentTable.tsx
index cbcdd09e5c..cfa555904f 100644
--- a/apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentTable.tsx
+++ b/apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentTable.tsx
@@ -2,210 +2,175 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
-import {
- MENU_ITEM_SHORTCUTS,
- MenuIcon,
- MenuItem,
- useDisclosure,
- VStack
-} from "@carbon/react";
import { useLingui } from "@lingui/react/macro";
import type { ColumnDef } from "@tanstack/react-table";
-import { memo, useCallback, useMemo, useState } from "react";
-import { flushSync } from "react-dom";
+import { memo, useCallback, useMemo } from "react";
import {
LuBookMarked,
+ LuBox,
+ LuCalendar,
LuFileText,
- LuPencil,
- LuTarget,
- LuTrash,
- LuUser
+ LuTarget
} from "react-icons/lu";
-import { useNavigate } from "react-router";
-import { DateTime, EmployeeAvatar, Hyperlink, New, Table } from "~/components";
-import { ConfirmDelete } from "~/components/Modals";
+import {
+ DateTime,
+ EmployeeAvatar,
+ exportOnlyColumn,
+ Highlight,
+ Hyperlink,
+ New,
+ searchMatches,
+ Table
+} from "~/components";
import type { InfiniteOptions } from "~/components/Table";
import { usePermissions, useUrlParams } from "~/hooks";
import { useItems } from "~/stores/items";
import { path } from "~/utils/path";
-import type { InspectionDocument } from "../../types";
+import type { InspectionPlanPart } from "../../types";
type InspectionDocumentTableProps = {
- data: InspectionDocument[];
+ data: InspectionPlanPart[];
count: number;
infinite: InfiniteOptions;
};
const defaultColumnVisibility = {
- createdAt: false,
- updatedAt: false,
- updatedBy: false
+ createdAt: false
};
+/** One row per part; its inspection plans are the expanded row, open while a
+ * search is, with the matches marked. */
const InspectionDocumentTable = memo(
({ data, count, infinite }: InspectionDocumentTableProps) => {
const [params] = useUrlParams();
- const navigate = useNavigate();
const { t } = useLingui();
const permissions = usePermissions();
const [items] = useItems();
+ const search = params.get("search");
- const deleteDisclosure = useDisclosure();
- const [selectedDiagram, setSelectedDiagram] =
- useState<InspectionDocument | null>(null);
-
- const columns = useMemo<ColumnDef<InspectionDocument>[]>(
+ const columns = useMemo<ColumnDef<InspectionPlanPart>[]>(
() => [
{
- accessorKey: "partId",
+ accessorKey: "partReadableId",
header: t`Part`,
- cell: ({ row }) => {
- const partId = row.original.partId;
- if (!partId) {
- return <span className="text-muted-foreground">—</span>;
- }
- const item = items.find((i) => i.id === partId);
- return (
- <Hyperlink to={path.to.inspectionDocument(row.original.id)}>
- <VStack spacing={0} className="min-w-[160px] leading-tight">
- <span className="truncate font-medium">
- {item?.readableIdWithRevision ?? partId}
- </span>
- {item?.name ? (
- <span className="truncate text-xs text-muted-foreground">
- {item.name}
- </span>
- ) : null}
- </VStack>
- </Hyperlink>
- );
- },
+ cell: ({ row }) => (
+ <Hyperlink to={path.to.part(row.original.id!)}>
+ <div className="flex flex-col gap-0">
+ <span className="text-sm font-medium">
+ <Highlight
+ text={row.original.partReadableId}
+ ranges={searchMatches(row.original.partReadableId, search)}
+ />
+ </span>
+ <span className="text-xs text-muted-foreground">
+ <Highlight
+ text={row.original.partName}
+ ranges={searchMatches(row.original.partName, search)}
+ />
+ </span>
+ </div>
+ </Hyperlink>
+ ),
meta: {
mobile: "P1",
+ icon: <LuBookMarked />,
filter: {
type: "static" as const,
options: items?.map((item) => ({
- value: item.id,
+ value: item.readableIdWithRevision,
label: item.readableIdWithRevision
}))
- },
- icon: <LuBookMarked />
+ }
}
},
{
- accessorKey: "name",
- header: t`Name`,
- cell: ({ row }) => row.original.name,
- // The service computes `name`; the view has no such column to sort.
- enableSorting: false,
- meta: { mobile: "P3", icon: <LuTarget /> }
- },
- {
- id: "createdBy",
- header: t`Created By`,
+ accessorKey: "planCount",
+ header: t`Inspection Plans`,
cell: ({ row }) => (
- <EmployeeAvatar employeeId={row.original.createdBy} />
+ <span className="tabular-nums">{row.original.planCount}</span>
),
- meta: { icon: <LuUser /> }
+ meta: { mobile: "P2", icon: <LuTarget /> }
},
{
- accessorKey: "createdAt",
- header: t`Created At`,
+ accessorKey: "updatedAt",
+ header: t`Updated At`,
cell: (item) => (
<DateTime value={item.getValue<string>()} variant="date" />
),
- meta: { mobile: "P2", icon: <LuFileText /> }
+ meta: { icon: <LuCalendar /> }
},
{
- id: "updatedBy",
- header: t`Updated By`,
- cell: ({ row }) => (
- <EmployeeAvatar employeeId={row.original.updatedBy} />
- ),
- meta: { icon: <LuUser /> }
- },
- {
- accessorKey: "updatedAt",
- header: t`Updated At`,
+ accessorKey: "createdAt",
+ header: t`Created At`,
cell: (item) => (
<DateTime value={item.getValue<string>()} variant="date" />
),
- meta: { icon: <LuFileText /> }
- }
+ meta: { icon: <LuCalendar /> }
+ },
+ // The plans live in the expanded row, which the CSV cannot carry.
+ exportOnlyColumn<InspectionPlanPart>({
+ id: "planNames",
+ header: t`Plan Names`,
+ value: (row) => row.plans.map((plan) => plan.name).join(", ")
+ })
],
- [items, t]
+ [items, search, t]
);
- const renderContextMenu = useCallback(
- (row: InspectionDocument) => (
- <>
- <MenuItem
- shortcut={MENU_ITEM_SHORTCUTS.edit}
- disabled={!permissions.can("update", "quality")}
- onClick={() => {
- navigate(
- `${path.to.inspectionDocument(row.id)}?${params?.toString()}`
- );
- }}
- >
- <MenuIcon icon={<LuPencil />} />
- Edit Diagram
- </MenuItem>
- <MenuItem
- shortcut={MENU_ITEM_SHORTCUTS.delete}
- destructive
- disabled={!permissions.can("delete", "quality")}
- onClick={() => {
- flushSync(() => {
- setSelectedDiagram(row);
- });
- deleteDisclosure.onOpen();
- }}
- >
- <MenuIcon icon={<LuTrash />} />
- Delete Diagram
- </MenuItem>
- </>
+ const renderExpandedRow = useCallback(
+ (row: InspectionPlanPart) => (
+ <div className="pl-[52px] pr-4">
+ {row.plans.map((plan) => (
+ <div key={plan.id} className="flex gap-3 py-3 text-sm">
+ <div
+ aria-hidden
+ className="w-5 shrink-0 border-l border-border -my-3"
+ />
+ <div className="flex min-w-0 flex-1 items-center gap-2">
+ {plan.modelUploadId ? (
+ <LuBox className="size-4 shrink-0 text-muted-foreground" />
+ ) : (
+ <LuFileText className="size-4 shrink-0 text-muted-foreground" />
+ )}
+ <Hyperlink to={path.to.inspectionDocument(plan.id)}>
+ <span className="font-medium">
+ <Highlight
+ text={plan.name}
+ ranges={searchMatches(plan.name, search)}
+ />
+ </span>
+ </Hyperlink>
+ </div>
+ <div className="flex shrink-0 items-center gap-3 text-muted-foreground">
+ <EmployeeAvatar employeeId={plan.createdBy} size="xs" />
+ <DateTime value={plan.createdAt} variant="date" />
+ </div>
+ </div>
+ ))}
+ </div>
),
- [permissions, navigate, params, deleteDisclosure]
+ [search]
);
return (
- <>
- <Table<InspectionDocument>
- data={data}
- infinite={infinite}
- columns={columns}
- count={count}
- defaultColumnVisibility={defaultColumnVisibility}
- primaryAction={
- permissions.can("create", "quality") && (
- <New
- label={t`Inspection Plan`}
- to={`${path.to.newInspectionDocument}?${params?.toString()}`}
- />
- )
- }
- renderContextMenu={renderContextMenu}
- title={t`Inspection Plans`}
- />
- {deleteDisclosure.isOpen && selectedDiagram && (
- <ConfirmDelete
- action={path.to.deleteInspectionDocument(selectedDiagram.id)}
- isOpen
- onCancel={() => {
- setSelectedDiagram(null);
- deleteDisclosure.onClose();
- }}
- onSubmit={() => {
- setSelectedDiagram(null);
- deleteDisclosure.onClose();
- }}
- name={selectedDiagram.name}
- text={t`Are you sure you want to delete this inspection plan?`}
- />
- )}
- </>
+ <Table<InspectionPlanPart>
+ data={data}
+ infinite={infinite}
+ columns={columns}
+ count={count}
+ defaultColumnVisibility={defaultColumnVisibility}
+ renderExpandedRow={renderExpandedRow}
+ expandRowsFor={search}
+ primaryAction={
+ permissions.can("create", "quality") && (
+ <New
+ label={t`Inspection Plan`}
+ to={`${path.to.newInspectionDocument}?${params?.toString()}`}
+ />
+ )
+ }
+ title={t`Inspection Plans`}
+ />
);
}
);
diff --git a/apps/erp/app/routes/x+/inventory+/receiving.tsx b/apps/erp/app/routes/x+/inventory+/receiving.tsx
index 3f8ac39223..4a7c93db86 100644
--- a/apps/erp/app/routes/x+/inventory+/receiving.tsx
+++ b/apps/erp/app/routes/x+/inventory+/receiving.tsx
@@ -23,6 +23,7 @@ import type {
} from "~/modules/inventory/types";
import ReceivingTable from "~/modules/inventory/ui/Receiving/ReceivingTable";
import type { Handle } from "~/utils/handle";
+import { SINGLE_LOAD_LIMIT } from "~/utils/pagination";
import { path } from "~/utils/path";
import { getGenericQueryFilters } from "~/utils/query";
@@ -43,12 +44,14 @@ export async function loader({ request }: LoaderFunctionArgs) {
const searchParams = new URL(request.url).searchParams;
const search = searchParams.get("search");
- const { limit, offset, filters } = getGenericQueryFilters(searchParams);
+ const { filters } = getGenericQueryFilters(searchParams);
+ // The table shows orders, so it reads every line at once rather than a page
+ // of lines, which could cut an order in two.
const lines = await getPurchaseOrderLinesToReceive(client, companyId, {
search,
- limit,
- offset,
+ limit: SINGLE_LOAD_LIMIT,
+ offset: 0,
filters
});
@@ -67,11 +70,20 @@ export async function loader({ request }: LoaderFunctionArgs) {
}
// The view's keys are never null; the generated view type cannot say so.
- const openLines = (lines.data ?? []).flatMap((line) =>
+ const readLines = (lines.data ?? []).flatMap((line) =>
line.id && line.purchaseOrderId
? [{ ...line, id: line.id, purchaseOrderId: line.purchaseOrderId }]
: []
);
+ // At the limit, more lines may match and the last order may be missing
+ // some: leave it out, so every order shown has all its lines.
+ const isTruncated = (lines.data ?? []).length === SINGLE_LOAD_LIMIT;
+ const cutOrderId = isTruncated ? readLines.at(-1)?.purchaseOrderId : null;
+ const completeLines = cutOrderId
+ ? readLines.filter((line) => line.purchaseOrderId !== cutOrderId)
+ : readLines;
+ // One order with more lines than the limit is all there is to show.
+ const openLines = completeLines.length > 0 ? completeLines : readLines;
const itemIds = [
...new Set(openLines.flatMap((line) => (line.itemId ? [line.itemId] : [])))
];
@@ -129,19 +141,20 @@ export async function loader({ request }: LoaderFunctionArgs) {
return {
rows,
- count: lines.count ?? 0,
- draftReceiptByOrder
+ draftReceiptByOrder,
+ isTruncated
};
}
export default function ReceivingRoute() {
- const { rows, count, draftReceiptByOrder } = useLoaderData<typeof loader>();
+ const { rows, draftReceiptByOrder, isTruncated } =
+ useLoaderData<typeof loader>();
return (
<VStack spacing={0} className="h-full">
<ReceivingTable
rows={rows}
- count={count}
+ isTruncated={isTruncated}
draftReceiptByOrder={draftReceiptByOrder}
/>
</VStack>
diff --git a/apps/erp/app/routes/x+/quality+/inspection-plans.tsx b/apps/erp/app/routes/x+/quality+/inspection-plans.tsx
index fe9b083f7c..6e6a3d813d 100644
--- a/apps/erp/app/routes/x+/quality+/inspection-plans.tsx
+++ b/apps/erp/app/routes/x+/quality+/inspection-plans.tsx
@@ -18,19 +18,15 @@ export const handle: Handle = {
};
export async function loader({ request }: LoaderFunctionArgs) {
- return loadListPage(request, inspectionPlansList, { dataKey: "diagrams" });
+ return loadListPage(request, inspectionPlansList, { dataKey: "parts" });
}
export default function InspectionDocumentsRoute() {
- const { diagrams, count, infinite } = useLoaderData<typeof loader>();
+ const { parts, count, infinite } = useLoaderData<typeof loader>();
return (
<VStack spacing={0} className="h-full">
- <InspectionDocumentTable
- data={diagrams}
- count={count}
- infinite={infinite}
- />
+ <InspectionDocumentTable data={parts} count={count} infinite={infinite} />
<RecordOutlet />
</VStack>
);
diff --git a/apps/erp/app/utils/list-registry/quality.server.ts b/apps/erp/app/utils/list-registry/quality.server.ts
index 6f57cf625b..1ad37ad26d 100644
--- a/apps/erp/app/utils/list-registry/quality.server.ts
+++ b/apps/erp/app/utils/list-registry/quality.server.ts
@@ -9,7 +9,7 @@ import {
getGaugeCalibrationRecords,
getGauges,
getGaugeTypes,
- getInspectionDocuments,
+ getInspectionPlanParts,
getInspections,
getIssues,
getIssueTypes,
@@ -18,7 +18,7 @@ import {
getQualityDocuments,
getRequiredActions,
getRisks,
- INSPECTION_DOCUMENTS_PAGING,
+ INSPECTION_PLAN_PARTS_PAGING,
INSPECTIONS_PAGING,
ISSUE_TYPES_PAGING,
ISSUE_WORKFLOWS_PAGING,
@@ -79,8 +79,12 @@ export const gaugeTypesList = searchList({
export const inspectionPlansList = searchList({
key: "inspection-plans",
permission: { view: "quality", role: "employee" },
- paging: INSPECTION_DOCUMENTS_PAGING,
- service: getInspectionDocuments
+ paging: INSPECTION_PLAN_PARTS_PAGING,
+ service: getInspectionPlanParts,
+ // The column joins the plans' names; the view's `planNames` is for search.
+ exportValues: {
+ planNames: (row) => row.plans.map((plan) => plan.name).join(", ")
+ }
});
export const inspectionsList = searchList({
diff --git a/apps/mes/app/routes/x+/picking.$pickingListId.tsx b/apps/mes/app/routes/x+/picking.$pickingListId.tsx
index 485afaa542..315ba39ba2 100644
--- a/apps/mes/app/routes/x+/picking.$pickingListId.tsx
+++ b/apps/mes/app/routes/x+/picking.$pickingListId.tsx
@@ -158,6 +158,16 @@ export default function PickingExecutionRoute() {
});
}, [lines]);
+ // Numbered down the list in display order, across kits, so a line number
+ // names one line of the whole list. The ERP numbers it the same way.
+ const lineNumbers = useMemo(
+ () =>
+ new Map(
+ kits.flatMap((kit) => kit.lines).map((line, i) => [line.id, i + 1])
+ ),
+ [kits]
+ );
+
const completedCount = lines.filter((l) => isLineResolved(l)).length;
return (
@@ -193,6 +203,7 @@ export default function PickingExecutionRoute() {
<PickingKitCard
key={kit.key}
kit={kit}
+ lineNumbers={lineNumbers}
status={index === 0 ? pickingList.status : undefined}
pickingListId={pickingList.id}
isLocked={isLocked}
@@ -413,12 +424,14 @@ function isLineResolved(line: Line) {
function PickingKitCard({
kit,
+ lineNumbers,
status,
pickingListId,
isLocked,
recommendations
}: {
kit: Kit;
+ lineNumbers: Map<string, number>;
/** Phones: the list status, shown in the first kit's header row. */
status?: ComponentProps<typeof PickingListStatus>["status"];
pickingListId: string;
@@ -464,6 +477,7 @@ function PickingKitCard({
<PickLineItem
key={line.id}
line={line}
+ lineNumber={lineNumbers.get(line.id)}
pickingListId={pickingListId}
isLast={index === kit.lines.length - 1}
isLocked={isLocked}
@@ -478,12 +492,14 @@ function PickingKitCard({
function PickLineItem({
line,
+ lineNumber,
pickingListId,
isLast,
isLocked,
recommendations
}: {
line: Line;
+ lineNumber?: number;
pickingListId: string;
isLast: boolean;
isLocked: boolean;
@@ -666,6 +682,9 @@ function PickLineItem({
{/* Identity — item, part number, suggested lots, and (mobile) the count */}
<div className="flex items-start justify-between gap-4 min-w-0 sm:flex-1">
<HStack spacing={4} className="min-w-0 flex-1 max-md:space-x-3">
+ <span className="w-6 shrink-0 text-right text-sm tabular-nums text-muted-foreground">
+ {lineNumber}
+ </span>
<div className="shrink-0 max-md:[&>*]:size-11 max-md:[&_svg]:size-7">
<ItemThumbnail
size="xl"
diff --git a/apps/mes/app/services/picking.service.ts b/apps/mes/app/services/picking.service.ts
index aa7991d2af..82de6d42a1 100644
--- a/apps/mes/app/services/picking.service.ts
+++ b/apps/mes/app/services/picking.service.ts
@@ -38,8 +38,11 @@ export async function getPickingListForExecution(
"*, item:item(name, readableId, unitOfMeasureCode), jobMaterial:jobMaterial(itemId, quantity, substitutionFactor, item(readableId, itemSupersession!itemSupersession_itemId_fkey(conversionFactor))), job:job(jobId), jobOperation:jobOperation(order, processId, workCenterId, process:process(name), workCenter:workCenter(name)), storageUnit:storageUnit!pickingListLine_storageUnitId_fkey(name), toStorageUnit:storageUnit!pickingListLine_toStorageUnitId_fkey(name)"
)
.eq("pickingListId", pickingListId)
+ // The ERP picking list reads the same order: line numbers are positions.
.order("jobOperationId")
- .order("storageUnitId");
+ .order("storageUnitId")
+ .order("itemId")
+ .order("id");
if (lineError) return { data: null, error: lineError };
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index b0d5aac9f5..7865260f98 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -57468,6 +57468,75 @@ export default {
tags: ["costCenter"]
}
},
+ "/inspectionPlanParts": {
+ get: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.inspectionPlanParts.id"
+ },
+ {
+ $ref: "#/parameters/rowFilter.inspectionPlanParts.companyId"
+ },
+ {
+ $ref: "#/parameters/rowFilter.inspectionPlanParts.partReadableId"
+ },
+ {
+ $ref: "#/parameters/rowFilter.inspectionPlanParts.partName"
+ },
+ {
+ $ref: "#/parameters/rowFilter.inspectionPlanParts.planCount"
+ },
+ {
+ $ref: "#/parameters/rowFilter.inspectionPlanParts.planNames"
+ },
+ {
+ $ref: "#/parameters/rowFilter.inspectionPlanParts.plans"
+ },
+ {
+ $ref: "#/parameters/rowFilter.inspectionPlanParts.createdAt"
+ },
+ {
+ $ref: "#/parameters/rowFilter.inspectionPlanParts.updatedAt"
+ },
+ {
+ $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/inspectionPlanParts"
+ },
+ type: "array"
+ }
+ },
+ "206": {
+ description: "Partial Content"
+ }
+ },
+ tags: ["inspectionPlanParts"]
+ }
+ },
"/purchaseReturnOrderLineTrackedEntity": {
get: {
parameters: [
@@ -146519,6 +146588,50 @@ export default {
},
type: "object"
},
+ inspectionPlanParts: {
+ properties: {
+ id: {
+ description:
+ "Note:\nThis is a Foreign Key to `item.id`.<fk table='item' column='id'/>",
+ format: "text",
+ type: "string"
+ },
+ companyId: {
+ description:
+ "Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",
+ format: "text",
+ type: "string"
+ },
+ partReadableId: {
+ format: "text",
+ type: "string"
+ },
+ partName: {
+ format: "text",
+ type: "string"
+ },
+ planCount: {
+ format: "integer",
+ type: "integer"
+ },
+ planNames: {
+ format: "text",
+ type: "string"
+ },
+ plans: {
+ format: "jsonb"
+ },
+ createdAt: {
+ format: "timestamp with time zone",
+ type: "string"
+ },
+ updatedAt: {
+ format: "timestamp with time zone",
+ type: "string"
+ }
+ },
+ type: "object"
+ },
purchaseReturnOrderLineTrackedEntity: {
required: [
"purchaseReturnOrderLineId",
@@ -200003,6 +200116,69 @@ export default {
in: "query",
type: "string"
},
+ "body.inspectionPlanParts": {
+ name: "inspectionPlanParts",
+ description: "inspectionPlanParts",
+ required: false,
+ in: "body",
+ schema: {
+ $ref: "#/definitions/inspectionPlanParts"
+ }
+ },
+ "rowFilter.inspectionPlanParts.id": {
+ name: "id",
+ required: false,
+ in: "query",
+ type: "string"
+ },
+ "rowFilter.inspectionPlanParts.companyId": {
+ name: "companyId",
+ required: false,
+ in: "query",
+ type: "string"
+ },
+ "rowFilter.inspectionPlanParts.partReadableId": {
+ name: "partReadableId",
+ required: false,
+ in: "query",
+ type: "string"
+ },
+ "rowFilter.inspectionPlanParts.partName": {
+ name: "partName",
+ required: false,
+ in: "query",
+ type: "string"
+ },
+ "rowFilter.inspectionPlanParts.planCount": {
+ name: "planCount",
+ required: false,
+ in: "query",
+ type: "string"
+ },
+ "rowFilter.inspectionPlanParts.planNames": {
+ name: "planNames",
+ required: false,
+ in: "query",
+ type: "string"
+ },
+ "rowFilter.inspectionPlanParts.plans": {
+ name: "plans",
+ required: false,
+ in: "query",
+ type: "string"
+ },
+ "rowFilter.inspectionPlanParts.createdAt": {
+ name: "createdAt",
+ required: false,
+ in: "query",
+ type: "string"
+ },
+ "rowFilter.inspectionPlanParts.updatedAt": {
+ name: "updatedAt",
+ required: false,
+ in: "query",
+ type: "string"
+ },
"body.purchaseReturnOrderLineTrackedEntity": {
name: "purchaseReturnOrderLineTrackedEntity",
description: "purchaseReturnOrderLineTrackedEntity",
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 5f0e1c2794..ad2c2d738e 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -77587,6 +77587,91 @@ export type Database = {
}
]
}
+ inspectionPlanParts: {
+ Row: {
+ companyId: string | null
+ createdAt: string | null
+ id: string | null
+ partName: string | null
+ partReadableId: string | null
+ planCount: number | null
+ planNames: string | null
+ plans: Json | null
+ updatedAt: string | null
+ }
+ Relationships: [
+ {
+ foreignKeyName: "inspectionDocument_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "inspectionDocument_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "inspectionDocument_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "inspectionDocument_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "inspectionDocument_partId_fkey"
+ columns: ["id"]
+ isOneToOne: false
+ referencedRelation: "consumables"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "inspectionDocument_partId_fkey"
+ columns: ["id"]
+ isOneToOne: false
+ referencedRelation: "item"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "inspectionDocument_partId_fkey"
+ columns: ["id"]
+ isOneToOne: false
+ referencedRelation: "materials"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "inspectionDocument_partId_fkey"
+ columns: ["id"]
+ isOneToOne: false
+ referencedRelation: "parts"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "inspectionDocument_partId_fkey"
+ columns: ["id"]
+ isOneToOne: false
+ referencedRelation: "services"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "inspectionDocument_partId_fkey"
+ columns: ["id"]
+ isOneToOne: false
+ referencedRelation: "tools"
+ referencedColumns: ["id"]
+ }
+ ]
+ }
integrations: {
Row: {
active: boolean | null
diff --git a/packages/database/supabase/migrations/20261028161842_inspection-plan-parts-view.sql b/packages/database/supabase/migrations/20261028161842_inspection-plan-parts-view.sql
new file mode 100644
index 0000000000..b174987120
--- /dev/null
+++ b/packages/database/supabase/migrations/20261028161842_inspection-plan-parts-view.sql
@@ -0,0 +1,28 @@
+-- The Inspection Plans list shows one row per part, its plans in the expanded
+-- row (as the Change Notices list shows a notice's affected items).
+
+DROP VIEW IF EXISTS "inspectionPlanParts";
+CREATE VIEW "inspectionPlanParts" WITH (SECURITY_INVOKER=true) AS
+ SELECT
+ d."partId" AS "id",
+ d."companyId",
+ i."readableIdWithRevision" AS "partReadableId",
+ i."name" AS "partName",
+ COUNT(*)::INTEGER AS "planCount",
+ -- The search reads the plans' names too.
+ string_agg(COALESCE(d."drawingNumber", d."fileName"), ' ') AS "planNames",
+ jsonb_agg(
+ jsonb_build_object(
+ 'id', d."id",
+ 'name', COALESCE(d."drawingNumber", d."fileName"),
+ 'modelUploadId', d."modelUploadId",
+ 'createdBy', d."createdBy",
+ 'createdAt', d."createdAt"
+ )
+ ORDER BY COALESCE(d."drawingNumber", d."fileName"), d."id"
+ ) AS "plans",
+ MIN(d."createdAt") AS "createdAt",
+ MAX(COALESCE(d."updatedAt", d."createdAt")) AS "updatedAt"
+ FROM "inspectionDocument" d
+ JOIN "item" i ON i."id" = d."partId"
+ GROUP BY d."partId", d."companyId", i."readableIdWithRevision", i."name";
diff --git a/packages/documents/src/pdf/blocks/LineItemsBlock.tsx b/packages/documents/src/pdf/blocks/LineItemsBlock.tsx
index 171d92bfb5..d206a31531 100644
--- a/packages/documents/src/pdf/blocks/LineItemsBlock.tsx
+++ b/packages/documents/src/pdf/blocks/LineItemsBlock.tsx
@@ -39,6 +39,8 @@ export function LineItemsBlock({
const opts = { ...DEFAULT_LINE_ITEMS_OPTIONS, ...block.options };
const overflow = itemTextOverflowStyle(opts);
let rowIndex = 0;
+ // Comment lines carry no quantity or price, so they take no line number.
+ let lineNumber = 0;
return (
<View>
@@ -50,7 +52,8 @@ export function LineItemsBlock({
{ backgroundColor: theme.accent, color: theme.accentForeground }
]}
>
- <Text style={tw("w-1/2")}>Description</Text>
+ <Text style={tw("w-[6%] text-center")}>#</Text>
+ <Text style={tw("w-[44%]")}>Description</Text>
<Text style={tw("w-1/6 text-center")}>Qty</Text>
<Text style={tw("w-1/6 text-center")}>Unit Price</Text>
<Text style={tw("w-1/6 text-center")}>Total</Text>
@@ -60,6 +63,8 @@ export function LineItemsBlock({
{salesInvoiceLines.map((line) => {
const isEven = rowIndex % 2 === 0;
rowIndex++;
+ const isComment = line.invoiceLineType === "Comment";
+ if (!isComment) lineNumber++;
const lineAddOnCost = line.convertedAddOnCost ?? 0;
const lineNonTaxableAddOnCost = line.convertedNonTaxableAddOnCost ?? 0;
@@ -89,7 +94,10 @@ export function LineItemsBlock({
}
]}
>
- <View style={tw("w-1/2 pr-2")}>
+ <Text style={tw("w-[6%] text-center text-gray-600")}>
+ {isComment ? "" : lineNumber}
+ </Text>
+ <View style={tw("w-[44%] pr-2")}>
<Text style={{ ...tw("text-gray-800"), ...overflow }}>
{getLineDescription(line)}
</Text>
diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.po
index b9fa3e0c21..c6fe802013 100644
--- a/packages/locale/locales/de/erp.po
+++ b/packages/locale/locales/de/erp.po
@@ -3524,9 +3524,6 @@ msgstr "Sind Sie sicher, dass Sie diese Änderungsmitteilung löschen möchten?"
msgid "Are you sure you want to delete this gauge?"
msgstr "Sind Sie sicher, dass Sie dieses Prüfmittel löschen möchten?"
-msgid "Are you sure you want to delete this inspection plan?"
-msgstr "Sind Sie sicher, dass Sie diesen Prüfplan löschen möchten?"
-
msgid "Are you sure you want to delete this inspection plan? This cannot be undone."
msgstr "Sind Sie sicher, dass Sie diesen Prüfplan löschen möchten? Dies kann nicht rückgängig gemacht werden."
@@ -6225,9 +6222,6 @@ msgstr "Eindeutige Kennung der Verfahrensanweisung kopieren"
msgid "Copy purchase invoice unique identifier"
msgstr "Eindeutige Kennung der Eingangsrechnung kopieren"
-msgid "Copy purchase order number"
-msgstr "Bestellnummer kopieren"
-
msgid "Copy purchase order unique identifier"
msgstr "Bestellnummer kopieren"
@@ -17501,6 +17495,9 @@ msgstr "Plan"
msgid "Plan ahead by projecting demand per item and location, then feed it straight into MRP and scheduling."
msgstr "Planen Sie voraus, indem Sie den Bedarf pro Artikel und Standort projizieren und ihn dann direkt in MRP und Planung einspeisen."
+msgid "Plan Names"
+msgstr "Namen der Prüfpläne"
+
msgid "Plan the work"
msgstr "Planen Sie die Arbeit"
@@ -21978,6 +21975,9 @@ msgstr "Die ersten 500 Zeilen werden angezeigt"
msgid "Showing the newest 200 journals"
msgstr "Die neuesten 200 Buchungssätze werden angezeigt"
+msgid "Showing the oldest orders only. Search or filter to see the rest."
+msgstr "Nur die ältesten Bestellungen werden angezeigt. Suchen Sie oder filtern Sie die Liste, um den Rest zu sehen."
+
msgid "Showing the top 1,000 groups by amount"
msgstr "Die Top 1.000 Gruppen nach Betrag werden angezeigt"
diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.po
index 998fc49cde..fda3753a4d 100644
--- a/packages/locale/locales/en/erp.po
+++ b/packages/locale/locales/en/erp.po
@@ -3524,9 +3524,6 @@ msgstr "Are you sure you want to delete this change notice?"
msgid "Are you sure you want to delete this gauge?"
msgstr "Are you sure you want to delete this gauge?"
-msgid "Are you sure you want to delete this inspection plan?"
-msgstr "Are you sure you want to delete this inspection plan?"
-
msgid "Are you sure you want to delete this inspection plan? This cannot be undone."
msgstr "Are you sure you want to delete this inspection plan? This cannot be undone."
@@ -6225,9 +6222,6 @@ msgstr "Copy procedure unique identifier"
msgid "Copy purchase invoice unique identifier"
msgstr "Copy purchase invoice unique identifier"
-msgid "Copy purchase order number"
-msgstr "Copy purchase order number"
-
msgid "Copy purchase order unique identifier"
msgstr "Copy purchase order unique identifier"
@@ -17501,6 +17495,9 @@ msgstr "Plan"
msgid "Plan ahead by projecting demand per item and location, then feed it straight into MRP and scheduling."
msgstr "Plan ahead by projecting demand per item and location, then feed it straight into MRP and scheduling."
+msgid "Plan Names"
+msgstr "Plan Names"
+
msgid "Plan the work"
msgstr "Plan the work"
@@ -21978,6 +21975,9 @@ msgstr "Showing the first 500 lines"
msgid "Showing the newest 200 journals"
msgstr "Showing the newest 200 journals"
+msgid "Showing the oldest orders only. Search or filter to see the rest."
+msgstr "Showing the oldest orders only. Search or filter to see the rest."
+
msgid "Showing the top 1,000 groups by amount"
msgstr "Showing the top 1,000 groups by amount"
diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.po
index d46c1caeef..8c5f54c3bc 100644
--- a/packages/locale/locales/es/erp.po
+++ b/packages/locale/locales/es/erp.po
@@ -3524,9 +3524,6 @@ msgstr "¿Está seguro de que desea eliminar este aviso de cambio?"
msgid "Are you sure you want to delete this gauge?"
msgstr "¿Está seguro de que desea eliminar este instrumento de medición?"
-msgid "Are you sure you want to delete this inspection plan?"
-msgstr "¿Está seguro de que desea eliminar este plan de inspección?"
-
msgid "Are you sure you want to delete this inspection plan? This cannot be undone."
msgstr "¿Estás seguro de que deseas eliminar este plan de inspección? Esto no se puede deshacer."
@@ -6225,9 +6222,6 @@ msgstr "Copiar identificador único del procedimiento"
msgid "Copy purchase invoice unique identifier"
msgstr "Copiar identificador único de factura de compra"
-msgid "Copy purchase order number"
-msgstr "Copiar número de orden de compra"
-
msgid "Copy purchase order unique identifier"
msgstr "Copiar identificador único de orden de compra"
@@ -17501,6 +17495,9 @@ msgstr "Plan"
msgid "Plan ahead by projecting demand per item and location, then feed it straight into MRP and scheduling."
msgstr "Planifica adelante proyectando la demanda por artículo y ubicación, luego envíala directamente a MRP y programación."
+msgid "Plan Names"
+msgstr "Nombres de los planes de inspección"
+
msgid "Plan the work"
msgstr "Planificar el trabajo"
@@ -21978,6 +21975,9 @@ msgstr "Mostrando las primeras 500 líneas"
msgid "Showing the newest 200 journals"
msgstr "Mostrando los 200 últimos asientos"
+msgid "Showing the oldest orders only. Search or filter to see the rest."
+msgstr "Mostrando solo los pedidos más antiguos. Busca o filtra para ver el resto."
+
msgid "Showing the top 1,000 groups by amount"
msgstr "Mostrando los 1,000 grupos principales por cantidad"
diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.po
index c627a3b6df..01f3f86ad9 100644
--- a/packages/locale/locales/fr/erp.po
+++ b/packages/locale/locales/fr/erp.po
@@ -3524,9 +3524,6 @@ msgstr "Êtes-vous sûr de vouloir supprimer cet avis de modification ?"
msgid "Are you sure you want to delete this gauge?"
msgstr "Êtes-vous sûr de vouloir supprimer cet instrument de mesure ?"
-msgid "Are you sure you want to delete this inspection plan?"
-msgstr "Êtes-vous sûr de vouloir supprimer ce plan de contrôle ?"
-
msgid "Are you sure you want to delete this inspection plan? This cannot be undone."
msgstr "Êtes-vous sûr de vouloir supprimer ce plan de contrôle ? Cette action ne peut pas être annulée."
@@ -6225,9 +6222,6 @@ msgstr "Copier l'identifiant unique de la procédure"
msgid "Copy purchase invoice unique identifier"
msgstr "Copier l'identifiant unique de la facture d'achat"
-msgid "Copy purchase order number"
-msgstr "Copier le numéro du bon de commande"
-
msgid "Copy purchase order unique identifier"
msgstr "Copier l'identifiant unique du bon de commande"
@@ -17501,6 +17495,9 @@ msgstr "Plan"
msgid "Plan ahead by projecting demand per item and location, then feed it straight into MRP and scheduling."
msgstr "Planifiez à l'avance en projetant les besoins par article et par site, puis alimentez-les directement dans MRP et le planning."
+msgid "Plan Names"
+msgstr "Noms des plans de contrôle"
+
msgid "Plan the work"
msgstr "Planifier le travail"
@@ -21978,6 +21975,9 @@ msgstr "Affichage des 500 premières lignes"
msgid "Showing the newest 200 journals"
msgstr "Affichage des 200 dernières écritures"
+msgid "Showing the oldest orders only. Search or filter to see the rest."
+msgstr "Affichage des commandes les plus anciennes uniquement. Rechercher ou filtrer pour voir le reste."
+
msgid "Showing the top 1,000 groups by amount"
msgstr "Affichage des 1 000 meilleurs groupes par montant"
diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.po
index c9c49f6ddb..4ac303471e 100644
--- a/packages/locale/locales/hi/erp.po
+++ b/packages/locale/locales/hi/erp.po
@@ -3524,9 +3524,6 @@ msgstr "क्या आप इस परिवर्तन सूचना क
msgid "Are you sure you want to delete this gauge?"
msgstr "क्या आप इस गेज को हटाना चाहते हैं?"
-msgid "Are you sure you want to delete this inspection plan?"
-msgstr "क्या आप इस निरीक्षण योजना को हटाना चाहते हैं?"
-
msgid "Are you sure you want to delete this inspection plan? This cannot be undone."
msgstr "क्या आप इस निरीक्षण योजना को हटाना चाहते हैं? यह वापस नहीं किया जा सकता।"
@@ -6225,9 +6222,6 @@ msgstr "कार्यविधि की अद्वितीय पहचा
msgid "Copy purchase invoice unique identifier"
msgstr "क्रय चालान की विशिष्ट पहचान नकल करें"
-msgid "Copy purchase order number"
-msgstr "क्रय आदेश संख्या कॉपी करें"
-
msgid "Copy purchase order unique identifier"
msgstr "क्रय आदेश की विशिष्ट पहचान नकल करें"
@@ -17501,6 +17495,9 @@ msgstr "योजना"
msgid "Plan ahead by projecting demand per item and location, then feed it straight into MRP and scheduling."
msgstr "आइटम और स्थान के अनुसार मांग का अनुमान लगाकर आगे की योजना बनाएं, फिर इसे सीधे MRP और शेड्यूलिंग में डालें।"
+msgid "Plan Names"
+msgstr "निरीक्षण योजनाओं के नाम"
+
msgid "Plan the work"
msgstr "काम की योजना बनाएं"
@@ -21978,6 +21975,9 @@ msgstr "पहली 500 लाइनें दिखा रहे हैं"
msgid "Showing the newest 200 journals"
msgstr "नवीनतम 200 जर्नल दिखाए जा रहे हैं"
+msgid "Showing the oldest orders only. Search or filter to see the rest."
+msgstr "केवल सबसे पुराने ऑर्डर दिखाए जा रहे हैं। बाकी देखने के लिए खोजें या फ़िल्टर करें।"
+
msgid "Showing the top 1,000 groups by amount"
msgstr "राशि द्वारा शीर्ष 1,000 समूह दिखा रहे हैं"
diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.po
index 7455546b36..ab7bd6279d 100644
--- a/packages/locale/locales/it/erp.po
+++ b/packages/locale/locales/it/erp.po
@@ -3524,9 +3524,6 @@ msgstr "Sei sicuro di voler eliminare questo avviso di modifica?"
msgid "Are you sure you want to delete this gauge?"
msgstr "Sei sicuro di voler eliminare questo strumento di misura?"
-msgid "Are you sure you want to delete this inspection plan?"
-msgstr "Sei sicuro di voler eliminare questo piano di controllo?"
-
msgid "Are you sure you want to delete this inspection plan? This cannot be undone."
msgstr "Sei sicuro di voler eliminare questo piano di controllo? Questa azione non può essere annullata."
@@ -6225,9 +6222,6 @@ msgstr "Copia identificatore univoco della procedura"
msgid "Copy purchase invoice unique identifier"
msgstr "Copia identificatore univoco fattura di acquisto"
-msgid "Copy purchase order number"
-msgstr "Copia numero ordine di acquisto"
-
msgid "Copy purchase order unique identifier"
msgstr "Copia identificatore univoco ordine di acquisto"
@@ -17501,6 +17495,9 @@ msgstr "Piano"
msgid "Plan ahead by projecting demand per item and location, then feed it straight into MRP and scheduling."
msgstr "Pianifica in anticipo proiettando il fabbisogno per articolo e ubicazione, quindi inseriscilo direttamente in MRP e programmazione."
+msgid "Plan Names"
+msgstr "Nomi dei piani di controllo"
+
msgid "Plan the work"
msgstr "Pianifica il lavoro"
@@ -21978,6 +21975,9 @@ msgstr "Visualizzazione delle prime 500 righe"
msgid "Showing the newest 200 journals"
msgstr "Visualizzazione delle 200 prime note più recenti"
+msgid "Showing the oldest orders only. Search or filter to see the rest."
+msgstr "Vengono mostrati solo gli ordini più vecchi. Cerca o filtra per vedere gli altri."
+
msgid "Showing the top 1,000 groups by amount"
msgstr "Visualizzazione dei primi 1.000 gruppi per importo"
diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.po
index 17cce2d934..09c9be9266 100644
--- a/packages/locale/locales/ja/erp.po
+++ b/packages/locale/locales/ja/erp.po
@@ -3524,9 +3524,6 @@ msgstr "この変更通知を削除してもよろしいですか?"
msgid "Are you sure you want to delete this gauge?"
msgstr "この測定器を削除してもよろしいですか?"
-msgid "Are you sure you want to delete this inspection plan?"
-msgstr "この検査計画を削除しますか?"
-
msgid "Are you sure you want to delete this inspection plan? This cannot be undone."
msgstr "この検査計画を削除してもよろしいですか?これは元に戻せません。"
@@ -6225,9 +6222,6 @@ msgstr "手順書の識別子をコピー"
msgid "Copy purchase invoice unique identifier"
msgstr "仕入先請求書の一意識別子をコピー"
-msgid "Copy purchase order number"
-msgstr "発注書番号をコピー"
-
msgid "Copy purchase order unique identifier"
msgstr "発注書の一意識別子をコピー"
@@ -17501,6 +17495,9 @@ msgstr "計画"
msgid "Plan ahead by projecting demand per item and location, then feed it straight into MRP and scheduling."
msgstr "品目と拠点ごとの所要量を予測して先行計画を立て、MRP とスケジューリングに直接フィードします。"
+msgid "Plan Names"
+msgstr "検査計画名"
+
msgid "Plan the work"
msgstr "作業を計画する"
@@ -21978,6 +21975,9 @@ msgstr "最初の 500 行を表示中"
msgid "Showing the newest 200 journals"
msgstr "最新200件の仕訳を表示中"
+msgid "Showing the oldest orders only. Search or filter to see the rest."
+msgstr "古い注文のみを表示しています。残りを表示するには検索または絞り込みを行ってください。"
+
msgid "Showing the top 1,000 groups by amount"
msgstr "金額別上位 1,000 グループを表示中"
diff --git a/packages/locale/locales/ko/erp.po b/packages/locale/locales/ko/erp.po
index bf469ecebb..7328ea8bdd 100644
--- a/packages/locale/locales/ko/erp.po
+++ b/packages/locale/locales/ko/erp.po
@@ -3524,9 +3524,6 @@ msgstr "이 변경 통지를 삭제하시겠습니까?"
msgid "Are you sure you want to delete this gauge?"
msgstr "이 계측기를 삭제하시겠습니까?"
-msgid "Are you sure you want to delete this inspection plan?"
-msgstr "이 검사 계획을 삭제하시겠습니까?"
-
msgid "Are you sure you want to delete this inspection plan? This cannot be undone."
msgstr "이 검사 계획을 삭제하시겠습니까? 이 작업은 취소할 수 없습니다."
@@ -6225,9 +6222,6 @@ msgstr "절차서 고유 식별자 복사"
msgid "Copy purchase invoice unique identifier"
msgstr "매입 송장 고유 식별자 복사"
-msgid "Copy purchase order number"
-msgstr "발주서 번호 복사"
-
msgid "Copy purchase order unique identifier"
msgstr "발주서 고유 식별자 복사"
@@ -17501,6 +17495,9 @@ msgstr "계획"
msgid "Plan ahead by projecting demand per item and location, then feed it straight into MRP and scheduling."
msgstr "품목 및 사업장별 소요량을 예측하여 미리 계획하고, 이를 직접 MRP 및 일정에 입력하세요."
+msgid "Plan Names"
+msgstr "검사 계획 이름"
+
msgid "Plan the work"
msgstr "작업 계획 수립"
@@ -21978,6 +21975,9 @@ msgstr "처음 500줄을 표시하고 있습니다"
msgid "Showing the newest 200 journals"
msgstr "최신 200개 전표 표시 중"
+msgid "Showing the oldest orders only. Search or filter to see the rest."
+msgstr "가장 오래된 주문만 표시하고 있습니다. 나머지를 보려면 검색하거나 필터를 적용하세요."
+
msgid "Showing the top 1,000 groups by amount"
msgstr "금액별 상위 1,000개 그룹을 표시하고 있습니다"
diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.po
index 71bfe70d32..03bbf75c95 100644
--- a/packages/locale/locales/pl/erp.po
+++ b/packages/locale/locales/pl/erp.po
@@ -3524,9 +3524,6 @@ msgstr "Czy chcesz usunąć to zawiadomienie o zmianie?"
msgid "Are you sure you want to delete this gauge?"
msgstr "Czy chcesz usunąć ten przyrząd pomiarowy?"
-msgid "Are you sure you want to delete this inspection plan?"
-msgstr "Czy chcesz usunąć ten plan kontroli?"
-
msgid "Are you sure you want to delete this inspection plan? This cannot be undone."
msgstr "Czy chcesz usunąć ten plan kontroli? Tej czynności nie można cofnąć."
@@ -6225,9 +6222,6 @@ msgstr "Skopiuj unikatowy identyfikator procedury"
msgid "Copy purchase invoice unique identifier"
msgstr "Skopiuj unikalny identyfikator faktury zakupu"
-msgid "Copy purchase order number"
-msgstr "Skopiuj numer zamówienia zakupu"
-
msgid "Copy purchase order unique identifier"
msgstr "Skopiuj unikalny identyfikator zamówienia zakupu"
@@ -17501,6 +17495,9 @@ msgstr "Plan"
msgid "Plan ahead by projecting demand per item and location, then feed it straight into MRP and scheduling."
msgstr "Planuj z wyprzedzeniem, projektując zapotrzebowanie dla każdego artykułu i lokalizacji, a następnie wprowadź je bezpośrednio do MRP i harmonogramu."
+msgid "Plan Names"
+msgstr "Nazwy planów kontroli"
+
msgid "Plan the work"
msgstr "Zaplanuj pracę"
@@ -21978,6 +21975,9 @@ msgstr "Pokazywanie pierwszych 500 linii"
msgid "Showing the newest 200 journals"
msgstr "Wyświetlanie 200 najnowszych dowodów księgowych"
+msgid "Showing the oldest orders only. Search or filter to see the rest."
+msgstr "Pokazano tylko najstarsze zamówienia. Szukaj lub filtruj, aby zobaczyć resztę."
+
msgid "Showing the top 1,000 groups by amount"
msgstr "Pokazywanie 1000 najlepszych grup wg kwoty"
diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.po
index 53a30b00e0..70a607073c 100644
--- a/packages/locale/locales/pt/erp.po
+++ b/packages/locale/locales/pt/erp.po
@@ -3524,9 +3524,6 @@ msgstr "Tem certeza de que deseja excluir este aviso de alteração?"
msgid "Are you sure you want to delete this gauge?"
msgstr "Tem certeza de que deseja excluir este instrumento de medição?"
-msgid "Are you sure you want to delete this inspection plan?"
-msgstr "Tem certeza que deseja excluir este plano de inspeção?"
-
msgid "Are you sure you want to delete this inspection plan? This cannot be undone."
msgstr "Tem certeza de que deseja excluir este plano de inspeção? Isso não pode ser desfeito."
@@ -6225,9 +6222,6 @@ msgstr "Copiar identificador único do procedimento"
msgid "Copy purchase invoice unique identifier"
msgstr "Copiar identificador único da fatura de compra"
-msgid "Copy purchase order number"
-msgstr "Copiar número do pedido de compra"
-
msgid "Copy purchase order unique identifier"
msgstr "Copiar identificador único do pedido de compra"
@@ -17501,6 +17495,9 @@ msgstr "Plano"
msgid "Plan ahead by projecting demand per item and location, then feed it straight into MRP and scheduling."
msgstr "Planeje com antecedência projetando demanda por item e local, depois alimente-a direto ao MRP e programação."
+msgid "Plan Names"
+msgstr "Nomes dos Planos de Inspeção"
+
msgid "Plan the work"
msgstr "Planejar o trabalho"
@@ -21978,6 +21975,9 @@ msgstr "Mostrando as primeiras 500 linhas"
msgid "Showing the newest 200 journals"
msgstr "Mostrando os 200 diários mais recentes"
+msgid "Showing the oldest orders only. Search or filter to see the rest."
+msgstr "Mostrando apenas os pedidos mais antigos. Pesquise ou filtre para ver os demais."
+
msgid "Showing the top 1,000 groups by amount"
msgstr "Mostrando os 1.000 grupos principais por valor"
diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.po
index c9fea99380..e255211534 100644
--- a/packages/locale/locales/ru/erp.po
+++ b/packages/locale/locales/ru/erp.po
@@ -3524,9 +3524,6 @@ msgstr "Вы уверены, что хотите удалить это изве
msgid "Are you sure you want to delete this gauge?"
msgstr "Вы уверены, что хотите удалить это средство измерения?"
-msgid "Are you sure you want to delete this inspection plan?"
-msgstr "Вы уверены, что хотите удалить этот план контроля?"
-
msgid "Are you sure you want to delete this inspection plan? This cannot be undone."
msgstr "Вы уверены, что хотите удалить этот план контроля? Это невозможно отменить."
@@ -6225,9 +6222,6 @@ msgstr "Скопировать уникальный идентификатор
msgid "Copy purchase invoice unique identifier"
msgstr "Скопировать уникальный идентификатор счета-фактуры полученного"
-msgid "Copy purchase order number"
-msgstr "Копировать номер заказа поставщику"
-
msgid "Copy purchase order unique identifier"
msgstr "Скопировать уникальный идентификатор заказа поставщику"
@@ -17501,6 +17495,9 @@ msgstr "План"
msgid "Plan ahead by projecting demand per item and location, then feed it straight into MRP and scheduling."
msgstr "Планируйте заранее, прогнозируя потребность по номенклатуре и площадке, затем подавайте ее прямо в MRP и планирование."
+msgid "Plan Names"
+msgstr "Названия планов контроля"
+
msgid "Plan the work"
msgstr "Спланируйте работу"
@@ -21978,6 +21975,9 @@ msgstr "Показано первые 500 строк"
msgid "Showing the newest 200 journals"
msgstr "Отображение 200 новейших операций"
+msgid "Showing the oldest orders only. Search or filter to see the rest."
+msgstr "Показаны только самые старые заказы. Используйте поиск или фильтр, чтобы увидеть остальные."
+
msgid "Showing the top 1,000 groups by amount"
msgstr "Показано топ 1000 групп по сумме"
diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.po
index 5fc7b3cf53..1b66ac992d 100644
--- a/packages/locale/locales/tr/erp.po
+++ b/packages/locale/locales/tr/erp.po
@@ -3524,9 +3524,6 @@ msgstr "Bu değişiklik bildirisini silmek istediğinizden emin misiniz?"
msgid "Are you sure you want to delete this gauge?"
msgstr "Bu ölçüm aletini silmek istediğinizden emin misiniz?"
-msgid "Are you sure you want to delete this inspection plan?"
-msgstr "Bu kontrol planını silmek istediğinizden emin misiniz?"
-
msgid "Are you sure you want to delete this inspection plan? This cannot be undone."
msgstr "Bu kontrol planını silmek istediğinizden emin misiniz? Bu işlem geri alınamaz."
@@ -6225,9 +6222,6 @@ msgstr "Prosedürün benzersiz tanımlayıcısını kopyala"
msgid "Copy purchase invoice unique identifier"
msgstr "Alış faturası benzersiz tanıtıcısını kopyala"
-msgid "Copy purchase order number"
-msgstr "Satın alma siparişi numarasını kopyala"
-
msgid "Copy purchase order unique identifier"
msgstr "Satın alma siparişi benzersiz tanıtıcısını kopyala"
@@ -17501,6 +17495,9 @@ msgstr "Plan"
msgid "Plan ahead by projecting demand per item and location, then feed it straight into MRP and scheduling."
msgstr "Stok kartı ve lokasyon başına talep projeksiyonu yaparak önceden planlayın, sonra bunu doğrudan MRP ve planlama'ya besleyin."
+msgid "Plan Names"
+msgstr "Kontrol Planı Adları"
+
msgid "Plan the work"
msgstr "Çalışmayı planlayın"
@@ -21978,6 +21975,9 @@ msgstr "İlk 500 satır gösteriliyor"
msgid "Showing the newest 200 journals"
msgstr "En yeni 200 muhasebe fişi gösteriliyor"
+msgid "Showing the oldest orders only. Search or filter to see the rest."
+msgstr "Yalnızca en eski siparişler gösteriliyor. Kalanları görmek için ara veya filtrele."
+
msgid "Showing the top 1,000 groups by amount"
msgstr "Miktar açısından ilk 1.000 grup gösteriliyor"
diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.po
index 3c3eb03885..511864e21f 100644
--- a/packages/locale/locales/zh/erp.po
+++ b/packages/locale/locales/zh/erp.po
@@ -3524,9 +3524,6 @@ msgstr "确定要删除此变更通知吗?"
msgid "Are you sure you want to delete this gauge?"
msgstr "确定要删除此量具吗?"
-msgid "Are you sure you want to delete this inspection plan?"
-msgstr "你确定要删除此检验计划吗?"
-
msgid "Are you sure you want to delete this inspection plan? This cannot be undone."
msgstr "你确定要删除此检验计划吗?此操作无法撤销。"
@@ -6225,9 +6222,6 @@ msgstr "复制程序文件唯一标识符"
msgid "Copy purchase invoice unique identifier"
msgstr "复制采购发票唯一标识符"
-msgid "Copy purchase order number"
-msgstr "复制采购订单编号"
-
msgid "Copy purchase order unique identifier"
msgstr "复制采购订单唯一标识符"
@@ -17501,6 +17495,9 @@ msgstr "计划"
msgid "Plan ahead by projecting demand per item and location, then feed it straight into MRP and scheduling."
msgstr "通过按物料和地点投影需求进行超前规划,然后将其直接送入MRP和排程。"
+msgid "Plan Names"
+msgstr "检验计划名称"
+
msgid "Plan the work"
msgstr "规划工作"
@@ -21978,6 +21975,9 @@ msgstr "显示前500行"
msgid "Showing the newest 200 journals"
msgstr "显示最新的 200 个凭证"
+msgid "Showing the oldest orders only. Search or filter to see the rest."
+msgstr "仅显示最早的订单。请搜索或筛选以查看其余订单。"
+
msgid "Showing the top 1,000 groups by amount"
msgstr "按金额显示前1,000个分组"