You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
setResult(`<p>✅ Order created successfully!</p><pre>${JSON.stringify(response.data,null,2)}</pre>`);
38
-
setItems([{productId: '',quantity: ''}]);// Reset form
53
+
setResult(`<p>✅ Order created successfully!</p><pre style="background: #f8fafc; padding: 1rem; border-radius: 8px; font-size: 0.8rem;">${JSON.stringify(response.data,null,2)}</pre>`);
54
+
setItems([{productId: '',quantity: ''}]);
55
+
clearCart();// Clear cart on success
39
56
}catch(error){
40
57
setResult(`<p style="color: red;">❌ Order creation failed: ${error.response?.data?.message||error.message}</p>`);
41
58
console.error(error);
@@ -46,33 +63,88 @@ function OrderCreate() {
46
63
47
64
return(
48
65
<div>
49
-
<h3>Create Order</h3>
66
+
<h3style={{marginBottom: '1.5rem'}}>Create New Order</h3>
67
+
68
+
{cartItems.length>0&&(
69
+
<divstyle={{
70
+
background: '#eff6ff',
71
+
padding: '1rem',
72
+
borderRadius: '8px',
73
+
marginBottom: '1.5rem',
74
+
border: '1px solid #bfdbfe',
75
+
fontSize: '0.9rem'
76
+
}}>
77
+
🛒 <strong>Cart Sync:</strong>{cartItems.length} items from your cart are ready to be ordered.
0 commit comments