diff --git a/src/views/orders/OrderDetails.js b/src/views/orders/OrderDetails.js index df8f462..44ca70d 100644 --- a/src/views/orders/OrderDetails.js +++ b/src/views/orders/OrderDetails.js @@ -177,7 +177,7 @@ const OrderDetails = () => { - Total GST: ₹ {gstTotal} + Total GST: ₹ {gstTotal.toFixed(2)} diff --git a/src/views/pages/cart/reviewOrder.js b/src/views/pages/cart/reviewOrder.js index 8ecc1f0..3d1ef07 100644 --- a/src/views/pages/cart/reviewOrder.js +++ b/src/views/pages/cart/reviewOrder.js @@ -163,7 +163,7 @@ const ReviewOrder = ({ - Total GST: ₹ {totalGST} + Total GST: ₹ {totalGST.toFixed(2)} diff --git a/src/views/pages/cart/shopingCart.js b/src/views/pages/cart/shopingCart.js index 2a96aca..2dfa147 100644 --- a/src/views/pages/cart/shopingCart.js +++ b/src/views/pages/cart/shopingCart.js @@ -137,8 +137,8 @@ const ShoppingCart = ({ handleTabChange }) => { ₹{row.price} - ₹{gstAmount} - ₹{row.price * row.count} + ₹{gstAmount.toFixed(2)} + ₹{(row.price * row.count).toFixed(2)} ) })} @@ -151,7 +151,7 @@ const ShoppingCart = ({ handleTabChange }) => { - Total GST: ₹ {totalGST} + Total GST: ₹ {totalGST.toFixed(2)} diff --git a/src/views/pages/rdOrders/invoiceTable.js b/src/views/pages/rdOrders/invoiceTable.js index edfee1b..6bb39bb 100644 --- a/src/views/pages/rdOrders/invoiceTable.js +++ b/src/views/pages/rdOrders/invoiceTable.js @@ -47,7 +47,7 @@ const InvoiceTable = ({ invoices }) => { ))} {invoice.subtotal} - {invoice.gstTotal} + {invoice.gstTotal.toFixed(2)} {invoice.invoiceAmount} { - {item.productId.name} + {item.name} ₹{item.price} {item.remainingQuantity} diff --git a/src/views/pages/rdOrders/viewOrders.js b/src/views/pages/rdOrders/viewOrders.js index a52a85e..5e1b1c0 100644 --- a/src/views/pages/rdOrders/viewOrders.js +++ b/src/views/pages/rdOrders/viewOrders.js @@ -304,13 +304,13 @@ const ViewOrders = () => { marginRight: 10, }} /> - {item.productId.name} + {item.name} ₹{item.price} {item.quantity} ₹{subtotal} {item.GST}% - ₹{gstAmount} + ₹{gstAmount.toFixed(2)} ₹{totalWithGST} ) @@ -347,7 +347,7 @@ const ViewOrders = () => { Total Items: {order?.orderItem.length} Total Subtotal: ₹{order?.subtotal} - Total GST: ₹{order?.gstTotal} + Total GST: ₹{order?.gstTotal.toFixed(2)} Grand Total: ₹{order?.grandTotal} @@ -355,7 +355,7 @@ const ViewOrders = () => { {/* { const [loading, setLoading] = useState(true) const [currentPage, setCurrentPage] = useState(1) const [totalData, setTotalData] = useState(0) - const itemsPerPage = 10 // Adjust this according to your requirements + const itemsPerPage = 10 const nameRef = useRef('') const categoryRef = useRef('') @@ -33,14 +40,14 @@ const Shop = () => { const handleChange = (event) => { const selectedValue = event.target.value setOption(selectedValue) - categoryRef.current = selectedValue === 'all' ? '' : selectedValue // Set to an empty string if "All" is selected - setCurrentPage(1) // Reset to first page when filter changes + categoryRef.current = selectedValue === 'all' ? '' : selectedValue + setCurrentPage(1) } const getCategories = async () => { try { const response = await Axios.get('/api/category/getCategories') - setCategories(response.data?.categories || []) // Assuming the response has a categories property + setCategories(response.data?.categories || []) } catch (err) { Swal.fire({ title: 'Error', @@ -60,7 +67,7 @@ const Shop = () => { page: currentPage, show: itemsPerPage, name: nameRef.current || '', - category: categoryRef.current || '', // Send category only if it's not empty + category: categoryRef.current || '', }, }) setProducts(response.data?.products || []) @@ -80,13 +87,14 @@ const Shop = () => { } useEffect(() => { - getCategories() // Fetch categories on component mount + getCategories() getProductsData() }, [currentPage, option]) const handlePageChange = (event, value) => { setCurrentPage(value) } + console.log(products) return ( @@ -114,13 +122,45 @@ const Shop = () => { ) : ( <> - - {products.map((item, i) => ( - - - - ))} - + + + + + + Product Name + + + Category + + + Price + + + Action + + + + + {products?.map((product) => ( + + + {product?.name} + + + {product.category.categoryName} + + + ₹{product.price} + + + + + + ))} + + + + { } return ( - - - - - {item?.name} - - - ${item?.price} - - - {isProductInCart ? 'Already in Cart' : 'Add to Cart'} - - - + + {isProductInCart ? 'Already in Cart' : 'Add to Cart'} + ) }