Add ML, fix product stock data
This commit is contained in:
@@ -115,6 +115,15 @@ export default function ProductsPage() {
|
||||
throw new Error("Cannot update product without an ID");
|
||||
}
|
||||
|
||||
// Prepare the product data with stock management fields
|
||||
const productData = {
|
||||
...data,
|
||||
stockTracking: data.stockTracking ?? true,
|
||||
currentStock: data.currentStock ?? 0,
|
||||
lowStockThreshold: data.lowStockThreshold ?? 10,
|
||||
stockStatus: data.stockStatus ?? 'out_of_stock'
|
||||
};
|
||||
|
||||
// Save the product data
|
||||
const endpoint = editing ? `/products/${data._id}` : "/products";
|
||||
const method = editing ? "PUT" : "POST";
|
||||
@@ -124,7 +133,7 @@ export default function ProductsPage() {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
body: JSON.stringify(productData),
|
||||
});
|
||||
|
||||
// If there's a new image to upload
|
||||
|
||||
Reference in New Issue
Block a user