diff --git a/routes/products.js b/routes/products.js index fd5a6bc89635673ab0d8243b28cc8d05de84ecfd..ff91dd4bf0954cf48df8617da2e00d6bd3cc7b60 100644 --- a/routes/products.js +++ b/routes/products.js @@ -147,7 +147,6 @@ router.put('/:id', isAuthenticated, async (req, res) => { const { name, price, - stock_quantity, minimum_stock, location, category_id @@ -157,7 +156,6 @@ router.put('/:id', isAuthenticated, async (req, res) => { UPDATE products SET name = ?, price = ?, - stock_quantity = ?, minimum_stock = ?, location = ?, category_id = ? @@ -165,7 +163,6 @@ router.put('/:id', isAuthenticated, async (req, res) => { `, [ name, price, - stock_quantity, minimum_stock, location, category_id, diff --git a/views/products.ejs b/views/products.ejs index 73dde27bbe8ea2efc1e9d1b28ee0b15397a3ddc1..bee68673e0d477a05fe824ff55e0a46f5f286f42 100644 --- a/views/products.ejs +++ b/views/products.ejs @@ -125,7 +125,10 @@ <input type="number" id="editPrice" placeholder="ราคา" required> </div> <div class="form-row"> + <input type="number" id="editMinimumStock" placeholder="จำนวนขั้นต่ำ" required> <input type="text" id="editLocation" placeholder="ตำแหน่งจัดเก็บ"> + </div> + <div class="form-row"> <select id="editCategory" required> <option value="">เลือกหมวดหมู่</option> <% categories.forEach(category => { %> @@ -186,7 +189,6 @@ .then(product => { document.getElementById('editName').value = product.name; document.getElementById('editPrice').value = product.price; - document.getElementById('editStockQuantity').value = product.stock_quantity; document.getElementById('editMinimumStock').value = product.minimum_stock; document.getElementById('editLocation').value = product.location || ''; document.getElementById('editCategory').value = product.category_id; @@ -203,7 +205,6 @@ const data = { name: document.getElementById('editName').value, price: document.getElementById('editPrice').value, - stock_quantity: document.getElementById('editStockQuantity').value, minimum_stock: document.getElementById('editMinimumStock').value, location: document.getElementById('editLocation').value, category_id: document.getElementById('editCategory').value