Compare commits

..
Author SHA1 Message Date
shawn 7dac01acb7 fix: restrict order quantity edits to pending orders
Runner Test / test (push) Successful in 36s
Runner Test / test (pull_request) Successful in 15s
2026-09-29 14:07:12 +10:00
2 changed files with 6 additions and 15 deletions
@@ -51,7 +51,11 @@ export function OrderItemsPanel({ order, onUpdateQuantity }: OrderItemsPanelProp
<div className="text-sm text-slate-600">{item.sku}</div>
<div className="text-sm text-slate-500">Available: {item.availableQuantity}</div>
</div>
{order.status === "pending" ? (
<QuantityForm itemId={item.id} quantity={item.quantity} onSave={onUpdateQuantity} />
) : (
<div className="text-sm text-slate-600">Quantity: {item.quantity}</div>
)}
</div>
</div>
))}
+1 -14
View File
@@ -72,19 +72,6 @@ export function OrderPage() {
}
}
async function handleUpdateQuantity(itemId: string, quantity: number) {
if (!order) {
return;
}
if (order.status !== "pending") {
setToast({ message: "Order items cannot be changed for this order status.", variant: "error" });
return;
}
await runAction(() => updateOrderItemQuantity(order.id, itemId, quantity), "Quantity saved.");
}
return (
<div className="space-y-4">
<Link className="inline-flex text-sm font-medium text-blue-600 hover:text-blue-700" to="/orders">
@@ -97,7 +84,7 @@ export function OrderPage() {
<OrderDetailPage
order={order}
auditEvents={auditEvents}
onUpdateQuantity={handleUpdateQuantity}
onUpdateQuantity={(itemId, quantity) => runAction(() => updateOrderItemQuantity(order.id, itemId, quantity), "Quantity saved.")}
onSaveAddress={(address: Address) => runAction(() => updateShippingAddress(order.id, address), "Shipping address saved.")}
onSaveNotes={(notes) => runAction(() => updateOrderNotes(order.id, notes), "Notes saved.")}
onCancel={() => runAction(() => cancelOrder(order.id), "Order cancelled.")}