diff --git a/src/views/pages/stock/stockTable.js b/src/views/pages/stock/stockTable.js
index fc63b09..4bcf7cd 100644
--- a/src/views/pages/stock/stockTable.js
+++ b/src/views/pages/stock/stockTable.js
@@ -21,7 +21,7 @@ import Swal from 'sweetalert2'
function StockTable() {
const [stocks, setStocks] = useState([]) // Store stock data
const [loading, setLoading] = useState(true) // Loading state
- const [rowsPerPage, setRowsPerPage] = useState(5)
+ const [rowsPerPage, setRowsPerPage] = useState(10)
const [page, setPage] = useState(0)
const token = isAutheticated()
@@ -46,7 +46,9 @@ function StockTable() {
const handleStockChange = (productId, value) => {
setStocks((prevStocks) =>
prevStocks.map((stock) =>
- stock.productid === productId ? { ...stock, Stock: parseInt(value, 10) || 0 } : stock,
+ stock.productid === productId
+ ? { ...stock, openingInventory: parseInt(value, 10) || 0 }
+ : stock,
),
)
}
@@ -55,7 +57,7 @@ function StockTable() {
// Submit updated stock values
const handleSubmit = async () => {
try {
- await Axios.put(
+ const res = await Axios.put(
'/api/pd/stock-update',
{ products: stocks },
{
@@ -65,6 +67,8 @@ function StockTable() {
},
},
)
+ console.log(res)
+ // setStocks(res.data.stock)
Swal.fire('success!', 'Stock updated successfully', 'success')
} catch (error) {
console.error('Error updating stock:', error)
@@ -95,7 +99,7 @@ function StockTable() {
Product Name
SKU
- Current Stock
+ Opening Inventory
@@ -113,7 +117,7 @@ function StockTable() {
handleStockChange(stock.productid, e.target.value)}
variant="outlined"
size="small"