|  |  |  | 
|---|
|  |  |  | Stack, | 
|---|
|  |  |  | Typography, | 
|---|
|  |  |  | Avatar, | 
|---|
|  |  |  | useTheme, | 
|---|
|  |  |  | } from '@mui/material'; | 
|---|
|  |  |  | import DialogCloseButton from "../components/DialogCloseButton"; | 
|---|
|  |  |  | import { blueGrey } from '@mui/material/colors'; | 
|---|
|  |  |  | import { blueGrey, blue } from '@mui/material/colors'; | 
|---|
|  |  |  | import MoveToInboxIcon from '@mui/icons-material/MoveToInbox'; | 
|---|
|  |  |  | import { format } from 'date-fns'; | 
|---|
|  |  |  | import { TaskList } from "./TaskList"; | 
|---|
|  |  |  | import { ActionsIterator } from "../action/ActionsIterator"; | 
|---|
|  |  |  | import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const MissionShow = ({ open, id }) => { | 
|---|
|  |  |  | const redirect = useRedirect(); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const MissionShowContent = ({ handleClose }) => { | 
|---|
|  |  |  | const theme = useTheme(); | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | const translate = useTranslate(); | 
|---|
|  |  |  | if (!record) return null; | 
|---|
|  |  |  | console.log(record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <> | 
|---|
|  |  |  | 
|---|
|  |  |  | sx={{ | 
|---|
|  |  |  | width: 30, | 
|---|
|  |  |  | height: 30, | 
|---|
|  |  |  | bgcolor: blueGrey[500], | 
|---|
|  |  |  | bgcolor: theme.palette.primary.main, | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | {record.agv} | 
|---|
|  |  |  | 
|---|
|  |  |  | color="textSecondary" | 
|---|
|  |  |  | variant="caption" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | Last sending date | 
|---|
|  |  |  | {translate('table.field.mission.lastSendDate')} | 
|---|
|  |  |  | </Typography> | 
|---|
|  |  |  | <Stack | 
|---|
|  |  |  | direction="row" | 
|---|
|  |  |  | 
|---|
|  |  |  | gap={1} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <Typography variant="body2"> | 
|---|
|  |  |  | {format(record.sendTime, 'yyyy-MM-dd HH:mm:ss')} | 
|---|
|  |  |  | {format(record.sendTime, 'yyyy-MM-dd HH:mm:ss') || '-'} | 
|---|
|  |  |  | </Typography> | 
|---|
|  |  |  | </Stack> | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  | 
|---|
|  |  |  | color="textSecondary" | 
|---|
|  |  |  | variant="caption" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | Bus No | 
|---|
|  |  |  | {translate('table.field.bus.busNo')} | 
|---|
|  |  |  | </Typography> | 
|---|
|  |  |  | <Typography variant="body2"> | 
|---|
|  |  |  | {record.busNo} | 
|---|
|  |  |  | {record.busNo || '-'} | 
|---|
|  |  |  | </Typography> | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | color="textSecondary" | 
|---|
|  |  |  | variant="caption" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | Action Count | 
|---|
|  |  |  | {translate('table.field.mission.actionCount')} | 
|---|
|  |  |  | </Typography> | 
|---|
|  |  |  | <Typography variant="body2"> | 
|---|
|  |  |  | {record.actionCount || 'unknown'} | 
|---|
|  |  |  | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | {!!record.contact_ids?.length && ( | 
|---|
|  |  |  | {!!record.taskIds?.length && ( | 
|---|
|  |  |  | <Box m={2}> | 
|---|
|  |  |  | <Box | 
|---|
|  |  |  | display="flex" | 
|---|
|  |  |  | 
|---|
|  |  |  | color="textSecondary" | 
|---|
|  |  |  | variant="caption" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | Contacts | 
|---|
|  |  |  | {translate('table.field.mission.task')} | 
|---|
|  |  |  | </Typography> | 
|---|
|  |  |  | <ReferenceArrayField | 
|---|
|  |  |  | source="contact_ids" | 
|---|
|  |  |  | reference="contacts_summary" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <ContactList /> | 
|---|
|  |  |  | <TaskList taskIds={record.taskIds} /> | 
|---|
|  |  |  | </ReferenceArrayField> | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  | )} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | {record.description && ( | 
|---|
|  |  |  | {!!record.codeList?.length && ( | 
|---|
|  |  |  | <Box m={2} sx={{ whiteSpace: 'pre-line' }}> | 
|---|
|  |  |  | <Typography | 
|---|
|  |  |  | color="textSecondary" | 
|---|
|  |  |  | variant="caption" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | Description | 
|---|
|  |  |  | {translate('table.field.mission.runPath')} | 
|---|
|  |  |  | </Typography> | 
|---|
|  |  |  | <Typography variant="body2"> | 
|---|
|  |  |  | {record.description} | 
|---|
|  |  |  | <Typography variant="body2" sx={{ whiteSpace: 'normal', overflow: 'hidden', display: 'flex', flexWrap: 'wrap' }}> | 
|---|
|  |  |  | [ {record.codeList.map((code, index) => ( | 
|---|
|  |  |  | <span key={index} style={{ | 
|---|
|  |  |  | color: record.currCode === code ? theme.palette.primary.main : 'inherit', | 
|---|
|  |  |  | }}> | 
|---|
|  |  |  | {code}{index < record.codeList.length - 1 && ','}  | 
|---|
|  |  |  | </span> | 
|---|
|  |  |  | ))} ] | 
|---|
|  |  |  | </Typography> | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  | )} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <Box m={2}> | 
|---|
|  |  |  | <Typography | 
|---|
|  |  |  | color="textSecondary" | 
|---|
|  |  |  | variant="caption" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | {translate('table.field.mission.actions')} | 
|---|
|  |  |  | </Typography> | 
|---|
|  |  |  | <Divider /> | 
|---|
|  |  |  | <ActionsIterator actionIds={record.actionIds} /> | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  | 
|---|
|  |  |  | const translate = useTranslate(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleClick = () => { | 
|---|
|  |  |  | alert(1); | 
|---|
|  |  |  | redirect(`/mission/${record.id}/resend`, undefined, undefined, undefined, { | 
|---|
|  |  |  | _scrollToTop: false, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Button | 
|---|
|  |  |  | onClick={handleClick} | 
|---|
|  |  |  | startIcon={<MoveToInboxIcon />} | 
|---|
|  |  |  | // startIcon={<MoveToInboxIcon />} | 
|---|
|  |  |  | endIcon={<ArrowForwardIosIcon />} | 
|---|
|  |  |  | size="small" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | {translate('common.action.resend')} | 
|---|