Commit b8bb5f4c authored by Nawasan Wisitsingkhon's avatar Nawasan Wisitsingkhon

update product display in admin

parent 95bc0080
...@@ -57,65 +57,67 @@ export default function Stock() { ...@@ -57,65 +57,67 @@ export default function Stock() {
เพิ่มสินค้า เพิ่มสินค้า
</Button> </Button>
</Box> </Box>
{productsFilter.map((product, idx) => ( <div className="mx-auto text-left grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 2xl:grid-cols-4 max-w-[1520px]">
<Card {productsFilter.map((product, idx) => (
key={idx} <Card
sx={{ key={idx}
m: 1, sx={{
px: 1, m: 1,
width: 300, px: 1,
height: 500, width: 300,
display: "inline-block", height: 500,
}} display: "inline-block",
> }}
<Box sx={{ px: 1 }}> >
<h5 className="h-[40px] overflow-y-hidden">{product.name}</h5> <Box sx={{ px: 1 }}>
</Box> <h5 className="h-[40px] overflow-y-hidden">{product.name}</h5>
<CardMedia </Box>
className="rounded" <CardMedia
component={"img"} className="rounded"
height={150} component={"img"}
image={product.image.length ? product.image : "/empty.jpg"} height={150}
/> image={product.image.length ? product.image : "/empty.jpg"}
<CardContent sx={{ px: 1 }}> />
<Typography <CardContent sx={{ px: 1 }}>
sx={{ height: 70, overflowY: "scroll" }} <Typography
variant="body2" sx={{ height: 70, overflowY: "scroll" }}
color={"text.secondary"} variant="body2"
> color={"text.secondary"}
{product.detail} >
</Typography> {product.detail}
<Table sx={{ m: 0, p: 0 }}> </Typography>
<TableBody> <Table sx={{ m: 0, p: 0 }}>
<TableRow sx={{ m: 0, p: 0 }}> <TableBody>
<TableCell sx={{ m: 0, p: 0, textAlign: "center " }}> <TableRow sx={{ m: 0, p: 0 }}>
{Number(product.price).toLocaleString() + " บาท"} <TableCell sx={{ m: 0, p: 0, textAlign: "center " }}>
</TableCell> {Number(product.price).toLocaleString() + " บาท"}
<TableCell> {`ส่วนลด ${product.discount}%`}</TableCell> </TableCell>
</TableRow> <TableCell> {`ส่วนลด ${product.discount}%`}</TableCell>
<TableRow> </TableRow>
<TableCell>เข้าชม {product.watch_count} ครั้ง</TableCell> <TableRow>
<TableCell>คงเหลือ {product.stock} ชิ้น</TableCell> <TableCell>เข้าชม {product.watch_count} ครั้ง</TableCell>
</TableRow> <TableCell>คงเหลือ {product.stock} ชิ้น</TableCell>
</TableBody> </TableRow>
</Table> </TableBody>
</CardContent> </Table>
<CardActions disableSpacing sx={{ justifyContent: "end" }}> </CardContent>
<Button <CardActions disableSpacing sx={{ justifyContent: "end" }}>
color="warning" <Button
onClick={() => setUpdateState({ open: true, data: product })} color="warning"
> onClick={() => setUpdateState({ open: true, data: product })}
<Edit /> แก้ไข >
</Button> <Edit /> แก้ไข
<Button </Button>
color="error" <Button
onClick={() => setDeleteState({ open: true, id: product.id })} color="error"
> onClick={() => setDeleteState({ open: true, id: product.id })}
<Delete /> ลบ >
</Button> <Delete /> ลบ
</CardActions> </Button>
</Card> </CardActions>
))} </Card>
))}
</div>
<AddProduct open={modal} handleClose={() => setModal(false)} /> <AddProduct open={modal} handleClose={() => setModal(false)} />
</Box> </Box>
{updateState.open && ( {updateState.open && (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment