Edit existing products
Adds PATCH /products/:id and an EditProductFlow modal opened from the product drawer. Editable fields cover name, brand, shop, bin, asset tag, price, purchase date, size (weight or count + unit weight), and the cannabinoid profile. SKU, type, kind, and status-derived dates stay locked because changing them would invalidate audit history math; type changes are surfaced as "mark gone, add new" in the modal. The strain row is re-resolved on name or brand change so analytics stay aligned, and the last-audit mirror (last_audit_weight / count_last_audit) only syncs with the original size when there are no audits yet. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ export function ProductDetail({
|
||||
onConsume,
|
||||
onMarkGone,
|
||||
onAudit,
|
||||
onEdit,
|
||||
}: {
|
||||
product: Product;
|
||||
data: Bootstrap;
|
||||
@@ -17,6 +18,7 @@ export function ProductDetail({
|
||||
onConsume: (p: Product) => void;
|
||||
onMarkGone: (p: Product) => void;
|
||||
onAudit: (p: Product) => void;
|
||||
onEdit: (p: Product) => void;
|
||||
}) {
|
||||
const bin = data.bins.find((b) => b.id === product.binId);
|
||||
const cfg = TYPES.find((t) => t.id === product.type);
|
||||
@@ -128,6 +130,9 @@ export function ProductDetail({
|
||||
Mark gone
|
||||
</Btn>
|
||||
)}
|
||||
<Btn variant="ghost" icon="edit" onClick={() => onEdit(product)}>
|
||||
Edit
|
||||
</Btn>
|
||||
<Btn variant="ghost" icon="close" onClick={onClose} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user