{/*
Explicit column widths. `table-fixed` honours these, so a cell
that goes into edit mode can no longer steal width from its
@@ -295,8 +326,6 @@ export function ItemsTable({
- {aiColumn ?
: null}
- {posColumn ?
: null}
@@ -306,8 +335,6 @@ export function ItemsTable({
Coll
Cost
Surplus
- {aiColumn ?
AI
: null}
- {posColumn ?
POS
: null}
@@ -378,6 +405,18 @@ export function ItemsTable({
{row.description ?? row.po_description ?? "—"}
+ {/* AI ticks and POS status sit under the description, not in
+ extra columns: the table shares its pane with the document
+ preview, and trailing columns ended up hidden behind it. */}
+ {(aiColumn && row.ai_check) || (posColumn && typeof row.in_pos === "boolean") ? (
+
- ) : null}
);
})}
diff --git a/src/lib/server/collection-ai-service.test.ts b/src/lib/server/collection-ai-service.test.ts
index 22bda67..3b8726e 100644
--- a/src/lib/server/collection-ai-service.test.ts
+++ b/src/lib/server/collection-ai-service.test.ts
@@ -728,7 +728,7 @@ describe("checkCollectionCard", () => {
expect(r.skus_filled).toBe(1);
});
- it("does not fill a SKU the AI couldn't read with certainty, even on a 'sure' pairing", async () => {
+ it("still fills a SKU the AI wasn't certain it read (the rep edits it if wrong)", async () => {
seedNss();
const { deps } = makeDeps({
readDocument: vi.fn(async () =>
@@ -740,11 +740,9 @@ describe("checkCollectionCard", () => {
const r = await checkCollectionCard(PO_CEM, { deps });
- expect(skuCalls).toEqual([]);
- expect(table("order_items").get("l1")?.sku).toBe("");
- expect(aiCheck("order_items", "l1")?.sku_filled_value).toBe("");
- expect(aiCheck("order_items", "l1")?.doc_line?.code).toBe("0515315");
- expect(r.skus_filled).toBe(0);
+ expect(table("order_items").get("l1")?.sku).toBe("0515315");
+ expect(aiCheck("order_items", "l1")?.sku_filled_value).toBe("0515315");
+ expect(r.skus_filled).toBe(1);
});
it("never changes an existing SKU, even on a 'sure' pairing", async () => {
diff --git a/src/lib/server/collection-ai-service.ts b/src/lib/server/collection-ai-service.ts
index 65aa527..bb73eca 100644
--- a/src/lib/server/collection-ai-service.ts
+++ b/src/lib/server/collection-ai-service.ts
@@ -828,10 +828,9 @@ async function checkCard(
let skuFilled =
previous?.sku_filled_value && str(fresh.sku) === previous.sku_filled_value ? previous.sku_filled_value : "";
const code = chosen.docLine?.code.trim() ?? "";
- // Only a code the AI read character-for-character may become a SKU:
- // a sure pairing with a misread digit would still be a wrong SKU.
- const codeCertain = chosen.docLine?.code_certain === true;
- if (!ownSku && code && codeCertain && code.length <= MAX_SKU_LENGTH && chosen.decision?.same_item === "sure") {
+ // Owner's call (2026-10-17): fill even when a digit may be misread on a
+ // blurry photo; the rep edits it, and a near-miss code still helps.
+ if (!ownSku && code && code.length <= MAX_SKU_LENGTH && chosen.decision?.same_item === "sure") {
// A failed fill must not cost the line its check.
try {
if (line.kind === "customer") {