Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
import type { Bootstrap, AuditMode } from "./types.js";
|
||||
|
||||
export type BatchOp =
|
||||
| { action: "update"; id: string; fields: Partial<{ shopId: string | null; binId: string | null; price: number; thc: number; cbd: number; totalCannabinoids: number }> }
|
||||
| { action: "update"; id: string; fields: Partial<{ shopId: string | null; binId: string | null; price: number; thc: number; cbd: number; totalCannabinoids: number; purchaseDate: string }> }
|
||||
| { action: "checkout"; id: string; date: string }
|
||||
| { action: "checkin"; id: string; date: string; binId: string }
|
||||
| { action: "finish"; id: string; date: string; rating?: number; notes?: string }
|
||||
|
||||
@@ -25,6 +25,7 @@ export function BulkEditModal({
|
||||
const [thc, setThc] = useState("");
|
||||
const [cbd, setCbd] = useState("");
|
||||
const [totalCannabinoids, setTotalCannabinoids] = useState("");
|
||||
const [purchaseDate, setPurchaseDate] = useState("");
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const save = useMutation({
|
||||
@@ -36,6 +37,7 @@ export function BulkEditModal({
|
||||
if (thc !== "") fields.thc = parseFloat(thc);
|
||||
if (cbd !== "") fields.cbd = parseFloat(cbd);
|
||||
if (totalCannabinoids !== "") fields.totalCannabinoids = parseFloat(totalCannabinoids);
|
||||
if (purchaseDate) fields.purchaseDate = purchaseDate;
|
||||
|
||||
if (Object.keys(fields).length === 0) {
|
||||
return Promise.reject(new Error("No fields to update — fill in at least one field."));
|
||||
@@ -114,7 +116,7 @@ export function BulkEditModal({
|
||||
<div className="smallcaps" style={{ color: "var(--ink-3)", marginBottom: 16 }}>
|
||||
Values
|
||||
</div>
|
||||
<div style={{ display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 16 }}>
|
||||
<div style={{ display: "grid", gridTemplateColumns: "repeat(5, 1fr)", gap: 16 }}>
|
||||
<Field label="Price ($)">
|
||||
<Input
|
||||
type="number"
|
||||
@@ -125,6 +127,13 @@ export function BulkEditModal({
|
||||
onChange={(e) => setPrice(e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Purchase date">
|
||||
<Input
|
||||
type="date"
|
||||
value={purchaseDate}
|
||||
onChange={(e) => setPurchaseDate(e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="THC %">
|
||||
<Input
|
||||
type="number"
|
||||
|
||||
Reference in New Issue
Block a user