Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit 9346baf9 authored by 65160126's avatar 65160126
Browse files

Update Edit Product

parent 68f2f783
Branches master
No related tags found
No related merge requests found
......@@ -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,
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment