1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
| import * as React from 'react';
| import {
| Avatar,
| Box,
| Button,
| List,
| ListItem,
| ListItemAvatar,
| ListItemButton,
| ListItemText,
| } from '@mui/material';
| import CommentIcon from '@mui/icons-material/Comment';
| import { Link } from 'react-router-dom';
| import {
| ReferenceField,
| FunctionField,
| useGetList,
| useTranslate,
| useIsDataLoaded,
| } from 'react-admin';
| import CardWithIcon from '../components/CardWithIcon';
|
| const NbCard = (props) => {
| const { list, ...rest } = props;
| const translate = useTranslate();
| const {
| data: reviews,
| total,
| isPending,
| } = useGetList('reviews', {
| filter: { status: 'pending' },
| sort: { field: 'date', order: 'DESC' },
| pagination: { page: 1, perPage: 100 },
| });
|
| const display = 'display';
| const newList = list.concat(list);
|
| return (
| <CardWithIcon
| icon={CommentIcon}
| title={translate('pos.dashboard.pending_reviews')}
| subtitle={total}
| {...rest}
| >
| <List sx={{ display }}>
| {newList?.map((record) => (
| <ListItem key={record.id} disablePadding>
| <ListItemButton
| alignItems="flex-start"
| component={Link}
| to={`/reviews/${record.id}`}
| >
| {/* <ListItemAvatar>
| <Avatar
| sx={{
| // bgcolor: 'primary.main',
| bgcolor: '#a2beeaff',
| color: 'primary.contrastText', // 避免白字白底
| // width: 40,
| // height: 40,
| // fontSize: 16,
| }}
| >
| {record.id}
| </Avatar>
| </ListItemAvatar> */}
|
| <ListItemText
| // primary={
| // <StarRatingField
| // record={record}
| // source="rating"
| // />
| // }
| primary={record.date + record.date}
| secondary={record.total}
| sx={{
| overflowY: 'hidden',
| height: '3em',
| display: '-webkit-box',
| WebkitLineClamp: 2,
| WebkitBoxOrient: 'vertical',
| paddingRight: 0,
| }}
| />
| </ListItemButton>
| </ListItem>
| ))}
| </List>
| <Box flexGrow={1}> </Box>
| <Button
| sx={{ borderRadius: 0 }}
| component={Link}
| to="/reviews"
| size="small"
| color="primary"
| >
| <Box p={1} sx={{ color: 'primary.main' }}>
| {translate('pos.dashboard.all_reviews')}
| </Box>
| </Button>
| </CardWithIcon>
| );
| };
|
| export default NbCard;
|
|