|  |  | 
 |  |  |     Box, | 
 |  |  |     Button, | 
 |  |  |     List, | 
 |  |  |     Grid, | 
 |  |  |     ListItem, | 
 |  |  |     Typography, | 
 |  |  |     ListItemAvatar, | 
 |  |  |     ListItemButton, | 
 |  |  |     ListItemText, | 
 |  |  | } from '@mui/material'; | 
 |  |  | import CommentIcon from '@mui/icons-material/Comment'; | 
 |  |  | import CardWithIcon from '../components/CardWithIcon'; | 
 |  |  | import { Link } from 'react-router-dom'; | 
 |  |  | import { | 
 |  |  |     ReferenceField, | 
 |  |  | 
 |  |  |     useTranslate, | 
 |  |  |     useIsDataLoaded, | 
 |  |  | } from 'react-admin'; | 
 |  |  | import CardWithIcon from '../components/CardWithIcon'; | 
 |  |  |  | 
 |  |  | const NbCard = (props) => { | 
 |  |  |     const { list, ...rest } = props; | 
 |  |  |     const { tasks, total, ...rset } = 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={`/task/${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="/task" | 
 |  |  |                 size="small" | 
 |  |  |                 color="primary" | 
 |  |  |         <> | 
 |  |  |             <CardWithIcon | 
 |  |  |                 icon={CommentIcon} | 
 |  |  |                 title={translate('page.dashboard.pending_reviews')} | 
 |  |  |                 subtitle={total} | 
 |  |  |                 {...rset} | 
 |  |  |             > | 
 |  |  |                 <Box p={1} sx={{ color: 'primary.main' }}> | 
 |  |  |                     {translate('pos.dashboard.all_reviews')} | 
 |  |  |                 </Box> | 
 |  |  |             </Button> | 
 |  |  |         </CardWithIcon> | 
 |  |  |                 <List sx={{ display }}> | 
 |  |  |                     {tasks?.map((record) => ( | 
 |  |  |                         <ListItem key={record.id} disablePadding> | 
 |  |  |                             <ListItemButton | 
 |  |  |                                 alignItems="flex-start" | 
 |  |  |                                 component={Link} | 
 |  |  |                                 to={`/task/${record.id}`} | 
 |  |  |                             > | 
 |  |  |                                 <Grid container item md={12}> | 
 |  |  |                                     <Box sx={{ display: 'flex' }}> | 
 |  |  |                                         <Box sx={{ display: 'flex', padding: '1em' }}> | 
 |  |  |                                             <Typography color="textSecondary">{translate("table.field.task.taskCode")}:</Typography> | 
 |  |  |                                             <Typography color="textSecondary">{record?.taskCode}</Typography> | 
 |  |  |                                         </Box> | 
 |  |  |                                     </Box> | 
 |  |  |                                     <Box sx={{ display: 'flex' }}> | 
 |  |  |                                         <Box sx={{ display: 'flex', padding: '1em' }}> | 
 |  |  |                                             <Typography color="textSecondary">{translate("table.field.task.taskType")}:</Typography> | 
 |  |  |                                             <Typography color="textSecondary" maxWidth="200" overflow="hidden">{record?.taskType$}</Typography> | 
 |  |  |                                         </Box> | 
 |  |  |                                     </Box> | 
 |  |  |                                     <Box sx={{ display: 'flex' }}> | 
 |  |  |                                         <Box sx={{ display: 'flex', padding: '1em' }}> | 
 |  |  |                                             <Typography color="textSecondary">{translate("table.field.task.taskStatus")}:</Typography> | 
 |  |  |                                             <Typography color="textSecondary">{record?.taskStatus$}</Typography> | 
 |  |  |                                         </Box> | 
 |  |  |                                     </Box> | 
 |  |  |                                     <Box sx={{ display: 'flex' }}> | 
 |  |  |                                         <Box sx={{ display: 'flex', padding: '1em' }}> | 
 |  |  |                                             <Typography color="textSecondary">{translate("table.field.task.startTime")}:</Typography> | 
 |  |  |                                             <Typography color="textSecondary">{record?.createTime}</Typography> | 
 |  |  |                                         </Box> | 
 |  |  |                                     </Box> | 
 |  |  |                                 </Grid> | 
 |  |  |                             </ListItemButton> | 
 |  |  |                             <Spacer /> | 
 |  |  |                         </ListItem> | 
 |  |  |                     ))} | 
 |  |  |                 </List> | 
 |  |  |                 <Box flexGrow={1}> </Box> | 
 |  |  |                 {/* <Button | 
 |  |  |                     sx={{ borderRadius: 0 }} | 
 |  |  |                     component={Link} | 
 |  |  |                     to="/task" | 
 |  |  |                     size="small" | 
 |  |  |                     color="primary" | 
 |  |  |                 > | 
 |  |  |                     <Box p={1} sx={{ color: 'primary.main' }}> | 
 |  |  |                         {translate('pos.dashboard.all_reviews')} | 
 |  |  |                     </Box> | 
 |  |  |                 </Button> */} | 
 |  |  |             </CardWithIcon> | 
 |  |  |         </> | 
 |  |  |     ); | 
 |  |  | }; | 
 |  |  |  | 
 |  |  | const Spacer = () => <span style={{ width: '1em', }} />; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | export default NbCard; |