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): gauges on inspections, inspection plans in Quality (#1780)

Brad Barbind65e7e564e70
diff --git a/.ai/lessons.md b/.ai/lessons.md
index 318f857151..5544256c47 100644
--- a/.ai/lessons.md
+++ b/.ai/lessons.md
@@ -2631,3 +2631,19 @@ failed but extra copies appeared", check all four before assuming a browser doub
`packages/auth/src/lib/supabase/client.ts` (`fetchWithRetry`, `isReplayable`),
`packages/jobs/src/inngest/functions/notifications/send-{email,slack}.ts`, and any
`<Button type="submit">` — enforced by `no-unguarded-submit` (`@carbon/checks`).
+
+## Rows inserted in one transaction share `createdAt`
+
+**Context:** The inspection plan editor listed features `ORDER BY "createdAt"`. The save
+RPC (`save_inspection_document_atomic`) creates every new feature in one transaction.
+
+**Problem:** `NOW()` is fixed for the whole transaction, so those features tie, and Postgres
+returns ties in heap order. An `UPDATE` writes a new tuple at the end of the heap, so the
+feature someone just edited dropped to the bottom after a reload. Its neighbour then sat in
+its place, and the edit read as "not saved" although the database had it.
+
+**Rule:** An `ORDER BY` on a timestamp that a batch insert sets needs a deterministic
+tiebreak (a label, a sort order, then the id). Never rely on insertion order surviving.
+
+**Applies to:** any list ordered by `createdAt` whose rows are written together — RPCs,
+Kysely transactions, `insertInto(...).values([...])`, seeds.
diff --git a/.claude/rules/chat-ai-sdk-info.md b/.claude/rules/chat-ai-sdk-info.md
index 59de2664c1..5b0d70ac1d 100644
--- a/.claude/rules/chat-ai-sdk-info.md
+++ b/.claude/rules/chat-ai-sdk-info.md
@@ -3,7 +3,7 @@ description: Vercel AI SDK usage in Carbon — versions, the v7 idioms in use, e
paths:
- "apps/erp/app/routes/api+/ai+/**"
- "apps/erp/app/modules/agent/**"
- - "apps/erp/app/modules/production/inspectionBalloonAnalyze.*"
+ - "apps/erp/app/modules/quality/quality.server.ts"
- "packages/utils/src/llm.ts"
- "packages/database/supabase/functions/lib/ai/**"
---
@@ -38,7 +38,7 @@ That is expected and nothing imports it.
|---|---|---|
| `apps/erp/app/routes/api+/ai+/csv+/$table.columns.tsx` | `gpt-4o` | Map CSV import columns → DB fields |
| `apps/erp/app/routes/x+/quote+/$quoteId.drag.tsx` | `gpt-4o-mini` | Parse 3D model filename → part id + revision |
-| `apps/erp/app/modules/production/inspectionBalloonAnalyze.server.ts` | `gpt-4o` | Vision: dimension callouts from drawing crops |
+| `apps/erp/app/modules/quality/quality.server.ts` (`runInspectionBalloonRegionVisionAnalysis`) | `gpt-4o` | Vision: dimension callouts from drawing crops |
| `packages/ee/src/accounting/core/account-mapping-ai.ts` | `openAiCategorizationModel` | Map GL accounts to a provider's chart |
| `packages/ee/src/paperless-parts/lib/lib.ts` (2) | `openAiCategorizationModel` | Substance / material properties |
| `packages/jobs/src/inngest/functions/tasks/onboard.ts` | `gpt-4o` | Lead quality (Warm/Cold) |
diff --git a/.claude/rules/inspection-system.md b/.claude/rules/inspection-system.md
index 43c8f71a3a..7c02fb7341 100644
--- a/.claude/rules/inspection-system.md
+++ b/.claude/rules/inspection-system.md
@@ -3,6 +3,9 @@ paths:
- "apps/erp/app/modules/quality/ui/Inspections/**"
- "apps/erp/app/modules/quality/quality.{server,service,models}.ts"
- "apps/erp/app/routes/x+/inspection+/**"
+ - "apps/erp/app/routes/x+/inspection-document+/**"
+ - "apps/erp/app/routes/x+/quality+/inspection-plans*.tsx"
+ - "apps/erp/app/modules/quality/ui/InspectionDocument/**"
- "apps/mes/app/components/Inspection/**"
- "apps/mes/app/routes/x+/inspection*.tsx"
- "packages/database/src/quality.ts"
@@ -140,6 +143,39 @@ Execution-layer tables (`20260722040401_inbound-inspection-execution.sql`):
RLS on all tables: standard SELECT/INSERT/UPDATE/DELETE gated by `quality_view/create/update/delete`.
+## Gauges (`20260929203517_inspection-gauges.sql`)
+
+- **Plan side** — `inspectionFeature.gaugeTypeId` (nullable FK → `gaugeType`,
+ ON DELETE SET NULL): the gauge TYPE a feature must be measured with. Edited in
+ the inspection plan editor's **Gauge Type** column (clearable = any gauge),
+ persisted by the `save_inspection_document_atomic` fork in that migration,
+ which refuses another company's gauge type (the FK alone would accept it).
+- **Execution side** — the gauge actually used is recorded per **lot × feature**
+ on `inspectionSamplingPlan.gaugeId` (+ `gaugeRecordedAt`), not per
+ measurement — one gauge per characteristic per lot, as SAP QM / FAI forms do.
+ Written by `recordInspectionGauge` (`@carbon/database/quality`): closed-lot
+ guard, company-scoped gauge, refuses `Inactive` gauges and a gauge whose type
+ differs from the feature's `gaugeTypeId`. A gauge recorded on a **closed** lot
+ (Passed/Failed/Partial) cannot be deleted — the trigger
+ `prevent_deleting_gauge_recorded_on_closed_inspection`
+ (`20261001022340_inspection-gauge-history.sql`) raises `23503`, which also refuses a
+ gauge-type delete reaching it through its cascade; set the gauge Inactive instead. Open
+ lots keep the FK's SET NULL, and a company wipe (`app.sync_in_progress`, or children
+ deleted first) is never blocked. Out-of-calibration is shown
+ (red icon in the cell, calibration status badge in the list) but does NOT block. Routes: ERP `x+/inspection+/$id.gauge.tsx`,
+ MES `x+/inspection-lot.$id.gauge.tsx` (`path.to.inspectionGauge`), quiet POSTs
+ like the measurement cells.
+- **Picker** — `InspectionGaugePicker` (ERP `ui/Inspections/`, touch-sized copy in
+ MES `components/Inspection/`): a button filling the whole Gauge cell opens a
+ search + list of Active gauges (the `gauges` view, filtered to the feature's
+ type). The loader also returns any gauge already recorded on the lot whatever
+ its status, so a gauge retired after use still shows by its readable id
+ ("(Inactive)") — that record is what a calibration recall reads. "Recently
+ used" comes first — `getRecentInspectionGauges` returns the
+ gauges most recently recorded at the lot's **station**: a Job Operation lot's
+ station is its operation's `workCenterId`; **all receipts are one station**.
+ No Gauge column on the no-document "Overall result" row.
+
## Receipt → inspection flow (`post-receipt/index.ts`, Supabase edge fn)
`packages/database/supabase/functions/post-receipt/index.ts` (inserts ~line 700):
@@ -306,8 +342,9 @@ GL/cost posting and `.ai/plans/2026-07-25-inspection-disposition-gl-posting.md`.
- **Server** — the transactional engine lives in **`@carbon/database/quality`**
(`packages/database/src/quality.ts`; moved 2026-07-26 so ERP and MES run one
engine). Every function takes a `Kysely<KyselyDatabase>` first param; ERP's
- `quality.server.ts` is thin wrappers currying `getDatabaseClient()` (names and
- signatures unchanged — ERP routes/tests untouched). `packages/database/src/sampling.ts`
+ `quality.server.ts` curries `getDatabaseClient()` into those engine calls, and
+ also holds the plan editor's server-only helpers (legacy save-payload
+ translation, the balloon-region vision call). `packages/database/src/sampling.ts`
re-exports the pure Deno `shared/sampling-engine.ts` node-side (client.ts
pattern); the engine consumes it, so package + edge share ONE resolver copy
(ERP's `samplingStandards.ts` client copy remains for UI previews).
@@ -374,11 +411,31 @@ GL/cost posting and `.ai/plans/2026-07-25-inspection-disposition-gl-posting.md`.
- **Inspection-required tracked entities post `On Hold`, not Available.** They are not on-hand
until released by sampling/disposition.
- **`trackedEntityId` is nullable** on samples; serial uniqueness is enforced by a *partial* index.
-- **Inspection *documents* are authored in the production module** (`inspectionDocument`/
+- **Inspection *documents* ("Inspection Plans") are authored in the quality module** (list
+ at `/x/quality/inspection-plans`, editor at `/x/inspection-document/{id}`; `inspectionDocument`/
`inspectionFeature`/`balloon` + `save_inspection_document_atomic`, newest def
- `20260722040401`) and are now *consumed* by this flow via the item's Receipt-usage
+ `20261001022635`) and are now *consumed* by this flow via the item's Receipt-usage
assignment. The lot references the document **live** — measurement rows store the
valuation at entry, so later tolerance edits never rewrite recorded results.
+- **The plan editor autosaves** — there is no Save button. A debounced effect posts the
+ whole diff to `x+/inspection-document+/$id.save.tsx` while the editor is quiet (a drag
+ saves when it ends), one save at a time; the toolbar shows Saving… / Saved / Could not
+ save, and leaving the page first flushes the save (`useBlocker`). The editor **mints the
+ ids** of the characteristics and balloons it creates (`ift_…` / `bbn_…`, `newFeatureId` /
+ `newBalloonId` in `ui/InspectionDocument/autosave.ts`), and the RPC inserts with them
+ (`20261001022635_inspection-plan-client-ids.sql`; a taken id fails the insert, it never
+ overwrites). So a row keeps one id from the moment it is drawn: an id the server has not
+ created yet is in the editor's unsaved set and goes out as a create, every edit marks its
+ row dirty, and `mergeSaveResponse` (tested) only swaps in the server copy of rows
+ untouched since the save went out. Deletes are always queued once a row has left the
+ browser (deleting an id the server never created is a no-op). Other callers may still
+ send `tempId` / `tempBalloonAnchorId` and read the `featureIdMap` / `balloonAnchorIdMap`
+ back. A PDF upload goes through the same save. The route skips revalidation after a
+ save (the response carries the rows).
+- **Features saved together share one `createdAt`** (the RPC is one transaction, `NOW()`
+ is fixed), so `ORDER BY "createdAt"` alone returns them in heap order, and an UPDATE
+ moves a row to the end. Anything listing features must break the tie — the editor sorts
+ by `createdAt`, then label (natural), then id, on load only.
- **Sample status is derived on document-driven lots** — do not add manual sample
pass/fail UI there; deviations resolve at disposition via MRB/NCR (spec decision).
- **Per-cell measurement saves are quiet** (plain `fetch`, no revalidation) — the grid and
diff --git a/.claude/rules/mcp-tools-reference.md b/.claude/rules/mcp-tools-reference.md
index 36a91380bc..d53dc477d2 100644
--- a/.claude/rules/mcp-tools-reference.md
+++ b/.claude/rules/mcp-tools-reference.md
@@ -523,6 +523,15 @@ the model context or the MCP dispatch.
*different*, still-current concept — don't conflate them.
- To block a tool from MCP, add its `<module>_<func>` name to
`MCP_BLOCKED_TOOL_NAMES` and regenerate metadata.
+- **Moving a service function to another module RENAMES its published tool**
+ (`production_getInspectionDocument` → `quality_getInspectionDocument`). Add the
+ old name to `OPERATION_ALIASES` (`api+/v1+/lib/operations.server.ts`) in the same
+ change. `operationsByName` maps the old name to the NEW entry, so `call_tool`,
+ `describe_tool` (which prints a deprecation line), the agent, workflows and
+ `callOperation` all resolve it; `router.server.ts` mounts the old HTTP path,
+ marked `deprecated` in the spec. The alias runs and is gated as the new
+ operation (its permission, not the old module's). Search and the docs never list
+ aliases. `dispatch-parity.test.ts` fails on a dangling or shadowing alias.
- **A `{module}.service.ts` must not import a `*.server` module** (`@carbon/auth/users.server`,
`@carbon/ee/rules.server`, an app `*.server.ts`, …) — even via `await import(...)`.
The module barrel (`~/modules/{module}`) re-exports the service, and client components
diff --git a/apps/erp/app/components/Form/InspectionDocument.tsx b/apps/erp/app/components/Form/InspectionDocument.tsx
index 2180667c40..8f80e7eb29 100644
--- a/apps/erp/app/components/Form/InspectionDocument.tsx
+++ b/apps/erp/app/components/Form/InspectionDocument.tsx
@@ -3,7 +3,7 @@ import { Combobox } from "@carbon/form";
import { HStack } from "@carbon/react";
import { useEffect, useMemo } from "react";
import { useFetcher } from "react-router";
-import type { getInspectionDocumentsForItem } from "~/modules/production/production.service";
+import type { getInspectionDocumentsForItem } from "~/modules/quality/quality.service";
import { path } from "~/utils/path";
type InspectionDocumentSelectProps = Omit<ComboboxProps, "options"> & {
diff --git a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx
index 93016ddffb..fcf6afb568 100644
--- a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx
+++ b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx
@@ -2,6 +2,7 @@ import type { Json } from "@carbon/database";
import { DatePicker, InputControlled, ValidatedForm } from "@carbon/form";
import {
Button,
+ Copy,
HStack,
IconButton,
Subheading,
@@ -13,7 +14,13 @@ import {
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useCallback, useEffect } from "react";
-import { LuCopy, LuInfo, LuLink, LuRefreshCcw } from "react-icons/lu";
+import {
+ LuCopy,
+ LuInfo,
+ LuKeySquare,
+ LuLink,
+ LuRefreshCcw
+} from "react-icons/lu";
import { useFetcher, useParams } from "react-router";
import { z } from "zod";
import { zfd } from "zod-form-data";
@@ -144,6 +151,13 @@ const PurchaseInvoiceProperties = () => {
<span>Copy link to Purchase Invoice</span>
</TooltipContent>
</Tooltip>
+ <Copy
+ text={invoiceId}
+ label={t`Copy purchase invoice unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx
index 2083585fc5..e76fadb22a 100644
--- a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx
+++ b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx
@@ -2,6 +2,7 @@ import type { Json } from "@carbon/database";
import { DatePicker, InputControlled, ValidatedForm } from "@carbon/form";
import {
Button,
+ Copy,
HStack,
IconButton,
Subheading,
@@ -13,7 +14,13 @@ import {
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useCallback, useEffect } from "react";
-import { LuCopy, LuInfo, LuLink, LuRefreshCcw } from "react-icons/lu";
+import {
+ LuCopy,
+ LuInfo,
+ LuKeySquare,
+ LuLink,
+ LuRefreshCcw
+} from "react-icons/lu";
import { useFetcher, useParams } from "react-router";
import { z } from "zod";
import { zfd } from "zod-form-data";
@@ -138,6 +145,13 @@ const SalesInvoiceProperties = () => {
<span>Copy link to Sales Invoice</span>
</TooltipContent>
</Tooltip>
+ <Copy
+ text={invoiceId}
+ label={t`Copy sales invoice unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/items/ui/ChangeNotice/ChangeNoticeProperties.tsx b/apps/erp/app/modules/items/ui/ChangeNotice/ChangeNoticeProperties.tsx
index a7871bec5d..f807552302 100644
--- a/apps/erp/app/modules/items/ui/ChangeNotice/ChangeNoticeProperties.tsx
+++ b/apps/erp/app/modules/items/ui/ChangeNotice/ChangeNoticeProperties.tsx
@@ -6,6 +6,7 @@ import {
} from "@carbon/form";
import {
Button,
+ Copy,
HStack,
Separator,
Subheading,
@@ -18,7 +19,7 @@ import {
import { Trans, useLingui } from "@lingui/react/macro";
import type { ReactNode } from "react";
import { useCallback, useEffect } from "react";
-import { LuLink } from "react-icons/lu";
+import { LuKeySquare, LuLink } from "react-icons/lu";
import { Link, useFetcher, useNavigate, useParams } from "react-router";
import { z } from "zod";
import { Assignee, EmployeeAvatar } from "~/components";
@@ -154,26 +155,35 @@ const ChangeNoticeProperties = () => {
<Subheading as="h3" variant="light">
<Trans>Properties</Trans>
</Subheading>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- variant="ghost"
- aria-label={t`Copy link`}
- size="sm"
- className="p-1"
- onClick={() =>
- copyToClipboard(
- window.location.origin + path.to.changeNotice(id)
- )
- }
- >
- <LuLink className="w-3 h-3" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <Trans>Copy link to change notice</Trans>
- </TooltipContent>
- </Tooltip>
+ <HStack spacing={1}>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ aria-label={t`Copy link`}
+ size="sm"
+ className="p-1"
+ onClick={() =>
+ copyToClipboard(
+ window.location.origin + path.to.changeNotice(id)
+ )
+ }
+ >
+ <LuLink className="w-3 h-3" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <Trans>Copy link to change notice</Trans>
+ </TooltipContent>
+ </Tooltip>
+ <Copy
+ text={id}
+ label={t`Copy change notice unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
+ </HStack>
</HStack>
<VStack spacing={1}>
<span className="text-sm tracking-tight">
diff --git a/apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx b/apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx
index a863ee40d3..dad40b01c4 100644
--- a/apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx
+++ b/apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx
@@ -3,6 +3,7 @@ import { InputControlled, Select, ValidatedForm } from "@carbon/form";
import {
Badge,
Button,
+ Copy,
HStack,
Subheading,
Tooltip,
@@ -13,7 +14,7 @@ import {
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { Suspense, useCallback, useEffect } from "react";
-import { LuCopy, LuLink } from "react-icons/lu";
+import { LuCopy, LuKeySquare, LuLink } from "react-icons/lu";
import { Await, Link, useFetcher, useParams } from "react-router";
import { z } from "zod";
import { zfd } from "zod-form-data";
@@ -229,6 +230,13 @@ const ConsumableProperties = ({ data }: ConsumablePropertiesProps) => {
</span>
</TooltipContent>
</Tooltip>
+ <Copy
+ text={itemId}
+ label={t`Copy consumable unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
diff --git a/apps/erp/app/modules/items/ui/Materials/MaterialProperties.tsx b/apps/erp/app/modules/items/ui/Materials/MaterialProperties.tsx
index 579e38e1f5..9bb3d28e16 100644
--- a/apps/erp/app/modules/items/ui/Materials/MaterialProperties.tsx
+++ b/apps/erp/app/modules/items/ui/Materials/MaterialProperties.tsx
@@ -5,6 +5,7 @@ import {
AlertTitle,
Badge,
Button,
+ Copy,
HStack,
Modal,
ModalBody,
@@ -327,26 +328,13 @@ const MaterialProperties = ({ data }: MaterialPropertiesProps) => {
</span>
</TooltipContent>
</Tooltip>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- variant="ghost"
- aria-label={t`Copy`}
- size="sm"
- className="p-1"
- onClick={() =>
- copyToClipboard(routeData?.materialSummary?.id ?? "")
- }
- >
- <LuKeySquare className="w-3 h-3" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <span>
- <Trans>Copy material unique identifier</Trans>
- </span>
- </TooltipContent>
- </Tooltip>
+ <Copy
+ text={routeData?.materialSummary?.id ?? ""}
+ label={t`Copy material unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/items/ui/Parts/PartProperties.tsx b/apps/erp/app/modules/items/ui/Parts/PartProperties.tsx
index f6e0b9c276..e17d975126 100644
--- a/apps/erp/app/modules/items/ui/Parts/PartProperties.tsx
+++ b/apps/erp/app/modules/items/ui/Parts/PartProperties.tsx
@@ -3,6 +3,7 @@ import { InputControlled, Select, ValidatedForm } from "@carbon/form";
import {
Badge,
Button,
+ Copy,
cn,
HStack,
Subheading,
@@ -409,24 +410,13 @@ const PartProperties = ({
</span>
</TooltipContent>
</Tooltip>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- variant="ghost"
- aria-label={t`Copy`}
- size="sm"
- className="p-1"
- onClick={() => copyToClipboard(itemId)}
- >
- <LuKeySquare className="w-3 h-3" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <span>
- <Trans>Copy part unique identifier</Trans>
- </span>
- </TooltipContent>
- </Tooltip>
+ <Copy
+ text={itemId}
+ label={t`Copy part unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/items/ui/Services/ServiceProperties.tsx b/apps/erp/app/modules/items/ui/Services/ServiceProperties.tsx
index a200fb88ef..85172a86ae 100644
--- a/apps/erp/app/modules/items/ui/Services/ServiceProperties.tsx
+++ b/apps/erp/app/modules/items/ui/Services/ServiceProperties.tsx
@@ -3,6 +3,7 @@ import { InputControlled, Select, ValidatedForm } from "@carbon/form";
import {
Badge,
Button,
+ Copy,
HStack,
Subheading,
Tooltip,
@@ -186,26 +187,13 @@ const ServiceProperties = ({ data }: ServicePropertiesProps) => {
</span>
</TooltipContent>
</Tooltip>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- variant="ghost"
- aria-label={t`Copy`}
- size="sm"
- className="p-1"
- onClick={() =>
- copyToClipboard(routeData?.serviceSummary?.id ?? "")
- }
- >
- <LuKeySquare className="w-3 h-3" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <span>
- <Trans>Copy service unique identifier</Trans>
- </span>
- </TooltipContent>
- </Tooltip>
+ <Copy
+ text={routeData?.serviceSummary?.id ?? ""}
+ label={t`Copy service unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/items/ui/Tools/ToolProperties.tsx b/apps/erp/app/modules/items/ui/Tools/ToolProperties.tsx
index 1b58390671..ba4ec3f34f 100644
--- a/apps/erp/app/modules/items/ui/Tools/ToolProperties.tsx
+++ b/apps/erp/app/modules/items/ui/Tools/ToolProperties.tsx
@@ -3,6 +3,7 @@ import { InputControlled, Select, ValidatedForm } from "@carbon/form";
import {
Badge,
Button,
+ Copy,
HStack,
Subheading,
Tooltip,
@@ -243,26 +244,13 @@ const ToolProperties = ({ data }: ToolPropertiesProps) => {
</span>
</TooltipContent>
</Tooltip>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- variant="ghost"
- aria-label={t`Copy`}
- size="sm"
- className="p-1"
- onClick={() =>
- copyToClipboard(routeData?.toolSummary?.id ?? "")
- }
- >
- <LuKeySquare className="w-3 h-3" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <span>
- <Trans>Copy tool unique identifier</Trans>
- </span>
- </TooltipContent>
- </Tooltip>
+ <Copy
+ text={routeData?.toolSummary?.id ?? ""}
+ label={t`Copy tool unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/production/index.ts b/apps/erp/app/modules/production/index.ts
index 5a03a8e61a..ef8f9462f1 100644
--- a/apps/erp/app/modules/production/index.ts
+++ b/apps/erp/app/modules/production/index.ts
@@ -1,4 +1,3 @@
-export * from "./inspectionBalloonAnalyze";
export * from "./production.models";
export * from "./production.service";
// @ts-ignore
diff --git a/apps/erp/app/modules/production/inspectionBalloonAnalyze.server.ts b/apps/erp/app/modules/production/inspectionBalloonAnalyze.server.ts
deleted file mode 100644
index c66750f099..0000000000
--- a/apps/erp/app/modules/production/inspectionBalloonAnalyze.server.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-import { openai } from "@ai-sdk/openai";
-import { generateText, Output } from "ai";
-import {
- type BalloonRegionAnalysis,
- balloonRegionAnalysisResultSchema
-} from "./inspectionBalloonAnalyze";
-
-/** Decoded image size limit for vision analyze (bytes). */
-export const INSPECTION_BALLOON_ANALYZE_MAX_IMAGE_BYTES = 12 * 1024 * 1024;
-
-const BALLOON_REGION_ANALYSIS_SYSTEM = `You assist with mechanical inspection ballooning on technical CAD drawings.
-
-You receive one raster image: a crop of a single callout region from a sheet.
-
-Return ONLY the JSON object matching the schema (field names and allowed enum values exactly).
-
-type (required, exactly one of):
-- linear — linear length/width/height dimension without ⌀ or R prefix.
-- diameter — nominal is the value for a diameter callout (⌀ or equivalent).
-- radius — nominal is the value for a radius callout (R or equivalent).
-- angle — nominal is the numeric angle; set unit to degree or rad only when °, deg, or rad is visible in the crop; otherwise unit null.
-- unknown — not clearly one of the above, or unreadable / ambiguous.
-
-unit (nullable, exactly one of the allowed enum strings or null):
-- Default is null. Set unit ONLY when this crop visibly shows a unit indicator (e.g. mm, cm, m, um, µm, in, ", IN, ft, °, DEG, RAD, or equivalent text/symbols next to the dimension).
-- Do NOT infer unit from decimal places, title block, drawing "standard," locale, or anything outside visible pixels in this crop. A bare number with tolerances but no unit text/symbol → unit null.
-- For type angle: use degree or rad only when that angle notation is visible; otherwise unit null.
-
-nominal / tolerances:
-- Prefer numbers from the print; use null (not zero) when not shown or unreadable.
-- Bilateral ±T: tol_plus = +T, tol_minus = -T (e.g. ±0.02 → tol_plus 0.02, tol_minus -0.02).
-- Unilateral stacked +0.005 / -0.000 (plus above, minus below nominal): tol_plus = 0.005, tol_minus = 0 (minus side is zero additional tolerance below nominal).
-- Other asymmetric +a / −b (both non-zero): tol_plus = +a, tol_minus = -b using the signed values as printed relative to nominal.
-
-Do not invent title-block or revision data outside the crop.
-`;
-
-const BALLOON_REGION_ANALYSIS_USER_MESSAGE =
- "Extract nominal, tol_plus, tol_minus, unit, and type per the system rules. For unit: use null unless a unit symbol or unit letters are literally visible in this crop; do not guess. Use only allowed enum literals for type and for unit when non-null.";
-
-const BALLOON_REGION_ANALYSIS_SCHEMA_DESCRIPTION =
- "Drawing crop: nominal, tolerances, type enum; unit enum only when a unit symbol/text is visible in the crop, otherwise null";
-
-/**
- * Runs vision extraction on a prepared PNG/JPEG/WebP buffer (caller validates size and auth).
- */
-export async function runInspectionBalloonRegionVisionAnalysis(args: {
- imageBytes: Buffer;
- mediaType: string;
-}): Promise<BalloonRegionAnalysis> {
- const { imageBytes, mediaType } = args;
- const { output: object } = await generateText({
- model: openai("gpt-4o"),
- output: Output.object({
- schema: balloonRegionAnalysisResultSchema,
- name: "balloon_region_analysis",
- description: BALLOON_REGION_ANALYSIS_SCHEMA_DESCRIPTION
- }),
- instructions: BALLOON_REGION_ANALYSIS_SYSTEM,
- messages: [
- {
- role: "user",
- content: [
- { type: "text", text: BALLOON_REGION_ANALYSIS_USER_MESSAGE },
- {
- type: "image",
- image: imageBytes,
- mediaType
- }
- ]
- }
- ],
- temperature: 0.1
- });
- return object;
-}
diff --git a/apps/erp/app/modules/production/inspectionBalloonAnalyze.ts b/apps/erp/app/modules/production/inspectionBalloonAnalyze.ts
deleted file mode 100644
index e426dbe123..0000000000
--- a/apps/erp/app/modules/production/inspectionBalloonAnalyze.ts
+++ /dev/null
@@ -1,85 +0,0 @@
-import { z } from "zod";
-
-/**
- * POST `/api/production/inspection-document/:inspectionDocumentId/balloon-analyze` — request body
- * uses `balloonRegionAnalysisRequestSchema`. Successful JSON body includes `analysis`
- * matching `balloonRegionAnalysisResultSchema`:
- *
- * - `nominal`, `tol_plus`, `tol_minus`: number or `null` (no free-text dimensions).
- * - `type`: always one of `balloonRegionFeatureTypes` (use `unknown` when not classifiable).
- * - `unit`: one of `balloonRegionUnits` only when a unit symbol/text is visible in the crop;
- * otherwise `null` (clients must not assume a default unit).
- *
- * Breaking change vs legacy: `type` and `unit` are closed vocabularies, not arbitrary strings.
- *
- * Server-only vision + prompts: `inspectionBalloonAnalyze.server.ts` (not exported from `index.ts`).
- */
-
-/** POST body for `/api/production/inspection-document/:id/balloon-analyze` */
-export const balloonRegionAnalysisRequestSchema = z.object({
- /** Base64-encoded image bytes (no `data:` prefix). */
- imageBase64: z.string().min(1).max(28_000_000),
- mediaType: z.enum(["image/png", "image/jpeg", "image/webp"]).optional()
-});
-
-/** Allowed `type` values for vision extraction (strict contract). */
-export const balloonRegionFeatureTypes = [
- "linear",
- "diameter",
- "radius",
- "angle",
- "unknown"
-] as const;
-
-/** Allowed `unit` literals when a unit is visibly present in the crop; otherwise API returns `null`. */
-export const balloonRegionUnits = [
- "mm",
- "cm",
- "m",
- "in",
- "ft",
- "um",
- "degree",
- "rad"
-] as const;
-
-export type BalloonRegionFeatureType =
- (typeof balloonRegionFeatureTypes)[number];
-export type BalloonRegionUnit = (typeof balloonRegionUnits)[number];
-
-/** Structured extraction from a cropped engineering-drawing region. */
-export const balloonRegionAnalysisResultSchema = z.object({
- nominal: z
- .number()
- .nullable()
- .describe(
- "Primary scalar from the dimension (length, diameter, radius, or angle magnitude). Null if unreadable."
- ),
- tol_plus: z
- .number()
- .nullable()
- .describe(
- "Upper tolerance vs nominal: bilateral ±T → +T; unilateral +a / −b → +a as printed (e.g. +0.005 → 0.005)."
- ),
- tol_minus: z
- .number()
- .nullable()
- .describe(
- "Lower tolerance vs nominal: bilateral ±T → −T (e.g. −0.02); unilateral +0.005 / −0.000 → 0 for a −.000 stack (no extra material below nominal on minus side)."
- ),
- unit: z
- .enum(balloonRegionUnits)
- .nullable()
- .describe(
- 'Allowed enum or null. Null unless unit text/symbol is visible in the crop (e.g. mm, in, ", °). Never infer from decimals or title block. For angles: degree or rad only when that notation appears; else null.'
- ),
- type: z
- .enum(balloonRegionFeatureTypes)
- .describe(
- "Feature kind: linear, diameter, radius, angle, or unknown when ambiguous or not a simple dimension."
- )
-});
-
-export type BalloonRegionAnalysis = z.infer<
- typeof balloonRegionAnalysisResultSchema
->;
diff --git a/apps/erp/app/modules/production/inspectionDocumentDb.ts b/apps/erp/app/modules/production/inspectionDocumentDb.ts
deleted file mode 100644
index 947cbf20f6..0000000000
--- a/apps/erp/app/modules/production/inspectionDocumentDb.ts
+++ /dev/null
@@ -1,151 +0,0 @@
-import type { Database } from "@carbon/database";
-import type { SupabaseClient } from "@supabase/supabase-js";
-
-type ProcedureStepType = Database["public"]["Enums"]["procedureStepType"];
-
-/** Row shapes for inspection tables until `pnpm db:types` includes them. */
-export type InspectionFeatureRow = {
- id: string;
- inspectionDocumentId: string;
- companyId: string;
- pageNumber: number;
- label: string;
- description: string | null;
- nominalValue: string | null;
- tolerancePlus: string | null;
- toleranceMinus: string | null;
- unit: string | null;
- type: ProcedureStepType;
- samplingPlanType: Database["public"]["Enums"]["samplingPlanType"] | null;
- samplingSampleSize: number | null;
- samplingPercentage: number | null;
- samplingAql: number | null;
- samplingInspectionLevel:
- | Database["public"]["Enums"]["inspectionLevel"]
- | null;
- samplingSeverity: Database["public"]["Enums"]["inspectionSeverity"] | null;
- createdBy: string;
- createdAt: string;
- updatedBy: string | null;
- updatedAt: string | null;
-};
-
-export type BalloonRow = {
- id: string;
- inspectionDocumentId: string;
- companyId: string;
- inspectionFeatureId: string;
- pageNumber: number;
- regionX: number;
- regionY: number;
- regionWidth: number;
- regionHeight: number;
- xCoordinate: number;
- yCoordinate: number;
- createdBy: string;
- createdAt: string;
- updatedBy: string | null;
- updatedAt: string | null;
-};
-
-type InspectionDbClient = {
- from: (table: "inspectionFeature" | "balloon" | "inspectionDocument") => {
- select: (columns?: string) => {
- eq: (
- column: string,
- value: unknown
- ) => {
- order: (
- column: string,
- opts: { ascending: boolean }
- ) => Promise<{ data: unknown[] | null; error: unknown }>;
- single: () => Promise<{ data: unknown | null; error: unknown }>;
- is: (
- column: string,
- value: null
- ) => {
- order: (
- column: string,
- opts?: { ascending?: boolean }
- ) => {
- order: (
- column: string,
- opts?: { ascending?: boolean }
- ) => Promise<{ data: unknown[] | null; error: unknown }>;
- };
- };
- };
- };
- delete: () => {
- eq: (column: string, value: unknown) => Promise<{ error: unknown }>;
- };
- };
-};
-
-export function inspectionDb(client: SupabaseClient<Database>) {
- return client as unknown as InspectionDbClient;
-}
-
-export async function listInspectionFeatures(
- client: SupabaseClient<Database>,
- inspectionDocumentId: string
-) {
- const result = await inspectionDb(client)
- .from("inspectionFeature")
- .select("*")
- .eq("inspectionDocumentId", inspectionDocumentId)
- .order("createdAt", { ascending: true });
-
- return {
- data: (result.data ?? []) as InspectionFeatureRow[],
- error: result.error
- };
-}
-
-export async function listBalloons(
- client: SupabaseClient<Database>,
- inspectionDocumentId: string
-) {
- const result = await inspectionDb(client)
- .from("balloon")
- .select("*")
- .eq("inspectionDocumentId", inspectionDocumentId)
- .order("createdAt", { ascending: true });
-
- return {
- data: (result.data ?? []) as BalloonRow[],
- error: result.error
- };
-}
-
-/** Maps persisted balloon ids to inspectionFeature ids for legacy save payloads. */
-export async function mapBalloonIdsToFeatureIdsForDocument(
- client: SupabaseClient<Database>,
- inspectionDocumentId: string,
- ids: string[]
-) {
- const unique = [...new Set(ids.filter((id) => id.length > 0))];
- const mapped = new Map<string, string>();
- for (const id of unique) {
- mapped.set(id, id);
- }
-
- const balloonsResult = await listBalloons(client, inspectionDocumentId);
- for (const balloon of balloonsResult.data ?? []) {
- if (mapped.has(balloon.id)) {
- mapped.set(balloon.id, balloon.inspectionFeatureId);
- }
- }
-
- const featuresResult = await listInspectionFeatures(
- client,
- inspectionDocumentId
- );
- for (const row of featuresResult.data ?? []) {
- if (mapped.has(row.id)) {
- mapped.set(row.id, row.id);
- }
- }
-
- return mapped;
-}
diff --git a/apps/erp/app/modules/production/inspectionDocumentSave.server.ts b/apps/erp/app/modules/production/inspectionDocumentSave.server.ts
deleted file mode 100644
index 4045bfa023..0000000000
--- a/apps/erp/app/modules/production/inspectionDocumentSave.server.ts
+++ /dev/null
@@ -1,202 +0,0 @@
-import type { Database } from "@carbon/database";
-import type { SupabaseClient } from "@supabase/supabase-js";
-import { mapBalloonIdsToFeatureIdsForDocument } from "./inspectionDocumentDb";
-import type {
- inspectionSaveAnchorsPayloadValidator,
- inspectionSaveBalloonsGeometryPayloadValidator,
- inspectionSaveBalloonsPayloadValidator,
- inspectionSaveFeaturesPayloadValidator
-} from "./production.models";
-
-export type InspectionSaveFeaturesPayload = ReturnType<
- typeof inspectionSaveFeaturesPayloadValidator.parse
->;
-export type InspectionSaveBalloonsGeometryPayload = ReturnType<
- typeof inspectionSaveBalloonsGeometryPayloadValidator.parse
->;
-type LegacyAnchors = ReturnType<
- typeof inspectionSaveAnchorsPayloadValidator.parse
->;
-type LegacyBalloons = ReturnType<
- typeof inspectionSaveBalloonsPayloadValidator.parse
->;
-
-export function isTempInspectionId(id: string) {
- return id.startsWith("temp-");
-}
-
-/** Maps legacy anchors + metadata balloons save shape to features + geometry balloons. */
-export function translateLegacyInspectionSavePayload(
- anchors: LegacyAnchors,
- balloons: LegacyBalloons
-): {
- features: InspectionSaveFeaturesPayload;
- balloons: InspectionSaveBalloonsGeometryPayload;
-} {
- const anchorByTempId = new Map(anchors.create.map((a) => [a.tempId, a]));
-
- const featuresCreate = balloons.create.map((b) => {
- const anchor = anchorByTempId.get(b.tempBalloonAnchorId);
- return {
- tempId: b.tempBalloonAnchorId,
- pageNumber: anchor?.pageNumber ?? 1,
- label: b.label,
- description: b.description ?? null,
- nominalValue: b.nominalValue ?? null,
- tolerancePlus: b.tolerancePlus ?? null,
- toleranceMinus: b.toleranceMinus ?? null,
- unit: b.unit ?? null
- };
- });
-
- for (const anchor of anchors.create) {
- if (featuresCreate.some((f) => f.tempId === anchor.tempId)) continue;
- featuresCreate.push({
- tempId: anchor.tempId,
- pageNumber: anchor.pageNumber,
- label: "0",
- description: null,
- nominalValue: null,
- tolerancePlus: null,
- toleranceMinus: null,
- unit: null
- });
- }
-
- const balloonsCreate = balloons.create.map((b) => {
- const anchor = anchorByTempId.get(b.tempBalloonAnchorId);
- return {
- tempInspectionFeatureId: b.tempBalloonAnchorId,
- tempBalloonAnchorId: b.tempBalloonAnchorId,
- pageNumber: anchor?.pageNumber ?? 1,
- regionX: anchor?.xCoordinate ?? 0,
- regionY: anchor?.yCoordinate ?? 0,
- regionWidth: anchor?.width ?? 0.1,
- regionHeight: anchor?.height ?? 0.1,
- xCoordinate: b.xCoordinate,
- yCoordinate: b.yCoordinate
- };
- });
-
- for (const anchor of anchors.create) {
- if (balloons.create.some((b) => b.tempBalloonAnchorId === anchor.tempId)) {
- continue;
- }
- balloonsCreate.push({
- tempInspectionFeatureId: anchor.tempId,
- tempBalloonAnchorId: anchor.tempId,
- pageNumber: anchor.pageNumber,
- regionX: anchor.xCoordinate,
- regionY: anchor.yCoordinate,
- regionWidth: anchor.width,
- regionHeight: anchor.height,
- xCoordinate: Math.min(
- 1 - 0.04,
- Math.max(0, anchor.xCoordinate + anchor.width + 0.02)
- ),
- yCoordinate: Math.min(1 - 0.04, Math.max(0, anchor.yCoordinate))
- });
- }
-
- const featuresUpdate = balloons.update.map((b) => ({
- id: b.id,
- label: b.label,
- description: b.description ?? null,
- nominalValue: b.nominalValue ?? null,
- tolerancePlus: b.tolerancePlus ?? null,
- toleranceMinus: b.toleranceMinus ?? null,
- unit: b.unit ?? null
- }));
-
- const balloonsUpdate = [
- ...anchors.update.map((a) => ({
- id: a.id,
- pageNumber: a.pageNumber,
- regionX: a.xCoordinate,
- regionY: a.yCoordinate,
- regionWidth: a.width,
- regionHeight: a.height
- })),
- ...balloons.update.map((b) => ({
- id: b.id,
- xCoordinate: b.xCoordinate,
- yCoordinate: b.yCoordinate
- }))
- ];
-
- const mergedBalloonUpdates = new Map<
- string,
- (typeof balloonsUpdate)[number]
- >();
- for (const item of balloonsUpdate) {
- const existing = mergedBalloonUpdates.get(item.id);
- mergedBalloonUpdates.set(item.id, { ...existing, ...item });
- }
-
- return {
- features: {
- create: featuresCreate,
- update: featuresUpdate,
- delete: [...new Set([...balloons.delete, ...anchors.delete])]
- },
- balloons: {
- create: balloonsCreate,
- update: [...mergedBalloonUpdates.values()],
- delete: []
- }
- };
-}
-
-export function mergeInspectionFeaturesPayload(
- base: InspectionSaveFeaturesPayload,
- extra: InspectionSaveFeaturesPayload
-): InspectionSaveFeaturesPayload {
- return {
- create: [...base.create, ...extra.create],
- update: [...base.update, ...extra.update],
- delete: [...new Set([...base.delete, ...extra.delete])]
- };
-}
-
-export function mergeInspectionBalloonsPayload(
- base: InspectionSaveBalloonsGeometryPayload,
- extra: InspectionSaveBalloonsGeometryPayload
-): InspectionSaveBalloonsGeometryPayload {
- return {
- create: [...base.create, ...extra.create],
- update: [...base.update, ...extra.update],
- delete: [...new Set([...base.delete, ...extra.delete])]
- };
-}
-
-export async function resolveInspectionFeaturePayloadIds(
- client: SupabaseClient<Database>,
- inspectionDocumentId: string,
- features: InspectionSaveFeaturesPayload
-): Promise<InspectionSaveFeaturesPayload> {
- const ids = [
- ...features.update.map((row) => row.id),
- ...features.delete
- ].filter((rowId) => !isTempInspectionId(rowId));
-
- if (ids.length === 0) {
- return features;
- }
-
- const idMap = await mapBalloonIdsToFeatureIdsForDocument(
- client,
- inspectionDocumentId,
- ids
- );
-
- return {
- create: features.create,
- update: features.update.map((row) => ({
- ...row,
- id: idMap.get(row.id) ?? row.id
- })),
- delete: [
- ...new Set(features.delete.map((rowId) => idMap.get(rowId) ?? rowId))
- ]
- };
-}
diff --git a/apps/erp/app/modules/production/inspectionDocumentSave.test.ts b/apps/erp/app/modules/production/inspectionDocumentSave.test.ts
deleted file mode 100644
index b2ba2e00bb..0000000000
--- a/apps/erp/app/modules/production/inspectionDocumentSave.test.ts
+++ /dev/null
@@ -1,84 +0,0 @@
-import { describe, expect, it } from "vitest";
-import { translateLegacyInspectionSavePayload } from "./inspectionDocumentSave.server";
-
-describe("translateLegacyInspectionSavePayload", () => {
- it("maps combined balloon+anchor create to feature and geometry create", () => {
- const result = translateLegacyInspectionSavePayload(
- {
- create: [
- {
- tempId: "temp-a1",
- pageNumber: 1,
- xCoordinate: 0.1,
- yCoordinate: 0.2,
- width: 0.05,
- height: 0.04
- }
- ],
- update: [],
- delete: []
- },
- {
- create: [
- {
- tempBalloonAnchorId: "temp-a1",
- label: "1",
- xCoordinate: 0.15,
- yCoordinate: 0.25,
- description: "Diameter",
- nominalValue: "10",
- tolerancePlus: "0.1",
- toleranceMinus: "0.1",
- unit: "mm"
- }
- ],
- update: [],
- delete: []
- }
- );
-
- expect(result.features.create).toHaveLength(1);
- expect(result.features.create[0]).toMatchObject({
- tempId: "temp-a1",
- label: "1",
- description: "Diameter",
- unit: "mm"
- });
- expect(result.balloons.create).toHaveLength(1);
- expect(result.balloons.create[0]).toMatchObject({
- tempInspectionFeatureId: "temp-a1",
- tempBalloonAnchorId: "temp-a1",
- regionX: 0.1,
- xCoordinate: 0.15
- });
- });
-
- it("creates anchor-only rows as feature with default label", () => {
- const result = translateLegacyInspectionSavePayload(
- {
- create: [
- {
- tempId: "temp-anchor-only",
- pageNumber: 2,
- xCoordinate: 0,
- yCoordinate: 0,
- width: 0.1,
- height: 0.1
- }
- ],
- update: [],
- delete: []
- },
- { create: [], update: [], delete: [] }
- );
-
- expect(result.features.create).toEqual([
- expect.objectContaining({
- tempId: "temp-anchor-only",
- label: "0",
- pageNumber: 2
- })
- ]);
- expect(result.balloons.create).toHaveLength(1);
- });
-});
diff --git a/apps/erp/app/modules/production/production.models.ts b/apps/erp/app/modules/production/production.models.ts
index 016d430ea0..f05d0401c7 100644
--- a/apps/erp/app/modules/production/production.models.ts
+++ b/apps/erp/app/modules/production/production.models.ts
@@ -2,11 +2,6 @@ import type { Database } from "@carbon/database";
import { parseDate } from "@internationalized/date";
import { z } from "zod";
import { zfd } from "zod-form-data";
-import {
- inspectionLevels,
- inspectionSeverities,
- samplingPlanTypes
-} from "../quality/samplingStandards";
import {
methodItemType,
methodOperationOrders,
@@ -1759,297 +1754,6 @@ export function getJobOrderStatusCategory(
return null;
}
-// ─── Inspection Documents ─────────────────────────────────────────────────────
-
-export const inspectionDocumentValidator = z.object({
- id: zfd.text(z.string().optional()),
- name: zfd.text(z.string().optional()),
- partId: z.string().min(1, { message: "Part is required" }),
- drawingNumber: zfd.text(z.string().optional()),
- pdfUrl: zfd.text(z.string().optional()),
- annotations: zfd.text(z.string().optional()),
- features: zfd.text(z.string().optional())
-});
-
-export const balloonFeatureValidator = z.object({
- id: zfd.text(z.string().optional()),
- inspectionDocumentId: z.string().min(1, { message: "Diagram is required" }),
- balloonNumber: zfd.numeric(z.number().min(1)),
- description: z.string().min(1, { message: "Description is required" }),
- nominalValue: zfd.numeric(z.number().optional()),
- tolerancePlus: zfd.numeric(z.number().optional()),
- toleranceMinus: zfd.numeric(z.number().optional()),
- unitOfMeasureCode: zfd.text(z.string().optional())
-});
-
-export const balloonCreateFromPayloadItemValidator = z.object({
- pageNumber: z.number(),
- regionX: z.number(),
- regionY: z.number(),
- regionWidth: z.number(),
- regionHeight: z.number(),
- label: z.string().min(1),
- xCoordinate: z.number(),
- yCoordinate: z.number(),
- nominalValue: z.string().nullable().optional(),
- tolerancePlus: z.string().nullable().optional(),
- toleranceMinus: z.string().nullable().optional(),
- unit: z.string().nullable().optional(),
- description: z.string().nullable().optional()
-});
-
-export const balloonUpdateItemValidator = z.object({
- id: z.string().min(1),
- pageNumber: z.number().optional(),
- regionX: z.number().optional(),
- regionY: z.number().optional(),
- regionWidth: z.number().optional(),
- regionHeight: z.number().optional(),
- label: z.string().optional(),
- xCoordinate: z.number().optional(),
- yCoordinate: z.number().optional(),
- nominalValue: z.string().nullable().optional(),
- tolerancePlus: z.string().nullable().optional(),
- toleranceMinus: z.string().nullable().optional(),
- unit: z.string().nullable().optional(),
- description: z.string().nullable().optional()
-});
-
-export const balloonDeleteValidator = z.object({
- ids: z.array(z.string().min(1))
-});
-
-const normalizedCoordinateValidator = z.number().min(0).max(1);
-const normalizedSizeValidator = z.number().gt(0).max(1);
-const pageNumberValidator = z.number().int().min(1);
-
-export const balloonAnchorCreateItemValidator = z
- .object({
- pageNumber: pageNumberValidator,
- regionX: normalizedCoordinateValidator,
- regionY: normalizedCoordinateValidator,
- regionWidth: normalizedSizeValidator,
- regionHeight: normalizedSizeValidator
- })
- .strict();
-
-export const balloonCreateItemWithOverlayValidator = z
- .object({
- pageNumber: pageNumberValidator,
- regionX: normalizedCoordinateValidator,
- regionY: normalizedCoordinateValidator,
- regionWidth: normalizedSizeValidator,
- regionHeight: normalizedSizeValidator,
- label: z.string().min(1),
- xCoordinate: normalizedCoordinateValidator,
- yCoordinate: normalizedCoordinateValidator,
- nominalValue: z.string().nullable().optional(),
- tolerancePlus: z.string().nullable().optional(),
- toleranceMinus: z.string().nullable().optional(),
- unit: z.string().nullable().optional(),
- description: z.string().nullable().optional(),
- type: z.enum(procedureStepType).optional(),
- data: z.record(z.string(), z.unknown()).optional()
- })
- .strict();
-
-export const balloonCreateItemsValidator = z.array(
- z.union([
- balloonCreateItemWithOverlayValidator,
- balloonAnchorCreateItemValidator
- ])
-);
-
-export const balloonUpdateItemsValidator = z.array(
- balloonUpdateItemValidator.extend({
- pageNumber: pageNumberValidator.optional(),
- regionX: normalizedCoordinateValidator.optional(),
- regionY: normalizedCoordinateValidator.optional(),
- regionWidth: normalizedSizeValidator.optional(),
- regionHeight: normalizedSizeValidator.optional(),
- xCoordinate: normalizedCoordinateValidator.optional(),
- yCoordinate: normalizedCoordinateValidator.optional(),
- data: z.record(z.string(), z.unknown()).optional()
- })
-);
-
-export const balloonDeleteIdsValidator = z.array(z.string().min(1));
-
-// The document-level default sampling rule (fallback for features without
-// their own rule; the lot-level plan base). Sent by the editor as JSON.
-export const inspectionDocumentSamplingValidator = z.object({
- samplingPlanType: z.enum(samplingPlanTypes).nullable(),
- samplingSampleSize: z.number().int().positive().nullable(),
- samplingPercentage: z.number().positive().max(100).nullable(),
- samplingAql: z.number().positive().nullable(),
- samplingInspectionLevel: z.enum(inspectionLevels).nullable(),
- samplingSeverity: z.enum(inspectionSeverities).nullable()
-});
-
-const inspectionFeatureSamplingFieldsValidator = {
- samplingPlanType: z.enum(samplingPlanTypes).nullable().optional(),
- samplingSampleSize: z.number().int().positive().nullable().optional(),
- samplingPercentage: z.number().positive().max(100).nullable().optional(),
- samplingAql: z.number().positive().nullable().optional(),
- samplingInspectionLevel: z.enum(inspectionLevels).nullable().optional(),
- samplingSeverity: z.enum(inspectionSeverities).nullable().optional()
-};
-
-export const inspectionSaveFeatureCreateItemValidator = z
- .object({
- tempId: z.string().min(1),
- pageNumber: pageNumberValidator,
- label: z.string().min(1),
- description: z.string().nullable().optional(),
- nominalValue: z.string().nullable().optional(),
- tolerancePlus: z.string().nullable().optional(),
- toleranceMinus: z.string().nullable().optional(),
- unit: z.string().nullable().optional(),
- type: z.enum(procedureStepType).optional(),
- ...inspectionFeatureSamplingFieldsValidator
- })
- .strict();
-
-export const inspectionSaveFeatureUpdateItemValidator = z
- .object({
- id: z.string().min(1),
- pageNumber: pageNumberValidator.optional(),
- label: z.string().min(1).optional(),
- description: z.string().nullable().optional(),
- nominalValue: z.string().nullable().optional(),
- tolerancePlus: z.string().nullable().optional(),
- toleranceMinus: z.string().nullable().optional(),
- unit: z.string().nullable().optional(),
- type: z.enum(procedureStepType).optional(),
- ...inspectionFeatureSamplingFieldsValidator
- })
- .strict();
-
-export const inspectionSaveFeaturesPayloadValidator = z
- .object({
- create: z.array(inspectionSaveFeatureCreateItemValidator).default([]),
- update: z.array(inspectionSaveFeatureUpdateItemValidator).default([]),
- delete: z.array(z.string().min(1)).default([])
- })
- .strict();
-
-export const inspectionSaveBalloonGeometryCreateItemValidator = z
- .object({
- tempInspectionFeatureId: z.string().min(1).optional(),
- inspectionFeatureId: z.string().min(1).optional(),
- tempBalloonAnchorId: z.string().min(1).optional(),
- pageNumber: pageNumberValidator,
- regionX: normalizedCoordinateValidator,
- regionY: normalizedCoordinateValidator,
- regionWidth: normalizedSizeValidator,
- regionHeight: normalizedSizeValidator,
- xCoordinate: normalizedCoordinateValidator,
- yCoordinate: normalizedCoordinateValidator
- })
- .strict()
- .refine(
- (data) =>
- Boolean(data.tempInspectionFeatureId) ||
- Boolean(data.inspectionFeatureId),
- { message: "tempInspectionFeatureId or inspectionFeatureId is required" }
- );
-
-export const inspectionSaveBalloonGeometryUpdateItemValidator = z
- .object({
- id: z.string().min(1),
- pageNumber: pageNumberValidator.optional(),
- regionX: normalizedCoordinateValidator.optional(),
- regionY: normalizedCoordinateValidator.optional(),
- regionWidth: normalizedSizeValidator.optional(),
- regionHeight: normalizedSizeValidator.optional(),
- xCoordinate: normalizedCoordinateValidator.optional(),
- yCoordinate: normalizedCoordinateValidator.optional()
- })
- .strict();
-
-export const inspectionSaveBalloonsGeometryPayloadValidator = z
- .object({
- create: z
- .array(inspectionSaveBalloonGeometryCreateItemValidator)
- .default([]),
- update: z
- .array(inspectionSaveBalloonGeometryUpdateItemValidator)
- .default([]),
- delete: z.array(z.string().min(1)).default([])
- })
- .strict();
-
-/** @deprecated Legacy combined payload; use features + balloons geometry split. */
-export const inspectionSaveBalloonCreateItemValidator = z
- .object({
- tempBalloonAnchorId: z.string().min(1),
- label: z.string().min(1),
- xCoordinate: normalizedCoordinateValidator,
- yCoordinate: normalizedCoordinateValidator,
- nominalValue: z.string().nullable().optional(),
- tolerancePlus: z.string().nullable().optional(),
- toleranceMinus: z.string().nullable().optional(),
- unit: z.string().nullable().optional(),
- description: z.string().nullable().optional(),
- type: z.enum(procedureStepType).optional()
- })
- .strict();
-
-/** @deprecated Legacy combined payload. */
-export const inspectionSaveBalloonUpdateItemValidator = z
- .object({
- id: z.string().min(1),
- label: z.string().min(1).optional(),
- xCoordinate: normalizedCoordinateValidator.optional(),
- yCoordinate: normalizedCoordinateValidator.optional(),
- nominalValue: z.string().nullable().optional(),
- tolerancePlus: z.string().nullable().optional(),
- toleranceMinus: z.string().nullable().optional(),
- unit: z.string().nullable().optional(),
- description: z.string().nullable().optional(),
- type: z.enum(procedureStepType).optional()
- })
- .strict();
-
-/** @deprecated Legacy combined payload. */
-export const inspectionSaveBalloonsPayloadValidator = z
- .object({
- create: z.array(inspectionSaveBalloonCreateItemValidator).default([]),
- update: z.array(inspectionSaveBalloonUpdateItemValidator).default([]),
- delete: z.array(z.string().min(1)).default([])
- })
- .strict();
-
-export const inspectionSaveAnchorCreateItemValidator = z
- .object({
- tempId: z.string().min(1),
- pageNumber: pageNumberValidator,
- xCoordinate: normalizedCoordinateValidator,
- yCoordinate: normalizedCoordinateValidator,
- width: normalizedSizeValidator,
- height: normalizedSizeValidator
- })
- .strict();
-
-export const inspectionSaveAnchorUpdateItemValidator = z
- .object({
- id: z.string().min(1),
- pageNumber: pageNumberValidator.optional(),
- xCoordinate: normalizedCoordinateValidator.optional(),
- yCoordinate: normalizedCoordinateValidator.optional(),
- width: normalizedSizeValidator.optional(),
- height: normalizedSizeValidator.optional()
- })
- .strict();
-
-export const inspectionSaveAnchorsPayloadValidator = z
- .object({
- create: z.array(inspectionSaveAnchorCreateItemValidator).default([]),
- update: z.array(inspectionSaveAnchorUpdateItemValidator).default([]),
- delete: z.array(z.string().min(1)).default([])
- })
- .strict();
-
/**
* Weekday flag columns on `shift`, Monday-first — the order people week rows
* are dealt out in.
diff --git a/apps/erp/app/modules/production/production.service.ts b/apps/erp/app/modules/production/production.service.ts
index a2ac912d11..b2bc1c3548 100644
--- a/apps/erp/app/modules/production/production.service.ts
+++ b/apps/erp/app/modules/production/production.service.ts
@@ -57,18 +57,11 @@ import type {
} from "../shared";
import { normalizeOperationSourceIds } from "../shared";
import { updateSortOrder } from "../shared/sort-order";
-import {
- listBalloons,
- listInspectionFeatures,
- mapBalloonIdsToFeatureIdsForDocument
-} from "./inspectionDocumentDb";
import type {
assemblyInstructionStatuses,
assemblyStepStatuses,
deadlineTypes,
failureModeValidator,
- inspectionDocumentSamplingValidator,
- inspectionDocumentValidator,
jobMaterialValidator,
jobOperationStatus,
jobOperationValidator,
@@ -116,8 +109,6 @@ import {
resolveOperationSupplier
} from "./ui/Jobs/job-release-logic";
-export { mapBalloonIdsToFeatureIdsForDocument };
-
const logger = getLogger("erp", "production");
export async function convertSalesOrderLinesToJobs(
@@ -9673,605 +9664,6 @@ export async function getJobMaterialSupplyJobLines(
}));
}
-// ─── Inspection Documents ─────────────────────────────────────────────────────
-
-function toStoragePath(pdfUrl?: string | null) {
- if (!pdfUrl) return null;
- const previewPrefix = "/file/preview/private/";
- if (pdfUrl.startsWith(previewPrefix)) {
- return pdfUrl.slice(previewPrefix.length);
- }
- return pdfUrl;
-}
-
-function toPreviewUrl(storagePath?: string | null) {
- if (!storagePath) return null;
- return storagePath.startsWith("/file/preview/private/")
- ? storagePath
- : `/file/preview/private/${storagePath}`;
-}
-
-function fileNameFromPath(storagePath?: string | null) {
- if (!storagePath) return "drawing.pdf";
- return storagePath.split("/").at(-1) ?? "drawing.pdf";
-}
-
-function mapInspectionDocument(row: Record<string, unknown>) {
- const drawingNumber = (row.drawingNumber as string | null) ?? null;
- return {
- id: String(row.id),
- name: String(drawingNumber ?? row.fileName ?? "Untitled Diagram"),
- companyId: String(row.companyId),
- partId: (row.partId as string | null) ?? null,
- createdBy: String(row.createdBy),
- updatedBy: (row.updatedBy as string | null) ?? null,
- createdAt: String(row.createdAt),
- updatedAt: (row.updatedAt as string | null) ?? null,
- content: {
- drawingNumber,
- pdfUrl: toPreviewUrl((row.storagePath as string | null) ?? null),
- annotations: [],
- features: []
- },
- // The document's default sampling rule (feature rule -> document default
- // -> All). NUMERIC columns arrive as strings from PostgREST — coerce.
- sampling: {
- samplingPlanType: (row.samplingPlanType as string | null) ?? null,
- samplingSampleSize: (row.samplingSampleSize as number | null) ?? null,
- samplingPercentage:
- row.samplingPercentage == null ? null : Number(row.samplingPercentage),
- samplingAql: row.samplingAql == null ? null : Number(row.samplingAql),
- samplingInspectionLevel:
- (row.samplingInspectionLevel as string | null) ?? null,
- samplingSeverity: (row.samplingSeverity as string | null) ?? null
- }
- };
-}
-
-export async function getInspectionDocuments(
- client: SupabaseClient<Database>,
- companyId: string,
- args?: { search: string | null } & GenericQueryFilters
-) {
- let query = client
- .from("inspectionDocuments")
- .select("*", { count: "exact" })
- .eq("companyId", companyId);
-
- if (args?.search) {
- query = query.or(
- `drawingNumber.ilike.%${args.search}%,fileName.ilike.%${args.search}%,partReadableId.ilike.%${args.search}%`
- );
- }
-
- if (args) {
- query = setGenericQueryFilters(query, args, [
- { column: "drawingNumber", ascending: true }
- ]);
- }
-
- const result = await query;
-
- return {
- data: (result.data ?? []).map((row: Record<string, unknown>) =>
- mapInspectionDocument(row)
- ),
- count: result.count ?? 0,
- error: result.error
- };
-}
-
-export async function getInspectionDocumentsForItem(
- client: SupabaseClient<Database>,
- itemId: string,
- companyId: string
-) {
- return client
- .from("inspectionDocument")
- .select("id, fileName, drawingNumber, version")
- .eq("companyId", companyId)
- .eq("partId", itemId)
- .order("updatedAt", { ascending: false, nullsFirst: false });
-}
-
-export async function getInspectionDocument(
- client: SupabaseClient<Database>,
- id: string,
- companyId: string
-) {
- const result = await client
- .from("inspectionDocument")
- .select("*")
- .eq("id", id)
- .eq("companyId", companyId)
- .single();
-
- return {
- data: result.data ? mapInspectionDocument(result.data) : null,
- error: result.error
- };
-}
-
-/**
- * When an inspection plan is created without a drawing number, fall back to the
- * part's readableIdWithRevision. If a plan with that drawing number already
- * exists for the company, append " (1)", " (2)", etc. until it is unique.
- */
-async function resolveInspectionDocumentDrawingNumber(
- client: SupabaseClient<Database>,
- companyId: string,
- partId: string
-): Promise<string | null> {
- const partResult = await client
- .from("item")
- .select("readableIdWithRevision")
- .eq("id", partId)
- .eq("companyId", companyId)
- .single();
-
- const base = partResult.data?.readableIdWithRevision?.trim();
- if (!base) return null;
-
- const existingResult = await client
- .from("inspectionDocument")
- .select("drawingNumber")
- .eq("companyId", companyId)
- .not("drawingNumber", "is", null);
-
- const taken = new Set(
- (existingResult.data ?? [])
- .map((row) => row.drawingNumber)
- .filter((value): value is string => Boolean(value))
- );
-
- if (!taken.has(base)) return base;
-
- let suffix = 1;
- while (taken.has(`${base} (${suffix})`)) {
- suffix += 1;
- }
- return `${base} (${suffix})`;
-}
-
-export async function upsertInspectionDocument(
- client: SupabaseClient<Database>,
- diagram:
- | (Omit<z.infer<typeof inspectionDocumentValidator>, "id"> & {
- id?: undefined;
- companyId: string;
- createdBy: string;
- updatedBy?: string;
- pageCount?: number;
- defaultPageWidth?: number;
- defaultPageHeight?: number;
- })
- | (Omit<z.infer<typeof inspectionDocumentValidator>, "id"> & {
- id: string;
- companyId: string;
- createdBy: string;
- updatedBy?: string;
- pageCount?: number;
- defaultPageWidth?: number;
- defaultPageHeight?: number;
- })
-) {
- const {
- id,
- partId,
- drawingNumber,
- pdfUrl,
- pageCount,
- defaultPageWidth,
- defaultPageHeight,
- companyId,
- createdBy,
- updatedBy
- } = diagram;
-
- const documentClient = client as unknown as {
- from: (table: string) => {
- select: (columns: string) => {
- eq: (
- column: string,
- value: unknown
- ) => {
- single: () => Promise<{
- data: Record<string, unknown> | null;
- error: unknown;
- }>;
- };
- };
- update: (payload: Record<string, unknown>) => {
- eq: (
- column: string,
- value: unknown
- ) => {
- eq: (
- column: string,
- value: unknown
- ) => {
- select: (columns: string) => {
- single: () => Promise<{
- data: { id: string } | null;
- error: unknown;
- }>;
- };
- };
- };
- };
- insert: (payload: Record<string, unknown>) => {
- select: (columns: string) => {
- single: () => Promise<{
- data: { id: string } | null;
- error: unknown;
- }>;
- };
- };
- };
- };
-
- const storagePath = toStoragePath(pdfUrl);
-
- if (id) {
- if (!companyId) {
- return {
- data: null,
- error: {
- message: "companyId is required to update inspection plan"
- }
- };
- }
-
- const existingResult = await documentClient
- .from("inspectionDocument")
- .select("*")
- .eq("id", id)
- .single();
-
- const existing = existingResult.data;
- if (!existing) {
- return {
- data: null,
- error: {
- message: "Inspection plan not found"
- }
- };
- }
- if (String(existing.companyId ?? "") !== companyId) {
- return {
- data: null,
- error: {
- message: "Inspection plan does not belong to this company"
- }
- };
- }
-
- const updatePayload: Record<string, unknown> = {
- updatedBy: updatedBy ?? createdBy,
- updatedAt: new Date().toISOString()
- };
- if (drawingNumber !== undefined) {
- updatePayload.drawingNumber = drawingNumber ?? null;
- }
- if (partId !== undefined) {
- updatePayload.partId = partId;
- }
-
- if (storagePath) {
- updatePayload.storagePath = storagePath;
- updatePayload.fileName = fileNameFromPath(storagePath);
- }
- if (pageCount && pageCount > 0) {
- updatePayload.pageCount = pageCount;
- }
- if (defaultPageWidth && defaultPageWidth > 0) {
- updatePayload.defaultPageWidth = defaultPageWidth;
- }
- if (defaultPageHeight && defaultPageHeight > 0) {
- updatePayload.defaultPageHeight = defaultPageHeight;
- }
-
- return documentClient
- .from("inspectionDocument")
- .update(updatePayload)
- .eq("id", id)
- .eq("companyId", companyId)
- .select("id")
- .single();
- }
-
- if (!companyId) {
- return {
- data: null,
- error: { message: "companyId is required to create inspection plan" }
- };
- }
-
- const resolvedDrawingNumber = drawingNumber?.trim()
- ? drawingNumber.trim()
- : await resolveInspectionDocumentDrawingNumber(client, companyId, partId);
-
- return documentClient
- .from("inspectionDocument")
- .insert({
- companyId,
- partId,
- drawingNumber: resolvedDrawingNumber ?? null,
- version: 0,
- ...(storagePath
- ? {
- storagePath,
- fileName: fileNameFromPath(storagePath),
- uploadedBy: createdBy
- }
- : {}),
- ...(pageCount && pageCount > 0 ? { pageCount } : {}),
- ...(defaultPageWidth && defaultPageWidth > 0 ? { defaultPageWidth } : {}),
- ...(defaultPageHeight && defaultPageHeight > 0
- ? { defaultPageHeight }
- : {}),
- createdBy
- })
- .select("id")
- .single();
-}
-
-export async function deleteInspectionDocument(
- client: SupabaseClient<Database>,
- id: string,
- companyId: string
-) {
- const existingResult = await client
- .from("inspectionDocument")
- .select("*")
- .eq("id", id)
- .eq("companyId", companyId)
- .single();
-
- if (!existingResult.data) {
- return {
- data: null,
- error: { message: "Inspection plan not found" }
- };
- }
-
- const storagePath =
- (existingResult.data.storagePath as string | null) ?? null;
-
- const deleteResult = await client
- .from("inspectionDocument")
- .delete()
- .eq("id", id)
- .eq("companyId", companyId);
-
- if (deleteResult.error) {
- return { data: null, error: deleteResult.error };
- }
-
- return {
- data: { storagePath },
- error: null
- };
-}
-
-function mapInspectionFeature(row: Record<string, unknown>) {
- const balloonIdRaw = row.balloonId ?? row.balloon_id;
- return {
- id: String(row.id),
- inspectionDocumentId: String(row.inspectionDocumentId),
- companyId: String(row.companyId),
- pageNumber: Number(row.pageNumber),
- label: String(row.label),
- description: (row.description as string | null) ?? null,
- nominalValue: (row.nominalValue as string | null) ?? null,
- tolerancePlus: (row.tolerancePlus as string | null) ?? null,
- toleranceMinus: (row.toleranceMinus as string | null) ?? null,
- unit: (row.unit as string | null) ?? null,
- type: (row.type as string) ?? "Measurement",
- // Per-feature sampling rule (NULL = inherit the document default). NUMERIC
- // columns arrive as strings from PostgREST — coerce, mirroring the document
- // default rule in mapInspectionDocument.
- samplingPlanType: (row.samplingPlanType as string | null) ?? null,
- samplingSampleSize: (row.samplingSampleSize as number | null) ?? null,
- samplingPercentage:
- row.samplingPercentage == null ? null : Number(row.samplingPercentage),
- samplingAql: row.samplingAql == null ? null : Number(row.samplingAql),
- samplingInspectionLevel:
- (row.samplingInspectionLevel as string | null) ?? null,
- samplingSeverity: (row.samplingSeverity as string | null) ?? null,
- balloonId:
- typeof balloonIdRaw === "string"
- ? balloonIdRaw
- : balloonIdRaw != null
- ? String(balloonIdRaw)
- : null,
- createdBy: String(row.createdBy),
- updatedBy: (row.updatedBy as string | null) ?? null,
- createdAt: String(row.createdAt),
- updatedAt: (row.updatedAt as string | null) ?? null
- };
-}
-
-function mapBalloon(row: Record<string, unknown>) {
- return {
- id: String(row.id),
- inspectionDocumentId: String(row.inspectionDocumentId),
- companyId: String(row.companyId),
- inspectionFeatureId: String(row.inspectionFeatureId),
- pageNumber: Number(row.pageNumber),
- regionX: Number(row.regionX),
- regionY: Number(row.regionY),
- regionWidth: Number(row.regionWidth),
- regionHeight: Number(row.regionHeight),
- xCoordinate: Number(row.xCoordinate),
- yCoordinate: Number(row.yCoordinate),
- createdBy: String(row.createdBy),
- updatedBy: (row.updatedBy as string | null) ?? null,
- createdAt: String(row.createdAt),
- updatedAt: (row.updatedAt as string | null) ?? null,
- balloonAnchorId: String(row.id)
- };
-}
-
-export async function getInspectionFeatures(
- client: SupabaseClient<Database>,
- inspectionDocumentId: string
-) {
- const [featuresResult, balloonsResult] = await Promise.all([
- getInspectionFeaturesRaw(client, inspectionDocumentId),
- getBalloons(client, inspectionDocumentId)
- ]);
-
- if (featuresResult.error) {
- return { data: null, error: featuresResult.error };
- }
- if (balloonsResult.error) {
- return { data: null, error: balloonsResult.error };
- }
-
- const balloonByFeatureId = new Map(
- (balloonsResult.data ?? []).map((b) => [b.inspectionFeatureId, b.id])
- );
-
- return {
- data: (featuresResult.data ?? []).map((row) =>
- mapInspectionFeature({
- ...row,
- balloonId: balloonByFeatureId.get(String(row.id)) ?? null
- })
- ),
- error: null
- };
-}
-
-async function getInspectionFeaturesRaw(
- client: SupabaseClient<Database>,
- inspectionDocumentId: string
-) {
- return listInspectionFeatures(client, inspectionDocumentId);
-}
-
-export async function getBalloons(
- client: SupabaseClient<Database>,
- inspectionDocumentId: string
-) {
- const result = await listBalloons(client, inspectionDocumentId);
-
- return {
- data: (result.data ?? []).map((row) =>
- mapBalloon(row as unknown as Record<string, unknown>)
- ),
- error: result.error
- };
-}
-
-export async function getInspectionPlan(
- client: SupabaseClient<Database>,
- inspectionDocumentId: string
-) {
- const [featuresResult, balloonsResult] = await Promise.all([
- getInspectionFeaturesRaw(client, inspectionDocumentId),
- getBalloons(client, inspectionDocumentId)
- ]);
-
- if (featuresResult.error) {
- return { data: null, error: featuresResult.error };
- }
- if (balloonsResult.error) {
- return { data: null, error: balloonsResult.error };
- }
-
- const balloonByFeatureId = new Map(
- (balloonsResult.data ?? []).map((b) => [b.inspectionFeatureId, b])
- );
-
- return {
- data: (featuresResult.data ?? []).map((row) => {
- const b = balloonByFeatureId.get(row.id);
- const featureId = row.id;
- return {
- /** Feature id (primary key for plan rows). */
- id: featureId,
- featureId,
- /** Balloon id when placed; null for table-only features. */
- balloonId: b?.id ?? null,
- inspectionDocumentId: row.inspectionDocumentId,
- pageNumber: b?.pageNumber ?? row.pageNumber,
- label: row.label,
- description: row.description,
- nominalValue: row.nominalValue,
- tolerancePlus: row.tolerancePlus,
- toleranceMinus: row.toleranceMinus,
- unit: row.unit,
- regionX: b ? b.regionX : null,
- regionY: b ? b.regionY : null,
- regionWidth: b ? b.regionWidth : null,
- regionHeight: b ? b.regionHeight : null,
- xCoordinate: b ? b.xCoordinate : null,
- yCoordinate: b ? b.yCoordinate : null
- };
- }),
- error: null
- };
-}
-
-export async function updateInspectionDocumentSampling(
- client: SupabaseClient<Database>,
- args: z.infer<typeof inspectionDocumentSamplingValidator> & {
- inspectionDocumentId: string;
- companyId: string;
- userId: string;
- }
-) {
- const { inspectionDocumentId, companyId, userId, ...sampling } = args;
- return client
- .from("inspectionDocument")
- .update({
- ...sampling,
- updatedBy: userId,
- updatedAt: new Date().toISOString()
- })
- .eq("id", inspectionDocumentId)
- .eq("companyId", companyId);
-}
-
-export async function saveInspectionDocumentAtomic(
- client: SupabaseClient<Database>,
- args: {
- inspectionDocumentId: string;
- companyId: string;
- userId: string;
- pdfUrl?: string | null;
- pageCount?: number;
- defaultPageWidth?: number;
- defaultPageHeight?: number;
- features: unknown;
- balloons: unknown;
- }
-) {
- return (
- client as unknown as {
- rpc: (
- fn: string,
- args: Record<string, unknown>
- ) => Promise<{
- data: unknown;
- error: unknown;
- }>;
- }
- ).rpc("save_inspection_document_atomic", {
- p_inspection_document_id: args.inspectionDocumentId,
- p_company_id: args.companyId,
- p_user_id: args.userId,
- p_pdf_url: args.pdfUrl ?? null,
- p_page_count: args.pageCount ?? null,
- p_default_page_width: args.defaultPageWidth ?? null,
- p_default_page_height: args.defaultPageHeight ?? null,
- p_features: args.features,
- p_balloons: args.balloons
- });
-}
-
// ---------------------------------------------------------------------------
// MES-core write entry points exposed to MCP (gatekeeper-carbon asks #1–#4).
//
diff --git a/apps/erp/app/modules/production/types.ts b/apps/erp/app/modules/production/types.ts
index 296b22f64e..57ddcb5524 100644
--- a/apps/erp/app/modules/production/types.ts
+++ b/apps/erp/app/modules/production/types.ts
@@ -10,12 +10,8 @@ import type {
getAssemblyInstructions,
getAssemblyInstructionVersions,
getAssemblyUnits,
- getBalloons,
getFailureMode,
getFailureModes,
- getInspectionDocument,
- getInspectionDocuments,
- getInspectionFeatures,
getJob,
getJobMakeMethodById,
getJobMaterialsWithQuantityOnHand,
@@ -313,37 +309,3 @@ export type AssemblyUnit = NonNullable<
export type AssemblyComponentMapping = NonNullable<
Awaited<ReturnType<typeof getAssemblyComponentMappings>>["data"]
>[number];
-
-// --- Inspection Documents -----------------------------------------------
-
-export type InspectionDocument = NonNullable<
- Awaited<ReturnType<typeof getInspectionDocuments>>["data"]
->[number];
-
-export type InspectionDocumentDetail = NonNullable<
- Awaited<ReturnType<typeof getInspectionDocument>>["data"]
->;
-
-export type Balloon = NonNullable<
- Awaited<ReturnType<typeof getBalloons>>["data"]
->[number];
-
-export type InspectionFeature = NonNullable<
- Awaited<ReturnType<typeof getInspectionFeatures>>["data"]
->[number];
-
-export type BalloonFeature = {
- id: string;
- balloonNumber: number;
- description: string;
- nominalValue: number | null;
- tolerancePlus: number | null;
- toleranceMinus: number | null;
- unitOfMeasureCode: string | null;
-};
-
-export type InspectionDocumentContent = {
- pdfUrl: string | null;
- drawingNumber: string | null;
- features: BalloonFeature[];
-};
diff --git a/apps/erp/app/modules/production/ui/InspectionDocument/cropInspectionAnchorToPng.ts b/apps/erp/app/modules/production/ui/InspectionDocument/cropInspectionAnchorToPng.ts
deleted file mode 100644
index c42d575331..0000000000
--- a/apps/erp/app/modules/production/ui/InspectionDocument/cropInspectionAnchorToPng.ts
+++ /dev/null
@@ -1,138 +0,0 @@
-import { closePdf, openPdf } from "@carbon/files/pdf";
-
-/** Extra resolution for vision / OCR vs on-screen PDF preview. */
-const VISION_RENDER_SCALE = 1.75;
-/** Cap raster width so very large displays do not allocate huge canvases. */
-const MAX_VISION_RASTER_WIDTH_PX = 4096;
-/** Pad crop by this fraction of max(width,height) on each side (percent space). */
-const CROP_PAD_FRAC = 0.1;
-const CROP_PAD_MAX_PCT = 4;
-const CROP_PAD_MIN_PCT = 0.3;
-/** Minimum crop width/height in percent-of-page so tiny boxes stay readable. */
-const CROP_MIN_SIZE_PCT = 2.5;
-
-export type InspectionAnchorCropArgs = {
- pdfBytes: ArrayBuffer;
- pageNumber: number;
- /** 0–100, same coordinate system as `SelectorRect` in the inspection editor */
- x: number;
- y: number;
- width: number;
- height: number;
- /**
- * Horizontal size in CSS px of one rendered page (matches `react-pdf` `Page` `width={renderedWidth}`).
- * Viewport scale is derived so raster width matches this value times an internal vision scale (capped).
- */
- renderedPageWidthPx: number;
-};
-
-/**
- * Expands the anchor rect with padding, enforces a minimum size, and clamps to the page (0–100 %).
- */
-function prepareVisionCropRect(
- x: number,
- y: number,
- width: number,
- height: number
-): { x: number; y: number; width: number; height: number } {
- const w0 = Math.max(1e-6, width);
- const h0 = Math.max(1e-6, height);
- const mx = Math.max(w0, h0);
- const pad = Math.min(
- CROP_PAD_MAX_PCT,
- Math.max(CROP_PAD_MIN_PCT, CROP_PAD_FRAC * mx)
- );
-
- const cx = x + w0 / 2;
- const cy = y + h0 / 2;
- let w = w0 + 2 * pad;
- let h = h0 + 2 * pad;
-
- w = Math.max(w, CROP_MIN_SIZE_PCT);
- h = Math.max(h, CROP_MIN_SIZE_PCT);
-
- w = Math.min(w, 100);
- h = Math.min(h, 100);
-
- let nx = cx - w / 2;
- let ny = cy - h / 2;
- nx = Math.max(0, Math.min(nx, 100 - w));
- ny = Math.max(0, Math.min(ny, 100 - h));
-
- return { x: nx, y: ny, width: w, height: h };
-}
-
-/**
- * Renders one PDF page at higher resolution than the editor preview, then crops the (padded, min-sized) anchor rectangle to PNG.
- */
-export async function cropInspectionAnchorToPngBlob(
- args: InspectionAnchorCropArgs
-): Promise<Blob> {
- const { pdfBytes, pageNumber, x, y, width, height, renderedPageWidthPx } =
- args;
-
- const {
- x: rx,
- y: ry,
- width: rw,
- height: rh
- } = prepareVisionCropRect(x, y, width, height);
-
- const pdf = await openPdf(pdfBytes);
-
- try {
- const page = await pdf.getPage(pageNumber);
- const baseVp = page.getViewport({ scale: 1 });
- const targetWidth = Math.min(
- Math.max(1, Math.floor(renderedPageWidthPx * VISION_RENDER_SCALE)),
- MAX_VISION_RASTER_WIDTH_PX
- );
- const scale = targetWidth / baseVp.width;
- const viewport = page.getViewport({ scale });
- const cw = Math.max(1, Math.floor(viewport.width));
- const ch = Math.max(1, Math.floor(viewport.height));
-
- const canvas = document.createElement("canvas");
- canvas.width = cw;
- canvas.height = ch;
- const ctx = canvas.getContext("2d");
- if (!ctx) {
- throw new Error("Could not get canvas context");
- }
-
- const renderTask = page.render({
- canvas,
- canvasContext: ctx,
- viewport
- });
- await renderTask.promise;
-
- const sx = Math.floor((rx / 100) * cw);
- const sy = Math.floor((ry / 100) * ch);
- const sw = Math.max(1, Math.floor((rw / 100) * cw));
- const sh = Math.max(1, Math.floor((rh / 100) * ch));
-
- const sx2 = Math.max(0, Math.min(sx, cw - 1));
- const sy2 = Math.max(0, Math.min(sy, ch - 1));
- const sw2 = Math.max(1, Math.min(sw, cw - sx2));
- const sh2 = Math.max(1, Math.min(sh, ch - sy2));
-
- const crop = document.createElement("canvas");
- crop.width = sw2;
- crop.height = sh2;
- const cctx = crop.getContext("2d");
- if (!cctx) {
- throw new Error("Could not get crop canvas context");
- }
- cctx.drawImage(canvas, sx2, sy2, sw2, sh2, 0, 0, sw2, sh2);
-
- return await new Promise<Blob>((resolve, reject) => {
- crop.toBlob((b) => {
- if (b) resolve(b);
- else reject(new Error("Canvas toBlob failed"));
- }, "image/png");
- });
- } finally {
- await closePdf(pdf);
- }
-}
diff --git a/apps/erp/app/modules/production/ui/InspectionDocument/exportInspectionDocumentPdfWithOverlays.ts b/apps/erp/app/modules/production/ui/InspectionDocument/exportInspectionDocumentPdfWithOverlays.ts
deleted file mode 100644
index a702baa76c..0000000000
--- a/apps/erp/app/modules/production/ui/InspectionDocument/exportInspectionDocumentPdfWithOverlays.ts
+++ /dev/null
@@ -1,236 +0,0 @@
-import { closePdf, openPdf } from "@carbon/files/pdf";
-import { PDFDocument } from "pdf-lib";
-
-const CALLOUT_STROKE = "#f97316";
-
-function liangBarskySegmentRect(
- x0: number,
- y0: number,
- x1: number,
- y1: number,
- minX: number,
- minY: number,
- maxX: number,
- maxY: number
-): { u0: number; u1: number } | null {
- const dx = x1 - x0;
- const dy = y1 - y0;
- let u0 = 0;
- let u1 = 1;
- const p = [-dx, dx, -dy, dy];
- const q = [x0 - minX, maxX - x0, y0 - minY, maxY - y0];
- for (let i = 0; i < 4; i += 1) {
- if (Math.abs(p[i]) < 1e-12) {
- if (q[i] < 0) return null;
- } else {
- const r = q[i] / p[i];
- if (p[i] < 0) {
- u0 = Math.max(u0, r);
- } else {
- u1 = Math.min(u1, r);
- }
- if (u0 > u1) return null;
- }
- }
- return { u0, u1 };
-}
-
-function clippedBalloonToAnchorLine(
- bx: number,
- by: number,
- radiusPx: number,
- ax: number,
- ay: number,
- rect: { x: number; y: number; w: number; h: number }
-): [number, number, number, number] | null {
- const L = Math.hypot(ax - bx, ay - by);
- if (L < 1e-6) return null;
- const epsU = Math.max(1e-4, 2 / L);
- const uBalloonExit = Math.min(1 - epsU, radiusPx / L + epsU);
- const { x, y, w, h } = rect;
- const hit = liangBarskySegmentRect(bx, by, ax, ay, x, y, x + w, y + h);
- let uEnd = 1 - epsU;
- if (hit) {
- const uEnter = Math.max(0, Math.min(1, hit.u0));
- if (uEnter > uBalloonExit) {
- uEnd = Math.min(uEnd, uEnter - epsU);
- }
- }
- if (uEnd <= uBalloonExit + 1e-4) return null;
- const x0 = bx + (ax - bx) * uBalloonExit;
- const y0 = by + (ay - by) * uBalloonExit;
- const x1 = bx + (ax - bx) * uEnd;
- const y1 = by + (ay - by) * uEnd;
- return [x0, y0, x1, y1];
-}
-
-export type ExportFeatureRow = {
- balloonId: string;
- balloonAnchorId: string;
- label: string;
- pageNumber: number;
- x: number;
- y: number;
- width: number;
- height: number;
-};
-
-export type ExportSelectorRect = {
- id: string;
- pageNumber: number;
- x: number;
- y: number;
- width: number;
- height: number;
-};
-
-function drawMarkupOnPageCanvas(
- ctx: CanvasRenderingContext2D,
- cw: number,
- ch: number,
- pageNumber: number,
- featureRows: ExportFeatureRow[],
- anchorRects: ExportSelectorRect[]
-) {
- ctx.save();
- ctx.lineJoin = "round";
- ctx.lineCap = "round";
-
- for (const s of anchorRects) {
- if (s.pageNumber !== pageNumber) continue;
- const sx = (s.x / 100) * cw;
- const sy = (s.y / 100) * ch;
- const sw = (s.width / 100) * cw;
- const sh = (s.height / 100) * ch;
- ctx.strokeStyle = CALLOUT_STROKE;
- ctx.lineWidth = 2;
- ctx.strokeRect(sx, sy, sw, sh);
- }
-
- for (const b of featureRows) {
- if (b.pageNumber !== pageNumber) continue;
- const bw = (b.width / 100) * cw;
- const bh = (b.height / 100) * ch;
- const balloonX = (b.x / 100) * cw;
- const balloonY = (b.y / 100) * ch;
- const balloonCenterX = balloonX + bw / 2;
- const balloonCenterY = balloonY + bh / 2;
- const radius = Math.max(8, Math.min(bw, bh) / 2);
- const balloonLabelFontSize = Math.max(
- 14,
- Math.min(26, Math.round(radius * 1.15))
- );
-
- const linkedSelector = anchorRects.find((s) => s.id === b.balloonAnchorId);
- let linePoints: [number, number, number, number] | null = null;
- if (linkedSelector) {
- const sx = (linkedSelector.x / 100) * cw;
- const sy = (linkedSelector.y / 100) * ch;
- const sw = (linkedSelector.width / 100) * cw;
- const sh = (linkedSelector.height / 100) * ch;
- const anchorX = sx + sw / 2;
- const anchorY = sy + sh / 2;
- linePoints = clippedBalloonToAnchorLine(
- balloonCenterX,
- balloonCenterY,
- radius,
- anchorX,
- anchorY,
- { x: sx, y: sy, w: sw, h: sh }
- );
- }
-
- if (linePoints) {
- ctx.beginPath();
- ctx.strokeStyle = CALLOUT_STROKE;
- ctx.lineWidth = 2;
- ctx.moveTo(linePoints[0], linePoints[1]);
- ctx.lineTo(linePoints[2], linePoints[3]);
- ctx.stroke();
- }
-
- ctx.beginPath();
- ctx.arc(balloonCenterX, balloonCenterY, radius, 0, Math.PI * 2);
- ctx.strokeStyle = CALLOUT_STROKE;
- ctx.lineWidth = 2;
- ctx.fillStyle = "#ffffff";
- ctx.fill();
- ctx.stroke();
-
- ctx.font = `bold ${balloonLabelFontSize}px ui-sans-serif, system-ui, sans-serif`;
- ctx.fillStyle = CALLOUT_STROKE;
- ctx.textAlign = "center";
- ctx.textBaseline = "middle";
- ctx.fillText(b.label, balloonCenterX, balloonCenterY);
- }
-
- ctx.restore();
-}
-
-/**
- * Rasterizes each PDF page with anchor + balloon markup (matching the Konva overlay) and builds a new PDF.
- */
-export async function buildInspectionDocumentPdfWithOverlaysBytes(args: {
- pdfBytes: ArrayBuffer;
- featureRows: ExportFeatureRow[];
- anchorRects: ExportSelectorRect[];
- /** PDF.js render scale; higher = sharper file */
- scale?: number;
-}): Promise<Uint8Array> {
- const scale = args.scale ?? 2;
- const pdf = await openPdf(args.pdfBytes);
- const outDoc = await PDFDocument.create();
-
- try {
- const numPages = pdf.numPages;
- for (let pageNum = 1; pageNum <= numPages; pageNum += 1) {
- const page = await pdf.getPage(pageNum);
- const viewport = page.getViewport({ scale });
- const cw = Math.floor(viewport.width);
- const ch = Math.floor(viewport.height);
- const canvas = document.createElement("canvas");
- canvas.width = cw;
- canvas.height = ch;
- const ctx = canvas.getContext("2d");
- if (!ctx) {
- throw new Error("Could not get canvas context");
- }
-
- const renderTask = page.render({
- canvas,
- canvasContext: ctx,
- viewport
- });
- await renderTask.promise;
-
- drawMarkupOnPageCanvas(
- ctx,
- cw,
- ch,
- pageNum,
- args.featureRows,
- args.anchorRects
- );
-
- const blob = await new Promise<Blob>((resolve, reject) => {
- canvas.toBlob((b) => {
- if (b) resolve(b);
- else reject(new Error("Canvas toBlob failed"));
- }, "image/png");
- });
- const pngBytes = new Uint8Array(await blob.arrayBuffer());
- const image = await outDoc.embedPng(pngBytes);
- const pdfPage = outDoc.addPage([cw, ch]);
- pdfPage.drawImage(image, {
- x: 0,
- y: 0,
- width: cw,
- height: ch
- });
- }
-
- return await outDoc.save({ useObjectStreams: true });
- } finally {
- await closePdf(pdf);
- }
-}
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx b/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx
index 8c36ee859a..35fe331eb0 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx
@@ -9,6 +9,7 @@ import {
import {
Badge,
Button,
+ Copy,
HStack,
Modal,
ModalBody,
@@ -28,7 +29,7 @@ import {
import { Trans, useLingui } from "@lingui/react/macro";
import type { PostgrestResponse } from "@supabase/supabase-js";
import { Suspense, useCallback, useEffect, useState } from "react";
-import { LuCopy, LuLink, LuUnlink2 } from "react-icons/lu";
+import { LuCopy, LuKeySquare, LuLink, LuUnlink2 } from "react-icons/lu";
import { RiProgress8Line } from "react-icons/ri";
import { Await, useFetcher, useParams } from "react-router";
import { z } from "zod";
@@ -217,6 +218,13 @@ const JobProperties = () => {
</span>
</TooltipContent>
</Tooltip>
+ <Copy
+ text={jobId}
+ label={t`Copy job unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/production/ui/Procedures/ProcedureProperties.tsx b/apps/erp/app/modules/production/ui/Procedures/ProcedureProperties.tsx
index 66d503faa8..c0aa210832 100644
--- a/apps/erp/app/modules/production/ui/Procedures/ProcedureProperties.tsx
+++ b/apps/erp/app/modules/production/ui/Procedures/ProcedureProperties.tsx
@@ -1,6 +1,7 @@
import { Select, ValidatedForm } from "@carbon/form";
import {
Button,
+ Copy,
HStack,
Subheading,
Tooltip,
@@ -106,26 +107,13 @@ const ProcedureProperties = () => {
</span>
</TooltipContent>
</Tooltip>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- variant="ghost"
- aria-label={t`Copy`}
- size="sm"
- className="p-1"
- onClick={() =>
- copyToClipboard(routeData?.procedure?.id ?? "")
- }
- >
- <LuKeySquare className="w-3 h-3" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <span>
- <Trans>Copy procedure unique identifier</Trans>
- </span>
- </TooltipContent>
- </Tooltip>
+ <Copy
+ text={routeData?.procedure?.id ?? ""}
+ label={t`Copy procedure unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/production/ui/useProductionSubmodules.tsx b/apps/erp/app/modules/production/ui/useProductionSubmodules.tsx
index 1c5cabe4f4..f2d4ffd383 100644
--- a/apps/erp/app/modules/production/ui/useProductionSubmodules.tsx
+++ b/apps/erp/app/modules/production/ui/useProductionSubmodules.tsx
@@ -1,5 +1,4 @@
import { useLingui } from "@lingui/react/macro";
-import { IoBalloonOutline } from "react-icons/io5";
import {
LuChartBarBig,
LuChartLine,
@@ -91,12 +90,6 @@ export default function useProductionSubmodules() {
icon: <LuStepForward />,
role: "employee"
},
- {
- name: t`Inspection Plans`,
- to: path.to.inspectionDocuments,
- icon: <IoBalloonOutline />,
- permission: "quality"
- },
{
name: t`Procedures`,
to: path.to.procedures,
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderProperties.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderProperties.tsx
index 4f981ab65d..54a678e04a 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderProperties.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderProperties.tsx
@@ -4,6 +4,7 @@ import { DatePicker, InputControlled, ValidatedForm } from "@carbon/form";
import {
Badge,
Button,
+ Copy,
HStack,
IconButton,
Subheading,
@@ -20,6 +21,7 @@ import {
LuCopy,
LuExternalLink,
LuInfo,
+ LuKeySquare,
LuLink,
LuRefreshCcw
} from "react-icons/lu";
@@ -159,6 +161,13 @@ const PurchaseOrderProperties = () => {
<span>Copy link to Purchase Order</span>
</TooltipContent>
</Tooltip>
+ <Copy
+ text={orderId}
+ label={t`Copy purchase order unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseReturnOrders/PurchaseReturnOrderProperties.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseReturnOrders/PurchaseReturnOrderProperties.tsx
index b61b2800f4..3b6f8a97b7 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseReturnOrders/PurchaseReturnOrderProperties.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseReturnOrders/PurchaseReturnOrderProperties.tsx
@@ -9,6 +9,7 @@ import {
import {
Badge,
Button,
+ Copy,
HStack,
Modal,
ModalBody,
@@ -26,7 +27,7 @@ import {
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useCallback, useEffect, useMemo, useState } from "react";
-import { LuCopy, LuLink, LuUnlink2 } from "react-icons/lu";
+import { LuCopy, LuKeySquare, LuLink, LuUnlink2 } from "react-icons/lu";
import { RiProgress8Line } from "react-icons/ri";
import { useFetcher, useParams } from "react-router";
import { z } from "zod";
@@ -249,6 +250,13 @@ const PurchaseReturnOrderProperties = () => {
</span>
</TooltipContent>
</Tooltip>
+ <Copy
+ text={id}
+ label={t`Copy purchase return order unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQProperties.tsx b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQProperties.tsx
index 1d200fd717..a30ac41a82 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQProperties.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchasingRfq/PurchasingRFQProperties.tsx
@@ -6,6 +6,7 @@ import {
AvatarGroupList,
AvatarOverflowIndicator,
Button,
+ Copy,
HStack,
Subheading,
Tooltip,
@@ -17,7 +18,7 @@ import {
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useCallback, useEffect, useMemo, useState } from "react";
-import { LuCopy, LuLink } from "react-icons/lu";
+import { LuCopy, LuKeySquare, LuLink } from "react-icons/lu";
import { useFetcher, useParams } from "react-router";
import { z } from "zod";
import { zfd } from "zod-form-data";
@@ -196,6 +197,13 @@ const PurchasingRFQProperties = () => {
<span>Copy link to RFQ</span>
</TooltipContent>
</Tooltip>
+ <Copy
+ text={rfqId}
+ label={t`Copy RFQ unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierHeader.tsx b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierHeader.tsx
index b18d4d3201..c56d38bfa1 100644
--- a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierHeader.tsx
+++ b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierHeader.tsx
@@ -11,6 +11,7 @@ import {
CardContent,
CardHeader,
CardTitle,
+ Copy,
DropdownMenu,
DropdownMenuContent,
DropdownMenuIcon,
@@ -36,6 +37,7 @@ import {
LuCheckCheck,
LuClipboardCheck,
LuEllipsisVertical,
+ LuKeySquare,
LuTrash,
LuX
} from "react-icons/lu";
@@ -174,6 +176,11 @@ const SupplierHeader = () => {
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
+ <Copy
+ text={supplierId}
+ label={t`Copy supplier unique identifier`}
+ icon={<LuKeySquare />}
+ />
</CardTitle>
</CardHeader>
<CardAction className="flex h-full flex-row items-center gap-2">
diff --git a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteProperties.tsx b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteProperties.tsx
index 93435283ba..503a61105c 100644
--- a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteProperties.tsx
+++ b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteProperties.tsx
@@ -2,6 +2,7 @@ import type { Json } from "@carbon/database";
import { DatePicker, InputControlled, ValidatedForm } from "@carbon/form";
import {
Button,
+ Copy,
HStack,
IconButton,
Subheading,
@@ -13,7 +14,13 @@ import {
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useCallback, useEffect } from "react";
-import { LuCopy, LuInfo, LuLink, LuRefreshCcw } from "react-icons/lu";
+import {
+ LuCopy,
+ LuInfo,
+ LuKeySquare,
+ LuLink,
+ LuRefreshCcw
+} from "react-icons/lu";
import { useFetcher, useParams } from "react-router";
import { z } from "zod";
import { zfd } from "zod-form-data";
@@ -136,6 +143,13 @@ const SupplierQuoteProperties = () => {
<span>Copy link to Quote</span>
</TooltipContent>
</Tooltip>
+ <Copy
+ text={id}
+ label={t`Copy supplier quote unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/quality/AGENTS.md b/apps/erp/app/modules/quality/AGENTS.md
index 26c152c73b..184f687df2 100644
--- a/apps/erp/app/modules/quality/AGENTS.md
+++ b/apps/erp/app/modules/quality/AGENTS.md
@@ -64,11 +64,11 @@ pnpm --filter @carbon/erp test
- `getIssueWorkflow` / `getIssueActionTasks` / `getIssueApprovalTasks` — workflow state
- `updateIssueStatus` / `updateIssueTaskStatus` — status transitions
- `closeIssue` (quality-disposition.server.ts, NOT quality.server.ts) — blocked while a linked supplier return is open; the 'Return to Supplier' write-off is reduced by shipped-via-return coverage, and return-shipped entities stay Consumed (not flipped Rejected). The `x+/issue+/$id.supplier-return.tsx` action drafts the linked `purchaseReturnOrder` (idempotent, supplier auto-resolution)
-- `getInspectionDocument` / `getBalloons` / `getInspectionFeatures` / `getInspectionPlan` — drawing-inspection reads; NOTE these live in `production.service.ts`, not this module
+- `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`)
- `getInspection` / `getInspections` (status + source filters) / `getInspectionTrackedEntities` — inspections
- `getInspectionSamplingPlans` / `getInspectionMeasurements` — per-inspection feature plans and grid readings
- `getItemInspectionDocumentAssignments` / `upsertItemInspectionDocumentAssignment` — Receipt-usage document assignment
-- `upsertInspectionMeasurement` / `reconcileInspectionSamplingPlans` / `changeInspectionDocument` / `valuateMeasurement` (quality.server.ts) — measurement recording, lazy plan resolution, document swap, pure valuation. The transactional engine lives in `@carbon/database/quality` (shared with the MES inspection routes); quality.server.ts is thin wrappers currying the ERP Kysely singleton
+- `upsertInspectionMeasurement` / `reconcileInspectionSamplingPlans` / `changeInspectionDocument` / `valuateMeasurement` (quality.server.ts) — measurement recording, lazy plan resolution, document swap, pure valuation. The transactional engine lives in `@carbon/database/quality` (shared with the MES inspection routes); quality.server.ts curries the ERP Kysely singleton into those engine calls, and also holds the plan editor's server-only helpers (legacy save-payload translation, the balloon-region vision call)
- `getGauge` / `getGauges` / `getGaugeCalibrationRecords` — gauge management
- `getRisk` / `getRisks` / `upsertRisk` / `updateRiskStatus` — risk register
- `getQualityDocument` / `getQualityDocumentSteps` — versioned SOPs
diff --git a/apps/erp/app/modules/quality/quality.models.ts b/apps/erp/app/modules/quality/quality.models.ts
index d6392d0a8d..27449c1b06 100644
--- a/apps/erp/app/modules/quality/quality.models.ts
+++ b/apps/erp/app/modules/quality/quality.models.ts
@@ -501,3 +501,402 @@ export const inspectionMeasurementValidator = z.object({
passed: zfd.text(z.enum(["true", "false"]).optional()),
notes: zfd.text(z.string().optional())
});
+
+// Records the gauge used for one feature of a lot; an empty gaugeId clears it.
+export const inspectionGaugeValidator = z.object({
+ inspectionId: z.string().min(1, { message: "Inspection is required" }),
+ inspectionFeatureId: z.string().min(1, { message: "Feature is required" }),
+ gaugeId: zfd.text(z.string().optional())
+});
+
+// ─── Inspection Documents ─────────────────────────────────────────────────────
+
+export const inspectionDocumentValidator = z.object({
+ id: zfd.text(z.string().optional()),
+ name: zfd.text(z.string().optional()),
+ partId: z.string().min(1, { message: "Part is required" }),
+ drawingNumber: zfd.text(z.string().optional()),
+ pdfUrl: zfd.text(z.string().optional()),
+ annotations: zfd.text(z.string().optional()),
+ features: zfd.text(z.string().optional())
+});
+
+export const balloonFeatureValidator = z.object({
+ id: zfd.text(z.string().optional()),
+ inspectionDocumentId: z.string().min(1, { message: "Diagram is required" }),
+ balloonNumber: zfd.numeric(z.number().min(1)),
+ description: z.string().min(1, { message: "Description is required" }),
+ nominalValue: zfd.numeric(z.number().optional()),
+ tolerancePlus: zfd.numeric(z.number().optional()),
+ toleranceMinus: zfd.numeric(z.number().optional()),
+ unitOfMeasureCode: zfd.text(z.string().optional())
+});
+
+export const balloonCreateFromPayloadItemValidator = z.object({
+ pageNumber: z.number(),
+ regionX: z.number(),
+ regionY: z.number(),
+ regionWidth: z.number(),
+ regionHeight: z.number(),
+ label: z.string().min(1),
+ xCoordinate: z.number(),
+ yCoordinate: z.number(),
+ nominalValue: z.string().nullable().optional(),
+ tolerancePlus: z.string().nullable().optional(),
+ toleranceMinus: z.string().nullable().optional(),
+ unit: z.string().nullable().optional(),
+ description: z.string().nullable().optional()
+});
+
+export const balloonUpdateItemValidator = z.object({
+ id: z.string().min(1),
+ pageNumber: z.number().optional(),
+ regionX: z.number().optional(),
+ regionY: z.number().optional(),
+ regionWidth: z.number().optional(),
+ regionHeight: z.number().optional(),
+ label: z.string().optional(),
+ xCoordinate: z.number().optional(),
+ yCoordinate: z.number().optional(),
+ nominalValue: z.string().nullable().optional(),
+ tolerancePlus: z.string().nullable().optional(),
+ toleranceMinus: z.string().nullable().optional(),
+ unit: z.string().nullable().optional(),
+ description: z.string().nullable().optional()
+});
+
+export const balloonDeleteValidator = z.object({
+ ids: z.array(z.string().min(1))
+});
+
+const normalizedCoordinateValidator = z.number().min(0).max(1);
+const normalizedSizeValidator = z.number().gt(0).max(1);
+const pageNumberValidator = z.number().int().min(1);
+
+export const balloonAnchorCreateItemValidator = z
+ .object({
+ pageNumber: pageNumberValidator,
+ regionX: normalizedCoordinateValidator,
+ regionY: normalizedCoordinateValidator,
+ regionWidth: normalizedSizeValidator,
+ regionHeight: normalizedSizeValidator
+ })
+ .strict();
+
+export const balloonCreateItemWithOverlayValidator = z
+ .object({
+ pageNumber: pageNumberValidator,
+ regionX: normalizedCoordinateValidator,
+ regionY: normalizedCoordinateValidator,
+ regionWidth: normalizedSizeValidator,
+ regionHeight: normalizedSizeValidator,
+ label: z.string().min(1),
+ xCoordinate: normalizedCoordinateValidator,
+ yCoordinate: normalizedCoordinateValidator,
+ nominalValue: z.string().nullable().optional(),
+ tolerancePlus: z.string().nullable().optional(),
+ toleranceMinus: z.string().nullable().optional(),
+ unit: z.string().nullable().optional(),
+ description: z.string().nullable().optional(),
+ type: z.enum(procedureStepType).optional(),
+ data: z.record(z.string(), z.unknown()).optional()
+ })
+ .strict();
+
+export const balloonCreateItemsValidator = z.array(
+ z.union([
+ balloonCreateItemWithOverlayValidator,
+ balloonAnchorCreateItemValidator
+ ])
+);
+
+export const balloonUpdateItemsValidator = z.array(
+ balloonUpdateItemValidator.extend({
+ pageNumber: pageNumberValidator.optional(),
+ regionX: normalizedCoordinateValidator.optional(),
+ regionY: normalizedCoordinateValidator.optional(),
+ regionWidth: normalizedSizeValidator.optional(),
+ regionHeight: normalizedSizeValidator.optional(),
+ xCoordinate: normalizedCoordinateValidator.optional(),
+ yCoordinate: normalizedCoordinateValidator.optional(),
+ data: z.record(z.string(), z.unknown()).optional()
+ })
+);
+
+export const balloonDeleteIdsValidator = z.array(z.string().min(1));
+
+// The document-level default sampling rule (fallback for features without
+// their own rule; the lot-level plan base). Sent by the editor as JSON.
+export const inspectionDocumentSamplingValidator = z.object({
+ samplingPlanType: z.enum(samplingPlanTypes).nullable(),
+ samplingSampleSize: z.number().int().positive().nullable(),
+ samplingPercentage: z.number().positive().max(100).nullable(),
+ samplingAql: z.number().positive().nullable(),
+ samplingInspectionLevel: z.enum(inspectionLevels).nullable(),
+ samplingSeverity: z.enum(inspectionSeverities).nullable()
+});
+
+const inspectionFeatureSamplingFieldsValidator = {
+ samplingPlanType: z.enum(samplingPlanTypes).nullable().optional(),
+ samplingSampleSize: z.number().int().positive().nullable().optional(),
+ samplingPercentage: z.number().positive().max(100).nullable().optional(),
+ samplingAql: z.number().positive().nullable().optional(),
+ samplingInspectionLevel: z.enum(inspectionLevels).nullable().optional(),
+ samplingSeverity: z.enum(inspectionSeverities).nullable().optional()
+};
+
+// The gauge type a feature must be measured with (optional). The save RPC
+// refuses another company's gauge type.
+const inspectionFeatureGaugeTypeValidator = {
+ gaugeTypeId: z.string().min(1).nullable().optional()
+};
+
+// The plan editor mints the ids of the characteristics and balloons it
+// creates, so a row keeps one id from the moment it is drawn. A taken id fails
+// the insert; it never overwrites. Other callers may still send a tempId and
+// read the persisted id back from the save's id maps.
+const clientIdValidator = z.string().regex(/^[A-Za-z0-9_-]{8,64}$/);
+
+export const inspectionSaveFeatureCreateItemValidator = z
+ .object({
+ id: clientIdValidator.optional(),
+ tempId: z.string().min(1).optional(),
+ pageNumber: pageNumberValidator,
+ label: z.string().min(1),
+ description: z.string().nullable().optional(),
+ nominalValue: z.string().nullable().optional(),
+ tolerancePlus: z.string().nullable().optional(),
+ toleranceMinus: z.string().nullable().optional(),
+ unit: z.string().nullable().optional(),
+ type: z.enum(procedureStepType).optional(),
+ ...inspectionFeatureSamplingFieldsValidator,
+ ...inspectionFeatureGaugeTypeValidator
+ })
+ .strict()
+ .refine((data) => Boolean(data.id) || Boolean(data.tempId), {
+ message: "id or tempId is required"
+ });
+
+export const inspectionSaveFeatureUpdateItemValidator = z
+ .object({
+ id: z.string().min(1),
+ pageNumber: pageNumberValidator.optional(),
+ label: z.string().min(1).optional(),
+ description: z.string().nullable().optional(),
+ nominalValue: z.string().nullable().optional(),
+ tolerancePlus: z.string().nullable().optional(),
+ toleranceMinus: z.string().nullable().optional(),
+ unit: z.string().nullable().optional(),
+ type: z.enum(procedureStepType).optional(),
+ ...inspectionFeatureSamplingFieldsValidator,
+ ...inspectionFeatureGaugeTypeValidator
+ })
+ .strict();
+
+export const inspectionSaveFeaturesPayloadValidator = z
+ .object({
+ create: z.array(inspectionSaveFeatureCreateItemValidator).default([]),
+ update: z.array(inspectionSaveFeatureUpdateItemValidator).default([]),
+ delete: z.array(z.string().min(1)).default([])
+ })
+ .strict();
+
+export const inspectionSaveBalloonGeometryCreateItemValidator = z
+ .object({
+ id: clientIdValidator.optional(),
+ tempInspectionFeatureId: z.string().min(1).optional(),
+ inspectionFeatureId: z.string().min(1).optional(),
+ tempBalloonAnchorId: z.string().min(1).optional(),
+ pageNumber: pageNumberValidator,
+ regionX: normalizedCoordinateValidator,
+ regionY: normalizedCoordinateValidator,
+ regionWidth: normalizedSizeValidator,
+ regionHeight: normalizedSizeValidator,
+ xCoordinate: normalizedCoordinateValidator,
+ yCoordinate: normalizedCoordinateValidator
+ })
+ .strict()
+ .refine(
+ (data) =>
+ Boolean(data.tempInspectionFeatureId) ||
+ Boolean(data.inspectionFeatureId),
+ { message: "tempInspectionFeatureId or inspectionFeatureId is required" }
+ );
+
+export const inspectionSaveBalloonGeometryUpdateItemValidator = z
+ .object({
+ id: z.string().min(1),
+ pageNumber: pageNumberValidator.optional(),
+ regionX: normalizedCoordinateValidator.optional(),
+ regionY: normalizedCoordinateValidator.optional(),
+ regionWidth: normalizedSizeValidator.optional(),
+ regionHeight: normalizedSizeValidator.optional(),
+ xCoordinate: normalizedCoordinateValidator.optional(),
+ yCoordinate: normalizedCoordinateValidator.optional()
+ })
+ .strict();
+
+export const inspectionSaveBalloonsGeometryPayloadValidator = z
+ .object({
+ create: z
+ .array(inspectionSaveBalloonGeometryCreateItemValidator)
+ .default([]),
+ update: z
+ .array(inspectionSaveBalloonGeometryUpdateItemValidator)
+ .default([]),
+ delete: z.array(z.string().min(1)).default([])
+ })
+ .strict();
+
+/** @deprecated Legacy combined payload; use features + balloons geometry split. */
+export const inspectionSaveBalloonCreateItemValidator = z
+ .object({
+ tempBalloonAnchorId: z.string().min(1),
+ label: z.string().min(1),
+ xCoordinate: normalizedCoordinateValidator,
+ yCoordinate: normalizedCoordinateValidator,
+ nominalValue: z.string().nullable().optional(),
+ tolerancePlus: z.string().nullable().optional(),
+ toleranceMinus: z.string().nullable().optional(),
+ unit: z.string().nullable().optional(),
+ description: z.string().nullable().optional(),
+ type: z.enum(procedureStepType).optional()
+ })
+ .strict();
+
+/** @deprecated Legacy combined payload. */
+export const inspectionSaveBalloonUpdateItemValidator = z
+ .object({
+ id: z.string().min(1),
+ label: z.string().min(1).optional(),
+ xCoordinate: normalizedCoordinateValidator.optional(),
+ yCoordinate: normalizedCoordinateValidator.optional(),
+ nominalValue: z.string().nullable().optional(),
+ tolerancePlus: z.string().nullable().optional(),
+ toleranceMinus: z.string().nullable().optional(),
+ unit: z.string().nullable().optional(),
+ description: z.string().nullable().optional(),
+ type: z.enum(procedureStepType).optional()
+ })
+ .strict();
+
+/** @deprecated Legacy combined payload. */
+export const inspectionSaveBalloonsPayloadValidator = z
+ .object({
+ create: z.array(inspectionSaveBalloonCreateItemValidator).default([]),
+ update: z.array(inspectionSaveBalloonUpdateItemValidator).default([]),
+ delete: z.array(z.string().min(1)).default([])
+ })
+ .strict();
+
+export const inspectionSaveAnchorCreateItemValidator = z
+ .object({
+ tempId: z.string().min(1),
+ pageNumber: pageNumberValidator,
+ xCoordinate: normalizedCoordinateValidator,
+ yCoordinate: normalizedCoordinateValidator,
+ width: normalizedSizeValidator,
+ height: normalizedSizeValidator
+ })
+ .strict();
+
+export const inspectionSaveAnchorUpdateItemValidator = z
+ .object({
+ id: z.string().min(1),
+ pageNumber: pageNumberValidator.optional(),
+ xCoordinate: normalizedCoordinateValidator.optional(),
+ yCoordinate: normalizedCoordinateValidator.optional(),
+ width: normalizedSizeValidator.optional(),
+ height: normalizedSizeValidator.optional()
+ })
+ .strict();
+
+export const inspectionSaveAnchorsPayloadValidator = z
+ .object({
+ create: z.array(inspectionSaveAnchorCreateItemValidator).default([]),
+ update: z.array(inspectionSaveAnchorUpdateItemValidator).default([]),
+ delete: z.array(z.string().min(1)).default([])
+ })
+ .strict();
+
+// ─── Balloon region vision analysis ──────────────────────────────────────────
+
+/**
+ * POST `/api/quality/inspection-document/:inspectionDocumentId/balloon-analyze` — request body
+ * uses `balloonRegionAnalysisRequestSchema`. Successful JSON body includes `analysis`
+ * matching `balloonRegionAnalysisResultSchema`:
+ *
+ * - `nominal`, `tol_plus`, `tol_minus`: number or `null` (no free-text dimensions).
+ * - `type`: always one of `balloonRegionFeatureTypes` (use `unknown` when not classifiable).
+ * - `unit`: one of `balloonRegionUnits` only when a unit symbol/text is visible in the crop;
+ * otherwise `null` (clients must not assume a default unit).
+ *
+ * Breaking change vs legacy: `type` and `unit` are closed vocabularies, not arbitrary strings.
+ *
+ * Server-only vision + prompts: `runInspectionBalloonRegionVisionAnalysis` in `quality.server.ts`.
+ */
+
+/** POST body for `/api/quality/inspection-document/:id/balloon-analyze` */
+export const balloonRegionAnalysisRequestSchema = z.object({
+ /** Base64-encoded image bytes (no `data:` prefix). */
+ imageBase64: z.string().min(1).max(28_000_000),
+ mediaType: z.enum(["image/png", "image/jpeg", "image/webp"]).optional()
+});
+
+/** Allowed `type` values for vision extraction (strict contract). */
+export const balloonRegionFeatureTypes = [
+ "linear",
+ "diameter",
+ "radius",
+ "angle",
+ "unknown"
+] as const;
+
+/** Allowed `unit` literals when a unit is visibly present in the crop; otherwise API returns `null`. */
+export const balloonRegionUnits = [
+ "mm",
+ "cm",
+ "m",
+ "in",
+ "ft",
+ "um",
+ "degree",
+ "rad"
+] as const;
+
+/** Structured extraction from a cropped engineering-drawing region. */
+export const balloonRegionAnalysisResultSchema = z.object({
+ nominal: z
+ .number()
+ .nullable()
+ .describe(
+ "Primary scalar from the dimension (length, diameter, radius, or angle magnitude). Null if unreadable."
+ ),
+ tol_plus: z
+ .number()
+ .nullable()
+ .describe(
+ "Upper tolerance vs nominal: bilateral ±T → +T; unilateral +a / −b → +a as printed (e.g. +0.005 → 0.005)."
+ ),
+ tol_minus: z
+ .number()
+ .nullable()
+ .describe(
+ "Lower tolerance vs nominal: bilateral ±T → −T (e.g. −0.02); unilateral +0.005 / −0.000 → 0 for a −.000 stack (no extra material below nominal on minus side)."
+ ),
+ unit: z
+ .enum(balloonRegionUnits)
+ .nullable()
+ .describe(
+ 'Allowed enum or null. Null unless unit text/symbol is visible in the crop (e.g. mm, in, ", °). Never infer from decimals or title block. For angles: degree or rad only when that notation appears; else null.'
+ ),
+ type: z
+ .enum(balloonRegionFeatureTypes)
+ .describe(
+ "Feature kind: linear, diameter, radius, angle, or unknown when ambiguous or not a simple dimension."
+ )
+});
+
+export type BalloonRegionAnalysis = z.infer<
+ typeof balloonRegionAnalysisResultSchema
+>;
diff --git a/apps/erp/app/modules/quality/quality.server.test.ts b/apps/erp/app/modules/quality/quality.server.test.ts
index 202dbb3add..9208fcaceb 100644
--- a/apps/erp/app/modules/quality/quality.server.test.ts
+++ b/apps/erp/app/modules/quality/quality.server.test.ts
@@ -1,5 +1,8 @@
import { describe, expect, it } from "vitest";
-import { valuateMeasurement } from "./quality.server";
+import {
+ translateLegacyInspectionSavePayload,
+ valuateMeasurement
+} from "./quality.server";
const numericFeature = {
type: "Measurement",
@@ -58,3 +61,85 @@ describe("valuateMeasurement", () => {
expect(valuateMeasurement(checkbox, null)).toBe("Pending");
});
});
+
+describe("translateLegacyInspectionSavePayload", () => {
+ it("maps combined balloon+anchor create to feature and geometry create", () => {
+ const result = translateLegacyInspectionSavePayload(
+ {
+ create: [
+ {
+ tempId: "temp-a1",
+ pageNumber: 1,
+ xCoordinate: 0.1,
+ yCoordinate: 0.2,
+ width: 0.05,
+ height: 0.04
+ }
+ ],
+ update: [],
+ delete: []
+ },
+ {
+ create: [
+ {
+ tempBalloonAnchorId: "temp-a1",
+ label: "1",
+ xCoordinate: 0.15,
+ yCoordinate: 0.25,
+ description: "Diameter",
+ nominalValue: "10",
+ tolerancePlus: "0.1",
+ toleranceMinus: "0.1",
+ unit: "mm"
+ }
+ ],
+ update: [],
+ delete: []
+ }
+ );
+
+ expect(result.features.create).toHaveLength(1);
+ expect(result.features.create[0]).toMatchObject({
+ tempId: "temp-a1",
+ label: "1",
+ description: "Diameter",
+ unit: "mm"
+ });
+ expect(result.balloons.create).toHaveLength(1);
+ expect(result.balloons.create[0]).toMatchObject({
+ tempInspectionFeatureId: "temp-a1",
+ tempBalloonAnchorId: "temp-a1",
+ regionX: 0.1,
+ xCoordinate: 0.15
+ });
+ });
+
+ it("creates anchor-only rows as feature with default label", () => {
+ const result = translateLegacyInspectionSavePayload(
+ {
+ create: [
+ {
+ tempId: "temp-anchor-only",
+ pageNumber: 2,
+ xCoordinate: 0,
+ yCoordinate: 0,
+ width: 0.1,
+ height: 0.1
+ }
+ ],
+ update: [],
+ delete: []
+ },
+ { create: [], update: [], delete: [] }
+ );
+
+ expect(result.features.create).toEqual([
+ expect.objectContaining({
+ tempId: "temp-anchor-only",
+ label: "0",
+ pageNumber: 2
+ })
+ ]);
+ expect(result.balloons.create).toHaveLength(1);
+ });
+});
diff --git a/apps/erp/app/modules/quality/quality.server.ts b/apps/erp/app/modules/quality/quality.server.ts
index c97c762e94..b733cf6053 100644
--- a/apps/erp/app/modules/quality/quality.server.ts
+++ b/apps/erp/app/modules/quality/quality.server.ts
@@ -4,15 +4,25 @@
* routes can run the same transactional core; these wrappers keep the ERP
* call sites unchanged by currying in the ERP Kysely singleton.
*/
+import { openai } from "@ai-sdk/openai";
+import type { Database } from "@carbon/database";
import * as engine from "@carbon/database/quality";
+import type { SupabaseClient } from "@supabase/supabase-js";
+import { generateText, Output } from "ai";
import type { z } from "zod";
import { getDatabaseClient } from "~/services/database.server";
import type {
+ BalloonRegionAnalysis,
inspectionDispositionValidator,
inspectionMeasurementValidator,
- inspectionSampleValidator
+ inspectionSampleValidator,
+ inspectionSaveAnchorsPayloadValidator,
+ inspectionSaveBalloonsGeometryPayloadValidator,
+ inspectionSaveBalloonsPayloadValidator,
+ inspectionSaveFeaturesPayloadValidator
} from "./quality.models";
+import { balloonRegionAnalysisResultSchema } from "./quality.models";
export type { Result } from "@carbon/database/quality";
export { errResult, valuateMeasurement } from "@carbon/database/quality";
@@ -63,3 +73,324 @@ export async function changeInspectionDocument(args: {
}) {
return engine.changeInspectionDocument(getDatabaseClient(), args);
}
+
+export async function recordInspectionGauge(
+ args: Parameters<typeof engine.recordInspectionGauge>[1]
+) {
+ return engine.recordInspectionGauge(getDatabaseClient(), args);
+}
+
+export async function getRecentInspectionGauges(
+ args: Parameters<typeof engine.getRecentInspectionGauges>[1]
+) {
+ return engine.getRecentInspectionGauges(getDatabaseClient(), args);
+}
+
+// ─── Inspection plan save ────────────────────────────────────────────────────
+
+/** Maps persisted balloon ids to inspectionFeature ids for legacy save payloads. */
+async function mapBalloonIdsToFeatureIdsForDocument(
+ client: SupabaseClient<Database>,
+ inspectionDocumentId: string,
+ companyId: string,
+ ids: string[]
+) {
+ const unique = [...new Set(ids.filter((id) => id.length > 0))];
+ const mapped = new Map<string, string>();
+ for (const id of unique) {
+ mapped.set(id, id);
+ }
+
+ const [balloons, features] = await Promise.all([
+ client
+ .from("balloon")
+ .select("id, inspectionFeatureId")
+ .eq("inspectionDocumentId", inspectionDocumentId)
+ .eq("companyId", companyId),
+ client
+ .from("inspectionFeature")
+ .select("id")
+ .eq("inspectionDocumentId", inspectionDocumentId)
+ .eq("companyId", companyId)
+ ]);
+
+ for (const balloon of balloons.data ?? []) {
+ if (mapped.has(balloon.id)) {
+ mapped.set(balloon.id, balloon.inspectionFeatureId);
+ }
+ }
+ for (const row of features.data ?? []) {
+ if (mapped.has(row.id)) {
+ mapped.set(row.id, row.id);
+ }
+ }
+
+ return mapped;
+}
+
+export type InspectionSaveFeaturesPayload = ReturnType<
+ typeof inspectionSaveFeaturesPayloadValidator.parse
+>;
+export type InspectionSaveBalloonsGeometryPayload = ReturnType<
+ typeof inspectionSaveBalloonsGeometryPayloadValidator.parse
+>;
+type LegacyAnchors = ReturnType<
+ typeof inspectionSaveAnchorsPayloadValidator.parse
+>;
+type LegacyBalloons = ReturnType<
+ typeof inspectionSaveBalloonsPayloadValidator.parse
+>;
+
+export function isTempInspectionId(id: string) {
+ return id.startsWith("temp-");
+}
+
+/** Maps legacy anchors + metadata balloons save shape to features + geometry balloons. */
+export function translateLegacyInspectionSavePayload(
+ anchors: LegacyAnchors,
+ balloons: LegacyBalloons
+): {
+ features: InspectionSaveFeaturesPayload;
+ balloons: InspectionSaveBalloonsGeometryPayload;
+} {
+ const anchorByTempId = new Map(anchors.create.map((a) => [a.tempId, a]));
+
+ const featuresCreate = balloons.create.map((b) => {
+ const anchor = anchorByTempId.get(b.tempBalloonAnchorId);
+ return {
+ tempId: b.tempBalloonAnchorId,
+ pageNumber: anchor?.pageNumber ?? 1,
+ label: b.label,
+ description: b.description ?? null,
+ nominalValue: b.nominalValue ?? null,
+ tolerancePlus: b.tolerancePlus ?? null,
+ toleranceMinus: b.toleranceMinus ?? null,
+ unit: b.unit ?? null
+ };
+ });
+
+ for (const anchor of anchors.create) {
+ if (featuresCreate.some((f) => f.tempId === anchor.tempId)) continue;
+ featuresCreate.push({
+ tempId: anchor.tempId,
+ pageNumber: anchor.pageNumber,
+ label: "0",
+ description: null,
+ nominalValue: null,
+ tolerancePlus: null,
+ toleranceMinus: null,
+ unit: null
+ });
+ }
+
+ const balloonsCreate = balloons.create.map((b) => {
+ const anchor = anchorByTempId.get(b.tempBalloonAnchorId);
+ return {
+ tempInspectionFeatureId: b.tempBalloonAnchorId,
+ tempBalloonAnchorId: b.tempBalloonAnchorId,
+ pageNumber: anchor?.pageNumber ?? 1,
+ regionX: anchor?.xCoordinate ?? 0,
+ regionY: anchor?.yCoordinate ?? 0,
+ regionWidth: anchor?.width ?? 0.1,
+ regionHeight: anchor?.height ?? 0.1,
+ xCoordinate: b.xCoordinate,
+ yCoordinate: b.yCoordinate
+ };
+ });
+
+ for (const anchor of anchors.create) {
+ if (balloons.create.some((b) => b.tempBalloonAnchorId === anchor.tempId)) {
+ continue;
+ }
+ balloonsCreate.push({
+ tempInspectionFeatureId: anchor.tempId,
+ tempBalloonAnchorId: anchor.tempId,
+ pageNumber: anchor.pageNumber,
+ regionX: anchor.xCoordinate,
+ regionY: anchor.yCoordinate,
+ regionWidth: anchor.width,
+ regionHeight: anchor.height,
+ xCoordinate: Math.min(
+ 1 - 0.04,
+ Math.max(0, anchor.xCoordinate + anchor.width + 0.02)
+ ),
+ yCoordinate: Math.min(1 - 0.04, Math.max(0, anchor.yCoordinate))
+ });
+ }
+
+ const featuresUpdate = balloons.update.map((b) => ({
+ id: b.id,
+ label: b.label,
+ description: b.description ?? null,
+ nominalValue: b.nominalValue ?? null,
+ tolerancePlus: b.tolerancePlus ?? null,
+ toleranceMinus: b.toleranceMinus ?? null,
+ unit: b.unit ?? null
+ }));
+
+ const balloonsUpdate = [
+ ...anchors.update.map((a) => ({
+ id: a.id,
+ pageNumber: a.pageNumber,
+ regionX: a.xCoordinate,
+ regionY: a.yCoordinate,
+ regionWidth: a.width,
+ regionHeight: a.height
+ })),
+ ...balloons.update.map((b) => ({
+ id: b.id,
+ xCoordinate: b.xCoordinate,
+ yCoordinate: b.yCoordinate
+ }))
+ ];
+
+ const mergedBalloonUpdates = new Map<
+ string,
+ (typeof balloonsUpdate)[number]
+ >();
+ for (const item of balloonsUpdate) {
+ const existing = mergedBalloonUpdates.get(item.id);
+ mergedBalloonUpdates.set(item.id, { ...existing, ...item });
+ }
+
+ return {
+ features: {
+ create: featuresCreate,
+ update: featuresUpdate,
+ delete: [...new Set([...balloons.delete, ...anchors.delete])]
+ },
+ balloons: {
+ create: balloonsCreate,
+ update: [...mergedBalloonUpdates.values()],
+ delete: []
+ }
+ };
+}
+
+export function mergeInspectionFeaturesPayload(
+ base: InspectionSaveFeaturesPayload,
+ extra: InspectionSaveFeaturesPayload
+): InspectionSaveFeaturesPayload {
+ return {
+ create: [...base.create, ...extra.create],
+ update: [...base.update, ...extra.update],
+ delete: [...new Set([...base.delete, ...extra.delete])]
+ };
+}
+
+export function mergeInspectionBalloonsPayload(
+ base: InspectionSaveBalloonsGeometryPayload,
+ extra: InspectionSaveBalloonsGeometryPayload
+): InspectionSaveBalloonsGeometryPayload {
+ return {
+ create: [...base.create, ...extra.create],
+ update: [...base.update, ...extra.update],
+ delete: [...new Set([...base.delete, ...extra.delete])]
+ };
+}
+
+export async function resolveInspectionFeaturePayloadIds(
+ client: SupabaseClient<Database>,
+ inspectionDocumentId: string,
+ companyId: string,
+ features: InspectionSaveFeaturesPayload
+): Promise<InspectionSaveFeaturesPayload> {
+ const ids = [
+ ...features.update.map((row) => row.id),
+ ...features.delete
+ ].filter((rowId) => !isTempInspectionId(rowId));
+
+ if (ids.length === 0) {
+ return features;
+ }
+
+ const idMap = await mapBalloonIdsToFeatureIdsForDocument(
+ client,
+ inspectionDocumentId,
+ companyId,
+ ids
+ );
+
+ return {
+ create: features.create,
+ update: features.update.map((row) => ({
+ ...row,
+ id: idMap.get(row.id) ?? row.id
+ })),
+ delete: [
+ ...new Set(features.delete.map((rowId) => idMap.get(rowId) ?? rowId))
+ ]
+ };
+}
+
+// ─── Balloon region vision analysis ──────────────────────────────────────────
+
+/** Decoded image size limit for vision analyze (bytes). */
+export const INSPECTION_BALLOON_ANALYZE_MAX_IMAGE_BYTES = 12 * 1024 * 1024;
+
+const BALLOON_REGION_ANALYSIS_SYSTEM = `You assist with mechanical inspection ballooning on technical CAD drawings.
+
+You receive one raster image: a crop of a single callout region from a sheet.
+
+Return ONLY the JSON object matching the schema (field names and allowed enum values exactly).
+
+type (required, exactly one of):
+- linear — linear length/width/height dimension without ⌀ or R prefix.
+- diameter — nominal is the value for a diameter callout (⌀ or equivalent).
+- radius — nominal is the value for a radius callout (R or equivalent).
+- angle — nominal is the numeric angle; set unit to degree or rad only when °, deg, or rad is visible in the crop; otherwise unit null.
+- unknown — not clearly one of the above, or unreadable / ambiguous.
+
+unit (nullable, exactly one of the allowed enum strings or null):
+- Default is null. Set unit ONLY when this crop visibly shows a unit indicator (e.g. mm, cm, m, um, µm, in, ", IN, ft, °, DEG, RAD, or equivalent text/symbols next to the dimension).
+- Do NOT infer unit from decimal places, title block, drawing "standard," locale, or anything outside visible pixels in this crop. A bare number with tolerances but no unit text/symbol → unit null.
+- For type angle: use degree or rad only when that angle notation is visible; otherwise unit null.
+
+nominal / tolerances:
+- Prefer numbers from the print; use null (not zero) when not shown or unreadable.
+- Bilateral ±T: tol_plus = +T, tol_minus = -T (e.g. ±0.02 → tol_plus 0.02, tol_minus -0.02).
+- Unilateral stacked +0.005 / -0.000 (plus above, minus below nominal): tol_plus = 0.005, tol_minus = 0 (minus side is zero additional tolerance below nominal).
+- Other asymmetric +a / −b (both non-zero): tol_plus = +a, tol_minus = -b using the signed values as printed relative to nominal.
+
+Do not invent title-block or revision data outside the crop.
+`;
+
+const BALLOON_REGION_ANALYSIS_USER_MESSAGE =
+ "Extract nominal, tol_plus, tol_minus, unit, and type per the system rules. For unit: use null unless a unit symbol or unit letters are literally visible in this crop; do not guess. Use only allowed enum literals for type and for unit when non-null.";
+
+const BALLOON_REGION_ANALYSIS_SCHEMA_DESCRIPTION =
+ "Drawing crop: nominal, tolerances, type enum; unit enum only when a unit symbol/text is visible in the crop, otherwise null";
+
+/**
+ * Runs vision extraction on a prepared PNG/JPEG/WebP buffer (caller validates size and auth).
+ */
+export async function runInspectionBalloonRegionVisionAnalysis(args: {
+ imageBytes: Buffer;
+ mediaType: string;
+}): Promise<BalloonRegionAnalysis> {
+ const { imageBytes, mediaType } = args;
+ const { output: object } = await generateText({
+ model: openai("gpt-4o"),
+ output: Output.object({
+ schema: balloonRegionAnalysisResultSchema,
+ name: "balloon_region_analysis",
+ description: BALLOON_REGION_ANALYSIS_SCHEMA_DESCRIPTION
+ }),
+ instructions: BALLOON_REGION_ANALYSIS_SYSTEM,
+ messages: [
+ {
+ role: "user",
+ content: [
+ { type: "text", text: BALLOON_REGION_ANALYSIS_USER_MESSAGE },
+ {
+ type: "image",
+ image: imageBytes,
+ mediaType
+ }
+ ]
+ }
+ ],
+ temperature: 0.1
+ });
+ return object;
+}
diff --git a/apps/erp/app/modules/quality/quality.service.ts b/apps/erp/app/modules/quality/quality.service.ts
index 379533e9de..0aa7c6f691 100644
--- a/apps/erp/app/modules/quality/quality.service.ts
+++ b/apps/erp/app/modules/quality/quality.service.ts
@@ -20,6 +20,8 @@ import type {
gaugeRole,
gaugeTypeValidator,
gaugeValidator,
+ inspectionDocumentSamplingValidator,
+ inspectionDocumentValidator,
issueTypeValidator,
issueValidator,
issueWorkflowValidator,
@@ -2417,12 +2419,47 @@ export async function getInspectionSamplingPlans(
return client
.from("inspectionSamplingPlan")
.select(
- "*, inspectionFeature(id, label, description, pageNumber, type, nominalValue, tolerancePlus, toleranceMinus, unit)"
+ "*, inspectionFeature(id, label, description, pageNumber, type, nominalValue, tolerancePlus, toleranceMinus, unit, gaugeTypeId, gaugeType(name))"
)
.eq("inspectionId", inspectionId)
.eq("companyId", companyId);
}
+// The gauges an inspection lot's view needs: every Active gauge (the
+// selectable options — Inactive gauges are retired and never offered, the
+// engine refuses them too) plus any gauge already recorded on this lot, even
+// if it has since been retired, so the record keeps showing its readable id.
+export async function getInspectionGauges(
+ client: SupabaseClient<Database>,
+ companyId: string,
+ inspectionId: string
+) {
+ const recorded = await client
+ .from("inspectionSamplingPlan")
+ .select("gaugeId")
+ .eq("inspectionId", inspectionId)
+ .eq("companyId", companyId)
+ .not("gaugeId", "is", null);
+ const recordedIds = [
+ ...new Set((recorded.data ?? []).map((row) => row.gaugeId as string))
+ ];
+
+ const query = client
+ .from("gauges")
+ .select(
+ "id, gaugeId, description, gaugeTypeId, gaugeStatus, gaugeCalibrationStatusWithDueDate, nextCalibrationDate"
+ )
+ .eq("companyId", companyId);
+
+ return (
+ recordedIds.length > 0
+ ? query.or(
+ `gaugeStatus.eq.Active,id.in.(${recordedIds.map((id) => `"${id}"`).join(",")})`
+ )
+ : query.eq("gaugeStatus", "Active")
+ ).order("gaugeId");
+}
+
export async function getInspectionMeasurements(
client: SupabaseClient<Database>,
inspectionId: string,
@@ -2492,3 +2529,558 @@ export async function upsertItemInspectionDocumentAssignment(
createdBy: assignment.userId
});
}
+
+// ─── Inspection Documents ─────────────────────────────────────────────────────
+
+function toStoragePath(pdfUrl?: string | null) {
+ if (!pdfUrl) return null;
+ const previewPrefix = "/file/preview/private/";
+ if (pdfUrl.startsWith(previewPrefix)) {
+ return pdfUrl.slice(previewPrefix.length);
+ }
+ return pdfUrl;
+}
+
+function toPreviewUrl(storagePath?: string | null) {
+ if (!storagePath) return null;
+ return storagePath.startsWith("/file/preview/private/")
+ ? storagePath
+ : `/file/preview/private/${storagePath}`;
+}
+
+function fileNameFromPath(storagePath?: string | null) {
+ if (!storagePath) return "drawing.pdf";
+ return storagePath.split("/").at(-1) ?? "drawing.pdf";
+}
+
+function mapInspectionDocument(row: Record<string, unknown>) {
+ const drawingNumber = (row.drawingNumber as string | null) ?? null;
+ return {
+ id: String(row.id),
+ name: String(drawingNumber ?? row.fileName ?? "Untitled Diagram"),
+ companyId: String(row.companyId),
+ partId: (row.partId as string | null) ?? null,
+ createdBy: String(row.createdBy),
+ updatedBy: (row.updatedBy as string | null) ?? null,
+ createdAt: String(row.createdAt),
+ updatedAt: (row.updatedAt as string | null) ?? null,
+ content: {
+ drawingNumber,
+ pdfUrl: toPreviewUrl((row.storagePath as string | null) ?? null),
+ annotations: [],
+ features: []
+ },
+ // The document's default sampling rule (feature rule -> document default
+ // -> All). NUMERIC columns arrive as strings from PostgREST — coerce.
+ sampling: {
+ samplingPlanType: (row.samplingPlanType as string | null) ?? null,
+ samplingSampleSize: (row.samplingSampleSize as number | null) ?? null,
+ samplingPercentage:
+ row.samplingPercentage == null ? null : Number(row.samplingPercentage),
+ samplingAql: row.samplingAql == null ? null : Number(row.samplingAql),
+ samplingInspectionLevel:
+ (row.samplingInspectionLevel as string | null) ?? null,
+ samplingSeverity: (row.samplingSeverity as string | null) ?? null
+ }
+ };
+}
+
+export async function getInspectionDocuments(
+ client: SupabaseClient<Database>,
+ companyId: string,
+ args?: { search: string | null } & GenericQueryFilters
+) {
+ let query = client
+ .from("inspectionDocuments")
+ .select("*", { count: "exact" })
+ .eq("companyId", companyId);
+
+ if (args?.search) {
+ query = query.or(
+ `drawingNumber.ilike.%${args.search}%,fileName.ilike.%${args.search}%,partReadableId.ilike.%${args.search}%`
+ );
+ }
+
+ if (args) {
+ query = setGenericQueryFilters(query, args, [
+ { column: "drawingNumber", ascending: true }
+ ]);
+ }
+
+ const result = await query;
+
+ return {
+ data: (result.data ?? []).map((row: Record<string, unknown>) =>
+ mapInspectionDocument(row)
+ ),
+ count: result.count ?? 0,
+ error: result.error
+ };
+}
+
+export async function getInspectionDocumentsForItem(
+ client: SupabaseClient<Database>,
+ itemId: string,
+ companyId: string
+) {
+ return client
+ .from("inspectionDocument")
+ .select("id, fileName, drawingNumber, version")
+ .eq("companyId", companyId)
+ .eq("partId", itemId)
+ .order("updatedAt", { ascending: false, nullsFirst: false });
+}
+
+export async function getInspectionDocument(
+ client: SupabaseClient<Database>,
+ id: string,
+ companyId: string
+) {
+ const result = await client
+ .from("inspectionDocument")
+ .select("*")
+ .eq("id", id)
+ .eq("companyId", companyId)
+ .single();
+
+ return {
+ data: result.data ? mapInspectionDocument(result.data) : null,
+ error: result.error
+ };
+}
+
+/**
+ * When an inspection plan is created without a drawing number, fall back to the
+ * part's readableIdWithRevision. If a plan with that drawing number already
+ * exists for the company, append " (1)", " (2)", etc. until it is unique.
+ */
+async function resolveInspectionDocumentDrawingNumber(
+ client: SupabaseClient<Database>,
+ companyId: string,
+ partId: string
+): Promise<string | null> {
+ const partResult = await client
+ .from("item")
+ .select("readableIdWithRevision")
+ .eq("id", partId)
+ .eq("companyId", companyId)
+ .single();
+
+ const base = partResult.data?.readableIdWithRevision?.trim();
+ if (!base) return null;
+
+ const existingResult = await client
+ .from("inspectionDocument")
+ .select("drawingNumber")
+ .eq("companyId", companyId)
+ .not("drawingNumber", "is", null);
+
+ const taken = new Set(
+ (existingResult.data ?? [])
+ .map((row) => row.drawingNumber)
+ .filter((value): value is string => Boolean(value))
+ );
+
+ if (!taken.has(base)) return base;
+
+ let suffix = 1;
+ while (taken.has(`${base} (${suffix})`)) {
+ suffix += 1;
+ }
+ return `${base} (${suffix})`;
+}
+
+export async function upsertInspectionDocument(
+ client: SupabaseClient<Database>,
+ diagram:
+ | (Omit<z.infer<typeof inspectionDocumentValidator>, "id"> & {
+ id?: undefined;
+ companyId: string;
+ createdBy: string;
+ updatedBy?: string;
+ pageCount?: number;
+ defaultPageWidth?: number;
+ defaultPageHeight?: number;
+ })
+ | (Omit<z.infer<typeof inspectionDocumentValidator>, "id"> & {
+ id: string;
+ companyId: string;
+ createdBy: string;
+ updatedBy?: string;
+ pageCount?: number;
+ defaultPageWidth?: number;
+ defaultPageHeight?: number;
+ })
+) {
+ const {
+ id,
+ partId,
+ drawingNumber,
+ pdfUrl,
+ pageCount,
+ defaultPageWidth,
+ defaultPageHeight,
+ companyId,
+ createdBy,
+ updatedBy
+ } = diagram;
+
+ const storagePath = toStoragePath(pdfUrl);
+
+ if (id) {
+ if (!companyId) {
+ return {
+ data: null,
+ error: {
+ message: "companyId is required to update inspection plan"
+ }
+ };
+ }
+
+ const existing = await client
+ .from("inspectionDocument")
+ .select("id")
+ .eq("id", id)
+ .eq("companyId", companyId)
+ .maybeSingle();
+
+ if (!existing.data) {
+ return {
+ data: null,
+ error: existing.error ?? { message: "Inspection plan not found" }
+ };
+ }
+
+ const updatePayload: Database["public"]["Tables"]["inspectionDocument"]["Update"] =
+ {
+ updatedBy: updatedBy ?? createdBy,
+ updatedAt: datetime.timestamp()
+ };
+ if (drawingNumber !== undefined) {
+ updatePayload.drawingNumber = drawingNumber ?? null;
+ }
+ if (partId !== undefined) {
+ updatePayload.partId = partId;
+ }
+
+ if (storagePath) {
+ updatePayload.storagePath = storagePath;
+ updatePayload.fileName = fileNameFromPath(storagePath);
+ }
+ if (pageCount && pageCount > 0) {
+ updatePayload.pageCount = pageCount;
+ }
+ if (defaultPageWidth && defaultPageWidth > 0) {
+ updatePayload.defaultPageWidth = defaultPageWidth;
+ }
+ if (defaultPageHeight && defaultPageHeight > 0) {
+ updatePayload.defaultPageHeight = defaultPageHeight;
+ }
+
+ return client
+ .from("inspectionDocument")
+ .update(updatePayload)
+ .eq("id", id)
+ .eq("companyId", companyId)
+ .select("id")
+ .single();
+ }
+
+ if (!companyId) {
+ return {
+ data: null,
+ error: { message: "companyId is required to create inspection plan" }
+ };
+ }
+
+ const resolvedDrawingNumber = drawingNumber?.trim()
+ ? drawingNumber.trim()
+ : await resolveInspectionDocumentDrawingNumber(client, companyId, partId);
+
+ return client
+ .from("inspectionDocument")
+ .insert({
+ companyId,
+ partId,
+ drawingNumber: resolvedDrawingNumber ?? null,
+ version: 0,
+ ...(storagePath
+ ? {
+ storagePath,
+ fileName: fileNameFromPath(storagePath),
+ uploadedBy: createdBy
+ }
+ : {}),
+ ...(pageCount && pageCount > 0 ? { pageCount } : {}),
+ ...(defaultPageWidth && defaultPageWidth > 0 ? { defaultPageWidth } : {}),
+ ...(defaultPageHeight && defaultPageHeight > 0
+ ? { defaultPageHeight }
+ : {}),
+ createdBy
+ })
+ .select("id")
+ .single();
+}
+
+export async function deleteInspectionDocument(
+ client: SupabaseClient<Database>,
+ id: string,
+ companyId: string
+) {
+ const existingResult = await client
+ .from("inspectionDocument")
+ .select("*")
+ .eq("id", id)
+ .eq("companyId", companyId)
+ .single();
+
+ if (!existingResult.data) {
+ return {
+ data: null,
+ error: { message: "Inspection plan not found" }
+ };
+ }
+
+ const storagePath =
+ (existingResult.data.storagePath as string | null) ?? null;
+
+ const deleteResult = await client
+ .from("inspectionDocument")
+ .delete()
+ .eq("id", id)
+ .eq("companyId", companyId);
+
+ if (deleteResult.error) {
+ return { data: null, error: deleteResult.error };
+ }
+
+ return {
+ data: { storagePath },
+ error: null
+ };
+}
+
+function mapInspectionFeature(row: Record<string, unknown>) {
+ const balloonIdRaw = row.balloonId ?? row.balloon_id;
+ return {
+ id: String(row.id),
+ inspectionDocumentId: String(row.inspectionDocumentId),
+ companyId: String(row.companyId),
+ pageNumber: Number(row.pageNumber),
+ label: String(row.label),
+ description: (row.description as string | null) ?? null,
+ nominalValue: (row.nominalValue as string | null) ?? null,
+ tolerancePlus: (row.tolerancePlus as string | null) ?? null,
+ toleranceMinus: (row.toleranceMinus as string | null) ?? null,
+ unit: (row.unit as string | null) ?? null,
+ type: (row.type as string) ?? "Measurement",
+ // Per-feature sampling rule (NULL = inherit the document default). NUMERIC
+ // columns arrive as strings from PostgREST — coerce, mirroring the document
+ // default rule in mapInspectionDocument.
+ samplingPlanType: (row.samplingPlanType as string | null) ?? null,
+ samplingSampleSize: (row.samplingSampleSize as number | null) ?? null,
+ samplingPercentage:
+ row.samplingPercentage == null ? null : Number(row.samplingPercentage),
+ samplingAql: row.samplingAql == null ? null : Number(row.samplingAql),
+ samplingInspectionLevel:
+ (row.samplingInspectionLevel as string | null) ?? null,
+ samplingSeverity: (row.samplingSeverity as string | null) ?? null,
+ gaugeTypeId: (row.gaugeTypeId as string | null) ?? null,
+ balloonId:
+ typeof balloonIdRaw === "string"
+ ? balloonIdRaw
+ : balloonIdRaw != null
+ ? String(balloonIdRaw)
+ : null,
+ createdBy: String(row.createdBy),
+ updatedBy: (row.updatedBy as string | null) ?? null,
+ createdAt: String(row.createdAt),
+ updatedAt: (row.updatedAt as string | null) ?? null
+ };
+}
+
+function mapBalloon(row: Record<string, unknown>) {
+ return {
+ id: String(row.id),
+ inspectionDocumentId: String(row.inspectionDocumentId),
+ companyId: String(row.companyId),
+ inspectionFeatureId: String(row.inspectionFeatureId),
+ pageNumber: Number(row.pageNumber),
+ regionX: Number(row.regionX),
+ regionY: Number(row.regionY),
+ regionWidth: Number(row.regionWidth),
+ regionHeight: Number(row.regionHeight),
+ xCoordinate: Number(row.xCoordinate),
+ yCoordinate: Number(row.yCoordinate),
+ createdBy: String(row.createdBy),
+ updatedBy: (row.updatedBy as string | null) ?? null,
+ createdAt: String(row.createdAt),
+ updatedAt: (row.updatedAt as string | null) ?? null,
+ balloonAnchorId: String(row.id)
+ };
+}
+
+export async function getInspectionFeatures(
+ client: SupabaseClient<Database>,
+ inspectionDocumentId: string
+) {
+ const [featuresResult, balloonsResult] = await Promise.all([
+ getInspectionFeaturesRaw(client, inspectionDocumentId),
+ getBalloons(client, inspectionDocumentId)
+ ]);
+
+ if (featuresResult.error) {
+ return { data: null, error: featuresResult.error };
+ }
+ if (balloonsResult.error) {
+ return { data: null, error: balloonsResult.error };
+ }
+
+ const balloonByFeatureId = new Map(
+ (balloonsResult.data ?? []).map((b) => [b.inspectionFeatureId, b.id])
+ );
+
+ return {
+ data: (featuresResult.data ?? []).map((row) =>
+ mapInspectionFeature({
+ ...row,
+ balloonId: balloonByFeatureId.get(String(row.id)) ?? null
+ })
+ ),
+ error: null
+ };
+}
+
+async function getInspectionFeaturesRaw(
+ client: SupabaseClient<Database>,
+ inspectionDocumentId: string
+) {
+ return client
+ .from("inspectionFeature")
+ .select("*")
+ .eq("inspectionDocumentId", inspectionDocumentId)
+ .order("createdAt", { ascending: true });
+}
+
+export async function getBalloons(
+ client: SupabaseClient<Database>,
+ inspectionDocumentId: string
+) {
+ const result = await client
+ .from("balloon")
+ .select("*")
+ .eq("inspectionDocumentId", inspectionDocumentId)
+ .order("createdAt", { ascending: true });
+
+ return {
+ data: (result.data ?? []).map(mapBalloon),
+ error: result.error
+ };
+}
+
+export async function getInspectionPlan(
+ client: SupabaseClient<Database>,
+ inspectionDocumentId: string
+) {
+ const [featuresResult, balloonsResult] = await Promise.all([
+ getInspectionFeaturesRaw(client, inspectionDocumentId),
+ getBalloons(client, inspectionDocumentId)
+ ]);
+
+ if (featuresResult.error) {
+ return { data: null, error: featuresResult.error };
+ }
+ if (balloonsResult.error) {
+ return { data: null, error: balloonsResult.error };
+ }
+
+ const balloonByFeatureId = new Map(
+ (balloonsResult.data ?? []).map((b) => [b.inspectionFeatureId, b])
+ );
+
+ return {
+ data: (featuresResult.data ?? []).map((row) => {
+ const b = balloonByFeatureId.get(row.id);
+ const featureId = row.id;
+ return {
+ /** Feature id (primary key for plan rows). */
+ id: featureId,
+ featureId,
+ /** Balloon id when placed; null for table-only features. */
+ balloonId: b?.id ?? null,
+ inspectionDocumentId: row.inspectionDocumentId,
+ pageNumber: b?.pageNumber ?? row.pageNumber,
+ label: row.label,
+ description: row.description,
+ nominalValue: row.nominalValue,
+ tolerancePlus: row.tolerancePlus,
+ toleranceMinus: row.toleranceMinus,
+ unit: row.unit,
+ regionX: b ? b.regionX : null,
+ regionY: b ? b.regionY : null,
+ regionWidth: b ? b.regionWidth : null,
+ regionHeight: b ? b.regionHeight : null,
+ xCoordinate: b ? b.xCoordinate : null,
+ yCoordinate: b ? b.yCoordinate : null
+ };
+ }),
+ error: null
+ };
+}
+
+export async function updateInspectionDocumentSampling(
+ client: SupabaseClient<Database>,
+ args: z.infer<typeof inspectionDocumentSamplingValidator> & {
+ inspectionDocumentId: string;
+ companyId: string;
+ userId: string;
+ }
+) {
+ const { inspectionDocumentId, companyId, userId, ...sampling } = args;
+ return client
+ .from("inspectionDocument")
+ .update({
+ ...sampling,
+ updatedBy: userId,
+ updatedAt: new Date().toISOString()
+ })
+ .eq("id", inspectionDocumentId)
+ .eq("companyId", companyId);
+}
+
+export async function saveInspectionDocumentAtomic(
+ client: SupabaseClient<Database>,
+ args: {
+ inspectionDocumentId: string;
+ companyId: string;
+ userId: string;
+ pdfUrl?: string | null;
+ pageCount?: number;
+ defaultPageWidth?: number;
+ defaultPageHeight?: number;
+ features: unknown;
+ balloons: unknown;
+ }
+) {
+ return (
+ client as unknown as {
+ rpc: (
+ fn: string,
+ args: Record<string, unknown>
+ ) => Promise<{
+ data: unknown;
+ error: unknown;
+ }>;
+ }
+ ).rpc("save_inspection_document_atomic", {
+ p_inspection_document_id: args.inspectionDocumentId,
+ p_company_id: args.companyId,
+ p_user_id: args.userId,
+ p_pdf_url: args.pdfUrl ?? null,
+ p_page_count: args.pageCount ?? null,
+ p_default_page_width: args.defaultPageWidth ?? null,
+ p_default_page_height: args.defaultPageHeight ?? null,
+ p_features: args.features,
+ p_balloons: args.balloons
+ });
+}
diff --git a/apps/erp/app/modules/quality/types.ts b/apps/erp/app/modules/quality/types.ts
index ea12e23c23..b4dc1c9f79 100644
--- a/apps/erp/app/modules/quality/types.ts
+++ b/apps/erp/app/modules/quality/types.ts
@@ -6,6 +6,8 @@ import type {
getGauges,
getGaugeTypes,
getInspection,
+ getInspectionDocuments,
+ getInspectionGauges,
getInspectionMeasurements,
getInspectionSamplingPlans,
getInspections,
@@ -187,6 +189,10 @@ export type InspectionSamplingPlan = NonNullable<
Awaited<ReturnType<typeof getInspectionSamplingPlans>>["data"]
>[number];
+export type InspectionGauge = NonNullable<
+ Awaited<ReturnType<typeof getInspectionGauges>>["data"]
+>[number];
+
export type InspectionMeasurement = NonNullable<
Awaited<ReturnType<typeof getInspectionMeasurements>>["data"]
>[number];
@@ -194,3 +200,25 @@ export type InspectionMeasurement = NonNullable<
export type IssueTypeListItem = NonNullable<
Awaited<ReturnType<typeof getIssueTypesList>>["data"]
>[number];
+
+// --- Inspection Documents -----------------------------------------------
+
+export type InspectionDocument = NonNullable<
+ Awaited<ReturnType<typeof getInspectionDocuments>>["data"]
+>[number];
+
+export type BalloonFeature = {
+ id: string;
+ balloonNumber: number;
+ description: string;
+ nominalValue: number | null;
+ tolerancePlus: number | null;
+ toleranceMinus: number | null;
+ unitOfMeasureCode: string | null;
+};
+
+export type InspectionDocumentContent = {
+ pdfUrl: string | null;
+ drawingNumber: string | null;
+ features: BalloonFeature[];
+};
diff --git a/apps/erp/app/modules/quality/ui/Documents/QualityDocumentProperties.tsx b/apps/erp/app/modules/quality/ui/Documents/QualityDocumentProperties.tsx
index e59a733042..24ab14dd9c 100644
--- a/apps/erp/app/modules/quality/ui/Documents/QualityDocumentProperties.tsx
+++ b/apps/erp/app/modules/quality/ui/Documents/QualityDocumentProperties.tsx
@@ -1,6 +1,7 @@
import { Select, ValidatedForm } from "@carbon/form";
import {
Button,
+ Copy,
HStack,
Subheading,
Tooltip,
@@ -135,24 +136,13 @@ const QualityDocumentProperties = () => {
</span>
</TooltipContent>
</Tooltip>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- variant="ghost"
- aria-label={t`Copy`}
- size="sm"
- className="p-1"
- onClick={() => copyToClipboard(routeData?.document?.id ?? "")}
- >
- <LuKeySquare className="w-3 h-3" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <span>
- <Trans>Copy document unique identifier</Trans>
- </span>
- </TooltipContent>
- </Tooltip>
+ <Copy
+ text={routeData?.document?.id ?? ""}
+ label={t`Copy document unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/production/ui/InspectionDocument/InspectionDocumentEditor.tsx b/apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentEditor.tsx
similarity index 87%
rename from apps/erp/app/modules/production/ui/InspectionDocument/InspectionDocumentEditor.tsx
rename to apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentEditor.tsx
index b23a19a621..2afde26bc1 100644
--- a/apps/erp/app/modules/production/ui/InspectionDocument/InspectionDocumentEditor.tsx
+++ b/apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentEditor.tsx
@@ -1,6 +1,7 @@
import { useCarbon } from "@carbon/auth";
import {
Button,
+ Combobox,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
@@ -30,6 +31,12 @@ import "react-pdf/dist/Page/AnnotationLayer.css";
import "react-pdf/dist/Page/TextLayer.css";
import type { Database } from "@carbon/database";
import { storage } from "@carbon/files";
+import {
+ BALLOON_CALLOUT_STROKE,
+ BALLOON_H_NORM,
+ BALLOON_W_NORM,
+ clippedBalloonToAnchorLine
+} from "@carbon/utils";
import type { ColumnDef } from "@tanstack/react-table";
import {
LuChevronDown,
@@ -44,13 +51,12 @@ import {
LuMinus,
LuPlus,
LuRectangleHorizontal,
- LuSave,
LuScan,
LuSlidersHorizontal,
LuTrash2,
LuUpload
} from "react-icons/lu";
-import { useFetcher, useNavigate } from "react-router";
+import { useBlocker, useFetcher, useNavigate } from "react-router";
import type { EditableTableCellComponentProps } from "~/components/Editable";
import { EditableList, EditableText } from "~/components/Editable";
import Grid from "~/components/Grid";
@@ -58,14 +64,23 @@ import { ProcedureStepTypeIcon } from "~/components/Icons";
import { ConfirmDelete } from "~/components/Modals";
import { usePermissions, useUser } from "~/hooks";
import { getLinkToItemDetails } from "~/modules/items/ui/Item/ItemForm";
-import type { BalloonRegionAnalysis } from "~/modules/production/inspectionBalloonAnalyze";
-import type { InspectionDocumentContent } from "~/modules/production/types";
+import type { BalloonRegionAnalysis } from "~/modules/quality/quality.models";
import type { SamplingStandard } from "~/modules/quality/samplingStandards";
+import type { InspectionDocumentContent } from "~/modules/quality/types";
import { procedureStepType } from "~/modules/shared/shared.models";
import { useItems } from "~/stores/items";
import { path } from "~/utils/path";
-import { cropInspectionAnchorToPngBlob } from "./cropInspectionAnchorToPng";
-import { buildInspectionDocumentPdfWithOverlaysBytes } from "./exportInspectionDocumentPdfWithOverlays";
+import {
+ AUTOSAVE_DELAY_MS,
+ hasUnsavedRows,
+ mergeSaveResponse,
+ newBalloonId,
+ newFeatureId
+} from "./autosave";
+import {
+ buildInspectionDocumentPdfWithOverlaysBytes,
+ cropInspectionAnchorToPngBlob
+} from "./drawingRaster";
import type { SamplingRule } from "./SamplingRuleModal";
import SamplingRuleModal, { EMPTY_SAMPLING_RULE } from "./SamplingRuleModal";
@@ -126,6 +141,7 @@ type InspectionDocumentEditorProps = {
features: Array<Record<string, unknown>>;
balloons: Array<Record<string, unknown>>;
unitOfMeasures: Array<{ code: string; name: string }>;
+ gaugeTypes: Array<{ id: string; name: string }>;
// The document's default sampling rule (fallback for features without a
// rule) and the company's sampling standard for previews.
sampling: SamplingRule | null;
@@ -262,8 +278,6 @@ function cursorForSelectorResizeHandle(
}
}
-/** Callout / anchor stroke — matches reference (orange border, hollow fill). */
-const CALLOUT_STROKE = "#f97316";
const CALLOUT_TEXT = "#171717";
/**
@@ -277,72 +291,6 @@ function konvaContentFromStageRef(stageRef: {
return st?.content ?? null;
}
-/** Liang–Barsky: clip segment (x0,y0)→(x1,y1) to axis-aligned rect; returns [0,1] params or null. */
-function liangBarskySegmentRect(
- x0: number,
- y0: number,
- x1: number,
- y1: number,
- minX: number,
- minY: number,
- maxX: number,
- maxY: number
-): { u0: number; u1: number } | null {
- const dx = x1 - x0;
- const dy = y1 - y0;
- let u0 = 0;
- let u1 = 1;
- const p = [-dx, dx, -dy, dy];
- const q = [x0 - minX, maxX - x0, y0 - minY, maxY - y0];
- for (let i = 0; i < 4; i += 1) {
- if (Math.abs(p[i]) < 1e-12) {
- if (q[i] < 0) return null;
- } else {
- const r = q[i] / p[i];
- if (p[i] < 0) {
- u0 = Math.max(u0, r);
- } else {
- u1 = Math.min(u1, r);
- }
- if (u0 > u1) return null;
- }
- }
- return { u0, u1 };
-}
-
-/**
- * Visible connector from balloon edge → toward anchor, stopping before the anchor rect interior.
- * u is linear param from B (0) to A (1); balloon occupies u ∈ [0, r/L).
- */
-function clippedBalloonToAnchorLine(
- bx: number,
- by: number,
- radiusPx: number,
- ax: number,
- ay: number,
- rect: { x: number; y: number; w: number; h: number }
-): [number, number, number, number] | null {
- const L = Math.hypot(ax - bx, ay - by);
- if (L < 1e-6) return null;
- const epsU = Math.max(1e-4, 2 / L);
- const uBalloonExit = Math.min(1 - epsU, radiusPx / L + epsU);
- const { x, y, w, h } = rect;
- const hit = liangBarskySegmentRect(bx, by, ax, ay, x, y, x + w, y + h);
- let uEnd = 1 - epsU;
- if (hit) {
- const uEnter = Math.max(0, Math.min(1, hit.u0));
- if (uEnter > uBalloonExit) {
- uEnd = Math.min(uEnd, uEnter - epsU);
- }
- }
- if (uEnd <= uBalloonExit + 1e-4) return null;
- const x0 = bx + (ax - bx) * uBalloonExit;
- const y0 = by + (ay - by) * uBalloonExit;
- const x1 = bx + (ax - bx) * uEnd;
- const y1 = by + (ay - by) * uEnd;
- return [x0, y0, x1, y1];
-}
-
type SelectorRect = {
id: string;
pageNumber: number;
@@ -378,6 +326,8 @@ type FeatureRow = {
samplingAql: number | null;
samplingInspectionLevel: SamplingRule["samplingInspectionLevel"];
samplingSeverity: SamplingRule["samplingSeverity"];
+ /** Optional gauge type the feature must be measured with. */
+ gaugeTypeId: string | null;
featureDirty?: boolean;
geometryDirty?: boolean;
};
@@ -437,8 +387,32 @@ const ConditionalMeasurementList =
return EditableList(baseMutation, options)(props);
};
-const BALLOON_W_NORM = 0.04;
-const BALLOON_H_NORM = 0.04;
+// Optional gauge type: a clearable list (cleared = any gauge may be used).
+const EditableGaugeType =
+ (
+ baseMutation: FeatureMutationFn,
+ options: { label: string; value: string }[]
+ ) =>
+ ({
+ value,
+ row,
+ accessorKey,
+ onUpdate
+ }: EditableTableCellComponentProps<FeatureRow>) => (
+ <Combobox
+ autoFocus
+ isClearable
+ className="rounded-none"
+ size="sm"
+ value={(value as string | null) ?? undefined}
+ options={options}
+ onChange={(newValue) => {
+ onUpdate({ [accessorKey]: newValue || null });
+ baseMutation(accessorKey, newValue, row);
+ }}
+ />
+ );
+
const BALLOON_OFFSET_NORM = 0.02;
const BALLOON_W_PCT = BALLOON_W_NORM * 100;
const BALLOON_H_PCT = BALLOON_H_NORM * 100;
@@ -452,13 +426,18 @@ function nextBalloonLabel(rows: FeatureRow[]): string {
return String(max + 1);
}
-function isTempFeatureId(featureId: string) {
- return featureId.startsWith("temp-ftr-");
-}
-
-function isTempBalloonId(balloonId: string | null) {
- return balloonId != null && balloonId.startsWith("temp-bln-");
-}
+/** What a save sent, so its response can tell what changed since. */
+type SaveSnapshot = {
+ featureRows: FeatureRow[];
+ anchorRects: SelectorRect[];
+ docSampling: SamplingRule;
+ pdfUrl: string;
+ sentPdfMetrics: boolean;
+ /** Characteristic and balloon ids this save creates. */
+ createdIds: string[];
+ featureDeleteIds: string[];
+ balloonDeleteIds: string[];
+};
function stripBalloonGeometryFromFeatureRows(rows: FeatureRow[]): FeatureRow[] {
return rows.map((r) =>
@@ -557,7 +536,7 @@ function mapFeatureRowFromRecords(
? String(feature.description)
: "";
const label = String(feature.label ?? "");
- const featureName = desc || `Feature ${label}`;
+ const featureName = desc || `Characteristic ${label}`;
const balloonId =
balloon != null
? String(balloon.id)
@@ -595,11 +574,33 @@ function mapFeatureRowFromRecords(
null,
samplingSeverity:
(feature.samplingSeverity as SamplingRule["samplingSeverity"]) ?? null,
+ gaugeTypeId: (feature.gaugeTypeId as string | null) ?? null,
featureDirty: false,
geometryDirty: false
};
}
+// Features saved together share one createdAt (the save RPC runs in a single
+// transaction), so createdAt alone leaves their order to the heap, and an
+// UPDATE moves the edited row to the end. Break the tie by balloon label, the
+// order the inspection grid shows them in. Rows are sorted on load only; a
+// save response keeps the editor's order (mergeSaveResponse), so a row never
+// moves under the cursor.
+function compareFeatureRecords(
+ a: Record<string, unknown>,
+ b: Record<string, unknown>
+) {
+ const aCreated = String(a.createdAt ?? "");
+ const bCreated = String(b.createdAt ?? "");
+ return (
+ (aCreated < bCreated ? -1 : aCreated > bCreated ? 1 : 0) ||
+ String(a.label ?? "").localeCompare(String(b.label ?? ""), undefined, {
+ numeric: true
+ }) ||
+ String(a.id).localeCompare(String(b.id))
+ );
+}
+
function buildFeatureRowsFromLoader(
features: Array<Record<string, unknown>>,
balloons: Array<Record<string, unknown>>
@@ -607,14 +608,16 @@ function buildFeatureRowsFromLoader(
const balloonByFeatureId = new Map(
balloons.map((b) => [String(b.inspectionFeatureId), b])
);
- return features.map((f) =>
- mapFeatureRowFromRecords(
- f,
- f.balloonId != null
- ? balloons.find((b) => String(b.id) === String(f.balloonId))
- : balloonByFeatureId.get(String(f.id))
- )
- );
+ return [...features]
+ .sort(compareFeatureRecords)
+ .map((f) =>
+ mapFeatureRowFromRecords(
+ f,
+ f.balloonId != null
+ ? balloons.find((b) => String(b.id) === String(f.balloonId))
+ : balloonByFeatureId.get(String(f.id))
+ )
+ );
}
export default function InspectionDocumentEditor({
@@ -625,6 +628,7 @@ export default function InspectionDocumentEditor({
features: initialFeatures,
balloons,
unitOfMeasures,
+ gaugeTypes,
sampling,
samplingStandard
}: InspectionDocumentEditorProps) {
@@ -665,7 +669,7 @@ export default function InspectionDocumentEditor({
const companyId = user.company.id;
const [pdfUrl, setPdfUrl] = useState<string>(content?.pdfUrl ?? "");
- // The document's default sampling rule; persisted with Save alongside the
+ // The document's default sampling rule; autosaved alongside the
// feature rows. "document" | featureId targets the sampling modal.
const [docSampling, setDocSampling] = useState<SamplingRule>(
sampling ?? EMPTY_SAMPLING_RULE
@@ -743,14 +747,42 @@ export default function InspectionDocumentEditor({
null
);
const fileInputRef = useRef<HTMLInputElement>(null);
- /** Only the explicit Save button should show "Diagram saved" — not auto-persist after anchor draw. */
- const manualSaveToastRef = useRef(false);
const pdfReplaceToastRef = useRef(false);
- const pdfReplacePendingMetricsRef = useRef(false);
- /** Persisted feature ids to hard-delete on next Save. */
+ /** A replaced drawing's page metrics still need saving once it renders. */
+ const [pdfMetricsDirty, setPdfMetricsDirty] = useState(false);
+ /** Persisted feature ids to hard-delete on the next save. */
const pendingFeatureDeleteIdsRef = useRef(new Set<string>());
- /** Persisted balloon ids to hard-delete on next Save (unballoon). */
+ /** Persisted balloon ids to hard-delete on the next save (unballoon). */
const pendingBalloonDeleteIdsRef = useRef(new Set<string>());
+ /** The save in flight; null when none is. */
+ const inFlightSaveRef = useRef<SaveSnapshot | null>(null);
+ /** The save response last merged — the merge effect also runs on edits. */
+ const handledSaveDataRef = useRef<unknown>(null);
+ /** The last autosave that failed — not retried until something changes. */
+ const failedSaveRef = useRef<SaveSnapshot | null>(null);
+ /** Characteristic and balloon ids minted here that no save has created
+ * yet. A save sends these as creates, everything else as updates. */
+ const unsavedIdsRef = useRef(new Set<string>());
+ const isUnsaved = useCallback(
+ (id: string) => unsavedIdsRef.current.has(id),
+ []
+ );
+ /** Queues a delete for a row the server has — or is creating right now —
+ * and simply forgets one that never left the browser. */
+ const queueDelete = useCallback((pending: Set<string>, id: string) => {
+ const sending = inFlightSaveRef.current?.createdIds.includes(id);
+ if (unsavedIdsRef.current.has(id) && !sending) {
+ unsavedIdsRef.current.delete(id);
+ } else {
+ pending.add(id);
+ }
+ }, []);
+ const savedSamplingRef = useRef<SamplingRule>(
+ sampling ?? EMPTY_SAMPLING_RULE
+ );
+ const savedPdfUrlRef = useRef(content?.pdfUrl ?? "");
+ /** Whether a save has succeeded yet — the label shows nothing before. */
+ const [hasSaved, setHasSaved] = useState(false);
const [placingFeatureId, setPlacingFeatureId] = useState<string | null>(null);
const [annotations, setAnnotations] = useState<AnnotationRecord[]>([]);
@@ -885,44 +917,56 @@ export default function InspectionDocumentEditor({
return () => ro.disconnect();
}, [pdfFile, pdfUrl]);
+ // Merges each save response into the editor's current state. It reads the
+ // current rows, so it also runs on every edit; handledSaveDataRef makes each
+ // response merge exactly once.
useEffect(() => {
- if (!pdfReplacePendingMetricsRef.current || !pdfMetrics) return;
- pdfReplacePendingMetricsRef.current = false;
- const formData = new FormData();
- formData.set("pageCount", String(pdfMetrics.pageCount));
- formData.set("defaultPageWidth", String(pdfMetrics.defaultPageWidth));
- formData.set("defaultPageHeight", String(pdfMetrics.defaultPageHeight));
- fetcher.submit(formData, {
- method: "post",
- action: path.to.saveInspectionDocument(diagramId)
+ const data = fetcher.data;
+ if (!data || data === handledSaveDataRef.current) return;
+ handledSaveDataRef.current = data;
+ const sent = inFlightSaveRef.current;
+ inFlightSaveRef.current = null;
+ if (!sent) return;
+
+ if (!data.success) {
+ failedSaveRef.current = sent;
+ pdfReplaceToastRef.current = false;
+ toast.error(data.message ?? t`Failed to save inspection plan`);
+ return;
+ }
+
+ const savedBalloons = data.balloons ?? [];
+ const merged = mergeSaveResponse({
+ sentRows: sent.featureRows,
+ sentAnchors: sent.anchorRects,
+ currentRows: featureRows,
+ currentAnchors: anchorRects,
+ savedRows: buildFeatureRowsFromLoader(data.features ?? [], savedBalloons),
+ savedAnchors: selectorRectsFromBalloonRecords(savedBalloons)
});
- }, [diagramId, fetcher, pdfMetrics]);
- useEffect(() => {
- if (fetcher.data?.success === true) {
- const savedBalloons = fetcher.data.balloons ?? [];
- setSelectorRects(selectorRectsFromBalloonRecords(savedBalloons));
- setFeatureRows(
- buildFeatureRowsFromLoader(fetcher.data.features ?? [], savedBalloons)
- );
- pendingFeatureDeleteIdsRef.current.clear();
- pendingBalloonDeleteIdsRef.current.clear();
- if (pdfReplaceToastRef.current) {
- toast.success(
- t`Drawing replaced. Balloon placements were removed; feature rows are unchanged.`
- );
- pdfReplaceToastRef.current = false;
- } else if (manualSaveToastRef.current) {
- toast.success(t`Diagram saved`);
- manualSaveToastRef.current = false;
- }
- } else if (fetcher.data?.success === false) {
+ for (const id of sent.createdIds) unsavedIdsRef.current.delete(id);
+ for (const id of sent.featureDeleteIds) {
+ pendingFeatureDeleteIdsRef.current.delete(id);
+ }
+ for (const id of sent.balloonDeleteIds) {
+ pendingBalloonDeleteIdsRef.current.delete(id);
+ }
+ savedSamplingRef.current = sent.docSampling;
+ savedPdfUrlRef.current = sent.pdfUrl;
+ failedSaveRef.current = null;
+ if (sent.sentPdfMetrics) setPdfMetricsDirty(false);
+ setFeatureRows(merged.rows);
+ setSelectorRects(merged.anchors);
+ setHasSaved(true);
+
+ if (pdfReplaceToastRef.current && sent.pdfUrl === pdfUrl) {
pdfReplaceToastRef.current = false;
- pdfReplacePendingMetricsRef.current = false;
- manualSaveToastRef.current = false;
- toast.error(fetcher.data.message ?? t`Failed to save diagram`);
+ toast.success(
+ t`Drawing replaced. Balloon placements were removed; characteristic rows are unchanged.`
+ );
}
- }, [fetcher.data, t]);
+ }, [fetcher.data, featureRows, anchorRects, pdfUrl, t]);
const loadAnnotations = useCallback(async () => {
setAnnotations([]);
@@ -1163,7 +1207,10 @@ export default function InspectionDocumentEditor({
}
const placingExistingFeatureId = placingFeatureId;
- const tempBalloonId = `temp-bln-${nanoid()}`;
+ const balloonId = newBalloonId();
+ const featureId = newFeatureId();
+ unsavedIdsRef.current.add(balloonId);
+ if (!placingExistingFeatureId) unsavedIdsRef.current.add(featureId);
let balloonX = rx + rw + BALLOON_OFFSET_PCT;
if (balloonX + BALLOON_W_PCT > 100) {
balloonX = rx - BALLOON_OFFSET_PCT - BALLOON_W_PCT;
@@ -1174,7 +1221,7 @@ export default function InspectionDocumentEditor({
setSelectorRects((prev) => [
...prev,
{
- id: tempBalloonId,
+ id: balloonId,
pageNumber,
x: rx,
y: localY,
@@ -1195,33 +1242,32 @@ export default function InspectionDocumentEditor({
? r
: {
...r,
- balloonId: tempBalloonId,
- balloonAnchorId: tempBalloonId,
+ balloonId,
+ balloonAnchorId: balloonId,
pageNumber,
x: balloonX,
y: balloonY,
- featureDirty: isTempFeatureId(r.featureId)
- ? r.featureDirty
- : true,
+ featureDirty: true,
geometryDirty: true
}
);
}
- const tempFeatureId = `temp-ftr-${nanoid()}`;
+ // The feature being placed was deleted meanwhile: a new one it is.
+ unsavedIdsRef.current.add(featureId);
const label = nextBalloonLabel(prev);
return [
...prev,
{
- featureId: tempFeatureId,
- balloonId: tempBalloonId,
- balloonAnchorId: tempBalloonId,
+ featureId,
+ balloonId,
+ balloonAnchorId: balloonId,
label,
pageNumber,
x: balloonX,
y: balloonY,
width: BALLOON_W_PCT,
height: BALLOON_H_PCT,
- featureName: `Feature ${label}`,
+ featureName: `Characteristic ${label}`,
nominalValue: "",
tolerancePlus: "",
toleranceMinus: "",
@@ -1232,7 +1278,8 @@ export default function InspectionDocumentEditor({
samplingPercentage: null,
samplingAql: null,
samplingInspectionLevel: null,
- samplingSeverity: null
+ samplingSeverity: null,
+ gaugeTypeId: null
}
];
});
@@ -1295,7 +1342,7 @@ export default function InspectionDocumentEditor({
const a = payload.analysis;
setFeatureRows((prev) =>
prev.map((r) => {
- if (r.balloonId !== tempBalloonId) return r;
+ if (r.balloonId !== balloonId) return r;
const fmt = (n: number | null, fallback: string) =>
n != null && Number.isFinite(n) ? String(n) : fallback;
const nextNominal = fmt(a.nominal, r.nominalValue);
@@ -1321,7 +1368,7 @@ export default function InspectionDocumentEditor({
};
})
);
- toast.success(t`Feature values suggested from drawing`);
+ toast.success(t`Characteristic values suggested from drawing`);
} catch {
toast.error(t`Could not analyze cropped region`);
}
@@ -1865,9 +1912,7 @@ export default function InspectionDocumentEditor({
...row,
x: nextX,
y: nextY,
- geometryDirty: isTempBalloonId(row.balloonId)
- ? row.geometryDirty
- : true
+ geometryDirty: true
};
})
);
@@ -2015,9 +2060,7 @@ export default function InspectionDocumentEditor({
? row
: {
...row,
- geometryDirty: isTempBalloonId(row.balloonId)
- ? row.geometryDirty
- : true
+ geometryDirty: true
}
)
);
@@ -2053,15 +2096,17 @@ export default function InspectionDocumentEditor({
[drag, dragKind, getRelativePosFromStage, finalizeDragAt]
);
- const handleSave = useCallback(() => {
- manualSaveToastRef.current = true;
+ const { submit: submitSave } = fetcher;
+ const saveChanges = useCallback(() => {
+ const featureDeleteIds = [...pendingFeatureDeleteIdsRef.current];
+ const balloonDeleteIds = [...pendingBalloonDeleteIdsRef.current];
const formData = new FormData();
formData.set("name", name);
if (pdfUrl) formData.set("pdfUrl", pdfUrl);
const featuresCreate = featureRows
- .filter((r) => isTempFeatureId(r.featureId))
+ .filter((r) => isUnsaved(r.featureId))
.map((r) => ({
- tempId: r.featureId,
+ id: r.featureId,
pageNumber: r.pageNumber,
label: r.label,
description: r.featureName.trim() || null,
@@ -2075,13 +2120,14 @@ export default function InspectionDocumentEditor({
samplingPercentage: r.samplingPercentage,
samplingAql: r.samplingAql,
samplingInspectionLevel: r.samplingInspectionLevel,
- samplingSeverity: r.samplingSeverity
+ samplingSeverity: r.samplingSeverity,
+ gaugeTypeId: r.gaugeTypeId
}));
const featuresUpdate = featureRows
.filter(
(r) =>
- !isTempFeatureId(r.featureId) &&
+ !isUnsaved(r.featureId) &&
(r.featureDirty || (r.geometryDirty && r.balloonId != null))
)
.map((r) => ({
@@ -2099,7 +2145,8 @@ export default function InspectionDocumentEditor({
samplingPercentage: r.samplingPercentage,
samplingAql: r.samplingAql,
samplingInspectionLevel: r.samplingInspectionLevel,
- samplingSeverity: r.samplingSeverity
+ samplingSeverity: r.samplingSeverity,
+ gaugeTypeId: r.gaugeTypeId
}));
formData.set(
@@ -2107,19 +2154,20 @@ export default function InspectionDocumentEditor({
JSON.stringify({
create: featuresCreate,
update: featuresUpdate,
- delete: [...pendingFeatureDeleteIdsRef.current]
+ delete: featureDeleteIds
})
);
const balloonsCreate = featureRows
- .filter((r) => isTempBalloonId(r.balloonId))
+ .filter(
+ (r): r is FeatureRow & { balloonId: string } =>
+ r.balloonId != null && isUnsaved(r.balloonId)
+ )
.map((r) => {
const anchor = anchorRects.find((s) => s.id === r.balloonAnchorId);
return {
- ...(isTempFeatureId(r.featureId)
- ? { tempInspectionFeatureId: r.featureId }
- : { inspectionFeatureId: r.featureId }),
- tempBalloonAnchorId: r.balloonId ?? undefined,
+ id: r.balloonId,
+ inspectionFeatureId: r.featureId,
pageNumber: r.pageNumber,
regionX: (anchor?.x ?? 0) / 100,
regionY: (anchor?.y ?? 0) / 100,
@@ -2156,7 +2204,7 @@ export default function InspectionDocumentEditor({
}
for (const row of featureRows.filter(
- (r) => r.balloonId && !isTempBalloonId(r.balloonId) && r.geometryDirty
+ (r) => r.balloonId && !isUnsaved(r.balloonId) && r.geometryDirty
)) {
const anchor = anchorRects.find((s) => s.id === row.balloonAnchorId);
const existing = balloonsUpdateById.get(row.balloonId!) ?? {
@@ -2183,7 +2231,7 @@ export default function InspectionDocumentEditor({
JSON.stringify({
create: balloonsCreate,
update: [...balloonsUpdateById.values()],
- delete: [...pendingBalloonDeleteIdsRef.current]
+ delete: balloonDeleteIds
})
);
@@ -2193,7 +2241,20 @@ export default function InspectionDocumentEditor({
formData.set("defaultPageHeight", String(pdfMetrics.defaultPageHeight));
}
formData.set("samplingDefault", JSON.stringify(docSampling));
- fetcher.submit(formData, {
+ inFlightSaveRef.current = {
+ featureRows,
+ anchorRects,
+ docSampling,
+ pdfUrl,
+ sentPdfMetrics: pdfMetrics != null,
+ createdIds: [
+ ...featuresCreate.map((f) => f.id),
+ ...balloonsCreate.map((b) => b.id)
+ ],
+ featureDeleteIds,
+ balloonDeleteIds
+ };
+ submitSave(formData, {
method: "post",
action: path.to.saveInspectionDocument(diagramId)
});
@@ -2205,9 +2266,67 @@ export default function InspectionDocumentEditor({
featureRows,
pdfMetrics,
docSampling,
- fetcher
+ submitSave,
+ isUnsaved
]);
+ // Every edit saves itself once the editor has been quiet for a moment — a
+ // drag saves when it ends, and one save at a time: an edit made while a save
+ // is in flight is picked up when it returns. Someone without update
+ // permission can still look around, but nothing they change is saved.
+ const canUpdate = permissions.can("update", "quality");
+ const isSaving = fetcher.state !== "idle";
+ const hasUnsavedChanges =
+ canUpdate &&
+ (hasUnsavedRows(featureRows, anchorRects, isUnsaved) ||
+ pendingFeatureDeleteIdsRef.current.size > 0 ||
+ pendingBalloonDeleteIdsRef.current.size > 0 ||
+ pdfUrl !== savedPdfUrlRef.current ||
+ (pdfMetricsDirty && pdfMetrics != null) ||
+ JSON.stringify(docSampling) !== JSON.stringify(savedSamplingRef.current));
+ const failedSave = failedSaveRef.current;
+ const saveFailed =
+ failedSave != null &&
+ failedSave.featureRows === featureRows &&
+ failedSave.anchorRects === anchorRects &&
+ failedSave.docSampling === docSampling &&
+ failedSave.pdfUrl === pdfUrl;
+
+ // Leaving with unsaved changes saves them first, then continues; only a
+ // failed save asks.
+ const blocker = useBlocker(
+ ({ currentLocation, nextLocation }) =>
+ (hasUnsavedChanges || isSaving) &&
+ currentLocation.pathname !== nextLocation.pathname
+ );
+ const isLeaving = blocker.state === "blocked";
+
+ useEffect(() => {
+ if (!hasUnsavedChanges || isSaving || uploading || saveFailed) return;
+ if (dragKind !== null) return;
+ const timer = setTimeout(saveChanges, isLeaving ? 0 : AUTOSAVE_DELAY_MS);
+ return () => clearTimeout(timer);
+ }, [
+ hasUnsavedChanges,
+ isSaving,
+ uploading,
+ saveFailed,
+ dragKind,
+ isLeaving,
+ saveChanges
+ ]);
+
+ useEffect(() => {
+ if (isLeaving && !hasUnsavedChanges && !isSaving) blocker.proceed?.();
+ }, [blocker, isLeaving, hasUnsavedChanges, isSaving]);
+
+ useEffect(() => {
+ if (!hasUnsavedChanges && !isSaving) return;
+ const onBeforeUnload = (event: BeforeUnloadEvent) => event.preventDefault();
+ window.addEventListener("beforeunload", onBeforeUnload);
+ return () => window.removeEventListener("beforeunload", onBeforeUnload);
+ }, [hasUnsavedChanges, isSaving]);
+
const uploadPdfAndSave = useCallback(
async (file: File, options: { clearBalloons: boolean }) => {
if (!carbon) return;
@@ -2232,40 +2351,22 @@ export default function InspectionDocumentEditor({
setPdfViewPage(1);
setNumPages(0);
setPdfMetrics(null);
-
- const formData = new FormData();
- formData.set("pdfUrl", nextPdfUrl);
+ // The new URL, the cleared balloons and the new drawing's page metrics
+ // (once it renders) all reach the server through the autosave.
+ setPdfMetricsDirty(true);
if (options.clearBalloons) {
- const persistedBalloonDeleteIds = featureRows
- .filter(
- (r): r is FeatureRow & { balloonId: string } =>
- r.balloonId != null && !isTempBalloonId(r.balloonId)
- )
- .map((r) => r.balloonId);
-
- formData.set(
- "balloons",
- JSON.stringify({
- create: [],
- update: [],
- delete: persistedBalloonDeleteIds
- })
- );
-
+ for (const r of featureRows) {
+ if (r.balloonId != null) {
+ queueDelete(pendingBalloonDeleteIdsRef.current, r.balloonId);
+ }
+ }
setSelectorRects([]);
setFeatureRows((prev) => stripBalloonGeometryFromFeatureRows(prev));
- pendingBalloonDeleteIdsRef.current.clear();
pdfReplaceToastRef.current = true;
- pdfReplacePendingMetricsRef.current = true;
}
-
- fetcher.submit(formData, {
- method: "post",
- action: path.to.saveInspectionDocument(diagramId)
- });
},
- [carbon, companyId, diagramId, featureRows, fetcher, t]
+ [carbon, companyId, diagramId, featureRows, t, queueDelete]
);
const handlePdfUpload = useCallback(
@@ -2306,32 +2407,35 @@ export default function InspectionDocumentEditor({
const isPdfReady = hasPdf && (numPages > 0 || pdfMetrics !== null);
const isOverlayReady = isPdfReady && containerWidth > 0 && overlayHeight > 0;
- const handleDeleteFeature = useCallback((featureId: string) => {
- setFeatureRows((prev) => {
- const row = prev.find((r) => r.featureId === featureId);
- if (row && !isTempFeatureId(row.featureId)) {
- pendingFeatureDeleteIdsRef.current.add(row.featureId);
- }
- const nextRows = prev.filter((r) => r.featureId !== featureId);
- const keptAnchorIds = new Set(
- nextRows
- .map((r) => r.balloonAnchorId)
- .filter((id): id is string => id.length > 0)
- );
- setSelectorRects((sels) =>
- sels.filter((sel) => keptAnchorIds.has(sel.id))
- );
- return nextRows;
- });
- }, []);
+ const handleDeleteFeature = useCallback(
+ (featureId: string) => {
+ setFeatureRows((prev) => {
+ const row = prev.find((r) => r.featureId === featureId);
+ if (row) queueDelete(pendingFeatureDeleteIdsRef.current, row.featureId);
+ const nextRows = prev.filter((r) => r.featureId !== featureId);
+ const keptAnchorIds = new Set(
+ nextRows
+ .map((r) => r.balloonAnchorId)
+ .filter((id): id is string => id.length > 0)
+ );
+ setSelectorRects((sels) =>
+ sels.filter((sel) => keptAnchorIds.has(sel.id))
+ );
+ return nextRows;
+ });
+ },
+ [queueDelete]
+ );
const handleAddFeature = useCallback(() => {
+ const featureId = newFeatureId();
+ unsavedIdsRef.current.add(featureId);
setFeatureRows((prev) => {
const label = nextBalloonLabel(prev);
return [
...prev,
{
- featureId: `temp-ftr-${nanoid()}`,
+ featureId,
balloonId: null,
balloonAnchorId: "",
label,
@@ -2340,7 +2444,7 @@ export default function InspectionDocumentEditor({
y: 0,
width: BALLOON_W_PCT,
height: BALLOON_H_PCT,
- featureName: `Feature ${label}`,
+ featureName: `Characteristic ${label}`,
nominalValue: "",
tolerancePlus: "",
toleranceMinus: "",
@@ -2351,7 +2455,8 @@ export default function InspectionDocumentEditor({
samplingPercentage: null,
samplingAql: null,
samplingInspectionLevel: null,
- samplingSeverity: null
+ samplingSeverity: null,
+ gaugeTypeId: null
}
];
});
@@ -2364,32 +2469,33 @@ export default function InspectionDocumentEditor({
setZoomBoxMode(false);
}, []);
- const handleUnballoon = useCallback((featureId: string) => {
- setFeatureRows((prev) => {
- const row = prev.find((r) => r.featureId === featureId);
- if (!row?.balloonId) return prev;
- if (!isTempBalloonId(row.balloonId)) {
- pendingBalloonDeleteIdsRef.current.add(row.balloonId);
- }
- if (row.balloonAnchorId) {
- setSelectorRects((sels) =>
- sels.filter((s) => s.id !== row.balloonAnchorId)
+ const handleUnballoon = useCallback(
+ (featureId: string) => {
+ setFeatureRows((prev) => {
+ const row = prev.find((r) => r.featureId === featureId);
+ if (!row?.balloonId) return prev;
+ queueDelete(pendingBalloonDeleteIdsRef.current, row.balloonId);
+ if (row.balloonAnchorId) {
+ setSelectorRects((sels) =>
+ sels.filter((s) => s.id !== row.balloonAnchorId)
+ );
+ }
+ return prev.map((r) =>
+ r.featureId !== featureId
+ ? r
+ : {
+ ...r,
+ balloonId: null,
+ balloonAnchorId: "",
+ x: 0,
+ y: 0,
+ geometryDirty: false
+ }
);
- }
- return prev.map((r) =>
- r.featureId !== featureId
- ? r
- : {
- ...r,
- balloonId: null,
- balloonAnchorId: "",
- x: 0,
- y: 0,
- geometryDirty: false
- }
- );
- });
- }, []);
+ });
+ },
+ [queueDelete]
+ );
const updateFeatureField = useCallback(
(
@@ -2401,7 +2507,8 @@ export default function InspectionDocumentEditor({
| "tolerancePlus"
| "toleranceMinus"
| "units"
- | "type",
+ | "type"
+ | "gaugeTypeId",
value: string
) => {
setFeatureRows((prev) =>
@@ -2410,10 +2517,8 @@ export default function InspectionDocumentEditor({
? r
: {
...r,
- [field]: value,
- featureDirty: isTempFeatureId(r.featureId)
- ? r.featureDirty
- : true
+ [field]: field === "gaugeTypeId" ? value || null : value,
+ featureDirty: true
}
)
);
@@ -2432,7 +2537,8 @@ export default function InspectionDocumentEditor({
| "tolerancePlus"
| "toleranceMinus"
| "units"
- | "type",
+ | "type"
+ | "gaugeTypeId",
newValue
);
return {
@@ -2467,6 +2573,16 @@ export default function InspectionDocumentEditor({
[unitOfMeasures]
);
+ const gaugeTypeOptions = useMemo(
+ () => gaugeTypes.map((gt) => ({ value: gt.id, label: gt.name })),
+ [gaugeTypes]
+ );
+
+ const gaugeTypeIdToName = useMemo(
+ () => new Map(gaugeTypes.map((gt) => [gt.id, gt.name])),
+ [gaugeTypes]
+ );
+
const featureEditableComponents = useMemo(
() => ({
type: EditableList(featureMutation, featureTypeOptions),
@@ -2475,14 +2591,15 @@ export default function InspectionDocumentEditor({
nominalValue: ConditionalMeasurementText(featureMutation),
tolerancePlus: ConditionalMeasurementText(featureMutation),
toleranceMinus: ConditionalMeasurementText(featureMutation),
- units: ConditionalMeasurementList(featureMutation, unitOfMeasureOptions)
+ units: ConditionalMeasurementList(featureMutation, unitOfMeasureOptions),
+ gaugeTypeId: EditableGaugeType(featureMutation, gaugeTypeOptions)
}),
- [featureMutation, unitOfMeasureOptions]
+ [featureMutation, unitOfMeasureOptions, gaugeTypeOptions]
);
const featureColumns = useMemo<ColumnDef<FeatureRow>[]>(
() => [
- { accessorKey: "label", header: t`Feature`, size: 80 },
+ { accessorKey: "label", header: t`Characteristic`, size: 80 },
{
accessorKey: "type",
header: t`Type`,
@@ -2535,6 +2652,17 @@ export default function InspectionDocumentEditor({
? (uomCodeToName.get(row.original.units) ?? row.original.units)
: null
},
+ {
+ accessorKey: "gaugeTypeId",
+ header: t`Gauge Type`,
+ size: 160,
+ cell: ({ row }) =>
+ row.original.gaugeTypeId ? (
+ (gaugeTypeIdToName.get(row.original.gaugeTypeId) ?? "—")
+ ) : (
+ <span className="text-muted-foreground">{t`Any`}</span>
+ )
+ },
{
id: "sampling",
header: t`Sampling`,
@@ -2617,6 +2745,7 @@ export default function InspectionDocumentEditor({
handleUnballoon,
isOverlayReady,
uomCodeToName,
+ gaugeTypeIdToName,
t
]
);
@@ -2701,7 +2830,7 @@ export default function InspectionDocumentEditor({
</ModalHeader>
<ModalBody>
<p className="text-sm text-muted-foreground">
- {t`Replacing the PDF removes all balloon placements on this document. Feature rows and their values stay; you can place balloons again on the new drawing.`}
+ {t`Replacing the PDF removes all balloon placements on this document. Characteristic rows and their values stay; you can place balloons again on the new drawing.`}
</p>
</ModalBody>
<ModalFooter>
@@ -2800,6 +2929,17 @@ export default function InspectionDocumentEditor({
</DropdownMenu>
</div>
<HStack spacing={2} className="flex-shrink-0 flex-wrap justify-end">
+ {!canUpdate ? (
+ <span className="text-xs text-muted-foreground">
+ {t`View only — changes are not saved`}
+ </span>
+ ) : saveFailed ? (
+ <span className="text-xs text-destructive">{t`Could not save`}</span>
+ ) : hasUnsavedChanges || isSaving ? (
+ <span className="text-xs text-muted-foreground">{t`Saving…`}</span>
+ ) : hasSaved ? (
+ <span className="text-xs text-muted-foreground">{t`Saved`}</span>
+ ) : null}
<Button
variant={placing ? "primary" : "secondary"}
leftIcon={<LuRectangleHorizontal />}
@@ -2826,13 +2966,6 @@ export default function InspectionDocumentEditor({
>
{samplingRuleSummary(docSampling) ?? t`Sampling`}
</Button>
- <Button
- leftIcon={<LuSave />}
- onClick={handleSave}
- isDisabled={fetcher.state !== "idle"}
- >
- {t`Save`}
- </Button>
<HStack
spacing={0}
className="ml-1 rounded-md border bg-background px-1 py-1"
@@ -2899,6 +3032,29 @@ export default function InspectionDocumentEditor({
</HStack>
</div>
+ {isLeaving && saveFailed && (
+ <Modal open onOpenChange={(open) => !open && blocker.reset?.()}>
+ <ModalContent>
+ <ModalHeader>
+ <ModalTitle>{t`Unsaved changes`}</ModalTitle>
+ </ModalHeader>
+ <ModalBody>
+ <p className="text-sm text-muted-foreground">
+ {t`Your latest changes could not be saved. Are you sure you want to leave this page?`}
+ </p>
+ </ModalBody>
+ <ModalFooter>
+ <Button variant="secondary" onClick={() => blocker.reset?.()}>
+ {t`Stay on this page`}
+ </Button>
+ <Button onClick={() => blocker.proceed?.()}>
+ {t`Leave this page`}
+ </Button>
+ </ModalFooter>
+ </ModalContent>
+ </Modal>
+ )}
+
{deleteDisclosure.isOpen && (
<ConfirmDelete
action={path.to.deleteInspectionDocument(diagramId)}
@@ -3054,7 +3210,7 @@ export default function InspectionDocumentEditor({
y={y}
width={width}
height={height}
- stroke={CALLOUT_STROKE}
+ stroke={BALLOON_CALLOUT_STROKE}
strokeWidth={isSelected ? 3 : 2}
fill={
isSelected
@@ -3104,7 +3260,7 @@ export default function InspectionDocumentEditor({
? "rgba(249,115,22,0.22)"
: "rgba(249,115,22,0.12)"
}
- stroke={CALLOUT_STROKE}
+ stroke={BALLOON_CALLOUT_STROKE}
strokeWidth={isSelected ? 2.5 : 1.5}
cornerRadius={4}
listening={false}
@@ -3143,7 +3299,7 @@ export default function InspectionDocumentEditor({
width={w}
height={h}
fill="rgba(249,115,22,0.16)"
- stroke={CALLOUT_STROKE}
+ stroke={BALLOON_CALLOUT_STROKE}
dash={[4, 4]}
strokeWidth={2}
cornerRadius={4}
@@ -3249,7 +3405,7 @@ export default function InspectionDocumentEditor({
linePoints[2] - balloonX,
linePoints[3] - balloonY
]}
- stroke={CALLOUT_STROKE}
+ stroke={BALLOON_CALLOUT_STROKE}
strokeWidth={2}
listening={false}
/>
@@ -3265,7 +3421,7 @@ export default function InspectionDocumentEditor({
: "rgba(0,0,0,0)"
}
fillEnabled
- stroke={CALLOUT_STROKE}
+ stroke={BALLOON_CALLOUT_STROKE}
strokeWidth={isSelected ? 3 : 2}
listening={false}
/>
@@ -3278,7 +3434,7 @@ export default function InspectionDocumentEditor({
text={b.label}
align="center"
verticalAlign="middle"
- fill={CALLOUT_STROKE}
+ fill={BALLOON_CALLOUT_STROKE}
fontStyle="bold"
fontSize={balloonLabelFontSize}
listening={false}
@@ -3299,7 +3455,7 @@ export default function InspectionDocumentEditor({
stroke={
dragKind === "zoom"
? "#2563eb"
- : CALLOUT_STROKE
+ : BALLOON_CALLOUT_STROKE
}
strokeWidth={2}
fillEnabled={false}
@@ -3524,7 +3680,7 @@ export default function InspectionDocumentEditor({
<div
role="separator"
aria-orientation="horizontal"
- aria-label={t`Drag to resize diagram and features`}
+ aria-label={t`Drag to resize diagram and characteristics`}
aria-valuenow={Math.round(pdfPaneHeightPx)}
className={`group flex h-2 shrink-0 cursor-row-resize touch-none items-center justify-center rounded-md px-2 hover:bg-muted/80 ${
isResizingPdfFeatures ? "bg-muted" : ""
@@ -3535,7 +3691,7 @@ export default function InspectionDocumentEditor({
</div>
) : null}
- {/* Features table — form fields map to balloon columns; persisted on Save */}
+ {/* Features table — form fields map to balloon columns; autosaved */}
<div
className={
featuresTableExpanded
@@ -3550,7 +3706,7 @@ export default function InspectionDocumentEditor({
>
<div className="flex min-h-10 flex-shrink-0 items-center justify-between gap-2 px-2 py-2 pl-3">
<span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">
- {t`Features`} ({featureRows.length})
+ {t`Characteristics`} ({featureRows.length})
</span>
<HStack spacing={1} className="flex-shrink-0 items-center">
<Button
@@ -3560,7 +3716,7 @@ export default function InspectionDocumentEditor({
leftIcon={<LuPlus className="h-4 w-4" />}
onClick={handleAddFeature}
>
- {t`Add Feature`}
+ {t`Add Characteristic`}
</Button>
<IconButton
type="button"
@@ -3569,8 +3725,8 @@ export default function InspectionDocumentEditor({
aria-expanded={featuresTableExpanded}
aria-label={
featuresTableExpanded
- ? t`Collapse features table`
- : t`Expand features table`
+ ? t`Collapse characteristics table`
+ : t`Expand characteristics table`
}
icon={
featuresTableExpanded ? (
diff --git a/apps/erp/app/modules/production/ui/InspectionDocument/InspectionDocumentForm.tsx b/apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentForm.tsx
similarity index 95%
rename from apps/erp/app/modules/production/ui/InspectionDocument/InspectionDocumentForm.tsx
rename to apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentForm.tsx
index 52ab797d40..8d407d2862 100644
--- a/apps/erp/app/modules/production/ui/InspectionDocument/InspectionDocumentForm.tsx
+++ b/apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentForm.tsx
@@ -11,7 +11,7 @@ import {
} from "@carbon/react";
import { useLingui } from "@lingui/react/macro";
import { Hidden, Input, Item, Submit } from "~/components/Form";
-import { inspectionDocumentValidator } from "~/modules/production/production.models";
+import { inspectionDocumentValidator } from "~/modules/quality/quality.models";
import { path } from "~/utils/path";
type InspectionDocumentFormProps = {
diff --git a/apps/erp/app/modules/production/ui/InspectionDocument/InspectionDocumentTable.tsx b/apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentTable.tsx
similarity index 100%
rename from apps/erp/app/modules/production/ui/InspectionDocument/InspectionDocumentTable.tsx
rename to apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentTable.tsx
diff --git a/apps/erp/app/modules/production/ui/InspectionDocument/SamplingRuleModal.tsx b/apps/erp/app/modules/quality/ui/InspectionDocument/SamplingRuleModal.tsx
similarity index 98%
rename from apps/erp/app/modules/production/ui/InspectionDocument/SamplingRuleModal.tsx
rename to apps/erp/app/modules/quality/ui/InspectionDocument/SamplingRuleModal.tsx
index ed422dc909..106389060d 100644
--- a/apps/erp/app/modules/production/ui/InspectionDocument/SamplingRuleModal.tsx
+++ b/apps/erp/app/modules/quality/ui/InspectionDocument/SamplingRuleModal.tsx
@@ -181,7 +181,7 @@ const SamplingRuleModal = ({
{context === "document" ? (
<Trans>Default Sampling</Trans>
) : (
- <Trans>Sampling — Feature {featureLabel}</Trans>
+ <Trans>Sampling — Characteristic {featureLabel}</Trans>
)}
</ModalTitle>
</ModalHeader>
@@ -190,8 +190,8 @@ const SamplingRuleModal = ({
{context === "document" ? (
<p className="text-sm text-muted-foreground">
<Trans>
- Applies to features without their own rule, and to the lot
- when this plan drives an inspection.
+ Applies to characteristics without their own rule, and to the
+ lot when this plan drives an inspection.
</Trans>
</p>
) : null}
diff --git a/apps/erp/app/modules/quality/ui/InspectionDocument/autosave.test.ts b/apps/erp/app/modules/quality/ui/InspectionDocument/autosave.test.ts
new file mode 100644
index 0000000000..d45b9a0f83
--- /dev/null
+++ b/apps/erp/app/modules/quality/ui/InspectionDocument/autosave.test.ts
@@ -0,0 +1,152 @@
+import { describe, expect, it } from "vitest";
+import {
+ hasUnsavedRows,
+ mergeSaveResponse,
+ newBalloonId,
+ newFeatureId
+} from "./autosave";
+
+type Row = {
+ featureId: string;
+ balloonId: string | null;
+ label: string;
+ featureDirty?: boolean;
+ geometryDirty?: boolean;
+};
+
+type Anchor = { id: string; isNew: boolean; isDirty: boolean };
+
+const row = (featureId: string, label: string, extra: Partial<Row> = {}) =>
+ ({ featureId, balloonId: null, label, ...extra }) satisfies Row as Row;
+
+const merge = (args: {
+ sentRows: Row[];
+ currentRows: Row[];
+ savedRows: Row[];
+ sentAnchors?: Anchor[];
+ currentAnchors?: Anchor[];
+ savedAnchors?: Anchor[];
+}) =>
+ mergeSaveResponse<Row, Anchor>({
+ sentRows: args.sentRows,
+ currentRows: args.currentRows,
+ savedRows: args.savedRows,
+ sentAnchors: args.sentAnchors ?? [],
+ currentAnchors: args.currentAnchors ?? [],
+ savedAnchors: args.savedAnchors ?? []
+ });
+
+describe("mergeSaveResponse", () => {
+ it("takes the server's copy of rows untouched since the save", () => {
+ const a = row("ift_a", "1", { featureDirty: true });
+ const saved = row("ift_a", "1");
+ const { rows } = merge({
+ sentRows: [a],
+ currentRows: [a],
+ savedRows: [saved]
+ });
+ expect(rows).toEqual([saved]);
+ });
+
+ it("keeps an edit made during the save, still dirty", () => {
+ const sent = row("ift_a", "1");
+ const edited = { ...sent, label: "1A", featureDirty: true };
+ const { rows } = merge({
+ sentRows: [sent],
+ currentRows: [edited],
+ savedRows: [row("ift_a", "1")]
+ });
+ expect(rows).toEqual([edited]);
+ });
+
+ it("keeps a row added during the save", () => {
+ const a = row("ift_a", "1");
+ const added = row("ift_b", "2");
+ const { rows } = merge({
+ sentRows: [a],
+ currentRows: [a, added],
+ savedRows: [a]
+ });
+ expect(rows).toEqual([a, added]);
+ });
+
+ it("keeps the editor's order rather than the server's", () => {
+ const one = row("ift_1", "1");
+ const twelve = row("ift_2", "12");
+ const eleven = row("ift_3", "11");
+ // The server sorts by label; the editor shows the rows as the user left them.
+ const { rows } = merge({
+ sentRows: [one, twelve, eleven],
+ currentRows: [one, twelve, eleven],
+ savedRows: [one, eleven, twelve]
+ });
+ expect(rows.map((r) => r.featureId)).toEqual(["ift_1", "ift_2", "ift_3"]);
+ });
+
+ it("turns an anchor the save created, then moved, into an update", () => {
+ const placed = { id: "bbn_a", isNew: true, isDirty: false };
+ const moved = { ...placed };
+ const { anchors } = merge({
+ sentRows: [],
+ currentRows: [],
+ savedRows: [],
+ sentAnchors: [placed],
+ currentAnchors: [moved],
+ savedAnchors: [{ id: "bbn_a", isNew: false, isDirty: false }]
+ });
+ expect(anchors).toEqual([{ id: "bbn_a", isNew: false, isDirty: true }]);
+ });
+
+ it("takes the server's copy of an anchor untouched since the save", () => {
+ const placed = { id: "bbn_a", isNew: true, isDirty: false };
+ const saved = { id: "bbn_a", isNew: false, isDirty: false };
+ const { anchors } = merge({
+ sentRows: [],
+ currentRows: [],
+ savedRows: [],
+ sentAnchors: [placed],
+ currentAnchors: [placed],
+ savedAnchors: [saved]
+ });
+ expect(anchors).toEqual([saved]);
+ });
+});
+
+describe("hasUnsavedRows", () => {
+ const none = () => false;
+
+ it("is false once every row and anchor is saved and clean", () => {
+ expect(
+ hasUnsavedRows(
+ [row("ift_a", "1", { balloonId: "bbn_a" })],
+ [{ id: "bbn_a", isNew: false, isDirty: false }],
+ none
+ )
+ ).toBe(false);
+ });
+
+ it("is true for an unsaved row or balloon", () => {
+ const unsaved = (id: string) => id === "ift_new" || id === "bbn_new";
+ expect(hasUnsavedRows([row("ift_new", "1")], [], unsaved)).toBe(true);
+ expect(
+ hasUnsavedRows([row("ift_a", "1", { balloonId: "bbn_new" })], [], unsaved)
+ ).toBe(true);
+ });
+
+ it("is true for an edited row or a moved anchor", () => {
+ expect(
+ hasUnsavedRows([row("ift_a", "1", { featureDirty: true })], [], none)
+ ).toBe(true);
+ expect(
+ hasUnsavedRows([], [{ id: "bbn_a", isNew: false, isDirty: true }], none)
+ ).toBe(true);
+ });
+});
+
+describe("minted ids", () => {
+ it("carry the table's prefix and pass the save validator's shape", () => {
+ expect(newFeatureId()).toMatch(/^ift_[A-Za-z0-9_-]{8,60}$/);
+ expect(newBalloonId()).toMatch(/^bbn_[A-Za-z0-9_-]{8,60}$/);
+ expect(newFeatureId()).not.toBe(newFeatureId());
+ });
+});
diff --git a/apps/erp/app/modules/quality/ui/InspectionDocument/autosave.ts b/apps/erp/app/modules/quality/ui/InspectionDocument/autosave.ts
new file mode 100644
index 0000000000..94d13bc97d
--- /dev/null
+++ b/apps/erp/app/modules/quality/ui/InspectionDocument/autosave.ts
@@ -0,0 +1,94 @@
+import { nanoid } from "nanoid";
+
+// The inspection plan editor saves itself. It mints the ids of the
+// characteristics and balloons it creates, so a row keeps one id from the
+// moment it is drawn; the user can keep editing while a save is in flight, and
+// the save's response is merged into the current rows rather than replacing
+// them.
+
+/** Quiet period after the last edit before the plan is saved. */
+export const AUTOSAVE_DELAY_MS = 500;
+
+export const newFeatureId = () => `ift_${nanoid()}`;
+export const newBalloonId = () => `bbn_${nanoid()}`;
+
+type MergeableRow = {
+ featureId: string;
+ balloonId: string | null;
+ featureDirty?: boolean;
+ geometryDirty?: boolean;
+};
+
+type MergeableAnchor = {
+ id: string;
+ isNew: boolean;
+ isDirty: boolean;
+};
+
+/** `isUnsaved` is true for an id the server has not created yet. */
+export function hasUnsavedRows(
+ rows: MergeableRow[],
+ anchors: MergeableAnchor[],
+ isUnsaved: (id: string) => boolean
+) {
+ return (
+ rows.some(
+ (r) =>
+ isUnsaved(r.featureId) ||
+ (r.balloonId != null && isUnsaved(r.balloonId)) ||
+ r.featureDirty ||
+ (r.geometryDirty && r.balloonId != null)
+ ) || anchors.some((a) => a.isNew || a.isDirty)
+ );
+}
+
+/**
+ * Merges a save response into the rows the editor holds now.
+ *
+ * - A row untouched since the save went out (same object) takes the server's
+ * copy, which is clean.
+ * - A row edited meanwhile is kept as it is: every edit marks its row dirty,
+ * so the next save sends it.
+ * - An anchor the save created but the user moved meanwhile is no longer new,
+ * only dirty — the next save updates it rather than creating it twice.
+ *
+ * The current order is kept, so a row never moves under the cursor.
+ */
+export function mergeSaveResponse<
+ R extends MergeableRow,
+ A extends MergeableAnchor
+>({
+ sentRows,
+ sentAnchors,
+ currentRows,
+ currentAnchors,
+ savedRows,
+ savedAnchors
+}: {
+ sentRows: R[];
+ sentAnchors: A[];
+ currentRows: R[];
+ currentAnchors: A[];
+ savedRows: R[];
+ savedAnchors: A[];
+}) {
+ const sentRowSet = new Set(sentRows);
+ const savedRowById = new Map(savedRows.map((r) => [r.featureId, r]));
+ const rows = currentRows.map((r) =>
+ sentRowSet.has(r) ? (savedRowById.get(r.featureId) ?? r) : r
+ );
+
+ const sentAnchorSet = new Set(sentAnchors);
+ const createdAnchorIds = new Set(
+ sentAnchors.filter((a) => a.isNew).map((a) => a.id)
+ );
+ const savedAnchorById = new Map(savedAnchors.map((a) => [a.id, a]));
+ const anchors = currentAnchors.map((a): A => {
+ if (sentAnchorSet.has(a)) return savedAnchorById.get(a.id) ?? a;
+ if (createdAnchorIds.has(a.id))
+ return { ...a, isNew: false, isDirty: true };
+ return a;
+ });
+
+ return { rows, anchors };
+}
diff --git a/apps/erp/app/modules/quality/ui/InspectionDocument/drawingRaster.ts b/apps/erp/app/modules/quality/ui/InspectionDocument/drawingRaster.ts
new file mode 100644
index 0000000000..182f05c0c1
--- /dev/null
+++ b/apps/erp/app/modules/quality/ui/InspectionDocument/drawingRaster.ts
@@ -0,0 +1,322 @@
+// Off-screen PDF rasterizing for the inspection plan editor: the padded crop
+// of an anchor sent to vision analysis, and the drawing exported with its
+// balloons and anchors burned in (matching the Konva overlay). Browser-only:
+// it renders through pdf.js onto canvases.
+import { closePdf, openPdf } from "@carbon/files/pdf";
+import {
+ BALLOON_CALLOUT_STROKE,
+ clippedBalloonToAnchorLine
+} from "@carbon/utils";
+import { PDFDocument } from "pdf-lib";
+
+// ─── Anchor crop (vision analysis) ───────────────────────────────────────────
+
+/** Extra resolution for vision / OCR vs on-screen PDF preview. */
+const VISION_RENDER_SCALE = 1.75;
+/** Cap raster width so very large displays do not allocate huge canvases. */
+const MAX_VISION_RASTER_WIDTH_PX = 4096;
+/** Pad crop by this fraction of max(width,height) on each side (percent space). */
+const CROP_PAD_FRAC = 0.1;
+const CROP_PAD_MAX_PCT = 4;
+const CROP_PAD_MIN_PCT = 0.3;
+/** Minimum crop width/height in percent-of-page so tiny boxes stay readable. */
+const CROP_MIN_SIZE_PCT = 2.5;
+
+type InspectionAnchorCropArgs = {
+ pdfBytes: ArrayBuffer;
+ pageNumber: number;
+ /** 0–100, same coordinate system as `SelectorRect` in the inspection editor */
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+ /**
+ * Horizontal size in CSS px of one rendered page (matches `react-pdf` `Page` `width={renderedWidth}`).
+ * Viewport scale is derived so raster width matches this value times an internal vision scale (capped).
+ */
+ renderedPageWidthPx: number;
+};
+
+/**
+ * Expands the anchor rect with padding, enforces a minimum size, and clamps to the page (0–100 %).
+ */
+function prepareVisionCropRect(
+ x: number,
+ y: number,
+ width: number,
+ height: number
+): { x: number; y: number; width: number; height: number } {
+ const w0 = Math.max(1e-6, width);
+ const h0 = Math.max(1e-6, height);
+ const mx = Math.max(w0, h0);
+ const pad = Math.min(
+ CROP_PAD_MAX_PCT,
+ Math.max(CROP_PAD_MIN_PCT, CROP_PAD_FRAC * mx)
+ );
+
+ const cx = x + w0 / 2;
+ const cy = y + h0 / 2;
+ let w = w0 + 2 * pad;
+ let h = h0 + 2 * pad;
+
+ w = Math.max(w, CROP_MIN_SIZE_PCT);
+ h = Math.max(h, CROP_MIN_SIZE_PCT);
+
+ w = Math.min(w, 100);
+ h = Math.min(h, 100);
+
+ let nx = cx - w / 2;
+ let ny = cy - h / 2;
+ nx = Math.max(0, Math.min(nx, 100 - w));
+ ny = Math.max(0, Math.min(ny, 100 - h));
+
+ return { x: nx, y: ny, width: w, height: h };
+}
+
+/**
+ * Renders one PDF page at higher resolution than the editor preview, then crops the (padded, min-sized) anchor rectangle to PNG.
+ */
+export async function cropInspectionAnchorToPngBlob(
+ args: InspectionAnchorCropArgs
+): Promise<Blob> {
+ const { pdfBytes, pageNumber, x, y, width, height, renderedPageWidthPx } =
+ args;
+
+ const {
+ x: rx,
+ y: ry,
+ width: rw,
+ height: rh
+ } = prepareVisionCropRect(x, y, width, height);
+
+ const pdf = await openPdf(pdfBytes);
+
+ try {
+ const page = await pdf.getPage(pageNumber);
+ const baseVp = page.getViewport({ scale: 1 });
+ const targetWidth = Math.min(
+ Math.max(1, Math.floor(renderedPageWidthPx * VISION_RENDER_SCALE)),
+ MAX_VISION_RASTER_WIDTH_PX
+ );
+ const scale = targetWidth / baseVp.width;
+ const viewport = page.getViewport({ scale });
+ const cw = Math.max(1, Math.floor(viewport.width));
+ const ch = Math.max(1, Math.floor(viewport.height));
+
+ const canvas = document.createElement("canvas");
+ canvas.width = cw;
+ canvas.height = ch;
+ const ctx = canvas.getContext("2d");
+ if (!ctx) {
+ throw new Error("Could not get canvas context");
+ }
+
+ const renderTask = page.render({
+ canvas,
+ canvasContext: ctx,
+ viewport
+ });
+ await renderTask.promise;
+
+ const sx = Math.floor((rx / 100) * cw);
+ const sy = Math.floor((ry / 100) * ch);
+ const sw = Math.max(1, Math.floor((rw / 100) * cw));
+ const sh = Math.max(1, Math.floor((rh / 100) * ch));
+
+ const sx2 = Math.max(0, Math.min(sx, cw - 1));
+ const sy2 = Math.max(0, Math.min(sy, ch - 1));
+ const sw2 = Math.max(1, Math.min(sw, cw - sx2));
+ const sh2 = Math.max(1, Math.min(sh, ch - sy2));
+
+ const crop = document.createElement("canvas");
+ crop.width = sw2;
+ crop.height = sh2;
+ const cctx = crop.getContext("2d");
+ if (!cctx) {
+ throw new Error("Could not get crop canvas context");
+ }
+ cctx.drawImage(canvas, sx2, sy2, sw2, sh2, 0, 0, sw2, sh2);
+
+ return await new Promise<Blob>((resolve, reject) => {
+ crop.toBlob((b) => {
+ if (b) resolve(b);
+ else reject(new Error("Canvas toBlob failed"));
+ }, "image/png");
+ });
+ } finally {
+ await closePdf(pdf);
+ }
+}
+
+// ─── PDF export with balloon overlays ────────────────────────────────────────
+
+type ExportFeatureRow = {
+ balloonId: string;
+ balloonAnchorId: string;
+ label: string;
+ pageNumber: number;
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+};
+
+type ExportSelectorRect = {
+ id: string;
+ pageNumber: number;
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+};
+
+function drawMarkupOnPageCanvas(
+ ctx: CanvasRenderingContext2D,
+ cw: number,
+ ch: number,
+ pageNumber: number,
+ featureRows: ExportFeatureRow[],
+ anchorRects: ExportSelectorRect[]
+) {
+ ctx.save();
+ ctx.lineJoin = "round";
+ ctx.lineCap = "round";
+
+ for (const s of anchorRects) {
+ if (s.pageNumber !== pageNumber) continue;
+ const sx = (s.x / 100) * cw;
+ const sy = (s.y / 100) * ch;
+ const sw = (s.width / 100) * cw;
+ const sh = (s.height / 100) * ch;
+ ctx.strokeStyle = BALLOON_CALLOUT_STROKE;
+ ctx.lineWidth = 2;
+ ctx.strokeRect(sx, sy, sw, sh);
+ }
+
+ for (const b of featureRows) {
+ if (b.pageNumber !== pageNumber) continue;
+ const bw = (b.width / 100) * cw;
+ const bh = (b.height / 100) * ch;
+ const balloonX = (b.x / 100) * cw;
+ const balloonY = (b.y / 100) * ch;
+ const balloonCenterX = balloonX + bw / 2;
+ const balloonCenterY = balloonY + bh / 2;
+ const radius = Math.max(8, Math.min(bw, bh) / 2);
+ const balloonLabelFontSize = Math.max(
+ 14,
+ Math.min(26, Math.round(radius * 1.15))
+ );
+
+ const linkedSelector = anchorRects.find((s) => s.id === b.balloonAnchorId);
+ let linePoints: [number, number, number, number] | null = null;
+ if (linkedSelector) {
+ const sx = (linkedSelector.x / 100) * cw;
+ const sy = (linkedSelector.y / 100) * ch;
+ const sw = (linkedSelector.width / 100) * cw;
+ const sh = (linkedSelector.height / 100) * ch;
+ const anchorX = sx + sw / 2;
+ const anchorY = sy + sh / 2;
+ linePoints = clippedBalloonToAnchorLine(
+ balloonCenterX,
+ balloonCenterY,
+ radius,
+ anchorX,
+ anchorY,
+ { x: sx, y: sy, w: sw, h: sh }
+ );
+ }
+
+ if (linePoints) {
+ ctx.beginPath();
+ ctx.strokeStyle = BALLOON_CALLOUT_STROKE;
+ ctx.lineWidth = 2;
+ ctx.moveTo(linePoints[0], linePoints[1]);
+ ctx.lineTo(linePoints[2], linePoints[3]);
+ ctx.stroke();
+ }
+
+ ctx.beginPath();
+ ctx.arc(balloonCenterX, balloonCenterY, radius, 0, Math.PI * 2);
+ ctx.strokeStyle = BALLOON_CALLOUT_STROKE;
+ ctx.lineWidth = 2;
+ ctx.fillStyle = "#ffffff";
+ ctx.fill();
+ ctx.stroke();
+
+ ctx.font = `bold ${balloonLabelFontSize}px ui-sans-serif, system-ui, sans-serif`;
+ ctx.fillStyle = BALLOON_CALLOUT_STROKE;
+ ctx.textAlign = "center";
+ ctx.textBaseline = "middle";
+ ctx.fillText(b.label, balloonCenterX, balloonCenterY);
+ }
+
+ ctx.restore();
+}
+
+/**
+ * Rasterizes each PDF page with anchor + balloon markup (matching the Konva overlay) and builds a new PDF.
+ */
+export async function buildInspectionDocumentPdfWithOverlaysBytes(args: {
+ pdfBytes: ArrayBuffer;
+ featureRows: ExportFeatureRow[];
+ anchorRects: ExportSelectorRect[];
+ /** PDF.js render scale; higher = sharper file */
+ scale?: number;
+}): Promise<Uint8Array> {
+ const scale = args.scale ?? 2;
+ const pdf = await openPdf(args.pdfBytes);
+ const outDoc = await PDFDocument.create();
+
+ try {
+ const numPages = pdf.numPages;
+ for (let pageNum = 1; pageNum <= numPages; pageNum += 1) {
+ const page = await pdf.getPage(pageNum);
+ const viewport = page.getViewport({ scale });
+ const cw = Math.floor(viewport.width);
+ const ch = Math.floor(viewport.height);
+ const canvas = document.createElement("canvas");
+ canvas.width = cw;
+ canvas.height = ch;
+ const ctx = canvas.getContext("2d");
+ if (!ctx) {
+ throw new Error("Could not get canvas context");
+ }
+
+ const renderTask = page.render({
+ canvas,
+ canvasContext: ctx,
+ viewport
+ });
+ await renderTask.promise;
+
+ drawMarkupOnPageCanvas(
+ ctx,
+ cw,
+ ch,
+ pageNum,
+ args.featureRows,
+ args.anchorRects
+ );
+
+ const blob = await new Promise<Blob>((resolve, reject) => {
+ canvas.toBlob((b) => {
+ if (b) resolve(b);
+ else reject(new Error("Canvas toBlob failed"));
+ }, "image/png");
+ });
+ const pngBytes = new Uint8Array(await blob.arrayBuffer());
+ const image = await outDoc.embedPng(pngBytes);
+ const pdfPage = outDoc.addPage([cw, ch]);
+ pdfPage.drawImage(image, {
+ x: 0,
+ y: 0,
+ width: cw,
+ height: ch
+ });
+ }
+
+ return await outDoc.save({ useObjectStreams: true });
+ } finally {
+ await closePdf(pdf);
+ }
+}
diff --git a/apps/erp/app/modules/production/ui/InspectionDocument/index.ts b/apps/erp/app/modules/quality/ui/InspectionDocument/index.ts
similarity index 100%
rename from apps/erp/app/modules/production/ui/InspectionDocument/index.ts
rename to apps/erp/app/modules/quality/ui/InspectionDocument/index.ts
diff --git a/apps/erp/app/modules/quality/ui/Inspections/InspectionDrawingPane.tsx b/apps/erp/app/modules/quality/ui/Inspections/InspectionDrawingPane.tsx
index ce20de9904..dcaf296399 100644
--- a/apps/erp/app/modules/quality/ui/Inspections/InspectionDrawingPane.tsx
+++ b/apps/erp/app/modules/quality/ui/Inspections/InspectionDrawingPane.tsx
@@ -1,19 +1,27 @@
import { IconButton } from "@carbon/react";
+import {
+ BALLOON_CALLOUT_STROKE,
+ BALLOON_H_NORM,
+ BALLOON_W_NORM,
+ clippedBalloonToAnchorLine
+} from "@carbon/utils";
import { useEffect, useMemo, useRef, useState } from "react";
import { LuChevronLeft, LuChevronRight } from "react-icons/lu";
-import { Circle, Group, Layer, Stage, Text } from "react-konva";
+import { Circle, Group, Layer, Line, Stage, Text } from "react-konva";
import { Document, Page } from "react-pdf";
import "react-pdf/dist/Page/AnnotationLayer.css";
import "react-pdf/dist/Page/TextLayer.css";
-const CALLOUT_STROKE = "#f97316";
-
export type DrawingBalloon = {
id: string;
inspectionFeatureId: string;
pageNumber: number;
xCoordinate: number;
yCoordinate: number;
+ regionX: number;
+ regionY: number;
+ regionWidth: number;
+ regionHeight: number;
label: string;
};
@@ -144,9 +152,28 @@ const InspectionDrawingPane = ({
<Stage width={containerWidth} height={overlayHeight} listening>
<Layer>
{pageBalloons.map((balloon) => {
- // DB coordinates are normalized 0–1.
- const x = balloon.xCoordinate * containerWidth;
- const y = balloon.yCoordinate * overlayHeight;
+ // DB coordinates are normalized 0–1: the balloon box's
+ // top-left corner, and the anchor region it points at.
+ const x =
+ (balloon.xCoordinate + BALLOON_W_NORM / 2) *
+ containerWidth;
+ const y =
+ (balloon.yCoordinate + BALLOON_H_NORM / 2) *
+ overlayHeight;
+ const region = {
+ x: balloon.regionX * containerWidth,
+ y: balloon.regionY * overlayHeight,
+ w: balloon.regionWidth * containerWidth,
+ h: balloon.regionHeight * overlayHeight
+ };
+ const linePoints = clippedBalloonToAnchorLine(
+ x,
+ y,
+ balloonRadius,
+ region.x + region.w / 2,
+ region.y + region.h / 2,
+ region
+ );
const isActive =
balloon.inspectionFeatureId === activeFeatureId;
return (
@@ -167,11 +194,19 @@ const InspectionDrawingPane = ({
if (stage) stage.container().style.cursor = "";
}}
>
+ {linePoints && (
+ <Line
+ points={linePoints}
+ stroke={BALLOON_CALLOUT_STROKE}
+ strokeWidth={2}
+ listening={false}
+ />
+ )}
<Circle
x={x}
y={y}
radius={balloonRadius}
- stroke={CALLOUT_STROKE}
+ stroke={BALLOON_CALLOUT_STROKE}
strokeWidth={isActive ? 3 : 2}
fill={
isActive
@@ -187,7 +222,7 @@ const InspectionDrawingPane = ({
text={balloon.label}
fontSize={balloonRadius}
fontStyle="bold"
- fill={CALLOUT_STROKE}
+ fill={BALLOON_CALLOUT_STROKE}
listening={false}
/>
</Group>
diff --git a/apps/erp/app/modules/quality/ui/Inspections/InspectionGaugePicker.tsx b/apps/erp/app/modules/quality/ui/Inspections/InspectionGaugePicker.tsx
new file mode 100644
index 0000000000..9f8ffe939d
--- /dev/null
+++ b/apps/erp/app/modules/quality/ui/Inspections/InspectionGaugePicker.tsx
@@ -0,0 +1,232 @@
+import type { Database } from "@carbon/database";
+import {
+ Command,
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ CommandList,
+ cn,
+ Popover,
+ PopoverContent,
+ PopoverTrigger
+} from "@carbon/react";
+import { useLingui } from "@lingui/react/macro";
+import { useMemo, useState } from "react";
+import { LuCheck, LuChevronDown, LuTriangleAlert, LuX } from "react-icons/lu";
+import { GaugeCalibrationStatus } from "../Gauge/GaugeStatus";
+
+// A row of the `gauges` view (every column is nullable on a view).
+export type GaugeOption = {
+ id: string | null;
+ gaugeId: string | null;
+ description: string | null;
+ gaugeTypeId: string | null;
+ gaugeStatus: Database["public"]["Enums"]["gaugeStatus"] | null;
+ gaugeCalibrationStatusWithDueDate:
+ | Database["public"]["Enums"]["gaugeCalibrationStatus"]
+ | null;
+};
+
+type InspectionGaugePickerProps = {
+ // Every Active gauge plus any (possibly retired) gauge recorded on this lot.
+ // Only Active gauges are offered; the rest exist so a recorded gauge still
+ // displays by its readable id.
+ gauges: GaugeOption[];
+ // The characteristic's label (balloon number), for the trigger's
+ // accessible name.
+ characteristicLabel: string;
+ // Gauge ids most recently recorded at this lot's work center, newest first.
+ recentGaugeIds: string[];
+ // The feature's required gauge type — when set, only gauges of that type
+ // are offered.
+ gaugeTypeId: string | null;
+ gaugeTypeName: string | null;
+ value: string | null;
+ isReadOnly: boolean;
+ onChange: (gaugeId: string | null) => void;
+};
+
+const isOutOfCalibration = (gauge: GaugeOption) =>
+ gauge.gaugeCalibrationStatusWithDueDate === "Out-of-Calibration";
+
+// The gauge cell of an inspection grid: a button filling the whole cell that
+// opens a searchable list, with the gauges recently used at this work center
+// on top and the rest below.
+const InspectionGaugePicker = ({
+ gauges,
+ characteristicLabel,
+ recentGaugeIds,
+ gaugeTypeId,
+ gaugeTypeName,
+ value,
+ isReadOnly,
+ onChange
+}: InspectionGaugePickerProps) => {
+ const { t } = useLingui();
+ const [open, setOpen] = useState(false);
+
+ const selected = value ? gauges.find((g) => g.id === value) : undefined;
+
+ const { recent, rest } = useMemo(() => {
+ const eligible = gauges.filter(
+ (g) =>
+ g.id &&
+ g.gaugeStatus === "Active" &&
+ (!gaugeTypeId || g.gaugeTypeId === gaugeTypeId)
+ );
+ const byId = new Map(eligible.map((g) => [g.id as string, g]));
+ const recent = recentGaugeIds
+ .map((id) => byId.get(id))
+ .filter((g): g is GaugeOption => g !== undefined);
+ const recentIds = new Set(recent.map((g) => g.id));
+ return {
+ recent,
+ rest: eligible.filter((g) => !recentIds.has(g.id))
+ };
+ }, [gauges, recentGaugeIds, gaugeTypeId]);
+
+ const placeholder = gaugeTypeName ?? t`Select gauge`;
+ const isInactive = selected?.gaugeStatus === "Inactive";
+
+ const label = selected ? (
+ <span className="flex min-w-0 items-center gap-1.5">
+ {isOutOfCalibration(selected) && (
+ <LuTriangleAlert
+ role="img"
+ className="size-3.5 shrink-0 text-red-500"
+ aria-label={t`Out of calibration`}
+ />
+ )}
+ <span
+ className={cn(
+ "truncate font-mono text-xs",
+ isInactive && "text-muted-foreground"
+ )}
+ >
+ {selected.gaugeId}
+ </span>
+ {isInactive && (
+ <span className="shrink-0 text-xs text-muted-foreground">
+ {t`(Inactive)`}
+ </span>
+ )}
+ </span>
+ ) : value ? (
+ <span className="truncate text-xs text-muted-foreground">
+ {t`Unknown gauge`}
+ </span>
+ ) : (
+ <span className="truncate text-xs text-muted-foreground">
+ {placeholder}
+ </span>
+ );
+
+ if (isReadOnly) {
+ return (
+ <div className="flex h-full min-w-[120px] items-center px-3">
+ {selected || value ? label : "—"}
+ </div>
+ );
+ }
+
+ const renderItem = (gauge: GaugeOption) => (
+ <CommandItem
+ key={gauge.id}
+ value={`${gauge.gaugeId ?? ""} ${gauge.description ?? ""} ${gauge.id}`}
+ onSelect={() => {
+ onChange(gauge.id);
+ setOpen(false);
+ }}
+ >
+ <div className="flex min-w-0 flex-1 flex-col">
+ <span className="truncate font-mono text-xs">{gauge.gaugeId}</span>
+ {gauge.description && (
+ <span className="truncate text-xs text-muted-foreground">
+ {gauge.description}
+ </span>
+ )}
+ </div>
+ {isOutOfCalibration(gauge) && (
+ <GaugeCalibrationStatus
+ status={gauge.gaugeCalibrationStatusWithDueDate}
+ />
+ )}
+ <LuCheck
+ className={cn(
+ "ml-2 size-4 shrink-0",
+ gauge.id === value ? "opacity-100" : "opacity-0"
+ )}
+ />
+ </CommandItem>
+ );
+
+ const currentGauge = selected
+ ? `${selected.gaugeId ?? ""}${isInactive ? ` ${t`(Inactive)`}` : ""}`
+ : value
+ ? t`Unknown gauge`
+ : t`None`;
+
+ return (
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ aria-label={t`Gauge for characteristic ${characteristicLabel}: ${currentGauge}`}
+ onClick={(e) => e.stopPropagation()}
+ className="flex h-full min-h-10 w-full min-w-[120px] items-center justify-between gap-2 px-3 text-left transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"
+ >
+ {label}
+ <LuChevronDown className="size-3.5 shrink-0 text-muted-foreground" />
+ </button>
+ </PopoverTrigger>
+ <PopoverContent
+ align="start"
+ className="w-72 p-0"
+ onClick={(e) => e.stopPropagation()}
+ >
+ <Command>
+ <CommandInput
+ placeholder={
+ gaugeTypeName
+ ? t`Search ${gaugeTypeName}...`
+ : t`Search gauges...`
+ }
+ className="h-9"
+ />
+ <CommandList>
+ <CommandEmpty>{t`No gauges found.`}</CommandEmpty>
+ {recent.length > 0 && (
+ <CommandGroup heading={t`Recently used`}>
+ {recent.map(renderItem)}
+ </CommandGroup>
+ )}
+ {rest.length > 0 && (
+ <CommandGroup
+ heading={recent.length > 0 ? t`All gauges` : undefined}
+ >
+ {rest.map(renderItem)}
+ </CommandGroup>
+ )}
+ {value && (
+ <CommandGroup>
+ <CommandItem
+ value="__clear__"
+ onSelect={() => {
+ onChange(null);
+ setOpen(false);
+ }}
+ >
+ <LuX className="mr-2 size-4 shrink-0" />
+ {t`Clear gauge`}
+ </CommandItem>
+ </CommandGroup>
+ )}
+ </CommandList>
+ </Command>
+ </PopoverContent>
+ </Popover>
+ );
+};
+
+export default InspectionGaugePicker;
diff --git a/apps/erp/app/modules/quality/ui/Inspections/InspectionMeasurementGrid.tsx b/apps/erp/app/modules/quality/ui/Inspections/InspectionMeasurementGrid.tsx
index aa2e89b51f..f9a209bab4 100644
--- a/apps/erp/app/modules/quality/ui/Inspections/InspectionMeasurementGrid.tsx
+++ b/apps/erp/app/modules/quality/ui/Inspections/InspectionMeasurementGrid.tsx
@@ -8,11 +8,13 @@ import { Table } from "~/components";
import type { EditableTableCellComponentProps } from "~/components/Editable";
import { EditableNumber } from "~/components/Editable";
import type {
+ InspectionGauge,
InspectionMeasurement,
InspectionSample,
InspectionSamplingPlan
} from "~/modules/quality/types";
import { path } from "~/utils/path";
+import InspectionGaugePicker from "./InspectionGaugePicker";
// A cell save's response payload (the measurement action returns it so the
// grid can update without a revalidation roundtrip).
@@ -37,6 +39,8 @@ type FeatureGridRow = {
sampleSize: number;
acceptanceNumber: number;
rejectionNumber: number;
+ gaugeTypeId: string | null;
+ gaugeTypeName: string | null;
} & Record<string, unknown>;
type InspectionMeasurementGridProps = {
@@ -46,6 +50,8 @@ type InspectionMeasurementGridProps = {
features: InspectionSamplingPlan[];
samples: InspectionSample[];
measurements: InspectionMeasurement[];
+ gauges: InspectionGauge[];
+ recentGaugeIds: string[];
maxSampleSize: number;
// Lot size caps how many sample columns can exist — a feature's n is the
// required minimum, but the inspector may record up to the whole lot.
@@ -64,6 +70,11 @@ type InspectionMeasurementGridProps = {
const sampleKey = (columnIndex: number) => `sample-${columnIndex}`;
+// Mirrors RECENT_INSPECTION_GAUGE_LIMIT in packages/database/src/quality.ts
+// (the server's "recently used" cap) — that module is server-only (Kysely), so
+// it cannot be imported into this client component.
+const RECENT_INSPECTION_GAUGE_LIMIT = 10;
+
// Synthetic feature id for the single pass/fail row shown when the lot has no
// inspection document. Its cells write the sample's status directly (via the
// sample route) rather than a per-feature measurement.
@@ -87,6 +98,8 @@ const InspectionMeasurementGrid = ({
features,
samples,
measurements,
+ gauges,
+ recentGaugeIds,
maxSampleSize,
lotSize,
lotAcceptanceNumber,
@@ -327,6 +340,143 @@ const InspectionMeasurementGrid = ({
[persistCell, t]
);
+ // The gauge recorded per feature: the plan rows' value, overridden
+ // optimistically on selection until the loader data agrees with it.
+ const [gaugeByFeature, setGaugeByFeature] = useState<
+ Record<string, string | null>
+ >({});
+ const [recentGauges, setRecentGauges] = useState(recentGaugeIds);
+ useEffect(() => {
+ setRecentGauges(recentGaugeIds);
+ }, [recentGaugeIds]);
+ const serverGaugeFor = useCallback(
+ (featureId: string): string | null =>
+ features.find((f) => f.inspectionFeatureId === featureId)?.gaugeId ??
+ null,
+ [features]
+ );
+ const serverGaugeForRef = useRef(serverGaugeFor);
+ serverGaugeForRef.current = serverGaugeFor;
+ const gaugeFor = useCallback(
+ (featureId: string): string | null =>
+ featureId in gaugeByFeature
+ ? gaugeByFeature[featureId]
+ : serverGaugeFor(featureId),
+ [gaugeByFeature, serverGaugeFor]
+ );
+
+ // Per-feature request bookkeeping, so a request that settles late can never
+ // undo a newer pick: `latest` is the newest request id, `settled` whether
+ // it has answered, `confirmed` the newest request the server accepted.
+ const gaugeRequests = useRef<
+ Record<
+ string,
+ {
+ latest: number;
+ settled: boolean;
+ confirmed?: { id: number; gaugeId: string | null };
+ }
+ >
+ >({});
+ // One gauge request per characteristic at a time, so the server commits the
+ // picks in the order they were made.
+ const gaugeQueue = useRef<Record<string, Promise<void>>>({});
+
+ // Once the loader data matches a settled pick, drop the override so later
+ // revalidations show the server's value.
+ useEffect(() => {
+ const caughtUp = Object.keys(gaugeByFeature).filter((featureId) => {
+ const request = gaugeRequests.current[featureId];
+ return (
+ (!request || request.settled) &&
+ serverGaugeFor(featureId) === gaugeByFeature[featureId]
+ );
+ });
+ if (caughtUp.length === 0) return;
+ for (const featureId of caughtUp) {
+ const request = gaugeRequests.current[featureId];
+ if (request) {
+ request.confirmed = {
+ id: request.latest,
+ gaugeId: serverGaugeFor(featureId)
+ };
+ }
+ }
+ setGaugeByFeature((prev) => {
+ const next = { ...prev };
+ for (const featureId of caughtUp) delete next[featureId];
+ return next;
+ });
+ }, [gaugeByFeature, serverGaugeFor]);
+
+ const persistGauge = useCallback(
+ async (featureId: string, gaugeId: string | null) => {
+ const request = gaugeRequests.current[featureId] ?? {
+ latest: 0,
+ settled: true
+ };
+ gaugeRequests.current[featureId] = request;
+ const requestId = request.latest + 1;
+ request.latest = requestId;
+ request.settled = false;
+ setGaugeByFeature((prev) => ({ ...prev, [featureId]: gaugeId }));
+
+ // Wait for this characteristic's previous request; a pick superseded
+ // while it waited is never sent.
+ const sent = (gaugeQueue.current[featureId] ?? Promise.resolve()).then(
+ async () => {
+ if (requestId !== request.latest) return null;
+ const formData = new FormData();
+ formData.set("inspectionId", inspectionId);
+ formData.set("inspectionFeatureId", featureId);
+ formData.set("gaugeId", gaugeId ?? "");
+ const response = await fetch(path.to.inspectionGauge(inspectionId), {
+ method: "post",
+ body: formData
+ }).catch(() => null);
+ const body = (await response?.json().catch(() => null)) as {
+ error?: { message: string } | null;
+ } | null;
+ return {
+ ok: !!response?.ok && !!body && !body.error,
+ message: body?.error?.message
+ };
+ }
+ );
+ gaugeQueue.current[featureId] = sent.then(() => undefined);
+ const result = await sent;
+ if (!result) return;
+ const { ok } = result;
+
+ if (ok && (!request.confirmed || requestId > request.confirmed.id)) {
+ request.confirmed = { id: requestId, gaugeId };
+ }
+ if (requestId === request.latest) request.settled = true;
+
+ if (!ok) {
+ toast.error(result.message ?? t`Failed to record gauge`);
+ } else if (gaugeId) {
+ setRecentGauges((prev) =>
+ [gaugeId, ...prev.filter((id) => id !== gaugeId)].slice(
+ 0,
+ RECENT_INSPECTION_GAUGE_LIMIT
+ )
+ );
+ }
+
+ // Once the newest pick has answered, show what the server last
+ // accepted: that pick if it succeeded, else the newest earlier pick
+ // that did, else the loader's value.
+ if (request.settled) {
+ const shown = request.confirmed
+ ? request.confirmed.gaugeId
+ : serverGaugeForRef.current(featureId);
+ setGaugeByFeature((prev) => ({ ...prev, [featureId]: shown }));
+ }
+ },
+ [inspectionId, t]
+ );
+
const rows = useMemo<FeatureGridRow[]>(() => {
if (!hasFeatures) {
// Single synthetic pass/fail row for lots with no inspection document.
@@ -340,7 +490,9 @@ const InspectionMeasurementGrid = ({
specLabel: "",
sampleSize: maxSampleSize,
acceptanceNumber: lotAcceptanceNumber,
- rejectionNumber: lotRejectionNumber
+ rejectionNumber: lotRejectionNumber,
+ gaugeTypeId: null,
+ gaugeTypeName: null
}
];
}
@@ -370,7 +522,9 @@ const InspectionMeasurementGrid = ({
specLabel: spec,
sampleSize: lotFeature.sampleSize,
acceptanceNumber: lotFeature.acceptanceNumber,
- rejectionNumber: lotFeature.rejectionNumber
+ rejectionNumber: lotFeature.rejectionNumber,
+ gaugeTypeId: feature.gaugeTypeId ?? null,
+ gaugeTypeName: feature.gaugeType?.name ?? null
};
for (let i = 0; i < columnCount; i++) {
const override = valueByCell[`${i}:${feature.id}`];
@@ -485,7 +639,7 @@ const InspectionMeasurementGrid = ({
},
{
accessorKey: "description",
- header: t`Feature`,
+ header: t`Characteristic`,
cell: ({ row }) => (
<span
className="line-clamp-2 max-w-[180px] text-xs"
@@ -504,6 +658,33 @@ const InspectionMeasurementGrid = ({
</span>
)
},
+ ...(hasFeatures
+ ? [
+ {
+ id: "gauge",
+ header: t`Gauge`,
+ cell: ({ row }) => (
+ // Negative margins cancel the cell padding so the picker's
+ // button fills the whole cell. `data-gauge-picker` lets the
+ // grid's Enter/Tab handler leave the picker's keys alone.
+ <div data-gauge-picker className="-mx-4 -my-2 h-10">
+ <InspectionGaugePicker
+ gauges={gauges}
+ characteristicLabel={row.original.label}
+ recentGaugeIds={recentGauges}
+ gaugeTypeId={row.original.gaugeTypeId}
+ gaugeTypeName={row.original.gaugeTypeName}
+ value={gaugeFor(row.original.featureId)}
+ isReadOnly={isReadOnly}
+ onChange={(gaugeId) =>
+ persistGauge(row.original.featureId, gaugeId)
+ }
+ />
+ </div>
+ )
+ } satisfies ColumnDef<FeatureGridRow>
+ ]
+ : []),
{
accessorKey: "sampleSize",
header: "n / Ac",
@@ -582,6 +763,12 @@ const InspectionMeasurementGrid = ({
featureCounts,
cellStatus,
renderPassFail,
+ hasFeatures,
+ gauges,
+ recentGauges,
+ gaugeFor,
+ isReadOnly,
+ persistGauge,
t
]);
@@ -607,7 +794,13 @@ const InspectionMeasurementGrid = ({
if (!props.row.isNumeric) {
return renderPassFail(props.row, i);
}
- return <NumberEditor {...props} />;
+ // The marker keeps the cell recognisable as a sample column while
+ // its editor is open (the display cell's marker is unmounted).
+ return (
+ <div data-sample-col={i} className="contents">
+ <NumberEditor {...props} />
+ </div>
+ );
};
}
return components;
@@ -638,6 +831,21 @@ const InspectionMeasurementGrid = ({
);
if (!cell || !gridRef.current?.contains(cell)) return;
+ // The Gauge cell: Enter opens its picker. Keep the event from the
+ // Table's own Enter navigation; a focused trigger button opens on its
+ // native Enter click, a selected cell clicks the trigger itself.
+ const gaugeTrigger = cell.querySelector<HTMLElement>(
+ "[data-gauge-picker] button"
+ );
+ if (gaugeTrigger && event.key === "Enter") {
+ event.stopPropagation();
+ if (event.target !== gaugeTrigger) {
+ event.preventDefault();
+ gaugeTrigger.click();
+ }
+ return;
+ }
+
const rowIndex = Number(cell.getAttribute("data-row"));
const currentColumn = Number(cell.getAttribute("data-column"));
@@ -655,11 +863,9 @@ const InspectionMeasurementGrid = ({
return [...columnsSet].sort((a, b) => a - b);
};
- // The cell currently being edited has its marker replaced by the editor —
- // include it explicitly.
+ // Every sample cell carries a marker, the open editor included, so a
+ // cell without one (label, spec, gauge, …) is not a sample column.
const columns = sampleColumnsForRow(rowIndex);
- if (!columns.includes(currentColumn)) columns.push(currentColumn);
- columns.sort((a, b) => a - b);
if (columns.length === 0) return;
const active = document.activeElement as HTMLElement | null;
@@ -743,7 +949,7 @@ const InspectionMeasurementGrid = ({
}
titleBadge={
<span className="min-w-0 truncate text-sm font-medium text-foreground">
- {hasFeatures ? `${t`Features`} (${rows.length})` : t`Result`}
+ {hasFeatures ? `${t`Characteristics`} (${rows.length})` : t`Result`}
</span>
}
primaryAction={primaryAction}
diff --git a/apps/erp/app/modules/quality/ui/Inspections/InspectionView.tsx b/apps/erp/app/modules/quality/ui/Inspections/InspectionView.tsx
index 1c3e4669e0..24b5e0c1d4 100644
--- a/apps/erp/app/modules/quality/ui/Inspections/InspectionView.tsx
+++ b/apps/erp/app/modules/quality/ui/Inspections/InspectionView.tsx
@@ -45,6 +45,7 @@ import { useFetcher } from "react-router";
import { Confirm } from "~/components/Modals";
import { usePermissions } from "~/hooks";
import type {
+ InspectionGauge,
InspectionMeasurement,
InspectionRow,
InspectionSample,
@@ -94,12 +95,20 @@ export type InspectionViewProps = {
samples: InspectionSample[];
features: InspectionSamplingPlan[];
measurements: InspectionMeasurement[];
+ // Active gauges, and the ones most recently recorded at this lot's work
+ // center (receipts are their own), newest first.
+ gauges: InspectionGauge[];
+ recentGaugeIds: string[];
balloons: {
id: string;
inspectionFeatureId: string;
pageNumber: number;
xCoordinate: number;
yCoordinate: number;
+ regionX: number;
+ regionY: number;
+ regionWidth: number;
+ regionHeight: number;
}[];
documentName: string | null;
pdfUrl: string | null;
@@ -124,6 +133,8 @@ const InspectionView = ({
samples,
features,
measurements,
+ gauges,
+ recentGaugeIds,
balloons,
documentName,
pdfUrl,
@@ -444,6 +455,10 @@ const InspectionView = ({
pageNumber: b.pageNumber,
xCoordinate: b.xCoordinate,
yCoordinate: b.yCoordinate,
+ regionX: b.regionX,
+ regionY: b.regionY,
+ regionWidth: b.regionWidth,
+ regionHeight: b.regionHeight,
label: labelByFeatureId.get(b.inspectionFeatureId) ?? ""
}));
}, [balloons, liveFeatures]);
@@ -599,7 +614,7 @@ const InspectionView = ({
<div
role="separator"
aria-orientation="horizontal"
- aria-label={t`Drag to resize drawing and features`}
+ aria-label={t`Drag to resize drawing and characteristics`}
aria-valuenow={Math.round(pdfPaneHeightPx)}
className={`group flex h-2 shrink-0 cursor-row-resize touch-none items-center justify-center rounded-md px-2 hover:bg-muted/80 ${
isResizingSplit ? "bg-muted" : ""
@@ -637,6 +652,8 @@ const InspectionView = ({
features={features}
samples={samples}
measurements={measurements}
+ gauges={gauges}
+ recentGaugeIds={recentGaugeIds}
maxSampleSize={maxSampleSize}
lotSize={inspection.lotSize}
lotAcceptanceNumber={inspection.acceptanceNumber}
@@ -652,8 +669,8 @@ const InspectionView = ({
aria-expanded={gridExpanded}
aria-label={
gridExpanded
- ? t`Collapse features table`
- : t`Expand features table`
+ ? t`Collapse characteristics table`
+ : t`Expand characteristics table`
}
icon={
gridExpanded ? (
@@ -684,6 +701,8 @@ const InspectionView = ({
features={features}
samples={samples}
measurements={measurements}
+ gauges={gauges}
+ recentGaugeIds={recentGaugeIds}
maxSampleSize={maxSampleSize}
lotSize={inspection.lotSize}
lotAcceptanceNumber={inspection.acceptanceNumber}
@@ -807,8 +826,8 @@ function DocumentSwitchModal({
<VStack spacing={2}>
<p className="text-sm text-muted-foreground">
<Trans>
- The lot's per-feature sampling plan will be re-resolved from the
- selected document.
+ The lot's per-characteristic sampling plan will be re-resolved
+ from the selected document.
</Trans>
</p>
<Select value={documentId} onValueChange={setDocumentId}>
diff --git a/apps/erp/app/modules/quality/ui/Inspections/RejectLotModal.tsx b/apps/erp/app/modules/quality/ui/Inspections/RejectLotModal.tsx
index efacdfb8d0..4efbf61eed 100644
--- a/apps/erp/app/modules/quality/ui/Inspections/RejectLotModal.tsx
+++ b/apps/erp/app/modules/quality/ui/Inspections/RejectLotModal.tsx
@@ -87,7 +87,7 @@ const RejectLotModal = ({
{failedFeatureSummary && failedFeatureSummary.length > 0 && (
<div className="w-full rounded-md border p-3">
<p className="mb-1 text-xs font-medium text-muted-foreground">
- <Trans>Failed features</Trans>
+ <Trans>Failed characteristics</Trans>
</p>
<ul className="flex flex-col gap-0.5">
{failedFeatureSummary.map((feature) => (
diff --git a/apps/erp/app/modules/quality/ui/Issue/IssueProperties.tsx b/apps/erp/app/modules/quality/ui/Issue/IssueProperties.tsx
index cb0c0aaf8e..ccec35e554 100644
--- a/apps/erp/app/modules/quality/ui/Issue/IssueProperties.tsx
+++ b/apps/erp/app/modules/quality/ui/Issue/IssueProperties.tsx
@@ -8,6 +8,7 @@ import {
} from "@carbon/form";
import {
Button,
+ Copy,
HStack,
Subheading,
Tooltip,
@@ -185,28 +186,13 @@ const IssueProperties = () => {
</span>
</TooltipContent>
</Tooltip>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- variant="ghost"
- aria-label={t`Copy`}
- size="sm"
- className="p-1"
- onClick={() =>
- copyToClipboard(
- routeData?.nonConformance?.nonConformanceId ?? ""
- )
- }
- >
- <LuKeySquare className="w-3 h-3" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <span>
- <Trans>Copy issue unique identifier</Trans>
- </span>
- </TooltipContent>
- </Tooltip>
+ <Copy
+ text={routeData?.nonConformance?.nonConformanceId ?? ""}
+ label={t`Copy issue unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/quality/ui/Item/ItemQualityView.tsx b/apps/erp/app/modules/quality/ui/Item/ItemQualityView.tsx
index 8165531205..77caaf116b 100644
--- a/apps/erp/app/modules/quality/ui/Item/ItemQualityView.tsx
+++ b/apps/erp/app/modules/quality/ui/Item/ItemQualityView.tsx
@@ -17,12 +17,12 @@ import { LuPlus } from "react-icons/lu";
import { Hyperlink } from "~/components";
import { Hidden, InspectionDocument, Submit } from "~/components/Form";
import { usePermissions } from "~/hooks";
-import InspectionDocumentForm from "~/modules/production/ui/InspectionDocument/InspectionDocumentForm";
import {
inspectionDocumentUsages,
itemInspectionDocumentAssignmentValidator
} from "~/modules/quality";
import type { ItemInspectionDocumentAssignment } from "~/modules/quality/types";
+import InspectionDocumentForm from "~/modules/quality/ui/InspectionDocument/InspectionDocumentForm";
import { path } from "~/utils/path";
type ItemQualityViewProps = {
diff --git a/apps/erp/app/modules/quality/ui/useQualitySubmodules.tsx b/apps/erp/app/modules/quality/ui/useQualitySubmodules.tsx
index 1a88bb4bc8..d73bbd6b52 100644
--- a/apps/erp/app/modules/quality/ui/useQualitySubmodules.tsx
+++ b/apps/erp/app/modules/quality/ui/useQualitySubmodules.tsx
@@ -1,4 +1,5 @@
import { useLingui } from "@lingui/react/macro";
+import { IoBalloonOutline } from "react-icons/io5";
import {
LuCircleGauge,
LuClipboardCheck,
@@ -70,6 +71,11 @@ export default function useQualitySubmodules() {
to: path.to.inspections,
icon: <LuClipboardCheck />,
table: "inspection"
+ },
+ {
+ name: t`Inspection Plans`,
+ to: path.to.inspectionDocuments,
+ icon: <IoBalloonOutline />
}
]
},
diff --git a/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchProperties.tsx b/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchProperties.tsx
index c8e30faf28..a6c07b54d1 100644
--- a/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchProperties.tsx
+++ b/apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchProperties.tsx
@@ -1,6 +1,7 @@
import { DateTimePicker, Hidden, Select, ValidatedForm } from "@carbon/form";
import {
Button,
+ Copy,
HStack,
Modal,
ModalBody,
@@ -153,24 +154,13 @@ const MaintenanceDispatchProperties = () => {
</span>
</TooltipContent>
</Tooltip>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- variant="ghost"
- aria-label="Copy ID"
- size="sm"
- className="p-1"
- onClick={() => copyToClipboard(routeData?.dispatch?.id ?? "")}
- >
- <LuKeySquare className="w-3 h-3" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <span>
- <Trans>Copy dispatch ID</Trans>
- </span>
- </TooltipContent>
- </Tooltip>
+ <Copy
+ text={routeData?.dispatch?.id ?? ""}
+ label={t`Copy dispatch ID`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/resources/ui/Training/TrainingProperties.tsx b/apps/erp/app/modules/resources/ui/Training/TrainingProperties.tsx
index 3de6442875..d5b2caf72a 100644
--- a/apps/erp/app/modules/resources/ui/Training/TrainingProperties.tsx
+++ b/apps/erp/app/modules/resources/ui/Training/TrainingProperties.tsx
@@ -2,6 +2,7 @@ import { Select, ValidatedForm } from "@carbon/form";
import {
Badge,
Button,
+ Copy,
HStack,
Subheading,
Tooltip,
@@ -124,24 +125,13 @@ const TrainingProperties = () => {
</span>
</TooltipContent>
</Tooltip>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- variant="ghost"
- aria-label="Copy"
- size="sm"
- className="p-1"
- onClick={() => copyToClipboard(routeData?.training?.id ?? "")}
- >
- <LuKeySquare className="w-3 h-3" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <span>
- <Trans>Copy training unique identifier</Trans>
- </span>
- </TooltipContent>
- </Tooltip>
+ <Copy
+ text={routeData?.training?.id ?? ""}
+ label={t`Copy training unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx b/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx
index 2f974c9350..6e1b304135 100644
--- a/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx
+++ b/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx
@@ -8,6 +8,7 @@ import {
CardContent,
CardHeader,
CardTitle,
+ Copy,
DropdownMenu,
DropdownMenuContent,
DropdownMenuIcon,
@@ -22,7 +23,7 @@ import {
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useCallback } from "react";
-import { LuEllipsisVertical, LuTrash } from "react-icons/lu";
+import { LuEllipsisVertical, LuKeySquare, LuTrash } from "react-icons/lu";
import { useFetcher, useParams } from "react-router";
import { z } from "zod";
import { EmployeeAvatar } from "~/components";
@@ -120,6 +121,11 @@ const CustomerHeader = () => {
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
+ <Copy
+ text={customerId}
+ label={t`Copy customer unique identifier`}
+ icon={<LuKeySquare />}
+ />
</CardTitle>
</CardHeader>
</HStack>
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteProperties.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteProperties.tsx
index 06a7b20d4a..85ef6d2956 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteProperties.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteProperties.tsx
@@ -3,6 +3,7 @@ import { getQuoteDisplayId } from "@carbon/documents/utils";
import { DatePicker, InputControlled, ValidatedForm } from "@carbon/form";
import {
Button,
+ Copy,
HStack,
IconButton,
Subheading,
@@ -14,7 +15,13 @@ import {
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useCallback, useEffect } from "react";
-import { LuCopy, LuInfo, LuLink, LuRefreshCcw } from "react-icons/lu";
+import {
+ LuCopy,
+ LuInfo,
+ LuKeySquare,
+ LuLink,
+ LuRefreshCcw
+} from "react-icons/lu";
import { useFetcher, useParams } from "react-router";
import { z } from "zod";
import { zfd } from "zod-form-data";
@@ -143,6 +150,13 @@ const QuoteProperties = () => {
<span>Copy link to Quote</span>
</TooltipContent>
</Tooltip>
+ <Copy
+ text={quoteId}
+ label={t`Copy quote unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderProperties.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderProperties.tsx
index 3defb03269..2fe93a1e76 100644
--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderProperties.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderProperties.tsx
@@ -2,6 +2,7 @@ import type { Json } from "@carbon/database";
import { DatePicker, InputControlled, ValidatedForm } from "@carbon/form";
import {
Button,
+ Copy,
HStack,
IconButton,
Subheading,
@@ -13,7 +14,13 @@ import {
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useCallback, useEffect } from "react";
-import { LuCopy, LuInfo, LuLink, LuRefreshCcw } from "react-icons/lu";
+import {
+ LuCopy,
+ LuInfo,
+ LuKeySquare,
+ LuLink,
+ LuRefreshCcw
+} from "react-icons/lu";
import { useFetcher, useParams } from "react-router";
import { z } from "zod";
import { zfd } from "zod-form-data";
@@ -146,6 +153,13 @@ const SalesOrderProperties = () => {
<span>Copy link to Sales Order</span>
</TooltipContent>
</Tooltip>
+ <Copy
+ text={orderId}
+ label={t`Copy sales order unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQProperties.tsx b/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQProperties.tsx
index fdac2ba016..6a4fa3b5ac 100644
--- a/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQProperties.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQProperties.tsx
@@ -2,6 +2,7 @@ import type { Json } from "@carbon/database";
import { DatePicker, InputControlled, ValidatedForm } from "@carbon/form";
import {
Button,
+ Copy,
HStack,
Subheading,
Tooltip,
@@ -12,7 +13,7 @@ import {
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useCallback, useEffect } from "react";
-import { LuCopy, LuLink } from "react-icons/lu";
+import { LuCopy, LuKeySquare, LuLink } from "react-icons/lu";
import { useFetcher, useParams } from "react-router";
import { z } from "zod";
import { zfd } from "zod-form-data";
@@ -131,6 +132,13 @@ const SalesRFQProperties = () => {
<span>Copy link to RFQ</span>
</TooltipContent>
</Tooltip>
+ <Copy
+ text={rfqId}
+ label={t`Copy RFQ unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/modules/sales/ui/SalesReturnOrders/SalesReturnOrderProperties.tsx b/apps/erp/app/modules/sales/ui/SalesReturnOrders/SalesReturnOrderProperties.tsx
index 4b9d9cadb4..40c21cb8bb 100644
--- a/apps/erp/app/modules/sales/ui/SalesReturnOrders/SalesReturnOrderProperties.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesReturnOrders/SalesReturnOrderProperties.tsx
@@ -9,6 +9,7 @@ import {
import {
Badge,
Button,
+ Copy,
HStack,
Modal,
ModalBody,
@@ -26,7 +27,7 @@ import {
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useCallback, useEffect, useMemo, useState } from "react";
-import { LuCopy, LuLink, LuUnlink2 } from "react-icons/lu";
+import { LuCopy, LuKeySquare, LuLink, LuUnlink2 } from "react-icons/lu";
import { RiProgress8Line } from "react-icons/ri";
import { useFetcher, useParams } from "react-router";
import { z } from "zod";
@@ -252,6 +253,13 @@ const SalesReturnOrderProperties = () => {
</span>
</TooltipContent>
</Tooltip>
+ <Copy
+ text={id}
+ label={t`Copy sales return order unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json b/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json
index b11a8ccb68..fd228c80ca 100644
--- a/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json
+++ b/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json
@@ -1,5 +1,5 @@
{
- "totalTools": 1558,
+ "totalTools": 1559,
"modules": 15,
"tools": [
{"name":"account_deleteUserAttributeValue","classification":"DESTRUCTIVE","paramCount":2,"schema":"0d38e12233b4","response":"bcde375ebd4c","injectAuth":"companyId+userId","permission":"none","paginates":false},
@@ -651,7 +651,6 @@
{"name":"production_deleteAssemblyInstructionStepTool","classification":"DESTRUCTIVE","paramCount":1,"schema":"3797626bd17e","response":"bcde375ebd4c","injectAuth":"companyId","permission":"production:delete","paginates":false},
{"name":"production_deleteAssemblyUnit","classification":"DESTRUCTIVE","paramCount":1,"schema":"3797626bd17e","response":"bcde375ebd4c","injectAuth":"companyId","permission":"production:delete","paginates":false},
{"name":"production_deleteFailureMode","classification":"DESTRUCTIVE","paramCount":1,"schema":"4a3e0384d72f","response":"bcde375ebd4c","injectAuth":"companyId","permission":"production:delete","paginates":false},
- {"name":"production_deleteInspectionDocument","classification":"DESTRUCTIVE","paramCount":1,"schema":"3797626bd17e","response":"e92dda062549","injectAuth":"companyId","permission":"production:delete","paginates":false},
{"name":"production_deleteJob","classification":"DESTRUCTIVE","paramCount":1,"schema":"4999bd4be598","response":"bcde375ebd4c","injectAuth":"companyId","permission":"production:delete","paginates":false},
{"name":"production_deleteJobMaterial","classification":"DESTRUCTIVE","paramCount":1,"schema":"9b0d4f228240","response":"bcde375ebd4c","injectAuth":"companyId","permission":"production:delete","paginates":false},
{"name":"production_deleteJobOperation","classification":"DESTRUCTIVE","paramCount":1,"schema":"6889e2589fdc","response":"bcde375ebd4c","injectAuth":"companyId","permission":"production:delete","paginates":false},
@@ -689,7 +688,6 @@
{"name":"production_getAssemblyInstructionVersions","classification":"READ","paramCount":2,"schema":"0c21424ecd86","response":"81c6e04c54bd","injectAuth":"companyId","permission":"production:view","paginates":false},
{"name":"production_getAssemblyPlanJson","classification":"READ","paramCount":1,"schema":"277f7d872d8c","response":"b4083e6fbe8b","injectAuth":"companyId","permission":"production:view","paginates":false},
{"name":"production_getAssemblyUnits","classification":"READ","paramCount":1,"schema":"277f7d872d8c","response":"7224ef8546c1","injectAuth":"companyId","permission":"production:view","paginates":false},
- {"name":"production_getBalloons","classification":"READ","paramCount":1,"schema":"c25fe011e891","response":"3fec0abbc97d","injectAuth":"companyId","permission":"production:view","paginates":false},
{"name":"production_getBatchableOperations","classification":"READ","paramCount":2,"schema":"4cebb10b56d4","response":"62622425cf9e","injectAuth":"companyId","permission":"production:view","paginates":false},
{"name":"production_getBatchableProcesses","classification":"READ","paramCount":0,"schema":"efddc7bd8bbc","response":"b0ab8957f96e","injectAuth":"companyId","permission":"production:view","paginates":false},
{"name":"production_getBatchOutputLots","classification":"READ","paramCount":1,"schema":"979f64cb9229","response":"7783e113d7a1","injectAuth":"companyId","permission":"production:view","paginates":false},
@@ -702,11 +700,6 @@
{"name":"production_getFailureModes","classification":"READ","paramCount":3,"schema":"04eded31eebb","response":"6fe6b1e0f957","injectAuth":"companyId","permission":"production:view","paginates":true},
{"name":"production_getFailureModesList","classification":"READ","paramCount":0,"schema":"efddc7bd8bbc","response":"ce08332e0ce6","injectAuth":"companyId","permission":"production:view","paginates":false},
{"name":"production_getFlattenedBomMaterials","classification":"READ","paramCount":1,"schema":"623ca47a6c74","response":"7f3fb0d1aeb3","injectAuth":"companyId","permission":"production:view","paginates":false},
- {"name":"production_getInspectionDocument","classification":"READ","paramCount":1,"schema":"3797626bd17e","response":"a82889f583de","injectAuth":"companyId","permission":"production:view","paginates":false},
- {"name":"production_getInspectionDocuments","classification":"READ","paramCount":1,"schema":"75e0e9e0be40","response":"0daf2106401c","injectAuth":"companyId","permission":"production:view","paginates":true},
- {"name":"production_getInspectionDocumentsForItem","classification":"READ","paramCount":1,"schema":"623ca47a6c74","response":"cfa5f1f7b8aa","injectAuth":"companyId","permission":"production:view","paginates":false},
- {"name":"production_getInspectionFeatures","classification":"READ","paramCount":1,"schema":"c25fe011e891","response":"1029909fcf82","injectAuth":"companyId","permission":"production:view","paginates":false},
- {"name":"production_getInspectionPlan","classification":"READ","paramCount":1,"schema":"c25fe011e891","response":"83a9b3640e41","injectAuth":"companyId","permission":"production:view","paginates":false},
{"name":"production_getJob","classification":"READ","paramCount":1,"schema":"3797626bd17e","response":"3067c24178e5","injectAuth":"companyId","permission":"production:view","paginates":false},
{"name":"production_getJobByOperationId","classification":"READ","paramCount":1,"schema":"c407a9edb930","response":"07382c86b3b8","injectAuth":"companyId","permission":"production:view","paginates":false},
{"name":"production_getJobDocuments","classification":"READ","paramCount":4,"schema":"f41144061088","response":"5483e69d7515","injectAuth":"companyId","permission":"production:view","paginates":false},
@@ -810,7 +803,6 @@
{"name":"production_releaseJobOperationBatch","classification":"WRITE","paramCount":1,"schema":"979f64cb9229","response":"none","injectAuth":"companyId+updatedBy+userId","permission":"production:update","paginates":false},
{"name":"production_replaceJobMaterialSteps","classification":"DESTRUCTIVE","paramCount":2,"schema":"876f8375508a","response":"bcde375ebd4c","injectAuth":"companyId","permission":"production:update","paginates":false},
{"name":"production_runMRP","classification":"WRITE","paramCount":2,"schema":"6e039fba26f6","response":"9e056a59d695","injectAuth":"companyId+updatedBy+userId","permission":"production:update","paginates":false},
- {"name":"production_saveInspectionDocumentAtomic","classification":"WRITE","paramCount":7,"schema":"302bbaaf5d0c","response":"none","injectAuth":"companyId+userId","permission":"production:update","paginates":false},
{"name":"production_scheduleJob","classification":"WRITE","paramCount":1,"schema":"4999bd4be598","response":"a70079765330","injectAuth":"companyId","permission":"production:update","paginates":false},
{"name":"production_setJobMaterialStepLink","classification":"DESTRUCTIVE","paramCount":4,"schema":"805d2a5ebf8e","response":"bcde375ebd4c","injectAuth":"companyId+updatedBy","permission":"production:update","paginates":false},
{"name":"production_setJobOperationToolStepLink","classification":"DESTRUCTIVE","paramCount":4,"schema":"2d14950ae331","response":"bcde375ebd4c","injectAuth":"companyId+updatedBy","permission":"production:update","paginates":false},
@@ -832,7 +824,6 @@
{"name":"production_updateAssemblyStepHiddenComponents","classification":"WRITE","paramCount":3,"schema":"3ac4e88c4df0","response":"3797626bd17e","injectAuth":"companyId+updatedBy","permission":"production:update","paginates":false},
{"name":"production_updateAssemblyStepJoin","classification":"WRITE","paramCount":3,"schema":"fe25857086d1","response":"3797626bd17e","injectAuth":"companyId+updatedBy","permission":"production:update","paginates":false},
{"name":"production_updateAssemblyStepMotion","classification":"WRITE","paramCount":3,"schema":"6665a9b53a17","response":"3797626bd17e","injectAuth":"companyId+updatedBy","permission":"production:update","paginates":false},
- {"name":"production_updateInspectionDocumentSampling","classification":"WRITE","paramCount":7,"schema":"e85058fba971","response":"bcde375ebd4c","injectAuth":"companyId+updatedBy+userId","permission":"production:update","paginates":false},
{"name":"production_updateJob","classification":"WRITE","paramCount":21,"schema":"e224c0a5aa29","response":"3797626bd17e","injectAuth":"companyId+updatedBy","permission":"production:update","paginates":false},
{"name":"production_updateJobBatchNumber","classification":"WRITE","paramCount":2,"schema":"a4c2a31bb8a6","response":"f7a40899c090","injectAuth":"companyId+updatedBy","permission":"production:update","paginates":false},
{"name":"production_updateJobMaterialOrder","classification":"WRITE","paramCount":1,"schema":"c822495a7892","response":"ce209a810cd2","injectAuth":"companyId+updatedBy","permission":"production:update","paginates":false},
@@ -855,7 +846,6 @@
{"name":"production_upsertAssemblyInstructionStepTool","classification":"WRITE","paramCount":5,"schema":"d64500fd5c94","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"production:create+update","paginates":false},
{"name":"production_upsertAssemblyUnit","classification":"WRITE","paramCount":5,"schema":"74497d782594","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"production:create+update","paginates":false},
{"name":"production_upsertFailureMode","classification":"WRITE","paramCount":3,"schema":"f47f137a8607","response":"8394fbabd845","injectAuth":"companyId+createdBy+updatedBy","permission":"production:create+update","paginates":false},
- {"name":"production_upsertInspectionDocument","classification":"WRITE","paramCount":10,"schema":"68e08a92df7a","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"production:create+update","paginates":false},
{"name":"production_upsertJob","classification":"WRITE","paramCount":2,"schema":"73f73c34c970","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"production:create+update","paginates":false},
{"name":"production_upsertJobMaterial","classification":"WRITE","paramCount":17,"schema":"55d0ec00089d","response":"af9af3838934","injectAuth":"companyId+createdBy+updatedBy","permission":"production:create+update","paginates":false},
{"name":"production_upsertJobMaterialMakeMethod","classification":"WRITE","paramCount":5,"schema":"d603e9c57b46","response":"bcde375ebd4c","injectAuth":"companyId+createdBy+updatedBy+userId","permission":"production:create+update","paginates":false},
@@ -1025,6 +1015,7 @@
{"name":"quality_deleteGauge","classification":"DESTRUCTIVE","paramCount":1,"schema":"f65da45a1155","response":"bcde375ebd4c","injectAuth":"companyId","permission":"quality:delete","paginates":false},
{"name":"quality_deleteGaugeCalibrationRecord","classification":"DESTRUCTIVE","paramCount":1,"schema":"81eca1e58f6e","response":"bcde375ebd4c","injectAuth":"companyId","permission":"quality:delete","paginates":false},
{"name":"quality_deleteGaugeType","classification":"DESTRUCTIVE","paramCount":1,"schema":"24fb90489cd4","response":"bcde375ebd4c","injectAuth":"companyId","permission":"quality:delete","paginates":false},
+ {"name":"quality_deleteInspectionDocument","classification":"DESTRUCTIVE","paramCount":1,"schema":"3797626bd17e","response":"e92dda062549","injectAuth":"companyId","permission":"quality:delete","paginates":false},
{"name":"quality_deleteIssue","classification":"DESTRUCTIVE","paramCount":1,"schema":"a78c6c21c084","response":"bcde375ebd4c","injectAuth":"companyId","permission":"quality:delete","paginates":false},
{"name":"quality_deleteIssueAssociation","classification":"DESTRUCTIVE","paramCount":2,"schema":"5e9621fb955d","response":"none","injectAuth":"companyId","permission":"quality:delete","paginates":false},
{"name":"quality_deleteIssueType","classification":"DESTRUCTIVE","paramCount":1,"schema":"bb6b04f68710","response":"bcde375ebd4c","injectAuth":"companyId","permission":"quality:delete","paginates":false},
@@ -1033,6 +1024,7 @@
{"name":"quality_deleteQualityDocumentStep","classification":"DESTRUCTIVE","paramCount":1,"schema":"6d1c301b650d","response":"bcde375ebd4c","injectAuth":"companyId","permission":"quality:delete","paginates":false},
{"name":"quality_deleteRequiredAction","classification":"DESTRUCTIVE","paramCount":1,"schema":"cca3bf9f3ebb","response":"bcde375ebd4c","injectAuth":"companyId","permission":"quality:delete","paginates":false},
{"name":"quality_deleteRisk","classification":"DESTRUCTIVE","paramCount":1,"schema":"7002f7ae1c58","response":"bcde375ebd4c","injectAuth":"companyId","permission":"quality:delete","paginates":false},
+ {"name":"quality_getBalloons","classification":"READ","paramCount":1,"schema":"c25fe011e891","response":"3fec0abbc97d","injectAuth":"companyId","permission":"quality:view","paginates":false},
{"name":"quality_getGauge","classification":"READ","paramCount":1,"schema":"f65da45a1155","response":"19d84b9bffdb","injectAuth":"companyId","permission":"quality:view","paginates":false},
{"name":"quality_getGaugeCalibrationRecord","classification":"READ","paramCount":1,"schema":"3797626bd17e","response":"90fb86d6af14","injectAuth":"companyId","permission":"quality:view","paginates":false},
{"name":"quality_getGaugeCalibrationRecords","classification":"READ","paramCount":3,"schema":"04eded31eebb","response":"7ed9f83a9f0f","injectAuth":"companyId","permission":"quality:view","paginates":true},
@@ -1043,9 +1035,15 @@
{"name":"quality_getGaugeTypes","classification":"READ","paramCount":3,"schema":"04eded31eebb","response":"95195653f3fc","injectAuth":"companyId","permission":"quality:view","paginates":true},
{"name":"quality_getGaugeTypesList","classification":"READ","paramCount":0,"schema":"efddc7bd8bbc","response":"ce08332e0ce6","injectAuth":"companyId","permission":"quality:view","paginates":false},
{"name":"quality_getInspection","classification":"READ","paramCount":1,"schema":"3797626bd17e","response":"none","injectAuth":"companyId","permission":"quality:view","paginates":false},
+ {"name":"quality_getInspectionDocument","classification":"READ","paramCount":1,"schema":"3797626bd17e","response":"a82889f583de","injectAuth":"companyId","permission":"quality:view","paginates":false},
+ {"name":"quality_getInspectionDocuments","classification":"READ","paramCount":1,"schema":"75e0e9e0be40","response":"0daf2106401c","injectAuth":"companyId","permission":"quality:view","paginates":true},
+ {"name":"quality_getInspectionDocumentsForItem","classification":"READ","paramCount":1,"schema":"623ca47a6c74","response":"cfa5f1f7b8aa","injectAuth":"companyId","permission":"quality:view","paginates":false},
+ {"name":"quality_getInspectionFeatures","classification":"READ","paramCount":1,"schema":"c25fe011e891","response":"1e8d8f002f21","injectAuth":"companyId","permission":"quality:view","paginates":false},
+ {"name":"quality_getInspectionGauges","classification":"READ","paramCount":1,"schema":"d88996520fca","response":"d5c3ebb5ddd2","injectAuth":"companyId","permission":"quality:view","paginates":false},
{"name":"quality_getInspectionMeasurements","classification":"READ","paramCount":1,"schema":"d88996520fca","response":"c6a90b70c17b","injectAuth":"companyId","permission":"quality:view","paginates":false},
+ {"name":"quality_getInspectionPlan","classification":"READ","paramCount":1,"schema":"c25fe011e891","response":"83a9b3640e41","injectAuth":"companyId","permission":"quality:view","paginates":false},
{"name":"quality_getInspections","classification":"READ","paramCount":5,"schema":"ab64e3131c2d","response":"b942685a303b","injectAuth":"companyId","permission":"quality:view","paginates":true},
- {"name":"quality_getInspectionSamplingPlans","classification":"READ","paramCount":1,"schema":"d88996520fca","response":"e8400eb0460f","injectAuth":"companyId","permission":"quality:view","paginates":false},
+ {"name":"quality_getInspectionSamplingPlans","classification":"READ","paramCount":1,"schema":"d88996520fca","response":"5b3237ad5668","injectAuth":"companyId","permission":"quality:view","paginates":false},
{"name":"quality_getInspectionTrackedEntities","classification":"READ","paramCount":1,"schema":"17337505bb69","response":"c20d7cb06756","injectAuth":"companyId","permission":"quality:view","paginates":false},
{"name":"quality_getIssue","classification":"READ","paramCount":1,"schema":"a78c6c21c084","response":"1a2ca8014c88","injectAuth":"companyId","permission":"quality:view","paginates":false},
{"name":"quality_getIssueActionTasks","classification":"READ","paramCount":2,"schema":"989a1bef3af7","response":"0f3a25ff459d","injectAuth":"companyId","permission":"quality:view","paginates":false},
@@ -1081,7 +1079,9 @@
{"name":"quality_insertGauge","classification":"WRITE","paramCount":15,"schema":"f067ee95ad2f","response":"3269d4609ad2","injectAuth":"companyId+createdBy+updatedBy","permission":"quality:create","paginates":false},
{"name":"quality_insertIssue","classification":"WRITE","paramCount":20,"schema":"308033845426","response":"bf12cbd0f560","injectAuth":"companyId+createdBy+updatedBy","permission":"quality:create","paginates":false},
{"name":"quality_insertIssueReviewer","classification":"WRITE","paramCount":2,"schema":"fdfb09172931","response":"bcde375ebd4c","injectAuth":"companyId+createdBy+updatedBy","permission":"quality:create","paginates":false},
+ {"name":"quality_saveInspectionDocumentAtomic","classification":"WRITE","paramCount":7,"schema":"302bbaaf5d0c","response":"none","injectAuth":"companyId+userId","permission":"quality:update","paginates":false},
{"name":"quality_updateGauge","classification":"WRITE","paramCount":16,"schema":"d62e872469a5","response":"3797626bd17e","injectAuth":"companyId+updatedBy","permission":"quality:update","paginates":false},
+ {"name":"quality_updateInspectionDocumentSampling","classification":"WRITE","paramCount":7,"schema":"e85058fba971","response":"bcde375ebd4c","injectAuth":"companyId+updatedBy+userId","permission":"quality:update","paginates":false},
{"name":"quality_updateIssue","classification":"WRITE","paramCount":16,"schema":"93bb71a6bcdc","response":"3797626bd17e","injectAuth":"companyId+updatedBy","permission":"quality:update","paginates":false},
{"name":"quality_updateIssueActionProcesses","classification":"DESTRUCTIVE","paramCount":2,"schema":"9dbd38e74ee8","response":"bcde375ebd4c","injectAuth":"companyId+updatedBy","permission":"quality:update","paginates":false},
{"name":"quality_updateIssueStatus","classification":"WRITE","paramCount":4,"schema":"57b4fe5217e7","response":"bcde375ebd4c","injectAuth":"companyId+updatedBy","permission":"quality:update","paginates":false},
@@ -1092,6 +1092,7 @@
{"name":"quality_upsertGauge","classification":"WRITE","paramCount":16,"schema":"6969c2f67b33","response":"3ec91e2c9200","injectAuth":"companyId+createdBy+updatedBy","permission":"quality:create+update","paginates":false},
{"name":"quality_upsertGaugeCalibrationRecord","classification":"WRITE","paramCount":15,"schema":"80febac2c711","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"quality:create+update","paginates":false},
{"name":"quality_upsertGaugeType","classification":"WRITE","paramCount":3,"schema":"f47f137a8607","response":"8394fbabd845","injectAuth":"companyId+createdBy+updatedBy","permission":"quality:create+update","paginates":false},
+ {"name":"quality_upsertInspectionDocument","classification":"WRITE","paramCount":10,"schema":"68e08a92df7a","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"quality:create+update","paginates":false},
{"name":"quality_upsertIssue","classification":"WRITE","paramCount":21,"schema":"5a6a8f4280d9","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"quality:create+update","paginates":false},
{"name":"quality_upsertIssueType","classification":"WRITE","paramCount":3,"schema":"f47f137a8607","response":"8394fbabd845","injectAuth":"companyId+createdBy+updatedBy","permission":"quality:create+update","paginates":false},
{"name":"quality_upsertIssueWorkflow","classification":"WRITE","paramCount":7,"schema":"ed37ccdc2f7a","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"quality:create+update","paginates":false},
diff --git a/apps/erp/app/routes/api+/production.inspection-document.$inspectionDocumentId.balloon-analyze.ts b/apps/erp/app/routes/api+/quality.inspection-document.$inspectionDocumentId.balloon-analyze.ts
similarity index 92%
rename from apps/erp/app/routes/api+/production.inspection-document.$inspectionDocumentId.balloon-analyze.ts
rename to apps/erp/app/routes/api+/quality.inspection-document.$inspectionDocumentId.balloon-analyze.ts
index aa24453721..363ad7078b 100644
--- a/apps/erp/app/routes/api+/production.inspection-document.$inspectionDocumentId.balloon-analyze.ts
+++ b/apps/erp/app/routes/api+/quality.inspection-document.$inspectionDocumentId.balloon-analyze.ts
@@ -2,12 +2,12 @@ import { assertIsPost } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
import type { ActionFunctionArgs } from "react-router";
import { data } from "react-router";
-import { balloonRegionAnalysisRequestSchema } from "~/modules/production/inspectionBalloonAnalyze";
+import { balloonRegionAnalysisRequestSchema } from "~/modules/quality/quality.models";
import {
INSPECTION_BALLOON_ANALYZE_MAX_IMAGE_BYTES,
runInspectionBalloonRegionVisionAnalysis
-} from "~/modules/production/inspectionBalloonAnalyze.server";
-import { getInspectionDocument } from "~/modules/production/production.service";
+} from "~/modules/quality/quality.server";
+import { getInspectionDocument } from "~/modules/quality/quality.service";
function getErrorMessage(error: unknown, fallback: string) {
if (error instanceof Error) return error.message;
diff --git a/apps/erp/app/routes/api+/production.inspection-documents.$itemId.ts b/apps/erp/app/routes/api+/quality.inspection-documents.$itemId.ts
similarity index 92%
rename from apps/erp/app/routes/api+/production.inspection-documents.$itemId.ts
rename to apps/erp/app/routes/api+/quality.inspection-documents.$itemId.ts
index a445f2fd40..f28bba479d 100644
--- a/apps/erp/app/routes/api+/production.inspection-documents.$itemId.ts
+++ b/apps/erp/app/routes/api+/quality.inspection-documents.$itemId.ts
@@ -4,12 +4,12 @@ import type {
LoaderFunctionArgs
} from "react-router";
import { data } from "react-router";
-import { getInspectionDocumentsForItem } from "~/modules/production";
+import { getInspectionDocumentsForItem } from "~/modules/quality";
import { getCompanyId, inspectionDocumentsQuery } from "~/utils/react-query";
export async function loader({ request, params }: LoaderFunctionArgs) {
const { client, companyId } = await requirePermissions(request, {
- view: "production"
+ view: "quality"
});
const { itemId } = params;
diff --git a/apps/erp/app/routes/api+/quality.inspection-plan.$id.ts b/apps/erp/app/routes/api+/quality.inspection-plan.$id.ts
index d371de2be9..f80a41ab25 100644
--- a/apps/erp/app/routes/api+/quality.inspection-plan.$id.ts
+++ b/apps/erp/app/routes/api+/quality.inspection-plan.$id.ts
@@ -1,7 +1,7 @@
import { requirePermissions } from "@carbon/auth/auth.server";
import type { LoaderFunctionArgs } from "react-router";
import { data } from "react-router";
-import { getInspectionDocument, getInspectionPlan } from "~/modules/production";
+import { getInspectionDocument, getInspectionPlan } from "~/modules/quality";
function getErrorMessage(error: unknown, fallback: string) {
if (error instanceof Error) return error.message;
diff --git a/apps/erp/app/routes/api+/v1+/lib/dispatch-parity.test.ts b/apps/erp/app/routes/api+/v1+/lib/dispatch-parity.test.ts
index 3031e97f39..c5c6b5cbf9 100644
--- a/apps/erp/app/routes/api+/v1+/lib/dispatch-parity.test.ts
+++ b/apps/erp/app/routes/api+/v1+/lib/dispatch-parity.test.ts
@@ -21,6 +21,7 @@ const spies = vi.hoisted(() => ({
upsertNotificationPreference: vi.fn(),
insertJob: vi.fn(),
insertIssue: vi.fn(),
+ getInspectionDocument: vi.fn(),
insertPurchaseOrder: vi.fn(),
insertSalesOrder: vi.fn(),
replaceInvoiceSettlements: vi.fn(),
@@ -61,7 +62,8 @@ vi.mock("~/modules/purchasing/purchasing.service", () => ({
insertPurchaseOrder: spies.insertPurchaseOrder
}));
vi.mock("~/modules/quality/quality.service", () => ({
- insertIssue: spies.insertIssue
+ insertIssue: spies.insertIssue,
+ getInspectionDocument: spies.getInspectionDocument
}));
vi.mock("~/modules/resources/resources.service", () => ({}));
vi.mock("~/modules/sales/sales.service", () => ({
@@ -91,6 +93,8 @@ vi.mock("@carbon/logger", () => ({
})
}));
+import { CarbonJsonSchemaConverter } from "@carbon/api/schema";
+import { OpenAPIGenerator } from "@orpc/openapi";
import { MCP_BLOCKED_TOOL_NAMES } from "../../mcp+/lib/mcp-blocked-tools";
import type { AuthedContext } from "./base.server";
import { callOperation } from "./call.server";
@@ -100,7 +104,15 @@ import {
dispatchOperation,
enrichWithAuthContext
} from "./dispatch.server";
-import { operationsByName } from "./operations.server";
+import { openApiHandler } from "./handler.server";
+import {
+ liveOperationAliases,
+ OPERATION_ALIASES,
+ OPERATIONS,
+ operationsByName
+} from "./operations.server";
+import { router } from "./router.server";
+import { specOptions } from "./spec-options.server";
const ctx: AuthedContext = {
client: spies.FAKE_CLIENT as unknown as AuthedContext["client"],
@@ -152,6 +164,7 @@ const allSpies = [
spies.upsertNotificationPreference,
spies.insertJob,
spies.insertIssue,
+ spies.getInspectionDocument,
spies.insertPurchaseOrder,
spies.insertSalesOrder,
spies.replaceInvoiceSettlements,
@@ -893,3 +906,96 @@ describe("blocked tools (D5)", () => {
});
});
});
+
+describe("renamed operations (deprecated aliases)", () => {
+ const OLD = "production_getInspectionDocument";
+
+ it("every alias names a published operation and shadows none", () => {
+ const published = new Set(OPERATIONS.map((op) => op.name));
+ for (const [alias, target] of Object.entries(OPERATION_ALIASES)) {
+ expect(published.has(target), `${alias} → ${target} is missing`).toBe(
+ true
+ );
+ expect(published.has(alias), `${alias} is a real operation`).toBe(false);
+ }
+ expect(liveOperationAliases).toHaveLength(
+ Object.keys(OPERATION_ALIASES).length
+ );
+ });
+
+ it("resolves an old name to its replacement's entry", () => {
+ expect(operationsByName.get(OLD)?.name).toBe(
+ "quality_getInspectionDocument"
+ );
+ });
+
+ it("callOperation runs the replacement under the OLD name", async () => {
+ spies.getInspectionDocument.mockResolvedValue({
+ data: { id: "isp_1" },
+ error: null
+ });
+ const result = await callOperation(OLD, ctx, { id: "isp_1" });
+ expect(result).toEqual({ success: true, data: { id: "isp_1" } });
+ expect(spies.getInspectionDocument).toHaveBeenCalledWith(
+ spies.FAKE_CLIENT,
+ "isp_1",
+ "c1"
+ );
+ });
+
+ it("gates an API-key caller on the NEW permission, not the old one", async () => {
+ const productionOnly = await callOperation(
+ OLD,
+ { ...ctx, authKind: "api-key", scopes: { production_view: ["c1"] } },
+ { id: "isp_1" }
+ );
+ expect(productionOnly).toEqual({
+ success: false,
+ errorKind: "execution",
+ error: "API key lacks the required scope: quality_view"
+ });
+ expect(spies.getInspectionDocument).not.toHaveBeenCalled();
+
+ const quality = await callOperation(
+ OLD,
+ { ...ctx, authKind: "api-key", scopes: { quality_view: ["c1"] } },
+ { id: "isp_1" }
+ );
+ expect(quality.success).toBe(true);
+ });
+
+ it("serves the old HTTP path through the replacement", async () => {
+ spies.getInspectionDocument.mockResolvedValue({
+ data: { id: "isp_1" },
+ error: null
+ });
+ const { matched, response } = await openApiHandler.handle(
+ new Request("http://localhost/api/v1/production/getInspectionDocument", {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({ id: "isp_1" })
+ }),
+ { prefix: "/api/v1", context: ctx }
+ );
+ expect(matched).toBe(true);
+ expect(response?.status).toBe(200);
+ expect(await response?.json()).toEqual({ id: "isp_1" });
+ expect(spies.getInspectionDocument).toHaveBeenCalledWith(
+ spies.FAKE_CLIENT,
+ "isp_1",
+ "c1"
+ );
+ });
+
+ it("publishes the old path in the spec, marked deprecated", async () => {
+ const spec = await new OpenAPIGenerator({
+ schemaConverters: [new CarbonJsonSchemaConverter()]
+ }).generate(router, specOptions());
+ const post = (path: string) =>
+ (spec.paths?.[path] as { post?: { deprecated?: boolean } } | undefined)
+ ?.post;
+ expect(post("/production/getInspectionDocument")?.deprecated).toBe(true);
+ // Undefined, so the serialized spec of every real operation is unchanged.
+ expect(post("/quality/getInspectionDocument")?.deprecated).toBeUndefined();
+ });
+});
diff --git a/apps/erp/app/routes/api+/v1+/lib/operations.server.ts b/apps/erp/app/routes/api+/v1+/lib/operations.server.ts
index fa8d867200..64a57993f7 100644
--- a/apps/erp/app/routes/api+/v1+/lib/operations.server.ts
+++ b/apps/erp/app/routes/api+/v1+/lib/operations.server.ts
@@ -10,11 +10,56 @@ import raw from "../../mcp+/lib/tool-metadata.json";
export const OPERATIONS = (raw as { tools: ManifestEntry[] }).tools;
-/** operation name (`module_func`) → entry. */
-export const operationsByName = new Map<string, ManifestEntry>(
+/**
+ * Deprecated operation names → the operation that replaced them. An operation's
+ * name is derived from the module its service lives in, so moving a function
+ * between modules renames the published operation; an entry here keeps the old
+ * name working for MCP `call_tool`/`describe_tool`, the agent, workflows and
+ * `POST /api/v1/{module}/{operation}`. The alias runs the NEW operation in full —
+ * its schema, its dispatch and its permission — so it grants nothing the new name
+ * does not. Aliases are never listed in the catalog (search, docs); the OpenAPI
+ * spec carries them marked `deprecated`.
+ */
+export const OPERATION_ALIASES: Readonly<Record<string, string>> = {
+ // Inspection plans moved from production to quality.
+ production_getInspectionDocument: "quality_getInspectionDocument",
+ production_getInspectionDocuments: "quality_getInspectionDocuments",
+ production_getInspectionDocumentsForItem:
+ "quality_getInspectionDocumentsForItem",
+ production_getInspectionFeatures: "quality_getInspectionFeatures",
+ production_getBalloons: "quality_getBalloons",
+ production_getInspectionPlan: "quality_getInspectionPlan",
+ production_saveInspectionDocumentAtomic:
+ "quality_saveInspectionDocumentAtomic",
+ production_updateInspectionDocumentSampling:
+ "quality_updateInspectionDocumentSampling",
+ production_upsertInspectionDocument: "quality_upsertInspectionDocument",
+ production_deleteInspectionDocument: "quality_deleteInspectionDocument"
+};
+
+const canonicalByName = new Map<string, ManifestEntry>(
OPERATIONS.map((op) => [op.name, op])
);
+/** The aliases that resolve: a real operation of the same name always wins, and
+ * an alias whose target is gone is dropped (dispatch-parity.test.ts fails on
+ * both, so neither ships). */
+export const liveOperationAliases: ReadonlyArray<[string, ManifestEntry]> =
+ Object.entries(OPERATION_ALIASES).flatMap(([alias, target]) => {
+ const op = canonicalByName.get(target);
+ return op && !canonicalByName.has(alias)
+ ? [[alias, op] as [string, ManifestEntry]]
+ : [];
+ });
+
+/** operation name (`module_func`) → entry, deprecated aliases included (an alias
+ * maps to its replacement's entry, so `entry.name` is the CURRENT name). A lookup
+ * table only — iterate `OPERATIONS` for the catalog. */
+export const operationsByName = new Map<string, ManifestEntry>([
+ ...canonicalByName,
+ ...liveOperationAliases
+]);
+
/** The bare operation id (the name without its `module_` prefix). */
export function operationId(op: ManifestEntry): string {
return op.name.slice(op.module.length + 1);
diff --git a/apps/erp/app/routes/api+/v1+/lib/router.server.ts b/apps/erp/app/routes/api+/v1+/lib/router.server.ts
index 458aebf69e..498608a3a3 100644
--- a/apps/erp/app/routes/api+/v1+/lib/router.server.ts
+++ b/apps/erp/app/routes/api+/v1+/lib/router.server.ts
@@ -7,6 +7,7 @@ import { jsonSchema, jsonSchemaInput } from "@carbon/api/schema";
import { base, gate, mapThrownErrors } from "./base.server";
import { dispatchOperation } from "./dispatch.server";
import {
+ liveOperationAliases,
OPERATIONS,
operationId,
outputSchema,
@@ -23,7 +24,15 @@ const RESERVED_KEYS = new Set([
"toJSON"
]);
-function buildProcedure(meta: ManifestEntry, id: string) {
+// `module`/`id` name the route; `meta` is the operation it runs. They differ only
+// for a deprecated alias, which keeps its old path but runs (and is gated as) its
+// replacement.
+function buildProcedure(
+ meta: ManifestEntry,
+ module: string,
+ id: string,
+ deprecated = false
+) {
return (
base
// Outside the gate so it also covers anything the gate itself throws
@@ -32,9 +41,13 @@ function buildProcedure(meta: ManifestEntry, id: string) {
.use(gate(meta))
.route({
method: "POST",
- path: `/${meta.module}/${id}`,
- tags: [meta.module],
- summary: meta.description
+ path: `/${module}/${id}`,
+ tags: [module],
+ summary: deprecated
+ ? `${meta.description} (deprecated: use /${meta.module}/${operationId(meta)})`
+ : meta.description,
+ // Only when set — `deprecated: false` would land on every operation.
+ ...(deprecated ? { deprecated: true } : {})
})
// Input validates; output does NOT — shapeHttpBody rewrites the body, so a
// correct response does not match the declared response schema.
@@ -56,14 +69,27 @@ export const router: Record<
string,
Record<string, ReturnType<typeof buildProcedure>>
> = {};
- for (const meta of OPERATIONS) {
- const id = operationId(meta);
- if (RESERVED_KEYS.has(id) || RESERVED_KEYS.has(meta.module)) {
+ const add = (
+ module: string,
+ id: string,
+ meta: ManifestEntry,
+ deprecated: boolean
+ ) => {
+ if (RESERVED_KEYS.has(id) || RESERVED_KEYS.has(module)) {
throw new Error(
- `Carbon API operation "${meta.name}" collides with a reserved oRPC router key.`
+ `Carbon API operation "${module}_${id}" collides with a reserved oRPC router key.`
);
}
- (out[meta.module] ??= {})[id] = buildProcedure(meta, id);
+ (out[module] ??= {})[id] = buildProcedure(meta, module, id, deprecated);
+ };
+ for (const meta of OPERATIONS) {
+ add(meta.module, operationId(meta), meta, false);
+ }
+ // Aliases are `<module>_<operation>` like every operation name; module names
+ // carry no underscore, so the first one splits it.
+ for (const [alias, meta] of liveOperationAliases) {
+ const split = alias.indexOf("_");
+ add(alias.slice(0, split), alias.slice(split + 1), meta, true);
}
return out;
})();
diff --git a/apps/erp/app/routes/x+/consumable+/$itemId.quality.tsx b/apps/erp/app/routes/x+/consumable+/$itemId.quality.tsx
index 0191c18577..ab68956c1d 100644
--- a/apps/erp/app/routes/x+/consumable+/$itemId.quality.tsx
+++ b/apps/erp/app/routes/x+/consumable+/$itemId.quality.tsx
@@ -5,8 +5,8 @@ import { validationError, validator } from "@carbon/form";
import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";
import { data, redirect, useLoaderData, useParams } from "react-router";
import invariant from "tiny-invariant";
-import { getInspectionDocumentsForItem } from "~/modules/production";
import {
+ getInspectionDocumentsForItem,
getItemInspectionDocumentAssignments,
itemInspectionDocumentAssignmentValidator,
upsertItemInspectionDocumentAssignment
diff --git a/apps/erp/app/routes/x+/inspection+/$id.gauge.tsx b/apps/erp/app/routes/x+/inspection+/$id.gauge.tsx
new file mode 100644
index 0000000000..2942207e39
--- /dev/null
+++ b/apps/erp/app/routes/x+/inspection+/$id.gauge.tsx
@@ -0,0 +1,50 @@
+import { assertIsPost, error } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { flash } from "@carbon/auth/session.server";
+import { validationError, validator } from "@carbon/form";
+import type { ActionFunctionArgs } from "react-router";
+import { data } from "react-router";
+import invariant from "tiny-invariant";
+import { inspectionGaugeValidator } from "~/modules/quality";
+import { recordInspectionGauge } from "~/modules/quality/quality.server";
+
+export async function action({ request, params }: ActionFunctionArgs) {
+ assertIsPost(request);
+ const { companyId, userId } = await requirePermissions(request, {
+ update: "quality",
+ role: "employee"
+ });
+ const { id } = params;
+ invariant(id, "id is required");
+
+ const formData = await request.formData();
+ const validation = await validator(inspectionGaugeValidator).validate(
+ formData
+ );
+ if (validation.error) return validationError(validation.error);
+
+ if (validation.data.inspectionId !== id) {
+ return data(
+ { error: { message: "Inspection id mismatch" } },
+ await flash(request, error(null, "Inspection id mismatch"))
+ );
+ }
+
+ const result = await recordInspectionGauge({
+ inspectionId: id,
+ inspectionFeatureId: validation.data.inspectionFeatureId,
+ gaugeId: validation.data.gaugeId || null,
+ companyId,
+ userId
+ });
+
+ if (result.error) {
+ return data(
+ { error: result.error },
+ await flash(request, error(result.error, "Failed to record gauge"))
+ );
+ }
+
+ // Quiet like the per-cell measurement saves — the grid updates itself.
+ return data(result);
+}
diff --git a/apps/erp/app/routes/x+/inspection+/$id.tsx b/apps/erp/app/routes/x+/inspection+/$id.tsx
index 0793388eb3..997c60c63a 100644
--- a/apps/erp/app/routes/x+/inspection+/$id.tsx
+++ b/apps/erp/app/routes/x+/inspection+/$id.tsx
@@ -6,16 +6,22 @@ import { msg } from "@lingui/core/macro";
import type { LoaderFunctionArgs } from "react-router";
import { data, redirect, useLoaderData } from "react-router";
import invariant from "tiny-invariant";
-import { getBalloons, getInspectionDocument } from "~/modules/production";
import {
+ getBalloons,
getInspection,
+ getInspectionDocument,
+ getInspectionGauges,
getInspectionMeasurements,
getInspectionSamplingPlans,
getInspectionTrackedEntities,
getIssueTypesList
} from "~/modules/quality";
-import { reconcileInspectionSamplingPlans } from "~/modules/quality/quality.server";
+import {
+ getRecentInspectionGauges,
+ reconcileInspectionSamplingPlans
+} from "~/modules/quality/quality.server";
import type {
+ InspectionGauge,
InspectionMeasurement,
InspectionRow,
InspectionSample,
@@ -80,37 +86,43 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const isReceiptSource = insp.sourceDocument === "Receipt";
const serviceRole = getCarbonServiceRole();
- const [features, measurements, lotEntities, document, balloons, receipt] =
- await Promise.all([
- getInspectionSamplingPlans(client, id, companyId),
- getInspectionMeasurements(client, id, companyId),
- isReceiptSource && insp.sourceDocumentLineId
- ? getInspectionTrackedEntities(
- client,
- insp.sourceDocumentLineId,
- companyId
- )
- : Promise.resolve({ data: null, error: null }),
- insp.inspectionDocumentId
- ? getInspectionDocument(
- serviceRole,
- insp.inspectionDocumentId,
- companyId
- )
- : Promise.resolve({ data: null, error: null }),
- insp.inspectionDocumentId
- ? getBalloons(serviceRole, insp.inspectionDocumentId)
- : Promise.resolve({ data: null, error: null }),
- // Four-eyes: the receiver is the receipt's creator (no FK on the generic
- // source id, so this is a separate lookup).
- isReceiptSource
- ? client
- .from("receipt")
- .select("createdBy")
- .eq("id", insp.sourceDocumentId)
- .maybeSingle()
- : Promise.resolve({ data: null, error: null })
- ]);
+ const [
+ features,
+ measurements,
+ gauges,
+ recentGauges,
+ lotEntities,
+ document,
+ balloons,
+ receipt
+ ] = await Promise.all([
+ getInspectionSamplingPlans(client, id, companyId),
+ getInspectionMeasurements(client, id, companyId),
+ getInspectionGauges(client, companyId, id),
+ getRecentInspectionGauges({ inspectionId: id, companyId }),
+ isReceiptSource && insp.sourceDocumentLineId
+ ? getInspectionTrackedEntities(
+ client,
+ insp.sourceDocumentLineId,
+ companyId
+ )
+ : Promise.resolve({ data: null, error: null }),
+ insp.inspectionDocumentId
+ ? getInspectionDocument(serviceRole, insp.inspectionDocumentId, companyId)
+ : Promise.resolve({ data: null, error: null }),
+ insp.inspectionDocumentId
+ ? getBalloons(serviceRole, insp.inspectionDocumentId)
+ : Promise.resolve({ data: null, error: null }),
+ // Four-eyes: the receiver is the receipt's creator (no FK on the generic
+ // source id, so this is a separate lookup).
+ isReceiptSource
+ ? client
+ .from("receipt")
+ .select("createdBy")
+ .eq("id", insp.sourceDocumentId)
+ .maybeSingle()
+ : Promise.resolve({ data: null, error: null })
+ ]);
const doc = document.data as {
name?: string | null;
@@ -127,12 +139,18 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
samples: insp.inspectionSample ?? [],
features: (features.data ?? []) as InspectionSamplingPlan[],
measurements: (measurements.data ?? []) as InspectionMeasurement[],
+ gauges: (gauges.data ?? []) as InspectionGauge[],
+ recentGaugeIds: recentGauges.data ?? [],
balloons: ((balloons.data ?? []) as any[]).map((b) => ({
id: b.id as string,
inspectionFeatureId: b.inspectionFeatureId as string,
pageNumber: Number(b.pageNumber ?? 1),
xCoordinate: Number(b.xCoordinate ?? 0),
- yCoordinate: Number(b.yCoordinate ?? 0)
+ yCoordinate: Number(b.yCoordinate ?? 0),
+ regionX: Number(b.regionX ?? 0),
+ regionY: Number(b.regionY ?? 0),
+ regionWidth: Number(b.regionWidth ?? 0),
+ regionHeight: Number(b.regionHeight ?? 0)
})),
documentName: doc?.name ?? null,
pdfUrl: doc?.content?.pdfUrl ?? null,
@@ -158,6 +176,8 @@ export default function InspectionExecutionRoute() {
samples={loaderData.samples as InspectionSample[]}
features={loaderData.features as InspectionSamplingPlan[]}
measurements={loaderData.measurements as InspectionMeasurement[]}
+ gauges={loaderData.gauges as InspectionGauge[]}
+ recentGaugeIds={loaderData.recentGaugeIds}
balloons={loaderData.balloons}
documentName={loaderData.documentName}
pdfUrl={loaderData.pdfUrl}
diff --git a/apps/erp/app/routes/x+/inspection-document+/$id.delete.tsx b/apps/erp/app/routes/x+/inspection-document+/$id.delete.tsx
index f734769ceb..539ba16341 100644
--- a/apps/erp/app/routes/x+/inspection-document+/$id.delete.tsx
+++ b/apps/erp/app/routes/x+/inspection-document+/$id.delete.tsx
@@ -8,7 +8,7 @@ import type {
ClientActionFunctionArgs
} from "react-router";
import { redirect } from "react-router";
-import { deleteInspectionDocument } from "~/modules/production";
+import { deleteInspectionDocument } from "~/modules/quality";
import { path } from "~/utils/path";
import { invalidateInspectionDocuments } from "~/utils/react-query";
diff --git a/apps/erp/app/routes/x+/inspection-document+/$id.save.tsx b/apps/erp/app/routes/x+/inspection-document+/$id.save.tsx
index 405debe9e9..3905ff18e3 100644
--- a/apps/erp/app/routes/x+/inspection-document+/$id.save.tsx
+++ b/apps/erp/app/routes/x+/inspection-document+/$id.save.tsx
@@ -8,7 +8,14 @@ import { data } from "react-router";
import {
saveInspectionDocumentAtomic,
updateInspectionDocumentSampling
-} from "~/modules/production";
+} from "~/modules/quality";
+import {
+ inspectionDocumentSamplingValidator,
+ inspectionSaveAnchorsPayloadValidator,
+ inspectionSaveBalloonsGeometryPayloadValidator,
+ inspectionSaveBalloonsPayloadValidator,
+ inspectionSaveFeaturesPayloadValidator
+} from "~/modules/quality/quality.models";
import {
type InspectionSaveBalloonsGeometryPayload,
type InspectionSaveFeaturesPayload,
@@ -16,14 +23,7 @@ import {
mergeInspectionFeaturesPayload,
resolveInspectionFeaturePayloadIds,
translateLegacyInspectionSavePayload
-} from "~/modules/production/inspectionDocumentSave.server";
-import {
- inspectionDocumentSamplingValidator,
- inspectionSaveAnchorsPayloadValidator,
- inspectionSaveBalloonsGeometryPayloadValidator,
- inspectionSaveBalloonsPayloadValidator,
- inspectionSaveFeaturesPayloadValidator
-} from "~/modules/production/production.models";
+} from "~/modules/quality/quality.server";
import { invalidateInspectionDocuments } from "~/utils/react-query";
function getErrorMessage(error: unknown, fallback: string) {
@@ -181,36 +181,14 @@ export async function action({ request, params }: ActionFunctionArgs) {
featuresParsed = await resolveInspectionFeaturePayloadIds(
client,
id,
+ companyId,
featuresParsed
);
- const rpcResult = await saveInspectionDocumentAtomic(client, {
- inspectionDocumentId: id,
- companyId,
- userId,
- pdfUrl: pdfUrl ?? undefined,
- pageCount,
- defaultPageWidth,
- defaultPageHeight,
- features: featuresParsed,
- balloons: balloonsParsed
- });
-
- if (rpcResult.error || !rpcResult.data) {
- return data(
- {
- success: false,
- message: getErrorMessage(
- rpcResult.error,
- "Failed to save inspection plan"
- )
- },
- { status: 400 }
- );
- }
-
// The document's default sampling rule rides the same save (a single
- // UPDATE; not part of the features/balloons atomic contract).
+ // UPDATE; not part of the features/balloons atomic contract). It goes
+ // first: a failure after the RPC had committed new features would leave
+ // the editor holding their temp ids, and its retry would create them twice.
if (samplingDefaultRaw) {
try {
const json = JSON.parse(samplingDefaultRaw) as unknown;
@@ -238,6 +216,31 @@ export async function action({ request, params }: ActionFunctionArgs) {
}
}
+ const rpcResult = await saveInspectionDocumentAtomic(client, {
+ inspectionDocumentId: id,
+ companyId,
+ userId,
+ pdfUrl: pdfUrl ?? undefined,
+ pageCount,
+ defaultPageWidth,
+ defaultPageHeight,
+ features: featuresParsed,
+ balloons: balloonsParsed
+ });
+
+ if (rpcResult.error || !rpcResult.data) {
+ return data(
+ {
+ success: false,
+ message: getErrorMessage(
+ rpcResult.error,
+ "Failed to save inspection plan"
+ )
+ },
+ { status: 400 }
+ );
+ }
+
return rpcResult.data as {
success: boolean;
featureIdMap: Record<string, string>;
diff --git a/apps/erp/app/routes/x+/inspection-document+/$id.tsx b/apps/erp/app/routes/x+/inspection-document+/$id.tsx
index 4a4689cf44..7b1fe9ce4a 100644
--- a/apps/erp/app/routes/x+/inspection-document+/$id.tsx
+++ b/apps/erp/app/routes/x+/inspection-document+/$id.tsx
@@ -5,39 +5,49 @@ import { flash } from "@carbon/auth/session.server";
import { ClientOnly, Spinner } from "@carbon/react";
import { msg } from "@lingui/core/macro";
import { lazy, Suspense } from "react";
-import type { LoaderFunctionArgs } from "react-router";
+import type {
+ LoaderFunctionArgs,
+ ShouldRevalidateFunction
+} from "react-router";
import { redirect, useLoaderData } from "react-router";
import { getUnitOfMeasuresList } from "~/modules/items/items.service";
import {
getBalloons,
+ getGaugeTypesList,
getInspectionDocument,
getInspectionFeatures
-} from "~/modules/production";
-import type { InspectionDocumentContent } from "~/modules/production/types";
-import type { SamplingRule } from "~/modules/production/ui/InspectionDocument/SamplingRuleModal";
+} from "~/modules/quality";
+import type { InspectionDocumentContent } from "~/modules/quality/types";
+import type { SamplingRule } from "~/modules/quality/ui/InspectionDocument/SamplingRuleModal";
import { getCompanySettings } from "~/modules/settings";
import type { BreadcrumbSegment, Handle } from "~/utils/handle";
import { path } from "~/utils/path";
const InspectionDocumentEditor = lazy(
() =>
- import(
- "~/modules/production/ui/InspectionDocument/InspectionDocumentEditor"
- )
+ import("~/modules/quality/ui/InspectionDocument/InspectionDocumentEditor")
);
export const handle: Handle = {
breadcrumb: (_params: unknown, data: any): BreadcrumbSegment[] => {
const segments: BreadcrumbSegment[] = [
- { breadcrumb: msg`Production`, to: path.to.production },
+ { breadcrumb: msg`Quality`, to: path.to.quality },
{ breadcrumb: msg`Inspection Plans`, to: path.to.inspectionDocuments }
];
const name = data?.diagram?.name;
return name ? [...segments, { breadcrumb: name }] : segments;
},
- module: "production"
+ module: "quality"
};
+// The editor saves itself, and each save's response already carries the
+// saved rows — reloading the plan after every edit would only slow the next
+// save down.
+export const shouldRevalidate: ShouldRevalidateFunction = ({
+ formAction,
+ defaultShouldRevalidate
+}) => (formAction?.endsWith("/save") ? false : defaultShouldRevalidate);
+
export async function loader({ request, params }: LoaderFunctionArgs) {
const { client, companyId } = await requirePermissions(request, {
view: "quality"
@@ -52,12 +62,14 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
featuresResult,
balloonsResult,
unitOfMeasuresResult,
+ gaugeTypesResult,
companySettings
] = await Promise.all([
getInspectionDocument(serviceRole, id, companyId),
getInspectionFeatures(serviceRole, id),
getBalloons(serviceRole, id),
getUnitOfMeasuresList(client, companyId),
+ getGaugeTypesList(client, companyId),
getCompanySettings(client, companyId)
]);
@@ -89,6 +101,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
features,
balloons,
unitOfMeasures,
+ gaugeTypes: gaugeTypesResult.data ?? [],
samplingStandard:
((companySettings.data as any)?.samplingStandard as
| "ANSI_Z1_4"
@@ -97,8 +110,14 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
}
export default function BalloonDetailRoute() {
- const { diagram, features, balloons, unitOfMeasures, samplingStandard } =
- useLoaderData<typeof loader>();
+ const {
+ diagram,
+ features,
+ balloons,
+ unitOfMeasures,
+ gaugeTypes,
+ samplingStandard
+ } = useLoaderData<typeof loader>();
const content = diagram.content as InspectionDocumentContent | null;
return (
@@ -119,6 +138,7 @@ export default function BalloonDetailRoute() {
}
>
<InspectionDocumentEditor
+ key={diagram.id}
diagramId={diagram.id}
name={diagram.name}
partId={diagram.partId}
@@ -126,6 +146,7 @@ export default function BalloonDetailRoute() {
features={features}
balloons={balloons}
unitOfMeasures={unitOfMeasures}
+ gaugeTypes={gaugeTypes}
sampling={(diagram.sampling as SamplingRule | null) ?? null}
samplingStandard={samplingStandard}
/>
diff --git a/apps/erp/app/routes/x+/material+/$itemId.quality.tsx b/apps/erp/app/routes/x+/material+/$itemId.quality.tsx
index e992c7ee12..64adbaadd9 100644
--- a/apps/erp/app/routes/x+/material+/$itemId.quality.tsx
+++ b/apps/erp/app/routes/x+/material+/$itemId.quality.tsx
@@ -5,8 +5,8 @@ import { validationError, validator } from "@carbon/form";
import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";
import { data, redirect, useLoaderData, useParams } from "react-router";
import invariant from "tiny-invariant";
-import { getInspectionDocumentsForItem } from "~/modules/production";
import {
+ getInspectionDocumentsForItem,
getItemInspectionDocumentAssignments,
itemInspectionDocumentAssignmentValidator,
upsertItemInspectionDocumentAssignment
diff --git a/apps/erp/app/routes/x+/part+/$itemId.quality.tsx b/apps/erp/app/routes/x+/part+/$itemId.quality.tsx
index f9589a8dab..8267e5b694 100644
--- a/apps/erp/app/routes/x+/part+/$itemId.quality.tsx
+++ b/apps/erp/app/routes/x+/part+/$itemId.quality.tsx
@@ -5,8 +5,8 @@ import { validationError, validator } from "@carbon/form";
import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";
import { data, redirect, useLoaderData, useParams } from "react-router";
import invariant from "tiny-invariant";
-import { getInspectionDocumentsForItem } from "~/modules/production";
import {
+ getInspectionDocumentsForItem,
getItemInspectionDocumentAssignments,
itemInspectionDocumentAssignmentValidator,
upsertItemInspectionDocumentAssignment
diff --git a/apps/erp/app/routes/x+/production+/inspection.new.tsx b/apps/erp/app/routes/x+/production+/inspection.new.tsx
index 93026ef3fc..b67c023151 100644
--- a/apps/erp/app/routes/x+/production+/inspection.new.tsx
+++ b/apps/erp/app/routes/x+/production+/inspection.new.tsx
@@ -1,73 +1,7 @@
-import { assertIsPost, error, success } from "@carbon/auth";
-import { requirePermissions } from "@carbon/auth/auth.server";
-import { flash } from "@carbon/auth/session.server";
-import { validationError, validator } from "@carbon/form";
-import type {
- ActionFunctionArgs,
- ClientActionFunctionArgs,
- LoaderFunctionArgs
-} from "react-router";
-import { redirect, useNavigate } from "react-router";
-import { upsertInspectionDocument } from "~/modules/production";
-import { inspectionDocumentValidator } from "~/modules/production/production.models";
-import { InspectionDocumentForm } from "~/modules/production/ui/InspectionDocument";
+import { redirect } from "react-router";
import { path } from "~/utils/path";
-import { invalidateInspectionDocuments } from "~/utils/react-query";
-export async function loader({ request }: LoaderFunctionArgs) {
- await requirePermissions(request, { create: "quality" });
- return null;
-}
-
-export async function action({ request }: ActionFunctionArgs) {
- assertIsPost(request);
- const { client, companyId, userId } = await requirePermissions(request, {
- create: "quality"
- });
-
- const formData = await request.formData();
- const validation = await validator(inspectionDocumentValidator).validate(
- formData
- );
-
- if (validation.error) {
- return validationError(validation.error);
- }
-
- const result = await upsertInspectionDocument(client, {
- ...validation.data,
- companyId,
- createdBy: userId
- });
-
- if (result.error || !result.data?.id) {
- throw redirect(
- path.to.inspectionDocuments,
- await flash(
- request,
- error(result.error, "Failed to create inspection plan")
- )
- );
- }
-
- throw redirect(
- path.to.inspectionDocument(result.data.id),
- await flash(request, success("Inspection plan created"))
- );
-}
-
-export async function clientAction({ serverAction }: ClientActionFunctionArgs) {
- invalidateInspectionDocuments();
- return await serverAction();
-}
-
-export default function BalloonNewRoute() {
- const navigate = useNavigate();
-
- return (
- <InspectionDocumentForm
- initialValues={{ name: "", partId: "", drawingNumber: "" }}
- onClose={() => navigate(-1)}
- />
- );
+// Inspection plans moved from Production to Quality; keep old links working.
+export async function loader() {
+ throw redirect(path.to.newInspectionDocument);
}
diff --git a/apps/erp/app/routes/x+/production+/inspection.tsx b/apps/erp/app/routes/x+/production+/inspection.tsx
index 133143e7f7..badf1715f7 100644
--- a/apps/erp/app/routes/x+/production+/inspection.tsx
+++ b/apps/erp/app/routes/x+/production+/inspection.tsx
@@ -1,52 +1,10 @@
-import { requirePermissions } from "@carbon/auth/auth.server";
-import { VStack } from "@carbon/react";
-import { msg } from "@lingui/core/macro";
import type { LoaderFunctionArgs } from "react-router";
-import { Outlet, useLoaderData } from "react-router";
-import { getInspectionDocuments } from "~/modules/production";
-import { InspectionDocumentTable } from "~/modules/production/ui/InspectionDocument";
-import type { Handle } from "~/utils/handle";
+import { redirect } from "react-router";
import { path } from "~/utils/path";
-import { getGenericQueryFilters } from "~/utils/query";
-
-export const handle: Handle = {
- breadcrumb: msg`Inspection Plans`,
- to: path.to.inspectionDocuments
-};
+// Inspection plans moved from Production to Quality; keep old links working.
export async function loader({ request }: LoaderFunctionArgs) {
- const { client, companyId } = await requirePermissions(request, {
- view: "quality",
- role: "employee"
- });
-
- const url = new URL(request.url);
- const searchParams = new URLSearchParams(url.search);
- const search = searchParams.get("search");
- const { limit, offset, sorts, filters } =
- getGenericQueryFilters(searchParams);
-
- const diagrams = await getInspectionDocuments(client, companyId, {
- search,
- limit,
- offset,
- sorts,
- filters
- });
-
- return {
- diagrams: diagrams.data ?? [],
- count: diagrams.count ?? 0
- };
-}
-
-export default function InspectionDocumentsRoute() {
- const { diagrams, count } = useLoaderData<typeof loader>();
-
- return (
- <VStack spacing={0} className="h-full">
- <InspectionDocumentTable data={diagrams} count={count} />
- <Outlet />
- </VStack>
+ throw redirect(
+ `${path.to.inspectionDocuments}${new URL(request.url).search}`
);
}
diff --git a/apps/erp/app/routes/x+/quality+/gauges.delete.$id.tsx b/apps/erp/app/routes/x+/quality+/gauges.delete.$id.tsx
index 4a697184e5..4f5b18877f 100644
--- a/apps/erp/app/routes/x+/quality+/gauges.delete.$id.tsx
+++ b/apps/erp/app/routes/x+/quality+/gauges.delete.$id.tsx
@@ -21,7 +21,16 @@ export async function action({ request, params }: ActionFunctionArgs) {
{
success: false
},
- await flash(request, error(mutation.error, "Failed to delete gauge"))
+ await flash(
+ request,
+ error(
+ mutation.error,
+ // A gauge recorded on a closed inspection is kept for traceability.
+ mutation.error.code === "23503"
+ ? "Gauge is used elsewhere. Set it to Inactive instead."
+ : "Failed to delete gauge"
+ )
+ )
);
}
diff --git a/apps/erp/app/routes/x+/quality+/inspection-plans.new.tsx b/apps/erp/app/routes/x+/quality+/inspection-plans.new.tsx
new file mode 100644
index 0000000000..297fc03000
--- /dev/null
+++ b/apps/erp/app/routes/x+/quality+/inspection-plans.new.tsx
@@ -0,0 +1,73 @@
+import { assertIsPost, error, success } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { flash } from "@carbon/auth/session.server";
+import { validationError, validator } from "@carbon/form";
+import type {
+ ActionFunctionArgs,
+ ClientActionFunctionArgs,
+ LoaderFunctionArgs
+} from "react-router";
+import { redirect, useNavigate } from "react-router";
+import { upsertInspectionDocument } from "~/modules/quality";
+import { inspectionDocumentValidator } from "~/modules/quality/quality.models";
+import { InspectionDocumentForm } from "~/modules/quality/ui/InspectionDocument";
+import { path } from "~/utils/path";
+import { invalidateInspectionDocuments } from "~/utils/react-query";
+
+export async function loader({ request }: LoaderFunctionArgs) {
+ await requirePermissions(request, { create: "quality" });
+ return null;
+}
+
+export async function action({ request }: ActionFunctionArgs) {
+ assertIsPost(request);
+ const { client, companyId, userId } = await requirePermissions(request, {
+ create: "quality"
+ });
+
+ const formData = await request.formData();
+ const validation = await validator(inspectionDocumentValidator).validate(
+ formData
+ );
+
+ if (validation.error) {
+ return validationError(validation.error);
+ }
+
+ const result = await upsertInspectionDocument(client, {
+ ...validation.data,
+ companyId,
+ createdBy: userId
+ });
+
+ if (result.error || !result.data?.id) {
+ throw redirect(
+ path.to.inspectionDocuments,
+ await flash(
+ request,
+ error(result.error, "Failed to create inspection plan")
+ )
+ );
+ }
+
+ throw redirect(
+ path.to.inspectionDocument(result.data.id),
+ await flash(request, success("Inspection plan created"))
+ );
+}
+
+export async function clientAction({ serverAction }: ClientActionFunctionArgs) {
+ invalidateInspectionDocuments();
+ return await serverAction();
+}
+
+export default function BalloonNewRoute() {
+ const navigate = useNavigate();
+
+ return (
+ <InspectionDocumentForm
+ initialValues={{ name: "", partId: "", drawingNumber: "" }}
+ onClose={() => navigate(-1)}
+ />
+ );
+}
diff --git a/apps/erp/app/routes/x+/quality+/inspection-plans.tsx b/apps/erp/app/routes/x+/quality+/inspection-plans.tsx
new file mode 100644
index 0000000000..bca92fb9ac
--- /dev/null
+++ b/apps/erp/app/routes/x+/quality+/inspection-plans.tsx
@@ -0,0 +1,52 @@
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { VStack } from "@carbon/react";
+import { msg } from "@lingui/core/macro";
+import type { LoaderFunctionArgs } from "react-router";
+import { Outlet, useLoaderData } from "react-router";
+import { getInspectionDocuments } from "~/modules/quality";
+import { InspectionDocumentTable } from "~/modules/quality/ui/InspectionDocument";
+import type { Handle } from "~/utils/handle";
+import { path } from "~/utils/path";
+import { getGenericQueryFilters } from "~/utils/query";
+
+export const handle: Handle = {
+ breadcrumb: msg`Inspection Plans`,
+ to: path.to.inspectionDocuments
+};
+
+export async function loader({ request }: LoaderFunctionArgs) {
+ const { client, companyId } = await requirePermissions(request, {
+ view: "quality",
+ role: "employee"
+ });
+
+ const url = new URL(request.url);
+ const searchParams = new URLSearchParams(url.search);
+ const search = searchParams.get("search");
+ const { limit, offset, sorts, filters } =
+ getGenericQueryFilters(searchParams);
+
+ const diagrams = await getInspectionDocuments(client, companyId, {
+ search,
+ limit,
+ offset,
+ sorts,
+ filters
+ });
+
+ return {
+ diagrams: diagrams.data ?? [],
+ count: diagrams.count ?? 0
+ };
+}
+
+export default function InspectionDocumentsRoute() {
+ const { diagrams, count } = useLoaderData<typeof loader>();
+
+ return (
+ <VStack spacing={0} className="h-full">
+ <InspectionDocumentTable data={diagrams} count={count} />
+ <Outlet />
+ </VStack>
+ );
+}
diff --git a/apps/erp/app/routes/x+/service+/$itemId.quality.tsx b/apps/erp/app/routes/x+/service+/$itemId.quality.tsx
index 50ff14d822..6a65654773 100644
--- a/apps/erp/app/routes/x+/service+/$itemId.quality.tsx
+++ b/apps/erp/app/routes/x+/service+/$itemId.quality.tsx
@@ -5,8 +5,8 @@ import { validationError, validator } from "@carbon/form";
import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";
import { data, redirect, useLoaderData, useParams } from "react-router";
import invariant from "tiny-invariant";
-import { getInspectionDocumentsForItem } from "~/modules/production";
import {
+ getInspectionDocumentsForItem,
getItemInspectionDocumentAssignments,
itemInspectionDocumentAssignmentValidator,
upsertItemInspectionDocumentAssignment
diff --git a/apps/erp/app/routes/x+/settings+/company.tsx b/apps/erp/app/routes/x+/settings+/company.tsx
index 17fb0c172b..1c3935c6b8 100644
--- a/apps/erp/app/routes/x+/settings+/company.tsx
+++ b/apps/erp/app/routes/x+/settings+/company.tsx
@@ -9,12 +9,10 @@ import {
CardDescription,
CardHeader,
CardTitle,
+ Copy,
Heading,
HStack,
ScrollArea,
- Tooltip,
- TooltipContent,
- TooltipTrigger,
VStack
} from "@carbon/react";
import { msg } from "@lingui/core/macro";
@@ -35,7 +33,6 @@ import { invalidateCompanyTimeZone } from "~/modules/shared/timezone.server";
import { getDatabaseClient } from "~/services/database.server";
import type { Handle } from "~/utils/handle";
import { path } from "~/utils/path";
-import { copyToClipboard } from "~/utils/string";
export const handle: Handle = {
breadcrumb: msg`Company`,
@@ -147,24 +144,13 @@ export default function Company() {
<Heading size="h3">
<Trans>Company</Trans>
</Heading>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- variant="ghost"
- aria-label={t`Copy`}
- size="sm"
- className="p-1"
- onClick={() => copyToClipboard(company.id ?? "")}
- >
- <LuKeySquare className="w-3 h-3" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <span>
- <Trans>Copy company unique identifier</Trans>
- </span>
- </TooltipContent>
- </Tooltip>
+ <Copy
+ text={company.id ?? ""}
+ label={t`Copy company unique identifier`}
+ icon={<LuKeySquare className="size-3" />}
+ variant="ghost"
+ className="w-auto"
+ />
</HStack>
<Card>
<CardHeader>
diff --git a/apps/erp/app/routes/x+/tool+/$itemId.quality.tsx b/apps/erp/app/routes/x+/tool+/$itemId.quality.tsx
index 847b9a88c3..e5a9fe17b9 100644
--- a/apps/erp/app/routes/x+/tool+/$itemId.quality.tsx
+++ b/apps/erp/app/routes/x+/tool+/$itemId.quality.tsx
@@ -5,8 +5,8 @@ import { validationError, validator } from "@carbon/form";
import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";
import { data, redirect, useLoaderData, useParams } from "react-router";
import invariant from "tiny-invariant";
-import { getInspectionDocumentsForItem } from "~/modules/production";
import {
+ getInspectionDocumentsForItem,
getItemInspectionDocumentAssignments,
itemInspectionDocumentAssignmentValidator,
upsertItemInspectionDocumentAssignment
diff --git a/apps/erp/app/utils/path.ts b/apps/erp/app/utils/path.ts
index 9922b5f572..25d75220d5 100644
--- a/apps/erp/app/utils/path.ts
+++ b/apps/erp/app/utils/path.ts
@@ -135,10 +135,10 @@ export const path = {
generatePath(`${api}/ai/csv/${table}/columns`),
inspectionDocumentBalloonAnalyze: (inspectionDocumentId: string) =>
generatePath(
- `${api}/production/inspection-document/${inspectionDocumentId}/balloon-analyze`
+ `${api}/quality/inspection-document/${inspectionDocumentId}/balloon-analyze`
),
inspectionDocuments: (itemId: string) =>
- generatePath(`${api}/production/inspection-documents/${itemId}`),
+ generatePath(`${api}/quality/inspection-documents/${itemId}`),
issueTypes: `${api}/quality/issue-types`,
item: (type: string) => generatePath(`${api}/item/${type}`),
itemConfigurable: `${api}/items/configurable`,
@@ -1268,7 +1268,9 @@ export const path = {
generatePath(`${x}/inspection/${id}/document`),
inspectionDocument: (id: string) =>
generatePath(`${x}/inspection-document/${id}`),
- inspectionDocuments: `${x}/production/inspection`,
+ inspectionDocuments: `${x}/quality/inspection-plans`,
+ inspectionGauge: (id: string) =>
+ generatePath(`${x}/inspection/${id}/gauge`),
inspectionMeasurement: (id: string) =>
generatePath(`${x}/inspection/${id}/measurement`),
inspectionPartial: (id: string) =>
@@ -1583,7 +1585,7 @@ export const path = {
newGaugeType: `${x}/quality/gauge-types/new`,
newGroup: `${x}/users/groups/new`,
newHoliday: `${x}/people/holidays/new`,
- newInspectionDocument: `${x}/production/inspection/new`,
+ newInspectionDocument: `${x}/quality/inspection-plans/new`,
newIntercompanyTransaction: `${x}/accounting/intercompany/new`,
newInventoryCount: `${x}/inventory/inventory-count/new`,
newInvestigationType: `${x}/quality/investigation-types/new`,
diff --git a/apps/mes/app/components/Inspection/DispositionModal.tsx b/apps/mes/app/components/Inspection/DispositionModal.tsx
index 831b78f7e6..152a6f012a 100644
--- a/apps/mes/app/components/Inspection/DispositionModal.tsx
+++ b/apps/mes/app/components/Inspection/DispositionModal.tsx
@@ -259,7 +259,7 @@ const DispositionModal = ({
{failedFeatureSummary && failedFeatureSummary.length > 0 && (
<div className="w-full rounded-md border p-3">
<p className="mb-1 text-xs font-medium text-muted-foreground">
- <Trans>Failed features</Trans>
+ <Trans>Failed characteristics</Trans>
</p>
<ul className="flex flex-col gap-0.5">
{failedFeatureSummary.map((feature) => (
diff --git a/apps/mes/app/components/Inspection/InspectionDrawingPane.tsx b/apps/mes/app/components/Inspection/InspectionDrawingPane.tsx
index ce20de9904..dcaf296399 100644
--- a/apps/mes/app/components/Inspection/InspectionDrawingPane.tsx
+++ b/apps/mes/app/components/Inspection/InspectionDrawingPane.tsx
@@ -1,19 +1,27 @@
import { IconButton } from "@carbon/react";
+import {
+ BALLOON_CALLOUT_STROKE,
+ BALLOON_H_NORM,
+ BALLOON_W_NORM,
+ clippedBalloonToAnchorLine
+} from "@carbon/utils";
import { useEffect, useMemo, useRef, useState } from "react";
import { LuChevronLeft, LuChevronRight } from "react-icons/lu";
-import { Circle, Group, Layer, Stage, Text } from "react-konva";
+import { Circle, Group, Layer, Line, Stage, Text } from "react-konva";
import { Document, Page } from "react-pdf";
import "react-pdf/dist/Page/AnnotationLayer.css";
import "react-pdf/dist/Page/TextLayer.css";
-const CALLOUT_STROKE = "#f97316";
-
export type DrawingBalloon = {
id: string;
inspectionFeatureId: string;
pageNumber: number;
xCoordinate: number;
yCoordinate: number;
+ regionX: number;
+ regionY: number;
+ regionWidth: number;
+ regionHeight: number;
label: string;
};
@@ -144,9 +152,28 @@ const InspectionDrawingPane = ({
<Stage width={containerWidth} height={overlayHeight} listening>
<Layer>
{pageBalloons.map((balloon) => {
- // DB coordinates are normalized 0–1.
- const x = balloon.xCoordinate * containerWidth;
- const y = balloon.yCoordinate * overlayHeight;
+ // DB coordinates are normalized 0–1: the balloon box's
+ // top-left corner, and the anchor region it points at.
+ const x =
+ (balloon.xCoordinate + BALLOON_W_NORM / 2) *
+ containerWidth;
+ const y =
+ (balloon.yCoordinate + BALLOON_H_NORM / 2) *
+ overlayHeight;
+ const region = {
+ x: balloon.regionX * containerWidth,
+ y: balloon.regionY * overlayHeight,
+ w: balloon.regionWidth * containerWidth,
+ h: balloon.regionHeight * overlayHeight
+ };
+ const linePoints = clippedBalloonToAnchorLine(
+ x,
+ y,
+ balloonRadius,
+ region.x + region.w / 2,
+ region.y + region.h / 2,
+ region
+ );
const isActive =
balloon.inspectionFeatureId === activeFeatureId;
return (
@@ -167,11 +194,19 @@ const InspectionDrawingPane = ({
if (stage) stage.container().style.cursor = "";
}}
>
+ {linePoints && (
+ <Line
+ points={linePoints}
+ stroke={BALLOON_CALLOUT_STROKE}
+ strokeWidth={2}
+ listening={false}
+ />
+ )}
<Circle
x={x}
y={y}
radius={balloonRadius}
- stroke={CALLOUT_STROKE}
+ stroke={BALLOON_CALLOUT_STROKE}
strokeWidth={isActive ? 3 : 2}
fill={
isActive
@@ -187,7 +222,7 @@ const InspectionDrawingPane = ({
text={balloon.label}
fontSize={balloonRadius}
fontStyle="bold"
- fill={CALLOUT_STROKE}
+ fill={BALLOON_CALLOUT_STROKE}
listening={false}
/>
</Group>
diff --git a/apps/mes/app/components/Inspection/InspectionGaugePicker.tsx b/apps/mes/app/components/Inspection/InspectionGaugePicker.tsx
new file mode 100644
index 0000000000..2877dcf8f6
--- /dev/null
+++ b/apps/mes/app/components/Inspection/InspectionGaugePicker.tsx
@@ -0,0 +1,238 @@
+import type { Database } from "@carbon/database";
+import {
+ Command,
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ CommandList,
+ cn,
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+ Status
+} from "@carbon/react";
+import { GAUGE_CALIBRATION_STATUS_COLOR_MAP } from "@carbon/utils";
+import { useLingui } from "@lingui/react/macro";
+import { useMemo, useState } from "react";
+import { LuCheck, LuChevronDown, LuTriangleAlert, LuX } from "react-icons/lu";
+
+// A row of the `gauges` view (every column is nullable on a view).
+export type GaugeOption = {
+ id: string | null;
+ gaugeId: string | null;
+ description: string | null;
+ gaugeTypeId: string | null;
+ gaugeStatus: Database["public"]["Enums"]["gaugeStatus"] | null;
+ gaugeCalibrationStatusWithDueDate:
+ | Database["public"]["Enums"]["gaugeCalibrationStatus"]
+ | null;
+};
+
+type InspectionGaugePickerProps = {
+ // Every Active gauge plus any (possibly retired) gauge recorded on this lot.
+ // Only Active gauges are offered; the rest exist so a recorded gauge still
+ // displays by its readable id.
+ gauges: GaugeOption[];
+ // The characteristic's label (balloon number), for the trigger's
+ // accessible name.
+ characteristicLabel: string;
+ // Gauge ids most recently recorded at this lot's work center, newest first.
+ recentGaugeIds: string[];
+ // The feature's required gauge type — when set, only gauges of that type
+ // are offered.
+ gaugeTypeId: string | null;
+ gaugeTypeName: string | null;
+ value: string | null;
+ isReadOnly: boolean;
+ onChange: (gaugeId: string | null) => void;
+};
+
+const isOutOfCalibration = (gauge: GaugeOption) =>
+ gauge.gaugeCalibrationStatusWithDueDate === "Out-of-Calibration";
+
+// The gauge cell of the inspection matrix: a button filling the whole cell that
+// opens a searchable list, with the gauges recently used at this work center
+// on top and the rest below. Touch-sized copy of the ERP quality module's
+// InspectionGaugePicker (MES cannot import ERP app code).
+const InspectionGaugePicker = ({
+ gauges,
+ characteristicLabel,
+ recentGaugeIds,
+ gaugeTypeId,
+ gaugeTypeName,
+ value,
+ isReadOnly,
+ onChange
+}: InspectionGaugePickerProps) => {
+ const { t } = useLingui();
+ const [open, setOpen] = useState(false);
+
+ const selected = value ? gauges.find((g) => g.id === value) : undefined;
+
+ const { recent, rest } = useMemo(() => {
+ const eligible = gauges.filter(
+ (g) =>
+ g.id &&
+ g.gaugeStatus === "Active" &&
+ (!gaugeTypeId || g.gaugeTypeId === gaugeTypeId)
+ );
+ const byId = new Map(eligible.map((g) => [g.id as string, g]));
+ const recent = recentGaugeIds
+ .map((id) => byId.get(id))
+ .filter((g): g is GaugeOption => g !== undefined);
+ const recentIds = new Set(recent.map((g) => g.id));
+ return {
+ recent,
+ rest: eligible.filter((g) => !recentIds.has(g.id))
+ };
+ }, [gauges, recentGaugeIds, gaugeTypeId]);
+
+ const placeholder = gaugeTypeName ?? t`Select gauge`;
+ const isInactive = selected?.gaugeStatus === "Inactive";
+
+ const label = selected ? (
+ <span className="flex min-w-0 items-center gap-1.5">
+ {isOutOfCalibration(selected) && (
+ <LuTriangleAlert
+ role="img"
+ className="size-3.5 shrink-0 text-red-500"
+ aria-label={t`Out of calibration`}
+ />
+ )}
+ <span
+ className={cn(
+ "truncate font-mono text-sm",
+ isInactive && "text-muted-foreground"
+ )}
+ >
+ {selected.gaugeId}
+ </span>
+ {isInactive && (
+ <span className="shrink-0 text-xs text-muted-foreground">
+ {t`(Inactive)`}
+ </span>
+ )}
+ </span>
+ ) : value ? (
+ <span className="truncate text-xs text-muted-foreground">
+ {t`Unknown gauge`}
+ </span>
+ ) : (
+ <span className="truncate text-sm text-muted-foreground">
+ {placeholder}
+ </span>
+ );
+
+ if (isReadOnly) {
+ return (
+ <div className="flex h-full min-h-12 min-w-[140px] items-center px-3">
+ {selected || value ? label : "—"}
+ </div>
+ );
+ }
+
+ const renderItem = (gauge: GaugeOption) => (
+ <CommandItem
+ key={gauge.id}
+ value={`${gauge.gaugeId ?? ""} ${gauge.description ?? ""} ${gauge.id}`}
+ className="py-2.5"
+ onSelect={() => {
+ onChange(gauge.id);
+ setOpen(false);
+ }}
+ >
+ <div className="flex min-w-0 flex-1 flex-col">
+ <span className="truncate font-mono text-sm">{gauge.gaugeId}</span>
+ {gauge.description && (
+ <span className="truncate text-xs text-muted-foreground">
+ {gauge.description}
+ </span>
+ )}
+ </div>
+ {isOutOfCalibration(gauge) && (
+ <Status
+ color={GAUGE_CALIBRATION_STATUS_COLOR_MAP["Out-of-Calibration"]}
+ className="shrink-0"
+ >
+ {t`Out of calibration`}
+ </Status>
+ )}
+ <LuCheck
+ className={cn(
+ "ml-2 size-4 shrink-0",
+ gauge.id === value ? "opacity-100" : "opacity-0"
+ )}
+ />
+ </CommandItem>
+ );
+
+ const currentGauge = selected
+ ? `${selected.gaugeId ?? ""}${isInactive ? ` ${t`(Inactive)`}` : ""}`
+ : value
+ ? t`Unknown gauge`
+ : t`None`;
+
+ return (
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ aria-label={t`Gauge for characteristic ${characteristicLabel}: ${currentGauge}`}
+ onClick={(e) => e.stopPropagation()}
+ className="flex h-full min-h-12 w-full min-w-[140px] items-center justify-between gap-2 px-3 text-left transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"
+ >
+ {label}
+ <LuChevronDown className="size-3.5 shrink-0 text-muted-foreground" />
+ </button>
+ </PopoverTrigger>
+ <PopoverContent
+ align="start"
+ className="w-80 p-0"
+ onClick={(e) => e.stopPropagation()}
+ >
+ <Command>
+ <CommandInput
+ placeholder={
+ gaugeTypeName
+ ? t`Search ${gaugeTypeName}...`
+ : t`Search gauges...`
+ }
+ className="h-11"
+ />
+ <CommandList>
+ <CommandEmpty>{t`No gauges found.`}</CommandEmpty>
+ {recent.length > 0 && (
+ <CommandGroup heading={t`Recently used`}>
+ {recent.map(renderItem)}
+ </CommandGroup>
+ )}
+ {rest.length > 0 && (
+ <CommandGroup
+ heading={recent.length > 0 ? t`All gauges` : undefined}
+ >
+ {rest.map(renderItem)}
+ </CommandGroup>
+ )}
+ {value && (
+ <CommandGroup>
+ <CommandItem
+ value="__clear__"
+ onSelect={() => {
+ onChange(null);
+ setOpen(false);
+ }}
+ >
+ <LuX className="mr-2 size-4 shrink-0" />
+ {t`Clear gauge`}
+ </CommandItem>
+ </CommandGroup>
+ )}
+ </CommandList>
+ </Command>
+ </PopoverContent>
+ </Popover>
+ );
+};
+
+export default InspectionGaugePicker;
diff --git a/apps/mes/app/components/Inspection/InspectionMeasurementMatrix.tsx b/apps/mes/app/components/Inspection/InspectionMeasurementMatrix.tsx
index 0c04d0a69b..89c7f6714a 100644
--- a/apps/mes/app/components/Inspection/InspectionMeasurementMatrix.tsx
+++ b/apps/mes/app/components/Inspection/InspectionMeasurementMatrix.tsx
@@ -1,13 +1,15 @@
import { cn, toast } from "@carbon/react";
import { useLingui } from "@lingui/react/macro";
-import { useCallback, useEffect, useMemo, useState } from "react";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { LuCheck, LuX } from "react-icons/lu";
import type {
+ InspectionGauge,
InspectionMeasurement,
InspectionSample,
InspectionSamplingPlan
} from "~/services/types";
import { path } from "~/utils/path";
+import InspectionGaugePicker from "./InspectionGaugePicker";
// A cell save's response payload (the measurement action returns it so the
// matrix can update without a revalidation roundtrip). Same contract as the
@@ -28,6 +30,11 @@ export type MeasurementSaveResult = {
// sample route) rather than a per-feature measurement.
export const OVERALL_ROW_ID = "__overall__";
+// Mirrors RECENT_INSPECTION_GAUGE_LIMIT in packages/database/src/quality.ts
+// (the server's "recently used" cap) — that module is server-only (Kysely), so
+// it cannot be imported into this client component.
+const RECENT_INSPECTION_GAUGE_LIMIT = 10;
+
type MatrixRow = {
featureId: string;
label: string;
@@ -37,6 +44,8 @@ type MatrixRow = {
sampleSize: number;
acceptanceNumber: number;
rejectionNumber: number;
+ gaugeTypeId: string | null;
+ gaugeTypeName: string | null;
};
type InspectionMeasurementMatrixProps = {
@@ -46,6 +55,8 @@ type InspectionMeasurementMatrixProps = {
features: InspectionSamplingPlan[];
samples: InspectionSample[];
measurements: InspectionMeasurement[];
+ gauges: InspectionGauge[];
+ recentGaugeIds: string[];
maxSampleSize: number;
// Lot size caps how many sample columns can exist — a feature's n is the
// required minimum, but the inspector may record up to the whole lot.
@@ -78,6 +89,8 @@ const InspectionMeasurementMatrix = ({
features,
samples,
measurements,
+ gauges,
+ recentGaugeIds,
maxSampleSize,
lotSize,
lotAcceptanceNumber,
@@ -116,7 +129,9 @@ const InspectionMeasurementMatrix = ({
specLabel: "",
sampleSize: maxSampleSize,
acceptanceNumber: lotAcceptanceNumber,
- rejectionNumber: lotRejectionNumber
+ rejectionNumber: lotRejectionNumber,
+ gaugeTypeId: null,
+ gaugeTypeName: null
}
];
}
@@ -141,7 +156,9 @@ const InspectionMeasurementMatrix = ({
specLabel,
sampleSize: lotFeature.sampleSize,
acceptanceNumber: lotFeature.acceptanceNumber,
- rejectionNumber: lotFeature.rejectionNumber
+ rejectionNumber: lotFeature.rejectionNumber,
+ gaugeTypeId: feature.gaugeTypeId ?? null,
+ gaugeTypeName: feature.gaugeType?.name ?? null
};
});
}, [
@@ -353,6 +370,143 @@ const InspectionMeasurementMatrix = ({
[persistMeasurement, persistOverall, onMeasurementSaved]
);
+ // The gauge recorded per feature: the plan rows' value, overridden
+ // optimistically on selection until the loader data agrees with it.
+ const [gaugeByFeature, setGaugeByFeature] = useState<
+ Record<string, string | null>
+ >({});
+ const [recentGauges, setRecentGauges] = useState(recentGaugeIds);
+ useEffect(() => {
+ setRecentGauges(recentGaugeIds);
+ }, [recentGaugeIds]);
+ const serverGaugeFor = useCallback(
+ (featureId: string): string | null =>
+ features.find((f) => f.inspectionFeatureId === featureId)?.gaugeId ??
+ null,
+ [features]
+ );
+ const serverGaugeForRef = useRef(serverGaugeFor);
+ serverGaugeForRef.current = serverGaugeFor;
+ const gaugeFor = useCallback(
+ (featureId: string): string | null =>
+ featureId in gaugeByFeature
+ ? gaugeByFeature[featureId]
+ : serverGaugeFor(featureId),
+ [gaugeByFeature, serverGaugeFor]
+ );
+
+ // Per-feature request bookkeeping, so a request that settles late can never
+ // undo a newer pick: `latest` is the newest request id, `settled` whether
+ // it has answered, `confirmed` the newest request the server accepted.
+ const gaugeRequests = useRef<
+ Record<
+ string,
+ {
+ latest: number;
+ settled: boolean;
+ confirmed?: { id: number; gaugeId: string | null };
+ }
+ >
+ >({});
+ // One gauge request per characteristic at a time, so the server commits the
+ // picks in the order they were made.
+ const gaugeQueue = useRef<Record<string, Promise<void>>>({});
+
+ // Once the loader data matches a settled pick, drop the override so later
+ // revalidations show the server's value.
+ useEffect(() => {
+ const caughtUp = Object.keys(gaugeByFeature).filter((featureId) => {
+ const request = gaugeRequests.current[featureId];
+ return (
+ (!request || request.settled) &&
+ serverGaugeFor(featureId) === gaugeByFeature[featureId]
+ );
+ });
+ if (caughtUp.length === 0) return;
+ for (const featureId of caughtUp) {
+ const request = gaugeRequests.current[featureId];
+ if (request) {
+ request.confirmed = {
+ id: request.latest,
+ gaugeId: serverGaugeFor(featureId)
+ };
+ }
+ }
+ setGaugeByFeature((prev) => {
+ const next = { ...prev };
+ for (const featureId of caughtUp) delete next[featureId];
+ return next;
+ });
+ }, [gaugeByFeature, serverGaugeFor]);
+
+ const persistGauge = useCallback(
+ async (featureId: string, gaugeId: string | null) => {
+ const request = gaugeRequests.current[featureId] ?? {
+ latest: 0,
+ settled: true
+ };
+ gaugeRequests.current[featureId] = request;
+ const requestId = request.latest + 1;
+ request.latest = requestId;
+ request.settled = false;
+ setGaugeByFeature((prev) => ({ ...prev, [featureId]: gaugeId }));
+
+ // Wait for this characteristic's previous request; a pick superseded
+ // while it waited is never sent.
+ const sent = (gaugeQueue.current[featureId] ?? Promise.resolve()).then(
+ async () => {
+ if (requestId !== request.latest) return null;
+ const formData = new FormData();
+ formData.set("inspectionId", inspectionId);
+ formData.set("inspectionFeatureId", featureId);
+ formData.set("gaugeId", gaugeId ?? "");
+ const response = await fetch(path.to.inspectionGauge(inspectionId), {
+ method: "post",
+ body: formData
+ }).catch(() => null);
+ const body = (await response?.json().catch(() => null)) as {
+ error?: { message: string } | null;
+ } | null;
+ return {
+ ok: !!response?.ok && !!body && !body.error,
+ message: body?.error?.message
+ };
+ }
+ );
+ gaugeQueue.current[featureId] = sent.then(() => undefined);
+ const result = await sent;
+ if (!result) return;
+ const { ok } = result;
+
+ if (ok && (!request.confirmed || requestId > request.confirmed.id)) {
+ request.confirmed = { id: requestId, gaugeId };
+ }
+ if (requestId === request.latest) request.settled = true;
+
+ if (!ok) {
+ toast.error(result.message ?? t`Failed to record gauge`);
+ } else if (gaugeId) {
+ setRecentGauges((prev) =>
+ [gaugeId, ...prev.filter((id) => id !== gaugeId)].slice(
+ 0,
+ RECENT_INSPECTION_GAUGE_LIMIT
+ )
+ );
+ }
+
+ // Once the newest pick has answered, show what the server last
+ // accepted: that pick if it succeeded, else the newest earlier pick
+ // that did, else the loader's value.
+ if (request.settled) {
+ const shown = request.confirmed
+ ? request.confirmed.gaugeId
+ : serverGaugeForRef.current(featureId);
+ setGaugeByFeature((prev) => ({ ...prev, [featureId]: shown }));
+ }
+ },
+ [inspectionId, t]
+ );
+
const columnHeaders = useMemo(
() =>
Array.from({ length: columnCount }, (_, index) => {
@@ -387,11 +541,16 @@ const InspectionMeasurementMatrix = ({
<tr>
<th className="sticky left-0 z-30 min-w-[220px] border-b border-r border-border bg-card px-3 py-2 text-left font-medium text-muted-foreground">
{hasFeatures ? (
- <span>{t`Feature`}</span>
+ <span>{t`Characteristic`}</span>
) : (
<span>{t`Result`}</span>
)}
</th>
+ {hasFeatures && (
+ <th className="min-w-[140px] border-b border-r border-border bg-card px-3 py-2 text-left font-medium text-muted-foreground">
+ {t`Gauge`}
+ </th>
+ )}
{columnHeaders.map((column, index) => (
// biome-ignore lint/suspicious/noArrayIndexKey: columns are positional
<th
@@ -452,6 +611,22 @@ const InspectionMeasurementMatrix = ({
</div>
</div>
</td>
+ {hasFeatures && (
+ <td className="h-px border-b border-r border-border p-0 align-middle">
+ <InspectionGaugePicker
+ gauges={gauges}
+ characteristicLabel={row.label}
+ recentGaugeIds={recentGauges}
+ gaugeTypeId={row.gaugeTypeId}
+ gaugeTypeName={row.gaugeTypeName}
+ value={gaugeFor(row.featureId)}
+ isReadOnly={isReadOnly}
+ onChange={(gaugeId) =>
+ persistGauge(row.featureId, gaugeId)
+ }
+ />
+ </td>
+ )}
{Array.from({ length: columnCount }, (_, columnIndex) => {
const disabled = isReadOnly;
const status = cellStatus(columnIndex, row.featureId);
diff --git a/apps/mes/app/components/Inspection/InspectionView.tsx b/apps/mes/app/components/Inspection/InspectionView.tsx
index 2900792fb9..4e475e2803 100644
--- a/apps/mes/app/components/Inspection/InspectionView.tsx
+++ b/apps/mes/app/components/Inspection/InspectionView.tsx
@@ -51,6 +51,7 @@ import { QuantityModal } from "~/components/JobOperation/components/QuantityModa
import { ReworkModal } from "~/components/JobOperation/components/ReworkModal";
import { useUser } from "~/hooks";
import type {
+ InspectionGauge,
InspectionMeasurement,
Inspection as InspectionRow,
InspectionSample,
@@ -96,6 +97,10 @@ type DrawingBalloonRow = {
pageNumber: number;
xCoordinate: number;
yCoordinate: number;
+ regionX: number;
+ regionY: number;
+ regionWidth: number;
+ regionHeight: number;
};
type WorkType = "Setup" | "Labor" | "Machine";
@@ -115,6 +120,10 @@ type InspectionViewProps = {
samples: InspectionSample[];
features: InspectionSamplingPlan[];
measurements: InspectionMeasurement[];
+ // Active gauges, and the ones most recently recorded at this operation's
+ // work center, newest first.
+ gauges: InspectionGauge[];
+ recentGaugeIds: string[];
balloons: DrawingBalloonRow[];
documentName: string | null;
pdfUrl: string | null;
@@ -144,6 +153,8 @@ export function InspectionView({
samples,
features,
measurements,
+ gauges,
+ recentGaugeIds,
balloons,
documentName,
pdfUrl,
@@ -536,6 +547,10 @@ export function InspectionView({
pageNumber: b.pageNumber,
xCoordinate: b.xCoordinate,
yCoordinate: b.yCoordinate,
+ regionX: b.regionX,
+ regionY: b.regionY,
+ regionWidth: b.regionWidth,
+ regionHeight: b.regionHeight,
label: labelByFeatureId.get(b.inspectionFeatureId) ?? ""
}));
}, [balloons, liveFeatures]);
@@ -776,7 +791,7 @@ export function InspectionView({
<div
role="separator"
aria-orientation="horizontal"
- aria-label={t`Drag to resize drawing and features`}
+ aria-label={t`Drag to resize drawing and characteristics`}
aria-valuenow={Math.round(pdfPaneHeightPx)}
className={cn(
"group flex h-2 shrink-0 cursor-row-resize touch-none items-center justify-center rounded-md px-2 hover:bg-muted/80",
@@ -802,7 +817,7 @@ export function InspectionView({
>
<div className="flex min-h-10 flex-shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2">
<span className="truncate text-sm font-medium text-foreground">
- {t`Features`}
+ {t`Characteristics`}
</span>
<IconButton
type="button"
@@ -810,8 +825,8 @@ export function InspectionView({
aria-expanded={gridExpanded}
aria-label={
gridExpanded
- ? t`Collapse features table`
- : t`Expand features table`
+ ? t`Collapse characteristics table`
+ : t`Expand characteristics table`
}
icon={
gridExpanded ? (
@@ -830,6 +845,8 @@ export function InspectionView({
features={features}
samples={samples}
measurements={measurements}
+ gauges={gauges}
+ recentGaugeIds={recentGaugeIds}
maxSampleSize={maxSampleSize}
lotSize={inspection.lotSize}
lotAcceptanceNumber={inspection.acceptanceNumber}
@@ -851,6 +868,8 @@ export function InspectionView({
features={features}
samples={samples}
measurements={measurements}
+ gauges={gauges}
+ recentGaugeIds={recentGaugeIds}
maxSampleSize={maxSampleSize}
lotSize={inspection.lotSize}
lotAcceptanceNumber={inspection.acceptanceNumber}
diff --git a/apps/mes/app/routes/x+/inspection-lot.$id.gauge.tsx b/apps/mes/app/routes/x+/inspection-lot.$id.gauge.tsx
new file mode 100644
index 0000000000..fd62af2302
--- /dev/null
+++ b/apps/mes/app/routes/x+/inspection-lot.$id.gauge.tsx
@@ -0,0 +1,49 @@
+import { assertIsPost, error } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { flash } from "@carbon/auth/session.server";
+import { recordInspectionGauge } from "@carbon/database/quality";
+import { validationError, validator } from "@carbon/form";
+import type { ActionFunctionArgs } from "react-router";
+import { data } from "react-router";
+import { getDatabaseClient } from "~/services/database.server";
+import { inspectionGaugeValidator } from "~/services/models";
+
+export async function action({ request, params }: ActionFunctionArgs) {
+ assertIsPost(request);
+ const { companyId, userId } = await requirePermissions(request, {
+ update: "quality"
+ });
+ const { id } = params;
+ if (!id) throw new Error("id is required");
+
+ const formData = await request.formData();
+ const validation = await validator(inspectionGaugeValidator).validate(
+ formData
+ );
+ if (validation.error) return validationError(validation.error);
+
+ if (validation.data.inspectionId !== id) {
+ return data(
+ { error: { message: "Inspection id mismatch" } },
+ await flash(request, error(null, "Inspection id mismatch"))
+ );
+ }
+
+ const result = await recordInspectionGauge(getDatabaseClient(), {
+ inspectionId: id,
+ inspectionFeatureId: validation.data.inspectionFeatureId,
+ gaugeId: validation.data.gaugeId || null,
+ companyId,
+ userId
+ });
+
+ if (result.error) {
+ return data(
+ { error: result.error },
+ await flash(request, error(result.error, "Failed to record gauge"))
+ );
+ }
+
+ // Quiet like the per-cell measurement saves — the matrix updates itself.
+ return data(result);
+}
diff --git a/apps/mes/app/routes/x+/inspection.$operationId.tsx b/apps/mes/app/routes/x+/inspection.$operationId.tsx
index 1697603b76..68f7f040a6 100644
--- a/apps/mes/app/routes/x+/inspection.$operationId.tsx
+++ b/apps/mes/app/routes/x+/inspection.$operationId.tsx
@@ -4,6 +4,7 @@ import { getCarbonServiceRole } from "@carbon/auth/client.server";
import { flash } from "@carbon/auth/session.server";
import {
getOrCreateJobOperationInspection,
+ getRecentInspectionGauges,
reconcileInspectionSamplingPlans
} from "@carbon/database/quality";
import { getLogger } from "@carbon/logger";
@@ -22,6 +23,7 @@ import {
import {
getInspection,
getInspectionDocumentWithBalloons,
+ getInspectionGauges,
getInspectionMeasurements,
getInspectionSamplingPlans,
getIssueTypesList
@@ -137,7 +139,9 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
events,
quantities,
linkedQuantities,
- document
+ document,
+ gauges,
+ recentGauges
] = await Promise.all([
getInspectionSamplingPlans(serviceRole, lot.data.id, companyId),
getInspectionMeasurements(serviceRole, lot.data.id, companyId),
@@ -161,7 +165,12 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
serviceRole,
inspection.inspectionDocumentId
)
- : Promise.resolve(null)
+ : Promise.resolve(null),
+ getInspectionGauges(serviceRole, companyId, lot.data.id),
+ getRecentInspectionGauges(getDatabaseClient(), {
+ inspectionId: lot.data.id,
+ companyId
+ })
]);
const linkedProductionRows = (linkedQuantities.data ?? []).filter(
@@ -195,6 +204,8 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
samples,
features: features.data ?? [],
measurements: measurements.data ?? [],
+ gauges: gauges.data ?? [],
+ recentGaugeIds: recentGauges.data ?? [],
issueTypes: issueTypes.data ?? [],
trackedEntities: trackedEntities.data ?? [],
requiresSerialTracking: jobMakeMethod.data?.requiresSerialTracking ?? false,
diff --git a/apps/mes/app/services/models.ts b/apps/mes/app/services/models.ts
index 7398b73ae5..16d40f2a3d 100644
--- a/apps/mes/app/services/models.ts
+++ b/apps/mes/app/services/models.ts
@@ -465,3 +465,10 @@ export const inspectionMeasurementValidator = z.object({
passed: zfd.text(z.enum(["true", "false"]).optional()),
notes: zfd.text(z.string().optional())
});
+
+// Records the gauge used for one feature of a lot; an empty gaugeId clears it.
+export const inspectionGaugeValidator = z.object({
+ inspectionId: z.string().min(1, { message: "Inspection is required" }),
+ inspectionFeatureId: z.string().min(1, { message: "Feature is required" }),
+ gaugeId: zfd.text(z.string().optional())
+});
diff --git a/apps/mes/app/services/quality.service.ts b/apps/mes/app/services/quality.service.ts
index b02f5a2661..68422bef0a 100644
--- a/apps/mes/app/services/quality.service.ts
+++ b/apps/mes/app/services/quality.service.ts
@@ -28,12 +28,47 @@ export async function getInspectionSamplingPlans(
return client
.from("inspectionSamplingPlan")
.select(
- "*, inspectionFeature(id, label, description, pageNumber, type, nominalValue, tolerancePlus, toleranceMinus, unit)"
+ "*, inspectionFeature(id, label, description, pageNumber, type, nominalValue, tolerancePlus, toleranceMinus, unit, gaugeTypeId, gaugeType(name))"
)
.eq("inspectionId", inspectionId)
.eq("companyId", companyId);
}
+// The gauges an inspection lot's view needs: every Active gauge (the
+// selectable options — Inactive gauges are retired and never offered, the
+// engine refuses them too) plus any gauge already recorded on this lot, even
+// if it has since been retired, so the record keeps showing its readable id.
+export async function getInspectionGauges(
+ client: SupabaseClient<Database>,
+ companyId: string,
+ inspectionId: string
+) {
+ const recorded = await client
+ .from("inspectionSamplingPlan")
+ .select("gaugeId")
+ .eq("inspectionId", inspectionId)
+ .eq("companyId", companyId)
+ .not("gaugeId", "is", null);
+ const recordedIds = [
+ ...new Set((recorded.data ?? []).map((row) => row.gaugeId as string))
+ ];
+
+ const query = client
+ .from("gauges")
+ .select(
+ "id, gaugeId, description, gaugeTypeId, gaugeStatus, gaugeCalibrationStatusWithDueDate"
+ )
+ .eq("companyId", companyId);
+
+ return (
+ recordedIds.length > 0
+ ? query.or(
+ `gaugeStatus.eq.Active,id.in.(${recordedIds.map((id) => `"${id}"`).join(",")})`
+ )
+ : query.eq("gaugeStatus", "Active")
+ ).order("gaugeId");
+}
+
export async function getInspectionMeasurements(
client: SupabaseClient<Database>,
inspectionId: string,
@@ -59,7 +94,7 @@ export async function getIssueTypesList(
// The drawing pane needs the document's display name, its PDF preview URL, and
// the balloon coordinates. This is a simplified read of what the ERP
-// production module assembles via mapInspectionDocument/mapBalloon.
+// quality module assembles via mapInspectionDocument/mapBalloon.
export async function getInspectionDocumentWithBalloons(
client: SupabaseClient<Database>,
inspectionDocumentId: string
@@ -72,7 +107,9 @@ export async function getInspectionDocumentWithBalloons(
.single(),
client
.from("balloon")
- .select("id, inspectionFeatureId, pageNumber, xCoordinate, yCoordinate")
+ .select(
+ "id, inspectionFeatureId, pageNumber, xCoordinate, yCoordinate, regionX, regionY, regionWidth, regionHeight"
+ )
.eq("inspectionDocumentId", inspectionDocumentId)
]);
diff --git a/apps/mes/app/services/types.ts b/apps/mes/app/services/types.ts
index 1b71dbdfaf..e354d08b2a 100644
--- a/apps/mes/app/services/types.ts
+++ b/apps/mes/app/services/types.ts
@@ -16,6 +16,7 @@ import type {
getTrackedInputs
} from "./operations.service";
import type {
+ getInspectionGauges,
getInspectionMeasurements,
getInspectionSamplingPlans,
getIssueTypesList
@@ -126,6 +127,10 @@ export type InspectionSamplingPlan = NonNullable<
Awaited<ReturnType<typeof getInspectionSamplingPlans>>["data"]
>[number];
+export type InspectionGauge = NonNullable<
+ Awaited<ReturnType<typeof getInspectionGauges>>["data"]
+>[number];
+
export type InspectionMeasurement = NonNullable<
Awaited<ReturnType<typeof getInspectionMeasurements>>["data"]
>[number];
diff --git a/apps/mes/app/utils/path.ts b/apps/mes/app/utils/path.ts
index 133b72aeef..40a5c44df5 100644
--- a/apps/mes/app/utils/path.ts
+++ b/apps/mes/app/utils/path.ts
@@ -144,6 +144,8 @@ export const path = {
generatePath(`${x}/inspection-lot/${id}/complete-passed`),
inspectionDisposition: (id: string) =>
generatePath(`${x}/inspection-lot/${id}/disposition`),
+ inspectionGauge: (id: string) =>
+ generatePath(`${x}/inspection-lot/${id}/gauge`),
inspectionMeasurement: (id: string) =>
generatePath(`${x}/inspection-lot/${id}/measurement`),
inspectionSample: (id: string) =>
diff --git a/docs/content/changelog/2026-09-30-inspection-gauges.mdx b/docs/content/changelog/2026-09-30-inspection-gauges.mdx
new file mode 100644
index 0000000000..625e4a4c83
--- /dev/null
+++ b/docs/content/changelog/2026-09-30-inspection-gauges.mdx
@@ -0,0 +1,38 @@
+---
+title: "Gauges on inspections, and Inspection Plans in Quality"
+description: "Record the gauge behind every inspected characteristic and require a gauge type. Plus inspection plans that save themselves."
+date: "2026-09-30"
+tags: ["quality", "production"]
+image: "/changelog/2026-09-30-inspection-gauges.svg"
+---
+
+A measurement is only as good as the instrument that took it. Inspections now record which [gauge](/docs/reference/calibration) measured each characteristic, so an auditor, or a recall, can trace a result back to the tool.
+
+## The gauge used for each characteristic
+
+An [inspection](/docs/reference/inspections#gauges) has a Gauge column, in the ERP and on the shop floor. Pick from your active gauges; the ones recently used at the same work center come first, and receiving inspections share one list. The gauge is recorded once per lot and characteristic, with the time it was recorded.
+
+A gauge that is out of calibration is flagged but can still be recorded, so the inspector can see the problem without being blocked from finishing the lot. A gauge retired later still shows on the lots it measured.
+
+## Required gauge types
+
+An inspection plan can name the gauge type each characteristic must be measured with, in the plan editor's new **Gauge Type** column. When one is set, the inspection only offers gauges of that type. Leave it empty to allow any gauge.
+
+## Inspection plans in Quality, saving as you work
+
+Inspection plans, the ballooned drawings that define what gets checked, now live under **Quality → Inspection → Inspection Plans**, next to the inspections that use them. The plan editor has no Save button anymore: every change saves itself, and the toolbar shows when it has.
+
+<Accordion title="Improvements">
+
+- Features are now called characteristics in inspection plans and inspections.
+- Balloons on an inspection's drawing show their leader line to the region they mark.
+- Properties panels on orders, quotes, invoices, jobs and items, and the customer and supplier headers, can copy the record's unique identifier.
+
+</Accordion>
+
+<Accordion title="Fixes">
+
+- Ramp bills pushed while Rillet holds the accounting seat now arrive with their accounting vendor linked.
+- Focus rings on inputs inside a modal are no longer clipped at the edge of the scroll area.
+
+</Accordion>
diff --git a/docs/content/docs/reference/calibration.mdx b/docs/content/docs/reference/calibration.mdx
index 90af6fbb7c..ddb0703719 100644
--- a/docs/content/docs/reference/calibration.mdx
+++ b/docs/content/docs/reference/calibration.mdx
@@ -5,7 +5,7 @@ description: Track measurement instruments, schedule their calibrations, and fla
A <Term>gauge</Term> is a measurement instrument you keep under control: a caliper, a micrometer, a pin gauge, a CMM. Carbon tracks each one as a record, holds it to a recurring <Term>calibration</Term> schedule, and marks it out of calibration the moment it's overdue. Every calibration you perform is logged as its own dated record, so the gauge carries its full history.
-Gauges live in the quality module alongside [issues and inbound inspection](/docs/reference/quality). They're managed on their own, though: a gauge is not attached to an inspection you record. Carbon keeps the instrument controlled so the person taking a measurement knows the tool is trustworthy.
+Gauges live in the quality module alongside [issues and inbound inspection](/docs/reference/quality). Carbon keeps the instrument controlled so the person taking a measurement knows the tool is trustworthy, and an [inspection](/docs/reference/inspections#gauges) records which gauge measured each characteristic.
## The gauge record
diff --git a/docs/content/docs/reference/inspections.mdx b/docs/content/docs/reference/inspections.mdx
index 4184edf958..fc66b87cc1 100644
--- a/docs/content/docs/reference/inspections.mdx
+++ b/docs/content/docs/reference/inspections.mdx
@@ -105,6 +105,14 @@ Each balloon feature carries:
Balloons anchor to a region of a specific PDF page (normalized 0–1 coordinates, so they stay put at any zoom) and each balloon can carry a step **type** from the same `procedureStepType` set, so a ballooned characteristic can be a Measurement, a Checkbox, and so on. Carbon can also auto-detect balloons from the drawing and turn detected regions into features. Because a balloon, its geometry, and its inspection feature must be created together or not at all, saves go through a single atomic RPC (`saveInspectionDocumentAtomic`) rather than separate writes.
+Inspection plans live under **Quality → Inspection → Inspection Plans**. The editor has no Save button: each change saves itself a moment after you stop editing, and the toolbar shows **Saving…**, **Saved**, or **Could not save**.
+
+### Gauges
+
+A characteristic can name the [gauge](/docs/reference/calibration) type it must be measured with, in the plan editor's **Gauge Type** column. Leave it empty to allow any gauge.
+
+When an inspection runs, each characteristic has a **Gauge** cell. The list offers only Active gauges, of the required type when one is set, with the gauges recently used at the same work center first; all receipts share one list. The gauge is recorded once per lot and characteristic, with the time it was recorded. An out-of-calibration gauge is flagged but can still be recorded, and a gauge retired later still shows on the lots it measured.
+
## Related
<Cards>
diff --git a/docs/public/changelog/2026-09-30-inspection-gauges.svg b/docs/public/changelog/2026-09-30-inspection-gauges.svg
new file mode 100644
index 0000000000..1e8e2fa0bf
--- /dev/null
+++ b/docs/public/changelog/2026-09-30-inspection-gauges.svg
@@ -0,0 +1,30 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 675" fill="none">
+ <rect width="1200" height="675" fill="#09090B"/>
+ <rect x="190" y="166" width="470" height="392" rx="16" fill="#141518" stroke="#26272B" stroke-width="1.5"/>
+ <path d="M190 212 H660" stroke="#26272B" stroke-width="1.5"/>
+ <circle cx="218" cy="189" r="4" fill="#2E3036"/>
+ <circle cx="236" cy="189" r="4" fill="#2E3036"/>
+ <circle cx="254" cy="189" r="4" fill="#2E3036"/>
+ <rect x="224" y="242" width="20" height="20" rx="5" fill="#0B3C50" stroke="#00B0FF" stroke-width="1.5"/>
+ <rect x="260" y="246" width="215" height="9" rx="4" fill="#43454D"/>
+ <rect x="548" y="246" width="69" height="9" rx="4" fill="#2E3036"/>
+ <rect x="224" y="300" width="20" height="20" rx="5" fill="#0B3C50" stroke="#00B0FF" stroke-width="1.5"/>
+ <rect x="260" y="304" width="175" height="9" rx="4" fill="#43454D"/>
+ <rect x="548" y="304" width="68" height="9" rx="4" fill="#2E3036"/>
+ <rect x="224" y="358" width="20" height="20" rx="5" fill="none" stroke="#43454D" stroke-width="1.5"/>
+ <rect x="260" y="362" width="170" height="9" rx="4" fill="#2E3036"/>
+ <rect x="548" y="362" width="68" height="9" rx="4" fill="#2E3036"/>
+ <rect x="224" y="416" width="20" height="20" rx="5" fill="none" stroke="#43454D" stroke-width="1.5"/>
+ <rect x="260" y="420" width="209" height="9" rx="4" fill="#2E3036"/>
+ <rect x="548" y="420" width="70" height="9" rx="4" fill="#2E3036"/>
+ <rect x="224" y="474" width="20" height="20" rx="5" fill="none" stroke="#43454D" stroke-width="1.5"/>
+ <rect x="260" y="478" width="141" height="9" rx="4" fill="#2E3036"/>
+ <rect x="548" y="478" width="54" height="9" rx="4" fill="#2E3036"/>
+ <path d="M712 300 H772 M712 420 H772" stroke="#43454D" stroke-width="1.5" stroke-dasharray="5 7"/>
+ <rect x="790" y="246" width="240" height="108" rx="14" fill="#1B1C20" stroke="#26272B" stroke-width="1.5"/>
+ <rect x="818" y="278" width="110" height="10" rx="5" fill="#43454D"/>
+ <rect x="818" y="306" width="164" height="8" rx="4" fill="#2E3036"/>
+ <rect x="790" y="386" width="240" height="108" rx="14" fill="#141518" stroke="#00B0FF" stroke-width="1.5"/>
+ <rect x="818" y="418" width="96" height="12" rx="6" fill="#00B0FF"/>
+ <rect x="818" y="448" width="152" height="8" rx="4" fill="#2E3036"/>
+</svg>
diff --git a/packages/checks/src/conformance/baseline.json b/packages/checks/src/conformance/baseline.json
index f0bb62eda1..89ac0665d8 100644
--- a/packages/checks/src/conformance/baseline.json
+++ b/packages/checks/src/conformance/baseline.json
@@ -363,22 +363,22 @@
"no-raw-rounding::apps/erp/app/modules/production/ui/Assemblies/ModelConvertProgress.tsx::if (n >= 1024 * 1024) return `${(n / (1024 * 1024)).toFixed(1)} MB`;",
"no-raw-rounding::apps/erp/app/modules/production/ui/Assemblies/ModelConvertProgress.tsx::if (n >= 1024) return `${Math.round(n / 1024)} KB`;",
"no-raw-rounding::apps/erp/app/modules/production/ui/Assemblies/ModelConvertProgress.tsx::return `${Math.floor(seconds / 60)}m ${seconds % 60}s`;",
- "no-raw-rounding::apps/erp/app/modules/production/ui/InspectionDocument/InspectionDocumentEditor.tsx::Math.min(26, Math.round(radius * 1.15))",
- "no-raw-rounding::apps/erp/app/modules/production/ui/InspectionDocument/InspectionDocumentEditor.tsx::Math.min(3, Number((zoomScale * Math.min(fitX, fitY)).toFixed(2)))",
- "no-raw-rounding::apps/erp/app/modules/production/ui/InspectionDocument/InspectionDocumentEditor.tsx::aria-valuenow={Math.round(pdfPaneHeightPx)}",
- "no-raw-rounding::apps/erp/app/modules/production/ui/InspectionDocument/InspectionDocumentEditor.tsx::setZoomScale((z) => Math.max(0.5, Number((z - 0.1).toFixed(2))))",
- "no-raw-rounding::apps/erp/app/modules/production/ui/InspectionDocument/InspectionDocumentEditor.tsx::setZoomScale((z) => Math.min(3, Number((z + 0.1).toFixed(2))))",
- "no-raw-rounding::apps/erp/app/modules/production/ui/InspectionDocument/InspectionDocumentEditor.tsx::{Math.round(zoomScale * 100)}%",
- "no-raw-rounding::apps/erp/app/modules/production/ui/InspectionDocument/cropInspectionAnchorToPng.ts::Math.max(1, Math.floor(renderedPageWidthPx * VISION_RENDER_SCALE)),",
- "no-raw-rounding::apps/erp/app/modules/production/ui/InspectionDocument/cropInspectionAnchorToPng.ts::const ch = Math.max(1, Math.floor(viewport.height));",
- "no-raw-rounding::apps/erp/app/modules/production/ui/InspectionDocument/cropInspectionAnchorToPng.ts::const cw = Math.max(1, Math.floor(viewport.width));",
- "no-raw-rounding::apps/erp/app/modules/production/ui/InspectionDocument/cropInspectionAnchorToPng.ts::const sh = Math.max(1, Math.floor((rh / 100) * ch));",
- "no-raw-rounding::apps/erp/app/modules/production/ui/InspectionDocument/cropInspectionAnchorToPng.ts::const sw = Math.max(1, Math.floor((rw / 100) * cw));",
- "no-raw-rounding::apps/erp/app/modules/production/ui/InspectionDocument/cropInspectionAnchorToPng.ts::const sx = Math.floor((rx / 100) * cw);",
- "no-raw-rounding::apps/erp/app/modules/production/ui/InspectionDocument/cropInspectionAnchorToPng.ts::const sy = Math.floor((ry / 100) * ch);",
- "no-raw-rounding::apps/erp/app/modules/production/ui/InspectionDocument/exportInspectionDocumentPdfWithOverlays.ts::Math.min(26, Math.round(radius * 1.15))",
- "no-raw-rounding::apps/erp/app/modules/production/ui/InspectionDocument/exportInspectionDocumentPdfWithOverlays.ts::const ch = Math.floor(viewport.height);",
- "no-raw-rounding::apps/erp/app/modules/production/ui/InspectionDocument/exportInspectionDocumentPdfWithOverlays.ts::const cw = Math.floor(viewport.width);",
+ "no-raw-rounding::apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentEditor.tsx::Math.min(26, Math.round(radius * 1.15))",
+ "no-raw-rounding::apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentEditor.tsx::Math.min(3, Number((zoomScale * Math.min(fitX, fitY)).toFixed(2)))",
+ "no-raw-rounding::apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentEditor.tsx::aria-valuenow={Math.round(pdfPaneHeightPx)}",
+ "no-raw-rounding::apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentEditor.tsx::setZoomScale((z) => Math.max(0.5, Number((z - 0.1).toFixed(2))))",
+ "no-raw-rounding::apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentEditor.tsx::setZoomScale((z) => Math.min(3, Number((z + 0.1).toFixed(2))))",
+ "no-raw-rounding::apps/erp/app/modules/quality/ui/InspectionDocument/InspectionDocumentEditor.tsx::{Math.round(zoomScale * 100)}%",
+ "no-raw-rounding::apps/erp/app/modules/quality/ui/InspectionDocument/drawingRaster.ts::Math.max(1, Math.floor(renderedPageWidthPx * VISION_RENDER_SCALE)),",
+ "no-raw-rounding::apps/erp/app/modules/quality/ui/InspectionDocument/drawingRaster.ts::const ch = Math.max(1, Math.floor(viewport.height));",
+ "no-raw-rounding::apps/erp/app/modules/quality/ui/InspectionDocument/drawingRaster.ts::const cw = Math.max(1, Math.floor(viewport.width));",
+ "no-raw-rounding::apps/erp/app/modules/quality/ui/InspectionDocument/drawingRaster.ts::const sh = Math.max(1, Math.floor((rh / 100) * ch));",
+ "no-raw-rounding::apps/erp/app/modules/quality/ui/InspectionDocument/drawingRaster.ts::const sw = Math.max(1, Math.floor((rw / 100) * cw));",
+ "no-raw-rounding::apps/erp/app/modules/quality/ui/InspectionDocument/drawingRaster.ts::const sx = Math.floor((rx / 100) * cw);",
+ "no-raw-rounding::apps/erp/app/modules/quality/ui/InspectionDocument/drawingRaster.ts::const sy = Math.floor((ry / 100) * ch);",
+ "no-raw-rounding::apps/erp/app/modules/quality/ui/InspectionDocument/drawingRaster.ts::Math.min(26, Math.round(radius * 1.15))",
+ "no-raw-rounding::apps/erp/app/modules/quality/ui/InspectionDocument/drawingRaster.ts::const ch = Math.floor(viewport.height);",
+ "no-raw-rounding::apps/erp/app/modules/quality/ui/InspectionDocument/drawingRaster.ts::const cw = Math.floor(viewport.width);",
"no-raw-rounding::apps/erp/app/modules/production/ui/Jobs/JobDocuments.tsx::Math.floor((file.metadata?.size ?? 0) / 1024)",
"no-raw-rounding::apps/erp/app/modules/production/ui/Jobs/JobDocuments.tsx::Math.floor((modelUpload.modelSize ?? 0) / 1024)",
"no-raw-rounding::apps/erp/app/modules/production/ui/Jobs/JobDocuments.tsx::formData.append(\"size\", Math.round(size / 1024).toString());",
diff --git a/packages/database/src/datasets/tiers/01-foundation.ts b/packages/database/src/datasets/tiers/01-foundation.ts
index 5ab42b7dfa..f108707a29 100644
--- a/packages/database/src/datasets/tiers/01-foundation.ts
+++ b/packages/database/src/datasets/tiers/01-foundation.ts
@@ -50,22 +50,17 @@ export async function runTier1(ctx: Ctx): Promise<void> {
// ── Abilities ─────────────────────────────────────────────────────────────
// Each ability is the qualification for a process. Reuse a same-named process
- // when the dataset already defines one (marking it as requiring the ability);
- // otherwise mint a dedicated process for the qualification.
+ // when the dataset already defines one; otherwise mint a dedicated process for
+ // the qualification. No process requires its ability, so a demo user can run
+ // any operation without first being trained on it.
ctx.log("abilities");
for (const name of data.abilities) {
let processId = ctx.refs.processes[name];
- if (processId) {
- await ctx.client.query(
- `UPDATE "process" SET "requiresAbility" = true WHERE "id" = $1 AND "companyId" = $2`,
- [processId, ctx.companyId]
- );
- } else {
+ if (!processId) {
processId = await insertId(ctx, "process", {
name,
defaultStandardFactor: "Minutes/Piece",
- processType: "Process",
- requiresAbility: true
+ processType: "Process"
});
ctx.refs.processes[name] = processId;
}
diff --git a/packages/database/src/inspection-gauge.test.ts b/packages/database/src/inspection-gauge.test.ts
new file mode 100644
index 0000000000..094944b93d
--- /dev/null
+++ b/packages/database/src/inspection-gauge.test.ts
@@ -0,0 +1,499 @@
+import { randomUUID } from "node:crypto";
+import type { DatabaseConnection } from "kysely";
+import { CompiledQuery, Kysely, PostgresDialect, PostgresDriver } from "kysely";
+import { Client } from "pg";
+import { afterAll, afterEach, beforeAll, describe, expect, it } from "vitest";
+import type { KyselyDatabase } from "./client.ts";
+import {
+ getRecentInspectionGauges,
+ RECENT_INSPECTION_GAUGE_LIMIT,
+ recordInspectionGauge
+} from "./quality.ts";
+
+// Runs against the local database, like the authz tests:
+// SUPABASE_DB_URL=… pnpm --filter @carbon/database test -- inspection-gauge
+//
+// Each test runs inside one transaction that is always rolled back, so it
+// writes nothing. Fixtures are inserted with `session_replication_role =
+// replica` (FKs and triggers off) so a lot needs no job, item or document
+// behind it; the engine's own queries then run on real Postgres, its
+// transaction becoming a savepoint inside the outer one.
+const url = process.env.SUPABASE_DB_URL;
+
+class SavepointDriver extends PostgresDriver {
+ override async beginTransaction(connection: DatabaseConnection) {
+ await connection.executeQuery(CompiledQuery.raw("SAVEPOINT engine"));
+ }
+ override async commitTransaction(connection: DatabaseConnection) {
+ await connection.executeQuery(
+ CompiledQuery.raw("RELEASE SAVEPOINT engine")
+ );
+ }
+ override async rollbackTransaction(connection: DatabaseConnection) {
+ await connection.executeQuery(
+ CompiledQuery.raw("ROLLBACK TO SAVEPOINT engine")
+ );
+ }
+}
+
+type Row = Record<string, unknown>;
+
+describe.skipIf(!url)("inspection gauges against a migrated database", () => {
+ const client = new Client({ connectionString: url });
+ const config = {
+ pool: {
+ connect: async () => Object.assign(client, { release: () => undefined }),
+ end: async () => undefined
+ }
+ };
+ const dialect = new PostgresDialect(config);
+ const db = new Kysely<KyselyDatabase>({
+ dialect: {
+ createAdapter: () => dialect.createAdapter(),
+ createDriver: () => new SavepointDriver(config),
+ createIntrospector: (k) => dialect.createIntrospector(k),
+ createQueryCompiler: () => dialect.createQueryCompiler()
+ }
+ });
+
+ // The tables' ids are globally unique, so every id is unique to this run.
+ const run = randomUUID().slice(0, 8);
+ const id = (name: string) => `t-${run}-${name}`;
+ const companyA = id("company-a");
+ const companyB = id("company-b");
+
+ // The NOT NULL columns each fixture table needs that the tests don't vary.
+ const required = {
+ inspection: (rowId: string): Row => ({
+ inspectionId: rowId,
+ itemId: id("item"),
+ lotSize: 1,
+ samplingStandard: "ANSI_Z1_4",
+ samplingPlanType: "All",
+ sampleSize: 1,
+ acceptanceNumber: 0,
+ rejectionNumber: 1,
+ sourceDocumentId: id("document")
+ }),
+ inspectionSamplingPlan: (): Row => ({
+ sampleSize: 1,
+ acceptanceNumber: 0,
+ rejectionNumber: 1
+ }),
+ inspectionFeature: (rowId: string): Row => ({
+ inspectionDocumentId: id("drawing"),
+ pageNumber: 1,
+ label: rowId
+ }),
+ gauge: (rowId: string): Row => ({ gaugeId: rowId }),
+ jobOperation: (): Row => ({ jobId: id("job"), processId: id("process") })
+ };
+
+ async function insert(table: keyof typeof required, rows: Row[]) {
+ for (const given of rows) {
+ const row: Row = {
+ ...required[table](String(given.id)),
+ createdBy: "system",
+ ...given
+ };
+ const columns = Object.keys(row);
+ await client.query(
+ `INSERT INTO "${table}" (${columns.map((c) => `"${c}"`).join(", ")})
+ VALUES (${columns.map((_, i) => `$${i + 1}`).join(", ")})`,
+ Object.values(row)
+ );
+ }
+ }
+
+ async function begin() {
+ await client.query("BEGIN");
+ await client.query("SET LOCAL session_replication_role = replica");
+ }
+
+ beforeAll(async () => {
+ await client.connect();
+ });
+
+ afterEach(async () => {
+ await client.query("ROLLBACK");
+ });
+
+ afterAll(async () => {
+ await client.end();
+ });
+
+ // ─── recordInspectionGauge ────────────────────────────────────────────────
+
+ describe("recordInspectionGauge", () => {
+ const lot = id("lot");
+ const plan = id("plan");
+
+ async function seed(status = "In Progress") {
+ await begin();
+ await insert("inspectionFeature", [
+ { id: id("ftr"), companyId: companyA, gaugeTypeId: id("gt-caliper") },
+ { id: id("ftr-any"), companyId: companyA, gaugeTypeId: null }
+ ]);
+ await insert("inspection", [
+ { id: lot, companyId: companyA, status, sourceDocument: "Receipt" },
+ {
+ id: id("lot-b"),
+ companyId: companyB,
+ status: "In Progress",
+ sourceDocument: "Receipt"
+ }
+ ]);
+ await insert("inspectionSamplingPlan", [
+ {
+ id: plan,
+ inspectionId: lot,
+ inspectionFeatureId: id("ftr"),
+ companyId: companyA
+ },
+ {
+ id: id("plan-any"),
+ inspectionId: lot,
+ inspectionFeatureId: id("ftr-any"),
+ companyId: companyA
+ },
+ {
+ id: id("plan-b"),
+ inspectionId: id("lot-b"),
+ inspectionFeatureId: id("ftr"),
+ companyId: companyB
+ }
+ ]);
+ await insert("gauge", [
+ {
+ id: id("caliper"),
+ companyId: companyA,
+ gaugeTypeId: id("gt-caliper")
+ },
+ {
+ id: id("mic"),
+ companyId: companyA,
+ gaugeTypeId: id("gt-micrometer")
+ },
+ {
+ id: id("retired"),
+ companyId: companyA,
+ gaugeTypeId: id("gt-caliper"),
+ gaugeStatus: "Inactive"
+ },
+ {
+ id: id("caliper-b"),
+ companyId: companyB,
+ gaugeTypeId: id("gt-caliper")
+ }
+ ]);
+ }
+
+ const record = (
+ gaugeId: string | null,
+ args: { inspectionId?: string; inspectionFeatureId?: string } = {}
+ ) =>
+ recordInspectionGauge(db, {
+ inspectionId: args.inspectionId ?? lot,
+ inspectionFeatureId: args.inspectionFeatureId ?? id("ftr"),
+ gaugeId,
+ companyId: companyA,
+ userId: "system"
+ });
+
+ // now() is the outer transaction's start, so "stamped by the database"
+ // reads as equal to it.
+ async function planRow(planId = plan) {
+ const { rows } = await client.query(
+ `SELECT "gaugeId",
+ "gaugeRecordedAt" IS NOT NULL AS "recorded",
+ "gaugeRecordedAt" = now() AS "recordedNow",
+ "updatedBy",
+ "updatedAt" = now() AS "updatedNow"
+ FROM "inspectionSamplingPlan" WHERE id = $1`,
+ [planId]
+ );
+ return rows[0];
+ }
+
+ it("records a gauge of the feature's required type, stamped now()", async () => {
+ await seed();
+ const result = await record(id("caliper"));
+ expect(result).toEqual({
+ data: { inspectionFeatureId: id("ftr"), gaugeId: id("caliper") },
+ error: null
+ });
+ expect(await planRow()).toEqual({
+ gaugeId: id("caliper"),
+ recorded: true,
+ recordedNow: true,
+ updatedBy: "system",
+ updatedNow: true
+ });
+ });
+
+ it("refuses a gauge of a different type", async () => {
+ await seed();
+ const result = await record(id("mic"));
+ expect(result.error?.message).toBe(
+ "Gauge is not of the type this feature requires"
+ );
+ expect((await planRow()).gaugeId).toBeNull();
+ });
+
+ it("accepts any type when the feature names none", async () => {
+ await seed();
+ const result = await record(id("mic"), {
+ inspectionFeatureId: id("ftr-any")
+ });
+ expect(result.error).toBeNull();
+ expect((await planRow(id("plan-any"))).gaugeId).toBe(id("mic"));
+ });
+
+ it("refuses an inactive gauge", async () => {
+ await seed();
+ const result = await record(id("retired"));
+ expect(result.error?.message).toBe("Gauge is inactive");
+ expect((await planRow()).gaugeId).toBeNull();
+ });
+
+ it("refuses another company's gauge", async () => {
+ await seed();
+ const result = await record(id("caliper-b"));
+ expect(result.error?.message).toBe("Gauge not found");
+ expect((await planRow()).gaugeId).toBeNull();
+ });
+
+ it("refuses another company's lot", async () => {
+ await seed();
+ const result = await record(id("caliper"), { inspectionId: id("lot-b") });
+ expect(result.error?.message).toBe("Inspection not found");
+ expect((await planRow(id("plan-b"))).gaugeId).toBeNull();
+ });
+
+ it("refuses a plan row that belongs to another company", async () => {
+ await seed();
+ await client.query(
+ `UPDATE "inspectionSamplingPlan" SET "companyId" = $1 WHERE id = $2`,
+ [companyB, plan]
+ );
+ const result = await record(id("caliper"));
+ expect(result.error?.message).toBe("Inspection feature not found");
+ expect((await planRow()).gaugeId).toBeNull();
+ });
+
+ it.each([
+ "Passed",
+ "Failed",
+ "Partial"
+ ])("refuses a %s (closed) lot", async (status) => {
+ await seed(status);
+ const result = await record(id("caliper"));
+ expect(result.error?.message).toBe("Inspection is closed");
+ expect((await planRow()).gaugeId).toBeNull();
+ });
+
+ it("clears the gauge and its recorded time", async () => {
+ await seed();
+ await record(id("caliper"));
+ const result = await record(null);
+ expect(result.error).toBeNull();
+ expect(await planRow()).toMatchObject({ gaugeId: null, recorded: false });
+ });
+ });
+
+ // ─── Deleting a recorded gauge (20261001022340) ───────────────────────────
+
+ describe("deleting a gauge recorded on a lot", () => {
+ const gauge = id("recorded");
+
+ // The delete's ON DELETE SET NULL re-checks every foreign key of a plan
+ // row inserted in this transaction, so these fixtures need a real company
+ // and feature behind them.
+ async function seed(status: string) {
+ await begin();
+ const { rows } = await client.query(`SELECT id FROM "company" LIMIT 1`);
+ const companyId = rows[0].id as string;
+ await insert("inspectionFeature", [{ id: id("ftr"), companyId }]);
+ await insert("inspection", [
+ { id: id("lot"), companyId, status, sourceDocument: "Receipt" }
+ ]);
+ await insert("inspectionSamplingPlan", [
+ {
+ id: id("plan"),
+ inspectionId: id("lot"),
+ inspectionFeatureId: id("ftr"),
+ companyId,
+ gaugeId: gauge
+ }
+ ]);
+ await insert("gauge", [
+ { id: gauge, companyId, gaugeTypeId: id("gt-caliper") }
+ ]);
+ // Fixtures go in with triggers off; the delete must run with them on.
+ await client.query("SET LOCAL session_replication_role = origin");
+ }
+
+ const deleteGauge = () =>
+ client.query(`DELETE FROM "gauge" WHERE id = $1`, [gauge]);
+
+ it.each([
+ "Passed",
+ "Failed",
+ "Partial"
+ ])("is refused when the lot is %s", async (status) => {
+ await seed(status);
+ await expect(deleteGauge()).rejects.toMatchObject({ code: "23503" });
+ });
+
+ it("clears the gauge from an open lot", async () => {
+ await seed("In Progress");
+ await deleteGauge();
+ const { rows } = await client.query(
+ `SELECT "gaugeId" FROM "inspectionSamplingPlan" WHERE id = $1`,
+ [id("plan")]
+ );
+ expect(rows[0].gaugeId).toBeNull();
+ });
+
+ it("lets a company wipe through", async () => {
+ await seed("Passed");
+ await client.query(`SET LOCAL "app.sync_in_progress" = 'true'`);
+ await expect(deleteGauge()).resolves.toMatchObject({ rowCount: 1 });
+ });
+ });
+
+ // ─── getRecentInspectionGauges ────────────────────────────────────────────
+
+ describe("getRecentInspectionGauges", () => {
+ const lathe = id("wc-lathe");
+ const mill = id("wc-mill");
+
+ let planSeq = 0;
+ const used = (
+ inspection: string,
+ gauge: string | null,
+ gaugeRecordedAt: string | null,
+ companyId = companyA
+ ): Row => {
+ planSeq++;
+ return {
+ id: id(`isp-${planSeq}`),
+ inspectionId: id(inspection),
+ inspectionFeatureId: id(`ftr-${planSeq}`),
+ companyId,
+ gaugeId: gauge && id(gauge),
+ gaugeRecordedAt
+ };
+ };
+
+ const lot = (
+ name: string,
+ companyId: string,
+ sourceDocument: "Job Operation" | "Receipt",
+ line: string
+ ): Row => ({
+ id: id(name),
+ companyId,
+ sourceDocument,
+ sourceDocumentLineId: id(line)
+ });
+
+ async function seed() {
+ await begin();
+ await insert("jobOperation", [
+ { id: id("op-lot"), companyId: companyA, workCenterId: lathe },
+ { id: id("op-lathe"), companyId: companyA, workCenterId: lathe },
+ { id: id("op-mill"), companyId: companyA, workCenterId: mill },
+ { id: id("op-nowc"), companyId: companyA, workCenterId: null },
+ // Another company's operations naming the same work center.
+ { id: id("op-b"), companyId: companyB, workCenterId: lathe },
+ { id: id("op-b2"), companyId: companyB, workCenterId: lathe }
+ ]);
+ await insert("inspection", [
+ lot("lot", companyA, "Job Operation", "op-lot"),
+ lot("lathe", companyA, "Job Operation", "op-lathe"),
+ lot("mill", companyA, "Job Operation", "op-mill"),
+ lot("nowc", companyA, "Job Operation", "op-nowc"),
+ lot("receipt-lot", companyA, "Receipt", "rl-1"),
+ lot("receipt", companyA, "Receipt", "rl-2"),
+ lot("lot-b", companyB, "Job Operation", "op-b"),
+ lot("receipt-b", companyB, "Receipt", "rl-3"),
+ // Our lot, on another company's lathe operation.
+ lot("cross-op", companyA, "Job Operation", "op-b2")
+ ]);
+ await insert("inspectionSamplingPlan", [
+ // Same work center: g-old was used first AND last, so it leads only
+ // when ordered by its most recent use.
+ used("lathe", "g-old", "2026-09-01T08:00:00Z"),
+ used("lathe", "g-new", "2026-09-03T08:00:00Z"),
+ used("lot", "g-old", "2026-09-04T08:00:00Z"),
+ used("lathe", null, null),
+ // Other stations.
+ used("mill", "g-mill", "2026-09-05T08:00:00Z"),
+ used("receipt", "g-receipt", "2026-09-06T08:00:00Z"),
+ used("nowc", "g-nowc", "2026-09-02T08:00:00Z"),
+ // Another company's plan row, on its own lathe lot.
+ used("lot-b", "g-b-plan", "2026-09-07T08:00:00Z", companyB),
+ // Our plan row, on another company's lathe lot.
+ used("lot-b", "g-b-lot", "2026-09-08T08:00:00Z"),
+ // Our lot whose operation is another company's lathe operation.
+ used("cross-op", "g-cross-op", "2026-09-09T08:00:00Z")
+ ]);
+ }
+
+ const recent = async (name: string) => {
+ const result = await getRecentInspectionGauges(db, {
+ inspectionId: id(name),
+ companyId: companyA
+ });
+ expect(result.error).toBeNull();
+ return result.data;
+ };
+
+ it("lists a Job Operation lot's work-center gauges, most recent use first", async () => {
+ await seed();
+ expect(await recent("lot")).toEqual([id("g-old"), id("g-new")]);
+ });
+
+ it("treats every receipt lot as one station", async () => {
+ await seed();
+ expect(await recent("receipt-lot")).toEqual([id("g-receipt")]);
+ });
+
+ it("has no history for an operation without a work center", async () => {
+ await seed();
+ expect(await recent("nowc")).toEqual([]);
+ });
+
+ it("has no station for a lot whose operation is another company's", async () => {
+ await seed();
+ expect(await recent("cross-op")).toEqual([]);
+ });
+
+ it("returns nothing for another company's lot", async () => {
+ await seed();
+ expect(await recent("receipt-b")).toEqual([]);
+ expect(await recent("lot-b")).toEqual([]);
+ });
+
+ it("keeps the newest gauges up to the limit", async () => {
+ await seed();
+ const days = Array.from(
+ { length: RECENT_INSPECTION_GAUGE_LIMIT + 2 },
+ (_, i) => 10 + i
+ );
+ await insert(
+ "inspectionSamplingPlan",
+ days.map((day) =>
+ used("receipt", `g-${day}`, `2026-09-${day}T08:00:00Z`)
+ )
+ );
+ expect(await recent("receipt-lot")).toEqual(
+ days
+ .slice(-RECENT_INSPECTION_GAUGE_LIMIT)
+ .reverse()
+ .map((day) => id(`g-${day}`))
+ );
+ });
+ });
+});
diff --git a/packages/database/src/quality.ts b/packages/database/src/quality.ts
index b7e4106e8f..f74d80fdb4 100644
--- a/packages/database/src/quality.ts
+++ b/packages/database/src/quality.ts
@@ -8,7 +8,7 @@
* its own `getDatabaseClient()` singleton). Kysely bypasses RLS — the calling
* route's `requirePermissions` is the auth gate.
*/
-import type { Transaction } from "kysely";
+import type { NotNull, Transaction } from "kysely";
import { sql } from "kysely";
import { getNextSequence } from "../supabase/functions/shared/get-next-sequence.ts";
@@ -1057,6 +1057,177 @@ export async function changeInspectionDocument(
}
}
+// -------------------------------------------------------------
+// 5b. recordInspectionGauge
+// -------------------------------------------------------------
+// Records (or clears) the gauge used to inspect one feature of a lot, on the
+// lot's per-feature plan row. When the feature names a gauge type, only a
+// gauge of that type is accepted. Inactive gauges are refused; calibration
+// status is shown to the inspector but does not block (the gauge's status is
+// the calibration program's call, not the inspector's).
+
+export async function recordInspectionGauge(
+ db: Kysely<KyselyDatabase>,
+ args: {
+ inspectionId: string;
+ inspectionFeatureId: string;
+ gaugeId: string | null;
+ companyId: string;
+ userId: string;
+ }
+): Promise<Result<{ inspectionFeatureId: string; gaugeId: string | null }>> {
+ try {
+ const result = await db.transaction().execute(async (trx) => {
+ const inspection = await trx
+ .selectFrom("inspection")
+ .select(["id", "status"])
+ .where("id", "=", args.inspectionId)
+ .where("companyId", "=", args.companyId)
+ .executeTakeFirst();
+ if (!inspection) throw new Error("Inspection not found");
+ if (isInspectionClosed(inspection.status)) {
+ throw new Error("Inspection is closed");
+ }
+
+ const plan = await trx
+ .selectFrom("inspectionSamplingPlan")
+ .innerJoin("inspectionFeature", (join) =>
+ join
+ .onRef(
+ "inspectionFeature.id",
+ "=",
+ "inspectionSamplingPlan.inspectionFeatureId"
+ )
+ .onRef(
+ "inspectionFeature.companyId",
+ "=",
+ "inspectionSamplingPlan.companyId"
+ )
+ )
+ .select(["inspectionSamplingPlan.id", "inspectionFeature.gaugeTypeId"])
+ .where("inspectionSamplingPlan.inspectionId", "=", args.inspectionId)
+ .where(
+ "inspectionSamplingPlan.inspectionFeatureId",
+ "=",
+ args.inspectionFeatureId
+ )
+ .where("inspectionSamplingPlan.companyId", "=", args.companyId)
+ .executeTakeFirst();
+ if (!plan) throw new Error("Inspection feature not found");
+
+ if (args.gaugeId) {
+ const gauge = await trx
+ .selectFrom("gauge")
+ .select(["id", "gaugeTypeId", "gaugeStatus"])
+ .where("id", "=", args.gaugeId)
+ .where("companyId", "=", args.companyId)
+ .executeTakeFirst();
+ if (!gauge) throw new Error("Gauge not found");
+ if (gauge.gaugeStatus === "Inactive") {
+ throw new Error("Gauge is inactive");
+ }
+ if (plan.gaugeTypeId && gauge.gaugeTypeId !== plan.gaugeTypeId) {
+ throw new Error("Gauge is not of the type this feature requires");
+ }
+ }
+
+ await trx
+ .updateTable("inspectionSamplingPlan")
+ .set({
+ gaugeId: args.gaugeId,
+ gaugeRecordedAt: args.gaugeId ? sql<string>`now()` : null,
+ updatedBy: args.userId,
+ updatedAt: sql<string>`now()`
+ })
+ .where("id", "=", plan.id)
+ .execute();
+
+ return {
+ inspectionFeatureId: args.inspectionFeatureId,
+ gaugeId: args.gaugeId
+ };
+ });
+
+ return { data: result, error: null };
+ } catch (err) {
+ return errResult(
+ err instanceof Error ? err.message : "Failed to record gauge"
+ );
+ }
+}
+
+// -------------------------------------------------------------
+// 5c. getRecentInspectionGauges
+// -------------------------------------------------------------
+// The gauges most recently recorded on inspections at the same "station" as
+// this lot, newest first — the execution view lists them above the rest. A Job
+// Operation lot's station is its operation's work center; receipts are one
+// station of their own. A work-centerless operation has no history.
+
+export const RECENT_INSPECTION_GAUGE_LIMIT = 10;
+
+export async function getRecentInspectionGauges(
+ db: Kysely<KyselyDatabase>,
+ args: { inspectionId: string; companyId: string }
+): Promise<Result<string[]>> {
+ try {
+ // One round trip: `lot` is this inspection, `used` is the inspection the
+ // gauge was recorded on, and each is joined to its operation's work center
+ // (null for a receipt lot).
+ const rows = await db
+ .selectFrom("inspectionSamplingPlan")
+ .innerJoin("inspection as used", (join) =>
+ join
+ .onRef("used.id", "=", "inspectionSamplingPlan.inspectionId")
+ .onRef("used.companyId", "=", "inspectionSamplingPlan.companyId")
+ )
+ .innerJoin("inspection as lot", (join) =>
+ join
+ .onRef("lot.sourceDocument", "=", "used.sourceDocument")
+ .on("lot.id", "=", args.inspectionId)
+ .on("lot.companyId", "=", args.companyId)
+ )
+ .leftJoin("jobOperation as usedOperation", (join) =>
+ join
+ .onRef("usedOperation.id", "=", "used.sourceDocumentLineId")
+ .onRef("usedOperation.companyId", "=", "used.companyId")
+ )
+ .leftJoin("jobOperation as lotOperation", (join) =>
+ join
+ .onRef("lotOperation.id", "=", "lot.sourceDocumentLineId")
+ .onRef("lotOperation.companyId", "=", "lot.companyId")
+ )
+ .select("inspectionSamplingPlan.gaugeId")
+ .where("inspectionSamplingPlan.companyId", "=", args.companyId)
+ .where("inspectionSamplingPlan.gaugeId", "is not", null)
+ .where("inspectionSamplingPlan.gaugeRecordedAt", "is not", null)
+ .where((eb) =>
+ eb.or([
+ eb("lot.sourceDocument", "=", "Receipt"),
+ eb(
+ "usedOperation.workCenterId",
+ "=",
+ eb.ref("lotOperation.workCenterId")
+ )
+ ])
+ )
+ .groupBy("inspectionSamplingPlan.gaugeId")
+ .orderBy(
+ (eb) => eb.fn.max("inspectionSamplingPlan.gaugeRecordedAt"),
+ "desc"
+ )
+ .limit(RECENT_INSPECTION_GAUGE_LIMIT)
+ .$narrowType<{ gaugeId: NotNull }>()
+ .execute();
+
+ return { data: rows.map((row) => row.gaugeId), error: null };
+ } catch (err) {
+ return errResult(
+ err instanceof Error ? err.message : "Failed to load recent gauges"
+ );
+ }
+}
+
// -------------------------------------------------------------
// 6. getOrCreateJobOperationInspection
// -------------------------------------------------------------
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index 816919e39a..72b79d7547 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -54102,6 +54102,9 @@ export default {
{
$ref: "#/parameters/rowFilter.inspectionFeature.samplingSeverity"
},
+ {
+ $ref: "#/parameters/rowFilter.inspectionFeature.gaugeTypeId"
+ },
{
$ref: "#/parameters/select"
},
@@ -54224,6 +54227,9 @@ export default {
{
$ref: "#/parameters/rowFilter.inspectionFeature.samplingSeverity"
},
+ {
+ $ref: "#/parameters/rowFilter.inspectionFeature.gaugeTypeId"
+ },
{
$ref: "#/parameters/preferReturn"
}
@@ -54300,6 +54306,9 @@ export default {
{
$ref: "#/parameters/rowFilter.inspectionFeature.samplingSeverity"
},
+ {
+ $ref: "#/parameters/rowFilter.inspectionFeature.gaugeTypeId"
+ },
{
$ref: "#/parameters/body.inspectionFeature"
},
@@ -78102,6 +78111,12 @@ export default {
{
$ref: "#/parameters/rowFilter.inspectionSamplingPlan.updatedAt"
},
+ {
+ $ref: "#/parameters/rowFilter.inspectionSamplingPlan.gaugeId"
+ },
+ {
+ $ref: "#/parameters/rowFilter.inspectionSamplingPlan.gaugeRecordedAt"
+ },
{
$ref: "#/parameters/select"
},
@@ -78197,6 +78212,12 @@ export default {
{
$ref: "#/parameters/rowFilter.inspectionSamplingPlan.updatedAt"
},
+ {
+ $ref: "#/parameters/rowFilter.inspectionSamplingPlan.gaugeId"
+ },
+ {
+ $ref: "#/parameters/rowFilter.inspectionSamplingPlan.gaugeRecordedAt"
+ },
{
$ref: "#/parameters/preferReturn"
}
@@ -78246,6 +78267,12 @@ export default {
{
$ref: "#/parameters/rowFilter.inspectionSamplingPlan.updatedAt"
},
+ {
+ $ref: "#/parameters/rowFilter.inspectionSamplingPlan.gaugeId"
+ },
+ {
+ $ref: "#/parameters/rowFilter.inspectionSamplingPlan.gaugeRecordedAt"
+ },
{
$ref: "#/parameters/body.inspectionSamplingPlan"
},
@@ -132410,6 +132437,12 @@ export default {
enum: ["Normal", "Tightened", "Reduced"],
format: 'public."inspectionSeverity"',
type: "string"
+ },
+ gaugeTypeId: {
+ description:
+ "Note:\nThis is a Foreign Key to `gaugeType.id`.<fk table='gaugeType' column='id'/>",
+ format: "text",
+ type: "string"
}
},
type: "object"
@@ -143650,6 +143683,16 @@ export default {
updatedAt: {
format: "timestamp with time zone",
type: "string"
+ },
+ gaugeId: {
+ description:
+ "Note:\nThis is a Foreign Key to `gauge.id`.<fk table='gauge' column='id'/>",
+ format: "text",
+ type: "string"
+ },
+ gaugeRecordedAt: {
+ format: "timestamp with time zone",
+ type: "string"
}
},
type: "object"
@@ -180240,6 +180283,12 @@ export default {
in: "query",
type: "string"
},
+ "rowFilter.inspectionFeature.gaugeTypeId": {
+ name: "gaugeTypeId",
+ required: false,
+ in: "query",
+ type: "string"
+ },
"body.itarCertification": {
name: "itarCertification",
description: "itarCertification",
@@ -192705,6 +192754,18 @@ export default {
in: "query",
type: "string"
},
+ "rowFilter.inspectionSamplingPlan.gaugeId": {
+ name: "gaugeId",
+ required: false,
+ in: "query",
+ type: "string"
+ },
+ "rowFilter.inspectionSamplingPlan.gaugeRecordedAt": {
+ name: "gaugeRecordedAt",
+ required: false,
+ in: "query",
+ type: "string"
+ },
"body.customerTax": {
name: "customerTax",
description: "customerTax",
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index ed723ce0b2..4f7961d104 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -19254,6 +19254,7 @@ export type Database = {
createdAt: string
createdBy: string
description: string | null
+ gaugeTypeId: string | null
id: string
inspectionDocumentId: string
label: string
@@ -19283,6 +19284,7 @@ export type Database = {
createdAt?: string
createdBy: string
description?: string | null
+ gaugeTypeId?: string | null
id?: string
inspectionDocumentId: string
label: string
@@ -19312,6 +19314,7 @@ export type Database = {
createdAt?: string
createdBy?: string
description?: string | null
+ gaugeTypeId?: string | null
id?: string
inspectionDocumentId?: string
label?: string
@@ -19414,6 +19417,13 @@ export type Database = {
referencedRelation: "inspectionDocuments"
referencedColumns: ["id", "companyId"]
},
+ {
+ foreignKeyName: "inspectionFeature_gaugeTypeId_fkey"
+ columns: ["gaugeTypeId"]
+ isOneToOne: false
+ referencedRelation: "gaugeType"
+ referencedColumns: ["id"]
+ },
{
foreignKeyName: "inspectionFeature_updatedBy_fkey"
columns: ["updatedBy"]
@@ -20087,6 +20097,8 @@ export type Database = {
companyId: string
createdAt: string
createdBy: string
+ gaugeId: string | null
+ gaugeRecordedAt: string | null
id: string
inspectionFeatureId: string
inspectionId: string
@@ -20101,6 +20113,8 @@ export type Database = {
companyId: string
createdAt?: string
createdBy: string
+ gaugeId?: string | null
+ gaugeRecordedAt?: string | null
id?: string
inspectionFeatureId: string
inspectionId: string
@@ -20115,6 +20129,8 @@ export type Database = {
companyId?: string
createdAt?: string
createdBy?: string
+ gaugeId?: string | null
+ gaugeRecordedAt?: string | null
id?: string
inspectionFeatureId?: string
inspectionId?: string
@@ -20235,6 +20251,20 @@ export type Database = {
isOneToOne: false
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "inspectionSamplingPlan_gaugeId_fkey"
+ columns: ["gaugeId"]
+ isOneToOne: false
+ referencedRelation: "gauge"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "inspectionSamplingPlan_gaugeId_fkey"
+ columns: ["gaugeId"]
+ isOneToOne: false
+ referencedRelation: "gauges"
+ referencedColumns: ["id"]
}
]
}
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index ed723ce0b2..4f7961d104 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -19254,6 +19254,7 @@ export type Database = {
createdAt: string
createdBy: string
description: string | null
+ gaugeTypeId: string | null
id: string
inspectionDocumentId: string
label: string
@@ -19283,6 +19284,7 @@ export type Database = {
createdAt?: string
createdBy: string
description?: string | null
+ gaugeTypeId?: string | null
id?: string
inspectionDocumentId: string
label: string
@@ -19312,6 +19314,7 @@ export type Database = {
createdAt?: string
createdBy?: string
description?: string | null
+ gaugeTypeId?: string | null
id?: string
inspectionDocumentId?: string
label?: string
@@ -19414,6 +19417,13 @@ export type Database = {
referencedRelation: "inspectionDocuments"
referencedColumns: ["id", "companyId"]
},
+ {
+ foreignKeyName: "inspectionFeature_gaugeTypeId_fkey"
+ columns: ["gaugeTypeId"]
+ isOneToOne: false
+ referencedRelation: "gaugeType"
+ referencedColumns: ["id"]
+ },
{
foreignKeyName: "inspectionFeature_updatedBy_fkey"
columns: ["updatedBy"]
@@ -20087,6 +20097,8 @@ export type Database = {
companyId: string
createdAt: string
createdBy: string
+ gaugeId: string | null
+ gaugeRecordedAt: string | null
id: string
inspectionFeatureId: string
inspectionId: string
@@ -20101,6 +20113,8 @@ export type Database = {
companyId: string
createdAt?: string
createdBy: string
+ gaugeId?: string | null
+ gaugeRecordedAt?: string | null
id?: string
inspectionFeatureId: string
inspectionId: string
@@ -20115,6 +20129,8 @@ export type Database = {
companyId?: string
createdAt?: string
createdBy?: string
+ gaugeId?: string | null
+ gaugeRecordedAt?: string | null
id?: string
inspectionFeatureId?: string
inspectionId?: string
@@ -20235,6 +20251,20 @@ export type Database = {
isOneToOne: false
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "inspectionSamplingPlan_gaugeId_fkey"
+ columns: ["gaugeId"]
+ isOneToOne: false
+ referencedRelation: "gauge"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "inspectionSamplingPlan_gaugeId_fkey"
+ columns: ["gaugeId"]
+ isOneToOne: false
+ referencedRelation: "gauges"
+ referencedColumns: ["id"]
}
]
}
diff --git a/packages/database/supabase/migrations/20260929203517_inspection-gauges.sql b/packages/database/supabase/migrations/20260929203517_inspection-gauges.sql
new file mode 100644
index 0000000000..3e3453a83b
--- /dev/null
+++ b/packages/database/supabase/migrations/20260929203517_inspection-gauges.sql
@@ -0,0 +1,379 @@
+-- Gauges on inspections.
+--
+-- 1. An inspection plan feature may name the gauge TYPE it must be measured
+-- with (optional). When set, the execution view only offers gauges of that
+-- type.
+-- 2. The gauge actually used is recorded per lot x feature on the lot's
+-- per-feature plan row (`inspectionSamplingPlan`), with the time it was
+-- recorded — the execution view sorts gauges by how recently they were
+-- used at the same work center (receipts count as their own work center).
+--
+-- Both references SET NULL on delete, like the lot's `inspectionDocumentId`.
+
+ALTER TABLE "inspectionFeature"
+ ADD COLUMN IF NOT EXISTS "gaugeTypeId" TEXT;
+
+DO $$ BEGIN
+ ALTER TABLE "inspectionFeature"
+ ADD CONSTRAINT "inspectionFeature_gaugeTypeId_fkey"
+ FOREIGN KEY ("gaugeTypeId") REFERENCES "gaugeType"("id")
+ ON DELETE SET NULL ON UPDATE CASCADE;
+EXCEPTION WHEN duplicate_object THEN NULL; END $$;
+
+CREATE INDEX IF NOT EXISTS "inspectionFeature_gaugeTypeId_idx"
+ ON "inspectionFeature" ("gaugeTypeId");
+
+ALTER TABLE "inspectionSamplingPlan"
+ ADD COLUMN IF NOT EXISTS "gaugeId" TEXT,
+ ADD COLUMN IF NOT EXISTS "gaugeRecordedAt" TIMESTAMP WITH TIME ZONE;
+
+DO $$ BEGIN
+ ALTER TABLE "inspectionSamplingPlan"
+ ADD CONSTRAINT "inspectionSamplingPlan_gaugeId_fkey"
+ FOREIGN KEY ("gaugeId") REFERENCES "gauge"("id")
+ ON DELETE SET NULL ON UPDATE CASCADE;
+EXCEPTION WHEN duplicate_object THEN NULL; END $$;
+
+CREATE INDEX IF NOT EXISTS "inspectionSamplingPlan_gaugeId_idx"
+ ON "inspectionSamplingPlan" ("gaugeId");
+
+-- Fork save_inspection_document_atomic (newest prior definition:
+-- 20260722040401_inbound-inspection-execution.sql) to persist
+-- "gaugeTypeId". Signature is unchanged, so CREATE OR REPLACE suffices.
+-- Body preserved verbatim apart from: the gauge-type tenant check, the column
+-- in the feature create INSERT, the feature update SET, and the returned
+-- features payload.
+CREATE OR REPLACE FUNCTION save_inspection_document_atomic(
+ p_inspection_document_id TEXT,
+ p_company_id TEXT,
+ p_user_id TEXT,
+ p_pdf_url TEXT DEFAULT NULL,
+ p_page_count INTEGER DEFAULT NULL,
+ p_default_page_width DOUBLE PRECISION DEFAULT NULL,
+ p_default_page_height DOUBLE PRECISION DEFAULT NULL,
+ p_features JSONB DEFAULT '{}'::jsonb,
+ p_balloons JSONB DEFAULT '{}'::jsonb
+)
+RETURNS JSONB
+LANGUAGE plpgsql
+AS $$
+DECLARE
+ v_document RECORD;
+ v_storage_path TEXT;
+ v_features_create JSONB := COALESCE(p_features->'create', '[]'::jsonb);
+ v_features_update JSONB := COALESCE(p_features->'update', '[]'::jsonb);
+ v_features_delete JSONB := COALESCE(p_features->'delete', '[]'::jsonb);
+ v_balloons_create JSONB := COALESCE(p_balloons->'create', '[]'::jsonb);
+ v_balloons_update JSONB := COALESCE(p_balloons->'update', '[]'::jsonb);
+ v_balloons_delete JSONB := COALESCE(p_balloons->'delete', '[]'::jsonb);
+ v_item JSONB;
+ v_temp_id TEXT;
+ v_feature_id TEXT;
+ v_balloon_id TEXT;
+ v_feature_id_map JSONB := '{}'::jsonb;
+ v_balloon_anchor_id_map JSONB := '{}'::jsonb;
+BEGIN
+ SELECT *
+ INTO v_document
+ FROM "inspectionDocument"
+ WHERE "id" = p_inspection_document_id
+ FOR UPDATE;
+
+ IF NOT FOUND THEN
+ RAISE EXCEPTION 'Inspection document not found';
+ END IF;
+
+ IF v_document."companyId" <> p_company_id THEN
+ RAISE EXCEPTION 'Inspection document does not belong to this company';
+ END IF;
+
+ -- A feature's gauge type must be one of this company's gauge types (the FK
+ -- alone would accept another tenant's id).
+ IF EXISTS (
+ SELECT 1
+ FROM jsonb_array_elements(v_features_create || v_features_update) AS f(value)
+ WHERE NULLIF(f.value->>'gaugeTypeId', '') IS NOT NULL
+ AND NOT EXISTS (
+ SELECT 1 FROM "gaugeType" gt
+ WHERE gt."id" = f.value->>'gaugeTypeId'
+ AND gt."companyId" = p_company_id
+ )
+ ) THEN
+ RAISE EXCEPTION 'Gauge type does not belong to this company';
+ END IF;
+
+ v_storage_path := NULLIF(
+ regexp_replace(COALESCE(p_pdf_url, ''), '^/file/preview/private/', ''),
+ ''
+ );
+
+ UPDATE "inspectionDocument"
+ SET
+ "storagePath" = CASE
+ WHEN v_storage_path IS NOT NULL THEN v_storage_path
+ ELSE "storagePath"
+ END,
+ "fileName" = CASE
+ WHEN v_storage_path IS NOT NULL THEN split_part(v_storage_path, '/', array_length(string_to_array(v_storage_path, '/'), 1))
+ ELSE "fileName"
+ END,
+ "uploadedBy" = CASE
+ WHEN v_storage_path IS NOT NULL THEN p_user_id
+ ELSE "uploadedBy"
+ END,
+ "pageCount" = CASE
+ WHEN p_page_count IS NOT NULL AND p_page_count > 0 THEN p_page_count
+ ELSE "pageCount"
+ END,
+ "defaultPageWidth" = CASE
+ WHEN p_default_page_width IS NOT NULL AND p_default_page_width > 0 THEN p_default_page_width
+ ELSE "defaultPageWidth"
+ END,
+ "defaultPageHeight" = CASE
+ WHEN p_default_page_height IS NOT NULL AND p_default_page_height > 0 THEN p_default_page_height
+ ELSE "defaultPageHeight"
+ END,
+ "updatedBy" = p_user_id,
+ "updatedAt" = NOW()
+ WHERE "id" = p_inspection_document_id
+ AND "companyId" = p_company_id;
+
+ IF jsonb_array_length(v_features_delete) > 0 THEN
+ DELETE FROM "inspectionFeature"
+ WHERE "id" = ANY (
+ SELECT jsonb_array_elements_text(v_features_delete)
+ )
+ AND "inspectionDocumentId" = p_inspection_document_id
+ AND "companyId" = p_company_id;
+ END IF;
+
+ IF jsonb_array_length(v_balloons_delete) > 0 THEN
+ DELETE FROM "balloon"
+ WHERE "id" = ANY (
+ SELECT jsonb_array_elements_text(v_balloons_delete)
+ )
+ AND "inspectionDocumentId" = p_inspection_document_id
+ AND "companyId" = p_company_id;
+ END IF;
+
+ FOR v_item IN SELECT value FROM jsonb_array_elements(v_features_create)
+ LOOP
+ INSERT INTO "inspectionFeature" (
+ "inspectionDocumentId",
+ "companyId",
+ "pageNumber",
+ "label",
+ "description",
+ "nominalValue",
+ "tolerancePlus",
+ "toleranceMinus",
+ "unit",
+ "type",
+ "samplingPlanType",
+ "samplingSampleSize",
+ "samplingPercentage",
+ "samplingAql",
+ "samplingInspectionLevel",
+ "samplingSeverity",
+ "gaugeTypeId",
+ "createdBy",
+ "updatedBy"
+ ) VALUES (
+ p_inspection_document_id,
+ p_company_id,
+ COALESCE((v_item->>'pageNumber')::INTEGER, 1),
+ COALESCE(v_item->>'label', ''),
+ CASE WHEN v_item ? 'description' THEN v_item->>'description' ELSE NULL END,
+ CASE WHEN v_item ? 'nominalValue' THEN v_item->>'nominalValue' ELSE NULL END,
+ CASE WHEN v_item ? 'tolerancePlus' THEN v_item->>'tolerancePlus' ELSE NULL END,
+ CASE WHEN v_item ? 'toleranceMinus' THEN v_item->>'toleranceMinus' ELSE NULL END,
+ CASE WHEN v_item ? 'unit' THEN v_item->>'unit' ELSE NULL END,
+ COALESCE((v_item->>'type')::"procedureStepType", 'Measurement'::"procedureStepType"),
+ CASE WHEN v_item ? 'samplingPlanType' THEN NULLIF(v_item->>'samplingPlanType', '')::"samplingPlanType" ELSE NULL END,
+ CASE WHEN v_item ? 'samplingSampleSize' THEN (v_item->>'samplingSampleSize')::INTEGER ELSE NULL END,
+ CASE WHEN v_item ? 'samplingPercentage' THEN (v_item->>'samplingPercentage')::NUMERIC ELSE NULL END,
+ CASE WHEN v_item ? 'samplingAql' THEN (v_item->>'samplingAql')::NUMERIC ELSE NULL END,
+ CASE WHEN v_item ? 'samplingInspectionLevel' THEN NULLIF(v_item->>'samplingInspectionLevel', '')::"inspectionLevel" ELSE NULL END,
+ CASE WHEN v_item ? 'samplingSeverity' THEN NULLIF(v_item->>'samplingSeverity', '')::"inspectionSeverity" ELSE NULL END,
+ CASE WHEN v_item ? 'gaugeTypeId' THEN NULLIF(v_item->>'gaugeTypeId', '') ELSE NULL END,
+ p_user_id,
+ p_user_id
+ )
+ RETURNING "id" INTO v_feature_id;
+
+ v_temp_id := v_item->>'tempId';
+ IF v_temp_id IS NOT NULL AND length(v_temp_id) > 0 THEN
+ v_feature_id_map := v_feature_id_map || jsonb_build_object(v_temp_id, v_feature_id);
+ END IF;
+ END LOOP;
+
+ FOR v_item IN SELECT value FROM jsonb_array_elements(v_balloons_create)
+ LOOP
+ v_feature_id := NULL;
+ IF v_item ? 'inspectionFeatureId' THEN
+ v_feature_id := v_item->>'inspectionFeatureId';
+ ELSIF v_item ? 'tempInspectionFeatureId' THEN
+ v_temp_id := v_item->>'tempInspectionFeatureId';
+ IF v_feature_id_map ? v_temp_id THEN
+ v_feature_id := v_feature_id_map->>v_temp_id;
+ END IF;
+ END IF;
+
+ IF v_feature_id IS NULL OR length(v_feature_id) = 0 THEN
+ RAISE EXCEPTION 'balloon create requires inspectionFeatureId or tempInspectionFeatureId';
+ END IF;
+
+ INSERT INTO "balloon" (
+ "inspectionDocumentId",
+ "companyId",
+ "inspectionFeatureId",
+ "pageNumber",
+ "regionX",
+ "regionY",
+ "regionWidth",
+ "regionHeight",
+ "xCoordinate",
+ "yCoordinate",
+ "createdBy",
+ "updatedBy"
+ ) VALUES (
+ p_inspection_document_id,
+ p_company_id,
+ v_feature_id,
+ COALESCE((v_item->>'pageNumber')::INTEGER, 1),
+ COALESCE((v_item->>'regionX')::DOUBLE PRECISION, 0),
+ COALESCE((v_item->>'regionY')::DOUBLE PRECISION, 0),
+ COALESCE((v_item->>'regionWidth')::DOUBLE PRECISION, 0.1),
+ COALESCE((v_item->>'regionHeight')::DOUBLE PRECISION, 0.1),
+ COALESCE((v_item->>'xCoordinate')::DOUBLE PRECISION, 0),
+ COALESCE((v_item->>'yCoordinate')::DOUBLE PRECISION, 0),
+ p_user_id,
+ p_user_id
+ )
+ RETURNING "id" INTO v_balloon_id;
+
+ v_temp_id := v_item->>'tempBalloonAnchorId';
+ IF v_temp_id IS NOT NULL AND length(v_temp_id) > 0 THEN
+ v_balloon_anchor_id_map := v_balloon_anchor_id_map || jsonb_build_object(v_temp_id, v_balloon_id);
+ END IF;
+ END LOOP;
+
+ FOR v_item IN SELECT value FROM jsonb_array_elements(v_features_update)
+ LOOP
+ UPDATE "inspectionFeature"
+ SET
+ "pageNumber" = CASE WHEN v_item ? 'pageNumber' THEN (v_item->>'pageNumber')::INTEGER ELSE "pageNumber" END,
+ "label" = CASE WHEN v_item ? 'label' THEN v_item->>'label' ELSE "label" END,
+ "description" = CASE WHEN v_item ? 'description' THEN v_item->>'description' ELSE "description" END,
+ "nominalValue" = CASE WHEN v_item ? 'nominalValue' THEN v_item->>'nominalValue' ELSE "nominalValue" END,
+ "tolerancePlus" = CASE WHEN v_item ? 'tolerancePlus' THEN v_item->>'tolerancePlus' ELSE "tolerancePlus" END,
+ "toleranceMinus" = CASE WHEN v_item ? 'toleranceMinus' THEN v_item->>'toleranceMinus' ELSE "toleranceMinus" END,
+ "unit" = CASE WHEN v_item ? 'unit' THEN v_item->>'unit' ELSE "unit" END,
+ "type" = CASE WHEN v_item ? 'type' THEN (v_item->>'type')::"procedureStepType" ELSE "type" END,
+ "samplingPlanType" = CASE WHEN v_item ? 'samplingPlanType' THEN NULLIF(v_item->>'samplingPlanType', '')::"samplingPlanType" ELSE "samplingPlanType" END,
+ "samplingSampleSize" = CASE WHEN v_item ? 'samplingSampleSize' THEN (v_item->>'samplingSampleSize')::INTEGER ELSE "samplingSampleSize" END,
+ "samplingPercentage" = CASE WHEN v_item ? 'samplingPercentage' THEN (v_item->>'samplingPercentage')::NUMERIC ELSE "samplingPercentage" END,
+ "samplingAql" = CASE WHEN v_item ? 'samplingAql' THEN (v_item->>'samplingAql')::NUMERIC ELSE "samplingAql" END,
+ "samplingInspectionLevel" = CASE WHEN v_item ? 'samplingInspectionLevel' THEN NULLIF(v_item->>'samplingInspectionLevel', '')::"inspectionLevel" ELSE "samplingInspectionLevel" END,
+ "samplingSeverity" = CASE WHEN v_item ? 'samplingSeverity' THEN NULLIF(v_item->>'samplingSeverity', '')::"inspectionSeverity" ELSE "samplingSeverity" END,
+ "gaugeTypeId" = CASE WHEN v_item ? 'gaugeTypeId' THEN NULLIF(v_item->>'gaugeTypeId', '') ELSE "gaugeTypeId" END,
+ "updatedBy" = p_user_id,
+ "updatedAt" = NOW()
+ WHERE "id" = v_item->>'id'
+ AND "inspectionDocumentId" = p_inspection_document_id
+ AND "companyId" = p_company_id;
+ END LOOP;
+
+ FOR v_item IN SELECT value FROM jsonb_array_elements(v_balloons_update)
+ LOOP
+ UPDATE "balloon"
+ SET
+ "pageNumber" = CASE WHEN v_item ? 'pageNumber' THEN (v_item->>'pageNumber')::INTEGER ELSE "pageNumber" END,
+ "regionX" = CASE WHEN v_item ? 'regionX' THEN (v_item->>'regionX')::DOUBLE PRECISION ELSE "regionX" END,
+ "regionY" = CASE WHEN v_item ? 'regionY' THEN (v_item->>'regionY')::DOUBLE PRECISION ELSE "regionY" END,
+ "regionWidth" = CASE WHEN v_item ? 'regionWidth' THEN (v_item->>'regionWidth')::DOUBLE PRECISION ELSE "regionWidth" END,
+ "regionHeight" = CASE WHEN v_item ? 'regionHeight' THEN (v_item->>'regionHeight')::DOUBLE PRECISION ELSE "regionHeight" END,
+ "xCoordinate" = CASE WHEN v_item ? 'xCoordinate' THEN (v_item->>'xCoordinate')::DOUBLE PRECISION ELSE "xCoordinate" END,
+ "yCoordinate" = CASE WHEN v_item ? 'yCoordinate' THEN (v_item->>'yCoordinate')::DOUBLE PRECISION ELSE "yCoordinate" END,
+ "updatedBy" = p_user_id,
+ "updatedAt" = NOW()
+ WHERE "id" = v_item->>'id'
+ AND "inspectionDocumentId" = p_inspection_document_id
+ AND "companyId" = p_company_id;
+ END LOOP;
+
+ RETURN jsonb_build_object(
+ 'success', true,
+ 'featureIdMap', v_feature_id_map,
+ 'balloonAnchorIdMap', v_balloon_anchor_id_map,
+ 'features', COALESCE((
+ SELECT jsonb_agg(jsonb_build_object(
+ 'id', f."id",
+ 'inspectionDocumentId', f."inspectionDocumentId",
+ 'companyId', f."companyId",
+ 'pageNumber', f."pageNumber",
+ 'label', f."label",
+ 'description', f."description",
+ 'nominalValue', f."nominalValue",
+ 'tolerancePlus', f."tolerancePlus",
+ 'toleranceMinus', f."toleranceMinus",
+ 'unit', f."unit",
+ 'type', f."type",
+ 'samplingPlanType', f."samplingPlanType",
+ 'samplingSampleSize', f."samplingSampleSize",
+ 'samplingPercentage', f."samplingPercentage",
+ 'samplingAql', f."samplingAql",
+ 'samplingInspectionLevel', f."samplingInspectionLevel",
+ 'samplingSeverity', f."samplingSeverity",
+ 'gaugeTypeId', f."gaugeTypeId",
+ 'balloonId', b."id",
+ 'createdBy', f."createdBy",
+ 'updatedBy', f."updatedBy",
+ 'createdAt', f."createdAt",
+ 'updatedAt', f."updatedAt"
+ ) ORDER BY f."createdAt" ASC)
+ FROM "inspectionFeature" f
+ LEFT JOIN "balloon" b
+ ON b."inspectionFeatureId" = f."id"
+ AND b."companyId" = f."companyId"
+ WHERE f."inspectionDocumentId" = p_inspection_document_id
+ AND f."companyId" = p_company_id
+ ), '[]'::jsonb),
+ 'balloons', COALESCE((
+ SELECT jsonb_agg(jsonb_build_object(
+ 'id', b."id",
+ 'inspectionDocumentId', b."inspectionDocumentId",
+ 'companyId', b."companyId",
+ 'inspectionFeatureId', b."inspectionFeatureId",
+ 'pageNumber', b."pageNumber",
+ 'regionX', b."regionX",
+ 'regionY', b."regionY",
+ 'regionWidth', b."regionWidth",
+ 'regionHeight', b."regionHeight",
+ 'xCoordinate', b."xCoordinate",
+ 'yCoordinate', b."yCoordinate",
+ 'createdBy', b."createdBy",
+ 'updatedBy', b."updatedBy",
+ 'createdAt', b."createdAt",
+ 'updatedAt', b."updatedAt"
+ ) ORDER BY b."createdAt" ASC)
+ FROM "balloon" b
+ WHERE b."inspectionDocumentId" = p_inspection_document_id
+ AND b."companyId" = p_company_id
+ ), '[]'::jsonb),
+ 'anchors', COALESCE((
+ SELECT jsonb_agg(jsonb_build_object(
+ 'id', b."id",
+ 'pageNumber', b."pageNumber",
+ 'xCoordinate', b."regionX",
+ 'yCoordinate', b."regionY",
+ 'width', b."regionWidth",
+ 'height', b."regionHeight"
+ ) ORDER BY b."createdAt" ASC)
+ FROM "balloon" b
+ WHERE b."inspectionDocumentId" = p_inspection_document_id
+ AND b."companyId" = p_company_id
+ ), '[]'::jsonb)
+ );
+END;
+$$;
diff --git a/packages/database/supabase/migrations/20261001022340_inspection-gauge-history.sql b/packages/database/supabase/migrations/20261001022340_inspection-gauge-history.sql
new file mode 100644
index 0000000000..6b90b97c60
--- /dev/null
+++ b/packages/database/supabase/migrations/20261001022340_inspection-gauge-history.sql
@@ -0,0 +1,51 @@
+-- A closed inspection lot keeps the gauge it was measured with.
+--
+-- `inspectionSamplingPlan.gaugeId` is ON DELETE SET NULL, and deleting a gauge
+-- type cascades to its gauges, so deleting either one silently erased the gauge
+-- from every Passed / Failed / Partial lot. That record is exactly what a
+-- calibration recall reads ("which lots did gauge X measure?").
+--
+-- Refuse to delete a gauge recorded on a closed lot; a retired gauge is set
+-- Inactive instead. Open lots keep SET NULL: their inspector simply picks again.
+-- A gauge-type delete reaches this trigger through its cascade, so it is refused
+-- the same way.
+--
+-- A company wipe (template apply / backup restore) sets
+-- `app.sync_in_progress` or deletes the lot's plan rows before its gauges, so it
+-- is never blocked.
+
+CREATE OR REPLACE FUNCTION prevent_deleting_gauge_recorded_on_closed_inspection()
+RETURNS TRIGGER
+LANGUAGE plpgsql
+AS $$
+BEGIN
+ IF current_setting('app.sync_in_progress', true) = 'true' THEN
+ RETURN OLD;
+ END IF;
+
+ IF EXISTS (
+ SELECT 1
+ FROM "inspectionSamplingPlan" p
+ JOIN "inspection" i
+ ON i."id" = p."inspectionId"
+ AND i."companyId" = p."companyId"
+ WHERE p."gaugeId" = OLD."id"
+ AND p."companyId" = OLD."companyId"
+ AND i."status" IN ('Passed', 'Failed', 'Partial')
+ ) THEN
+ RAISE EXCEPTION 'Gauge % was used on a closed inspection. Set it to Inactive instead of deleting it.',
+ COALESCE(OLD."gaugeId", OLD."id")
+ USING ERRCODE = 'foreign_key_violation';
+ END IF;
+
+ RETURN OLD;
+END;
+$$;
+
+DROP TRIGGER IF EXISTS "prevent_deleting_gauge_recorded_on_closed_inspection"
+ ON "gauge";
+
+CREATE TRIGGER "prevent_deleting_gauge_recorded_on_closed_inspection"
+ BEFORE DELETE ON "gauge"
+ FOR EACH ROW
+ EXECUTE FUNCTION prevent_deleting_gauge_recorded_on_closed_inspection();
diff --git a/packages/database/supabase/migrations/20261001022635_inspection-plan-client-ids.sql b/packages/database/supabase/migrations/20261001022635_inspection-plan-client-ids.sql
new file mode 100644
index 0000000000..1412cbbdf8
--- /dev/null
+++ b/packages/database/supabase/migrations/20261001022635_inspection-plan-client-ids.sql
@@ -0,0 +1,351 @@
+-- The inspection plan editor mints its own ids for new characteristics and
+-- balloons, so a row keeps one id from the moment it is drawn: the editor no
+-- longer has to re-point rows, selections and in-flight work from temp ids to
+-- the ids a save returns.
+--
+-- Fork of save_inspection_document_atomic (newest prior definition:
+-- 20260929203517_inspection-gauges.sql). Body preserved verbatim apart from the
+-- two INSERTs, which now take the item's "id" when one is sent and fall back to
+-- the column default otherwise. Callers that still send tempId /
+-- tempBalloonAnchorId get the same id maps back as before. A caller-chosen id
+-- that collides with an existing row fails the INSERT (primary key), so it can
+-- never overwrite anything.
+
+CREATE OR REPLACE FUNCTION save_inspection_document_atomic(
+ p_inspection_document_id TEXT,
+ p_company_id TEXT,
+ p_user_id TEXT,
+ p_pdf_url TEXT DEFAULT NULL,
+ p_page_count INTEGER DEFAULT NULL,
+ p_default_page_width DOUBLE PRECISION DEFAULT NULL,
+ p_default_page_height DOUBLE PRECISION DEFAULT NULL,
+ p_features JSONB DEFAULT '{}'::jsonb,
+ p_balloons JSONB DEFAULT '{}'::jsonb
+)
+RETURNS JSONB
+LANGUAGE plpgsql
+AS $$
+DECLARE
+ v_document RECORD;
+ v_storage_path TEXT;
+ v_features_create JSONB := COALESCE(p_features->'create', '[]'::jsonb);
+ v_features_update JSONB := COALESCE(p_features->'update', '[]'::jsonb);
+ v_features_delete JSONB := COALESCE(p_features->'delete', '[]'::jsonb);
+ v_balloons_create JSONB := COALESCE(p_balloons->'create', '[]'::jsonb);
+ v_balloons_update JSONB := COALESCE(p_balloons->'update', '[]'::jsonb);
+ v_balloons_delete JSONB := COALESCE(p_balloons->'delete', '[]'::jsonb);
+ v_item JSONB;
+ v_temp_id TEXT;
+ v_feature_id TEXT;
+ v_balloon_id TEXT;
+ v_feature_id_map JSONB := '{}'::jsonb;
+ v_balloon_anchor_id_map JSONB := '{}'::jsonb;
+BEGIN
+ SELECT *
+ INTO v_document
+ FROM "inspectionDocument"
+ WHERE "id" = p_inspection_document_id
+ FOR UPDATE;
+
+ IF NOT FOUND THEN
+ RAISE EXCEPTION 'Inspection document not found';
+ END IF;
+
+ IF v_document."companyId" <> p_company_id THEN
+ RAISE EXCEPTION 'Inspection document does not belong to this company';
+ END IF;
+
+ -- A feature's gauge type must be one of this company's gauge types (the FK
+ -- alone would accept another tenant's id).
+ IF EXISTS (
+ SELECT 1
+ FROM jsonb_array_elements(v_features_create || v_features_update) AS f(value)
+ WHERE NULLIF(f.value->>'gaugeTypeId', '') IS NOT NULL
+ AND NOT EXISTS (
+ SELECT 1 FROM "gaugeType" gt
+ WHERE gt."id" = f.value->>'gaugeTypeId'
+ AND gt."companyId" = p_company_id
+ )
+ ) THEN
+ RAISE EXCEPTION 'Gauge type does not belong to this company';
+ END IF;
+
+ v_storage_path := NULLIF(
+ regexp_replace(COALESCE(p_pdf_url, ''), '^/file/preview/private/', ''),
+ ''
+ );
+
+ UPDATE "inspectionDocument"
+ SET
+ "storagePath" = CASE
+ WHEN v_storage_path IS NOT NULL THEN v_storage_path
+ ELSE "storagePath"
+ END,
+ "fileName" = CASE
+ WHEN v_storage_path IS NOT NULL THEN split_part(v_storage_path, '/', array_length(string_to_array(v_storage_path, '/'), 1))
+ ELSE "fileName"
+ END,
+ "uploadedBy" = CASE
+ WHEN v_storage_path IS NOT NULL THEN p_user_id
+ ELSE "uploadedBy"
+ END,
+ "pageCount" = CASE
+ WHEN p_page_count IS NOT NULL AND p_page_count > 0 THEN p_page_count
+ ELSE "pageCount"
+ END,
+ "defaultPageWidth" = CASE
+ WHEN p_default_page_width IS NOT NULL AND p_default_page_width > 0 THEN p_default_page_width
+ ELSE "defaultPageWidth"
+ END,
+ "defaultPageHeight" = CASE
+ WHEN p_default_page_height IS NOT NULL AND p_default_page_height > 0 THEN p_default_page_height
+ ELSE "defaultPageHeight"
+ END,
+ "updatedBy" = p_user_id,
+ "updatedAt" = NOW()
+ WHERE "id" = p_inspection_document_id
+ AND "companyId" = p_company_id;
+
+ IF jsonb_array_length(v_features_delete) > 0 THEN
+ DELETE FROM "inspectionFeature"
+ WHERE "id" = ANY (
+ SELECT jsonb_array_elements_text(v_features_delete)
+ )
+ AND "inspectionDocumentId" = p_inspection_document_id
+ AND "companyId" = p_company_id;
+ END IF;
+
+ IF jsonb_array_length(v_balloons_delete) > 0 THEN
+ DELETE FROM "balloon"
+ WHERE "id" = ANY (
+ SELECT jsonb_array_elements_text(v_balloons_delete)
+ )
+ AND "inspectionDocumentId" = p_inspection_document_id
+ AND "companyId" = p_company_id;
+ END IF;
+
+ FOR v_item IN SELECT value FROM jsonb_array_elements(v_features_create)
+ LOOP
+ INSERT INTO "inspectionFeature" (
+ "id",
+ "inspectionDocumentId",
+ "companyId",
+ "pageNumber",
+ "label",
+ "description",
+ "nominalValue",
+ "tolerancePlus",
+ "toleranceMinus",
+ "unit",
+ "type",
+ "samplingPlanType",
+ "samplingSampleSize",
+ "samplingPercentage",
+ "samplingAql",
+ "samplingInspectionLevel",
+ "samplingSeverity",
+ "gaugeTypeId",
+ "createdBy",
+ "updatedBy"
+ ) VALUES (
+ COALESCE(NULLIF(v_item->>'id', ''), id('ift')),
+ p_inspection_document_id,
+ p_company_id,
+ COALESCE((v_item->>'pageNumber')::INTEGER, 1),
+ COALESCE(v_item->>'label', ''),
+ CASE WHEN v_item ? 'description' THEN v_item->>'description' ELSE NULL END,
+ CASE WHEN v_item ? 'nominalValue' THEN v_item->>'nominalValue' ELSE NULL END,
+ CASE WHEN v_item ? 'tolerancePlus' THEN v_item->>'tolerancePlus' ELSE NULL END,
+ CASE WHEN v_item ? 'toleranceMinus' THEN v_item->>'toleranceMinus' ELSE NULL END,
+ CASE WHEN v_item ? 'unit' THEN v_item->>'unit' ELSE NULL END,
+ COALESCE((v_item->>'type')::"procedureStepType", 'Measurement'::"procedureStepType"),
+ CASE WHEN v_item ? 'samplingPlanType' THEN NULLIF(v_item->>'samplingPlanType', '')::"samplingPlanType" ELSE NULL END,
+ CASE WHEN v_item ? 'samplingSampleSize' THEN (v_item->>'samplingSampleSize')::INTEGER ELSE NULL END,
+ CASE WHEN v_item ? 'samplingPercentage' THEN (v_item->>'samplingPercentage')::NUMERIC ELSE NULL END,
+ CASE WHEN v_item ? 'samplingAql' THEN (v_item->>'samplingAql')::NUMERIC ELSE NULL END,
+ CASE WHEN v_item ? 'samplingInspectionLevel' THEN NULLIF(v_item->>'samplingInspectionLevel', '')::"inspectionLevel" ELSE NULL END,
+ CASE WHEN v_item ? 'samplingSeverity' THEN NULLIF(v_item->>'samplingSeverity', '')::"inspectionSeverity" ELSE NULL END,
+ CASE WHEN v_item ? 'gaugeTypeId' THEN NULLIF(v_item->>'gaugeTypeId', '') ELSE NULL END,
+ p_user_id,
+ p_user_id
+ )
+ RETURNING "id" INTO v_feature_id;
+
+ v_temp_id := v_item->>'tempId';
+ IF v_temp_id IS NOT NULL AND length(v_temp_id) > 0 THEN
+ v_feature_id_map := v_feature_id_map || jsonb_build_object(v_temp_id, v_feature_id);
+ END IF;
+ END LOOP;
+
+ FOR v_item IN SELECT value FROM jsonb_array_elements(v_balloons_create)
+ LOOP
+ v_feature_id := NULL;
+ IF v_item ? 'inspectionFeatureId' THEN
+ v_feature_id := v_item->>'inspectionFeatureId';
+ ELSIF v_item ? 'tempInspectionFeatureId' THEN
+ v_temp_id := v_item->>'tempInspectionFeatureId';
+ IF v_feature_id_map ? v_temp_id THEN
+ v_feature_id := v_feature_id_map->>v_temp_id;
+ END IF;
+ END IF;
+
+ IF v_feature_id IS NULL OR length(v_feature_id) = 0 THEN
+ RAISE EXCEPTION 'balloon create requires inspectionFeatureId or tempInspectionFeatureId';
+ END IF;
+
+ INSERT INTO "balloon" (
+ "id",
+ "inspectionDocumentId",
+ "companyId",
+ "inspectionFeatureId",
+ "pageNumber",
+ "regionX",
+ "regionY",
+ "regionWidth",
+ "regionHeight",
+ "xCoordinate",
+ "yCoordinate",
+ "createdBy",
+ "updatedBy"
+ ) VALUES (
+ COALESCE(NULLIF(v_item->>'id', ''), id('bbn')),
+ p_inspection_document_id,
+ p_company_id,
+ v_feature_id,
+ COALESCE((v_item->>'pageNumber')::INTEGER, 1),
+ COALESCE((v_item->>'regionX')::DOUBLE PRECISION, 0),
+ COALESCE((v_item->>'regionY')::DOUBLE PRECISION, 0),
+ COALESCE((v_item->>'regionWidth')::DOUBLE PRECISION, 0.1),
+ COALESCE((v_item->>'regionHeight')::DOUBLE PRECISION, 0.1),
+ COALESCE((v_item->>'xCoordinate')::DOUBLE PRECISION, 0),
+ COALESCE((v_item->>'yCoordinate')::DOUBLE PRECISION, 0),
+ p_user_id,
+ p_user_id
+ )
+ RETURNING "id" INTO v_balloon_id;
+
+ v_temp_id := v_item->>'tempBalloonAnchorId';
+ IF v_temp_id IS NOT NULL AND length(v_temp_id) > 0 THEN
+ v_balloon_anchor_id_map := v_balloon_anchor_id_map || jsonb_build_object(v_temp_id, v_balloon_id);
+ END IF;
+ END LOOP;
+
+ FOR v_item IN SELECT value FROM jsonb_array_elements(v_features_update)
+ LOOP
+ UPDATE "inspectionFeature"
+ SET
+ "pageNumber" = CASE WHEN v_item ? 'pageNumber' THEN (v_item->>'pageNumber')::INTEGER ELSE "pageNumber" END,
+ "label" = CASE WHEN v_item ? 'label' THEN v_item->>'label' ELSE "label" END,
+ "description" = CASE WHEN v_item ? 'description' THEN v_item->>'description' ELSE "description" END,
+ "nominalValue" = CASE WHEN v_item ? 'nominalValue' THEN v_item->>'nominalValue' ELSE "nominalValue" END,
+ "tolerancePlus" = CASE WHEN v_item ? 'tolerancePlus' THEN v_item->>'tolerancePlus' ELSE "tolerancePlus" END,
+ "toleranceMinus" = CASE WHEN v_item ? 'toleranceMinus' THEN v_item->>'toleranceMinus' ELSE "toleranceMinus" END,
+ "unit" = CASE WHEN v_item ? 'unit' THEN v_item->>'unit' ELSE "unit" END,
+ "type" = CASE WHEN v_item ? 'type' THEN (v_item->>'type')::"procedureStepType" ELSE "type" END,
+ "samplingPlanType" = CASE WHEN v_item ? 'samplingPlanType' THEN NULLIF(v_item->>'samplingPlanType', '')::"samplingPlanType" ELSE "samplingPlanType" END,
+ "samplingSampleSize" = CASE WHEN v_item ? 'samplingSampleSize' THEN (v_item->>'samplingSampleSize')::INTEGER ELSE "samplingSampleSize" END,
+ "samplingPercentage" = CASE WHEN v_item ? 'samplingPercentage' THEN (v_item->>'samplingPercentage')::NUMERIC ELSE "samplingPercentage" END,
+ "samplingAql" = CASE WHEN v_item ? 'samplingAql' THEN (v_item->>'samplingAql')::NUMERIC ELSE "samplingAql" END,
+ "samplingInspectionLevel" = CASE WHEN v_item ? 'samplingInspectionLevel' THEN NULLIF(v_item->>'samplingInspectionLevel', '')::"inspectionLevel" ELSE "samplingInspectionLevel" END,
+ "samplingSeverity" = CASE WHEN v_item ? 'samplingSeverity' THEN NULLIF(v_item->>'samplingSeverity', '')::"inspectionSeverity" ELSE "samplingSeverity" END,
+ "gaugeTypeId" = CASE WHEN v_item ? 'gaugeTypeId' THEN NULLIF(v_item->>'gaugeTypeId', '') ELSE "gaugeTypeId" END,
+ "updatedBy" = p_user_id,
+ "updatedAt" = NOW()
+ WHERE "id" = v_item->>'id'
+ AND "inspectionDocumentId" = p_inspection_document_id
+ AND "companyId" = p_company_id;
+ END LOOP;
+
+ FOR v_item IN SELECT value FROM jsonb_array_elements(v_balloons_update)
+ LOOP
+ UPDATE "balloon"
+ SET
+ "pageNumber" = CASE WHEN v_item ? 'pageNumber' THEN (v_item->>'pageNumber')::INTEGER ELSE "pageNumber" END,
+ "regionX" = CASE WHEN v_item ? 'regionX' THEN (v_item->>'regionX')::DOUBLE PRECISION ELSE "regionX" END,
+ "regionY" = CASE WHEN v_item ? 'regionY' THEN (v_item->>'regionY')::DOUBLE PRECISION ELSE "regionY" END,
+ "regionWidth" = CASE WHEN v_item ? 'regionWidth' THEN (v_item->>'regionWidth')::DOUBLE PRECISION ELSE "regionWidth" END,
+ "regionHeight" = CASE WHEN v_item ? 'regionHeight' THEN (v_item->>'regionHeight')::DOUBLE PRECISION ELSE "regionHeight" END,
+ "xCoordinate" = CASE WHEN v_item ? 'xCoordinate' THEN (v_item->>'xCoordinate')::DOUBLE PRECISION ELSE "xCoordinate" END,
+ "yCoordinate" = CASE WHEN v_item ? 'yCoordinate' THEN (v_item->>'yCoordinate')::DOUBLE PRECISION ELSE "yCoordinate" END,
+ "updatedBy" = p_user_id,
+ "updatedAt" = NOW()
+ WHERE "id" = v_item->>'id'
+ AND "inspectionDocumentId" = p_inspection_document_id
+ AND "companyId" = p_company_id;
+ END LOOP;
+
+ RETURN jsonb_build_object(
+ 'success', true,
+ 'featureIdMap', v_feature_id_map,
+ 'balloonAnchorIdMap', v_balloon_anchor_id_map,
+ 'features', COALESCE((
+ SELECT jsonb_agg(jsonb_build_object(
+ 'id', f."id",
+ 'inspectionDocumentId', f."inspectionDocumentId",
+ 'companyId', f."companyId",
+ 'pageNumber', f."pageNumber",
+ 'label', f."label",
+ 'description', f."description",
+ 'nominalValue', f."nominalValue",
+ 'tolerancePlus', f."tolerancePlus",
+ 'toleranceMinus', f."toleranceMinus",
+ 'unit', f."unit",
+ 'type', f."type",
+ 'samplingPlanType', f."samplingPlanType",
+ 'samplingSampleSize', f."samplingSampleSize",
+ 'samplingPercentage', f."samplingPercentage",
+ 'samplingAql', f."samplingAql",
+ 'samplingInspectionLevel', f."samplingInspectionLevel",
+ 'samplingSeverity', f."samplingSeverity",
+ 'gaugeTypeId', f."gaugeTypeId",
+ 'balloonId', b."id",
+ 'createdBy', f."createdBy",
+ 'updatedBy', f."updatedBy",
+ 'createdAt', f."createdAt",
+ 'updatedAt', f."updatedAt"
+ ) ORDER BY f."createdAt" ASC)
+ FROM "inspectionFeature" f
+ LEFT JOIN "balloon" b
+ ON b."inspectionFeatureId" = f."id"
+ AND b."companyId" = f."companyId"
+ WHERE f."inspectionDocumentId" = p_inspection_document_id
+ AND f."companyId" = p_company_id
+ ), '[]'::jsonb),
+ 'balloons', COALESCE((
+ SELECT jsonb_agg(jsonb_build_object(
+ 'id', b."id",
+ 'inspectionDocumentId', b."inspectionDocumentId",
+ 'companyId', b."companyId",
+ 'inspectionFeatureId', b."inspectionFeatureId",
+ 'pageNumber', b."pageNumber",
+ 'regionX', b."regionX",
+ 'regionY', b."regionY",
+ 'regionWidth', b."regionWidth",
+ 'regionHeight', b."regionHeight",
+ 'xCoordinate', b."xCoordinate",
+ 'yCoordinate', b."yCoordinate",
+ 'createdBy', b."createdBy",
+ 'updatedBy', b."updatedBy",
+ 'createdAt', b."createdAt",
+ 'updatedAt', b."updatedAt"
+ ) ORDER BY b."createdAt" ASC)
+ FROM "balloon" b
+ WHERE b."inspectionDocumentId" = p_inspection_document_id
+ AND b."companyId" = p_company_id
+ ), '[]'::jsonb),
+ 'anchors', COALESCE((
+ SELECT jsonb_agg(jsonb_build_object(
+ 'id', b."id",
+ 'pageNumber', b."pageNumber",
+ 'xCoordinate', b."regionX",
+ 'yCoordinate', b."regionY",
+ 'width', b."regionWidth",
+ 'height', b."regionHeight"
+ ) ORDER BY b."createdAt" ASC)
+ FROM "balloon" b
+ WHERE b."inspectionDocumentId" = p_inspection_document_id
+ AND b."companyId" = p_company_id
+ ), '[]'::jsonb)
+ );
+END;
+$$;
diff --git a/packages/ee/src/mcp/server.ts b/packages/ee/src/mcp/server.ts
index 58b382f03f..e17a231dee 100644
--- a/packages/ee/src/mcp/server.ts
+++ b/packages/ee/src/mcp/server.ts
@@ -102,13 +102,20 @@ export async function createMcpServer<Ctx extends McpContext>(
missing.push(toolName);
continue;
}
+ // A deprecated alias resolves to its replacement's entry (the app's
+ // `OPERATION_ALIASES`), so the names differ — say so, once, up front.
+ const deprecation =
+ meta.name === toolName
+ ? ""
+ : `'${toolName}' is deprecated — it now runs '${meta.name}'. Call '${meta.name}' instead.\n\n`;
sections.push(
- formatToolDescription(meta, {
- isList: isListOperation(meta),
- sibling: meta.paginates
- ? null
- : paginatingSibling(meta.name, (n) => operationsByName.get(n))
- })
+ deprecation +
+ formatToolDescription(meta, {
+ isList: isListOperation(meta),
+ sibling: meta.paginates
+ ? null
+ : paginatingSibling(meta.name, (n) => operationsByName.get(n))
+ })
);
}
diff --git a/packages/ee/src/mcp/types.ts b/packages/ee/src/mcp/types.ts
index f4224cb9d3..960fe12aae 100644
--- a/packages/ee/src/mcp/types.ts
+++ b/packages/ee/src/mcp/types.ts
@@ -35,6 +35,8 @@ export interface McpServerDeps<Ctx> {
ctx: Ctx,
args?: string | Record<string, unknown>
) => Promise<McpCallResult>;
+ /** Includes deprecated aliases, keyed by the OLD name and mapped to the
+ * replacement's entry — so `get(name).name !== name` marks an alias. */
operationsByName: Map<string, ManifestEntry>;
isListOperation: (meta: ManifestEntry) => boolean;
isMcpBlockedTool: (name: string) => boolean;
diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.po
index 51641e7a42..1cc85f690b 100644
--- a/packages/locale/locales/de/erp.po
+++ b/packages/locale/locales/de/erp.po
@@ -48,6 +48,9 @@ msgstr "„{taskName}\" ist erledigt – alle {0} seiner Setup-Map-Elemente sind
msgid "(excluded for this customer)"
msgstr "(für diesen Kunden ausgeschlossen)"
+msgid "(Inactive)"
+msgstr "(Inaktiv)"
+
#. placeholder {0}: target.slackDays
msgid "{0, plural, one {# day of slack} other {# days of slack}}"
msgstr "{0, plural, one {# Tag Puffer} other {# Tage Puffer}}"
@@ -1430,6 +1433,9 @@ msgstr "Authentifikator-App hinzufügen"
msgid "Add Calibration Record"
msgstr "Kalibrierprotokoll hinzufügen"
+msgid "Add Characteristic"
+msgstr "Merkmal hinzufügen"
+
msgid "Add Child Storage Unit"
msgstr "Untergeordnete Lagereinheit hinzufügen"
@@ -1460,9 +1466,6 @@ msgstr "Mitarbeiter hinzufügen"
msgid "Add Entry"
msgstr "Eintrag hinzufügen"
-msgid "Add Feature"
-msgstr "Feature hinzufügen"
-
msgid "Add from library…"
msgstr "Aus Bibliothek hinzufügen…"
@@ -1749,6 +1752,9 @@ msgstr "Alle Abteilungen"
msgid "All Documents"
msgstr "Alle Dokumente"
+msgid "All gauges"
+msgstr "Alle Prüfmittel"
+
msgid "All item types"
msgstr "Alle Artikeltypen"
@@ -2013,6 +2019,9 @@ msgstr "Eine weitere Lagereinheit, in die diese Einheit verschachtelt ist (z. B.
msgid "Another system is connected to Ramp as its accounting system"
msgstr "Ein anderes System ist mit Ramp als Buchhaltungssystem verbunden"
+msgid "Any"
+msgstr "Alle"
+
msgid "Any item group"
msgstr "Beliebige Artikelgruppe"
@@ -2092,8 +2101,8 @@ msgstr "Gilt für alle"
msgid "Applies to all work centers"
msgstr "Gilt für alle Arbeitsplätze"
-msgid "Applies to features without their own rule, and to the lot when this plan drives an inspection."
-msgstr "Gilt für Funktionen ohne eigene Regel und für die Charge, wenn dieser Plan eine Prüfung durchführt."
+msgid "Applies to characteristics without their own rule, and to the lot when this plan drives an inspection."
+msgstr "Gilt für Merkmale ohne eigene Regel und für die Charge, wenn dieser Plan eine Prüfung durchführt."
msgid "Apply"
msgstr "Anwenden"
@@ -3720,6 +3729,15 @@ msgstr "Das Ändern aktualisiert die Teile-ID"
msgid "Changing type resets this item's draft edits."
msgstr "Das Ändern des Typs setzt die Entwurfsbearbeitungen dieses Elements zurück."
+msgid "Characteristic"
+msgstr "Merkmal"
+
+msgid "Characteristic values suggested from drawing"
+msgstr "Merkmalwerte aus der Zeichnung vorgeschlagen"
+
+msgid "Characteristics"
+msgstr "Merkmale"
+
msgid "Charges"
msgstr "Belastungen"
@@ -3820,6 +3838,9 @@ msgstr "Fälligkeitsdatum löschen"
msgid "Clear Filters"
msgstr "Filter löschen"
+msgid "Clear gauge"
+msgstr "Prüfmittel löschen"
+
msgid "Clear search"
msgstr "Suche löschen"
@@ -3921,12 +3942,12 @@ msgstr "Zusammenklappen {0}"
msgid "Collapse all"
msgstr "Alle einklappen"
+msgid "Collapse characteristics table"
+msgstr "Merkmaltabelle ausblenden"
+
msgid "Collapse Costs"
msgstr "Kosten ausblenden"
-msgid "Collapse features table"
-msgstr "Features-Tabelle ausblenden"
-
msgid "Collapse Labor"
msgstr "Personal ausblenden"
@@ -4430,6 +4451,9 @@ msgstr "Link in die Zwischenablage kopiert"
msgid "Copied setup prompt to your clipboard"
msgstr "Rüst-Ansage in die Zwischenablage kopiert"
+msgid "Copied!"
+msgstr "Kopiert!"
+
msgid "Copies a setup prompt for your AI coding tool"
msgstr "Kopiert eine Rüst-Eingabeaufforderung für Ihr KI-Codierungstool"
@@ -4445,12 +4469,21 @@ msgstr "API-Schlüssel kopieren"
msgid "Copy batch number"
msgstr "Los-Nummer kopieren"
+msgid "Copy change notice unique identifier"
+msgstr "Eindeutige Kennung der Änderungsmitteilung kopieren"
+
msgid "Copy company unique identifier"
msgstr "Eindeutige Unternehmenskennung kopieren"
msgid "Copy consumable number"
msgstr "Verbrauchsmaterialnummer kopieren"
+msgid "Copy consumable unique identifier"
+msgstr "Eindeutige Kennung des Verbrauchsmaterials kopieren"
+
+msgid "Copy customer unique identifier"
+msgstr "Kundennummer kopieren"
+
msgid "Copy dispatch ID"
msgstr "Instandhaltungsauftrags-ID kopieren"
@@ -4475,6 +4508,9 @@ msgstr "Eindeutige Kennung des Problems kopieren"
msgid "Copy Job number"
msgstr "Job-Nummer kopieren"
+msgid "Copy job unique identifier"
+msgstr "Fertigungsauftrags-Nummer kopieren"
+
msgid "Copy link"
msgstr "Link kopieren"
@@ -4553,6 +4589,15 @@ msgstr "Name der Verfahrensanweisung kopieren"
msgid "Copy procedure unique identifier"
msgstr "Eindeutige Kennung der Verfahrensanweisung kopieren"
+msgid "Copy purchase invoice unique identifier"
+msgstr "Eindeutige Kennung der Eingangsrechnung kopieren"
+
+msgid "Copy purchase order unique identifier"
+msgstr "Bestellnummer kopieren"
+
+msgid "Copy purchase return order unique identifier"
+msgstr "Eindeutige Kennung der Bestellrücksendung kopieren"
+
msgid "Copy Quality Document"
msgstr "Qualitätsdokument kopieren"
@@ -4562,18 +4607,39 @@ msgstr "Angebot kopieren"
msgid "Copy Quote number"
msgstr "Angebotsnummer kopieren"
+msgid "Copy quote unique identifier"
+msgstr "Angebotsnummer kopieren"
+
msgid "Copy return number"
msgstr "Rückgabennummer kopieren"
+msgid "Copy RFQ unique identifier"
+msgstr "Anfragenummer kopieren"
+
msgid "Copy RMA number"
msgstr "RMA-Nummer kopieren"
+msgid "Copy sales invoice unique identifier"
+msgstr "Eindeutige Kennung der Ausgangsrechnung kopieren"
+
+msgid "Copy sales order unique identifier"
+msgstr "Kundenauftrags-Nummer kopieren"
+
+msgid "Copy sales return order unique identifier"
+msgstr "Eindeutige Kennung der Kundenrücksendung kopieren"
+
msgid "Copy service number"
msgstr "Dienstleistungsnummer kopieren"
msgid "Copy service unique identifier"
msgstr "Eindeutige Kennung der Dienstleistung kopieren"
+msgid "Copy supplier quote unique identifier"
+msgstr "Eindeutige Kennung des Lieferantenangebots kopieren"
+
+msgid "Copy supplier unique identifier"
+msgstr "Lieferantennummer kopieren"
+
msgid "Copy this item's pricing to another scope."
msgstr "Kopieren Sie die Preise dieses Artikels auf einen anderen Geltungsbereich."
@@ -4583,6 +4649,9 @@ msgstr "Kopieren Sie diesen Link, um das Angebot mit einem Kunden zu teilen"
msgid "Copy this link to share the quote with a supplier"
msgstr "Kopieren Sie diesen Link, um das Angebot mit einem Lieferanten zu teilen"
+msgid "Copy to clipboard"
+msgstr "In die Zwischenablage kopieren"
+
msgid "Copy tool number"
msgstr "Werkzeugnummer kopieren"
@@ -6119,9 +6188,6 @@ msgstr "Erkannt vom Bewegungsplaner"
msgid "Developer"
msgstr "Entwickler"
-msgid "Diagram saved"
-msgstr "Diagramm gespeichert"
-
msgid "Differs from the selection — allowed, but confirm they nest together"
msgstr "Unterscheidet sich von der Auswahl — zulässig, aber bestätigen Sie, dass sie zusammenpassen"
@@ -6400,11 +6466,11 @@ msgstr "Auf Zeichnung platzieren durch Ziehen"
msgid "Drag to reorder"
msgstr "Zum Neuordnen ziehen"
-msgid "Drag to resize diagram and features"
-msgstr "Ziehen Sie, um das Diagramm und die Funktionen zu ändern"
+msgid "Drag to resize diagram and characteristics"
+msgstr "Zum Ändern der Größe von Diagramm und Merkmalen ziehen"
-msgid "Drag to resize drawing and features"
-msgstr "Zum Vergrößern von Zeichnung und Funktionen ziehen"
+msgid "Drag to resize drawing and characteristics"
+msgstr "Zum Ändern der Größe von Zeichnung und Merkmalen ziehen"
msgid "Drag to zoom"
msgstr "Zum Zoomen ziehen"
@@ -6415,8 +6481,8 @@ msgstr "Abheben"
msgid "Drawing Number"
msgstr "Zeichnungsnummer"
-msgid "Drawing replaced. Balloon placements were removed; feature rows are unchanged."
-msgstr "Zeichnung ersetzt. Ballonplatzierungen wurden entfernt; Funktionszeilen bleiben unverändert."
+msgid "Drawing replaced. Balloon placements were removed; characteristic rows are unchanged."
+msgstr "Zeichnung ersetzt. Anmerkungsplatzierungen wurden entfernt. Merkmalzeilen bleiben unverändert."
msgid "Drop Ship"
msgstr "Direktversand"
@@ -7452,12 +7518,12 @@ msgstr "Erweitern {0}"
msgid "Expand all"
msgstr "Alle erweitern"
+msgid "Expand characteristics table"
+msgstr "Merkmaltabelle erweitern"
+
msgid "Expand Costs"
msgstr "Kosten erweitern"
-msgid "Expand features table"
-msgstr "Features-Tabelle erweitern"
-
msgid "Expand Labor"
msgstr "Personal erweitern"
@@ -7641,7 +7707,7 @@ msgstr "Nicht bestanden"
msgid "Failed"
msgstr "Fehlgeschlagen"
-msgid "Failed features"
+msgid "Failed characteristics"
msgstr "Fehlgeschlagene Merkmale"
#. placeholder {0}: rows.length
@@ -7893,6 +7959,9 @@ msgstr "Fehler beim Laden von verfolgten Entitäten"
msgid "Failed to move account: {0}"
msgstr "Konto konnte nicht verschoben werden: {0}"
+msgid "Failed to record gauge"
+msgstr "Prüfmittel konnte nicht aufgezeichnet werden"
+
msgid "Failed to regenerate schedule"
msgstr "Terminplan konnte nicht neu generiert werden"
@@ -7926,8 +7995,8 @@ msgstr "Fehler beim Abrufen der CSV-Spaltendaten."
msgid "Failed to save configuration rule"
msgstr "Fehler beim Speichern der Konfigurationsregel"
-msgid "Failed to save diagram"
-msgstr "Fehler beim Speichern des Diagramms"
+msgid "Failed to save inspection plan"
+msgstr "Prüfplan konnte nicht gespeichert werden"
msgid "Failed to save measurement"
msgstr "Messung konnte nicht gespeichert werden"
@@ -8028,15 +8097,6 @@ msgstr "Fax"
msgid "Fax Number"
msgstr "Faxnummer"
-msgid "Feature"
-msgstr "Merkmal"
-
-msgid "Feature values suggested from drawing"
-msgstr "Merkmalswerte aus Zeichnung vorgeschlagen"
-
-msgid "Features"
-msgstr "Funktionen"
-
msgid "Fees"
msgstr "Gebühren"
@@ -8342,6 +8402,9 @@ msgstr "Prüfmittel"
msgid "Gauge Calibration Notifications"
msgstr "Kalibrierbenachrichtigungen für Prüfmittel"
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Prüfmittel für Merkmal {characteristicLabel}: {currentGauge}"
+
msgid "Gauge ID"
msgstr "Prüfmittel-ID"
@@ -11678,6 +11741,9 @@ msgstr "Keine Prognose für diesen Auftrag verfügbar."
msgid "No Gauge Selected"
msgstr "Kein Prüfmittel ausgewählt"
+msgid "No gauges found."
+msgstr "Keine Prüfmittel gefunden."
+
msgid "No grouped notifications"
msgstr "Keine gruppierten Benachrichtigungen"
@@ -12748,6 +12814,9 @@ msgstr "Andernfalls"
msgid "Out"
msgstr "Aus"
+msgid "Out of calibration"
+msgstr "Nicht kalibriert"
+
msgid "Outbound"
msgstr "Versand"
@@ -14424,6 +14493,9 @@ msgstr "Kürzliche Zahlungen"
msgid "Recently Created"
msgstr "Kürzlich erstellt"
+msgid "Recently used"
+msgstr "Zuletzt verwendet"
+
msgid "Recertify Every (Days)"
msgstr "Alle (Tage) Wiederbeglaubigung"
@@ -14801,8 +14873,8 @@ msgstr "Ersetzen Sie die Daten dieses Unternehmens durch einen Demo-Datensatz
msgid "Replacement Order"
msgstr "Ersatzbestellung"
-msgid "Replacing the PDF removes all balloon placements on this document. Feature rows and their values stay; you can place balloons again on the new drawing."
-msgstr "Das Ersetzen der PDF entfernt alle Ballonplatzierungen in diesem Dokument. Funktionszeilen und ihre Werte bleiben erhalten; Sie können Ballons auf der neuen Zeichnung erneut platzieren."
+msgid "Replacing the PDF removes all balloon placements on this document. Characteristic rows and their values stay; you can place balloons again on the new drawing."
+msgstr "Das Ersetzen der PDF entfernt alle Anmerkungsplatzierungen. Merkmalzeilen und ihre Werte bleiben erhalten. Sie können Anmerkungen auf der neuen Zeichnung erneut platzieren."
msgid "Replenishment"
msgstr "Nachschub"
@@ -15550,8 +15622,8 @@ msgstr "Stichprobengröße"
msgid "Sampling"
msgstr "Stichprobenprüfung"
-msgid "Sampling — Feature {featureLabel}"
-msgstr "Stichprobenprüfung — Funktion {featureLabel}"
+msgid "Sampling — Characteristic {featureLabel}"
+msgstr "Stichprobenprüfung – Merkmal {featureLabel}"
msgid "Sampling Standard"
msgstr "Stichprobenstandard"
@@ -15752,6 +15824,9 @@ msgstr "Verschrottet"
msgid "Search"
msgstr "Suchen"
+msgid "Search {gaugeTypeName}..."
+msgstr "Nach {gaugeTypeName} suchen..."
+
msgid "Search accounts"
msgstr "Konten durchsuchen"
@@ -15797,6 +15872,9 @@ msgstr "Felder durchsuchen..."
msgid "Search for existing or create a new one"
msgstr "Suchen Sie nach einem vorhandenen oder erstellen Sie einen neuen"
+msgid "Search gauges..."
+msgstr "Prüfmittel suchen..."
+
msgid "Search items or bins"
msgstr "Artikel oder Lagerplätze suchen"
@@ -15993,6 +16071,9 @@ msgstr "Mitarbeitertyp auswählen"
msgid "Select field"
msgstr "Feld auswählen"
+msgid "Select gauge"
+msgstr "Prüfmittel auswählen"
+
msgid "Select Gauge"
msgstr "Prüfmittel wählen"
@@ -18113,8 +18194,8 @@ msgstr "Das Los wird als Bestanden markiert. {fails} erfasste Fehler werden für
msgid "The lot will still be rejected, but an NCR cannot be created until at least one Issue Type is configured."
msgstr "Das Los wird immer noch abgelehnt, aber ein NCR kann nicht erstellt werden, bis mindestens ein Problemtyp konfiguriert ist."
-msgid "The lot's per-feature sampling plan will be re-resolved from the selected document."
-msgstr "Der Stichprobenplan pro Merkmal des Loses wird aus dem ausgewählten Dokument neu aufgelöst."
+msgid "The lot's per-characteristic sampling plan will be re-resolved from the selected document."
+msgstr "Der Stichprobenplan pro Merkmal der Charge wird aus dem ausgewählten Dokument erneut bestimmt."
msgid "The lowest amount this supplier will charge for this process, regardless of quantity; jobs below the breakeven volume still cost at least this much."
msgstr "Der niedrigste Betrag, den dieser Lieferant für dieses Verfahren berechnet, unabhängig von der Menge; Fertigungsaufträge unter dem Break-Even-Volumen kosten mindestens diesen Betrag."
@@ -19479,6 +19560,9 @@ msgstr "Unbekannt"
msgid "unknown error"
msgstr "unbekannter Fehler"
+msgid "Unknown gauge"
+msgstr "Unbekanntes Prüfmittel"
+
msgid "unknown location"
msgstr "unbekannter Ort"
@@ -20051,6 +20135,9 @@ msgstr "Notizen anzeigen"
msgid "View on schedule board"
msgstr "Auf der Plantafel anzeigen"
+msgid "View only — changes are not saved"
+msgstr "Nur anzeigen — Änderungen werden nicht gespeichert"
+
msgid "View Open"
msgstr "Offene anzeigen"
@@ -20968,6 +21055,9 @@ msgstr "Ihre Einladung ist ungültig oder wurde bereits angenommen. Bitte kontak
msgid "Your job here: check a real sample of each row, then mark it validated. Foundation data loads first, then master records, then open transactions at cutover."
msgstr "Ihre Aufgabe hier: Überprüfen Sie ein echtes Beispiel jeder Zeile und markieren Sie es dann als validiert. Grundlagendaten werden zuerst geladen, dann Masterdatensätze, dann offene Transaktionen beim Cutover."
+msgid "Your latest changes could not be saved. Are you sure you want to leave this page?"
+msgstr "Ihre letzten Änderungen konnten nicht gespeichert werden. Sind Sie sicher, dass Sie diese Seite verlassen möchten?"
+
msgid "Your legal name, addresses, branding, and document defaults"
msgstr "Ihr rechtlicher Name, Adressen, Branding und Dokumentstandards"
diff --git a/packages/locale/locales/de/mes.po b/packages/locale/locales/de/mes.po
index eae21ae801..bdd49e96c9 100644
--- a/packages/locale/locales/de/mes.po
+++ b/packages/locale/locales/de/mes.po
@@ -12,6 +12,9 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+msgid "(Inactive)"
+msgstr "(Inaktiv)"
+
#. placeholder {0}: attribute.name
#. placeholder {1}: activeStep + 1
msgid "{0} - Set {1}"
@@ -148,6 +151,9 @@ msgstr "Alle"
msgid "All clear"
msgstr "Alles klar"
+msgid "All gauges"
+msgstr "Alle Prüfmittel"
+
msgid "All jobs"
msgstr "Alle Fertigungsaufträge"
@@ -268,6 +274,12 @@ msgstr "Carbon Logo"
msgid "Cards"
msgstr "Karten"
+msgid "Characteristic"
+msgstr "Merkmal"
+
+msgid "Characteristics"
+msgstr "Merkmale"
+
msgid "Chat"
msgstr "Chat"
@@ -283,6 +295,9 @@ msgstr "Löschen"
msgid "Clear Filters"
msgstr "Filter zurücksetzen"
+msgid "Clear gauge"
+msgstr "Prüfmittel leeren"
+
msgid "Clear Search"
msgstr "Suche löschen"
@@ -301,8 +316,8 @@ msgstr "Eingecheckt seit <0/>"
msgid "Close"
msgstr "Schließen"
-msgid "Collapse features table"
-msgstr "Merkmalstabelle ausblenden"
+msgid "Collapse characteristics table"
+msgstr "Merkmalstabelle einklappen"
msgid "Collapse panel"
msgstr "Bereich reduzieren"
@@ -366,6 +381,15 @@ msgstr "Verbrauchte abgelaufen"
msgid "Continue"
msgstr "Weiter"
+msgid "Copied!"
+msgstr "Kopiert!"
+
+msgid "Copy"
+msgstr "Kopieren"
+
+msgid "Copy to clipboard"
+msgstr "In die Zwischenablage kopieren"
+
#. placeholder {0}: board.unplannedCost.days
msgid "Cost of unplanned maintenance, last {0} days"
msgstr "Kosten der ungeplanten Instandhaltung der letzten {0} Tage"
@@ -463,8 +487,8 @@ msgstr "Entwurf"
msgid "Drag and drop a file here, or click to select a file"
msgstr "Datei hierher ziehen oder klicken, um eine Datei auszuwählen"
-msgid "Drag to resize drawing and features"
-msgstr "Zeichnung und Funktionen durch Ziehen vergrößern/verkleinern"
+msgid "Drag to resize drawing and characteristics"
+msgstr "Zum Ändern der Größe von Zeichnung und Merkmalen ziehen"
#. placeholder {0}: active.data.current?.type
msgid "Dragging {0} cancelled."
@@ -541,8 +565,8 @@ msgstr "Jeder Fertigungsauftrag im Los folgt diesen Schritten. Zeichnen Sie eine
msgid "Every unit has a verdict: {passes} passed and {fails} failed. The lot closes with each unit routed to its own outcome."
msgstr "Jede Einheit hat ein Urteil: {passes} bestanden und {fails} fehlgeschlagen. Das Los wird geschlossen, wobei jede Einheit zu ihrem eigenen Ergebnis weitergeleitet wird."
-msgid "Expand features table"
-msgstr "Funktionstabelle erweitern"
+msgid "Expand characteristics table"
+msgstr "Merkmalstabelle ausklappen"
msgid "Expand panel"
msgstr "Bereich erweitern"
@@ -563,8 +587,8 @@ msgstr "Verfällt zuerst"
msgid "Failed"
msgstr "Fehlgeschlagen"
-msgid "Failed features"
-msgstr "Fehlgeschlagene Funktionen"
+msgid "Failed characteristics"
+msgstr "Fehlgeschlagene Merkmale"
msgid "Failed to complete inventory adjustment"
msgstr "Bestandskorrektur konnte nicht abgeschlossen werden"
@@ -581,6 +605,9 @@ msgstr "Aktive Arbeitsgänge konnten nicht abgerufen werden"
msgid "Failed to fetch storageUnits"
msgstr "Fehler beim Abrufen von Lagerbereichen"
+msgid "Failed to record gauge"
+msgstr "Prüfmittel konnte nicht aufgezeichnet werden"
+
msgid "Failed to save measurement"
msgstr "Messung konnte nicht gespeichert werden"
@@ -598,12 +625,6 @@ msgstr "Fehler beim Hochladen der Datei: {0}"
msgid "Failed to upload image"
msgstr "Fehler beim Hochladen des Bildes"
-msgid "Feature"
-msgstr "Funktion"
-
-msgid "Features"
-msgstr "Merkmale"
-
msgid "File size exceeds 10MB limit"
msgstr "Dateigröße überschreitet das Limit von 10 MB"
@@ -645,6 +666,12 @@ msgstr "Korrigieren Sie die markierten Mengen vor dem Fertigstellen."
msgid "Forgot to Clock Out?"
msgstr "Ausstempeln vergessen?"
+msgid "Gauge"
+msgstr "Prüfmittel"
+
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Prüfmittel für Merkmal {characteristicLabel}: {currentGauge}"
+
msgid "General"
msgstr "Allgemein"
@@ -959,6 +986,9 @@ msgstr "Keine Instandhaltungsaufträge an Sie zugewiesen"
msgid "No files"
msgstr "Keine Dateien"
+msgid "No gauges found."
+msgstr "Keine Prüfmittel gefunden."
+
msgid "No Impact"
msgstr "Keine Auswirkung"
@@ -1126,6 +1156,9 @@ msgstr "Optional"
msgid "or"
msgstr "oder"
+msgid "Out of calibration"
+msgstr "Außerhalb der Kalibrierung"
+
msgid "Output lot"
msgstr "Ausgabe-Charge"
@@ -1276,6 +1309,9 @@ msgstr "Grund für Nacharbeit"
msgid "Recent"
msgstr "Zuletzt"
+msgid "Recently used"
+msgstr "Zuletzt verwendet"
+
msgid "Record"
msgstr "Erfassen"
@@ -1407,9 +1443,15 @@ msgstr "Ausgewählte Seriennummer wird verschrottet"
msgid "Search"
msgstr "Suchen"
+msgid "Search {gaugeTypeName}..."
+msgstr "Suchen {gaugeTypeName}..."
+
msgid "Search by job or item ID"
msgstr "Nach Job oder Artikel-ID suchen"
+msgid "Search gauges..."
+msgstr "Prüfmittel suchen..."
+
msgid "Search operators..."
msgstr "Werker suchen..."
@@ -1444,6 +1486,9 @@ msgstr "Artikel auswählen..."
msgid "Select Batch {0}"
msgstr "Charge {0} auswählen"
+msgid "Select gauge"
+msgstr "Prüfmittel auswählen"
+
msgid "Select Printer"
msgstr "Drucker auswählen"
@@ -1728,6 +1773,9 @@ msgstr "Nicht ausgegebene Serien-/Chargenmaterialien"
msgid "Unknown"
msgstr "Unbekannt"
+msgid "Unknown gauge"
+msgstr "Unbekanntes Prüfmittel"
+
msgid "Unlock"
msgstr "Entsperren"
diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.po
index a406b3f6eb..330e539920 100644
--- a/packages/locale/locales/en/erp.po
+++ b/packages/locale/locales/en/erp.po
@@ -48,6 +48,9 @@ msgstr "\"{taskName}\" is done — all {0} of its Setup Map items are configured
msgid "(excluded for this customer)"
msgstr "(excluded for this customer)"
+msgid "(Inactive)"
+msgstr "(Inactive)"
+
#. placeholder {0}: target.slackDays
msgid "{0, plural, one {# day of slack} other {# days of slack}}"
msgstr "{0, plural, one {# day of slack} other {# days of slack}}"
@@ -1430,6 +1433,9 @@ msgstr "Add Authenticator App"
msgid "Add Calibration Record"
msgstr "Add Calibration Record"
+msgid "Add Characteristic"
+msgstr "Add Characteristic"
+
msgid "Add Child Storage Unit"
msgstr "Add Child Storage Unit"
@@ -1460,9 +1466,6 @@ msgstr "Add Employee"
msgid "Add Entry"
msgstr "Add Entry"
-msgid "Add Feature"
-msgstr "Add Feature"
-
msgid "Add from library…"
msgstr "Add from library…"
@@ -1749,6 +1752,9 @@ msgstr "All departments"
msgid "All Documents"
msgstr "All Documents"
+msgid "All gauges"
+msgstr "All gauges"
+
msgid "All item types"
msgstr "All item types"
@@ -2013,6 +2019,9 @@ msgstr "Another storage unit this one nests inside (e.g. a bin within a rack); m
msgid "Another system is connected to Ramp as its accounting system"
msgstr "Another system is connected to Ramp as its accounting system"
+msgid "Any"
+msgstr "Any"
+
msgid "Any item group"
msgstr "Any item group"
@@ -2092,8 +2101,8 @@ msgstr "Applies to all"
msgid "Applies to all work centers"
msgstr "Applies to all work centers"
-msgid "Applies to features without their own rule, and to the lot when this plan drives an inspection."
-msgstr "Applies to features without their own rule, and to the lot when this plan drives an inspection."
+msgid "Applies to characteristics without their own rule, and to the lot when this plan drives an inspection."
+msgstr "Applies to characteristics without their own rule, and to the lot when this plan drives an inspection."
msgid "Apply"
msgstr "Apply"
@@ -3720,6 +3729,15 @@ msgstr "Changing this will update the part ID"
msgid "Changing type resets this item's draft edits."
msgstr "Changing type resets this item's draft edits."
+msgid "Characteristic"
+msgstr "Characteristic"
+
+msgid "Characteristic values suggested from drawing"
+msgstr "Characteristic values suggested from drawing"
+
+msgid "Characteristics"
+msgstr "Characteristics"
+
msgid "Charges"
msgstr "Charges"
@@ -3820,6 +3838,9 @@ msgstr "Clear due date"
msgid "Clear Filters"
msgstr "Clear Filters"
+msgid "Clear gauge"
+msgstr "Clear gauge"
+
msgid "Clear search"
msgstr "Clear search"
@@ -3921,12 +3942,12 @@ msgstr "Collapse {0}"
msgid "Collapse all"
msgstr "Collapse all"
+msgid "Collapse characteristics table"
+msgstr "Collapse characteristics table"
+
msgid "Collapse Costs"
msgstr "Collapse Costs"
-msgid "Collapse features table"
-msgstr "Collapse features table"
-
msgid "Collapse Labor"
msgstr "Collapse Labor"
@@ -4430,6 +4451,9 @@ msgstr "Copied link to clipboard"
msgid "Copied setup prompt to your clipboard"
msgstr "Copied setup prompt to your clipboard"
+msgid "Copied!"
+msgstr "Copied!"
+
msgid "Copies a setup prompt for your AI coding tool"
msgstr "Copies a setup prompt for your AI coding tool"
@@ -4445,12 +4469,21 @@ msgstr "Copy API Key"
msgid "Copy batch number"
msgstr "Copy batch number"
+msgid "Copy change notice unique identifier"
+msgstr "Copy change notice unique identifier"
+
msgid "Copy company unique identifier"
msgstr "Copy company unique identifier"
msgid "Copy consumable number"
msgstr "Copy consumable number"
+msgid "Copy consumable unique identifier"
+msgstr "Copy consumable unique identifier"
+
+msgid "Copy customer unique identifier"
+msgstr "Copy customer unique identifier"
+
msgid "Copy dispatch ID"
msgstr "Copy dispatch ID"
@@ -4475,6 +4508,9 @@ msgstr "Copy issue unique identifier"
msgid "Copy Job number"
msgstr "Copy Job number"
+msgid "Copy job unique identifier"
+msgstr "Copy job unique identifier"
+
msgid "Copy link"
msgstr "Copy link"
@@ -4553,6 +4589,15 @@ msgstr "Copy procedure name"
msgid "Copy procedure unique identifier"
msgstr "Copy procedure unique identifier"
+msgid "Copy purchase invoice unique identifier"
+msgstr "Copy purchase invoice unique identifier"
+
+msgid "Copy purchase order unique identifier"
+msgstr "Copy purchase order unique identifier"
+
+msgid "Copy purchase return order unique identifier"
+msgstr "Copy purchase return order unique identifier"
+
msgid "Copy Quality Document"
msgstr "Copy Quality Document"
@@ -4562,18 +4607,39 @@ msgstr "Copy Quote"
msgid "Copy Quote number"
msgstr "Copy Quote number"
+msgid "Copy quote unique identifier"
+msgstr "Copy quote unique identifier"
+
msgid "Copy return number"
msgstr "Copy return number"
+msgid "Copy RFQ unique identifier"
+msgstr "Copy RFQ unique identifier"
+
msgid "Copy RMA number"
msgstr "Copy RMA number"
+msgid "Copy sales invoice unique identifier"
+msgstr "Copy sales invoice unique identifier"
+
+msgid "Copy sales order unique identifier"
+msgstr "Copy sales order unique identifier"
+
+msgid "Copy sales return order unique identifier"
+msgstr "Copy sales return order unique identifier"
+
msgid "Copy service number"
msgstr "Copy service number"
msgid "Copy service unique identifier"
msgstr "Copy service unique identifier"
+msgid "Copy supplier quote unique identifier"
+msgstr "Copy supplier quote unique identifier"
+
+msgid "Copy supplier unique identifier"
+msgstr "Copy supplier unique identifier"
+
msgid "Copy this item's pricing to another scope."
msgstr "Copy this item's pricing to another scope."
@@ -4583,6 +4649,9 @@ msgstr "Copy this link to share the quote with a customer"
msgid "Copy this link to share the quote with a supplier"
msgstr "Copy this link to share the quote with a supplier"
+msgid "Copy to clipboard"
+msgstr "Copy to clipboard"
+
msgid "Copy tool number"
msgstr "Copy tool number"
@@ -6119,9 +6188,6 @@ msgstr "Detected by the motion planner"
msgid "Developer"
msgstr "Developer"
-msgid "Diagram saved"
-msgstr "Diagram saved"
-
msgid "Differs from the selection — allowed, but confirm they nest together"
msgstr "Differs from the selection — allowed, but confirm they nest together"
@@ -6400,11 +6466,11 @@ msgstr "Drag to place on drawing"
msgid "Drag to reorder"
msgstr "Drag to reorder"
-msgid "Drag to resize diagram and features"
-msgstr "Drag to resize diagram and features"
+msgid "Drag to resize diagram and characteristics"
+msgstr "Drag to resize diagram and characteristics"
-msgid "Drag to resize drawing and features"
-msgstr "Drag to resize drawing and features"
+msgid "Drag to resize drawing and characteristics"
+msgstr "Drag to resize drawing and characteristics"
msgid "Drag to zoom"
msgstr "Drag to zoom"
@@ -6415,8 +6481,8 @@ msgstr "Drawing"
msgid "Drawing Number"
msgstr "Drawing Number"
-msgid "Drawing replaced. Balloon placements were removed; feature rows are unchanged."
-msgstr "Drawing replaced. Balloon placements were removed; feature rows are unchanged."
+msgid "Drawing replaced. Balloon placements were removed; characteristic rows are unchanged."
+msgstr "Drawing replaced. Balloon placements were removed; characteristic rows are unchanged."
msgid "Drop Ship"
msgstr "Drop Ship"
@@ -7452,12 +7518,12 @@ msgstr "Expand {0}"
msgid "Expand all"
msgstr "Expand all"
+msgid "Expand characteristics table"
+msgstr "Expand characteristics table"
+
msgid "Expand Costs"
msgstr "Expand Costs"
-msgid "Expand features table"
-msgstr "Expand features table"
-
msgid "Expand Labor"
msgstr "Expand Labor"
@@ -7641,8 +7707,8 @@ msgstr "Fail"
msgid "Failed"
msgstr "Failed"
-msgid "Failed features"
-msgstr "Failed features"
+msgid "Failed characteristics"
+msgstr "Failed characteristics"
#. placeholder {0}: rows.length
msgid "Failed to add line — {addedCount} of {0} lines were added"
@@ -7893,6 +7959,9 @@ msgstr "Failed to load tracked entities"
msgid "Failed to move account: {0}"
msgstr "Failed to move account: {0}"
+msgid "Failed to record gauge"
+msgstr "Failed to record gauge"
+
msgid "Failed to regenerate schedule"
msgstr "Failed to regenerate schedule"
@@ -7926,8 +7995,8 @@ msgstr "Failed to retrieve CSV column data."
msgid "Failed to save configuration rule"
msgstr "Failed to save configuration rule"
-msgid "Failed to save diagram"
-msgstr "Failed to save diagram"
+msgid "Failed to save inspection plan"
+msgstr "Failed to save inspection plan"
msgid "Failed to save measurement"
msgstr "Failed to save measurement"
@@ -8028,15 +8097,6 @@ msgstr "Fax"
msgid "Fax Number"
msgstr "Fax Number"
-msgid "Feature"
-msgstr "Feature"
-
-msgid "Feature values suggested from drawing"
-msgstr "Feature values suggested from drawing"
-
-msgid "Features"
-msgstr "Features"
-
msgid "Fees"
msgstr "Fees"
@@ -8342,6 +8402,9 @@ msgstr "Gauge"
msgid "Gauge Calibration Notifications"
msgstr "Gauge Calibration Notifications"
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+
msgid "Gauge ID"
msgstr "Gauge ID"
@@ -11678,6 +11741,9 @@ msgstr "No forecast available for this job."
msgid "No Gauge Selected"
msgstr "No Gauge Selected"
+msgid "No gauges found."
+msgstr "No gauges found."
+
msgid "No grouped notifications"
msgstr "No grouped notifications"
@@ -12748,6 +12814,9 @@ msgstr "Otherwise"
msgid "Out"
msgstr "Out"
+msgid "Out of calibration"
+msgstr "Out of calibration"
+
msgid "Outbound"
msgstr "Outbound"
@@ -14424,6 +14493,9 @@ msgstr "Recent payments"
msgid "Recently Created"
msgstr "Recently Created"
+msgid "Recently used"
+msgstr "Recently used"
+
msgid "Recertify Every (Days)"
msgstr "Recertify Every (Days)"
@@ -14801,8 +14873,8 @@ msgstr "Replace this company's data with a demo dataset — snapshotted first, s
msgid "Replacement Order"
msgstr "Replacement Order"
-msgid "Replacing the PDF removes all balloon placements on this document. Feature rows and their values stay; you can place balloons again on the new drawing."
-msgstr "Replacing the PDF removes all balloon placements on this document. Feature rows and their values stay; you can place balloons again on the new drawing."
+msgid "Replacing the PDF removes all balloon placements on this document. Characteristic rows and their values stay; you can place balloons again on the new drawing."
+msgstr "Replacing the PDF removes all balloon placements on this document. Characteristic rows and their values stay; you can place balloons again on the new drawing."
msgid "Replenishment"
msgstr "Replenishment"
@@ -15550,8 +15622,8 @@ msgstr "Sample Size"
msgid "Sampling"
msgstr "Sampling"
-msgid "Sampling — Feature {featureLabel}"
-msgstr "Sampling — Feature {featureLabel}"
+msgid "Sampling — Characteristic {featureLabel}"
+msgstr "Sampling — Characteristic {featureLabel}"
msgid "Sampling Standard"
msgstr "Sampling Standard"
@@ -15752,6 +15824,9 @@ msgstr "Scrapped"
msgid "Search"
msgstr "Search"
+msgid "Search {gaugeTypeName}..."
+msgstr "Search {gaugeTypeName}..."
+
msgid "Search accounts"
msgstr "Search accounts"
@@ -15797,6 +15872,9 @@ msgstr "Search fields..."
msgid "Search for existing or create a new one"
msgstr "Search for existing or create a new one"
+msgid "Search gauges..."
+msgstr "Search gauges..."
+
msgid "Search items or bins"
msgstr "Search items or bins"
@@ -15993,6 +16071,9 @@ msgstr "Select Employee Type"
msgid "Select field"
msgstr "Select field"
+msgid "Select gauge"
+msgstr "Select gauge"
+
msgid "Select Gauge"
msgstr "Select Gauge"
@@ -18113,8 +18194,8 @@ msgstr "The lot will be marked Passed. {fails} sampled failure(s) are recorded f
msgid "The lot will still be rejected, but an NCR cannot be created until at least one Issue Type is configured."
msgstr "The lot will still be rejected, but an NCR cannot be created until at least one Issue Type is configured."
-msgid "The lot's per-feature sampling plan will be re-resolved from the selected document."
-msgstr "The lot's per-feature sampling plan will be re-resolved from the selected document."
+msgid "The lot's per-characteristic sampling plan will be re-resolved from the selected document."
+msgstr "The lot's per-characteristic sampling plan will be re-resolved from the selected document."
msgid "The lowest amount this supplier will charge for this process, regardless of quantity; jobs below the breakeven volume still cost at least this much."
msgstr "The lowest amount this supplier will charge for this process, regardless of quantity; jobs below the breakeven volume still cost at least this much."
@@ -19479,6 +19560,9 @@ msgstr "Unknown"
msgid "unknown error"
msgstr "unknown error"
+msgid "Unknown gauge"
+msgstr "Unknown gauge"
+
msgid "unknown location"
msgstr "unknown location"
@@ -20051,6 +20135,9 @@ msgstr "View notes"
msgid "View on schedule board"
msgstr "View on schedule board"
+msgid "View only — changes are not saved"
+msgstr "View only — changes are not saved"
+
msgid "View Open"
msgstr "View Open"
@@ -20972,6 +21059,9 @@ msgstr "Your invitation is invalid or has already been accepted. Please contact
msgid "Your job here: check a real sample of each row, then mark it validated. Foundation data loads first, then master records, then open transactions at cutover."
msgstr "Your job here: check a real sample of each row, then mark it validated. Foundation data loads first, then master records, then open transactions at cutover."
+msgid "Your latest changes could not be saved. Are you sure you want to leave this page?"
+msgstr "Your latest changes could not be saved. Are you sure you want to leave this page?"
+
msgid "Your legal name, addresses, branding, and document defaults"
msgstr "Your legal name, addresses, branding, and document defaults"
diff --git a/packages/locale/locales/en/mes.po b/packages/locale/locales/en/mes.po
index aa94a3742b..194e6c9bd7 100644
--- a/packages/locale/locales/en/mes.po
+++ b/packages/locale/locales/en/mes.po
@@ -12,6 +12,9 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+msgid "(Inactive)"
+msgstr "(Inactive)"
+
#. placeholder {0}: attribute.name
#. placeholder {1}: activeStep + 1
msgid "{0} - Set {1}"
@@ -148,6 +151,9 @@ msgstr "All"
msgid "All clear"
msgstr "All clear"
+msgid "All gauges"
+msgstr "All gauges"
+
msgid "All jobs"
msgstr "All jobs"
@@ -268,6 +274,12 @@ msgstr "Carbon Logo"
msgid "Cards"
msgstr "Cards"
+msgid "Characteristic"
+msgstr "Characteristic"
+
+msgid "Characteristics"
+msgstr "Characteristics"
+
msgid "Chat"
msgstr "Chat"
@@ -283,6 +295,9 @@ msgstr "Clear"
msgid "Clear Filters"
msgstr "Clear Filters"
+msgid "Clear gauge"
+msgstr "Clear gauge"
+
msgid "Clear Search"
msgstr "Clear Search"
@@ -301,8 +316,8 @@ msgstr "Clocked in since <0/>"
msgid "Close"
msgstr "Close"
-msgid "Collapse features table"
-msgstr "Collapse features table"
+msgid "Collapse characteristics table"
+msgstr "Collapse characteristics table"
msgid "Collapse panel"
msgstr "Collapse panel"
@@ -366,6 +381,15 @@ msgstr "Consumed expired"
msgid "Continue"
msgstr "Continue"
+msgid "Copied!"
+msgstr "Copied!"
+
+msgid "Copy"
+msgstr "Copy"
+
+msgid "Copy to clipboard"
+msgstr "Copy to clipboard"
+
#. placeholder {0}: board.unplannedCost.days
msgid "Cost of unplanned maintenance, last {0} days"
msgstr "Cost of unplanned maintenance, last {0} days"
@@ -463,8 +487,8 @@ msgstr "Draft"
msgid "Drag and drop a file here, or click to select a file"
msgstr "Drag and drop a file here, or click to select a file"
-msgid "Drag to resize drawing and features"
-msgstr "Drag to resize drawing and features"
+msgid "Drag to resize drawing and characteristics"
+msgstr "Drag to resize drawing and characteristics"
#. placeholder {0}: active.data.current?.type
msgid "Dragging {0} cancelled."
@@ -541,8 +565,8 @@ msgstr "Every job in the batch follows these steps. Record a step for all of the
msgid "Every unit has a verdict: {passes} passed and {fails} failed. The lot closes with each unit routed to its own outcome."
msgstr "Every unit has a verdict: {passes} passed and {fails} failed. The lot closes with each unit routed to its own outcome."
-msgid "Expand features table"
-msgstr "Expand features table"
+msgid "Expand characteristics table"
+msgstr "Expand characteristics table"
msgid "Expand panel"
msgstr "Expand panel"
@@ -563,8 +587,8 @@ msgstr "Expiring first"
msgid "Failed"
msgstr "Failed"
-msgid "Failed features"
-msgstr "Failed features"
+msgid "Failed characteristics"
+msgstr "Failed characteristics"
msgid "Failed to complete inventory adjustment"
msgstr "Failed to complete inventory adjustment"
@@ -581,6 +605,9 @@ msgstr "Failed to fetch active operations"
msgid "Failed to fetch storageUnits"
msgstr "Failed to fetch storageUnits"
+msgid "Failed to record gauge"
+msgstr "Failed to record gauge"
+
msgid "Failed to save measurement"
msgstr "Failed to save measurement"
@@ -598,12 +625,6 @@ msgstr "Failed to upload file: {0}"
msgid "Failed to upload image"
msgstr "Failed to upload image"
-msgid "Feature"
-msgstr "Feature"
-
-msgid "Features"
-msgstr "Features"
-
msgid "File size exceeds 10MB limit"
msgstr "File size exceeds 10MB limit"
@@ -645,6 +666,12 @@ msgstr "Fix the highlighted quantities before completing."
msgid "Forgot to Clock Out?"
msgstr "Forgot to Clock Out?"
+msgid "Gauge"
+msgstr "Gauge"
+
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+
msgid "General"
msgstr "General"
@@ -959,6 +986,9 @@ msgstr "No dispatches assigned to you"
msgid "No files"
msgstr "No files"
+msgid "No gauges found."
+msgstr "No gauges found."
+
msgid "No Impact"
msgstr "No Impact"
@@ -1126,6 +1156,9 @@ msgstr "Optional"
msgid "or"
msgstr "or"
+msgid "Out of calibration"
+msgstr "Out of calibration"
+
msgid "Output lot"
msgstr "Output lot"
@@ -1276,6 +1309,9 @@ msgstr "Reason for rework"
msgid "Recent"
msgstr "Recent"
+msgid "Recently used"
+msgstr "Recently used"
+
msgid "Record"
msgstr "Record"
@@ -1407,9 +1443,15 @@ msgstr "Scrapping the selected serial"
msgid "Search"
msgstr "Search"
+msgid "Search {gaugeTypeName}..."
+msgstr "Search {gaugeTypeName}..."
+
msgid "Search by job or item ID"
msgstr "Search by job or item ID"
+msgid "Search gauges..."
+msgstr "Search gauges..."
+
msgid "Search operators..."
msgstr "Search operators..."
@@ -1444,6 +1486,9 @@ msgstr "Select an item..."
msgid "Select Batch {0}"
msgstr "Select Batch {0}"
+msgid "Select gauge"
+msgstr "Select gauge"
+
msgid "Select Printer"
msgstr "Select Printer"
@@ -1728,6 +1773,9 @@ msgstr "Unissued serial/batch materials"
msgid "Unknown"
msgstr "Unknown"
+msgid "Unknown gauge"
+msgstr "Unknown gauge"
+
msgid "Unlock"
msgstr "Unlock"
diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.po
index ce82b1c41b..1996b28fef 100644
--- a/packages/locale/locales/es/erp.po
+++ b/packages/locale/locales/es/erp.po
@@ -48,6 +48,9 @@ msgstr "\"{taskName}\" está hecho — todos los {0} elementos de su Mapa de Con
msgid "(excluded for this customer)"
msgstr "(excluido para este cliente)"
+msgid "(Inactive)"
+msgstr "(Inactivo)"
+
#. placeholder {0}: target.slackDays
msgid "{0, plural, one {# day of slack} other {# days of slack}}"
msgstr "{0, plural, one {# día de holgura} other {# días de holgura}}"
@@ -1430,6 +1433,9 @@ msgstr "Agregar aplicación de autenticación"
msgid "Add Calibration Record"
msgstr "Agregar Registro de Calibración"
+msgid "Add Characteristic"
+msgstr "Agregar Característica"
+
msgid "Add Child Storage Unit"
msgstr "Agregar unidad de almacenamiento secundaria"
@@ -1460,9 +1466,6 @@ msgstr "Agregar empleado"
msgid "Add Entry"
msgstr "Agregar entrada"
-msgid "Add Feature"
-msgstr "Agregar característica"
-
msgid "Add from library…"
msgstr "Agregar de la biblioteca…"
@@ -1749,6 +1752,9 @@ msgstr "Todos los departamentos"
msgid "All Documents"
msgstr "Todos los documentos"
+msgid "All gauges"
+msgstr "Todos los instrumentos de medición"
+
msgid "All item types"
msgstr "Todos los tipos de artículos"
@@ -2013,6 +2019,9 @@ msgstr "Otra unidad de almacenamiento dentro de la que está anidada esta (p. ej
msgid "Another system is connected to Ramp as its accounting system"
msgstr "Otro sistema está conectado a Ramp como su sistema contable"
+msgid "Any"
+msgstr "Cualquiera"
+
msgid "Any item group"
msgstr "Cualquier grupo de artículos"
@@ -2092,8 +2101,8 @@ msgstr "Se aplica a todos"
msgid "Applies to all work centers"
msgstr "Se aplica a todos los centros de trabajo"
-msgid "Applies to features without their own rule, and to the lot when this plan drives an inspection."
-msgstr "Se aplica a características sin su propia regla, y al lote cuando este plan impulsa una inspección."
+msgid "Applies to characteristics without their own rule, and to the lot when this plan drives an inspection."
+msgstr "Se aplica a las características sin su propia regla y al lote cuando este plan impulsa una inspección."
msgid "Apply"
msgstr "Aplicar"
@@ -3720,6 +3729,15 @@ msgstr "Cambiar esto actualizará el ID de la pieza"
msgid "Changing type resets this item's draft edits."
msgstr "Cambiar el tipo restablece los borradores editados de este elemento."
+msgid "Characteristic"
+msgstr "Característica"
+
+msgid "Characteristic values suggested from drawing"
+msgstr "Valores de características sugeridos del dibujo"
+
+msgid "Characteristics"
+msgstr "Características"
+
msgid "Charges"
msgstr "Cargos"
@@ -3820,6 +3838,9 @@ msgstr "Borrar fecha de vencimiento"
msgid "Clear Filters"
msgstr "Limpiar filtros"
+msgid "Clear gauge"
+msgstr "Limpiar instrumento de medición"
+
msgid "Clear search"
msgstr "Limpiar búsqueda"
@@ -3921,12 +3942,12 @@ msgstr "Contraer {0}"
msgid "Collapse all"
msgstr "Contraer todo"
+msgid "Collapse characteristics table"
+msgstr "Contraer tabla de características"
+
msgid "Collapse Costs"
msgstr "Contraer Costos"
-msgid "Collapse features table"
-msgstr "Contraer tabla de características"
-
msgid "Collapse Labor"
msgstr "Contraer mano de obra"
@@ -4430,6 +4451,9 @@ msgstr "Enlace copiado al portapapeles"
msgid "Copied setup prompt to your clipboard"
msgstr "Indicación de preparación copiada al portapapeles"
+msgid "Copied!"
+msgstr "¡Copiado!"
+
msgid "Copies a setup prompt for your AI coding tool"
msgstr "Copia un prompt de preparación para tu herramienta de codificación IA"
@@ -4445,12 +4469,21 @@ msgstr "Copiar clave API"
msgid "Copy batch number"
msgstr "Copiar número de lote"
+msgid "Copy change notice unique identifier"
+msgstr "Copiar identificador único de aviso de cambio"
+
msgid "Copy company unique identifier"
msgstr "Copiar identificador único de la empresa"
msgid "Copy consumable number"
msgstr "Copiar número de consumible"
+msgid "Copy consumable unique identifier"
+msgstr "Copiar identificador único de consumible"
+
+msgid "Copy customer unique identifier"
+msgstr "Copiar identificador único de cliente"
+
msgid "Copy dispatch ID"
msgstr "Copiar ID de orden de mantenimiento"
@@ -4475,6 +4508,9 @@ msgstr "Copiar identificador único del problema"
msgid "Copy Job number"
msgstr "Copiar número de trabajo"
+msgid "Copy job unique identifier"
+msgstr "Copiar identificador único de orden de trabajo"
+
msgid "Copy link"
msgstr "Copiar enlace"
@@ -4553,6 +4589,15 @@ msgstr "Copiar nombre del procedimiento"
msgid "Copy procedure unique identifier"
msgstr "Copiar identificador único del procedimiento"
+msgid "Copy purchase invoice unique identifier"
+msgstr "Copiar identificador único de factura de compra"
+
+msgid "Copy purchase order unique identifier"
+msgstr "Copiar identificador único de orden de compra"
+
+msgid "Copy purchase return order unique identifier"
+msgstr "Copiar identificador único de orden de devolución de compra"
+
msgid "Copy Quality Document"
msgstr "Copiar Documento de Calidad"
@@ -4562,18 +4607,39 @@ msgstr "Copiar Presupuesto"
msgid "Copy Quote number"
msgstr "Copiar número de cotización"
+msgid "Copy quote unique identifier"
+msgstr "Copiar identificador único de cotización"
+
msgid "Copy return number"
msgstr "Copiar número de devolución"
+msgid "Copy RFQ unique identifier"
+msgstr "Copiar identificador único de RFQ"
+
msgid "Copy RMA number"
msgstr "Copiar número de RMA"
+msgid "Copy sales invoice unique identifier"
+msgstr "Copiar identificador único de factura de venta"
+
+msgid "Copy sales order unique identifier"
+msgstr "Copiar identificador único de pedido de venta"
+
+msgid "Copy sales return order unique identifier"
+msgstr "Copiar identificador único de orden de devolución de venta"
+
msgid "Copy service number"
msgstr "Copiar número de servicio"
msgid "Copy service unique identifier"
msgstr "Copiar identificador único del servicio"
+msgid "Copy supplier quote unique identifier"
+msgstr "Copiar identificador único de cotización del proveedor"
+
+msgid "Copy supplier unique identifier"
+msgstr "Copiar identificador único de proveedor"
+
msgid "Copy this item's pricing to another scope."
msgstr "Copiar la fijación de precios de este artículo a otro alcance."
@@ -4583,6 +4649,9 @@ msgstr "Copia este enlace para compartir la cotización con un cliente"
msgid "Copy this link to share the quote with a supplier"
msgstr "Copia este enlace para compartir la cotización con un proveedor"
+msgid "Copy to clipboard"
+msgstr "Copiar al portapapeles"
+
msgid "Copy tool number"
msgstr "Copiar número de herramienta"
@@ -6119,9 +6188,6 @@ msgstr "Detectado por el planificador de movimiento"
msgid "Developer"
msgstr "Desarrollador"
-msgid "Diagram saved"
-msgstr "Diagrama guardado"
-
msgid "Differs from the selection — allowed, but confirm they nest together"
msgstr "Difiere de la selección — permitido, pero confirme que se anidan juntos"
@@ -6400,11 +6466,11 @@ msgstr "Arrastra para colocar en el dibujo"
msgid "Drag to reorder"
msgstr "Arrastra para reordenar"
-msgid "Drag to resize diagram and features"
-msgstr "Arrastra para redimensionar el diagrama y las características"
+msgid "Drag to resize diagram and characteristics"
+msgstr "Arrastrar para cambiar el tamaño del diagrama y las características"
-msgid "Drag to resize drawing and features"
-msgstr "Arrastra para redimensionar el dibujo y las características"
+msgid "Drag to resize drawing and characteristics"
+msgstr "Arrastrar para cambiar el tamaño del dibujo y las características"
msgid "Drag to zoom"
msgstr "Arrastra para ampliar"
@@ -6415,8 +6481,8 @@ msgstr "Extrayendo"
msgid "Drawing Number"
msgstr "Número de plano"
-msgid "Drawing replaced. Balloon placements were removed; feature rows are unchanged."
-msgstr "Dibujo reemplazado. Las ubicaciones de globos se eliminaron; las filas de características no cambiaron."
+msgid "Drawing replaced. Balloon placements were removed; characteristic rows are unchanged."
+msgstr "Dibujo reemplazado. Se eliminaron las ubicaciones de globos; las filas de características no han cambiado."
msgid "Drop Ship"
msgstr "Envío directo"
@@ -7452,12 +7518,12 @@ msgstr "Expandir {0}"
msgid "Expand all"
msgstr "Expandir todo"
+msgid "Expand characteristics table"
+msgstr "Expandir tabla de características"
+
msgid "Expand Costs"
msgstr "Expandir Costos"
-msgid "Expand features table"
-msgstr "Expandir tabla de características"
-
msgid "Expand Labor"
msgstr "Expandir mano de obra"
@@ -7641,8 +7707,8 @@ msgstr "No conforme"
msgid "Failed"
msgstr "Fallido"
-msgid "Failed features"
-msgstr "Características fallidas"
+msgid "Failed characteristics"
+msgstr "Características defectuosas"
#. placeholder {0}: rows.length
msgid "Failed to add line — {addedCount} of {0} lines were added"
@@ -7893,6 +7959,9 @@ msgstr "No se pudieron cargar las entidades rastreadas"
msgid "Failed to move account: {0}"
msgstr "Error al mover cuenta: {0}"
+msgid "Failed to record gauge"
+msgstr "No se pudo registrar el instrumento de medición"
+
msgid "Failed to regenerate schedule"
msgstr "Fallo al regenerar el programa"
@@ -7926,8 +7995,8 @@ msgstr "Error al recuperar los datos de columna del CSV."
msgid "Failed to save configuration rule"
msgstr "Error al guardar la regla de configuración"
-msgid "Failed to save diagram"
-msgstr "No se pudo guardar el diagrama"
+msgid "Failed to save inspection plan"
+msgstr "No se pudo guardar el plan de inspección"
msgid "Failed to save measurement"
msgstr "Error al guardar la medición"
@@ -8028,15 +8097,6 @@ msgstr "Fax"
msgid "Fax Number"
msgstr "Número de Fax"
-msgid "Feature"
-msgstr "Característica"
-
-msgid "Feature values suggested from drawing"
-msgstr "Valores de características sugeridos del dibujo"
-
-msgid "Features"
-msgstr "Características"
-
msgid "Fees"
msgstr "Tarifas"
@@ -8342,6 +8402,9 @@ msgstr "Instrumento de medición"
msgid "Gauge Calibration Notifications"
msgstr "Notificaciones de calibración de instrumentos de medición"
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Instrumento de medición para la característica {characteristicLabel}: {currentGauge}"
+
msgid "Gauge ID"
msgstr "ID de instrumento de medición"
@@ -11678,6 +11741,9 @@ msgstr "Sin pronóstico disponible para este trabajo."
msgid "No Gauge Selected"
msgstr "Ningún instrumento de medición seleccionado"
+msgid "No gauges found."
+msgstr "No se encontraron instrumentos de medición."
+
msgid "No grouped notifications"
msgstr "Sin notificaciones agrupadas"
@@ -12748,6 +12814,9 @@ msgstr "De lo contrario"
msgid "Out"
msgstr "Fuera"
+msgid "Out of calibration"
+msgstr "Fuera de calibración"
+
msgid "Outbound"
msgstr "Saliente"
@@ -14424,6 +14493,9 @@ msgstr "Pagos recientes"
msgid "Recently Created"
msgstr "Creado Recientemente"
+msgid "Recently used"
+msgstr "Usado recientemente"
+
msgid "Recertify Every (Days)"
msgstr "Recertificar cada (Días)"
@@ -14801,8 +14873,8 @@ msgstr "Reemplaza los datos de esta empresa con un conjunto de datos de demostra
msgid "Replacement Order"
msgstr "Orden de reemplazo"
-msgid "Replacing the PDF removes all balloon placements on this document. Feature rows and their values stay; you can place balloons again on the new drawing."
-msgstr "Reemplazar el PDF elimina todas las colocaciones de globos en este documento. Las filas de características y sus valores permanecen; puede colocar globos nuevamente en el nuevo dibujo."
+msgid "Replacing the PDF removes all balloon placements on this document. Characteristic rows and their values stay; you can place balloons again on the new drawing."
+msgstr "Reemplazar el PDF elimina todas las ubicaciones de globos en este documento. Las filas de características y sus valores permanecen; puede colocar globos nuevamente en el nuevo dibujo."
msgid "Replenishment"
msgstr "Reabastecimiento"
@@ -15550,7 +15622,7 @@ msgstr "Tamaño de Muestra"
msgid "Sampling"
msgstr "Muestreo"
-msgid "Sampling — Feature {featureLabel}"
+msgid "Sampling — Characteristic {featureLabel}"
msgstr "Muestreo — Característica {featureLabel}"
msgid "Sampling Standard"
@@ -15752,6 +15824,9 @@ msgstr "Descartada"
msgid "Search"
msgstr "Buscar"
+msgid "Search {gaugeTypeName}..."
+msgstr "Buscar {gaugeTypeName}..."
+
msgid "Search accounts"
msgstr "Buscar cuentas"
@@ -15797,6 +15872,9 @@ msgstr "Buscar campos..."
msgid "Search for existing or create a new one"
msgstr "Buscar uno existente o crear uno nuevo"
+msgid "Search gauges..."
+msgstr "Buscar instrumentos de medición..."
+
msgid "Search items or bins"
msgstr "Buscar artículos o contenedores"
@@ -15993,6 +16071,9 @@ msgstr "Seleccionar Tipo de Empleado"
msgid "Select field"
msgstr "Seleccionar campo"
+msgid "Select gauge"
+msgstr "Seleccionar instrumento de medición"
+
msgid "Select Gauge"
msgstr "Seleccionar instrumento de medición"
@@ -18113,8 +18194,8 @@ msgstr "El lote será marcado Superado. Se registran {fails} falla(s) muestreada
msgid "The lot will still be rejected, but an NCR cannot be created until at least one Issue Type is configured."
msgstr "El lote seguirá siendo rechazado, pero no se puede crear un NCR hasta que se configure al menos un tipo de problema."
-msgid "The lot's per-feature sampling plan will be re-resolved from the selected document."
-msgstr "El plan de muestreo por característica del lote se volverá a resolver desde el documento seleccionado."
+msgid "The lot's per-characteristic sampling plan will be re-resolved from the selected document."
+msgstr "El plan de muestreo por característica del lote será determinado nuevamente desde el documento seleccionado."
msgid "The lowest amount this supplier will charge for this process, regardless of quantity; jobs below the breakeven volume still cost at least this much."
msgstr "El monto mínimo que este proveedor cobrará por este proceso, independientemente de la cantidad; las órdenes de trabajo por debajo del volumen de equilibrio aún cuestan como mínimo esto."
@@ -19479,6 +19560,9 @@ msgstr "Desconocido"
msgid "unknown error"
msgstr "error desconocido"
+msgid "Unknown gauge"
+msgstr "Instrumento de medición desconocido"
+
msgid "unknown location"
msgstr "ubicación desconocida"
@@ -20051,6 +20135,9 @@ msgstr "Ver notas"
msgid "View on schedule board"
msgstr "Ver en el tablero de programación"
+msgid "View only — changes are not saved"
+msgstr "Solo lectura — los cambios no se guardan"
+
msgid "View Open"
msgstr "Ver Abiertos"
@@ -20968,6 +21055,9 @@ msgstr "Tu invitación es inválida o ya ha sido aceptada. Por favor contacta co
msgid "Your job here: check a real sample of each row, then mark it validated. Foundation data loads first, then master records, then open transactions at cutover."
msgstr "Tu trabajo aquí: verifica una muestra real de cada fila, luego márcala como validada. Los datos de fundación se cargan primero, luego los registros maestros, luego las transacciones abiertas en el momento del cambio."
+msgid "Your latest changes could not be saved. Are you sure you want to leave this page?"
+msgstr "Los cambios recientes no se pudieron guardar. ¿Está seguro de que desea abandonar esta página?"
+
msgid "Your legal name, addresses, branding, and document defaults"
msgstr "Su nombre legal, direcciones, marca y valores predeterminados de documentos"
diff --git a/packages/locale/locales/es/mes.po b/packages/locale/locales/es/mes.po
index be1e5804bf..a4dc8d4bfb 100644
--- a/packages/locale/locales/es/mes.po
+++ b/packages/locale/locales/es/mes.po
@@ -12,6 +12,9 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+msgid "(Inactive)"
+msgstr "(Inactivo)"
+
#. placeholder {0}: attribute.name
#. placeholder {1}: activeStep + 1
msgid "{0} - Set {1}"
@@ -148,6 +151,9 @@ msgstr "Todos"
msgid "All clear"
msgstr "Todo despejado"
+msgid "All gauges"
+msgstr "Todos los instrumentos de medición"
+
msgid "All jobs"
msgstr "Todas las órdenes de trabajo"
@@ -268,6 +274,12 @@ msgstr "Logotipo de Carbon"
msgid "Cards"
msgstr "Tarjetas"
+msgid "Characteristic"
+msgstr "Característica"
+
+msgid "Characteristics"
+msgstr "Características"
+
msgid "Chat"
msgstr "Chat"
@@ -283,6 +295,9 @@ msgstr "Limpiar"
msgid "Clear Filters"
msgstr "Limpiar filtros"
+msgid "Clear gauge"
+msgstr "Borrar instrumento de medición"
+
msgid "Clear Search"
msgstr "Limpiar Búsqueda"
@@ -301,7 +316,7 @@ msgstr "Marcado entrada desde <0/>"
msgid "Close"
msgstr "Cerrar"
-msgid "Collapse features table"
+msgid "Collapse characteristics table"
msgstr "Contraer tabla de características"
msgid "Collapse panel"
@@ -366,6 +381,15 @@ msgstr "Consumido vencido"
msgid "Continue"
msgstr "Continuar"
+msgid "Copied!"
+msgstr "¡Copiado!"
+
+msgid "Copy"
+msgstr "Copiar"
+
+msgid "Copy to clipboard"
+msgstr "Copiar al portapapeles"
+
#. placeholder {0}: board.unplannedCost.days
msgid "Cost of unplanned maintenance, last {0} days"
msgstr "Costo del mantenimiento no planificado, últimos {0} días"
@@ -463,8 +487,8 @@ msgstr "Borrador"
msgid "Drag and drop a file here, or click to select a file"
msgstr "Arrastre y suelte un archivo aquí, o haga clic para seleccionar un archivo"
-msgid "Drag to resize drawing and features"
-msgstr "Arrastra para redimensionar el dibujo y las características"
+msgid "Drag to resize drawing and characteristics"
+msgstr "Arrastra para redimensionar el dibujo y características"
#. placeholder {0}: active.data.current?.type
msgid "Dragging {0} cancelled."
@@ -541,7 +565,7 @@ msgstr "Cada orden de trabajo en el lote de producción sigue estos pasos. Regis
msgid "Every unit has a verdict: {passes} passed and {fails} failed. The lot closes with each unit routed to its own outcome."
msgstr "Cada unidad tiene un veredicto: {passes} superadas y {fails} rechazadas. El lote se cierra con cada unidad dirigida a su propio resultado."
-msgid "Expand features table"
+msgid "Expand characteristics table"
msgstr "Expandir tabla de características"
msgid "Expand panel"
@@ -563,7 +587,7 @@ msgstr "Vencimiento próximo"
msgid "Failed"
msgstr "Fallido"
-msgid "Failed features"
+msgid "Failed characteristics"
msgstr "Características fallidas"
msgid "Failed to complete inventory adjustment"
@@ -581,6 +605,9 @@ msgstr "Error al obtener las operaciones activas"
msgid "Failed to fetch storageUnits"
msgstr "Error al obtener unidades de almacenamiento"
+msgid "Failed to record gauge"
+msgstr "Error al registrar el instrumento de medición"
+
msgid "Failed to save measurement"
msgstr "Error al guardar la medición"
@@ -598,12 +625,6 @@ msgstr "Error al subir el archivo: {0}"
msgid "Failed to upload image"
msgstr "Error al subir la imagen"
-msgid "Feature"
-msgstr "Característica"
-
-msgid "Features"
-msgstr "Características"
-
msgid "File size exceeds 10MB limit"
msgstr "El tamaño del archivo excede el límite de 10MB"
@@ -645,6 +666,12 @@ msgstr "Corrija las cantidades resaltadas antes de completar."
msgid "Forgot to Clock Out?"
msgstr "¿Olvidó fichar salida?"
+msgid "Gauge"
+msgstr "Instrumento de medición"
+
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Instrumento de medición para la característica {characteristicLabel}: {currentGauge}"
+
msgid "General"
msgstr "General"
@@ -959,6 +986,9 @@ msgstr "Sin órdenes de mantenimiento asignadas a usted"
msgid "No files"
msgstr "Sin archivos"
+msgid "No gauges found."
+msgstr "No se encontraron instrumentos de medición."
+
msgid "No Impact"
msgstr "Sin impacto"
@@ -1126,6 +1156,9 @@ msgstr "Opcional"
msgid "or"
msgstr "o"
+msgid "Out of calibration"
+msgstr "Fuera de calibración"
+
msgid "Output lot"
msgstr "Lote de salida"
@@ -1276,6 +1309,9 @@ msgstr "Motivo del retrabajo"
msgid "Recent"
msgstr "Recientes"
+msgid "Recently used"
+msgstr "Usado recientemente"
+
msgid "Record"
msgstr "Registrar"
@@ -1407,9 +1443,15 @@ msgstr "Descartando la serie seleccionada"
msgid "Search"
msgstr "Buscar"
+msgid "Search {gaugeTypeName}..."
+msgstr "Buscar {gaugeTypeName}..."
+
msgid "Search by job or item ID"
msgstr "Buscar por ID de trabajo o artículo"
+msgid "Search gauges..."
+msgstr "Buscar instrumentos de medición..."
+
msgid "Search operators..."
msgstr "Buscar operadores..."
@@ -1444,6 +1486,9 @@ msgstr "Seleccione un artículo..."
msgid "Select Batch {0}"
msgstr "Seleccionar lote {0}"
+msgid "Select gauge"
+msgstr "Seleccionar instrumento de medición"
+
msgid "Select Printer"
msgstr "Seleccionar Impresora"
@@ -1728,6 +1773,9 @@ msgstr "Materiales de serie/lote no emitidos"
msgid "Unknown"
msgstr "Desconocido"
+msgid "Unknown gauge"
+msgstr "Instrumento de medición desconocido"
+
msgid "Unlock"
msgstr "Desbloquear"
diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.po
index 212607f1d7..fcf00de909 100644
--- a/packages/locale/locales/fr/erp.po
+++ b/packages/locale/locales/fr/erp.po
@@ -48,6 +48,9 @@ msgstr "« {taskName} » est fait – tous les {0} éléments de sa carte de mis
msgid "(excluded for this customer)"
msgstr "(exclu pour ce client)"
+msgid "(Inactive)"
+msgstr "(Inactif)"
+
#. placeholder {0}: target.slackDays
msgid "{0, plural, one {# day of slack} other {# days of slack}}"
msgstr "{0, plural, one {# jour de marge} other {# jours de marge}}"
@@ -1430,6 +1433,9 @@ msgstr "Ajouter une application d'authentification"
msgid "Add Calibration Record"
msgstr "Ajouter un enregistrement d'étalonnage"
+msgid "Add Characteristic"
+msgstr "Ajouter une caractéristique"
+
msgid "Add Child Storage Unit"
msgstr "Ajouter une unité de stockage enfant"
@@ -1460,9 +1466,6 @@ msgstr "Ajouter un employé"
msgid "Add Entry"
msgstr "Ajouter une entrée"
-msgid "Add Feature"
-msgstr "Ajouter une fonctionnalité"
-
msgid "Add from library…"
msgstr "Ajouter à partir de la bibliothèque…"
@@ -1749,6 +1752,9 @@ msgstr "Tous les départements"
msgid "All Documents"
msgstr "Tous les documents"
+msgid "All gauges"
+msgstr "Tous les instruments de mesure"
+
msgid "All item types"
msgstr "Tous les types d'articles"
@@ -2013,6 +2019,9 @@ msgstr "Une autre unité de stockage dans laquelle celle-ci est imbriquée (p. e
msgid "Another system is connected to Ramp as its accounting system"
msgstr "Un autre système est connecté à Ramp en tant que système comptable"
+msgid "Any"
+msgstr "Tout"
+
msgid "Any item group"
msgstr "Tout groupe d'articles"
@@ -2092,8 +2101,8 @@ msgstr "S'applique à tous"
msgid "Applies to all work centers"
msgstr "S'applique à tous les Postes de travail"
-msgid "Applies to features without their own rule, and to the lot when this plan drives an inspection."
-msgstr "S'applique aux fonctionnalités sans leur propre Règle, et au Lot quand ce plan dirige un Contrôle."
+msgid "Applies to characteristics without their own rule, and to the lot when this plan drives an inspection."
+msgstr "S'applique aux caractéristiques sans leur propre règle et au lot lorsque ce plan de contrôle entraîne une inspection."
msgid "Apply"
msgstr "Appliquer"
@@ -3720,6 +3729,15 @@ msgstr "Modifier ceci mettra à jour l'ID de pièce"
msgid "Changing type resets this item's draft edits."
msgstr "Modifier le type réinitialise les brouillons de cet article."
+msgid "Characteristic"
+msgstr "Caractéristique"
+
+msgid "Characteristic values suggested from drawing"
+msgstr "Valeurs de caractéristique suggérées à partir du dessin"
+
+msgid "Characteristics"
+msgstr "Caractéristiques"
+
msgid "Charges"
msgstr "Débits"
@@ -3820,6 +3838,9 @@ msgstr "Effacer la date d'échéance"
msgid "Clear Filters"
msgstr "Effacer les filtres"
+msgid "Clear gauge"
+msgstr "Effacer l'instrument de mesure"
+
msgid "Clear search"
msgstr "Effacer la recherche"
@@ -3921,12 +3942,12 @@ msgstr "Réduire {0}"
msgid "Collapse all"
msgstr "Réduire tout"
+msgid "Collapse characteristics table"
+msgstr "Réduire le tableau des caractéristiques"
+
msgid "Collapse Costs"
msgstr "Réduire les coûts"
-msgid "Collapse features table"
-msgstr "Réduire le tableau des fonctionnalités"
-
msgid "Collapse Labor"
msgstr "Réduire la main-d'œuvre"
@@ -4430,6 +4451,9 @@ msgstr "Lien copié dans le presse-papiers"
msgid "Copied setup prompt to your clipboard"
msgstr "Invite de Réglage copiée dans votre presse-papiers"
+msgid "Copied!"
+msgstr "Copié !"
+
msgid "Copies a setup prompt for your AI coding tool"
msgstr "Copie une invite de réglage pour votre outil de codage IA"
@@ -4445,12 +4469,21 @@ msgstr "Copier la clé API"
msgid "Copy batch number"
msgstr "Copier le numéro de lot de production"
+msgid "Copy change notice unique identifier"
+msgstr "Copier l'identifiant unique de l'avis de modification"
+
msgid "Copy company unique identifier"
msgstr "Copier l'identifiant unique de la Société"
msgid "Copy consumable number"
msgstr "Copier le numéro de consommable"
+msgid "Copy consumable unique identifier"
+msgstr "Copier l'identifiant unique du consommable"
+
+msgid "Copy customer unique identifier"
+msgstr "Copier l'identifiant unique du client"
+
msgid "Copy dispatch ID"
msgstr "Copier l'ID de l'intervention de maintenance"
@@ -4475,6 +4508,9 @@ msgstr "Copier l'identifiant unique du problème"
msgid "Copy Job number"
msgstr "Copier le numéro de travail"
+msgid "Copy job unique identifier"
+msgstr "Copier l'identifiant unique de l'ordre de fabrication"
+
msgid "Copy link"
msgstr "Copier le lien"
@@ -4553,6 +4589,15 @@ msgstr "Copier le nom de la procédure"
msgid "Copy procedure unique identifier"
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 unique identifier"
+msgstr "Copier l'identifiant unique du bon de commande"
+
+msgid "Copy purchase return order unique identifier"
+msgstr "Copier l'identifiant unique de l'ordre de retour d'achat"
+
msgid "Copy Quality Document"
msgstr "Copier le Document de Qualité"
@@ -4562,18 +4607,39 @@ msgstr "Copier le devis"
msgid "Copy Quote number"
msgstr "Copier le numéro de devis"
+msgid "Copy quote unique identifier"
+msgstr "Copier l'identifiant unique du devis"
+
msgid "Copy return number"
msgstr "Copier le numéro de retour"
+msgid "Copy RFQ unique identifier"
+msgstr "Copier l'identifiant unique de la RFQ"
+
msgid "Copy RMA number"
msgstr "Copier le numéro de RMA"
+msgid "Copy sales invoice unique identifier"
+msgstr "Copier l'identifiant unique de la facture de vente"
+
+msgid "Copy sales order unique identifier"
+msgstr "Copier l'identifiant unique de la commande client"
+
+msgid "Copy sales return order unique identifier"
+msgstr "Copier l'identifiant unique de l'ordre de retour de vente"
+
msgid "Copy service number"
msgstr "Copier le numéro de service"
msgid "Copy service unique identifier"
msgstr "Copier l'identifiant unique du service"
+msgid "Copy supplier quote unique identifier"
+msgstr "Copier l'identifiant unique du devis fournisseur"
+
+msgid "Copy supplier unique identifier"
+msgstr "Copier l'identifiant unique du fournisseur"
+
msgid "Copy this item's pricing to another scope."
msgstr "Copiez la tarification de cet article vers une autre portée."
@@ -4583,6 +4649,9 @@ msgstr "Copiez ce lien pour partager le devis avec un client"
msgid "Copy this link to share the quote with a supplier"
msgstr "Copiez ce lien pour partager le devis avec un fournisseur"
+msgid "Copy to clipboard"
+msgstr "Copier dans le presse-papiers"
+
msgid "Copy tool number"
msgstr "Copier le numéro d'outil"
@@ -6119,9 +6188,6 @@ msgstr "Détecté par le planificateur de mouvement"
msgid "Developer"
msgstr "Développeur"
-msgid "Diagram saved"
-msgstr "Diagramme enregistré"
-
msgid "Differs from the selection — allowed, but confirm they nest together"
msgstr "Diffère de la sélection — autorisé, mais confirmez qu'ils s'imbriquent ensemble"
@@ -6400,11 +6466,11 @@ msgstr "Faites glisser pour placer sur le dessin"
msgid "Drag to reorder"
msgstr "Glisser pour réorganiser"
-msgid "Drag to resize diagram and features"
-msgstr "Faites glisser pour redimensionner le diagramme et les fonctionnalités"
+msgid "Drag to resize diagram and characteristics"
+msgstr "Faites glisser pour redimensionner le diagramme et les caractéristiques"
-msgid "Drag to resize drawing and features"
-msgstr "Faites glisser pour redimensionner le dessin et les fonctionnalités"
+msgid "Drag to resize drawing and characteristics"
+msgstr "Faites glisser pour redimensionner le dessin et les caractéristiques"
msgid "Drag to zoom"
msgstr "Glisser pour zoomer"
@@ -6415,8 +6481,8 @@ msgstr "Prélèvement"
msgid "Drawing Number"
msgstr "Numéro de plan"
-msgid "Drawing replaced. Balloon placements were removed; feature rows are unchanged."
-msgstr "Le dessin a été remplacé. Les placements de bulles ont été supprimés ; les lignes de fonctionnalités restent inchangées."
+msgid "Drawing replaced. Balloon placements were removed; characteristic rows are unchanged."
+msgstr "Dessin remplacé. Les placements de bulles ont été supprimés ; les lignes de caractéristiques restent inchangées."
msgid "Drop Ship"
msgstr "Livraison directe"
@@ -7452,12 +7518,12 @@ msgstr "Développer {0}"
msgid "Expand all"
msgstr "Développer tout"
+msgid "Expand characteristics table"
+msgstr "Développer le tableau des caractéristiques"
+
msgid "Expand Costs"
msgstr "Développer les coûts"
-msgid "Expand features table"
-msgstr "Développer le tableau des fonctionnalités"
-
msgid "Expand Labor"
msgstr "Développer Main-d'œuvre"
@@ -7641,7 +7707,7 @@ msgstr "Non conforme"
msgid "Failed"
msgstr "Échoué"
-msgid "Failed features"
+msgid "Failed characteristics"
msgstr "Caractéristiques échouées"
#. placeholder {0}: rows.length
@@ -7893,6 +7959,9 @@ msgstr "Impossible de charger les entités suivies"
msgid "Failed to move account: {0}"
msgstr "Impossible de déplacer le compte : {0}"
+msgid "Failed to record gauge"
+msgstr "Échec de l'enregistrement de l'instrument de mesure"
+
msgid "Failed to regenerate schedule"
msgstr "Impossible de régénérer le planning"
@@ -7926,8 +7995,8 @@ msgstr "Impossible de récupérer les données de colonne CSV."
msgid "Failed to save configuration rule"
msgstr "Échec de l'enregistrement de la règle de configuration"
-msgid "Failed to save diagram"
-msgstr "Impossible d'enregistrer le diagramme"
+msgid "Failed to save inspection plan"
+msgstr "Échec de l'enregistrement du plan de contrôle"
msgid "Failed to save measurement"
msgstr "Impossible d'enregistrer la mesure"
@@ -8028,15 +8097,6 @@ msgstr "Télécopie"
msgid "Fax Number"
msgstr "Numéro de fax"
-msgid "Feature"
-msgstr "Fonctionnalité"
-
-msgid "Feature values suggested from drawing"
-msgstr "Valeurs de caractéristiques suggérées à partir du dessin"
-
-msgid "Features"
-msgstr "Fonctionnalités"
-
msgid "Fees"
msgstr "Frais"
@@ -8342,6 +8402,9 @@ msgstr "Instrument de mesure"
msgid "Gauge Calibration Notifications"
msgstr "Notifications d'étalonnage de l'instrument de mesure"
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Instrument de mesure pour la caractéristique {characteristicLabel} : {currentGauge}"
+
msgid "Gauge ID"
msgstr "ID instrument de mesure"
@@ -11678,6 +11741,9 @@ msgstr "Aucune prévision disponible pour ce travail."
msgid "No Gauge Selected"
msgstr "Aucun instrument de mesure sélectionné"
+msgid "No gauges found."
+msgstr "Aucun instrument de mesure trouvé."
+
msgid "No grouped notifications"
msgstr "Aucune notification groupée"
@@ -12748,6 +12814,9 @@ msgstr "Sinon"
msgid "Out"
msgstr "Hors"
+msgid "Out of calibration"
+msgstr "Hors étalonnage"
+
msgid "Outbound"
msgstr "Expédition"
@@ -14424,6 +14493,9 @@ msgstr "Paiements récents"
msgid "Recently Created"
msgstr "Récemment créé"
+msgid "Recently used"
+msgstr "Utilisé récemment"
+
msgid "Recertify Every (Days)"
msgstr "Recertifier tous les (jours)"
@@ -14801,8 +14873,8 @@ msgstr "Remplacer les données de cette société par un ensemble de données de
msgid "Replacement Order"
msgstr "Commande de remplacement"
-msgid "Replacing the PDF removes all balloon placements on this document. Feature rows and their values stay; you can place balloons again on the new drawing."
-msgstr "Le remplacement du PDF supprime tous les placements de bulles sur ce document. Les lignes de fonctionnalités et leurs valeurs restent ; vous pouvez placer à nouveau les bulles sur le nouveau dessin."
+msgid "Replacing the PDF removes all balloon placements on this document. Characteristic rows and their values stay; you can place balloons again on the new drawing."
+msgstr "Le remplacement du PDF supprime tous les placements de bulles sur ce document. Les lignes de caractéristiques et leurs valeurs restent ; vous pouvez placer les bulles à nouveau sur le nouveau dessin."
msgid "Replenishment"
msgstr "Réapprovisionnement"
@@ -15550,8 +15622,8 @@ msgstr "Taille d'échantillon"
msgid "Sampling"
msgstr "Échantillonnage"
-msgid "Sampling — Feature {featureLabel}"
-msgstr "Échantillonnage — Fonctionnalité {featureLabel}"
+msgid "Sampling — Characteristic {featureLabel}"
+msgstr "Échantillonnage — Caractéristique {featureLabel}"
msgid "Sampling Standard"
msgstr "Norme d'échantillonnage"
@@ -15752,6 +15824,9 @@ msgstr "Mise au rebut"
msgid "Search"
msgstr "Rechercher"
+msgid "Search {gaugeTypeName}..."
+msgstr "Rechercher {gaugeTypeName}..."
+
msgid "Search accounts"
msgstr "Rechercher les comptes"
@@ -15797,6 +15872,9 @@ msgstr "Rechercher des champs..."
msgid "Search for existing or create a new one"
msgstr "Rechercher un existant ou en créer un nouveau"
+msgid "Search gauges..."
+msgstr "Rechercher des instruments de mesure..."
+
msgid "Search items or bins"
msgstr "Rechercher des articles ou des casiers"
@@ -15993,6 +16071,9 @@ msgstr "Sélectionner le type d'employé"
msgid "Select field"
msgstr "Sélectionner un champ"
+msgid "Select gauge"
+msgstr "Sélectionner un instrument de mesure"
+
msgid "Select Gauge"
msgstr "Sélectionner un instrument de mesure"
@@ -18113,8 +18194,8 @@ msgstr "Le lot sera marqué Réussi. {fails} défaut(s) d'échantillonnage sont
msgid "The lot will still be rejected, but an NCR cannot be created until at least one Issue Type is configured."
msgstr "Le lot sera toujours rejeté, mais un NCR ne peut pas être créé tant qu'au moins un type de problème n'est pas configuré."
-msgid "The lot's per-feature sampling plan will be re-resolved from the selected document."
-msgstr "Le plan d'échantillonnage par caractéristique du lot sera re-résolu à partir du document sélectionné."
+msgid "The lot's per-characteristic sampling plan will be re-resolved from the selected document."
+msgstr "Le plan d'échantillonnage par caractéristique du lot sera redéterminé à partir du document sélectionné."
msgid "The lowest amount this supplier will charge for this process, regardless of quantity; jobs below the breakeven volume still cost at least this much."
msgstr "Le montant minimum que ce fournisseur facturera pour ce procédé, indépendamment de la quantité; les ordres de fabrication en dessous du volume de rentabilité coûtent au moins ce montant."
@@ -19479,6 +19560,9 @@ msgstr "Inconnu"
msgid "unknown error"
msgstr "erreur inconnue"
+msgid "Unknown gauge"
+msgstr "Instrument de mesure inconnu"
+
msgid "unknown location"
msgstr "localisation inconnue"
@@ -20051,6 +20135,9 @@ msgstr "Afficher les notes"
msgid "View on schedule board"
msgstr "Voir sur le tableau de planification"
+msgid "View only — changes are not saved"
+msgstr "Lecture seule — les modifications ne sont pas enregistrées"
+
msgid "View Open"
msgstr "Afficher les ouvertes"
@@ -20968,6 +21055,9 @@ msgstr "Votre invitation est invalide ou a déjà été acceptée. Veuillez cont
msgid "Your job here: check a real sample of each row, then mark it validated. Foundation data loads first, then master records, then open transactions at cutover."
msgstr "Votre travail ici : vérifiez un vrai échantillon de chaque ligne, puis marquez-le comme validé. Les données de base se chargent en premier, puis les enregistrements principaux, puis les transactions ouvertes au basculement."
+msgid "Your latest changes could not be saved. Are you sure you want to leave this page?"
+msgstr "Vos dernières modifications n'ont pas pu être enregistrées. Êtes-vous sûr de vouloir quitter cette page ?"
+
msgid "Your legal name, addresses, branding, and document defaults"
msgstr "Votre nom légal, adresses, marque et paramètres par défaut des documents"
diff --git a/packages/locale/locales/fr/mes.po b/packages/locale/locales/fr/mes.po
index 4903a0cf27..a4859023e9 100644
--- a/packages/locale/locales/fr/mes.po
+++ b/packages/locale/locales/fr/mes.po
@@ -12,6 +12,9 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+msgid "(Inactive)"
+msgstr "(Inactif)"
+
#. placeholder {0}: attribute.name
#. placeholder {1}: activeStep + 1
msgid "{0} - Set {1}"
@@ -148,6 +151,9 @@ msgstr "Tout"
msgid "All clear"
msgstr "Tout est correct"
+msgid "All gauges"
+msgstr "Tous les instruments de mesure"
+
msgid "All jobs"
msgstr "Tous les ordres de fabrication"
@@ -268,6 +274,12 @@ msgstr "Logo Carbon"
msgid "Cards"
msgstr "Cartes"
+msgid "Characteristic"
+msgstr "Caractéristique"
+
+msgid "Characteristics"
+msgstr "Caractéristiques"
+
msgid "Chat"
msgstr "Discussion"
@@ -283,6 +295,9 @@ msgstr "Effacer"
msgid "Clear Filters"
msgstr "Effacer les filtres"
+msgid "Clear gauge"
+msgstr "Effacer l'instrument de mesure"
+
msgid "Clear Search"
msgstr "Effacer la recherche"
@@ -301,7 +316,7 @@ msgstr "Connecté depuis <0/>"
msgid "Close"
msgstr "Fermer"
-msgid "Collapse features table"
+msgid "Collapse characteristics table"
msgstr "Réduire le tableau des caractéristiques"
msgid "Collapse panel"
@@ -366,6 +381,15 @@ msgstr "Consommé expiré"
msgid "Continue"
msgstr "Continuer"
+msgid "Copied!"
+msgstr "Copié !"
+
+msgid "Copy"
+msgstr "Copier"
+
+msgid "Copy to clipboard"
+msgstr "Copier dans le presse-papiers"
+
#. placeholder {0}: board.unplannedCost.days
msgid "Cost of unplanned maintenance, last {0} days"
msgstr "Coût de la maintenance imprévue, {0} derniers jours"
@@ -463,7 +487,7 @@ msgstr "Brouillon"
msgid "Drag and drop a file here, or click to select a file"
msgstr "Glissez-déposez un fichier ici, ou cliquez pour sélectionner un fichier"
-msgid "Drag to resize drawing and features"
+msgid "Drag to resize drawing and characteristics"
msgstr "Faites glisser pour redimensionner le dessin et les caractéristiques"
#. placeholder {0}: active.data.current?.type
@@ -541,8 +565,8 @@ msgstr "Chaque ordre de fabrication du lot de production suit ces étapes. Enreg
msgid "Every unit has a verdict: {passes} passed and {fails} failed. The lot closes with each unit routed to its own outcome."
msgstr "Chaque unité a un verdict : {passes} réussie(s) et {fails} échouée(s). Le lot se ferme avec chaque unité acheminée vers son propre résultat."
-msgid "Expand features table"
-msgstr "Développer le tableau des caractéristiques"
+msgid "Expand characteristics table"
+msgstr "Agrandir le tableau des caractéristiques"
msgid "Expand panel"
msgstr "Agrandir le panneau"
@@ -563,8 +587,8 @@ msgstr "Expiration en premier"
msgid "Failed"
msgstr "Échoué"
-msgid "Failed features"
-msgstr "Fonctionnalités échouées"
+msgid "Failed characteristics"
+msgstr "Caractéristiques non conformes"
msgid "Failed to complete inventory adjustment"
msgstr "Échec de l'ajustement de stock"
@@ -581,6 +605,9 @@ msgstr "Échec de la récupération des opérations actives"
msgid "Failed to fetch storageUnits"
msgstr "Échec de la récupération des unités de stockage"
+msgid "Failed to record gauge"
+msgstr "Échec de l'enregistrement de l'instrument de mesure"
+
msgid "Failed to save measurement"
msgstr "Échec de l'enregistrement de la mesure"
@@ -598,12 +625,6 @@ msgstr "Échec du téléversement du fichier : {0}"
msgid "Failed to upload image"
msgstr "Échec du téléversement de l'image"
-msgid "Feature"
-msgstr "Fonctionnalité"
-
-msgid "Features"
-msgstr "Caractéristiques"
-
msgid "File size exceeds 10MB limit"
msgstr "La taille du fichier dépasse la limite de 10 Mo"
@@ -645,6 +666,12 @@ msgstr "Corrigez les quantités surlignées avant de continuer."
msgid "Forgot to Clock Out?"
msgstr "Avez-vous oublié le pointage fin ?"
+msgid "Gauge"
+msgstr "Instrument de mesure"
+
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Instrument de mesure pour la caractéristique {characteristicLabel} : {currentGauge}"
+
msgid "General"
msgstr "Général"
@@ -959,6 +986,9 @@ msgstr "Aucune intervention de maintenance qui vous est assignée"
msgid "No files"
msgstr "Aucun fichier"
+msgid "No gauges found."
+msgstr "Aucun instrument de mesure trouvé."
+
msgid "No Impact"
msgstr "Aucun impact"
@@ -1126,6 +1156,9 @@ msgstr "Optionnel"
msgid "or"
msgstr "ou"
+msgid "Out of calibration"
+msgstr "Hors d'étalonnage"
+
msgid "Output lot"
msgstr "Lot de sortie"
@@ -1276,6 +1309,9 @@ msgstr "Raison de la retouche"
msgid "Recent"
msgstr "Récent"
+msgid "Recently used"
+msgstr "Utilisés récemment"
+
msgid "Record"
msgstr "Enregistrer"
@@ -1407,9 +1443,15 @@ msgstr "Mise au rebut du numéro de série sélectionné"
msgid "Search"
msgstr "Rechercher"
+msgid "Search {gaugeTypeName}..."
+msgstr "Rechercher {gaugeTypeName}..."
+
msgid "Search by job or item ID"
msgstr "Rechercher par numéro de travail ou d'article"
+msgid "Search gauges..."
+msgstr "Rechercher les instruments de mesure..."
+
msgid "Search operators..."
msgstr "Rechercher des opérateurs..."
@@ -1444,6 +1486,9 @@ msgstr "Sélectionner un article..."
msgid "Select Batch {0}"
msgstr "Sélectionner le lot {0}"
+msgid "Select gauge"
+msgstr "Sélectionner un instrument de mesure"
+
msgid "Select Printer"
msgstr "Sélectionner l'imprimante"
@@ -1728,6 +1773,9 @@ msgstr "Matériaux série/lot non distribués"
msgid "Unknown"
msgstr "Inconnu"
+msgid "Unknown gauge"
+msgstr "Instrument de mesure inconnu"
+
msgid "Unlock"
msgstr "Déverrouiller"
diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.po
index 50b418b459..d45f7ab44a 100644
--- a/packages/locale/locales/hi/erp.po
+++ b/packages/locale/locales/hi/erp.po
@@ -48,6 +48,9 @@ msgstr "\"{taskName}\" पूरा हो गया — इसके सभी
msgid "(excluded for this customer)"
msgstr "(इस ग्राहक के लिए बाहर रखा गया)"
+msgid "(Inactive)"
+msgstr "(निष्क्रिय)"
+
#. placeholder {0}: target.slackDays
msgid "{0, plural, one {# day of slack} other {# days of slack}}"
msgstr "{0, plural, one {# दिन का अतिरिक्त समय} other {# दिन का अतिरिक्त समय}}"
@@ -1430,6 +1433,9 @@ msgstr "ऑथेंटिकेटर ऐप जोड़ें"
msgid "Add Calibration Record"
msgstr "अंशांकन रिकॉर्ड जोड़ें"
+msgid "Add Characteristic"
+msgstr "विशेषता जोड़ें"
+
msgid "Add Child Storage Unit"
msgstr "बाल भंडारण इकाई जोड़ें"
@@ -1460,9 +1466,6 @@ msgstr "कर्मचारी जोड़ें"
msgid "Add Entry"
msgstr "प्रविष्टि जोड़ें"
-msgid "Add Feature"
-msgstr "फीचर जोड़ें"
-
msgid "Add from library…"
msgstr "लाइब्रेरी से जोड़ें…"
@@ -1749,6 +1752,9 @@ msgstr "सभी विभाग"
msgid "All Documents"
msgstr "सभी दस्तावेज़"
+msgid "All gauges"
+msgstr "सभी गेज"
+
msgid "All item types"
msgstr "सभी आइटम प्रकार"
@@ -2013,6 +2019,9 @@ msgstr "एक अन्य भंडारण इकाई जिसमें
msgid "Another system is connected to Ramp as its accounting system"
msgstr "एक अन्य सिस्टम Ramp से इसके लेखांकन प्रणाली के रूप में जुड़ा हुआ है"
+msgid "Any"
+msgstr "कोई भी"
+
msgid "Any item group"
msgstr "कोई भी आइटम समूह"
@@ -2092,8 +2101,8 @@ msgstr "सभी पर लागू होता है"
msgid "Applies to all work centers"
msgstr "सभी वर्क सेंटर पर लागू होता है"
-msgid "Applies to features without their own rule, and to the lot when this plan drives an inspection."
-msgstr "उन सुविधाओं पर लागू होता है जिनके अपने नियम नहीं हैं, और जब यह योजना निरीक्षण चलाती है तो लॉट पर लागू होता है।"
+msgid "Applies to characteristics without their own rule, and to the lot when this plan drives an inspection."
+msgstr "उन विशेषताओं पर लागू होता है जिनके अपने नियम नहीं हैं, और लॉट पर जब यह योजना निरीक्षण संचालित करती है।"
msgid "Apply"
msgstr "लागू करें"
@@ -3720,6 +3729,15 @@ msgstr "इसे बदलने से पार्ट ID अपडेट ह
msgid "Changing type resets this item's draft edits."
msgstr "प्रकार बदलने से इस आइटम की ड्राफ्ट संपादन रीसेट हो जाती है।"
+msgid "Characteristic"
+msgstr "विशेषता"
+
+msgid "Characteristic values suggested from drawing"
+msgstr "ड्राइंग से सुझाई गई विशेषता के मान"
+
+msgid "Characteristics"
+msgstr "विशेषताएं"
+
msgid "Charges"
msgstr "शुल्क"
@@ -3820,6 +3838,9 @@ msgstr "नियत तिथि साफ करें"
msgid "Clear Filters"
msgstr "फ़िल्टर साफ़ करें"
+msgid "Clear gauge"
+msgstr "गेज साफ़ करें"
+
msgid "Clear search"
msgstr "खोज साफ़ करें"
@@ -3921,12 +3942,12 @@ msgstr "{0} को संक्षिप्त करें"
msgid "Collapse all"
msgstr "सभी को संक्षिप्त करें"
+msgid "Collapse characteristics table"
+msgstr "विशेषताओं की तालिका को संपीड़ित करें"
+
msgid "Collapse Costs"
msgstr "लागत को संक्षिप्त करें"
-msgid "Collapse features table"
-msgstr "फीचर्स टेबल को संक्षिप्त करें"
-
msgid "Collapse Labor"
msgstr "श्रम को संक्षिप्त करें"
@@ -4430,6 +4451,9 @@ msgstr "क्लिपबोर्ड में लिंक कॉपी क
msgid "Copied setup prompt to your clipboard"
msgstr "सेटअप प्रॉम्प्ट आपके क्लिपबोर्ड में कॉपी किया गया"
+msgid "Copied!"
+msgstr "कॉपी हो गया!"
+
msgid "Copies a setup prompt for your AI coding tool"
msgstr "आपकी AI कोडिंग टूल के लिए एक सेटअप प्रॉम्प्ट कॉपी करता है"
@@ -4445,12 +4469,21 @@ msgstr "API कुंजी की नकल करें"
msgid "Copy batch number"
msgstr "बैच नंबर कॉपी करें"
+msgid "Copy change notice unique identifier"
+msgstr "परिवर्तन सूचना की विशिष्ट पहचान नकल करें"
+
msgid "Copy company unique identifier"
msgstr "कंपनी के अद्वितीय पहचानकर्ता की प्रतिलिपि बनाएं"
msgid "Copy consumable number"
msgstr "उपभोग्य सामग्री संख्या की नकल करें"
+msgid "Copy consumable unique identifier"
+msgstr "उपभोग्य सामग्री की विशिष्ट पहचान नकल करें"
+
+msgid "Copy customer unique identifier"
+msgstr "ग्राहक की विशिष्ट पहचान नकल करें"
+
msgid "Copy dispatch ID"
msgstr "रखरखाव कार्य ID की नकल करें"
@@ -4475,6 +4508,9 @@ msgstr "समस्या की अद्वितीय पहचान क
msgid "Copy Job number"
msgstr "जॉब नंबर कॉपी करें"
+msgid "Copy job unique identifier"
+msgstr "जॉब की विशिष्ट पहचान नकल करें"
+
msgid "Copy link"
msgstr "लिंक कॉपी करें"
@@ -4553,6 +4589,15 @@ msgstr "कार्यविधि का नाम नकल करें"
msgid "Copy procedure unique identifier"
msgstr "कार्यविधि की अद्वितीय पहचान की नकल करें"
+msgid "Copy purchase invoice unique identifier"
+msgstr "क्रय चालान की विशिष्ट पहचान नकल करें"
+
+msgid "Copy purchase order unique identifier"
+msgstr "क्रय आदेश की विशिष्ट पहचान नकल करें"
+
+msgid "Copy purchase return order unique identifier"
+msgstr "क्रय रिटर्न आदेश की विशिष्ट पहचान नकल करें"
+
msgid "Copy Quality Document"
msgstr "गुणवत्ता दस्तावेज़ कॉपी करें"
@@ -4562,18 +4607,39 @@ msgstr "उद्धरण की प्रतिलिपि बनाएँ"
msgid "Copy Quote number"
msgstr "उद्धरण संख्या कॉपी करें"
+msgid "Copy quote unique identifier"
+msgstr "कोटेशन की विशिष्ट पहचान नकल करें"
+
msgid "Copy return number"
msgstr "रिटर्न नंबर कॉपी करें"
+msgid "Copy RFQ unique identifier"
+msgstr "RFQ की विशिष्ट पहचान नकल करें"
+
msgid "Copy RMA number"
msgstr "RMA नंबर कॉपी करें"
+msgid "Copy sales invoice unique identifier"
+msgstr "विक्रय चालान की विशिष्ट पहचान नकल करें"
+
+msgid "Copy sales order unique identifier"
+msgstr "विक्रय आदेश की विशिष्ट पहचान नकल करें"
+
+msgid "Copy sales return order unique identifier"
+msgstr "विक्रय रिटर्न आदेश की विशिष्ट पहचान नकल करें"
+
msgid "Copy service number"
msgstr "सेवा संख्या कॉपी करें"
msgid "Copy service unique identifier"
msgstr "सेवा अनन्य पहचानकर्ता कॉपी करें"
+msgid "Copy supplier quote unique identifier"
+msgstr "आपूर्तिकर्ता कोटेशन की विशिष्ट पहचान नकल करें"
+
+msgid "Copy supplier unique identifier"
+msgstr "आपूर्तिकर्ता की विशिष्ट पहचान नकल करें"
+
msgid "Copy this item's pricing to another scope."
msgstr "इस आइटम की मूल्य निर्धारण को दूसरे स्कोप में कॉपी करें।"
@@ -4583,6 +4649,9 @@ msgstr "इस लिंक को कॉपी करें ताकि आप
msgid "Copy this link to share the quote with a supplier"
msgstr "कोटेशन को आपूर्तिकर्ता के साथ साझा करने के लिए इस लिंक की नकल करें"
+msgid "Copy to clipboard"
+msgstr "क्लिपबोर्ड पर कॉपी करें"
+
msgid "Copy tool number"
msgstr "टूल नंबर कॉपी करें"
@@ -6119,9 +6188,6 @@ msgstr "गति योजनाकार द्वारा पहचाना
msgid "Developer"
msgstr "डेवलपर"
-msgid "Diagram saved"
-msgstr "आरेख सहेजा गया"
-
msgid "Differs from the selection — allowed, but confirm they nest together"
msgstr "चयन से अलग — अनुमत, लेकिन पुष्टि करें कि वे एक साथ नेस्ट करते हैं"
@@ -6400,11 +6466,11 @@ msgstr "ड्राइंग पर रखने के लिए ड्रै
msgid "Drag to reorder"
msgstr "पुनः व्यवस्थित करने के लिए खींचें"
-msgid "Drag to resize diagram and features"
-msgstr "आरेख और सुविधाओं को पुनः आकार देने के लिए खींचें"
+msgid "Drag to resize diagram and characteristics"
+msgstr "आरेख और विशेषताओं को आकार बदलने के लिए खींचें"
-msgid "Drag to resize drawing and features"
-msgstr "ड्राइंग और विशेषताओं को आकार बदलने के लिए खींचें"
+msgid "Drag to resize drawing and characteristics"
+msgstr "चित्र और विशेषताओं को आकार बदलने के लिए खींचें"
msgid "Drag to zoom"
msgstr "ज़ूम करने के लिए ड्रैग करें"
@@ -6415,8 +6481,8 @@ msgstr "आहरण"
msgid "Drawing Number"
msgstr "ड्राइंग नंबर"
-msgid "Drawing replaced. Balloon placements were removed; feature rows are unchanged."
-msgstr "ड्राइंग बदल दी गई। बैलून प्लेसमेंट हटा दिए गए; फीचर पंक्तियां अपरिवर्तित हैं।"
+msgid "Drawing replaced. Balloon placements were removed; characteristic rows are unchanged."
+msgstr "चित्र को प्रतिस्थापित किया गया। बैलून प्लेसमेंट हटा दिए गए; विशेषता पंक्तियां अपरिवर्तित रहीं।"
msgid "Drop Ship"
msgstr "ड्रॉप शिप"
@@ -7452,12 +7518,12 @@ msgstr "विस्तार करें {0}"
msgid "Expand all"
msgstr "सभी को विस्तृत करें"
+msgid "Expand characteristics table"
+msgstr "विशेषताओं की तालिका को विस्तारित करें"
+
msgid "Expand Costs"
msgstr "लागत विस्तृत करें"
-msgid "Expand features table"
-msgstr "फीचर्स टेबल को विस्तृत करें"
-
msgid "Expand Labor"
msgstr "श्रम विस्तृत करें"
@@ -7641,8 +7707,8 @@ msgstr "अनुत्तीर्ण"
msgid "Failed"
msgstr "विफल"
-msgid "Failed features"
-msgstr "विफल विशेषताएँ"
+msgid "Failed characteristics"
+msgstr "विफल विशेषताएं"
#. placeholder {0}: rows.length
msgid "Failed to add line — {addedCount} of {0} lines were added"
@@ -7893,6 +7959,9 @@ msgstr "ट्रैक किए गए इकाइयों को लोड
msgid "Failed to move account: {0}"
msgstr "खाता स्थानांतरित करने में विफल: {0}"
+msgid "Failed to record gauge"
+msgstr "गेज रिकॉर्ड करने में विफल"
+
msgid "Failed to regenerate schedule"
msgstr "शेड्यूल पुनः उत्पन्न करने में विफल"
@@ -7926,8 +7995,8 @@ msgstr "CSV कॉलम डेटा प्राप्त करने मे
msgid "Failed to save configuration rule"
msgstr "कॉन्फ़िगरेशन नियम सहेजने में विफल"
-msgid "Failed to save diagram"
-msgstr "आरेख सहेजने में विफल"
+msgid "Failed to save inspection plan"
+msgstr "निरीक्षण योजना को सहेजने में विफल"
msgid "Failed to save measurement"
msgstr "माप को सहेजने में विफल"
@@ -8028,15 +8097,6 @@ msgstr "फैक्स"
msgid "Fax Number"
msgstr "फैक्स नंबर"
-msgid "Feature"
-msgstr "विशेषता"
-
-msgid "Feature values suggested from drawing"
-msgstr "ड्राइंग से सुझाए गए फीचर मान"
-
-msgid "Features"
-msgstr "विशेषताएं"
-
msgid "Fees"
msgstr "शुल्क"
@@ -8342,6 +8402,9 @@ msgstr "गेज"
msgid "Gauge Calibration Notifications"
msgstr "गेज अंशांकन सूचनाएँ"
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "विशेषता {characteristicLabel} के लिए गेज: {currentGauge}"
+
msgid "Gauge ID"
msgstr "गेज आईडी"
@@ -11678,6 +11741,9 @@ msgstr "इस नौकरी के लिए कोई पूर्वान
msgid "No Gauge Selected"
msgstr "कोई गेज चयनित नहीं"
+msgid "No gauges found."
+msgstr "कोई गेज नहीं मिले।"
+
msgid "No grouped notifications"
msgstr "कोई समूहीकृत सूचनाएं नहीं"
@@ -12748,6 +12814,9 @@ msgstr "अन्यथा"
msgid "Out"
msgstr "बाहर"
+msgid "Out of calibration"
+msgstr "अंशांकन से बाहर"
+
msgid "Outbound"
msgstr "निर्गामी"
@@ -14424,6 +14493,9 @@ msgstr "हाल के भुगतान"
msgid "Recently Created"
msgstr "हाल ही में बनाया गया"
+msgid "Recently used"
+msgstr "हाल ही में उपयोग किया गया"
+
msgid "Recertify Every (Days)"
msgstr "हर (दिन) को पुनः प्रमाणित करें"
@@ -14801,8 +14873,8 @@ msgstr "इस कंपनी के डेटा को डेमो डेट
msgid "Replacement Order"
msgstr "प्रतिस्थापन आदेश"
-msgid "Replacing the PDF removes all balloon placements on this document. Feature rows and their values stay; you can place balloons again on the new drawing."
-msgstr "इस दस्तावेज़ पर PDF को बदलने से सभी बैलून प्लेसमेंट हटा दिए जाते हैं। सुविधा पंक्तियां और उनके मान रहते हैं; आप नई ड्राइंग पर फिर से बैलून रख सकते हैं।"
+msgid "Replacing the PDF removes all balloon placements on this document. Characteristic rows and their values stay; you can place balloons again on the new drawing."
+msgstr "PDF को बदलने से इस दस्तावेज़ पर सभी बैलून प्लेसमेंट हटा दिए जाते हैं। विशेषता पंक्तियां और उनके मान रहते हैं; आप नए चित्र पर फिर से बैलून रख सकते हैं।"
msgid "Replenishment"
msgstr "पुनःपूर्ति"
@@ -15550,8 +15622,8 @@ msgstr "नमूना आकार"
msgid "Sampling"
msgstr "नमूनाकरण"
-msgid "Sampling — Feature {featureLabel}"
-msgstr "नमूनाकरण — सुविधा {featureLabel}"
+msgid "Sampling — Characteristic {featureLabel}"
+msgstr "नमूनाकरण — विशेषता {featureLabel}"
msgid "Sampling Standard"
msgstr "नमूना मानक"
@@ -15752,6 +15824,9 @@ msgstr "स्क्रैप किया गया"
msgid "Search"
msgstr "खोजें"
+msgid "Search {gaugeTypeName}..."
+msgstr "{gaugeTypeName} खोजें..."
+
msgid "Search accounts"
msgstr "खातों को खोजें"
@@ -15797,6 +15872,9 @@ msgstr "फ़ील्ड खोजें..."
msgid "Search for existing or create a new one"
msgstr "मौजूदा को खोजें या नया बनाएं"
+msgid "Search gauges..."
+msgstr "गेज खोजें..."
+
msgid "Search items or bins"
msgstr "आइटम या बिन खोजें"
@@ -15993,6 +16071,9 @@ msgstr "कर्मचारी प्रकार चुनें"
msgid "Select field"
msgstr "फ़ील्ड चुनें"
+msgid "Select gauge"
+msgstr "गेज चुनें"
+
msgid "Select Gauge"
msgstr "गेज चुनें"
@@ -18113,8 +18194,8 @@ msgstr "लॉट को उत्तीर्ण के रूप में च
msgid "The lot will still be rejected, but an NCR cannot be created until at least one Issue Type is configured."
msgstr "लॉट अभी भी अस्वीकृत कर दिया जाएगा, लेकिन कम से कम एक Issue Type कॉन्फ़िगर होने तक NCR नहीं बनाया जा सकता।"
-msgid "The lot's per-feature sampling plan will be re-resolved from the selected document."
-msgstr "चयनित दस्तावेज़ से लॉट की प्रति-विशेषता नमूनाकरण योजना को पुनः निर्धारित किया जाएगा।"
+msgid "The lot's per-characteristic sampling plan will be re-resolved from the selected document."
+msgstr "लॉट की प्रति-विशेषता नमूनाकरण योजना को चयनित दस्तावेज़ से पुनः हल किया जाएगा।"
msgid "The lowest amount this supplier will charge for this process, regardless of quantity; jobs below the breakeven volume still cost at least this much."
msgstr "यह न्यूनतम राशि जो यह आपूर्तिकर्ता इस प्रक्रिया के लिए चार्ज करेगा, मात्रा की परवाह किए बिना; ब्रेकइवन वॉल्यूम के नीचे जॉब की लागत कम से कम यह राशि ही होगी।"
@@ -19479,6 +19560,9 @@ msgstr "अज्ञात"
msgid "unknown error"
msgstr "अज्ञात त्रुटि"
+msgid "Unknown gauge"
+msgstr "अज्ञात गेज"
+
msgid "unknown location"
msgstr "अज्ञात स्थान"
@@ -20051,6 +20135,9 @@ msgstr "नोट्स देखें"
msgid "View on schedule board"
msgstr "शेड्यूल बोर्ड पर देखें"
+msgid "View only — changes are not saved"
+msgstr "केवल देखें — परिवर्तन सहेजे नहीं जाते"
+
msgid "View Open"
msgstr "खुला देखें"
@@ -20972,6 +21059,9 @@ msgstr "आपका निमंत्रण अमान्य है या
msgid "Your job here: check a real sample of each row, then mark it validated. Foundation data loads first, then master records, then open transactions at cutover."
msgstr "आपका काम यहाँ है: प्रत्येक पंक्ति का एक वास्तविक नमूना जांचें, फिर इसे सत्यापित के रूप में चिह्नित करें। फाउंडेशन डेटा पहले लोड होता है, फिर मास्टर रिकॉर्ड, फिर कटओवर पर खुले लेनदेन।"
+msgid "Your latest changes could not be saved. Are you sure you want to leave this page?"
+msgstr "आपके नवीनतम परिवर्तन सहेजे नहीं जा सके। क्या आप निश्चित हैं कि आप इस पृष्ठ को छोड़ना चाहते हैं?"
+
msgid "Your legal name, addresses, branding, and document defaults"
msgstr "आपका कानूनी नाम, पते, ब्रांडिंग, और दस्तावेज़ डिफ़ॉल्ट"
diff --git a/packages/locale/locales/hi/mes.po b/packages/locale/locales/hi/mes.po
index ae230599db..ec1df245f5 100644
--- a/packages/locale/locales/hi/mes.po
+++ b/packages/locale/locales/hi/mes.po
@@ -12,6 +12,9 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+msgid "(Inactive)"
+msgstr "(निष्क्रिय)"
+
#. placeholder {0}: attribute.name
#. placeholder {1}: activeStep + 1
msgid "{0} - Set {1}"
@@ -148,6 +151,9 @@ msgstr "सभी"
msgid "All clear"
msgstr "सब कुछ स्पष्ट"
+msgid "All gauges"
+msgstr "सभी गेज"
+
msgid "All jobs"
msgstr "सभी जॉब"
@@ -268,6 +274,12 @@ msgstr "कार्बन लोगो"
msgid "Cards"
msgstr "कार्ड"
+msgid "Characteristic"
+msgstr "विशेषता"
+
+msgid "Characteristics"
+msgstr "विशेषताएं"
+
msgid "Chat"
msgstr "चैट"
@@ -283,6 +295,9 @@ msgstr "साफ़ करें"
msgid "Clear Filters"
msgstr "फ़िल्टर साफ़ करें"
+msgid "Clear gauge"
+msgstr "गेज साफ़ करें"
+
msgid "Clear Search"
msgstr "खोज साफ़ करें"
@@ -301,8 +316,8 @@ msgstr "<0/> से घड़ी चालू है"
msgid "Close"
msgstr "बंद करें"
-msgid "Collapse features table"
-msgstr "फीचर्स टेबल को संक्षिप्त करें"
+msgid "Collapse characteristics table"
+msgstr "विशेषताएं तालिका संपीड़ित करें"
msgid "Collapse panel"
msgstr "पैनल संक्षिप्त करें"
@@ -366,6 +381,15 @@ msgstr "खपत की गई समाप्त"
msgid "Continue"
msgstr "जारी रखें"
+msgid "Copied!"
+msgstr "कॉपी हो गया!"
+
+msgid "Copy"
+msgstr "कॉपी करें"
+
+msgid "Copy to clipboard"
+msgstr "क्लिपबोर्ड पर कॉपी करें"
+
#. placeholder {0}: board.unplannedCost.days
msgid "Cost of unplanned maintenance, last {0} days"
msgstr "अनियोजित रखरखाव की लागत, पिछले {0} दिन"
@@ -463,8 +487,8 @@ msgstr "ड्राफ्ट"
msgid "Drag and drop a file here, or click to select a file"
msgstr "यहाँ एक फ़ाइल को ड्रैग और ड्रॉप करें, या फ़ाइल चुनने के लिए क्लिक करें"
-msgid "Drag to resize drawing and features"
-msgstr "ड्राइंग और फीचर्स को रिसाइज़ करने के लिए ड्रैग करें"
+msgid "Drag to resize drawing and characteristics"
+msgstr "ड्राइंग और विशेषताओं को पुनः आकार देने के लिए खींचें"
#. placeholder {0}: active.data.current?.type
msgid "Dragging {0} cancelled."
@@ -541,8 +565,8 @@ msgstr "बैच में हर जॉब इन चरणों का प
msgid "Every unit has a verdict: {passes} passed and {fails} failed. The lot closes with each unit routed to its own outcome."
msgstr "प्रत्येक इकाई का निर्णय है: {passes} उत्तीर्ण और {fails} असफल। लॉट बंद हो जाता है जब प्रत्येक इकाई को अपने परिणाम के अनुसार भेजा जाता है।"
-msgid "Expand features table"
-msgstr "फीचर्स टेबल को विस्तृत करें"
+msgid "Expand characteristics table"
+msgstr "विशेषताएं तालिका विस्तृत करें"
msgid "Expand panel"
msgstr "पैनल विस्तार करें"
@@ -563,8 +587,8 @@ msgstr "पहले समाप्त होने वाले"
msgid "Failed"
msgstr "विफल"
-msgid "Failed features"
-msgstr "विफल सुविधाएँ"
+msgid "Failed characteristics"
+msgstr "विफल विशेषताएं"
msgid "Failed to complete inventory adjustment"
msgstr "इन्वेंटरी समायोजन पूरा करने में विफल"
@@ -581,6 +605,9 @@ msgstr "चल रहे ऑपरेशन प्राप्त करने
msgid "Failed to fetch storageUnits"
msgstr "storageUnits को प्राप्त करने में विफल"
+msgid "Failed to record gauge"
+msgstr "गेज रिकॉर्ड करने में विफल"
+
msgid "Failed to save measurement"
msgstr "माप को सहेजने में विफल"
@@ -598,12 +625,6 @@ msgstr "फाइल अपलोड करने में विफल: {0}"
msgid "Failed to upload image"
msgstr "इमेज अपलोड करने में विफल"
-msgid "Feature"
-msgstr "सुविधा"
-
-msgid "Features"
-msgstr "विशेषताएं"
-
msgid "File size exceeds 10MB limit"
msgstr "फ़ाइल का आकार 10MB की सीमा से अधिक है"
@@ -645,6 +666,12 @@ msgstr "पूर्ण करने से पहले हाइलाइट
msgid "Forgot to Clock Out?"
msgstr "कार्य समाप्त करना भूल गए?"
+msgid "Gauge"
+msgstr "गेज"
+
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "विशेषता {characteristicLabel} के लिए गेज: {currentGauge}"
+
msgid "General"
msgstr "सामान्य"
@@ -959,6 +986,9 @@ msgstr "आपको कोई असाइन किया गया रखर
msgid "No files"
msgstr "कोई फ़ाइलें नहीं"
+msgid "No gauges found."
+msgstr "कोई गेज नहीं मिला।"
+
msgid "No Impact"
msgstr "कोई प्रभाव नहीं"
@@ -1126,6 +1156,9 @@ msgstr "वैकल्पिक"
msgid "or"
msgstr "या"
+msgid "Out of calibration"
+msgstr "अंशांकन से बाहर"
+
msgid "Output lot"
msgstr "आउटपुट लॉट"
@@ -1276,6 +1309,9 @@ msgstr "पुनः कार्य का कारण"
msgid "Recent"
msgstr "हाल ही में"
+msgid "Recently used"
+msgstr "हाल ही में उपयोग किया गया"
+
msgid "Record"
msgstr "रिकॉर्ड"
@@ -1407,9 +1443,15 @@ msgstr "चयनित सीरीयल को स्क्रैप कि
msgid "Search"
msgstr "खोजें"
+msgid "Search {gaugeTypeName}..."
+msgstr "{gaugeTypeName} खोजें..."
+
msgid "Search by job or item ID"
msgstr "जॉब या आइटम आईडी से खोजें"
+msgid "Search gauges..."
+msgstr "गेज खोजें..."
+
msgid "Search operators..."
msgstr "ऑपरेटर खोजें..."
@@ -1444,6 +1486,9 @@ msgstr "एक आइटम चुनें..."
msgid "Select Batch {0}"
msgstr "बैच {0} चुनें"
+msgid "Select gauge"
+msgstr "गेज का चयन करें"
+
msgid "Select Printer"
msgstr "प्रिंटर चुनें"
@@ -1728,6 +1773,9 @@ msgstr "अजारी सीरीज़/बैच सामग्री"
msgid "Unknown"
msgstr "अज्ञात"
+msgid "Unknown gauge"
+msgstr "अज्ञात गेज"
+
msgid "Unlock"
msgstr "अनलॉक"
diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.po
index 1ed582da02..9002672902 100644
--- a/packages/locale/locales/it/erp.po
+++ b/packages/locale/locales/it/erp.po
@@ -48,6 +48,9 @@ msgstr "\"{taskName}\" è completato — tutti i {0} articoli della sua Mappa di
msgid "(excluded for this customer)"
msgstr "(escluso per questo cliente)"
+msgid "(Inactive)"
+msgstr "(Inattivo)"
+
#. placeholder {0}: target.slackDays
msgid "{0, plural, one {# day of slack} other {# days of slack}}"
msgstr "{0, plural, one {# giorno di margine} other {# giorni di margine}}"
@@ -1430,6 +1433,9 @@ msgstr "Aggiungi app autenticatore"
msgid "Add Calibration Record"
msgstr "Aggiungi un registro di taratura"
+msgid "Add Characteristic"
+msgstr "Aggiungi Caratteristica"
+
msgid "Add Child Storage Unit"
msgstr "Aggiungi un'unità di stoccaggio secondaria"
@@ -1460,9 +1466,6 @@ msgstr "Aggiungi Dipendente"
msgid "Add Entry"
msgstr "Aggiungi Voce"
-msgid "Add Feature"
-msgstr "Aggiungi Funzione"
-
msgid "Add from library…"
msgstr "Aggiungi dalla libreria…"
@@ -1749,6 +1752,9 @@ msgstr "Tutti i reparti"
msgid "All Documents"
msgstr "Tutti i documenti"
+msgid "All gauges"
+msgstr "Tutti gli strumenti di misura"
+
msgid "All item types"
msgstr "Tutti i tipi di articoli"
@@ -2013,6 +2019,9 @@ msgstr "Un'altra unità di stoccaggio dentro la quale questa è annidata (p. es.
msgid "Another system is connected to Ramp as its accounting system"
msgstr "Un altro sistema è connesso a Ramp come suo sistema di contabilità"
+msgid "Any"
+msgstr "Qualsiasi"
+
msgid "Any item group"
msgstr "Qualsiasi gruppo articoli"
@@ -2092,8 +2101,8 @@ msgstr "Si applica a tutti"
msgid "Applies to all work centers"
msgstr "Si applica a tutti i centri di lavoro"
-msgid "Applies to features without their own rule, and to the lot when this plan drives an inspection."
-msgstr "Si applica alle funzioni senza regola propria e al lotto quando questo piano attiva un controllo."
+msgid "Applies to characteristics without their own rule, and to the lot when this plan drives an inspection."
+msgstr "Si applica alle caratteristiche senza propria regola, e al lotto quando questo piano guida un controllo."
msgid "Apply"
msgstr "Applica"
@@ -3720,6 +3729,15 @@ msgstr "Modificare questo aggiornerà l'ID della parte"
msgid "Changing type resets this item's draft edits."
msgstr "Cambiare il tipo ripristina le modifiche in bozza di questo elemento."
+msgid "Characteristic"
+msgstr "Caratteristica"
+
+msgid "Characteristic values suggested from drawing"
+msgstr "Valori caratteristici suggeriti dal disegno"
+
+msgid "Characteristics"
+msgstr "Caratteristiche"
+
msgid "Charges"
msgstr "Addebiti"
@@ -3820,6 +3838,9 @@ msgstr "Cancella data di scadenza"
msgid "Clear Filters"
msgstr "Cancella Filtri"
+msgid "Clear gauge"
+msgstr "Cancella strumento di misura"
+
msgid "Clear search"
msgstr "Cancella ricerca"
@@ -3921,12 +3942,12 @@ msgstr "Comprimi {0}"
msgid "Collapse all"
msgstr "Comprimi tutto"
+msgid "Collapse characteristics table"
+msgstr "Comprimi tabella caratteristiche"
+
msgid "Collapse Costs"
msgstr "Comprimi Costi"
-msgid "Collapse features table"
-msgstr "Comprimi tabella funzioni"
-
msgid "Collapse Labor"
msgstr "Comprimi manodopera"
@@ -4430,6 +4451,9 @@ msgstr "Collegamento copiato negli appunti"
msgid "Copied setup prompt to your clipboard"
msgstr "Prompt di configurazione copiato negli appunti"
+msgid "Copied!"
+msgstr "Copiato!"
+
msgid "Copies a setup prompt for your AI coding tool"
msgstr "Copia un prompt di attrezzaggio per il tuo strumento di codifica AI"
@@ -4445,12 +4469,21 @@ msgstr "Copia Chiave API"
msgid "Copy batch number"
msgstr "Copia numero lotto di produzione"
+msgid "Copy change notice unique identifier"
+msgstr "Copia identificatore univoco avviso di modifica"
+
msgid "Copy company unique identifier"
msgstr "Copia identificatore univoco azienda"
msgid "Copy consumable number"
msgstr "Copia il numero del materiale di consumo"
+msgid "Copy consumable unique identifier"
+msgstr "Copia identificatore univoco materiale di consumo"
+
+msgid "Copy customer unique identifier"
+msgstr "Copia identificatore univoco cliente"
+
msgid "Copy dispatch ID"
msgstr "Copia l'ID dell'intervento di manutenzione"
@@ -4475,6 +4508,9 @@ msgstr "Copia identificatore univoco del problema"
msgid "Copy Job number"
msgstr "Copia numero lavoro"
+msgid "Copy job unique identifier"
+msgstr "Copia identificatore univoco ordine di produzione"
+
msgid "Copy link"
msgstr "Copia link"
@@ -4553,6 +4589,15 @@ msgstr "Copia nome procedura"
msgid "Copy procedure unique identifier"
msgstr "Copia identificatore univoco della procedura"
+msgid "Copy purchase invoice unique identifier"
+msgstr "Copia identificatore univoco fattura di acquisto"
+
+msgid "Copy purchase order unique identifier"
+msgstr "Copia identificatore univoco ordine di acquisto"
+
+msgid "Copy purchase return order unique identifier"
+msgstr "Copia identificatore univoco ordine di reso acquisto"
+
msgid "Copy Quality Document"
msgstr "Copia Documento Qualità"
@@ -4562,18 +4607,39 @@ msgstr "Copia Preventivo"
msgid "Copy Quote number"
msgstr "Copia numero preventivo"
+msgid "Copy quote unique identifier"
+msgstr "Copia identificatore univoco offerta"
+
msgid "Copy return number"
msgstr "Copia numero reso"
+msgid "Copy RFQ unique identifier"
+msgstr "Copia identificatore univoco RdO"
+
msgid "Copy RMA number"
msgstr "Copia numero RMA"
+msgid "Copy sales invoice unique identifier"
+msgstr "Copia identificatore univoco fattura di vendita"
+
+msgid "Copy sales order unique identifier"
+msgstr "Copia identificatore univoco ordine di vendita"
+
+msgid "Copy sales return order unique identifier"
+msgstr "Copia identificatore univoco ordine di reso vendita"
+
msgid "Copy service number"
msgstr "Copia numero servizio"
msgid "Copy service unique identifier"
msgstr "Copia identificatore univoco del servizio"
+msgid "Copy supplier quote unique identifier"
+msgstr "Copia identificatore univoco offerta del fornitore"
+
+msgid "Copy supplier unique identifier"
+msgstr "Copia identificatore univoco fornitore"
+
msgid "Copy this item's pricing to another scope."
msgstr "Copia la determinazione dei prezzi di questo articolo a un altro ambito."
@@ -4583,6 +4649,9 @@ msgstr "Copia questo link per condividere l'offerta con un cliente"
msgid "Copy this link to share the quote with a supplier"
msgstr "Copia questo link per condividere l'offerta con un fornitore"
+msgid "Copy to clipboard"
+msgstr "Copia negli appunti"
+
msgid "Copy tool number"
msgstr "Copia numero strumento"
@@ -6119,9 +6188,6 @@ msgstr "Rilevato dal pianificatore di movimento"
msgid "Developer"
msgstr "Sviluppatore"
-msgid "Diagram saved"
-msgstr "Diagramma salvato"
-
msgid "Differs from the selection — allowed, but confirm they nest together"
msgstr "Diverso dalla selezione — consentito, ma confermare che si annidino insieme"
@@ -6400,11 +6466,11 @@ msgstr "Trascina per posizionare sul disegno"
msgid "Drag to reorder"
msgstr "Trascina per riordinare"
-msgid "Drag to resize diagram and features"
-msgstr "Trascinare per ridimensionare il diagramma e le funzioni"
+msgid "Drag to resize diagram and characteristics"
+msgstr "Trascina per ridimensionare il diagramma e le caratteristiche"
-msgid "Drag to resize drawing and features"
-msgstr "Trascina per ridimensionare il disegno e le funzionalità"
+msgid "Drag to resize drawing and characteristics"
+msgstr "Trascina per ridimensionare il disegno e le caratteristiche"
msgid "Drag to zoom"
msgstr "Trascina per ingrandire"
@@ -6415,8 +6481,8 @@ msgstr "Prelievo"
msgid "Drawing Number"
msgstr "Numero di Disegno"
-msgid "Drawing replaced. Balloon placements were removed; feature rows are unchanged."
-msgstr "Disegno sostituito. I posizionamenti dei palloncini sono stati rimossi; le righe delle funzioni rimangono invariate."
+msgid "Drawing replaced. Balloon placements were removed; characteristic rows are unchanged."
+msgstr "Disegno sostituito. I posizionamenti dei palloni sono stati rimossi; le righe caratteristiche rimangono invariate."
msgid "Drop Ship"
msgstr "Spedizione diretta"
@@ -7452,12 +7518,12 @@ msgstr "Espandi {0}"
msgid "Expand all"
msgstr "Espandi tutto"
+msgid "Expand characteristics table"
+msgstr "Espandi tabella caratteristiche"
+
msgid "Expand Costs"
msgstr "Espandi Costi"
-msgid "Expand features table"
-msgstr "Espandi tabella funzioni"
-
msgid "Expand Labor"
msgstr "Espandi manodopera"
@@ -7641,8 +7707,8 @@ msgstr "Non conforme"
msgid "Failed"
msgstr "Non riuscito"
-msgid "Failed features"
-msgstr "Caratteristiche fallite"
+msgid "Failed characteristics"
+msgstr "Caratteristiche non riuscite"
#. placeholder {0}: rows.length
msgid "Failed to add line — {addedCount} of {0} lines were added"
@@ -7893,6 +7959,9 @@ msgstr "Impossibile caricare le entità tracciate"
msgid "Failed to move account: {0}"
msgstr "Impossibile spostare il conto: {0}"
+msgid "Failed to record gauge"
+msgstr "Impossibile registrare lo strumento di misura"
+
msgid "Failed to regenerate schedule"
msgstr "Impossibile rigenerare il programma"
@@ -7926,8 +7995,8 @@ msgstr "Impossibile recuperare i dati delle colonne CSV."
msgid "Failed to save configuration rule"
msgstr "Impossibile salvare la regola di configurazione"
-msgid "Failed to save diagram"
-msgstr "Impossibile salvare il diagramma"
+msgid "Failed to save inspection plan"
+msgstr "Impossibile salvare il piano di controllo"
msgid "Failed to save measurement"
msgstr "Impossibile salvare la misurazione"
@@ -8028,15 +8097,6 @@ msgstr "Fax"
msgid "Fax Number"
msgstr "Numero di Fax"
-msgid "Feature"
-msgstr "Funzione"
-
-msgid "Feature values suggested from drawing"
-msgstr "Valori delle caratteristiche suggeriti dal disegno"
-
-msgid "Features"
-msgstr "Funzionalità"
-
msgid "Fees"
msgstr "Commissioni"
@@ -8342,6 +8402,9 @@ msgstr "Strumento di misura"
msgid "Gauge Calibration Notifications"
msgstr "Notifiche di taratura degli strumenti di misura"
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Strumento di misura per caratteristica {characteristicLabel}: {currentGauge}"
+
msgid "Gauge ID"
msgstr "ID dello strumento di misura"
@@ -11678,6 +11741,9 @@ msgstr "Nessuna previsione disponibile per questo lavoro."
msgid "No Gauge Selected"
msgstr "Nessuno strumento di misura selezionato"
+msgid "No gauges found."
+msgstr "Nessuno strumento di misura trovato."
+
msgid "No grouped notifications"
msgstr "Nessuna notifica raggruppata"
@@ -12748,6 +12814,9 @@ msgstr "Altrimenti"
msgid "Out"
msgstr "Fuori"
+msgid "Out of calibration"
+msgstr "Fuori taratura"
+
msgid "Outbound"
msgstr "In uscita"
@@ -14424,6 +14493,9 @@ msgstr "Pagamenti recenti"
msgid "Recently Created"
msgstr "Creato di recente"
+msgid "Recently used"
+msgstr "Usato di recente"
+
msgid "Recertify Every (Days)"
msgstr "Ricertifica ogni (giorni)"
@@ -14801,8 +14873,8 @@ msgstr "Sostituisci i dati di questa azienda con un set di dati demo - snapshot
msgid "Replacement Order"
msgstr "Ordine di Sostituzione"
-msgid "Replacing the PDF removes all balloon placements on this document. Feature rows and their values stay; you can place balloons again on the new drawing."
-msgstr "La sostituzione del PDF rimuove tutti i posizionamenti dei palloncini su questo documento. Le righe delle funzioni e i loro valori rimangono; puoi posizionare di nuovo i palloncini sul nuovo disegno."
+msgid "Replacing the PDF removes all balloon placements on this document. Characteristic rows and their values stay; you can place balloons again on the new drawing."
+msgstr "La sostituzione del PDF rimuove tutti i posizionamenti dei palloni su questo documento. Le righe caratteristiche e i loro valori rimangono; puoi posizionare di nuovo i palloni sul nuovo disegno."
msgid "Replenishment"
msgstr "Rifornimento"
@@ -15550,8 +15622,8 @@ msgstr "Dimensione del Campione"
msgid "Sampling"
msgstr "Campionamento"
-msgid "Sampling — Feature {featureLabel}"
-msgstr "Campionamento — Funzionalità {featureLabel}"
+msgid "Sampling — Characteristic {featureLabel}"
+msgstr "Campionamento — Caratteristica {featureLabel}"
msgid "Sampling Standard"
msgstr "Standard di Campionamento"
@@ -15752,6 +15824,9 @@ msgstr "Scartato"
msgid "Search"
msgstr "Cerca"
+msgid "Search {gaugeTypeName}..."
+msgstr "Cerca {gaugeTypeName}..."
+
msgid "Search accounts"
msgstr "Cerca account"
@@ -15797,6 +15872,9 @@ msgstr "Cerca campi..."
msgid "Search for existing or create a new one"
msgstr "Cerca uno esistente o creane uno nuovo"
+msgid "Search gauges..."
+msgstr "Cerca strumenti di misura..."
+
msgid "Search items or bins"
msgstr "Cerca articoli o contenitori"
@@ -15993,6 +16071,9 @@ msgstr "Seleziona Tipo di Dipendente"
msgid "Select field"
msgstr "Seleziona campo"
+msgid "Select gauge"
+msgstr "Seleziona strumento di misura"
+
msgid "Select Gauge"
msgstr "Seleziona strumento di misura"
@@ -18113,8 +18194,8 @@ msgstr "Il lotto sarà contrassegnato come Superato. {fails} errore(i) campionat
msgid "The lot will still be rejected, but an NCR cannot be created until at least one Issue Type is configured."
msgstr "Il lotto sarà comunque rifiutato, ma non è possibile creare un NCR finché non è configurato almeno un tipo di problema."
-msgid "The lot's per-feature sampling plan will be re-resolved from the selected document."
-msgstr "Il piano di campionamento per caratteristica del lotto sarà ri-risolto dal documento selezionato."
+msgid "The lot's per-characteristic sampling plan will be re-resolved from the selected document."
+msgstr "Il piano di campionamento per caratteristica del lotto verrà nuovamente determinato dal documento selezionato."
msgid "The lowest amount this supplier will charge for this process, regardless of quantity; jobs below the breakeven volume still cost at least this much."
msgstr "L'importo minimo che questo fornitore addebiterà per questo processo, indipendentemente dalla quantità; gli ordini di produzione al di sotto del volume di pareggio costano ancora almeno questo importo."
@@ -19479,6 +19560,9 @@ msgstr "Sconosciuto"
msgid "unknown error"
msgstr "errore sconosciuto"
+msgid "Unknown gauge"
+msgstr "Strumento di misura sconosciuto"
+
msgid "unknown location"
msgstr "posizione sconosciuta"
@@ -20051,6 +20135,9 @@ msgstr "Visualizza note"
msgid "View on schedule board"
msgstr "Vedi nella bacheca di pianificazione"
+msgid "View only — changes are not saved"
+msgstr "Sola visualizzazione — le modifiche non vengono salvate"
+
msgid "View Open"
msgstr "Visualizza Aperto"
@@ -20968,6 +21055,9 @@ msgstr "Il tuo invito non è valido o è già stato accettato. Contatta il suppo
msgid "Your job here: check a real sample of each row, then mark it validated. Foundation data loads first, then master records, then open transactions at cutover."
msgstr "Il tuo compito qui: controlla un campione reale di ogni riga, quindi contrassegnala come convalidata. I dati di base vengono caricati per primi, poi i record master, quindi le transazioni aperte al cutover."
+msgid "Your latest changes could not be saved. Are you sure you want to leave this page?"
+msgstr "Non è stato possibile salvare i tuoi ultimi cambiamenti. Sei sicuro di voler abbandonare questa pagina?"
+
msgid "Your legal name, addresses, branding, and document defaults"
msgstr "Il tuo nome legale, indirizzi, branding e impostazioni predefinite dei documenti"
diff --git a/packages/locale/locales/it/mes.po b/packages/locale/locales/it/mes.po
index 441b549872..2e0a778fa9 100644
--- a/packages/locale/locales/it/mes.po
+++ b/packages/locale/locales/it/mes.po
@@ -12,6 +12,9 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+msgid "(Inactive)"
+msgstr "(Inattivo)"
+
#. placeholder {0}: attribute.name
#. placeholder {1}: activeStep + 1
msgid "{0} - Set {1}"
@@ -148,6 +151,9 @@ msgstr "Tutti"
msgid "All clear"
msgstr "Tutto libero"
+msgid "All gauges"
+msgstr "Tutti gli strumenti di misura"
+
msgid "All jobs"
msgstr "Tutti gli ordini di produzione"
@@ -268,6 +274,12 @@ msgstr "Logo Carbon"
msgid "Cards"
msgstr "Schede"
+msgid "Characteristic"
+msgstr "Caratteristica"
+
+msgid "Characteristics"
+msgstr "Caratteristiche"
+
msgid "Chat"
msgstr "Chat"
@@ -283,6 +295,9 @@ msgstr "Cancella"
msgid "Clear Filters"
msgstr "Cancella Filtri"
+msgid "Clear gauge"
+msgstr "Cancella strumento di misura"
+
msgid "Clear Search"
msgstr "Cancella Ricerca"
@@ -301,8 +316,8 @@ msgstr "Connesso da <0/>"
msgid "Close"
msgstr "Chiudi"
-msgid "Collapse features table"
-msgstr "Comprimi tabella funzionalità"
+msgid "Collapse characteristics table"
+msgstr "Comprimi tabella delle caratteristiche"
msgid "Collapse panel"
msgstr "Comprimi pannello"
@@ -366,6 +381,15 @@ msgstr "Consumato scaduto"
msgid "Continue"
msgstr "Continua"
+msgid "Copied!"
+msgstr "Copiato!"
+
+msgid "Copy"
+msgstr "Copia"
+
+msgid "Copy to clipboard"
+msgstr "Copia negli appunti"
+
#. placeholder {0}: board.unplannedCost.days
msgid "Cost of unplanned maintenance, last {0} days"
msgstr "Costo della manutenzione non pianificata, ultimi {0} giorni"
@@ -463,8 +487,8 @@ msgstr "Bozza"
msgid "Drag and drop a file here, or click to select a file"
msgstr "Trascina e rilascia un file qui, o clicca per selezionare un file"
-msgid "Drag to resize drawing and features"
-msgstr "Trascinare per ridimensionare il disegno e le caratteristiche"
+msgid "Drag to resize drawing and characteristics"
+msgstr "Trascina per ridimensionare il disegno e le caratteristiche"
#. placeholder {0}: active.data.current?.type
msgid "Dragging {0} cancelled."
@@ -541,8 +565,8 @@ msgstr "Ogni ordine di produzione nel lotto di produzione segue questi passi. Re
msgid "Every unit has a verdict: {passes} passed and {fails} failed. The lot closes with each unit routed to its own outcome."
msgstr "Ogni unità ha un verdetto: {passes} superate e {fails} fallite. Il lotto si chiude con ogni unità indirizzata al suo esito."
-msgid "Expand features table"
-msgstr "Espandi tabella funzionalità"
+msgid "Expand characteristics table"
+msgstr "Espandi tabella delle caratteristiche"
msgid "Expand panel"
msgstr "Espandi pannello"
@@ -563,8 +587,8 @@ msgstr "Scadenza prima"
msgid "Failed"
msgstr "Non riuscito"
-msgid "Failed features"
-msgstr "Funzionalità non riuscite"
+msgid "Failed characteristics"
+msgstr "Caratteristiche non conformi"
msgid "Failed to complete inventory adjustment"
msgstr "Impossibile completare la rettifica di magazzino"
@@ -581,6 +605,9 @@ msgstr "Impossibile recuperare le operazioni attive"
msgid "Failed to fetch storageUnits"
msgstr "Impossibile recuperare le unità di archiviazione"
+msgid "Failed to record gauge"
+msgstr "Impossibile registrare lo strumento di misura"
+
msgid "Failed to save measurement"
msgstr "Errore durante il salvataggio della misurazione"
@@ -598,12 +625,6 @@ msgstr "Impossibile caricare il file: {0}"
msgid "Failed to upload image"
msgstr "Impossibile caricare l'immagine"
-msgid "Feature"
-msgstr "Funzionalità"
-
-msgid "Features"
-msgstr "Caratteristiche"
-
msgid "File size exceeds 10MB limit"
msgstr "La dimensione del file supera il limite di 10MB"
@@ -645,6 +666,12 @@ msgstr "Correggi le quantità evidenziate prima di completare."
msgid "Forgot to Clock Out?"
msgstr "Hai dimenticato il timbra fine?"
+msgid "Gauge"
+msgstr "Strumento di misura"
+
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Strumento di misura per la caratteristica {characteristicLabel}: {currentGauge}"
+
msgid "General"
msgstr "Generale"
@@ -959,6 +986,9 @@ msgstr "Nessun intervento di manutenzione assegnato"
msgid "No files"
msgstr "Nessun file"
+msgid "No gauges found."
+msgstr "Nessuno strumento di misura trovato."
+
msgid "No Impact"
msgstr "Nessun Impatto"
@@ -1126,6 +1156,9 @@ msgstr "Facoltativo"
msgid "or"
msgstr "o"
+msgid "Out of calibration"
+msgstr "Fuori dalla taratura"
+
msgid "Output lot"
msgstr "Lotto di output"
@@ -1276,6 +1309,9 @@ msgstr "Motivo della rilavorazione"
msgid "Recent"
msgstr "Recenti"
+msgid "Recently used"
+msgstr "Usato di recente"
+
msgid "Record"
msgstr "Registra"
@@ -1407,9 +1443,15 @@ msgstr "Scarto del numero di serie selezionato"
msgid "Search"
msgstr "Cerca"
+msgid "Search {gaugeTypeName}..."
+msgstr "Cerca {gaugeTypeName}..."
+
msgid "Search by job or item ID"
msgstr "Cerca per ID lavoro o articolo"
+msgid "Search gauges..."
+msgstr "Cerca strumenti di misura..."
+
msgid "Search operators..."
msgstr "Cerca operatori..."
@@ -1444,6 +1486,9 @@ msgstr "Seleziona un articolo..."
msgid "Select Batch {0}"
msgstr "Seleziona Lotto {0}"
+msgid "Select gauge"
+msgstr "Seleziona strumento di misura"
+
msgid "Select Printer"
msgstr "Seleziona Stampante"
@@ -1728,6 +1773,9 @@ msgstr "Materiali seriali/lotto non prelevati"
msgid "Unknown"
msgstr "Sconosciuto"
+msgid "Unknown gauge"
+msgstr "Strumento di misura sconosciuto"
+
msgid "Unlock"
msgstr "Sblocca"
diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.po
index be8bb8530d..9b097039ea 100644
--- a/packages/locale/locales/ja/erp.po
+++ b/packages/locale/locales/ja/erp.po
@@ -48,6 +48,9 @@ msgstr "「{taskName}」は完了しました — セットアップマップの
msgid "(excluded for this customer)"
msgstr "(この得意先から除外)"
+msgid "(Inactive)"
+msgstr "(無効)"
+
#. placeholder {0}: target.slackDays
msgid "{0, plural, one {# day of slack} other {# days of slack}}"
msgstr "{0, plural, one {# 日のスラック} other {# 日のスラック}}"
@@ -1430,6 +1433,9 @@ msgstr "認証器アプリを追加"
msgid "Add Calibration Record"
msgstr "校正記録を追加"
+msgid "Add Characteristic"
+msgstr "特性を追加"
+
msgid "Add Child Storage Unit"
msgstr "子保管ユニットを追加"
@@ -1460,9 +1466,6 @@ msgstr "従業員を追加"
msgid "Add Entry"
msgstr "エントリを追加"
-msgid "Add Feature"
-msgstr "機能を追加"
-
msgid "Add from library…"
msgstr "ライブラリから追加…"
@@ -1749,6 +1752,9 @@ msgstr "すべての部門"
msgid "All Documents"
msgstr "すべてのドキュメント"
+msgid "All gauges"
+msgstr "すべての測定器"
+
msgid "All item types"
msgstr "すべての品目タイプ"
@@ -2013,6 +2019,9 @@ msgstr "この保管ユニットがネストされる別の保管ユニット(
msgid "Another system is connected to Ramp as its accounting system"
msgstr "別のシステムがRampの会計システムとして接続されています"
+msgid "Any"
+msgstr "いずれか"
+
msgid "Any item group"
msgstr "任意のアイテムグループ"
@@ -2092,8 +2101,8 @@ msgstr "すべてに適用"
msgid "Applies to all work centers"
msgstr "すべての作業区に適用"
-msgid "Applies to features without their own rule, and to the lot when this plan drives an inspection."
-msgstr "独自のルールがない機能に適用され、このプランが検査を実施する場合、ロットに適用されます。"
+msgid "Applies to characteristics without their own rule, and to the lot when this plan drives an inspection."
+msgstr "独自のルールを持たない特性に適用され、この計画が検査を実施する場合はロットに適用されます。"
msgid "Apply"
msgstr "適用"
@@ -3720,6 +3729,15 @@ msgstr "これを変更するとパーツIDが更新されます"
msgid "Changing type resets this item's draft edits."
msgstr "タイプを変更すると、この品目の下書き編集がリセットされます。"
+msgid "Characteristic"
+msgstr "特性"
+
+msgid "Characteristic values suggested from drawing"
+msgstr "図面から提案された特性値"
+
+msgid "Characteristics"
+msgstr "特性"
+
msgid "Charges"
msgstr "カード請求"
@@ -3820,6 +3838,9 @@ msgstr "期日をクリア"
msgid "Clear Filters"
msgstr "絞り込みをクリア"
+msgid "Clear gauge"
+msgstr "測定器をクリア"
+
msgid "Clear search"
msgstr "検索をクリア"
@@ -3921,12 +3942,12 @@ msgstr "{0}を折りたたむ"
msgid "Collapse all"
msgstr "すべて折りたたむ"
+msgid "Collapse characteristics table"
+msgstr "特性テーブルを折りたたむ"
+
msgid "Collapse Costs"
msgstr "原価を折りたたみ"
-msgid "Collapse features table"
-msgstr "機能テーブルを折りたたむ"
-
msgid "Collapse Labor"
msgstr "労務を折りたたみ"
@@ -4430,6 +4451,9 @@ msgstr "クリップボードにリンクをコピーしました"
msgid "Copied setup prompt to your clipboard"
msgstr "セットアップ プロンプトをクリップボードにコピーしました"
+msgid "Copied!"
+msgstr "コピーしました!"
+
msgid "Copies a setup prompt for your AI coding tool"
msgstr "AIコーディングツール用の段取りプロンプトをコピーします"
@@ -4445,12 +4469,21 @@ msgstr "APIキーをコピー"
msgid "Copy batch number"
msgstr "バッチ番号をコピー"
+msgid "Copy change notice unique identifier"
+msgstr "変更通知の一意識別子をコピー"
+
msgid "Copy company unique identifier"
msgstr "会社の一意の識別子をコピー"
msgid "Copy consumable number"
msgstr "消耗品番号をコピー"
+msgid "Copy consumable unique identifier"
+msgstr "消耗品の一意識別子をコピー"
+
+msgid "Copy customer unique identifier"
+msgstr "得意先の一意識別子をコピー"
+
msgid "Copy dispatch ID"
msgstr "保全指示IDをコピー"
@@ -4475,6 +4508,9 @@ msgstr "問題の一意の識別子をコピー"
msgid "Copy Job number"
msgstr "ジョブ番号をコピー"
+msgid "Copy job unique identifier"
+msgstr "製造指図の一意識別子をコピー"
+
msgid "Copy link"
msgstr "リンクをコピー"
@@ -4553,6 +4589,15 @@ msgstr "手順書名をコピー"
msgid "Copy procedure unique identifier"
msgstr "手順書の識別子をコピー"
+msgid "Copy purchase invoice unique identifier"
+msgstr "仕入先請求書の一意識別子をコピー"
+
+msgid "Copy purchase order unique identifier"
+msgstr "発注書の一意識別子をコピー"
+
+msgid "Copy purchase return order unique identifier"
+msgstr "購買返品の一意識別子をコピー"
+
msgid "Copy Quality Document"
msgstr "品質文書をコピー"
@@ -4562,18 +4607,39 @@ msgstr "見積書をコピー"
msgid "Copy Quote number"
msgstr "見積番号をコピー"
+msgid "Copy quote unique identifier"
+msgstr "見積の一意識別子をコピー"
+
msgid "Copy return number"
msgstr "返品番号をコピー"
+msgid "Copy RFQ unique identifier"
+msgstr "見積依頼の一意識別子をコピー"
+
msgid "Copy RMA number"
msgstr "RMA番号をコピー"
+msgid "Copy sales invoice unique identifier"
+msgstr "売上請求書の一意識別子をコピー"
+
+msgid "Copy sales order unique identifier"
+msgstr "受注の一意識別子をコピー"
+
+msgid "Copy sales return order unique identifier"
+msgstr "売上返品の一意識別子をコピー"
+
msgid "Copy service number"
msgstr "サービス番号をコピー"
msgid "Copy service unique identifier"
msgstr "サービスの一意な識別子をコピー"
+msgid "Copy supplier quote unique identifier"
+msgstr "仕入先見積の一意識別子をコピー"
+
+msgid "Copy supplier unique identifier"
+msgstr "仕入先の一意識別子をコピー"
+
msgid "Copy this item's pricing to another scope."
msgstr "このアイテムの価格設定を別のスコープにコピーします。"
@@ -4583,6 +4649,9 @@ msgstr "この見積を得意先と共有するためのリンクをコピー"
msgid "Copy this link to share the quote with a supplier"
msgstr "この見積を仕入先と共有するためのリンクをコピー"
+msgid "Copy to clipboard"
+msgstr "クリップボードにコピー"
+
msgid "Copy tool number"
msgstr "ツール番号をコピー"
@@ -6119,9 +6188,6 @@ msgstr "モーションプランナーで検出されました"
msgid "Developer"
msgstr "開発者"
-msgid "Diagram saved"
-msgstr "図が保存されました"
-
msgid "Differs from the selection — allowed, but confirm they nest together"
msgstr "選択と異なります — 許可されていますが、それらが一緒に実行できることを確認してください"
@@ -6400,11 +6466,11 @@ msgstr "図面上に配置するためにドラッグしてください"
msgid "Drag to reorder"
msgstr "ドラッグして並べ替え"
-msgid "Drag to resize diagram and features"
-msgstr "図と機能をリサイズするにはドラッグしてください"
+msgid "Drag to resize diagram and characteristics"
+msgstr "ダイアグラムと特性をリサイズするためにドラッグ"
-msgid "Drag to resize drawing and features"
-msgstr "ドラッグして図面と機能のサイズを変更してください"
+msgid "Drag to resize drawing and characteristics"
+msgstr "図面と特性をリサイズするためにドラッグ"
msgid "Drag to zoom"
msgstr "ズームするにはドラッグしてください"
@@ -6415,8 +6481,8 @@ msgstr "引き出し中"
msgid "Drawing Number"
msgstr "図面番号"
-msgid "Drawing replaced. Balloon placements were removed; feature rows are unchanged."
-msgstr "図面が置き換わりました。バルーン配置は削除されました。機能行は変更されていません。"
+msgid "Drawing replaced. Balloon placements were removed; characteristic rows are unchanged."
+msgstr "図面が置き換えられました。バルーン配置は削除されました。特性行は変更されていません。"
msgid "Drop Ship"
msgstr "ドロップシップ"
@@ -7452,12 +7518,12 @@ msgstr "展開 {0}"
msgid "Expand all"
msgstr "すべて展開"
+msgid "Expand characteristics table"
+msgstr "特性テーブルを展開"
+
msgid "Expand Costs"
msgstr "原価を展開"
-msgid "Expand features table"
-msgstr "機能テーブルを展開"
-
msgid "Expand Labor"
msgstr "労務を展開"
@@ -7641,8 +7707,8 @@ msgstr "不合格"
msgid "Failed"
msgstr "失敗"
-msgid "Failed features"
-msgstr "失敗した機能"
+msgid "Failed characteristics"
+msgstr "不合格の特性"
#. placeholder {0}: rows.length
msgid "Failed to add line — {addedCount} of {0} lines were added"
@@ -7893,6 +7959,9 @@ msgstr "追跡対象エンティティの読み込みに失敗しました"
msgid "Failed to move account: {0}"
msgstr "勘定科目の移動に失敗しました: {0}"
+msgid "Failed to record gauge"
+msgstr "測定器の記録に失敗しました"
+
msgid "Failed to regenerate schedule"
msgstr "スケジュールの再生成に失敗しました"
@@ -7926,8 +7995,8 @@ msgstr "CSVの列データの取得に失敗しました。"
msgid "Failed to save configuration rule"
msgstr "設定ルールの保存に失敗しました"
-msgid "Failed to save diagram"
-msgstr "図の保存に失敗しました"
+msgid "Failed to save inspection plan"
+msgstr "検査計画の保存に失敗しました"
msgid "Failed to save measurement"
msgstr "測定値の保存に失敗しました"
@@ -8028,15 +8097,6 @@ msgstr "ファックス"
msgid "Fax Number"
msgstr "ファックス番号"
-msgid "Feature"
-msgstr "機能"
-
-msgid "Feature values suggested from drawing"
-msgstr "図面から提案された機能値"
-
-msgid "Features"
-msgstr "機能"
-
msgid "Fees"
msgstr "手数料"
@@ -8342,6 +8402,9 @@ msgstr "測定器"
msgid "Gauge Calibration Notifications"
msgstr "測定器の校正通知"
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "特性 {characteristicLabel} の測定器: {currentGauge}"
+
msgid "Gauge ID"
msgstr "測定器 ID"
@@ -11678,6 +11741,9 @@ msgstr "この製造指図に対して利用可能な予測はありません。
msgid "No Gauge Selected"
msgstr "測定器が選択されていません"
+msgid "No gauges found."
+msgstr "測定器が見つかりません。"
+
msgid "No grouped notifications"
msgstr "グループ化された通知がありません"
@@ -12748,6 +12814,9 @@ msgstr "その他"
msgid "Out"
msgstr "対象外"
+msgid "Out of calibration"
+msgstr "校正範囲外"
+
msgid "Outbound"
msgstr "出荷"
@@ -14424,6 +14493,9 @@ msgstr "最近の支払い"
msgid "Recently Created"
msgstr "最近作成"
+msgid "Recently used"
+msgstr "最近使用した"
+
msgid "Recertify Every (Days)"
msgstr "再認定 (日)"
@@ -14801,8 +14873,8 @@ msgstr "この会社のデータをデモデータセットで置き換えます
msgid "Replacement Order"
msgstr "交換注文"
-msgid "Replacing the PDF removes all balloon placements on this document. Feature rows and their values stay; you can place balloons again on the new drawing."
-msgstr "PDFを置き換えると、このドキュメントのすべてのバルーン配置が削除されます。フィーチャ行とその値は残ります。新しい図面上で再度バルーンを配置できます。"
+msgid "Replacing the PDF removes all balloon placements on this document. Characteristic rows and their values stay; you can place balloons again on the new drawing."
+msgstr "PDFを置き換えると、このドキュメント上のすべてのバルーン配置が削除されます。特性行とその値は保持されます。新しい図面でバルーンを再度配置できます。"
msgid "Replenishment"
msgstr "補充"
@@ -15550,8 +15622,8 @@ msgstr "サンプルサイズ"
msgid "Sampling"
msgstr "抜取検査"
-msgid "Sampling — Feature {featureLabel}"
-msgstr "抜取検査 — 機能{featureLabel}"
+msgid "Sampling — Characteristic {featureLabel}"
+msgstr "抜取検査 — 特性 {featureLabel}"
msgid "Sampling Standard"
msgstr "抜取検査基準"
@@ -15752,6 +15824,9 @@ msgstr "スクラップ済み"
msgid "Search"
msgstr "検索"
+msgid "Search {gaugeTypeName}..."
+msgstr "{gaugeTypeName} を検索..."
+
msgid "Search accounts"
msgstr "アカウントを検索"
@@ -15797,6 +15872,9 @@ msgstr "フィールドを検索..."
msgid "Search for existing or create a new one"
msgstr "既存のものを検索するか、新しいものを作成してください"
+msgid "Search gauges..."
+msgstr "測定器を検索..."
+
msgid "Search items or bins"
msgstr "アイテムまたはビンを検索"
@@ -15993,6 +16071,9 @@ msgstr "従業員タイプを選択"
msgid "Select field"
msgstr "フィールドを選択"
+msgid "Select gauge"
+msgstr "測定器を選択"
+
msgid "Select Gauge"
msgstr "測定器を選択"
@@ -18113,8 +18194,8 @@ msgstr "ロットは合格とマークされます。{fails}件のサンプル
msgid "The lot will still be rejected, but an NCR cannot be created until at least one Issue Type is configured."
msgstr "ロットは引き続き却下されますが、少なくとも1つの問題タイプが設定されるまでNCRを作成することはできません。"
-msgid "The lot's per-feature sampling plan will be re-resolved from the selected document."
-msgstr "ロットの機能別抜取検査方式は、選択した文書から再解決されます。"
+msgid "The lot's per-characteristic sampling plan will be re-resolved from the selected document."
+msgstr "ロットの特性別抜取検査方式は選択された文書から再度解決されます。"
msgid "The lowest amount this supplier will charge for this process, regardless of quantity; jobs below the breakeven volume still cost at least this much."
msgstr "この仕入先がこの工法に対して請求する最低金額(数量に関係なく)。損益分岐点量以下の製造指図でも、最低でもこの金額がかかります。"
@@ -19479,6 +19560,9 @@ msgstr "不明"
msgid "unknown error"
msgstr "不明なエラー"
+msgid "Unknown gauge"
+msgstr "不明な測定器"
+
msgid "unknown location"
msgstr "不明な場所"
@@ -20051,6 +20135,9 @@ msgstr "メモを表示"
msgid "View on schedule board"
msgstr "スケジュールボードで表示"
+msgid "View only — changes are not saved"
+msgstr "表示のみ — 変更は保存されません"
+
msgid "View Open"
msgstr "開く"
@@ -20968,6 +21055,9 @@ msgstr "あなたの招待は無効であるか、既に受け入れられてい
msgid "Your job here: check a real sample of each row, then mark it validated. Foundation data loads first, then master records, then open transactions at cutover."
msgstr "ここでのあなたの仕事:各行の実際のサンプルを確認してから、検証済みとしてマークしてください。基礎データが最初に読み込まれ、次にマスターレコード、その後カットオーバー時にオープントランザクションが読み込まれます。"
+msgid "Your latest changes could not be saved. Are you sure you want to leave this page?"
+msgstr "最新の変更は保存できませんでした。このページを離れてもよろしいですか?"
+
msgid "Your legal name, addresses, branding, and document defaults"
msgstr "法人名、住所、ブランディング、文書デフォルト"
diff --git a/packages/locale/locales/ja/mes.po b/packages/locale/locales/ja/mes.po
index 3da41e6bf8..c2baf5eacc 100644
--- a/packages/locale/locales/ja/mes.po
+++ b/packages/locale/locales/ja/mes.po
@@ -12,6 +12,9 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+msgid "(Inactive)"
+msgstr "(無効)"
+
#. placeholder {0}: attribute.name
#. placeholder {1}: activeStep + 1
msgid "{0} - Set {1}"
@@ -148,6 +151,9 @@ msgstr "すべて"
msgid "All clear"
msgstr "異常なし"
+msgid "All gauges"
+msgstr "全測定器"
+
msgid "All jobs"
msgstr "すべての製造指図"
@@ -268,6 +274,12 @@ msgstr "Carbonロゴ"
msgid "Cards"
msgstr "カード"
+msgid "Characteristic"
+msgstr "特性"
+
+msgid "Characteristics"
+msgstr "特性"
+
msgid "Chat"
msgstr "チャット"
@@ -283,6 +295,9 @@ msgstr "クリア"
msgid "Clear Filters"
msgstr "絞り込みをクリア"
+msgid "Clear gauge"
+msgstr "測定器をクリア"
+
msgid "Clear Search"
msgstr "検索をクリア"
@@ -301,8 +316,8 @@ msgstr "<0/>からクロックイン中"
msgid "Close"
msgstr "閉じる"
-msgid "Collapse features table"
-msgstr "機能テーブルを折りたたむ"
+msgid "Collapse characteristics table"
+msgstr "特性テーブルを折りたたむ"
msgid "Collapse panel"
msgstr "パネルを折りたたむ"
@@ -366,6 +381,15 @@ msgstr "消費期限切れ"
msgid "Continue"
msgstr "続行"
+msgid "Copied!"
+msgstr "コピーしました!"
+
+msgid "Copy"
+msgstr "コピー"
+
+msgid "Copy to clipboard"
+msgstr "クリップボードにコピー"
+
#. placeholder {0}: board.unplannedCost.days
msgid "Cost of unplanned maintenance, last {0} days"
msgstr "過去{0}日間の未計画保全原価"
@@ -463,8 +487,8 @@ msgstr "下書き"
msgid "Drag and drop a file here, or click to select a file"
msgstr "ファイルをここにドラッグ&ドロップするか、クリックしてファイルを選択してください"
-msgid "Drag to resize drawing and features"
-msgstr "描画と機能をリサイズするためにドラッグします"
+msgid "Drag to resize drawing and characteristics"
+msgstr "ドラッグして図面と特性のサイズを変更"
#. placeholder {0}: active.data.current?.type
msgid "Dragging {0} cancelled."
@@ -541,8 +565,8 @@ msgstr "バッチ内のすべての製造指図がこれらのステップに従
msgid "Every unit has a verdict: {passes} passed and {fails} failed. The lot closes with each unit routed to its own outcome."
msgstr "すべてのユニットに判定があります: {passes}件が合格し、{fails}件が不合格です。ロットは各ユニットが独自の結果にルーティングされて終了します。"
-msgid "Expand features table"
-msgstr "機能テーブルを展開"
+msgid "Expand characteristics table"
+msgstr "特性テーブルを展開"
msgid "Expand panel"
msgstr "パネルを展開"
@@ -563,8 +587,8 @@ msgstr "最初に期限切れ"
msgid "Failed"
msgstr "失敗"
-msgid "Failed features"
-msgstr "失敗した機能"
+msgid "Failed characteristics"
+msgstr "不合格特性"
msgid "Failed to complete inventory adjustment"
msgstr "在庫調整の完了に失敗しました"
@@ -581,6 +605,9 @@ msgstr "アクティブな工程の取得に失敗しました"
msgid "Failed to fetch storageUnits"
msgstr "storageUnitsの取得に失敗しました"
+msgid "Failed to record gauge"
+msgstr "測定器の記録に失敗しました"
+
msgid "Failed to save measurement"
msgstr "測定の保存に失敗しました"
@@ -598,12 +625,6 @@ msgstr "ファイルのアップロードに失敗しました: {0}"
msgid "Failed to upload image"
msgstr "画像のアップロードに失敗しました"
-msgid "Feature"
-msgstr "機能"
-
-msgid "Features"
-msgstr "機能"
-
msgid "File size exceeds 10MB limit"
msgstr "ファイルサイズが10MBの制限を超えています"
@@ -645,6 +666,12 @@ msgstr "完了する前に、ハイライトされた数量を修正してくだ
msgid "Forgot to Clock Out?"
msgstr "作業終了を忘れていませんか?"
+msgid "Gauge"
+msgstr "測定器"
+
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "特性 {characteristicLabel} の測定器: {currentGauge}"
+
msgid "General"
msgstr "一般"
@@ -959,6 +986,9 @@ msgstr "あなたに割り当てられた保全指示はありません。"
msgid "No files"
msgstr "ファイルなし"
+msgid "No gauges found."
+msgstr "測定器が見つかりません。"
+
msgid "No Impact"
msgstr "影響なし"
@@ -1126,6 +1156,9 @@ msgstr "オプション"
msgid "or"
msgstr "または"
+msgid "Out of calibration"
+msgstr "校正対象外"
+
msgid "Output lot"
msgstr "出力ロット"
@@ -1276,6 +1309,9 @@ msgstr "手直しの理由"
msgid "Recent"
msgstr "最近"
+msgid "Recently used"
+msgstr "最近使用した"
+
msgid "Record"
msgstr "記録"
@@ -1407,9 +1443,15 @@ msgstr "選択したシリアルをスクラップ中"
msgid "Search"
msgstr "検索"
+msgid "Search {gaugeTypeName}..."
+msgstr "{gaugeTypeName} を検索..."
+
msgid "Search by job or item ID"
msgstr "ジョブまたはアイテムIDで検索"
+msgid "Search gauges..."
+msgstr "測定器を検索..."
+
msgid "Search operators..."
msgstr "作業者を検索..."
@@ -1444,6 +1486,9 @@ msgstr "品目を選択..."
msgid "Select Batch {0}"
msgstr "バッチ {0} を選択"
+msgid "Select gauge"
+msgstr "測定器を選択"
+
msgid "Select Printer"
msgstr "プリンターを選択"
@@ -1728,6 +1773,9 @@ msgstr "未払出のシリアル/バッチ材料"
msgid "Unknown"
msgstr "不明"
+msgid "Unknown gauge"
+msgstr "不明な測定器"
+
msgid "Unlock"
msgstr "ロック解除"
diff --git a/packages/locale/locales/ko/erp.po b/packages/locale/locales/ko/erp.po
index 1166ce4781..0615982e41 100644
--- a/packages/locale/locales/ko/erp.po
+++ b/packages/locale/locales/ko/erp.po
@@ -48,6 +48,9 @@ msgstr "\"{taskName}\" 완료 — 설정 맵 항목 {0}개가 모두 설정되
msgid "(excluded for this customer)"
msgstr "(이 고객에게는 제외됨)"
+msgid "(Inactive)"
+msgstr "(비활성)"
+
#. placeholder {0}: target.slackDays
msgid "{0, plural, one {# day of slack} other {# days of slack}}"
msgstr "{0, plural, one {여유 # 일} other {여유 # 일}}"
@@ -1430,6 +1433,9 @@ msgstr "인증 앱 추가"
msgid "Add Calibration Record"
msgstr "교정 기록 추가"
+msgid "Add Characteristic"
+msgstr "특성 추가"
+
msgid "Add Child Storage Unit"
msgstr "하위 보관 단위 추가"
@@ -1460,9 +1466,6 @@ msgstr "직원 추가"
msgid "Add Entry"
msgstr "항목 추가"
-msgid "Add Feature"
-msgstr "기능 추가"
-
msgid "Add from library…"
msgstr "라이브러리에서 추가…"
@@ -1749,6 +1752,9 @@ msgstr "모든 부서"
msgid "All Documents"
msgstr "모든 문서"
+msgid "All gauges"
+msgstr "모든 계측기"
+
msgid "All item types"
msgstr "모든 품목 유형"
@@ -2013,6 +2019,9 @@ msgstr "이것이 중첩되는 다른 보관 단위 (예: 랙 내의 빈); 같
msgid "Another system is connected to Ramp as its accounting system"
msgstr "다른 시스템이 Ramp에 회계 시스템으로 연결되어 있습니다"
+msgid "Any"
+msgstr "아무거나"
+
msgid "Any item group"
msgstr "모든 품목 그룹"
@@ -2092,8 +2101,8 @@ msgstr "전체에 적용"
msgid "Applies to all work centers"
msgstr "모든 작업장에 적용"
-msgid "Applies to features without their own rule, and to the lot when this plan drives an inspection."
-msgstr "자신의 규칙이 없는 기능과 이 계획이 검사를 실행할 때의 로트에 적용됩니다."
+msgid "Applies to characteristics without their own rule, and to the lot when this plan drives an inspection."
+msgstr "자신의 규칙이 없는 특성과 이 계획이 검사를 실행하는 로트에 적용됩니다."
msgid "Apply"
msgstr "적용"
@@ -3720,6 +3729,15 @@ msgstr "이를 변경하면 품목 ID가 업데이트됩니다"
msgid "Changing type resets this item's draft edits."
msgstr "유형을 변경하면 이 항목의 초안 편집이 재설정됩니다."
+msgid "Characteristic"
+msgstr "특성"
+
+msgid "Characteristic values suggested from drawing"
+msgstr "도면에서 제안된 특성 값"
+
+msgid "Characteristics"
+msgstr "특성"
+
msgid "Charges"
msgstr "청구"
@@ -3820,6 +3838,9 @@ msgstr "마감일 지우기"
msgid "Clear Filters"
msgstr "필터 지우기"
+msgid "Clear gauge"
+msgstr "계측기 제거"
+
msgid "Clear search"
msgstr "검색어 지우기"
@@ -3921,12 +3942,12 @@ msgstr "축소 {0}"
msgid "Collapse all"
msgstr "모두 접기"
+msgid "Collapse characteristics table"
+msgstr "특성 테이블 축소"
+
msgid "Collapse Costs"
msgstr "원가 접기"
-msgid "Collapse features table"
-msgstr "기능 표 접기"
-
msgid "Collapse Labor"
msgstr "노무 접기"
@@ -4430,6 +4451,9 @@ msgstr "링크가 클립보드에 복사됨"
msgid "Copied setup prompt to your clipboard"
msgstr "셋업 프롬프트를 클립보드에 복사했습니다"
+msgid "Copied!"
+msgstr "복사되었습니다!"
+
msgid "Copies a setup prompt for your AI coding tool"
msgstr "AI 코딩 도구용 셋업 프롬프트를 복사합니다"
@@ -4445,12 +4469,21 @@ msgstr "API 키 복사"
msgid "Copy batch number"
msgstr "배치 번호 복사"
+msgid "Copy change notice unique identifier"
+msgstr "변경 통지 고유 식별자 복사"
+
msgid "Copy company unique identifier"
msgstr "회사 고유 식별자 복사"
msgid "Copy consumable number"
msgstr "소모품 번호 복사"
+msgid "Copy consumable unique identifier"
+msgstr "소모품 고유 식별자 복사"
+
+msgid "Copy customer unique identifier"
+msgstr "고객 고유 식별자 복사"
+
msgid "Copy dispatch ID"
msgstr "유지보수 지시 ID 복사"
@@ -4475,6 +4508,9 @@ msgstr "이슈 고유 식별자 복사"
msgid "Copy Job number"
msgstr "작업 번호 복사"
+msgid "Copy job unique identifier"
+msgstr "작업 지시 고유 식별자 복사"
+
msgid "Copy link"
msgstr "링크 복사"
@@ -4553,6 +4589,15 @@ msgstr "절차서 이름 복사"
msgid "Copy procedure unique identifier"
msgstr "절차서 고유 식별자 복사"
+msgid "Copy purchase invoice unique identifier"
+msgstr "매입 송장 고유 식별자 복사"
+
+msgid "Copy purchase order unique identifier"
+msgstr "발주서 고유 식별자 복사"
+
+msgid "Copy purchase return order unique identifier"
+msgstr "구매 반품 주문 고유 식별자 복사"
+
msgid "Copy Quality Document"
msgstr "품질 문서 복사"
@@ -4562,18 +4607,39 @@ msgstr "견적 복사"
msgid "Copy Quote number"
msgstr "견적 번호 복사"
+msgid "Copy quote unique identifier"
+msgstr "견적서 고유 식별자 복사"
+
msgid "Copy return number"
msgstr "반품 번호 복사"
+msgid "Copy RFQ unique identifier"
+msgstr "견적 요청 고유 식별자 복사"
+
msgid "Copy RMA number"
msgstr "RMA 번호 복사"
+msgid "Copy sales invoice unique identifier"
+msgstr "매출 송장 고유 식별자 복사"
+
+msgid "Copy sales order unique identifier"
+msgstr "수주 고유 식별자 복사"
+
+msgid "Copy sales return order unique identifier"
+msgstr "판매 반품 주문 고유 식별자 복사"
+
msgid "Copy service number"
msgstr "서비스 번호 복사"
msgid "Copy service unique identifier"
msgstr "서비스 고유 식별자 복사"
+msgid "Copy supplier quote unique identifier"
+msgstr "공급업체 견적 고유 식별자 복사"
+
+msgid "Copy supplier unique identifier"
+msgstr "공급업체 고유 식별자 복사"
+
msgid "Copy this item's pricing to another scope."
msgstr "이 품목의 가격 책정을 다른 범위로 복사합니다."
@@ -4583,6 +4649,9 @@ msgstr "이 링크를 복사하여 고객과 견적을 공유하세요"
msgid "Copy this link to share the quote with a supplier"
msgstr "이 링크를 복사하여 공급업체와 견적을 공유하세요"
+msgid "Copy to clipboard"
+msgstr "클립보드에 복사"
+
msgid "Copy tool number"
msgstr "공구 번호 복사"
@@ -6119,9 +6188,6 @@ msgstr "모션 플래너가 감지함"
msgid "Developer"
msgstr "개발자"
-msgid "Diagram saved"
-msgstr "다이어그램이 저장됨"
-
msgid "Differs from the selection — allowed, but confirm they nest together"
msgstr "선택과 다릅니다 — 허용되지만 함께 중첩되는지 확인하세요"
@@ -6400,11 +6466,11 @@ msgstr "드래그하여 도면에 배치"
msgid "Drag to reorder"
msgstr "드래그하여 순서 변경"
-msgid "Drag to resize diagram and features"
-msgstr "드래그하여 다이어그램과 피처 크기 조정"
+msgid "Drag to resize diagram and characteristics"
+msgstr "다이어그램 및 특성의 크기를 조정하려면 드래그하세요"
-msgid "Drag to resize drawing and features"
-msgstr "드래그하여 드로잉 및 기능의 크기를 조정"
+msgid "Drag to resize drawing and characteristics"
+msgstr "도면 및 특성의 크기를 조정하려면 드래그하세요"
msgid "Drag to zoom"
msgstr "드래그하여 확대/축소"
@@ -6415,8 +6481,8 @@ msgstr "도면"
msgid "Drawing Number"
msgstr "도면 번호"
-msgid "Drawing replaced. Balloon placements were removed; feature rows are unchanged."
-msgstr "도면이 교체되었습니다. 벌룬 배치는 제거되었으며, 피처 행은 변경되지 않습니다."
+msgid "Drawing replaced. Balloon placements were removed; characteristic rows are unchanged."
+msgstr "도면이 교체되었습니다. 풍선 배치가 제거되었으며 특성 행은 변경되지 않았습니다."
msgid "Drop Ship"
msgstr "직배송"
@@ -7452,12 +7518,12 @@ msgstr "{0} 펼치기"
msgid "Expand all"
msgstr "모두 펼치기"
+msgid "Expand characteristics table"
+msgstr "특성 테이블 확장"
+
msgid "Expand Costs"
msgstr "원가 펼치기"
-msgid "Expand features table"
-msgstr "기능 표 펼치기"
-
msgid "Expand Labor"
msgstr "노무 펼치기"
@@ -7641,8 +7707,8 @@ msgstr "불합격"
msgid "Failed"
msgstr "실패"
-msgid "Failed features"
-msgstr "부적합 특성"
+msgid "Failed characteristics"
+msgstr "실패한 특성"
#. placeholder {0}: rows.length
msgid "Failed to add line — {addedCount} of {0} lines were added"
@@ -7893,6 +7959,9 @@ msgstr "추적 개체를 불러오지 못했습니다"
msgid "Failed to move account: {0}"
msgstr "계정 이동 실패: {0}"
+msgid "Failed to record gauge"
+msgstr "계측기 기록에 실패했습니다"
+
msgid "Failed to regenerate schedule"
msgstr "일정 재생성 실패"
@@ -7926,8 +7995,8 @@ msgstr "CSV 열 데이터를 가져오지 못했습니다."
msgid "Failed to save configuration rule"
msgstr "설정 규칙을 저장하지 못했습니다"
-msgid "Failed to save diagram"
-msgstr "다이어그램을 저장하지 못했습니다"
+msgid "Failed to save inspection plan"
+msgstr "검사 계획 저장에 실패했습니다"
msgid "Failed to save measurement"
msgstr "측정값 저장 실패"
@@ -8028,15 +8097,6 @@ msgstr "팩스"
msgid "Fax Number"
msgstr "팩스 번호"
-msgid "Feature"
-msgstr "기능"
-
-msgid "Feature values suggested from drawing"
-msgstr "도면에서 제안된 기능 값"
-
-msgid "Features"
-msgstr "기능"
-
msgid "Fees"
msgstr "수수료"
@@ -8342,6 +8402,9 @@ msgstr "계측기"
msgid "Gauge Calibration Notifications"
msgstr "계측기 교정 알림"
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "특성 {characteristicLabel}에 대한 계측기: {currentGauge}"
+
msgid "Gauge ID"
msgstr "계측기 ID"
@@ -11678,6 +11741,9 @@ msgstr "이 작업 지시에 대한 예측이 없습니다."
msgid "No Gauge Selected"
msgstr "선택된 계측기 없음"
+msgid "No gauges found."
+msgstr "계측기를 찾을 수 없습니다."
+
msgid "No grouped notifications"
msgstr "그룹화된 알림이 없습니다"
@@ -12748,6 +12814,9 @@ msgstr "그 외에"
msgid "Out"
msgstr "출고"
+msgid "Out of calibration"
+msgstr "교정 범위 벗어남"
+
msgid "Outbound"
msgstr "출고"
@@ -14424,6 +14493,9 @@ msgstr "최근 지불"
msgid "Recently Created"
msgstr "최근 생성됨"
+msgid "Recently used"
+msgstr "최근 사용"
+
msgid "Recertify Every (Days)"
msgstr "매 (Days)마다 재인증"
@@ -14801,8 +14873,8 @@ msgstr "이 회사의 데이터를 데모 데이터셋으로 교체합니다 —
msgid "Replacement Order"
msgstr "대체 주문"
-msgid "Replacing the PDF removes all balloon placements on this document. Feature rows and their values stay; you can place balloons again on the new drawing."
-msgstr "PDF를 교체하면 이 문서의 모든 풍선 표시가 제거됩니다. 기능 행과 값은 유지되며, 새 도면에 풍선을 다시 배치할 수 있습니다."
+msgid "Replacing the PDF removes all balloon placements on this document. Characteristic rows and their values stay; you can place balloons again on the new drawing."
+msgstr "PDF를 교체하면 이 문서의 모든 풍선 배치가 제거됩니다. 특성 행과 해당 값은 유지되며, 새 도면에서 풍선을 다시 배치할 수 있습니다."
msgid "Replenishment"
msgstr "보충"
@@ -15550,8 +15622,8 @@ msgstr "샘플 크기"
msgid "Sampling"
msgstr "샘플링"
-msgid "Sampling — Feature {featureLabel}"
-msgstr "샘플링 — 기능 {featureLabel}"
+msgid "Sampling — Characteristic {featureLabel}"
+msgstr "샘플링 — 특성 {featureLabel}"
msgid "Sampling Standard"
msgstr "샘플링 표준"
@@ -15752,6 +15824,9 @@ msgstr "폐기됨"
msgid "Search"
msgstr "검색"
+msgid "Search {gaugeTypeName}..."
+msgstr "검색 {gaugeTypeName}..."
+
msgid "Search accounts"
msgstr "계정 검색"
@@ -15797,6 +15872,9 @@ msgstr "필드 검색..."
msgid "Search for existing or create a new one"
msgstr "기존 항목을 검색하거나 새로 생성하세요"
+msgid "Search gauges..."
+msgstr "계측기 검색..."
+
msgid "Search items or bins"
msgstr "품목 또는 빈 검색"
@@ -15993,6 +16071,9 @@ msgstr "직원 유형 선택"
msgid "Select field"
msgstr "필드 선택"
+msgid "Select gauge"
+msgstr "계측기 선택"
+
msgid "Select Gauge"
msgstr "계측기 선택"
@@ -18113,8 +18194,8 @@ msgstr "로트는 통과로 표시됩니다. {fails}개의 샘플 불합격 항
msgid "The lot will still be rejected, but an NCR cannot be created until at least one Issue Type is configured."
msgstr "로트는 그대로 반려되지만, 이슈 유형이 하나 이상 설정되기 전까지는 NCR을 생성할 수 없습니다."
-msgid "The lot's per-feature sampling plan will be re-resolved from the selected document."
-msgstr "로트의 특성별 샘플링 계획이 선택된 문서에서 다시 결정됩니다."
+msgid "The lot's per-characteristic sampling plan will be re-resolved from the selected document."
+msgstr "로트의 특성별 샘플링 계획은 선택한 문서에서 다시 결정됩니다."
msgid "The lowest amount this supplier will charge for this process, regardless of quantity; jobs below the breakeven volume still cost at least this much."
msgstr "이 공급업체가 수량과 관계없이 이 공법에 대해 청구할 최소 금액; 손익분기점 이하의 작업 지시도 최소한 이 금액이 들어갑니다."
@@ -19479,6 +19560,9 @@ msgstr "알 수 없음"
msgid "unknown error"
msgstr "알 수 없는 오류"
+msgid "Unknown gauge"
+msgstr "알 수 없는 계측기"
+
msgid "unknown location"
msgstr "알 수 없는 위치"
@@ -20051,6 +20135,9 @@ msgstr "메모 보기"
msgid "View on schedule board"
msgstr "일정 보드에서 보기"
+msgid "View only — changes are not saved"
+msgstr "보기 전용 — 변경 사항이 저장되지 않습니다"
+
msgid "View Open"
msgstr "미결 보기"
@@ -20968,6 +21055,9 @@ msgstr "초대가 유효하지 않거나 이미 수락되었습니다. 이것이
msgid "Your job here: check a real sample of each row, then mark it validated. Foundation data loads first, then master records, then open transactions at cutover."
msgstr "여기서 할 일: 각 행의 실제 샘플을 확인한 후 검증 완료로 표시하세요. 기초 데이터가 먼저 로드되고, 이어서 마스터 레코드, 전환 시점의 미결 거래 순으로 로드됩니다."
+msgid "Your latest changes could not be saved. Are you sure you want to leave this page?"
+msgstr "최근 변경 사항을 저장할 수 없습니다. 이 페이지를 떠나시겠습니까?"
+
msgid "Your legal name, addresses, branding, and document defaults"
msgstr "법인명, 주소, 브랜딩, 문서 기본값"
diff --git a/packages/locale/locales/ko/mes.po b/packages/locale/locales/ko/mes.po
index d61cf9571b..17e5cde26e 100644
--- a/packages/locale/locales/ko/mes.po
+++ b/packages/locale/locales/ko/mes.po
@@ -12,6 +12,9 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+msgid "(Inactive)"
+msgstr "(비활성)"
+
#. placeholder {0}: attribute.name
#. placeholder {1}: activeStep + 1
msgid "{0} - Set {1}"
@@ -148,6 +151,9 @@ msgstr "전체"
msgid "All clear"
msgstr "모두 정상"
+msgid "All gauges"
+msgstr "모든 계측기"
+
msgid "All jobs"
msgstr "모든 작업 지시"
@@ -268,6 +274,12 @@ msgstr "Carbon 로고"
msgid "Cards"
msgstr "카드"
+msgid "Characteristic"
+msgstr "특성"
+
+msgid "Characteristics"
+msgstr "특성"
+
msgid "Chat"
msgstr "채팅"
@@ -283,6 +295,9 @@ msgstr "지우기"
msgid "Clear Filters"
msgstr "필터 지우기"
+msgid "Clear gauge"
+msgstr "계측기 해제"
+
msgid "Clear Search"
msgstr "검색 지우기"
@@ -301,8 +316,8 @@ msgstr "<0/>부터 근무 중"
msgid "Close"
msgstr "닫기"
-msgid "Collapse features table"
-msgstr "기능 테이블 축소"
+msgid "Collapse characteristics table"
+msgstr "특성 표 축소"
msgid "Collapse panel"
msgstr "패널 축소"
@@ -366,6 +381,15 @@ msgstr "소모됨 만료됨"
msgid "Continue"
msgstr "계속"
+msgid "Copied!"
+msgstr "복사되었습니다!"
+
+msgid "Copy"
+msgstr "복사"
+
+msgid "Copy to clipboard"
+msgstr "클립보드에 복사"
+
#. placeholder {0}: board.unplannedCost.days
msgid "Cost of unplanned maintenance, last {0} days"
msgstr "계획되지 않은 유지보수의 원가, 최근 {0}일"
@@ -463,8 +487,8 @@ msgstr "초안"
msgid "Drag and drop a file here, or click to select a file"
msgstr "파일을 여기로 끌어다 놓거나 클릭하여 선택하세요"
-msgid "Drag to resize drawing and features"
-msgstr "그리기 및 기능 크기 조정하려면 드래그하세요"
+msgid "Drag to resize drawing and characteristics"
+msgstr "드래그하여 도면 및 특성 크기 조정"
#. placeholder {0}: active.data.current?.type
msgid "Dragging {0} cancelled."
@@ -541,8 +565,8 @@ msgstr "배치의 모든 작업 지시는 이러한 단계를 따릅니다. 모
msgid "Every unit has a verdict: {passes} passed and {fails} failed. The lot closes with each unit routed to its own outcome."
msgstr "각 개는 판정을 가집니다: {passes}개 통과하고 {fails}개 불합격합니다. 로트는 각 개가 자신의 결과로 배정되면서 마감됩니다."
-msgid "Expand features table"
-msgstr "기능 테이블 확장"
+msgid "Expand characteristics table"
+msgstr "특성 표 확대"
msgid "Expand panel"
msgstr "패널 확대"
@@ -563,8 +587,8 @@ msgstr "먼저 만료되는 순"
msgid "Failed"
msgstr "실패"
-msgid "Failed features"
-msgstr "실패한 기능"
+msgid "Failed characteristics"
+msgstr "부적합 특성"
msgid "Failed to complete inventory adjustment"
msgstr "재고 조정을 완료하지 못했습니다"
@@ -581,6 +605,9 @@ msgstr "진행 중인 공정작업을 불러오지 못했습니다"
msgid "Failed to fetch storageUnits"
msgstr "저장 단위를 불러오지 못했습니다"
+msgid "Failed to record gauge"
+msgstr "계측기 기록 실패"
+
msgid "Failed to save measurement"
msgstr "측정값 저장 실패"
@@ -598,12 +625,6 @@ msgstr "파일을 업로드하지 못했습니다: {0}"
msgid "Failed to upload image"
msgstr "이미지를 업로드하지 못했습니다"
-msgid "Feature"
-msgstr "기능"
-
-msgid "Features"
-msgstr "기능"
-
msgid "File size exceeds 10MB limit"
msgstr "파일 크기가 10MB 제한을 초과했습니다"
@@ -645,6 +666,12 @@ msgstr "완료하기 전에 강조된 수량을 수정하세요."
msgid "Forgot to Clock Out?"
msgstr "작업 종료를 잊었나요?"
+msgid "Gauge"
+msgstr "계측기"
+
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "특성 {characteristicLabel}에 대한 계측기: {currentGauge}"
+
msgid "General"
msgstr "일반"
@@ -959,6 +986,9 @@ msgstr "당신에게 할당된 유지보수 지시가 없습니다"
msgid "No files"
msgstr "파일 없음"
+msgid "No gauges found."
+msgstr "계측기가 없습니다."
+
msgid "No Impact"
msgstr "영향 없음"
@@ -1126,6 +1156,9 @@ msgstr "선택 사항"
msgid "or"
msgstr "또는"
+msgid "Out of calibration"
+msgstr "교정 기한 만료"
+
msgid "Output lot"
msgstr "출력 로트"
@@ -1276,6 +1309,9 @@ msgstr "재작업 사유"
msgid "Recent"
msgstr "최근"
+msgid "Recently used"
+msgstr "최근 사용"
+
msgid "Record"
msgstr "기록"
@@ -1407,9 +1443,15 @@ msgstr "선택한 일련번호 폐기"
msgid "Search"
msgstr "검색"
+msgid "Search {gaugeTypeName}..."
+msgstr "{gaugeTypeName} 검색..."
+
msgid "Search by job or item ID"
msgstr "작업 또는 품목 ID로 검색"
+msgid "Search gauges..."
+msgstr "계측기 검색..."
+
msgid "Search operators..."
msgstr "작업자 검색..."
@@ -1444,6 +1486,9 @@ msgstr "품목을 선택하세요..."
msgid "Select Batch {0}"
msgstr "배치 {0} 선택"
+msgid "Select gauge"
+msgstr "계측기 선택"
+
msgid "Select Printer"
msgstr "프린터 선택"
@@ -1728,6 +1773,9 @@ msgstr "출고되지 않은 일련번호/배치 자재"
msgid "Unknown"
msgstr "알 수 없음"
+msgid "Unknown gauge"
+msgstr "알 수 없는 계측기"
+
msgid "Unlock"
msgstr "잠금 해제"
diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.po
index 18002d2bc2..a66c29882a 100644
--- a/packages/locale/locales/pl/erp.po
+++ b/packages/locale/locales/pl/erp.po
@@ -48,6 +48,9 @@ msgstr "„{taskName}\" jest gotowe — wszystkie {0} jego elementów Setup Map
msgid "(excluded for this customer)"
msgstr "(wykluczone dla tego klienta)"
+msgid "(Inactive)"
+msgstr "(Nieaktywny)"
+
#. placeholder {0}: target.slackDays
msgid "{0, plural, one {# day of slack} other {# days of slack}}"
msgstr "{0, plural, one {# dzień luzu} few {# dni luzu} many {# dni luzu} other {# dni luzu}}"
@@ -1430,6 +1433,9 @@ msgstr "Dodaj aplikację Authenticator"
msgid "Add Calibration Record"
msgstr "Dodaj Zapis wzorcowania"
+msgid "Add Characteristic"
+msgstr "Dodaj charakterystykę"
+
msgid "Add Child Storage Unit"
msgstr "Dodaj podrzędną jednostkę magazynową"
@@ -1460,9 +1466,6 @@ msgstr "Dodaj Pracownika"
msgid "Add Entry"
msgstr "Dodaj wpis"
-msgid "Add Feature"
-msgstr "Dodaj funkcję"
-
msgid "Add from library…"
msgstr "Dodaj z biblioteki…"
@@ -1749,6 +1752,9 @@ msgstr "Wszystkie działy"
msgid "All Documents"
msgstr "Wszystkie dokumenty"
+msgid "All gauges"
+msgstr "Wszystkie przyrządy pomiarowe"
+
msgid "All item types"
msgstr "Wszystkie typy artykułów"
@@ -2013,6 +2019,9 @@ msgstr "Inna jednostka magazynowa, w której ta się zagnieżdża (np. pojemnik
msgid "Another system is connected to Ramp as its accounting system"
msgstr "Inny system jest połączony z Ramp jako jego system księgowy"
+msgid "Any"
+msgstr "Dowolny"
+
msgid "Any item group"
msgstr "Dowolna grupa artykułów"
@@ -2092,8 +2101,8 @@ msgstr "Dotyczy wszystkich"
msgid "Applies to all work centers"
msgstr "Dotyczy wszystkich stanowisk roboczych"
-msgid "Applies to features without their own rule, and to the lot when this plan drives an inspection."
-msgstr "Dotyczy funkcji, które nie mają własnej reguły, oraz partii, gdy ten plan prowadzi kontrolę."
+msgid "Applies to characteristics without their own rule, and to the lot when this plan drives an inspection."
+msgstr "Dotyczy charakterystyk bez własnej reguły i partii, gdy ten plan kontroli prowadzi do wykonania kontroli."
msgid "Apply"
msgstr "Zastosuj"
@@ -3720,6 +3729,15 @@ msgstr "Zmiana tego zaktualizuje identyfikator części"
msgid "Changing type resets this item's draft edits."
msgstr "Zmiana typu resetuje zmiany wersji roboczej tego artykułu."
+msgid "Characteristic"
+msgstr "Charakterystyka"
+
+msgid "Characteristic values suggested from drawing"
+msgstr "Wartości charakterystyki sugerowane na podstawie rysunku"
+
+msgid "Characteristics"
+msgstr "Charakterystyki"
+
msgid "Charges"
msgstr "Obciążenia"
@@ -3820,6 +3838,9 @@ msgstr "Wyczyść datę terminu"
msgid "Clear Filters"
msgstr "Wyczyść filtry"
+msgid "Clear gauge"
+msgstr "Wyczyść przyrząd pomiarowy"
+
msgid "Clear search"
msgstr "Wyczyść wyszukiwanie"
@@ -3921,12 +3942,12 @@ msgstr "Zwiń {0}"
msgid "Collapse all"
msgstr "Zwiń wszystko"
+msgid "Collapse characteristics table"
+msgstr "Zwiń tabelę charakterystyk"
+
msgid "Collapse Costs"
msgstr "Zwiń koszty"
-msgid "Collapse features table"
-msgstr "Zwiń tabelę funkcji"
-
msgid "Collapse Labor"
msgstr "Zwiń robociznę"
@@ -4430,6 +4451,9 @@ msgstr "Skopiowano link do schowka"
msgid "Copied setup prompt to your clipboard"
msgstr "Skopiowano monit przezbrojenia do schowka"
+msgid "Copied!"
+msgstr "Skopiowano!"
+
msgid "Copies a setup prompt for your AI coding tool"
msgstr "Kopiuje instrukcję przezbrojenia dla twojego narzędzia kodowania AI"
@@ -4445,12 +4469,21 @@ msgstr "Skopiuj klucz API"
msgid "Copy batch number"
msgstr "Skopiuj numer partii produkcyjnej"
+msgid "Copy change notice unique identifier"
+msgstr "Skopiuj unikalny identyfikator zawiadomienia o zmianie"
+
msgid "Copy company unique identifier"
msgstr "Skopiuj unikalny identyfikator firmy"
msgid "Copy consumable number"
msgstr "Skopiuj numer materiału eksploatacyjnego"
+msgid "Copy consumable unique identifier"
+msgstr "Skopiuj unikalny identyfikator materiału eksploatacyjnego"
+
+msgid "Copy customer unique identifier"
+msgstr "Skopiuj unikalny identyfikator klienta"
+
msgid "Copy dispatch ID"
msgstr "Skopiuj identyfikator zlecenia utrzymania ruchu"
@@ -4475,6 +4508,9 @@ msgstr "Skopiuj unikalny identyfikator problemu"
msgid "Copy Job number"
msgstr "Skopiuj numer zadania"
+msgid "Copy job unique identifier"
+msgstr "Skopiuj unikalny identyfikator zlecenia produkcyjnego"
+
msgid "Copy link"
msgstr "Skopiuj link"
@@ -4553,6 +4589,15 @@ msgstr "Skopiuj nazwę procedury"
msgid "Copy procedure unique identifier"
msgstr "Skopiuj unikatowy identyfikator procedury"
+msgid "Copy purchase invoice unique identifier"
+msgstr "Skopiuj unikalny identyfikator faktury zakupu"
+
+msgid "Copy purchase order unique identifier"
+msgstr "Skopiuj unikalny identyfikator zamówienia zakupu"
+
+msgid "Copy purchase return order unique identifier"
+msgstr "Skopiuj unikalny identyfikator zamówienia zwrotu zakupu"
+
msgid "Copy Quality Document"
msgstr "Skopiuj Dokument Jakości"
@@ -4562,18 +4607,39 @@ msgstr "Skopiuj Ofertę"
msgid "Copy Quote number"
msgstr "Skopiuj numer oferty"
+msgid "Copy quote unique identifier"
+msgstr "Skopiuj unikalny identyfikator oferty"
+
msgid "Copy return number"
msgstr "Skopiuj numer zwrotu"
+msgid "Copy RFQ unique identifier"
+msgstr "Skopiuj unikalny identyfikator RFQ"
+
msgid "Copy RMA number"
msgstr "Skopiuj numer RMA"
+msgid "Copy sales invoice unique identifier"
+msgstr "Skopiuj unikalny identyfikator faktury sprzedaży"
+
+msgid "Copy sales order unique identifier"
+msgstr "Skopiuj unikalny identyfikator zamówienia sprzedaży"
+
+msgid "Copy sales return order unique identifier"
+msgstr "Skopiuj unikalny identyfikator zamówienia zwrotu sprzedaży"
+
msgid "Copy service number"
msgstr "Skopiuj numer usługi"
msgid "Copy service unique identifier"
msgstr "Skopiuj unikalny identyfikator usługi"
+msgid "Copy supplier quote unique identifier"
+msgstr "Skopiuj unikalny identyfikator oferty dostawcy"
+
+msgid "Copy supplier unique identifier"
+msgstr "Skopiuj unikalny identyfikator dostawcy"
+
msgid "Copy this item's pricing to another scope."
msgstr "Skopiuj wycenę tego artykułu na inny zakres."
@@ -4583,6 +4649,9 @@ msgstr "Skopiuj ten link, aby udostępnić ofertę klientowi"
msgid "Copy this link to share the quote with a supplier"
msgstr "Skopiuj ten link, aby udostępnić ofertę dostawcy"
+msgid "Copy to clipboard"
+msgstr "Kopiuj do schowka"
+
msgid "Copy tool number"
msgstr "Skopiuj numer narzędzia"
@@ -6119,9 +6188,6 @@ msgstr "Wykryte przez planer ruchu"
msgid "Developer"
msgstr "Deweloper"
-msgid "Diagram saved"
-msgstr "Diagram zapisany"
-
msgid "Differs from the selection — allowed, but confirm they nest together"
msgstr "Różni się od wyboru — dozwolone, ale potwierdź, że się do siebie dopasowują"
@@ -6400,11 +6466,11 @@ msgstr "Przeciągnij, aby umieścić na rysunku"
msgid "Drag to reorder"
msgstr "Przeciągnij, aby zmienić kolejność"
-msgid "Drag to resize diagram and features"
-msgstr "Przeciągnij, aby zmienić rozmiar diagramu i funkcji"
+msgid "Drag to resize diagram and characteristics"
+msgstr "Przeciągnij, aby zmienić rozmiar diagramu i charakterystyk"
-msgid "Drag to resize drawing and features"
-msgstr "Przeciągnij, aby zmienić rozmiar rysunku i funkcji"
+msgid "Drag to resize drawing and characteristics"
+msgstr "Przeciągnij, aby zmienić rozmiar rysunku i charakterystyk"
msgid "Drag to zoom"
msgstr "Przeciągnij, aby powiększyć"
@@ -6415,8 +6481,8 @@ msgstr "Pobieranie"
msgid "Drawing Number"
msgstr "Numer rysunku"
-msgid "Drawing replaced. Balloon placements were removed; feature rows are unchanged."
-msgstr "Rysunek zastąpiony. Umieszczenia balonów zostały usunięte; wiersze funkcji pozostają niezmienione."
+msgid "Drawing replaced. Balloon placements were removed; characteristic rows are unchanged."
+msgstr "Rysunek zastąpiony. Umieszczenia balonów zostały usunięte; wiersze charakterystyk pozostały niezmienione."
msgid "Drop Ship"
msgstr "Wysyłka bezpośrednia"
@@ -7452,12 +7518,12 @@ msgstr "Rozwiń {0}"
msgid "Expand all"
msgstr "Rozwiń wszystko"
+msgid "Expand characteristics table"
+msgstr "Rozwiń tabelę charakterystyk"
+
msgid "Expand Costs"
msgstr "Rozwiń koszty"
-msgid "Expand features table"
-msgstr "Rozwiń tabelę funkcji"
-
msgid "Expand Labor"
msgstr "Rozwiń Robociznę"
@@ -7641,8 +7707,8 @@ msgstr "Niezgodny"
msgid "Failed"
msgstr "Nieudane"
-msgid "Failed features"
-msgstr "Cechy nie powiodły się"
+msgid "Failed characteristics"
+msgstr "Cechy niezgodne"
#. placeholder {0}: rows.length
msgid "Failed to add line — {addedCount} of {0} lines were added"
@@ -7893,6 +7959,9 @@ msgstr "Nie udało się załadować śledzonych jednostek"
msgid "Failed to move account: {0}"
msgstr "Nie udało się przenieść konta: {0}"
+msgid "Failed to record gauge"
+msgstr "Nie udało się zapisać przyrządu pomiarowego"
+
msgid "Failed to regenerate schedule"
msgstr "Nie udało się wygenerować harmonogramu"
@@ -7926,8 +7995,8 @@ msgstr "Nie udało się pobrać danych kolumn CSV."
msgid "Failed to save configuration rule"
msgstr "Nie udało się zapisać reguły konfiguracji"
-msgid "Failed to save diagram"
-msgstr "Nie udało się zapisać diagramu"
+msgid "Failed to save inspection plan"
+msgstr "Nie udało się zapisać planu kontroli"
msgid "Failed to save measurement"
msgstr "Nie udało się zapisać pomiaru"
@@ -8028,15 +8097,6 @@ msgstr "Faks"
msgid "Fax Number"
msgstr "Numer faksu"
-msgid "Feature"
-msgstr "Funkcja"
-
-msgid "Feature values suggested from drawing"
-msgstr "Wartości funkcji sugerowane z rysunku"
-
-msgid "Features"
-msgstr "Funkcje"
-
msgid "Fees"
msgstr "Opłaty"
@@ -8342,6 +8402,9 @@ msgstr "Przyrząd pomiarowy"
msgid "Gauge Calibration Notifications"
msgstr "Powiadomienia o wzorcowaniu przyrządów pomiarowych"
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Przyrząd pomiarowy dla charakterystyki {characteristicLabel}: {currentGauge}"
+
msgid "Gauge ID"
msgstr "ID przyrządu pomiarowego"
@@ -11678,6 +11741,9 @@ msgstr "Brak prognozy dostępnej dla tego zadania."
msgid "No Gauge Selected"
msgstr "Nie wybrano Przyrządu pomiarowego"
+msgid "No gauges found."
+msgstr "Nie znaleziono przyrządów pomiarowych."
+
msgid "No grouped notifications"
msgstr "Brak zgrupowanych powiadomień"
@@ -12748,6 +12814,9 @@ msgstr "W przeciwnym razie"
msgid "Out"
msgstr "Poza"
+msgid "Out of calibration"
+msgstr "Wymaga wzorcowania"
+
msgid "Outbound"
msgstr "Wychodzące"
@@ -14424,6 +14493,9 @@ msgstr "Ostatnie płatności"
msgid "Recently Created"
msgstr "Niedawno utworzone"
+msgid "Recently used"
+msgstr "Ostatnio używane"
+
msgid "Recertify Every (Days)"
msgstr "Ponownie certyfikuj co (Dni)"
@@ -14801,8 +14873,8 @@ msgstr "Zastąp dane tej firmy zestawem danych demonstracyjnych — najpierw mig
msgid "Replacement Order"
msgstr "Zamówienie zastępcze"
-msgid "Replacing the PDF removes all balloon placements on this document. Feature rows and their values stay; you can place balloons again on the new drawing."
-msgstr "Zamiana pliku PDF usuwa wszystkie umieszczenia dymków na tym dokumencie. Wiersze funkcji i ich wartości pozostają; możesz ponownie umieścić dymki na nowym rysunku."
+msgid "Replacing the PDF removes all balloon placements on this document. Characteristic rows and their values stay; you can place balloons again on the new drawing."
+msgstr "Zastąpienie PDF-a usuwa wszystkie umieszczenia balonów na tym dokumencie. Wiersze charakterystyk i ich wartości zostają; możesz ponownie umieścić balony na nowym rysunku."
msgid "Replenishment"
msgstr "Uzupełnianie"
@@ -15550,8 +15622,8 @@ msgstr "Wielkość próbki"
msgid "Sampling"
msgstr "Kontrola wyrywkowa"
-msgid "Sampling — Feature {featureLabel}"
-msgstr "Kontrola wyrywkowa — Funkcja {featureLabel}"
+msgid "Sampling — Characteristic {featureLabel}"
+msgstr "Kontrola wyrywkowa — Charakterystyka {featureLabel}"
msgid "Sampling Standard"
msgstr "Normalna kontrola wyrywkowa"
@@ -15752,6 +15824,9 @@ msgstr "Złomowany"
msgid "Search"
msgstr "Szukaj"
+msgid "Search {gaugeTypeName}..."
+msgstr "Szukaj {gaugeTypeName}..."
+
msgid "Search accounts"
msgstr "Wyszukaj konta"
@@ -15797,6 +15872,9 @@ msgstr "Wyszukaj pola..."
msgid "Search for existing or create a new one"
msgstr "Wyszukaj istniejący lub utwórz nowy"
+msgid "Search gauges..."
+msgstr "Szukaj przyrządów pomiarowych..."
+
msgid "Search items or bins"
msgstr "Szukaj przedmiotów lub pojemników"
@@ -15993,6 +16071,9 @@ msgstr "Wybierz typ pracownika"
msgid "Select field"
msgstr "Wybierz pole"
+msgid "Select gauge"
+msgstr "Wybierz przyrząd pomiarowy"
+
msgid "Select Gauge"
msgstr "Wybierz przyrząd pomiarowy"
@@ -18113,8 +18194,8 @@ msgstr "Partia będzie oznaczona jako Zaliczona. {fails} niepowodzenie(ń) prób
msgid "The lot will still be rejected, but an NCR cannot be created until at least one Issue Type is configured."
msgstr "Partia będzie nadal odrzucona, ale nie można utworzyć NCR, dopóki nie zostanie skonfigurowany co najmniej jeden typ problemu."
-msgid "The lot's per-feature sampling plan will be re-resolved from the selected document."
-msgstr "Plan kontroli wyrywkowej partii będzie ponownie ustalony na podstawie wybranego dokumentu."
+msgid "The lot's per-characteristic sampling plan will be re-resolved from the selected document."
+msgstr "Plan kontroli wyrywkowej dla każdej cechy partii zostanie ponownie ustalony na podstawie wybranego dokumentu."
msgid "The lowest amount this supplier will charge for this process, regardless of quantity; jobs below the breakeven volume still cost at least this much."
msgstr "Najniższa kwota, którą dostawca będzie pobierać za ten proces, niezależnie od ilości; zlecenia produkcyjne poniżej progu rentowności kosztują przynajmniej tyle."
@@ -19479,6 +19560,9 @@ msgstr "Nieznany"
msgid "unknown error"
msgstr "nieznany błąd"
+msgid "Unknown gauge"
+msgstr "Nieznany przyrząd pomiarowy"
+
msgid "unknown location"
msgstr "nieznana lokalizacja"
@@ -20051,6 +20135,9 @@ msgstr "Wyświetl notatki"
msgid "View on schedule board"
msgstr "Zobacz na tablicy harmonogramu"
+msgid "View only — changes are not saved"
+msgstr "Tryb wyświetlania — zmiany nie są zapisywane"
+
msgid "View Open"
msgstr "Wyświetl Otwarte"
@@ -20968,6 +21055,9 @@ msgstr "Twoje zaproszenie jest nieprawidłowe lub zostało już zaakceptowane. S
msgid "Your job here: check a real sample of each row, then mark it validated. Foundation data loads first, then master records, then open transactions at cutover."
msgstr "Twoja rola tutaj: sprawdź rzeczywistą próbkę każdego wiersza, a następnie oznacz ją jako zweryfikowaną. Dane fundamentowe ładują się najpierw, potem rekordy główne, a następnie otwarte transakcje w momencie przejścia."
+msgid "Your latest changes could not be saved. Are you sure you want to leave this page?"
+msgstr "Nie można było zapisać ostatnich zmian. Czy na pewno chcesz opuścić tę stronę?"
+
msgid "Your legal name, addresses, branding, and document defaults"
msgstr "Twoja nazwa prawna, adresy, branding i domyślne ustawienia dokumentów"
diff --git a/packages/locale/locales/pl/mes.po b/packages/locale/locales/pl/mes.po
index 40aabb7c99..e85e4db6e6 100644
--- a/packages/locale/locales/pl/mes.po
+++ b/packages/locale/locales/pl/mes.po
@@ -12,6 +12,9 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+msgid "(Inactive)"
+msgstr "(Nieaktywny)"
+
#. placeholder {0}: attribute.name
#. placeholder {1}: activeStep + 1
msgid "{0} - Set {1}"
@@ -148,6 +151,9 @@ msgstr "Wszystkie"
msgid "All clear"
msgstr "Wszystko jasne"
+msgid "All gauges"
+msgstr "Wszystkie przyrządy pomiarowe"
+
msgid "All jobs"
msgstr "Wszystkie zlecenia produkcyjne"
@@ -268,6 +274,12 @@ msgstr "Logo Carbon"
msgid "Cards"
msgstr "Karty"
+msgid "Characteristic"
+msgstr "Cecha"
+
+msgid "Characteristics"
+msgstr "Cechy"
+
msgid "Chat"
msgstr "Czat"
@@ -283,6 +295,9 @@ msgstr "Wyczyść"
msgid "Clear Filters"
msgstr "Wyczyść filtry"
+msgid "Clear gauge"
+msgstr "Wyczyść przyrząd pomiarowy"
+
msgid "Clear Search"
msgstr "Wyczyść wyszukiwanie"
@@ -301,8 +316,8 @@ msgstr "Zalogowany od <0/>"
msgid "Close"
msgstr "Zamknij"
-msgid "Collapse features table"
-msgstr "Zwiń tabelę funkcji"
+msgid "Collapse characteristics table"
+msgstr "Zwiń tabelę cech"
msgid "Collapse panel"
msgstr "Zwiń panel"
@@ -366,6 +381,15 @@ msgstr "Zużyte wygasłe"
msgid "Continue"
msgstr "Kontynuuj"
+msgid "Copied!"
+msgstr "Skopiowano!"
+
+msgid "Copy"
+msgstr "Kopiuj"
+
+msgid "Copy to clipboard"
+msgstr "Kopiuj do schowka"
+
#. placeholder {0}: board.unplannedCost.days
msgid "Cost of unplanned maintenance, last {0} days"
msgstr "Koszt nieplanowanego utrzymania ruchu, ostatnie {0} dni"
@@ -463,8 +487,8 @@ msgstr "Wersja robocza"
msgid "Drag and drop a file here, or click to select a file"
msgstr "Przeciągnij i upuść plik tutaj lub kliknij, aby wybrać plik"
-msgid "Drag to resize drawing and features"
-msgstr "Przeciągnij, aby zmienić rozmiar rysunku i funkcji"
+msgid "Drag to resize drawing and characteristics"
+msgstr "Przeciągnij, aby zmienić rozmiar rysunku i cech"
#. placeholder {0}: active.data.current?.type
msgid "Dragging {0} cancelled."
@@ -541,8 +565,8 @@ msgstr "Każde zlecenie produkcyjne w partii produkcyjnej następuje po tych kro
msgid "Every unit has a verdict: {passes} passed and {fails} failed. The lot closes with each unit routed to its own outcome."
msgstr "Każda sztuka ma wyrok: {passes} zaliczonych i {fails} niezaliczonych. Partia zamyka się, każda sztuka kierowana jest do jej wyniku."
-msgid "Expand features table"
-msgstr "Rozwiń tabelę funkcji"
+msgid "Expand characteristics table"
+msgstr "Rozwiń tabelę cech"
msgid "Expand panel"
msgstr "Rozwiń panel"
@@ -563,8 +587,8 @@ msgstr "Wygasające pierwsze"
msgid "Failed"
msgstr "Nieudane"
-msgid "Failed features"
-msgstr "Funkcje nie powiodły się"
+msgid "Failed characteristics"
+msgstr "Nieudane cechy"
msgid "Failed to complete inventory adjustment"
msgstr "Nie udało się zakończyć korekty zapasów"
@@ -581,6 +605,9 @@ msgstr "Nie udało się pobrać aktywnych operacji"
msgid "Failed to fetch storageUnits"
msgstr "Nie udało się pobrać jednostek magazynowych"
+msgid "Failed to record gauge"
+msgstr "Nie udało się zarejestrować przyrządu pomiarowego"
+
msgid "Failed to save measurement"
msgstr "Nie udało się zapisać pomiaru"
@@ -598,12 +625,6 @@ msgstr "Nie udało się przesłać pliku: {0}"
msgid "Failed to upload image"
msgstr "Nie udało się przesłać plik"
-msgid "Feature"
-msgstr "Funkcja"
-
-msgid "Features"
-msgstr "Cechy"
-
msgid "File size exceeds 10MB limit"
msgstr "Rozmiar pliku przekracza limit 10 MB"
@@ -645,6 +666,12 @@ msgstr "Popraw podświetlone ilości przed sfinalizowaniem."
msgid "Forgot to Clock Out?"
msgstr "Zapomniano o zakończeniu pracy?"
+msgid "Gauge"
+msgstr "Przyrząd pomiarowy"
+
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Przyrząd pomiarowy dla cechy {characteristicLabel}: {currentGauge}"
+
msgid "General"
msgstr "Ogólne"
@@ -959,6 +986,9 @@ msgstr "Brak zleceń utrzymania ruchu przydzielonych Tobie"
msgid "No files"
msgstr "Brak plików"
+msgid "No gauges found."
+msgstr "Nie znaleziono przyrządów pomiarowych."
+
msgid "No Impact"
msgstr "Brak wpływu"
@@ -1126,6 +1156,9 @@ msgstr "Opcjonalnie"
msgid "or"
msgstr "lub"
+msgid "Out of calibration"
+msgstr "Poza wzorcowaniem"
+
msgid "Output lot"
msgstr "Partia wyrobu"
@@ -1276,6 +1309,9 @@ msgstr "Przyczyna poprawki"
msgid "Recent"
msgstr "Ostatnie"
+msgid "Recently used"
+msgstr "Ostatnio używane"
+
msgid "Record"
msgstr "Rejestruj"
@@ -1407,9 +1443,15 @@ msgstr "Złomowanie wybranego numeru seryjnego"
msgid "Search"
msgstr "Szukaj"
+msgid "Search {gaugeTypeName}..."
+msgstr "Szukaj {gaugeTypeName}..."
+
msgid "Search by job or item ID"
msgstr "Szukaj po ID zadania lub przedmiotu"
+msgid "Search gauges..."
+msgstr "Szukaj przyrządów pomiarowych..."
+
msgid "Search operators..."
msgstr "Szukaj operatorów..."
@@ -1444,6 +1486,9 @@ msgstr "Wybierz pozycję..."
msgid "Select Batch {0}"
msgstr "Wybierz partię {0}"
+msgid "Select gauge"
+msgstr "Wybierz przyrząd pomiarowy"
+
msgid "Select Printer"
msgstr "Wybierz drukarkę"
@@ -1728,6 +1773,9 @@ msgstr "Niewydane materiały seryjne/partyjne"
msgid "Unknown"
msgstr "Nieznane"
+msgid "Unknown gauge"
+msgstr "Nieznany przyrząd pomiarowy"
+
msgid "Unlock"
msgstr "Odblokuj"
diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.po
index c3be0a8ce3..046a62e19b 100644
--- a/packages/locale/locales/pt/erp.po
+++ b/packages/locale/locales/pt/erp.po
@@ -48,6 +48,9 @@ msgstr "\"{taskName}\" está feito — todos os {0} itens do seu Mapa de Setup e
msgid "(excluded for this customer)"
msgstr "(excluído para este cliente)"
+msgid "(Inactive)"
+msgstr "(Inativo)"
+
#. placeholder {0}: target.slackDays
msgid "{0, plural, one {# day of slack} other {# days of slack}}"
msgstr "{0, plural, one {# dia de folga} other {# dias de folga}}"
@@ -1430,6 +1433,9 @@ msgstr "Adicionar Aplicação Autenticadora"
msgid "Add Calibration Record"
msgstr "Adicionar Registro de Calibração"
+msgid "Add Characteristic"
+msgstr "Adicionar Característica"
+
msgid "Add Child Storage Unit"
msgstr "Adicionar Unidade de Armazenamento Filha"
@@ -1460,9 +1466,6 @@ msgstr "Adicionar Funcionário"
msgid "Add Entry"
msgstr "Adicionar Entrada"
-msgid "Add Feature"
-msgstr "Adicionar Recurso"
-
msgid "Add from library…"
msgstr "Adicionar da biblioteca…"
@@ -1749,6 +1752,9 @@ msgstr "Todos os departamentos"
msgid "All Documents"
msgstr "Todos os Documentos"
+msgid "All gauges"
+msgstr "Todos os instrumentos de medição"
+
msgid "All item types"
msgstr "Todos os tipos de item"
@@ -2013,6 +2019,9 @@ msgstr "Outra unidade de armazenamento dentro da qual está aninhada (p. ex. um
msgid "Another system is connected to Ramp as its accounting system"
msgstr "Outro sistema está conectado ao Ramp como seu sistema contábil"
+msgid "Any"
+msgstr "Qualquer"
+
msgid "Any item group"
msgstr "Qualquer grupo de itens"
@@ -2092,8 +2101,8 @@ msgstr "Aplica-se a todos"
msgid "Applies to all work centers"
msgstr "Aplica-se a todos os centros de trabalho"
-msgid "Applies to features without their own rule, and to the lot when this plan drives an inspection."
-msgstr "Aplica-se a recursos sem sua própria regra e ao lote quando este plano conduz a uma inspeção."
+msgid "Applies to characteristics without their own rule, and to the lot when this plan drives an inspection."
+msgstr "Aplica-se às características sem sua própria regra e ao lote quando este plano conduz uma inspeção."
msgid "Apply"
msgstr "Aplicar"
@@ -3720,6 +3729,15 @@ msgstr "Alterar isto atualizará o ID da peça"
msgid "Changing type resets this item's draft edits."
msgstr "Alterar o tipo redefine as edições em rascunho deste item."
+msgid "Characteristic"
+msgstr "Característica"
+
+msgid "Characteristic values suggested from drawing"
+msgstr "Valores de característica sugeridos do desenho"
+
+msgid "Characteristics"
+msgstr "Características"
+
msgid "Charges"
msgstr "Cobranças"
@@ -3820,6 +3838,9 @@ msgstr "Limpar data de vencimento"
msgid "Clear Filters"
msgstr "Limpar Filtros"
+msgid "Clear gauge"
+msgstr "Limpar instrumento de medição"
+
msgid "Clear search"
msgstr "Limpar pesquisa"
@@ -3921,12 +3942,12 @@ msgstr "Recolher {0}"
msgid "Collapse all"
msgstr "Recolher tudo"
+msgid "Collapse characteristics table"
+msgstr "Recolher tabela de características"
+
msgid "Collapse Costs"
msgstr "Recolher Custos"
-msgid "Collapse features table"
-msgstr "Recolher tabela de recursos"
-
msgid "Collapse Labor"
msgstr "Recolher Mão de obra"
@@ -4430,6 +4451,9 @@ msgstr "Link copiado para a área de transferência"
msgid "Copied setup prompt to your clipboard"
msgstr "Prompt de setup copiado para sua área de transferência"
+msgid "Copied!"
+msgstr "Copiado!"
+
msgid "Copies a setup prompt for your AI coding tool"
msgstr "Copia um prompt de setup para sua ferramenta de codificação de IA"
@@ -4445,12 +4469,21 @@ msgstr "Copiar Chave de API"
msgid "Copy batch number"
msgstr "Copiar número do lote de produção"
+msgid "Copy change notice unique identifier"
+msgstr "Copiar identificador único do aviso de alteração"
+
msgid "Copy company unique identifier"
msgstr "Copiar identificador único da empresa"
msgid "Copy consumable number"
msgstr "Copiar número do consumível"
+msgid "Copy consumable unique identifier"
+msgstr "Copiar identificador único do consumível"
+
+msgid "Copy customer unique identifier"
+msgstr "Copiar identificador único do cliente"
+
msgid "Copy dispatch ID"
msgstr "Copiar ID da ordem de manutenção"
@@ -4475,6 +4508,9 @@ msgstr "Copiar identificador único do problema"
msgid "Copy Job number"
msgstr "Copiar número do trabalho"
+msgid "Copy job unique identifier"
+msgstr "Copiar identificador único da ordem de produção"
+
msgid "Copy link"
msgstr "Copiar ligação"
@@ -4553,6 +4589,15 @@ msgstr "Copiar nome do procedimento"
msgid "Copy procedure unique identifier"
msgstr "Copiar identificador único do procedimento"
+msgid "Copy purchase invoice unique identifier"
+msgstr "Copiar identificador único da fatura de compra"
+
+msgid "Copy purchase order unique identifier"
+msgstr "Copiar identificador único do pedido de compra"
+
+msgid "Copy purchase return order unique identifier"
+msgstr "Copiar identificador único do pedido de devolução de compra"
+
msgid "Copy Quality Document"
msgstr "Copiar Documento de Qualidade"
@@ -4562,18 +4607,39 @@ msgstr "Copiar Cotação"
msgid "Copy Quote number"
msgstr "Copiar número da Cotação"
+msgid "Copy quote unique identifier"
+msgstr "Copiar identificador único do orçamento"
+
msgid "Copy return number"
msgstr "Copiar número de devolução"
+msgid "Copy RFQ unique identifier"
+msgstr "Copiar identificador único da RFQ"
+
msgid "Copy RMA number"
msgstr "Copiar número de RMA"
+msgid "Copy sales invoice unique identifier"
+msgstr "Copiar identificador único da fatura de venda"
+
+msgid "Copy sales order unique identifier"
+msgstr "Copiar identificador único do pedido de venda"
+
+msgid "Copy sales return order unique identifier"
+msgstr "Copiar identificador único do pedido de devolução de venda"
+
msgid "Copy service number"
msgstr "Copiar número do serviço"
msgid "Copy service unique identifier"
msgstr "Copiar identificador exclusivo do serviço"
+msgid "Copy supplier quote unique identifier"
+msgstr "Copiar identificador único da cotação do fornecedor"
+
+msgid "Copy supplier unique identifier"
+msgstr "Copiar identificador único do fornecedor"
+
msgid "Copy this item's pricing to another scope."
msgstr "Copiar a precificação deste item para outro escopo."
@@ -4583,6 +4649,9 @@ msgstr "Copie este link para compartilhar a cotação com um cliente"
msgid "Copy this link to share the quote with a supplier"
msgstr "Copie este link para compartilhar a cotação com um fornecedor"
+msgid "Copy to clipboard"
+msgstr "Copiar para a área de transferência"
+
msgid "Copy tool number"
msgstr "Copiar número da ferramenta"
@@ -6119,9 +6188,6 @@ msgstr "Detectado pelo planejador de movimento"
msgid "Developer"
msgstr "Desenvolvedor"
-msgid "Diagram saved"
-msgstr "Diagrama salvo"
-
msgid "Differs from the selection — allowed, but confirm they nest together"
msgstr "Difere da seleção — permitido, mas confirme que se encaixam"
@@ -6400,11 +6466,11 @@ msgstr "Arraste para colocar no desenho"
msgid "Drag to reorder"
msgstr "Arrastar para reordenar"
-msgid "Drag to resize diagram and features"
-msgstr "Arraste para redimensionar diagrama e recursos"
+msgid "Drag to resize diagram and characteristics"
+msgstr "Arrastar para redimensionar diagrama e características"
-msgid "Drag to resize drawing and features"
-msgstr "Arraste para redimensionar desenho e recursos"
+msgid "Drag to resize drawing and characteristics"
+msgstr "Arrastar para redimensionar desenho e características"
msgid "Drag to zoom"
msgstr "Arrastar para ampliar"
@@ -6415,8 +6481,8 @@ msgstr "Sacando"
msgid "Drawing Number"
msgstr "Número do Desenho"
-msgid "Drawing replaced. Balloon placements were removed; feature rows are unchanged."
-msgstr "Desenho substituído. Os posicionamentos de balões foram removidos; as linhas de recursos permanecem inalteradas."
+msgid "Drawing replaced. Balloon placements were removed; characteristic rows are unchanged."
+msgstr "Desenho substituído. Os posicionamentos de balão foram removidos; as linhas de características permanecem inalteradas."
msgid "Drop Ship"
msgstr "Entrega direta"
@@ -7452,12 +7518,12 @@ msgstr "Expandir {0}"
msgid "Expand all"
msgstr "Expandir tudo"
+msgid "Expand characteristics table"
+msgstr "Expandir tabela de características"
+
msgid "Expand Costs"
msgstr "Expandir Custos"
-msgid "Expand features table"
-msgstr "Expandir tabela de recursos"
-
msgid "Expand Labor"
msgstr "Expandir Mão de obra"
@@ -7641,8 +7707,8 @@ msgstr "Reprovado"
msgid "Failed"
msgstr "Falhou"
-msgid "Failed features"
-msgstr "Recursos com falha"
+msgid "Failed characteristics"
+msgstr "Características com falha"
#. placeholder {0}: rows.length
msgid "Failed to add line — {addedCount} of {0} lines were added"
@@ -7893,6 +7959,9 @@ msgstr "Falha ao carregar entidades rastreadas"
msgid "Failed to move account: {0}"
msgstr "Falha ao mover conta: {0}"
+msgid "Failed to record gauge"
+msgstr "Falha ao registrar instrumento de medição"
+
msgid "Failed to regenerate schedule"
msgstr "Falha ao regenerar programação"
@@ -7926,8 +7995,8 @@ msgstr "Falha ao recuperar dados de coluna CSV."
msgid "Failed to save configuration rule"
msgstr "Falha ao salvar regra de configuração"
-msgid "Failed to save diagram"
-msgstr "Falha ao salvar diagrama"
+msgid "Failed to save inspection plan"
+msgstr "Falha ao salvar plano de inspeção"
msgid "Failed to save measurement"
msgstr "Falha ao salvar medição"
@@ -8028,15 +8097,6 @@ msgstr "Fax"
msgid "Fax Number"
msgstr "Número de Fax"
-msgid "Feature"
-msgstr "Recurso"
-
-msgid "Feature values suggested from drawing"
-msgstr "Valores de recurso sugeridos do desenho"
-
-msgid "Features"
-msgstr "Recursos"
-
msgid "Fees"
msgstr "Taxas"
@@ -8342,6 +8402,9 @@ msgstr "Instrumento de medição"
msgid "Gauge Calibration Notifications"
msgstr "Notificações de calibração de instrumento de medição"
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Instrumento de medição para característica {characteristicLabel}: {currentGauge}"
+
msgid "Gauge ID"
msgstr "ID do instrumento de medição"
@@ -11678,6 +11741,9 @@ msgstr "Nenhuma previsão disponível para este trabalho."
msgid "No Gauge Selected"
msgstr "Nenhum instrumento de medição selecionado"
+msgid "No gauges found."
+msgstr "Nenhum instrumento de medição encontrado."
+
msgid "No grouped notifications"
msgstr "Sem notificações agrupadas"
@@ -12748,6 +12814,9 @@ msgstr "Caso contrário"
msgid "Out"
msgstr "Fora"
+msgid "Out of calibration"
+msgstr "Fora de calibração"
+
msgid "Outbound"
msgstr "Expedição"
@@ -14424,6 +14493,9 @@ msgstr "Pagamentos recentes"
msgid "Recently Created"
msgstr "Criado Recentemente"
+msgid "Recently used"
+msgstr "Usado recentemente"
+
msgid "Recertify Every (Days)"
msgstr "Recertificar a Cada (Dias)"
@@ -14801,8 +14873,8 @@ msgstr "Substitua os dados desta empresa por um conjunto de dados de demonstraç
msgid "Replacement Order"
msgstr "Pedido de Substituição"
-msgid "Replacing the PDF removes all balloon placements on this document. Feature rows and their values stay; you can place balloons again on the new drawing."
-msgstr "Substituir o PDF remove todos os posicionamentos de balões neste documento. As linhas de recursos e seus valores permanecem; você pode colocar balões novamente no novo desenho."
+msgid "Replacing the PDF removes all balloon placements on this document. Characteristic rows and their values stay; you can place balloons again on the new drawing."
+msgstr "Substituir o PDF remove todos os posicionamentos de balão neste documento. As linhas de características e seus valores permanecem; você pode colocar balões novamente no novo desenho."
msgid "Replenishment"
msgstr "Reabastecimento"
@@ -15550,8 +15622,8 @@ msgstr "Tamanho da Amostra"
msgid "Sampling"
msgstr "Amostragem"
-msgid "Sampling — Feature {featureLabel}"
-msgstr "Amostragem — Recurso {featureLabel}"
+msgid "Sampling — Characteristic {featureLabel}"
+msgstr "Amostragem — Característica {featureLabel}"
msgid "Sampling Standard"
msgstr "Padrão de Amostragem"
@@ -15752,6 +15824,9 @@ msgstr "Sucatada"
msgid "Search"
msgstr "Pesquisar"
+msgid "Search {gaugeTypeName}..."
+msgstr "Pesquisar {gaugeTypeName}..."
+
msgid "Search accounts"
msgstr "Pesquisar contas"
@@ -15797,6 +15872,9 @@ msgstr "Pesquisar campos..."
msgid "Search for existing or create a new one"
msgstr "Pesquisar um existente ou criar um novo"
+msgid "Search gauges..."
+msgstr "Pesquisar instrumentos de medição..."
+
msgid "Search items or bins"
msgstr "Pesquisar itens ou compartimentos"
@@ -15993,6 +16071,9 @@ msgstr "Selecionar Tipo de Funcionário"
msgid "Select field"
msgstr "Selecionar campo"
+msgid "Select gauge"
+msgstr "Selecionar instrumento de medição"
+
msgid "Select Gauge"
msgstr "Selecione o instrumento de medição"
@@ -18113,8 +18194,8 @@ msgstr "O lote será marcado como Aprovado. {fails} falha(s) amostrada(s) são r
msgid "The lot will still be rejected, but an NCR cannot be created until at least one Issue Type is configured."
msgstr "O lote ainda será rejeitado, mas um NCR não pode ser criado até que pelo menos um Tipo de Problema seja configurado."
-msgid "The lot's per-feature sampling plan will be re-resolved from the selected document."
-msgstr "O plano de amostragem por recurso do lote será resolvido novamente a partir do documento selecionado."
+msgid "The lot's per-characteristic sampling plan will be re-resolved from the selected document."
+msgstr "O plano de amostragem por característica do lote será recalculado a partir do documento selecionado."
msgid "The lowest amount this supplier will charge for this process, regardless of quantity; jobs below the breakeven volume still cost at least this much."
msgstr "O menor valor que este fornecedor cobrará por este processo, independentemente da quantidade; ordens de produção abaixo do volume de equilíbrio ainda custarão no mínimo este valor."
@@ -19479,6 +19560,9 @@ msgstr "Desconhecido"
msgid "unknown error"
msgstr "erro desconhecido"
+msgid "Unknown gauge"
+msgstr "Instrumento de medição desconhecido"
+
msgid "unknown location"
msgstr "localização desconhecida"
@@ -20051,6 +20135,9 @@ msgstr "Ver Observações"
msgid "View on schedule board"
msgstr "Ver no quadro de programação"
+msgid "View only — changes are not saved"
+msgstr "Apenas visualização — as alterações não são salvas"
+
msgid "View Open"
msgstr "Ver Abertos"
@@ -20968,6 +21055,9 @@ msgstr "O seu convite é inválido ou já foi aceito. Entre em contato com o sup
msgid "Your job here: check a real sample of each row, then mark it validated. Foundation data loads first, then master records, then open transactions at cutover."
msgstr "Seu trabalho aqui: verifique uma amostra real de cada linha, depois marque como validada. Os dados de fundação são carregados primeiro, depois os registros mestres, depois as transações abertas no cutover."
+msgid "Your latest changes could not be saved. Are you sure you want to leave this page?"
+msgstr "Suas últimas alterações não puderam ser salvas. Tem certeza de que deseja sair desta página?"
+
msgid "Your legal name, addresses, branding, and document defaults"
msgstr "Seu nome legal, endereços, marca e padrões de documentos"
diff --git a/packages/locale/locales/pt/mes.po b/packages/locale/locales/pt/mes.po
index a7c992543f..75be62d787 100644
--- a/packages/locale/locales/pt/mes.po
+++ b/packages/locale/locales/pt/mes.po
@@ -12,6 +12,9 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+msgid "(Inactive)"
+msgstr "(Inativo)"
+
#. placeholder {0}: attribute.name
#. placeholder {1}: activeStep + 1
msgid "{0} - Set {1}"
@@ -148,6 +151,9 @@ msgstr "Todos"
msgid "All clear"
msgstr "Tudo limpo"
+msgid "All gauges"
+msgstr "Todos os instrumentos de medição"
+
msgid "All jobs"
msgstr "Todas as ordens de produção"
@@ -268,6 +274,12 @@ msgstr "Logo Carbon"
msgid "Cards"
msgstr "Cartões"
+msgid "Characteristic"
+msgstr "Característica"
+
+msgid "Characteristics"
+msgstr "Características"
+
msgid "Chat"
msgstr "Chat"
@@ -283,6 +295,9 @@ msgstr "Limpar"
msgid "Clear Filters"
msgstr "Limpar Filtros"
+msgid "Clear gauge"
+msgstr "Limpar instrumento de medição"
+
msgid "Clear Search"
msgstr "Limpar Pesquisa"
@@ -301,8 +316,8 @@ msgstr "Registrado desde <0/>"
msgid "Close"
msgstr "Fechar"
-msgid "Collapse features table"
-msgstr "Recolher tabela de recursos"
+msgid "Collapse characteristics table"
+msgstr "Recolher tabela de características"
msgid "Collapse panel"
msgstr "Recolher painel"
@@ -366,6 +381,15 @@ msgstr "Consumido vencido"
msgid "Continue"
msgstr "Continuar"
+msgid "Copied!"
+msgstr "Copiado!"
+
+msgid "Copy"
+msgstr "Copiar"
+
+msgid "Copy to clipboard"
+msgstr "Copiar para a área de transferência"
+
#. placeholder {0}: board.unplannedCost.days
msgid "Cost of unplanned maintenance, last {0} days"
msgstr "Custo de manutenção não planejada, últimos {0} dias"
@@ -463,8 +487,8 @@ msgstr "Rascunho"
msgid "Drag and drop a file here, or click to select a file"
msgstr "Arraste e solte um arquivo aqui ou clique para selecionar um arquivo"
-msgid "Drag to resize drawing and features"
-msgstr "Arraste para redimensionar desenho e recursos"
+msgid "Drag to resize drawing and characteristics"
+msgstr "Arrastar para redimensionar desenho e características"
#. placeholder {0}: active.data.current?.type
msgid "Dragging {0} cancelled."
@@ -541,8 +565,8 @@ msgstr "Cada ordem de produção no lote de produção segue estas etapas. Regis
msgid "Every unit has a verdict: {passes} passed and {fails} failed. The lot closes with each unit routed to its own outcome."
msgstr "Cada unidade tem um veredicto: {passes} aprovada(s) e {fails} reprovada(s). O lote fecha com cada unidade encaminhada para seu próprio resultado."
-msgid "Expand features table"
-msgstr "Expandir tabela de recursos"
+msgid "Expand characteristics table"
+msgstr "Expandir tabela de características"
msgid "Expand panel"
msgstr "Expandir painel"
@@ -563,8 +587,8 @@ msgstr "Expirando primeiro"
msgid "Failed"
msgstr "Falhou"
-msgid "Failed features"
-msgstr "Recursos com falha"
+msgid "Failed characteristics"
+msgstr "Características falhadas"
msgid "Failed to complete inventory adjustment"
msgstr "Falha ao concluir ajuste de estoque"
@@ -581,6 +605,9 @@ msgstr "Falha ao buscar operações ativas"
msgid "Failed to fetch storageUnits"
msgstr "Falha ao buscar unidades de armazenamento"
+msgid "Failed to record gauge"
+msgstr "Falha ao registar instrumento de medição"
+
msgid "Failed to save measurement"
msgstr "Falha ao salvar medição"
@@ -598,12 +625,6 @@ msgstr "Falha ao enviar arquivo: {0}"
msgid "Failed to upload image"
msgstr "Falha ao enviar arquivo de imagem"
-msgid "Feature"
-msgstr "Recurso"
-
-msgid "Features"
-msgstr "Características"
-
msgid "File size exceeds 10MB limit"
msgstr "O tamanho do arquivo excede o limite de 10MB"
@@ -645,6 +666,12 @@ msgstr "Corrija as quantidades realçadas antes de concluir."
msgid "Forgot to Clock Out?"
msgstr "Esqueceu de apontar fim?"
+msgid "Gauge"
+msgstr "Instrumento de medição"
+
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Instrumento de medição para característica {characteristicLabel}: {currentGauge}"
+
msgid "General"
msgstr "Geral"
@@ -959,6 +986,9 @@ msgstr "Nenhuma ordem de manutenção atribuída a você"
msgid "No files"
msgstr "Nenhum arquivo"
+msgid "No gauges found."
+msgstr "Nenhum instrumento de medição encontrado."
+
msgid "No Impact"
msgstr "Sem Impacto"
@@ -1126,6 +1156,9 @@ msgstr "Opcional"
msgid "or"
msgstr "ou"
+msgid "Out of calibration"
+msgstr "Fora de calibração"
+
msgid "Output lot"
msgstr "Lote de saída"
@@ -1276,6 +1309,9 @@ msgstr "Motivo da retrabalhação"
msgid "Recent"
msgstr "Recente"
+msgid "Recently used"
+msgstr "Usado recentemente"
+
msgid "Record"
msgstr "Registrar"
@@ -1407,9 +1443,15 @@ msgstr "Descartando a serial selecionada"
msgid "Search"
msgstr "Pesquisar"
+msgid "Search {gaugeTypeName}..."
+msgstr "Pesquisar {gaugeTypeName}..."
+
msgid "Search by job or item ID"
msgstr "Pesquisar por ID de trabalho ou item"
+msgid "Search gauges..."
+msgstr "Pesquisar instrumentos de medição..."
+
msgid "Search operators..."
msgstr "Pesquisar operadores..."
@@ -1444,6 +1486,9 @@ msgstr "Selecione um item..."
msgid "Select Batch {0}"
msgstr "Selecionar Lote {0}"
+msgid "Select gauge"
+msgstr "Selecionar instrumento de medição"
+
msgid "Select Printer"
msgstr "Selecionar Impressora"
@@ -1728,6 +1773,9 @@ msgstr "Materiais de série/lote não emitidos"
msgid "Unknown"
msgstr "Desconhecido"
+msgid "Unknown gauge"
+msgstr "Instrumento de medição desconhecido"
+
msgid "Unlock"
msgstr "Desbloquear"
diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.po
index 9a3df9e43e..05fb75a70b 100644
--- a/packages/locale/locales/ru/erp.po
+++ b/packages/locale/locales/ru/erp.po
@@ -48,6 +48,9 @@ msgstr "«{taskName}» готово — все {0} позиций графика
msgid "(excluded for this customer)"
msgstr "(исключено для этого покупателя)"
+msgid "(Inactive)"
+msgstr "(Неактивный)"
+
#. placeholder {0}: target.slackDays
msgid "{0, plural, one {# day of slack} other {# days of slack}}"
msgstr "{0, plural, one {# день страхового запаса} few {# дня страхового запаса} many {# дней страхового запаса} other {# дней страхового запаса}}"
@@ -1430,6 +1433,9 @@ msgstr "Добавить приложение-аутентификатор"
msgid "Add Calibration Record"
msgstr "Добавить запись калибровки"
+msgid "Add Characteristic"
+msgstr "Добавить характеристику"
+
msgid "Add Child Storage Unit"
msgstr "Добавить дочернюю единицу хранения"
@@ -1460,9 +1466,6 @@ msgstr "Добавить сотрудника"
msgid "Add Entry"
msgstr "Добавить запись"
-msgid "Add Feature"
-msgstr "Добавить функцию"
-
msgid "Add from library…"
msgstr "Добавить из библиотеки…"
@@ -1749,6 +1752,9 @@ msgstr "Все отделы"
msgid "All Documents"
msgstr "Все документы"
+msgid "All gauges"
+msgstr "Все средства измерения"
+
msgid "All item types"
msgstr "Все типы номенклатуры"
@@ -2013,6 +2019,9 @@ msgstr "Другая единица хранения, в которую влож
msgid "Another system is connected to Ramp as its accounting system"
msgstr "Другая система подключена к Ramp как система учета"
+msgid "Any"
+msgstr "Любой"
+
msgid "Any item group"
msgstr "Любая группа товаров"
@@ -2092,8 +2101,8 @@ msgstr "Применяется ко всем"
msgid "Applies to all work centers"
msgstr "Применяется ко всем рабочим центрам"
-msgid "Applies to features without their own rule, and to the lot when this plan drives an inspection."
-msgstr "Применяется к функциям без собственного правила и к партии, когда этот план инициирует контроль."
+msgid "Applies to characteristics without their own rule, and to the lot when this plan drives an inspection."
+msgstr "Применяется к характеристикам без собственного правила и к партии, когда этот план контроля проводит контроль."
msgid "Apply"
msgstr "Применить"
@@ -3720,6 +3729,15 @@ msgstr "Изменение этого обновит ID детали"
msgid "Changing type resets this item's draft edits."
msgstr "Изменение типа сбрасывает черновые редактирования этого элемента."
+msgid "Characteristic"
+msgstr "Характеристика"
+
+msgid "Characteristic values suggested from drawing"
+msgstr "Значения характеристик, предложенные из чертежа"
+
+msgid "Characteristics"
+msgstr "Характеристики"
+
msgid "Charges"
msgstr "Списания"
@@ -3820,6 +3838,9 @@ msgstr "Очистить срок выполнения"
msgid "Clear Filters"
msgstr "Очистить фильтры"
+msgid "Clear gauge"
+msgstr "Очистить средство измерения"
+
msgid "Clear search"
msgstr "Очистить поиск"
@@ -3921,12 +3942,12 @@ msgstr "Свернуть {0}"
msgid "Collapse all"
msgstr "Свернуть все"
+msgid "Collapse characteristics table"
+msgstr "Свернуть таблицу характеристик"
+
msgid "Collapse Costs"
msgstr "Свернуть себестоимость"
-msgid "Collapse features table"
-msgstr "Свернуть таблицу функций"
-
msgid "Collapse Labor"
msgstr "Свернуть Труд"
@@ -4430,6 +4451,9 @@ msgstr "Ссылка скопирована в буфер обмена"
msgid "Copied setup prompt to your clipboard"
msgstr "Приглашение наладки скопировано в буфер обмена"
+msgid "Copied!"
+msgstr "Скопировано!"
+
msgid "Copies a setup prompt for your AI coding tool"
msgstr "Копирует подсказку наладки для вашего инструмента кодирования AI"
@@ -4445,12 +4469,21 @@ msgstr "Скопировать API-ключ"
msgid "Copy batch number"
msgstr "Копировать номер серии"
+msgid "Copy change notice unique identifier"
+msgstr "Скопировать уникальный идентификатор извещения об изменении"
+
msgid "Copy company unique identifier"
msgstr "Скопировать уникальный идентификатор организации"
msgid "Copy consumable number"
msgstr "Скопировать номер расходного материала"
+msgid "Copy consumable unique identifier"
+msgstr "Скопировать уникальный идентификатор расходного материала"
+
+msgid "Copy customer unique identifier"
+msgstr "Скопировать уникальный идентификатор покупателя"
+
msgid "Copy dispatch ID"
msgstr "Скопировать ID заявки на техобслуживание"
@@ -4475,6 +4508,9 @@ msgstr "Скопировать уникальный идентификатор
msgid "Copy Job number"
msgstr "Скопировать номер задания"
+msgid "Copy job unique identifier"
+msgstr "Скопировать уникальный идентификатор производственного заказа"
+
msgid "Copy link"
msgstr "Копировать ссылку"
@@ -4553,6 +4589,15 @@ msgstr "Копировать имя процедуры"
msgid "Copy procedure unique identifier"
msgstr "Скопировать уникальный идентификатор процедуры"
+msgid "Copy purchase invoice unique identifier"
+msgstr "Скопировать уникальный идентификатор счета-фактуры полученного"
+
+msgid "Copy purchase order unique identifier"
+msgstr "Скопировать уникальный идентификатор заказа поставщику"
+
+msgid "Copy purchase return order unique identifier"
+msgstr "Скопировать уникальный идентификатор возврата по заказу поставщику"
+
msgid "Copy Quality Document"
msgstr "Копировать документ качества"
@@ -4562,18 +4607,39 @@ msgstr "Копировать предложение"
msgid "Copy Quote number"
msgstr "Копировать номер предложения"
+msgid "Copy quote unique identifier"
+msgstr "Скопировать уникальный идентификатор коммерческого предложения"
+
msgid "Copy return number"
msgstr "Скопировать номер возврата"
+msgid "Copy RFQ unique identifier"
+msgstr "Скопировать уникальный идентификатор запроса цен"
+
msgid "Copy RMA number"
msgstr "Скопировать номер RMA"
+msgid "Copy sales invoice unique identifier"
+msgstr "Скопировать уникальный идентификатор счета-фактуры выданного"
+
+msgid "Copy sales order unique identifier"
+msgstr "Скопировать уникальный идентификатор заказа покупателя"
+
+msgid "Copy sales return order unique identifier"
+msgstr "Скопировать уникальный идентификатор возврата по заказу покупателя"
+
msgid "Copy service number"
msgstr "Копировать номер услуги"
msgid "Copy service unique identifier"
msgstr "Копировать уникальный идентификатор услуги"
+msgid "Copy supplier quote unique identifier"
+msgstr "Скопировать уникальный идентификатор предложения поставщика"
+
+msgid "Copy supplier unique identifier"
+msgstr "Скопировать уникальный идентификатор поставщика"
+
msgid "Copy this item's pricing to another scope."
msgstr "Скопировать ценообразование этой номенклатуры в другую область."
@@ -4583,6 +4649,9 @@ msgstr "Скопировать эту ссылку, чтобы поделить
msgid "Copy this link to share the quote with a supplier"
msgstr "Скопируйте эту ссылку, чтобы поделиться предложением с поставщиком"
+msgid "Copy to clipboard"
+msgstr "Копировать в буфер обмена"
+
msgid "Copy tool number"
msgstr "Скопировать номер инструмента"
@@ -6119,9 +6188,6 @@ msgstr "Обнаружено планировщиком движения"
msgid "Developer"
msgstr "Разработчик"
-msgid "Diagram saved"
-msgstr "Диаграмма сохранена"
-
msgid "Differs from the selection — allowed, but confirm they nest together"
msgstr "Отличается от выбора — допустимо, но убедитесь в их совместимости"
@@ -6400,11 +6466,11 @@ msgstr "Перетащите, чтобы разместить на чертеж
msgid "Drag to reorder"
msgstr "Перетащите для переупорядочивания"
-msgid "Drag to resize diagram and features"
-msgstr "Перетащите, чтобы изменить размер диаграммы и функций"
+msgid "Drag to resize diagram and characteristics"
+msgstr "Перетащить для изменения размера диаграммы и характеристик"
-msgid "Drag to resize drawing and features"
-msgstr "Перетащите, чтобы изменить размер рисунка и функций"
+msgid "Drag to resize drawing and characteristics"
+msgstr "Перетащить для изменения размера чертежа и характеристик"
msgid "Drag to zoom"
msgstr "Перетащите для масштабирования"
@@ -6415,8 +6481,8 @@ msgstr "Снятие"
msgid "Drawing Number"
msgstr "Номер чертежа"
-msgid "Drawing replaced. Balloon placements were removed; feature rows are unchanged."
-msgstr "Рисунок заменён. Размещение выносок удалено; строки функций не изменены."
+msgid "Drawing replaced. Balloon placements were removed; characteristic rows are unchanged."
+msgstr "Чертеж заменен. Размещения выносок были удалены; строки характеристик остались без изменений."
msgid "Drop Ship"
msgstr "Дропшиппинг"
@@ -7452,12 +7518,12 @@ msgstr "Развернуть {0}"
msgid "Expand all"
msgstr "Развернуть все"
+msgid "Expand characteristics table"
+msgstr "Развернуть таблицу характеристик"
+
msgid "Expand Costs"
msgstr "Развернуть Себестоимость"
-msgid "Expand features table"
-msgstr "Развернуть таблицу функций"
-
msgid "Expand Labor"
msgstr "Развернуть Труд"
@@ -7641,8 +7707,8 @@ msgstr "Не годен"
msgid "Failed"
msgstr "Неудачно"
-msgid "Failed features"
-msgstr "Отказавшие элементы"
+msgid "Failed characteristics"
+msgstr "Неудачные характеристики"
#. placeholder {0}: rows.length
msgid "Failed to add line — {addedCount} of {0} lines were added"
@@ -7893,6 +7959,9 @@ msgstr "Не удалось загрузить отслеживаемые сущ
msgid "Failed to move account: {0}"
msgstr "Не удалось переместить счет: {0}"
+msgid "Failed to record gauge"
+msgstr "Не удалось записать средство измерения"
+
msgid "Failed to regenerate schedule"
msgstr "Ошибка при пересчете графика"
@@ -7926,8 +7995,8 @@ msgstr "Не удалось получить данные столбцов CSV."
msgid "Failed to save configuration rule"
msgstr "Ошибка при сохранении правила конфигурации"
-msgid "Failed to save diagram"
-msgstr "Не удалось сохранить диаграмму"
+msgid "Failed to save inspection plan"
+msgstr "Не удалось сохранить план контроля"
msgid "Failed to save measurement"
msgstr "Не удалось сохранить измерение"
@@ -8028,15 +8097,6 @@ msgstr "Факс"
msgid "Fax Number"
msgstr "Номер факса"
-msgid "Feature"
-msgstr "Функция"
-
-msgid "Feature values suggested from drawing"
-msgstr "Значения функции предложены на основе чертежа"
-
-msgid "Features"
-msgstr "Функции"
-
msgid "Fees"
msgstr "Сборы"
@@ -8342,6 +8402,9 @@ msgstr "Средство измерения"
msgid "Gauge Calibration Notifications"
msgstr "Уведомления о калибровке средств измерения"
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Средство измерения для характеристики {characteristicLabel}: {currentGauge}"
+
msgid "Gauge ID"
msgstr "ID средства измерения"
@@ -11678,6 +11741,9 @@ msgstr "Прогноз недоступен для этой работы."
msgid "No Gauge Selected"
msgstr "Средство измерения не выбрано"
+msgid "No gauges found."
+msgstr "Средства измерения не найдены."
+
msgid "No grouped notifications"
msgstr "Нет сгруппированных уведомлений"
@@ -12748,6 +12814,9 @@ msgstr "В противном случае"
msgid "Out"
msgstr "Вне"
+msgid "Out of calibration"
+msgstr "Вне калибровки"
+
msgid "Outbound"
msgstr "Исходящие"
@@ -14424,6 +14493,9 @@ msgstr "Недавние платежи"
msgid "Recently Created"
msgstr "Недавно созданные"
+msgid "Recently used"
+msgstr "Недавно используемые"
+
msgid "Recertify Every (Days)"
msgstr "Пересертификация каждые (дни)"
@@ -14801,8 +14873,8 @@ msgstr "Заменить данные этой организации демон
msgid "Replacement Order"
msgstr "Заказ на замену"
-msgid "Replacing the PDF removes all balloon placements on this document. Feature rows and their values stay; you can place balloons again on the new drawing."
-msgstr "Замена PDF удаляет все размещения выносок на этом документе. Строки элементов и их значения остаются; вы можете разместить выноски снова на новом чертеже."
+msgid "Replacing the PDF removes all balloon placements on this document. Characteristic rows and their values stay; you can place balloons again on the new drawing."
+msgstr "Замена PDF удаляет все размещения выносок на этом документе. Строки характеристик и их значения остаются; вы можете разместить выноски снова на новом чертеже."
msgid "Replenishment"
msgstr "Пополнение"
@@ -15550,8 +15622,8 @@ msgstr "Объем выборки"
msgid "Sampling"
msgstr "Выборочный контроль"
-msgid "Sampling — Feature {featureLabel}"
-msgstr "Выборочный контроль — функция {featureLabel}"
+msgid "Sampling — Characteristic {featureLabel}"
+msgstr "Выборочный контроль — Характеристика {featureLabel}"
msgid "Sampling Standard"
msgstr "Стандарт выборочного контроля"
@@ -15752,6 +15824,9 @@ msgstr "Списано"
msgid "Search"
msgstr "Поиск"
+msgid "Search {gaugeTypeName}..."
+msgstr "Поиск {gaugeTypeName}..."
+
msgid "Search accounts"
msgstr "Поиск счетов"
@@ -15797,6 +15872,9 @@ msgstr "Поиск полей..."
msgid "Search for existing or create a new one"
msgstr "Поиск существующей или создание новой"
+msgid "Search gauges..."
+msgstr "Поиск средств измерения..."
+
msgid "Search items or bins"
msgstr "Поиск номенклатуры или ячеек"
@@ -15993,6 +16071,9 @@ msgstr "Выберите тип сотрудника"
msgid "Select field"
msgstr "Выберите поле"
+msgid "Select gauge"
+msgstr "Выберите средство измерения"
+
msgid "Select Gauge"
msgstr "Выбрать средство измерения"
@@ -18113,8 +18194,8 @@ msgstr "Партия будет отмечена как пройдено. Заф
msgid "The lot will still be rejected, but an NCR cannot be created until at least one Issue Type is configured."
msgstr "Партия все еще будет отклонена, но NCR не может быть создана до тех пор, пока не будет настроен хотя бы один тип проблемы."
-msgid "The lot's per-feature sampling plan will be re-resolved from the selected document."
-msgstr "План выборочного контроля партии по каждому признаку будет переопределен из выбранного документа."
+msgid "The lot's per-characteristic sampling plan will be re-resolved from the selected document."
+msgstr "План выборочного контроля для каждой характеристики партии будет переопределен на основе выбранного документа."
msgid "The lowest amount this supplier will charge for this process, regardless of quantity; jobs below the breakeven volume still cost at least this much."
msgstr "Минимальная сумма, которую этот поставщик будет взимать за этот процесс, независимо от количества; производственные заказы ниже объема безубыточности все равно стоят как минимум столько."
@@ -19479,6 +19560,9 @@ msgstr "Неизвестно"
msgid "unknown error"
msgstr "неизвестная ошибка"
+msgid "Unknown gauge"
+msgstr "Неизвестное средство измерения"
+
msgid "unknown location"
msgstr "неизвестное местоположение"
@@ -20051,6 +20135,9 @@ msgstr "Просмотр Примечаний"
msgid "View on schedule board"
msgstr "Открыть на доске расписания"
+msgid "View only — changes are not saved"
+msgstr "Только просмотр — изменения не сохраняются"
+
msgid "View Open"
msgstr "Просмотреть открытые"
@@ -20968,6 +21055,9 @@ msgstr "Ваше приглашение недействительно или у
msgid "Your job here: check a real sample of each row, then mark it validated. Foundation data loads first, then master records, then open transactions at cutover."
msgstr "Ваша задача здесь: проверьте реальный образец каждой строки, затем отметьте её как проверенную. Данные фундамента загружаются первыми, затем основные записи, затем открытые транзакции при переходе."
+msgid "Your latest changes could not be saved. Are you sure you want to leave this page?"
+msgstr "Ваши последние изменения не были сохранены. Вы уверены, что хотите покинуть эту страницу?"
+
msgid "Your legal name, addresses, branding, and document defaults"
msgstr "Ваше юридическое имя, адреса, брендинг и стандартные параметры документов"
diff --git a/packages/locale/locales/ru/mes.po b/packages/locale/locales/ru/mes.po
index aa7b6b669d..06648a91cf 100644
--- a/packages/locale/locales/ru/mes.po
+++ b/packages/locale/locales/ru/mes.po
@@ -12,6 +12,9 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+msgid "(Inactive)"
+msgstr "(Неактивный)"
+
#. placeholder {0}: attribute.name
#. placeholder {1}: activeStep + 1
msgid "{0} - Set {1}"
@@ -148,6 +151,9 @@ msgstr "Все"
msgid "All clear"
msgstr "Все в порядке"
+msgid "All gauges"
+msgstr "Все средства измерения"
+
msgid "All jobs"
msgstr "Все производственные заказы"
@@ -268,6 +274,12 @@ msgstr "Логотип Carbon"
msgid "Cards"
msgstr "Карточки"
+msgid "Characteristic"
+msgstr "Характеристика"
+
+msgid "Characteristics"
+msgstr "Характеристики"
+
msgid "Chat"
msgstr "Чат"
@@ -283,6 +295,9 @@ msgstr "Очистить"
msgid "Clear Filters"
msgstr "Очистить фильтры"
+msgid "Clear gauge"
+msgstr "Очистить средство измерения"
+
msgid "Clear Search"
msgstr "Очистить поиск"
@@ -301,8 +316,8 @@ msgstr "Отметился в системе с <0/>"
msgid "Close"
msgstr "Закрыть"
-msgid "Collapse features table"
-msgstr "Свернуть таблицу функций"
+msgid "Collapse characteristics table"
+msgstr "Свернуть таблицу характеристик"
msgid "Collapse panel"
msgstr "Свернуть панель"
@@ -366,6 +381,15 @@ msgstr "Израсходовано - истек срок"
msgid "Continue"
msgstr "Продолжить"
+msgid "Copied!"
+msgstr "Скопировано!"
+
+msgid "Copy"
+msgstr "Копировать"
+
+msgid "Copy to clipboard"
+msgstr "Копировать в буфер обмена"
+
#. placeholder {0}: board.unplannedCost.days
msgid "Cost of unplanned maintenance, last {0} days"
msgstr "Себестоимость внепланового техобслуживания за последние {0} дней"
@@ -463,8 +487,8 @@ msgstr "Черновик"
msgid "Drag and drop a file here, or click to select a file"
msgstr "Перетащите файл сюда или нажмите для выбора файла"
-msgid "Drag to resize drawing and features"
-msgstr "Перетащите, чтобы изменить размер чертежа и функций"
+msgid "Drag to resize drawing and characteristics"
+msgstr "Перетащите для изменения размера рисунка и характеристик"
#. placeholder {0}: active.data.current?.type
msgid "Dragging {0} cancelled."
@@ -541,8 +565,8 @@ msgstr "Каждый производственный заказ в серии
msgid "Every unit has a verdict: {passes} passed and {fails} failed. The lot closes with each unit routed to its own outcome."
msgstr "Каждая единица имеет результат: {passes} пройдено и {fails} отклонено. Партия закрывается с распределением каждой единицы по её результату."
-msgid "Expand features table"
-msgstr "Развернуть таблицу функций"
+msgid "Expand characteristics table"
+msgstr "Развернуть таблицу характеристик"
msgid "Expand panel"
msgstr "Развернуть панель"
@@ -563,8 +587,8 @@ msgstr "Истекает первым"
msgid "Failed"
msgstr "Не пройдено"
-msgid "Failed features"
-msgstr "Неудачные функции"
+msgid "Failed characteristics"
+msgstr "Не прошедшие проверку характеристики"
msgid "Failed to complete inventory adjustment"
msgstr "Не удалось выполнить корректировку запасов"
@@ -581,6 +605,9 @@ msgstr "Не удалось загрузить активные операции
msgid "Failed to fetch storageUnits"
msgstr "Не удалось получить единицы хранения"
+msgid "Failed to record gauge"
+msgstr "Не удалось записать средство измерения"
+
msgid "Failed to save measurement"
msgstr "Не удалось сохранить измерение"
@@ -598,12 +625,6 @@ msgstr "Не удалось загрузить файл: {0}"
msgid "Failed to upload image"
msgstr "Не удалось загрузить изображение"
-msgid "Feature"
-msgstr "Функция"
-
-msgid "Features"
-msgstr "Характеристики"
-
msgid "File size exceeds 10MB limit"
msgstr "Размер файла превышает ограничение в 10 МБ"
@@ -645,6 +666,12 @@ msgstr "Исправьте выделенные количества перед
msgid "Forgot to Clock Out?"
msgstr "Забыли отметить окончание работы?"
+msgid "Gauge"
+msgstr "Средство измерения"
+
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Средство измерения для характеристики {characteristicLabel}: {currentGauge}"
+
msgid "General"
msgstr "Общие"
@@ -959,6 +986,9 @@ msgstr "Вам не назначены никакие заявки на техо
msgid "No files"
msgstr "Нет файлов"
+msgid "No gauges found."
+msgstr "Средства измерения не найдены."
+
msgid "No Impact"
msgstr "Без влияния"
@@ -1126,6 +1156,9 @@ msgstr "Опционально"
msgid "or"
msgstr "или"
+msgid "Out of calibration"
+msgstr "Вне калибровки"
+
msgid "Output lot"
msgstr "Партия выпуска"
@@ -1276,6 +1309,9 @@ msgstr "Причина доработки"
msgid "Recent"
msgstr "Недавние"
+msgid "Recently used"
+msgstr "Недавно использованные"
+
msgid "Record"
msgstr "Записать"
@@ -1407,9 +1443,15 @@ msgstr "Списание выбранного серийного номера"
msgid "Search"
msgstr "Поиск"
+msgid "Search {gaugeTypeName}..."
+msgstr "Поиск {gaugeTypeName}..."
+
msgid "Search by job or item ID"
msgstr "Поиск по номеру работы или товара"
+msgid "Search gauges..."
+msgstr "Поиск средств измерения..."
+
msgid "Search operators..."
msgstr "Поиск операторов..."
@@ -1444,6 +1486,9 @@ msgstr "Выберите номенклатуру..."
msgid "Select Batch {0}"
msgstr "Выберите партию {0}"
+msgid "Select gauge"
+msgstr "Выбрать средство измерения"
+
msgid "Select Printer"
msgstr "Выберите принтер"
@@ -1728,6 +1773,9 @@ msgstr "Невыданные серийные/партионные матери
msgid "Unknown"
msgstr "Неизвестно"
+msgid "Unknown gauge"
+msgstr "Неизвестное средство измерения"
+
msgid "Unlock"
msgstr "Разблокировать"
diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.po
index 7890502752..f6ccde1078 100644
--- a/packages/locale/locales/tr/erp.po
+++ b/packages/locale/locales/tr/erp.po
@@ -48,6 +48,9 @@ msgstr "\"{taskName}\" bitti — tüm {0} Kurulum Haritası öğesi yapılandır
msgid "(excluded for this customer)"
msgstr "(bu müşteri için hariç tutulmuş)"
+msgid "(Inactive)"
+msgstr "(Pasif)"
+
#. placeholder {0}: target.slackDays
msgid "{0, plural, one {# day of slack} other {# days of slack}}"
msgstr "{0, plural, one {# gün esneklik payı} other {# gün esneklik payı}}"
@@ -1430,6 +1433,9 @@ msgstr "Kimlik Doğrulayıcı Uygulaması Ekle"
msgid "Add Calibration Record"
msgstr "Kalibrasyon Kaydı Ekle"
+msgid "Add Characteristic"
+msgstr "Özellik Ekle"
+
msgid "Add Child Storage Unit"
msgstr "Alt Depolama Birimi Ekle"
@@ -1460,9 +1466,6 @@ msgstr "Çalışan Ekle"
msgid "Add Entry"
msgstr "Giri Ekle"
-msgid "Add Feature"
-msgstr "Özellik Ekle"
-
msgid "Add from library…"
msgstr "Kütüphaneden ekle…"
@@ -1749,6 +1752,9 @@ msgstr "Tüm departmanlar"
msgid "All Documents"
msgstr "Tüm Belgeler"
+msgid "All gauges"
+msgstr "Tüm ölçüm aletleri"
+
msgid "All item types"
msgstr "Tüm Stok kartı türleri"
@@ -2013,6 +2019,9 @@ msgstr "Bu depolama biriminin yerleştirildiği başka bir depolama birimi (örn
msgid "Another system is connected to Ramp as its accounting system"
msgstr "Başka bir sistem Ramp'a muhasebe sistemi olarak bağlı"
+msgid "Any"
+msgstr "Herhangi bir"
+
msgid "Any item group"
msgstr "Herhangi bir ürün grubu"
@@ -2092,8 +2101,8 @@ msgstr "Tümüne uygulanır"
msgid "Applies to all work centers"
msgstr "Tüm iş merkezlerine uygulanır"
-msgid "Applies to features without their own rule, and to the lot when this plan drives an inspection."
-msgstr "Kendi kuralı olmayan özelliklere ve bu plan bir muayene yaptırdığında lota uygulanır."
+msgid "Applies to characteristics without their own rule, and to the lot when this plan drives an inspection."
+msgstr "Kendi kuralı olmayan özelliklere ve bu kontrol planı bir muayene başlattığında lota uygulanır."
msgid "Apply"
msgstr "Uygula"
@@ -3720,6 +3729,15 @@ msgstr "Bunu değiştirmek parça kimliğini güncelleyecektir"
msgid "Changing type resets this item's draft edits."
msgstr "Türü değiştirmek bu öğenin taslak düzenlemelerini sıfırlar."
+msgid "Characteristic"
+msgstr "Özellik"
+
+msgid "Characteristic values suggested from drawing"
+msgstr "Çizimden önerilen özellik değerleri"
+
+msgid "Characteristics"
+msgstr "Özellikler"
+
msgid "Charges"
msgstr "Harcamalar"
@@ -3820,6 +3838,9 @@ msgstr "Son tarihi temizle"
msgid "Clear Filters"
msgstr "Filtreleri Temizle"
+msgid "Clear gauge"
+msgstr "Ölçüm aletini temizle"
+
msgid "Clear search"
msgstr "Aramayı temizle"
@@ -3921,12 +3942,12 @@ msgstr "{0} öğesini daralt"
msgid "Collapse all"
msgstr "Tümünü daralt"
+msgid "Collapse characteristics table"
+msgstr "Özellikler tablosunu daralt"
+
msgid "Collapse Costs"
msgstr "Maliyetleri Daralt"
-msgid "Collapse features table"
-msgstr "Özellikler tablosunu daralt"
-
msgid "Collapse Labor"
msgstr "İşçilik Süresini Daralt"
@@ -4430,6 +4451,9 @@ msgstr "Bağlantı panoya kopyalandı"
msgid "Copied setup prompt to your clipboard"
msgstr "Hazırlık istemi panonuza kopyalandı"
+msgid "Copied!"
+msgstr "Kopyalandı!"
+
msgid "Copies a setup prompt for your AI coding tool"
msgstr "AI kodlama aracınız için hazırlık talimatı kopyalar"
@@ -4445,12 +4469,21 @@ msgstr "API Anahtarını Kopyala"
msgid "Copy batch number"
msgstr "Parti Numarasını Kopyala"
+msgid "Copy change notice unique identifier"
+msgstr "Değişiklik bildirimi benzersiz tanıtıcısını kopyala"
+
msgid "Copy company unique identifier"
msgstr "Şirket benzersiz tanımlayıcısını kopyala"
msgid "Copy consumable number"
msgstr "Sarf malzemesi numarasını kopyala"
+msgid "Copy consumable unique identifier"
+msgstr "Sarf malzemesi benzersiz tanıtıcısını kopyala"
+
+msgid "Copy customer unique identifier"
+msgstr "Müşteri benzersiz tanıtıcısını kopyala"
+
msgid "Copy dispatch ID"
msgstr "Bakım emri ID'sini kopyala"
@@ -4475,6 +4508,9 @@ msgstr "Sorun benzersiz tanımlayıcısını kopyala"
msgid "Copy Job number"
msgstr "İş Numarasını Kopyala"
+msgid "Copy job unique identifier"
+msgstr "İş emri benzersiz tanıtıcısını kopyala"
+
msgid "Copy link"
msgstr "Bağlantıyı kopyala"
@@ -4553,6 +4589,15 @@ msgstr "Prosedür adını kopyala"
msgid "Copy procedure unique identifier"
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 unique identifier"
+msgstr "Satın alma siparişi benzersiz tanıtıcısını kopyala"
+
+msgid "Copy purchase return order unique identifier"
+msgstr "Satın alma iade siparişi benzersiz tanıtıcısını kopyala"
+
msgid "Copy Quality Document"
msgstr "Kalite Belgesini Kopyala"
@@ -4562,18 +4607,39 @@ msgstr "Teklifi Kopyala"
msgid "Copy Quote number"
msgstr "Teklif numarasını kopyala"
+msgid "Copy quote unique identifier"
+msgstr "Teklif benzersiz tanıtıcısını kopyala"
+
msgid "Copy return number"
msgstr "İade numarasını kopyala"
+msgid "Copy RFQ unique identifier"
+msgstr "Teklif talebi benzersiz tanıtıcısını kopyala"
+
msgid "Copy RMA number"
msgstr "RMA numarasını kopyala"
+msgid "Copy sales invoice unique identifier"
+msgstr "Satış faturası benzersiz tanıtıcısını kopyala"
+
+msgid "Copy sales order unique identifier"
+msgstr "Satış siparişi benzersiz tanıtıcısını kopyala"
+
+msgid "Copy sales return order unique identifier"
+msgstr "Satış iade siparişi benzersiz tanıtıcısını kopyala"
+
msgid "Copy service number"
msgstr "Hizmet numarasını kopyala"
msgid "Copy service unique identifier"
msgstr "Hizmet benzersiz tanımlayıcısını kopyala"
+msgid "Copy supplier quote unique identifier"
+msgstr "Tedarikçi teklifi benzersiz tanıtıcısını kopyala"
+
+msgid "Copy supplier unique identifier"
+msgstr "Tedarikçi benzersiz tanıtıcısını kopyala"
+
msgid "Copy this item's pricing to another scope."
msgstr "Bu öğenin fiyatlandırmasını başka bir kapsamdaki konumlandırın."
@@ -4583,6 +4649,9 @@ msgstr "Bu bağlantıyı bir müşteriyle paylaşmak için kopyalayın"
msgid "Copy this link to share the quote with a supplier"
msgstr "Bu teklifi bir tedarikçiyle paylaşmak için bu bağlantıyı kopyalayın"
+msgid "Copy to clipboard"
+msgstr "Panoya kopyala"
+
msgid "Copy tool number"
msgstr "Araç numarasını kopyala"
@@ -6119,9 +6188,6 @@ msgstr "Hareket planlayıcısı tarafından algılandı"
msgid "Developer"
msgstr "Geliştirici"
-msgid "Diagram saved"
-msgstr "Şema kaydedildi"
-
msgid "Differs from the selection — allowed, but confirm they nest together"
msgstr "Seçimden farklı — izin verilir, ancak birlikte iç içe geçtiğini doğrulayın"
@@ -6400,11 +6466,11 @@ msgstr "Çizime yerleştirmek için sürükleyin"
msgid "Drag to reorder"
msgstr "Yeniden sıralamak için sürükleyin"
-msgid "Drag to resize diagram and features"
-msgstr "Şemayı ve özellikleri yeniden boyutlandırmak için sürükleyin"
+msgid "Drag to resize diagram and characteristics"
+msgstr "Diyagramı ve özellikleri yeniden boyutlandırmak için sürükleyin"
-msgid "Drag to resize drawing and features"
-msgstr "Çizim ve özellikleri yeniden boyutlandırmak için sürükleyin"
+msgid "Drag to resize drawing and characteristics"
+msgstr "Çizimi ve özellikleri yeniden boyutlandırmak için sürükleyin"
msgid "Drag to zoom"
msgstr "Yakınlaştırmak için sürükleyin"
@@ -6415,8 +6481,8 @@ msgstr "Çekiliyor"
msgid "Drawing Number"
msgstr "Resim numarası"
-msgid "Drawing replaced. Balloon placements were removed; feature rows are unchanged."
-msgstr "Çizim değiştirildi. Balon yerleşimleri kaldırıldı; özellik satırları değişmedi."
+msgid "Drawing replaced. Balloon placements were removed; characteristic rows are unchanged."
+msgstr "Çizim değiştirildi. Balon yerleştirmeleri kaldırıldı; özellik satırları değişmedi."
msgid "Drop Ship"
msgstr "Direkt Sevkiyat"
@@ -7452,12 +7518,12 @@ msgstr "Genişlet {0}"
msgid "Expand all"
msgstr "Tümünü genişlet"
+msgid "Expand characteristics table"
+msgstr "Özellikler tablosunu genişlet"
+
msgid "Expand Costs"
msgstr "Maliyetleri Genişlet"
-msgid "Expand features table"
-msgstr "Özellikler tablosunu genişlet"
-
msgid "Expand Labor"
msgstr "İşçilik Genişlet"
@@ -7641,7 +7707,7 @@ msgstr "Uygun değil"
msgid "Failed"
msgstr "Başarısız"
-msgid "Failed features"
+msgid "Failed characteristics"
msgstr "Başarısız özellikler"
#. placeholder {0}: rows.length
@@ -7893,6 +7959,9 @@ msgstr "Takip edilen varlıklar yüklenemedi"
msgid "Failed to move account: {0}"
msgstr "Hesap taşınamadı: {0}"
+msgid "Failed to record gauge"
+msgstr "Ölçüm aleti kaydedilemedi"
+
msgid "Failed to regenerate schedule"
msgstr "Çizelge yeniden oluşturulamadı"
@@ -7926,8 +7995,8 @@ msgstr "CSV sütun verileri alınamadı."
msgid "Failed to save configuration rule"
msgstr "Yapılandırma kuralını kaydetme başarısız oldu"
-msgid "Failed to save diagram"
-msgstr "Şemayı kaydetme başarısız oldu"
+msgid "Failed to save inspection plan"
+msgstr "Kontrol planı kaydedilemedi"
msgid "Failed to save measurement"
msgstr "Ölçüm kaydedilemedi"
@@ -8028,15 +8097,6 @@ msgstr "Faks"
msgid "Fax Number"
msgstr "Faks Numarası"
-msgid "Feature"
-msgstr "Özellik"
-
-msgid "Feature values suggested from drawing"
-msgstr "Çizimden önerilen özellik değerleri"
-
-msgid "Features"
-msgstr "Özellikler"
-
msgid "Fees"
msgstr "Ücretler"
@@ -8342,6 +8402,9 @@ msgstr "Ölçüm aleti"
msgid "Gauge Calibration Notifications"
msgstr "Ölçüm Aleti Kalibrasyon Bildirimleri"
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Özellik {characteristicLabel} için ölçüm aleti: {currentGauge}"
+
msgid "Gauge ID"
msgstr "Ölçüm aleti ID"
@@ -11678,6 +11741,9 @@ msgstr "Bu İş emri için Tahmin mevcut değildir."
msgid "No Gauge Selected"
msgstr "Ölçüm aleti seçilmedi"
+msgid "No gauges found."
+msgstr "Ölçüm aleti bulunamadı."
+
msgid "No grouped notifications"
msgstr "Gruplanmış bildirim yok"
@@ -12748,6 +12814,9 @@ msgstr "Aksi takdirde"
msgid "Out"
msgstr "Dışı"
+msgid "Out of calibration"
+msgstr "Kalibrasyon dışı"
+
msgid "Outbound"
msgstr "Giden"
@@ -14424,6 +14493,9 @@ msgstr "Son ödemeler"
msgid "Recently Created"
msgstr "Son Oluşturulanlar"
+msgid "Recently used"
+msgstr "Son kullanılan"
+
msgid "Recertify Every (Days)"
msgstr "Her (Gün) Yeniden Sertifikalandır"
@@ -14801,8 +14873,8 @@ msgstr "Bu şirketin verilerini bir demo veri seti ile değiştirin — önce an
msgid "Replacement Order"
msgstr "Değişim Siparişi"
-msgid "Replacing the PDF removes all balloon placements on this document. Feature rows and their values stay; you can place balloons again on the new drawing."
-msgstr "PDF'i değiştirmek bu belgedeki tüm balon yerleşimlerini kaldırır. Özellik satırları ve değerleri kalır; yeni çizim üzerinde tekrar balon yerleştirebilirsiniz."
+msgid "Replacing the PDF removes all balloon placements on this document. Characteristic rows and their values stay; you can place balloons again on the new drawing."
+msgstr "PDF'yi değiştirmek bu belgede tüm balon yerleştirmelerini kaldırır. Özellik satırları ve değerleri kalır; yeni çizimde tekrar balon yerleştirebilirsiniz."
msgid "Replenishment"
msgstr "Yenileştirme"
@@ -15550,7 +15622,7 @@ msgstr "Örneklem büyüklüğü"
msgid "Sampling"
msgstr "Örnekleme"
-msgid "Sampling — Feature {featureLabel}"
+msgid "Sampling — Characteristic {featureLabel}"
msgstr "Örnekleme — Özellik {featureLabel}"
msgid "Sampling Standard"
@@ -15752,6 +15824,9 @@ msgstr "Çıkartıldı"
msgid "Search"
msgstr "Ara"
+msgid "Search {gaugeTypeName}..."
+msgstr "Ara {gaugeTypeName}..."
+
msgid "Search accounts"
msgstr "Hesapları arayın"
@@ -15797,6 +15872,9 @@ msgstr "Alanları ara..."
msgid "Search for existing or create a new one"
msgstr "Mevcut birini arayın veya yeni bir tane oluşturun"
+msgid "Search gauges..."
+msgstr "Ölçüm aletleri ara..."
+
msgid "Search items or bins"
msgstr "Stok kartlarını veya gözleri ara"
@@ -15993,6 +16071,9 @@ msgstr "Çalışan Türü Seçin"
msgid "Select field"
msgstr "Alan seçin"
+msgid "Select gauge"
+msgstr "Ölçüm aleti seçin"
+
msgid "Select Gauge"
msgstr "Ölçüm Aleti Seç"
@@ -18113,8 +18194,8 @@ msgstr "Lot, Geçti olarak işaretlenecektir. {fails} örneklenen başarısızl
msgid "The lot will still be rejected, but an NCR cannot be created until at least one Issue Type is configured."
msgstr "Lot yine de reddedilecek, ancak en az bir Hata Türü yapılandırılana kadar Bir Uygunluk Raporu (NCR) oluşturulamaz."
-msgid "The lot's per-feature sampling plan will be re-resolved from the selected document."
-msgstr "Lot'un her özellik başına örnekleme planı seçilen belgeden yeniden çözülecektir."
+msgid "The lot's per-characteristic sampling plan will be re-resolved from the selected document."
+msgstr "Lotun her karakteristiği için örnekleme planı seçilen belgeden yeniden belirlenecek."
msgid "The lowest amount this supplier will charge for this process, regardless of quantity; jobs below the breakeven volume still cost at least this much."
msgstr "Bu Tedarikçinin bu Proses için Miktar ne olursa olsun talep edebileceği en düşük tutar; başabaş hacminin altındaki İş emirleri en az bu tutardan maliyetlidir."
@@ -19479,6 +19560,9 @@ msgstr "Bilinmeyen"
msgid "unknown error"
msgstr "bilinmeyen hata"
+msgid "Unknown gauge"
+msgstr "Bilinmeyen ölçüm aleti"
+
msgid "unknown location"
msgstr "bilinmeyen konum"
@@ -20051,6 +20135,9 @@ msgstr "Notları görüntüle"
msgid "View on schedule board"
msgstr "Çizelge panosunda görüntüle"
+msgid "View only — changes are not saved"
+msgstr "Yalnızca görüntüle — değişiklikler kaydedilmez"
+
msgid "View Open"
msgstr "Açık Gör"
@@ -20968,6 +21055,9 @@ msgstr "Davetiyeniz geçersiz veya zaten Kabul edilmiştir. Bu bir hata olduğun
msgid "Your job here: check a real sample of each row, then mark it validated. Foundation data loads first, then master records, then open transactions at cutover."
msgstr "Buradaki işiniz: her satırın gerçek bir örneğini kontrol edin, ardından doğrulanmış olarak işaretleyin. Temel veriler önce yüklenir, ardından ana kayıtlar, ardından kesme noktasında açık işlemler."
+msgid "Your latest changes could not be saved. Are you sure you want to leave this page?"
+msgstr "Son değişiklikleriniz kaydedilemedi. Bu sayfadan çıkmak istediğinizden emin misiniz?"
+
msgid "Your legal name, addresses, branding, and document defaults"
msgstr "Yasal adınız, adresler, marka kimliği ve belge varsayılanları"
diff --git a/packages/locale/locales/tr/mes.po b/packages/locale/locales/tr/mes.po
index e2c4579872..2723527d67 100644
--- a/packages/locale/locales/tr/mes.po
+++ b/packages/locale/locales/tr/mes.po
@@ -12,6 +12,9 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+msgid "(Inactive)"
+msgstr "(Pasif)"
+
#. placeholder {0}: attribute.name
#. placeholder {1}: activeStep + 1
msgid "{0} - Set {1}"
@@ -148,6 +151,9 @@ msgstr "Tümü"
msgid "All clear"
msgstr "Tamamen temiz"
+msgid "All gauges"
+msgstr "Tüm ölçüm aletleri"
+
msgid "All jobs"
msgstr "Tüm iş emirleri"
@@ -268,6 +274,12 @@ msgstr "Carbon Logosu"
msgid "Cards"
msgstr "Kartlar"
+msgid "Characteristic"
+msgstr "Özellik"
+
+msgid "Characteristics"
+msgstr "Özellikler"
+
msgid "Chat"
msgstr "Sohbet"
@@ -283,6 +295,9 @@ msgstr "Temizle"
msgid "Clear Filters"
msgstr "Filtreleri Temizle"
+msgid "Clear gauge"
+msgstr "Ölçüm aletini temizle"
+
msgid "Clear Search"
msgstr "Aramayı Temizle"
@@ -301,7 +316,7 @@ msgstr "<0/>'den beri kaydedilmiş"
msgid "Close"
msgstr "Kapat"
-msgid "Collapse features table"
+msgid "Collapse characteristics table"
msgstr "Özellikler tablosunu daralt"
msgid "Collapse panel"
@@ -366,6 +381,15 @@ msgstr "Tüketildi süresi doldu"
msgid "Continue"
msgstr "Devam Et"
+msgid "Copied!"
+msgstr "Kopyalandı!"
+
+msgid "Copy"
+msgstr "Kopyala"
+
+msgid "Copy to clipboard"
+msgstr "Panoya kopyala"
+
#. placeholder {0}: board.unplannedCost.days
msgid "Cost of unplanned maintenance, last {0} days"
msgstr "Planlanmamış bakım maliyeti, son {0} gün"
@@ -463,8 +487,8 @@ msgstr "Taslak"
msgid "Drag and drop a file here, or click to select a file"
msgstr "Dosyayı buraya sürükleyip bırakın veya bir dosya seçmek için tıklayın"
-msgid "Drag to resize drawing and features"
-msgstr "Çizimi ve özellikleri yeniden boyutlandırmak için sürükleyin"
+msgid "Drag to resize drawing and characteristics"
+msgstr "Çizim ve özellikleri yeniden boyutlandırmak için sürükleyin"
#. placeholder {0}: active.data.current?.type
msgid "Dragging {0} cancelled."
@@ -541,7 +565,7 @@ msgstr "Partideki her iş emri bu adımları takip eder. Tüm bunlar için bir a
msgid "Every unit has a verdict: {passes} passed and {fails} failed. The lot closes with each unit routed to its own outcome."
msgstr "Her birim için bir karar verildi: {passes} geçti ve {fails} başarısız oldu. Lot, her birim kendi sonucuna yönlendirilmek üzere kapanır."
-msgid "Expand features table"
+msgid "Expand characteristics table"
msgstr "Özellikler tablosunu genişlet"
msgid "Expand panel"
@@ -563,7 +587,7 @@ msgstr "İlk süresi dolacak"
msgid "Failed"
msgstr "Başarısız"
-msgid "Failed features"
+msgid "Failed characteristics"
msgstr "Başarısız özellikler"
msgid "Failed to complete inventory adjustment"
@@ -581,6 +605,9 @@ msgstr "Aktif operasyonlar alınamadı"
msgid "Failed to fetch storageUnits"
msgstr "Depolama birimlerini almak başarısız oldu"
+msgid "Failed to record gauge"
+msgstr "Ölçüm aleti kaydedilemedi"
+
msgid "Failed to save measurement"
msgstr "Ölçüm kaydedilemedi"
@@ -598,12 +625,6 @@ msgstr "Dosyayı yüklemede başarısız oldu: {0}"
msgid "Failed to upload image"
msgstr "Görsel yüklenemedi"
-msgid "Feature"
-msgstr "Özellik"
-
-msgid "Features"
-msgstr "Özellikler"
-
msgid "File size exceeds 10MB limit"
msgstr "Dosya boyutu 10MB sınırını aşıyor"
@@ -645,6 +666,12 @@ msgstr "Tamamlamadan önce vurgulanan miktarları düzeltin."
msgid "Forgot to Clock Out?"
msgstr "İş bitişini unutmuş musunuz?"
+msgid "Gauge"
+msgstr "Ölçüm aleti"
+
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "Özellik {characteristicLabel} için ölçüm aleti: {currentGauge}"
+
msgid "General"
msgstr "Genel"
@@ -959,6 +986,9 @@ msgstr "Size atanmış bakım emri yok"
msgid "No files"
msgstr "Dosya yok"
+msgid "No gauges found."
+msgstr "Ölçüm aleti bulunamadı."
+
msgid "No Impact"
msgstr "Etki Yok"
@@ -1126,6 +1156,9 @@ msgstr "İsteğe bağlı"
msgid "or"
msgstr "veya"
+msgid "Out of calibration"
+msgstr "Kalibrasyon dışı"
+
msgid "Output lot"
msgstr "Çıktı Lotu"
@@ -1276,6 +1309,9 @@ msgstr "Yeniden işleme nedeni"
msgid "Recent"
msgstr "Son"
+msgid "Recently used"
+msgstr "Son kullanılanlar"
+
msgid "Record"
msgstr "Kaydet"
@@ -1407,9 +1443,15 @@ msgstr "Seçilen serinin hurdası"
msgid "Search"
msgstr "Ara"
+msgid "Search {gaugeTypeName}..."
+msgstr "Ara {gaugeTypeName}..."
+
msgid "Search by job or item ID"
msgstr "İş veya ürün kimliği ile ara"
+msgid "Search gauges..."
+msgstr "Ölçüm aletlerini ara..."
+
msgid "Search operators..."
msgstr "Operatörleri ara..."
@@ -1444,6 +1486,9 @@ msgstr "Bir ürün seçin..."
msgid "Select Batch {0}"
msgstr "Seçilecek Parti {0}"
+msgid "Select gauge"
+msgstr "Ölçüm aleti seç"
+
msgid "Select Printer"
msgstr "Yazıcı Seç"
@@ -1728,6 +1773,9 @@ msgstr "Yayımlanmamış seri/parti malzemeleri"
msgid "Unknown"
msgstr "Bilinmiyor"
+msgid "Unknown gauge"
+msgstr "Bilinmeyen ölçüm aleti"
+
msgid "Unlock"
msgstr "Kilit aç"
diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.po
index 4fee398f00..bd8ab05cd8 100644
--- a/packages/locale/locales/zh/erp.po
+++ b/packages/locale/locales/zh/erp.po
@@ -48,6 +48,9 @@ msgstr "\"{taskName}\"已完成——其所有{0}个设置映射项都已配置
msgid "(excluded for this customer)"
msgstr "(已为此客户排除)"
+msgid "(Inactive)"
+msgstr "(已停用)"
+
#. placeholder {0}: target.slackDays
msgid "{0, plural, one {# day of slack} other {# days of slack}}"
msgstr "{0, plural, one {# 天的松弛} other {# 天的松弛}}"
@@ -1430,6 +1433,9 @@ msgstr "添加身份验证器应用"
msgid "Add Calibration Record"
msgstr "添加校准记录"
+msgid "Add Characteristic"
+msgstr "添加特性"
+
msgid "Add Child Storage Unit"
msgstr "添加子存储单元"
@@ -1460,9 +1466,6 @@ msgstr "添加员工"
msgid "Add Entry"
msgstr "添加条目"
-msgid "Add Feature"
-msgstr "添加功能"
-
msgid "Add from library…"
msgstr "从库中添加…"
@@ -1749,6 +1752,9 @@ msgstr "所有部门"
msgid "All Documents"
msgstr "所有文档"
+msgid "All gauges"
+msgstr "所有量具"
+
msgid "All item types"
msgstr "所有物料类型"
@@ -2013,6 +2019,9 @@ msgstr "此存储单元嵌套在其中的另一个存储单元(例如,架内
msgid "Another system is connected to Ramp as its accounting system"
msgstr "另一个系统已连接到 Ramp 作为其会计系统"
+msgid "Any"
+msgstr "任何"
+
msgid "Any item group"
msgstr "任何项目组"
@@ -2092,8 +2101,8 @@ msgstr "适用于全部"
msgid "Applies to all work centers"
msgstr "适用于所有工作中心"
-msgid "Applies to features without their own rule, and to the lot when this plan drives an inspection."
-msgstr "适用于没有自己规则的功能,以及当该计划驱动检验时的批次。"
+msgid "Applies to characteristics without their own rule, and to the lot when this plan drives an inspection."
+msgstr "适用于没有自己规则的特性,以及当该计划驱动检验时适用于批次。"
msgid "Apply"
msgstr "应用"
@@ -3720,6 +3729,15 @@ msgstr "更改此项将更新零件ID"
msgid "Changing type resets this item's draft edits."
msgstr "更改类型将重置此项目的草稿编辑。"
+msgid "Characteristic"
+msgstr "特性"
+
+msgid "Characteristic values suggested from drawing"
+msgstr "从图纸建议的特性值"
+
+msgid "Characteristics"
+msgstr "特性"
+
msgid "Charges"
msgstr "卡消费"
@@ -3820,6 +3838,9 @@ msgstr "清除到期日"
msgid "Clear Filters"
msgstr "清除筛选"
+msgid "Clear gauge"
+msgstr "清除量具"
+
msgid "Clear search"
msgstr "清除搜索"
@@ -3921,12 +3942,12 @@ msgstr "折叠 {0}"
msgid "Collapse all"
msgstr "全部折叠"
+msgid "Collapse characteristics table"
+msgstr "折叠特性表"
+
msgid "Collapse Costs"
msgstr "折叠成本"
-msgid "Collapse features table"
-msgstr "折叠功能表"
-
msgid "Collapse Labor"
msgstr "折叠人工"
@@ -4430,6 +4451,9 @@ msgstr "已复制链接到剪贴板"
msgid "Copied setup prompt to your clipboard"
msgstr "已将换型提示复制到剪贴板"
+msgid "Copied!"
+msgstr "已复制!"
+
msgid "Copies a setup prompt for your AI coding tool"
msgstr "复制换型提示给您的AI编码工具"
@@ -4445,12 +4469,21 @@ msgstr "复制API密钥"
msgid "Copy batch number"
msgstr "复制生产批次号"
+msgid "Copy change notice unique identifier"
+msgstr "复制变更通知唯一标识符"
+
msgid "Copy company unique identifier"
msgstr "复制公司唯一标识符"
msgid "Copy consumable number"
msgstr "复制耗材编号"
+msgid "Copy consumable unique identifier"
+msgstr "复制耗材唯一标识符"
+
+msgid "Copy customer unique identifier"
+msgstr "复制客户唯一标识符"
+
msgid "Copy dispatch ID"
msgstr "复制维护工单ID"
@@ -4475,6 +4508,9 @@ msgstr "复制问题唯一标识符"
msgid "Copy Job number"
msgstr "复制工作单号"
+msgid "Copy job unique identifier"
+msgstr "复制工单唯一标识符"
+
msgid "Copy link"
msgstr "复制链接"
@@ -4553,6 +4589,15 @@ msgstr "复制程序文件名"
msgid "Copy procedure unique identifier"
msgstr "复制程序文件唯一标识符"
+msgid "Copy purchase invoice unique identifier"
+msgstr "复制采购发票唯一标识符"
+
+msgid "Copy purchase order unique identifier"
+msgstr "复制采购订单唯一标识符"
+
+msgid "Copy purchase return order unique identifier"
+msgstr "复制采购退货订单唯一标识符"
+
msgid "Copy Quality Document"
msgstr "复制质量文件"
@@ -4562,18 +4607,39 @@ msgstr "复制报价"
msgid "Copy Quote number"
msgstr "复制报价单号"
+msgid "Copy quote unique identifier"
+msgstr "复制报价单唯一标识符"
+
msgid "Copy return number"
msgstr "复制退货编号"
+msgid "Copy RFQ unique identifier"
+msgstr "复制询价单唯一标识符"
+
msgid "Copy RMA number"
msgstr "复制 RMA 编号"
+msgid "Copy sales invoice unique identifier"
+msgstr "复制销售发票唯一标识符"
+
+msgid "Copy sales order unique identifier"
+msgstr "复制销售订单唯一标识符"
+
+msgid "Copy sales return order unique identifier"
+msgstr "复制销售退货订单唯一标识符"
+
msgid "Copy service number"
msgstr "复制服务编号"
msgid "Copy service unique identifier"
msgstr "复制服务唯一标识符"
+msgid "Copy supplier quote unique identifier"
+msgstr "复制供应商报价唯一标识符"
+
+msgid "Copy supplier unique identifier"
+msgstr "复制供应商唯一标识符"
+
msgid "Copy this item's pricing to another scope."
msgstr "将此项目的定价复制到另一个范围。"
@@ -4583,6 +4649,9 @@ msgstr "复制此链接以与客户分享报价"
msgid "Copy this link to share the quote with a supplier"
msgstr "复制此链接以与供应商共享报价"
+msgid "Copy to clipboard"
+msgstr "复制到剪贴板"
+
msgid "Copy tool number"
msgstr "复制工具编号"
@@ -6119,9 +6188,6 @@ msgstr "由运动规划器检测"
msgid "Developer"
msgstr "开发人员"
-msgid "Diagram saved"
-msgstr "图表已保存"
-
msgid "Differs from the selection — allowed, but confirm they nest together"
msgstr "与选择不同 — 允许,但请确认它们能够嵌套在一起"
@@ -6400,11 +6466,11 @@ msgstr "拖动以在图纸上放置"
msgid "Drag to reorder"
msgstr "拖动以重新排序"
-msgid "Drag to resize diagram and features"
-msgstr "拖动以调整图表和功能的大小"
+msgid "Drag to resize diagram and characteristics"
+msgstr "拖动以调整图表和特性大小"
-msgid "Drag to resize drawing and features"
-msgstr "拖动以调整绘图和功能的大小"
+msgid "Drag to resize drawing and characteristics"
+msgstr "拖动以调整绘图和特性大小"
msgid "Drag to zoom"
msgstr "拖动以缩放"
@@ -6415,8 +6481,8 @@ msgstr "提取"
msgid "Drawing Number"
msgstr "图号"
-msgid "Drawing replaced. Balloon placements were removed; feature rows are unchanged."
-msgstr "图纸已替换。气球位置已移除;功能行保持不变。"
+msgid "Drawing replaced. Balloon placements were removed; characteristic rows are unchanged."
+msgstr "绘图已替换。气泡位置已移除;特性行保持不变。"
msgid "Drop Ship"
msgstr "代发货"
@@ -7452,12 +7518,12 @@ msgstr "展开 {0}"
msgid "Expand all"
msgstr "全部展开"
+msgid "Expand characteristics table"
+msgstr "展开特性表"
+
msgid "Expand Costs"
msgstr "展开成本"
-msgid "Expand features table"
-msgstr "展开功能表"
-
msgid "Expand Labor"
msgstr "展开人工"
@@ -7641,8 +7707,8 @@ msgstr "不合格"
msgid "Failed"
msgstr "失败"
-msgid "Failed features"
-msgstr "失效特性"
+msgid "Failed characteristics"
+msgstr "失败的特性"
#. placeholder {0}: rows.length
msgid "Failed to add line — {addedCount} of {0} lines were added"
@@ -7893,6 +7959,9 @@ msgstr "加载跟踪实体失败"
msgid "Failed to move account: {0}"
msgstr "移动账户失败: {0}"
+msgid "Failed to record gauge"
+msgstr "未能记录量具"
+
msgid "Failed to regenerate schedule"
msgstr "排程再生成失败"
@@ -7926,8 +7995,8 @@ msgstr "未能检索 CSV 列数据。"
msgid "Failed to save configuration rule"
msgstr "保存配置规则失败"
-msgid "Failed to save diagram"
-msgstr "保存图表失败"
+msgid "Failed to save inspection plan"
+msgstr "未能保存检验计划"
msgid "Failed to save measurement"
msgstr "保存测量值失败"
@@ -8028,15 +8097,6 @@ msgstr "传真"
msgid "Fax Number"
msgstr "传真号码"
-msgid "Feature"
-msgstr "特征"
-
-msgid "Feature values suggested from drawing"
-msgstr "从绘图中建议的特征值"
-
-msgid "Features"
-msgstr "功能"
-
msgid "Fees"
msgstr "费用"
@@ -8342,6 +8402,9 @@ msgstr "量具"
msgid "Gauge Calibration Notifications"
msgstr "量具校准通知"
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "特性{characteristicLabel}的量具:{currentGauge}"
+
msgid "Gauge ID"
msgstr "量具ID"
@@ -11678,6 +11741,9 @@ msgstr "此任务没有可用预测。"
msgid "No Gauge Selected"
msgstr "未选择量具"
+msgid "No gauges found."
+msgstr "未找到量具。"
+
msgid "No grouped notifications"
msgstr "没有分组通知"
@@ -12748,6 +12814,9 @@ msgstr "否则"
msgid "Out"
msgstr "出"
+msgid "Out of calibration"
+msgstr "校准过期"
+
msgid "Outbound"
msgstr "出库"
@@ -14424,6 +14493,9 @@ msgstr "最近的付款"
msgid "Recently Created"
msgstr "最近创建"
+msgid "Recently used"
+msgstr "最近使用"
+
msgid "Recertify Every (Days)"
msgstr "每(天)重新认证"
@@ -14801,8 +14873,8 @@ msgstr "用演示数据集替换此公司的数据——首先快照,以便您
msgid "Replacement Order"
msgstr "替换订单"
-msgid "Replacing the PDF removes all balloon placements on this document. Feature rows and their values stay; you can place balloons again on the new drawing."
-msgstr "替换 PDF 会移除此文件上的所有气球位置。功能行及其值保持不变;你可以在新绘图上重新放置气球。"
+msgid "Replacing the PDF removes all balloon placements on this document. Characteristic rows and their values stay; you can place balloons again on the new drawing."
+msgstr "替换PDF将移除此文件上的所有气泡位置。特性行及其值保持不变;您可以在新绘图上重新放置气泡。"
msgid "Replenishment"
msgstr "补货"
@@ -15550,8 +15622,8 @@ msgstr "样本量"
msgid "Sampling"
msgstr "抽样"
-msgid "Sampling — Feature {featureLabel}"
-msgstr "抽样 — 功能 {featureLabel}"
+msgid "Sampling — Characteristic {featureLabel}"
+msgstr "抽样 — 特性{featureLabel}"
msgid "Sampling Standard"
msgstr "抽样正常检验"
@@ -15752,6 +15824,9 @@ msgstr "已报废"
msgid "Search"
msgstr "搜索"
+msgid "Search {gaugeTypeName}..."
+msgstr "搜索{gaugeTypeName}..."
+
msgid "Search accounts"
msgstr "搜索账户"
@@ -15797,6 +15872,9 @@ msgstr "搜索字段..."
msgid "Search for existing or create a new one"
msgstr "搜索现有问题或创建新问题"
+msgid "Search gauges..."
+msgstr "搜索量具..."
+
msgid "Search items or bins"
msgstr "搜索物料或料箱"
@@ -15993,6 +16071,9 @@ msgstr "选择员工类型"
msgid "Select field"
msgstr "选择字段"
+msgid "Select gauge"
+msgstr "选择量具"
+
msgid "Select Gauge"
msgstr "选择量具"
@@ -18113,8 +18194,8 @@ msgstr "批次将标记为已通过。{fails} 个抽样失败已记录在案。"
msgid "The lot will still be rejected, but an NCR cannot be created until at least one Issue Type is configured."
msgstr "批次仍将被拒绝,但在配置至少一个问题类型之前无法创建 NCR。"
-msgid "The lot's per-feature sampling plan will be re-resolved from the selected document."
-msgstr "批次的每个特征抽样方案将从选定的文件重新解析。"
+msgid "The lot's per-characteristic sampling plan will be re-resolved from the selected document."
+msgstr "该批次各特征的抽样方案将从所选文件重新确定。"
msgid "The lowest amount this supplier will charge for this process, regardless of quantity; jobs below the breakeven volume still cost at least this much."
msgstr "此供应商对此工艺收费的最低金额,无论数量如何;低于盈亏平衡量的工单仍至少成本此金额。"
@@ -19479,6 +19560,9 @@ msgstr "未知"
msgid "unknown error"
msgstr "未知错误"
+msgid "Unknown gauge"
+msgstr "未知量具"
+
msgid "unknown location"
msgstr "未知位置"
@@ -20051,6 +20135,9 @@ msgstr "查看备注"
msgid "View on schedule board"
msgstr "在排程看板中查看"
+msgid "View only — changes are not saved"
+msgstr "仅查看 — 更改不会被保存"
+
msgid "View Open"
msgstr "查看未结"
@@ -20972,6 +21059,9 @@ msgstr "您的邀请无效或已被接受。如果您认为这是错误,请联
msgid "Your job here: check a real sample of each row, then mark it validated. Foundation data loads first, then master records, then open transactions at cutover."
msgstr "你的工作是:检查每一行的真实样本,然后标记为已验证。基础数据首先加载,然后是主记录,最后是截止时的未结交易。"
+msgid "Your latest changes could not be saved. Are you sure you want to leave this page?"
+msgstr "您的最新更改未能保存。您确定要离开此页面吗?"
+
msgid "Your legal name, addresses, branding, and document defaults"
msgstr "你的法定名称、地址、品牌和文件默认值"
diff --git a/packages/locale/locales/zh/mes.po b/packages/locale/locales/zh/mes.po
index 2507ed7c75..893c8533d4 100644
--- a/packages/locale/locales/zh/mes.po
+++ b/packages/locale/locales/zh/mes.po
@@ -12,6 +12,9 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"
+msgid "(Inactive)"
+msgstr "(已停用)"
+
#. placeholder {0}: attribute.name
#. placeholder {1}: activeStep + 1
msgid "{0} - Set {1}"
@@ -148,6 +151,9 @@ msgstr "全部"
msgid "All clear"
msgstr "一切正常"
+msgid "All gauges"
+msgstr "所有量具"
+
msgid "All jobs"
msgstr "所有工单"
@@ -268,6 +274,12 @@ msgstr "Carbon 标志"
msgid "Cards"
msgstr "卡片"
+msgid "Characteristic"
+msgstr "特性"
+
+msgid "Characteristics"
+msgstr "特性"
+
msgid "Chat"
msgstr "聊天"
@@ -283,6 +295,9 @@ msgstr "清除"
msgid "Clear Filters"
msgstr "清除筛选"
+msgid "Clear gauge"
+msgstr "清除量具"
+
msgid "Clear Search"
msgstr "清除搜索"
@@ -301,8 +316,8 @@ msgstr "自 <0/> 起打卡"
msgid "Close"
msgstr "关闭"
-msgid "Collapse features table"
-msgstr "折叠功能表"
+msgid "Collapse characteristics table"
+msgstr "折叠特性表格"
msgid "Collapse panel"
msgstr "折叠面板"
@@ -366,6 +381,15 @@ msgstr "已消耗已过期"
msgid "Continue"
msgstr "继续"
+msgid "Copied!"
+msgstr "已复制!"
+
+msgid "Copy"
+msgstr "复制"
+
+msgid "Copy to clipboard"
+msgstr "复制到剪贴板"
+
#. placeholder {0}: board.unplannedCost.days
msgid "Cost of unplanned maintenance, last {0} days"
msgstr "过去 {0} 天的计划外维护成本"
@@ -463,8 +487,8 @@ msgstr "草稿"
msgid "Drag and drop a file here, or click to select a file"
msgstr "拖放文件到此处,或点击选择文件"
-msgid "Drag to resize drawing and features"
-msgstr "拖动以调整绘图和功能的大小"
+msgid "Drag to resize drawing and characteristics"
+msgstr "拖动调整图形和特性的大小"
#. placeholder {0}: active.data.current?.type
msgid "Dragging {0} cancelled."
@@ -541,8 +565,8 @@ msgstr "生产批次中的每个工单都遵循这些步骤。同时为所有工
msgid "Every unit has a verdict: {passes} passed and {fails} failed. The lot closes with each unit routed to its own outcome."
msgstr "每件都有一个结果:{passes} 个已通过,{fails} 个不合格。批次随着每件分配到其结果而关闭。"
-msgid "Expand features table"
-msgstr "展开功能表"
+msgid "Expand characteristics table"
+msgstr "展开特性表格"
msgid "Expand panel"
msgstr "展开面板"
@@ -563,8 +587,8 @@ msgstr "即将过期优先"
msgid "Failed"
msgstr "失败"
-msgid "Failed features"
-msgstr "失败的功能"
+msgid "Failed characteristics"
+msgstr "失效特性"
msgid "Failed to complete inventory adjustment"
msgstr "库存调整失败"
@@ -581,6 +605,9 @@ msgstr "获取活跃工序失败"
msgid "Failed to fetch storageUnits"
msgstr "获取存储单位失败"
+msgid "Failed to record gauge"
+msgstr "无法记录量具"
+
msgid "Failed to save measurement"
msgstr "无法保存测量"
@@ -598,12 +625,6 @@ msgstr "文件上传失败:{0}"
msgid "Failed to upload image"
msgstr "图片上传失败"
-msgid "Feature"
-msgstr "功能"
-
-msgid "Features"
-msgstr "特性"
-
msgid "File size exceeds 10MB limit"
msgstr "文件大小超过 10MB 限制"
@@ -645,6 +666,12 @@ msgstr "完成前请修正突出显示的数量。"
msgid "Forgot to Clock Out?"
msgstr "忘记收工了吗?"
+msgid "Gauge"
+msgstr "量具"
+
+msgid "Gauge for characteristic {characteristicLabel}: {currentGauge}"
+msgstr "特性 {characteristicLabel} 对应的量具: {currentGauge}"
+
msgid "General"
msgstr "常规"
@@ -959,6 +986,9 @@ msgstr "没有分配给您的维护工单"
msgid "No files"
msgstr "无文件"
+msgid "No gauges found."
+msgstr "未找到量具。"
+
msgid "No Impact"
msgstr "无影响"
@@ -1126,6 +1156,9 @@ msgstr "可选"
msgid "or"
msgstr "或"
+msgid "Out of calibration"
+msgstr "需要校准"
+
msgid "Output lot"
msgstr "输出批次"
@@ -1276,6 +1309,9 @@ msgstr "返工原因"
msgid "Recent"
msgstr "最近"
+msgid "Recently used"
+msgstr "最近使用"
+
msgid "Record"
msgstr "记录"
@@ -1407,9 +1443,15 @@ msgstr "报废所选序列号"
msgid "Search"
msgstr "搜索"
+msgid "Search {gaugeTypeName}..."
+msgstr "搜索 {gaugeTypeName}..."
+
msgid "Search by job or item ID"
msgstr "按工作或项目ID搜索"
+msgid "Search gauges..."
+msgstr "搜索量具..."
+
msgid "Search operators..."
msgstr "搜索操作员..."
@@ -1444,6 +1486,9 @@ msgstr "选择物料..."
msgid "Select Batch {0}"
msgstr "选择批次 {0}"
+msgid "Select gauge"
+msgstr "选择量具"
+
msgid "Select Printer"
msgstr "选择打印机"
@@ -1728,6 +1773,9 @@ msgstr "未领料的序列号/生产批次物料"
msgid "Unknown"
msgstr "未知"
+msgid "Unknown gauge"
+msgstr "未知量具"
+
msgid "Unlock"
msgstr "解锁"
diff --git a/packages/react/src/Copy.tsx b/packages/react/src/Copy.tsx
index 7994789ccd..16eab04c64 100644
--- a/packages/react/src/Copy.tsx
+++ b/packages/react/src/Copy.tsx
@@ -1,5 +1,7 @@
+import { useLingui } from "@lingui/react/macro";
import { useState } from "react";
import { LuCheck, LuCopy } from "react-icons/lu";
+import type { ButtonProps } from "./Button";
import { IconButton } from "./IconButton";
import { Tooltip, TooltipContent, TooltipTrigger } from "./Tooltip";
import { cn } from "./utils/cn";
@@ -8,23 +10,30 @@ import { copyToClipboard } from "./utils/dom";
const Copy = ({
text,
icon,
+ label,
className,
tooltipClassName,
withTextInTooltip = false,
- size = "sm"
+ size = "sm",
+ variant = "secondary"
}: {
text: string;
icon?: JSX.Element;
+ /** Names what is copied: the tooltip text and the button's aria-label. */
+ label?: string;
className?: string;
tooltipClassName?: string;
withTextInTooltip?: boolean;
size?: "sm" | "md" | "lg";
+ variant?: ButtonProps["variant"];
}) => {
+ const { t } = useLingui();
const [isCopied, setIsCopied] = useState(false);
- const handleCopy = (e: React.MouseEvent<HTMLButtonElement>) => {
+ const handleCopy = async (e: React.MouseEvent<HTMLButtonElement>) => {
e.stopPropagation();
- copyToClipboard(text);
+ // Only confirm a copy that happened.
+ if (!(await copyToClipboard(text))) return;
setIsCopied(true);
setTimeout(() => setIsCopied(false), 1500);
};
@@ -33,9 +42,16 @@ const Copy = ({
<Tooltip>
<TooltipTrigger asChild>
<IconButton
- variant="secondary"
- aria-label="Copy"
- icon={isCopied ? <LuCheck /> : (icon ?? <LuCopy />)}
+ variant={variant}
+ aria-label={label ?? t`Copy`}
+ icon={
+ isCopied ? (
+ // Keep a custom icon's sizing so the button does not resize
+ <LuCheck className={icon?.props?.className} />
+ ) : (
+ (icon ?? <LuCopy />)
+ )
+ }
size={size}
className={cn(
isCopied && "text-emerald-500 hover:text-emerald-500",
@@ -47,10 +63,8 @@ const Copy = ({
<TooltipContent className={tooltipClassName}>
<span>
{isCopied
- ? "Copied!"
- : withTextInTooltip
- ? text
- : "Copy to clipboard"}
+ ? t`Copied!`
+ : (label ?? (withTextInTooltip ? text : t`Copy to clipboard`))}
</span>
</TooltipContent>
</Tooltip>
diff --git a/packages/react/src/Modal.tsx b/packages/react/src/Modal.tsx
index addf55dbbc..5a606e77f5 100644
--- a/packages/react/src/Modal.tsx
+++ b/packages/react/src/Modal.tsx
@@ -124,7 +124,9 @@ ModalHeader.displayName = "ModalHeader";
const ModalBody = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
- "relative w-full min-h-0 overflow-y-auto py-0 px-6 mb-4",
+ // py-1 keeps the 3px focus ring of the first/last field inside the
+ // scroll clip; -mt-1/mb-3 cancel it so the layout is unchanged.
+ "relative w-full min-h-0 overflow-y-auto -mt-1 py-1 px-6 mb-3",
"scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent",
className
)}
diff --git a/packages/react/src/utils/dom.ts b/packages/react/src/utils/dom.ts
index c04c6d0155..79f4e3e66e 100644
--- a/packages/react/src/utils/dom.ts
+++ b/packages/react/src/utils/dom.ts
@@ -11,33 +11,29 @@ export const ariaAttr = (condition: boolean | undefined) =>
condition ? true : undefined;
/**
- * Copy text content (string or Promise<string>) into Clipboard.
- * Safari doesn't support write text into clipboard async, so if you need to load
- * text content async before coping, please use Promise<string> for the 1st arg.
+ * Copy text content (string or Promise<string>) into Clipboard, resolving to
+ * whether it was copied. Safari doesn't support write text into clipboard
+ * async, so if you need to load text content async before coping, please use
+ * Promise<string> for the 1st arg.
*/
export const copyToClipboard = async (
str: string | Promise<string>,
// biome-ignore lint/suspicious/noEmptyBlockStatements: suppressed due to migration
callback = () => {}
-) => {
- const focused = window.document.hasFocus();
- if (focused) {
- if (
- navigator.clipboard &&
- typeof navigator.clipboard.writeText === "function"
- ) {
- const text = await Promise.resolve(str);
- Promise.resolve(window.navigator?.clipboard?.writeText(text)).then(
- callback
- );
-
- return;
- }
-
- Promise.resolve(str)
- .then((text) => window.navigator?.clipboard?.writeText(text))
- .then(callback);
- } else {
+): Promise<boolean> => {
+ if (
+ !window.document.hasFocus() ||
+ typeof navigator.clipboard?.writeText !== "function"
+ ) {
log.warning("Unable to copy to clipboard");
+ return false;
+ }
+ try {
+ await navigator.clipboard.writeText(await Promise.resolve(str));
+ callback();
+ return true;
+ } catch (error) {
+ log.warning("Unable to copy to clipboard", { error });
+ return false;
}
};
diff --git a/packages/utils/src/balloons.test.ts b/packages/utils/src/balloons.test.ts
new file mode 100644
index 0000000000..abf958a6c9
--- /dev/null
+++ b/packages/utils/src/balloons.test.ts
@@ -0,0 +1,25 @@
+import { describe, expect, it } from "vitest";
+import { clippedBalloonToAnchorLine } from "./balloons";
+
+const rect = { x: 100, y: 0, w: 50, h: 20 };
+
+describe("clippedBalloonToAnchorLine", () => {
+ it("runs from just outside the balloon to just short of the anchor", () => {
+ // Balloon centred at (0, 10), radius 10; anchor centre (125, 10). Both
+ // ends keep a 2px gap.
+ expect(clippedBalloonToAnchorLine(0, 10, 10, 125, 10, rect)).toEqual([
+ 12, 10, 98, 10
+ ]);
+ });
+
+ it("stops at the edge the line enters through", () => {
+ // Approaching from straight above, the line ends at the anchor's top edge.
+ const line = clippedBalloonToAnchorLine(125, -100, 10, 125, 10, rect);
+ expect(line).not.toBeNull();
+ expect(line![3]).toBeCloseTo(-2, 5);
+ });
+
+ it("draws nothing when the balloon sits on its anchor", () => {
+ expect(clippedBalloonToAnchorLine(125, 10, 10, 125, 10, rect)).toBeNull();
+ });
+});
diff --git a/packages/utils/src/balloons.ts b/packages/utils/src/balloons.ts
new file mode 100644
index 0000000000..ec74cd3642
--- /dev/null
+++ b/packages/utils/src/balloons.ts
@@ -0,0 +1,82 @@
+// Balloon overlay geometry shared by the inspection plan editor, its PDF
+// export, and the ERP and MES inspection drawing panes, so every view draws a
+// balloon and its leader line in the same place.
+
+/** Callout / anchor stroke (orange border, hollow fill). */
+export const BALLOON_CALLOUT_STROKE = "#f97316";
+
+// A balloon is stored as the top-left corner of a box this size (normalized to
+// the page); the circle sits at the box's center. The plan editor places
+// balloons with the same box, so both views agree on where a circle is.
+export const BALLOON_W_NORM = 0.04;
+export const BALLOON_H_NORM = 0.04;
+
+/** Liang–Barsky: clip segment (x0,y0)→(x1,y1) to axis-aligned rect; returns [0,1] params or null. */
+function liangBarskySegmentRect(
+ x0: number,
+ y0: number,
+ x1: number,
+ y1: number,
+ minX: number,
+ minY: number,
+ maxX: number,
+ maxY: number
+): { u0: number; u1: number } | null {
+ const dx = x1 - x0;
+ const dy = y1 - y0;
+ let u0 = 0;
+ let u1 = 1;
+ const edges: Array<[p: number, q: number]> = [
+ [-dx, x0 - minX],
+ [dx, maxX - x0],
+ [-dy, y0 - minY],
+ [dy, maxY - y0]
+ ];
+ for (const [p, q] of edges) {
+ if (Math.abs(p) < 1e-12) {
+ if (q < 0) return null;
+ } else {
+ const r = q / p;
+ if (p < 0) {
+ u0 = Math.max(u0, r);
+ } else {
+ u1 = Math.min(u1, r);
+ }
+ if (u0 > u1) return null;
+ }
+ }
+ return { u0, u1 };
+}
+
+/**
+ * Visible connector from balloon edge → toward anchor, stopping before the anchor rect interior.
+ * u is linear param from B (0) to A (1); balloon occupies u ∈ [0, r/L).
+ */
+export function clippedBalloonToAnchorLine(
+ bx: number,
+ by: number,
+ radiusPx: number,
+ ax: number,
+ ay: number,
+ rect: { x: number; y: number; w: number; h: number }
+): [number, number, number, number] | null {
+ const L = Math.hypot(ax - bx, ay - by);
+ if (L < 1e-6) return null;
+ const epsU = Math.max(1e-4, 2 / L);
+ const uBalloonExit = Math.min(1 - epsU, radiusPx / L + epsU);
+ const { x, y, w, h } = rect;
+ const hit = liangBarskySegmentRect(bx, by, ax, ay, x, y, x + w, y + h);
+ let uEnd = 1 - epsU;
+ if (hit) {
+ const uEnter = Math.max(0, Math.min(1, hit.u0));
+ if (uEnter > uBalloonExit) {
+ uEnd = Math.min(uEnd, uEnter - epsU);
+ }
+ }
+ if (uEnd <= uBalloonExit + 1e-4) return null;
+ const x0 = bx + (ax - bx) * uBalloonExit;
+ const y0 = by + (ay - by) * uBalloonExit;
+ const x1 = bx + (ax - bx) * uEnd;
+ const y1 = by + (ay - by) * uEnd;
+ return [x0, y0, x1, y1];
+}
diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts
index 436e22b66f..bd98e84d50 100644
--- a/packages/utils/src/index.ts
+++ b/packages/utils/src/index.ts
@@ -5,6 +5,7 @@ export * from "./address";
export * from "./all";
export * from "./arrays";
export * from "./assembly-units";
+export * from "./balloons";
export * from "./bank";
export * from "./batch-compatibility";
export * from "./batch-duration";