| | |
| | | Form, |
| | | ReferenceField, |
| | | useNotify, |
| | | useResourceContext, |
| | | useTheme, |
| | | useTranslate, |
| | | } from 'react-admin'; |
| | | import { |
| | | Box, |
| | | Button, |
| | | Divider, |
| | | Stack, |
| | | Tooltip, |
| | | Typography, |
| | | Avatar, |
| | | } from '@mui/material'; |
| | | import { format } from 'date-fns'; |
| | | import { format, formatRelative } from 'date-fns'; |
| | | import { blueGrey } from '@mui/material/colors'; |
| | | |
| | | export const Action = ({ data }) => { |
| | | const notify = useNotify(); |
| | | const translate = useTranslate(); |
| | | |
| | | const theme = useTheme(); |
| | | const [isHover, setHover] = useState(false); |
| | | |
| | | return ( |
| | |
| | | <Stack direction="row" spacing={1} alignItems="center" width="100%"> |
| | | <Avatar |
| | | sx={{ |
| | | width: 30, |
| | | height: 30, |
| | | bgcolor: blueGrey[500], |
| | | width: 20, |
| | | height: 20, |
| | | fontSize: '.9rem' |
| | | }} |
| | | > |
| | | {data.priority} |
| | | </Avatar> |
| | | <Typography color="text.secondary" variant="body2"> |
| | | {data.name} |
| | | <Typography color="textPrimary" variant="body2" sx={{ transform: 'scale(1.1)', pl: 1, pr: .1 }}> |
| | | {data.actionType$} |
| | | </Typography> |
| | | <Typography |
| | | variant="body2" |
| | | color="textSecondary" |
| | | > |
| | | ({data.actionSts$ || '-'}) |
| | | </Typography> |
| | | <Box flex={1}></Box> |
| | | <Typography |
| | |
| | | variant="body2" |
| | | component="span" |
| | | > |
| | | {format(data.ioTime, 'yyyy-MM-dd HH:mm:ss') || '-'} |
| | | {/* {formatRelative(new Date(data.ioTime), new Date())} */} |
| | | {/* {format(data.ioTime, 'yyyy-MM-dd HH:mm:ss') || '-'} */} |
| | | No.{data.uuid} |
| | | </Typography> |
| | | </Stack> |
| | | <Stack |
| | | direction="row" |
| | | sx={{ |
| | | paddingTop: '0.5em', |
| | | display: 'flex', |
| | |
| | | }, |
| | | }} |
| | | > |
| | | {/* {note.text |
| | | ?.split('\n') |
| | | .map((paragraph: string, index: number) => ( |
| | | <Typography |
| | | component="p" |
| | | variant="body2" |
| | | lineHeight={1.5} |
| | | margin={0} |
| | | key={index} |
| | | > |
| | | {paragraph} |
| | | </Typography> |
| | | ))} |
| | | |
| | | {note.attachments && <NoteAttachments note={note} />} */} |
| | | <Typography |
| | | variant="body2" |
| | | color="textSecondary" |
| | | > |
| | | {translate('table.field.action.taskId')}: {data.taskId$ || '-'} |
| | | </Typography> |
| | | <Divider orientation="vertical" flexItem sx={{ marginX: 1 }} /> |
| | | <Typography |
| | | variant="body2" |
| | | color="textSecondary" |
| | | > |
| | | {translate('table.field.action.code')}: {data.code || '-'} |
| | | </Typography> |
| | | <Divider orientation="vertical" flexItem sx={{ marginX: 1 }} /> |
| | | <Typography |
| | | variant="body2" |
| | | color="textSecondary" |
| | | > |
| | | {translate('table.field.action.val')}: {data.val || '-'} |
| | | </Typography> |
| | | <Divider orientation="vertical" flexItem sx={{ marginX: 1 }} /> |
| | | <Typography |
| | | variant="body2" |
| | | color="textSecondary" |
| | | > |
| | | {translate('table.field.action.params')}: {data.param || '-'} |
| | | </Typography> |
| | | </Stack> |
| | | </Box> |
| | | ); |