{ if (!open && !busy) onClose(); }}
+ size="md"
+ eyebrow={poNumber}
+ title="Return to collection pool?"
+ description={`Return ${count} collected item${count === 1 ? "" : "s"} for another pickup.`}
+ footer={
+
+
+
+
+ }
+ >
+
+ Collected quantities will be reset to zero and driver assignments and collection dates cleared.
+ These items will be available to assign to a driver again. Photos and order details will be kept.
+
+
+ {rows.map(row => - {row.description || row.po_description || row.sku || row.id}
)}
+
+ Items already invoiced, dispatched or booked into stock cannot be returned here.
+ {error ? {error}
: null}
+
+ );
+}
diff --git a/src/lib/server/collection-return-guard.test.ts b/src/lib/server/collection-return-guard.test.ts
new file mode 100644
index 0000000..ce442c6
--- /dev/null
+++ b/src/lib/server/collection-return-guard.test.ts
@@ -0,0 +1,114 @@
+// Run the real PB hook in a JS sandbox; no live records are changed.
+import { readFileSync } from "node:fs";
+import { runInNewContext } from "node:vm";
+import { describe, expect, it, vi } from "vitest";
+
+function setup(stored: Record