Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7dac01acb7 |
@@ -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-600">{item.sku}</div>
|
||||||
<div className="text-sm text-slate-500">Available: {item.availableQuantity}</div>
|
<div className="text-sm text-slate-500">Available: {item.availableQuantity}</div>
|
||||||
</div>
|
</div>
|
||||||
|
{order.status === "pending" ? (
|
||||||
<QuantityForm itemId={item.id} quantity={item.quantity} onSave={onUpdateQuantity} />
|
<QuantityForm itemId={item.id} quantity={item.quantity} onSave={onUpdateQuantity} />
|
||||||
|
) : (
|
||||||
|
<div className="text-sm text-slate-600">Quantity: {item.quantity}</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -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 (
|
return (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<Link className="inline-flex text-sm font-medium text-blue-600 hover:text-blue-700" to="/orders">
|
<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
|
<OrderDetailPage
|
||||||
order={order}
|
order={order}
|
||||||
auditEvents={auditEvents}
|
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.")}
|
onSaveAddress={(address: Address) => runAction(() => updateShippingAddress(order.id, address), "Shipping address saved.")}
|
||||||
onSaveNotes={(notes) => runAction(() => updateOrderNotes(order.id, notes), "Notes saved.")}
|
onSaveNotes={(notes) => runAction(() => updateOrderNotes(order.id, notes), "Notes saved.")}
|
||||||
onCancel={() => runAction(() => cancelOrder(order.id), "Order cancelled.")}
|
onCancel={() => runAction(() => cancelOrder(order.id), "Order cancelled.")}
|
||||||
|
|||||||
Reference in New Issue
Block a user