index.js 1.1 KB

12345678910111213141516171819202122
  1. import { Box, Divider, Paper, Stack, Typography } from "@mui/material";
  2. import { statusNumber } from "../../../helpers";
  3. import { DashboardOrderGood } from "./DashboardOrderGood";
  4. export const DashboardOrder = ({ order }) => {
  5. const { price = null, createdAt, orderGoods = [], status } = order || {};
  6. return (
  7. <Paper className="DashboardOrder">
  8. <Stack direction="vertical" justifyContent="space-between" className="title">
  9. <Typography textAlign="left">Дата: {new Date(+createdAt * 1000).toLocaleDateString()}</Typography>
  10. <Typography textAlign="left">Сума: {price || " - "}</Typography>
  11. <Typography textAlign="left">Статус: {"" + status?.length ? statusNumber[+order.status] : "-"}</Typography>
  12. </Stack>
  13. <Divider sx={{ my: 2 }} />
  14. <Stack spacing={2}>
  15. {(orderGoods || []).map((orderGood) => (
  16. <DashboardOrderGood orderGood={orderGood} key={orderGood._id} />
  17. ))}
  18. </Stack>
  19. </Paper>
  20. );
  21. };