all requested changs done
Some checks failed
NPM Installation / build (16.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (16.x, windows-latest) (push) Has been cancelled
NPM Installation / build (17.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (17.x, windows-latest) (push) Has been cancelled
NPM Installation / build (18.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (18.x, windows-latest) (push) Has been cancelled
Some checks failed
NPM Installation / build (16.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (16.x, windows-latest) (push) Has been cancelled
NPM Installation / build (17.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (17.x, windows-latest) (push) Has been cancelled
NPM Installation / build (18.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (18.x, windows-latest) (push) Has been cancelled
This commit is contained in:
parent
983186c56d
commit
279e8842e9
@ -177,7 +177,7 @@ const OrderDetails = () => {
|
|||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={7} />
|
<TableCell colSpan={7} />
|
||||||
<TableCell>
|
<TableCell>
|
||||||
Total GST:<strong> ₹ {gstTotal} </strong>
|
Total GST:<strong> ₹ {gstTotal.toFixed(2)} </strong>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
|
@ -163,7 +163,7 @@ const ReviewOrder = ({
|
|||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={7} />
|
<TableCell colSpan={7} />
|
||||||
<TableCell>
|
<TableCell>
|
||||||
Total GST:<strong> ₹ {totalGST} </strong>
|
Total GST:<strong> ₹ {totalGST.toFixed(2)} </strong>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
|
@ -137,8 +137,8 @@ const ShoppingCart = ({ handleTabChange }) => {
|
|||||||
</Box>
|
</Box>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>₹{row.price}</TableCell>
|
<TableCell>₹{row.price}</TableCell>
|
||||||
<TableCell>₹{gstAmount}</TableCell>
|
<TableCell>₹{gstAmount.toFixed(2)}</TableCell>
|
||||||
<TableCell>₹{row.price * row.count}</TableCell>
|
<TableCell>₹{(row.price * row.count).toFixed(2)}</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
@ -151,7 +151,7 @@ const ShoppingCart = ({ handleTabChange }) => {
|
|||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={5} />
|
<TableCell colSpan={5} />
|
||||||
<TableCell>
|
<TableCell>
|
||||||
Total GST:<strong> ₹ {totalGST} </strong>
|
Total GST:<strong> ₹ {totalGST.toFixed(2)} </strong>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ const InvoiceTable = ({ invoices }) => {
|
|||||||
))}
|
))}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>{invoice.subtotal}</TableCell>
|
<TableCell>{invoice.subtotal}</TableCell>
|
||||||
<TableCell>{invoice.gstTotal}</TableCell>
|
<TableCell>{invoice.gstTotal.toFixed(2)}</TableCell>
|
||||||
<TableCell>{invoice.invoiceAmount}</TableCell>
|
<TableCell>{invoice.invoiceAmount}</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Chip
|
<Chip
|
||||||
|
@ -72,11 +72,11 @@ const OrderDetailsDialog = ({ open, onClose, order, onSubmit }) => {
|
|||||||
<TableRow key={index}>
|
<TableRow key={index}>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<img
|
<img
|
||||||
src={item.productId.image}
|
src={item?.image[0]?.url}
|
||||||
alt={item.productId.name}
|
alt={item.name}
|
||||||
style={{ width: 50, height: 50, marginRight: 10 }}
|
style={{ width: 50, height: 50, marginRight: 10 }}
|
||||||
/>
|
/>
|
||||||
<Typography variant="subtitle1">{item.productId.name}</Typography>
|
<Typography variant="subtitle1">{item.name}</Typography>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell align="right">₹{item.price}</TableCell>
|
<TableCell align="right">₹{item.price}</TableCell>
|
||||||
<TableCell align="right">{item.remainingQuantity}</TableCell>
|
<TableCell align="right">{item.remainingQuantity}</TableCell>
|
||||||
|
@ -304,13 +304,13 @@ const ViewOrders = () => {
|
|||||||
marginRight: 10,
|
marginRight: 10,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Typography variant="subtitle1">{item.productId.name}</Typography>
|
<Typography variant="subtitle1">{item.name} </Typography>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell align="right">₹{item.price}</TableCell>
|
<TableCell align="right">₹{item.price}</TableCell>
|
||||||
<TableCell align="right">{item.quantity}</TableCell>
|
<TableCell align="right">{item.quantity}</TableCell>
|
||||||
<TableCell align="right">₹{subtotal}</TableCell>
|
<TableCell align="right">₹{subtotal}</TableCell>
|
||||||
<TableCell align="right">{item.GST}%</TableCell>
|
<TableCell align="right">{item.GST}%</TableCell>
|
||||||
<TableCell align="right">₹{gstAmount}</TableCell>
|
<TableCell align="right">₹{gstAmount.toFixed(2)}</TableCell>
|
||||||
<TableCell align="right">₹{totalWithGST}</TableCell>
|
<TableCell align="right">₹{totalWithGST}</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
)
|
)
|
||||||
@ -347,7 +347,7 @@ const ViewOrders = () => {
|
|||||||
<Typography>Total Items: {order?.orderItem.length}</Typography>
|
<Typography>Total Items: {order?.orderItem.length}</Typography>
|
||||||
|
|
||||||
<Typography>Total Subtotal: ₹{order?.subtotal}</Typography>
|
<Typography>Total Subtotal: ₹{order?.subtotal}</Typography>
|
||||||
<Typography>Total GST: ₹{order?.gstTotal}</Typography>
|
<Typography>Total GST: ₹{order?.gstTotal.toFixed(2)}</Typography>
|
||||||
<Typography variant="h5" sx={{ marginTop: 2 }}>
|
<Typography variant="h5" sx={{ marginTop: 2 }}>
|
||||||
Grand Total: ₹{order?.grandTotal}
|
Grand Total: ₹{order?.grandTotal}
|
||||||
</Typography>
|
</Typography>
|
||||||
@ -355,7 +355,7 @@ const ViewOrders = () => {
|
|||||||
</Grid>
|
</Grid>
|
||||||
{/* <Grid item sm={6} md={6} xl={6}>
|
{/* <Grid item sm={6} md={6} xl={6}>
|
||||||
<TableContainer
|
<TableContainer
|
||||||
component={Paper}
|
component={Paper}ss
|
||||||
sx={{ maxWidth: 600, margin: "auto", mt: 4 }}
|
sx={{ maxWidth: 600, margin: "auto", mt: 4 }}
|
||||||
>
|
>
|
||||||
<Table
|
<Table
|
||||||
|
@ -13,6 +13,13 @@ import {
|
|||||||
Pagination,
|
Pagination,
|
||||||
Select,
|
Select,
|
||||||
Typography,
|
Typography,
|
||||||
|
Table,
|
||||||
|
TableBody,
|
||||||
|
TableCell,
|
||||||
|
TableContainer,
|
||||||
|
TableHead,
|
||||||
|
TableRow,
|
||||||
|
Paper,
|
||||||
} from '@mui/material'
|
} from '@mui/material'
|
||||||
import ShopCard from './shopCard'
|
import ShopCard from './shopCard'
|
||||||
|
|
||||||
@ -23,7 +30,7 @@ const Shop = () => {
|
|||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
const [currentPage, setCurrentPage] = useState(1)
|
const [currentPage, setCurrentPage] = useState(1)
|
||||||
const [totalData, setTotalData] = useState(0)
|
const [totalData, setTotalData] = useState(0)
|
||||||
const itemsPerPage = 10 // Adjust this according to your requirements
|
const itemsPerPage = 10
|
||||||
|
|
||||||
const nameRef = useRef('')
|
const nameRef = useRef('')
|
||||||
const categoryRef = useRef('')
|
const categoryRef = useRef('')
|
||||||
@ -33,14 +40,14 @@ const Shop = () => {
|
|||||||
const handleChange = (event) => {
|
const handleChange = (event) => {
|
||||||
const selectedValue = event.target.value
|
const selectedValue = event.target.value
|
||||||
setOption(selectedValue)
|
setOption(selectedValue)
|
||||||
categoryRef.current = selectedValue === 'all' ? '' : selectedValue // Set to an empty string if "All" is selected
|
categoryRef.current = selectedValue === 'all' ? '' : selectedValue
|
||||||
setCurrentPage(1) // Reset to first page when filter changes
|
setCurrentPage(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
const getCategories = async () => {
|
const getCategories = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await Axios.get('/api/category/getCategories')
|
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) {
|
} catch (err) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: 'Error',
|
title: 'Error',
|
||||||
@ -60,7 +67,7 @@ const Shop = () => {
|
|||||||
page: currentPage,
|
page: currentPage,
|
||||||
show: itemsPerPage,
|
show: itemsPerPage,
|
||||||
name: nameRef.current || '',
|
name: nameRef.current || '',
|
||||||
category: categoryRef.current || '', // Send category only if it's not empty
|
category: categoryRef.current || '',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
setProducts(response.data?.products || [])
|
setProducts(response.data?.products || [])
|
||||||
@ -80,13 +87,14 @@ const Shop = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getCategories() // Fetch categories on component mount
|
getCategories()
|
||||||
getProductsData()
|
getProductsData()
|
||||||
}, [currentPage, option])
|
}, [currentPage, option])
|
||||||
|
|
||||||
const handlePageChange = (event, value) => {
|
const handlePageChange = (event, value) => {
|
||||||
setCurrentPage(value)
|
setCurrentPage(value)
|
||||||
}
|
}
|
||||||
|
console.log(products)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
@ -114,13 +122,45 @@ const Shop = () => {
|
|||||||
<CircularProgress />
|
<CircularProgress />
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Grid container spacing={2}>
|
<TableContainer component={Paper} sx={{ mt: 3 }}>
|
||||||
{products.map((item, i) => (
|
<Table>
|
||||||
<Grid key={i} item xs={12} sm={6} md={4} lg={4}>
|
<TableHead>
|
||||||
<ShopCard item={item} />
|
<TableRow>
|
||||||
</Grid>
|
<TableCell sx={{ fontWeight: 'bold' }} align="center">
|
||||||
))}
|
Product Name
|
||||||
</Grid>
|
</TableCell>
|
||||||
|
<TableCell sx={{ fontWeight: 'bold' }} align="center">
|
||||||
|
Category
|
||||||
|
</TableCell>
|
||||||
|
<TableCell sx={{ fontWeight: 'bold' }} align="center">
|
||||||
|
Price
|
||||||
|
</TableCell>
|
||||||
|
<TableCell sx={{ fontWeight: 'bold' }} align="center">
|
||||||
|
Action
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableHead>
|
||||||
|
<TableBody>
|
||||||
|
{products?.map((product) => (
|
||||||
|
<TableRow key={product._id}>
|
||||||
|
<TableCell size="small" align="center">
|
||||||
|
{product?.name}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell size="small" align="center">
|
||||||
|
{product.category.categoryName}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell size="small" align="center">
|
||||||
|
₹{product.price}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell size="small" align="center">
|
||||||
|
<ShopCard item={product} />
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
))}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</TableContainer>
|
||||||
|
|
||||||
<Box mt={3} display="flex" justifyContent="center">
|
<Box mt={3} display="flex" justifyContent="center">
|
||||||
<Pagination
|
<Pagination
|
||||||
count={Math.ceil(totalData / itemsPerPage)}
|
count={Math.ceil(totalData / itemsPerPage)}
|
||||||
|
@ -18,27 +18,16 @@ const ShopCard = ({ item }) => {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Card>
|
<Button
|
||||||
<CardMedia component="img" height="150" image={item?.image} alt={item?.name} />
|
variant="contained"
|
||||||
<CardContent>
|
color="primary"
|
||||||
<Typography gutterBottom variant="h5" component="div">
|
// fullWidth
|
||||||
{item?.name}
|
disabled={isProductInCart}
|
||||||
</Typography>
|
onClick={handleAddToCart}
|
||||||
<Typography variant="body2" color="text.secondary">
|
sx={{ marginTop: '10px' }}
|
||||||
${item?.price}
|
>
|
||||||
</Typography>
|
{isProductInCart ? 'Already in Cart' : 'Add to Cart'}
|
||||||
<Button
|
</Button>
|
||||||
variant="contained"
|
|
||||||
color="primary"
|
|
||||||
fullWidth
|
|
||||||
disabled={isProductInCart}
|
|
||||||
onClick={handleAddToCart}
|
|
||||||
sx={{ marginTop: '10px' }}
|
|
||||||
>
|
|
||||||
{isProductInCart ? 'Already in Cart' : 'Add to Cart'}
|
|
||||||
</Button>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user