|  |  | 
 |  |  |     UrlField, | 
 |  |  |     useRecordContext, | 
 |  |  |     useTranslate, | 
 |  |  |     Button as RaButton, | 
 |  |  |     useNotify, | 
 |  |  | } from 'react-admin'; | 
 |  |  | import { Link as RouterLink, useLocation } from 'react-router-dom'; | 
 |  |  | import { | 
 |  |  | 
 |  |  | import { formatDistance } from 'date-fns'; | 
 |  |  | import StatusField from "../../components/StatusField"; | 
 |  |  | import AccessTimeIcon from '@mui/icons-material/AccessTime'; | 
 |  |  | import RemoveCircleIcon from '@mui/icons-material/RemoveCircle'; | 
 |  |  | import AdjustIcon from '@mui/icons-material/Adjust'; | 
 |  |  | import request from '@/utils/request'; | 
 |  |  | import { HANDLE_APP_KEY } from '@/config/setting'; | 
 |  |  |  | 
 |  |  | export const AgvShowAside = (props) => { | 
 |  |  |     const translate = useTranslate(); | 
 |  |  |     const notify = useNotify(); | 
 |  |  |     const record = useRecordContext(); | 
 |  |  |     if (!record) return null; | 
 |  |  |  | 
 |  |  |     const removeFromMap = () => { | 
 |  |  |         if (confirm(translate('common.msg.confirm.desc'))) { | 
 |  |  |             request.post('/agv/remove/from/map', { ...record }).then(res => { | 
 |  |  |                 const { code, msg, data } = res.data; | 
 |  |  |                 if (code === 200) { | 
 |  |  |                     notify(msg, { type: 'success', messageArgs: { _: msg } }); | 
 |  |  |                 } else { | 
 |  |  |                     notify(msg, { type: 'error', messageArgs: { _: msg } }); | 
 |  |  |                 } | 
 |  |  |             }).catch(error => { | 
 |  |  |                 notify(error, { type: 'error', messageArgs: { _: error } }); | 
 |  |  |             }) | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     const reposition = () => { | 
 |  |  |         if (confirm(translate('common.msg.confirm.desc'))) { | 
 |  |  |             request.post('/handler/unlock', | 
 |  |  |                 { agvNo: record.uuid }, | 
 |  |  |                 { headers: { 'appKey': HANDLE_APP_KEY } } | 
 |  |  |             ).then(res => { | 
 |  |  |                 const { code, msg, data } = res.data; | 
 |  |  |                 if (code === 200) { | 
 |  |  |                     notify(msg, { type: 'success', messageArgs: { _: msg } }); | 
 |  |  |                 } else { | 
 |  |  |                     notify(msg, { type: 'error', messageArgs: { _: msg } }); | 
 |  |  |                 } | 
 |  |  |             }).catch(error => { | 
 |  |  |                 notify(error, { type: 'error', messageArgs: { _: error } }); | 
 |  |  |             }) | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     return ( | 
 |  |  |         <Box width={400} display={{ xs: 'none', lg: 'block' }}> | 
 |  |  | 
 |  |  |                     <Card> | 
 |  |  |                         <CardContent> | 
 |  |  |                             <Stack direction="row" spacing={1}> | 
 |  |  |                                 <EditButton label="Edit Company" /> | 
 |  |  |                                 <EditButton /> | 
 |  |  |                             </Stack> | 
 |  |  |                             <Stack direction="row" mt={1}> | 
 |  |  |                             <Stack direction="row" mt={.5}> | 
 |  |  |                                 <RaButton label="page.agv.show.remove" onClick={removeFromMap}> | 
 |  |  |                                     <RemoveCircleIcon /> | 
 |  |  |                                 </RaButton> | 
 |  |  |                             </Stack> | 
 |  |  |                             <Stack direction="row" mt={.5}> | 
 |  |  |                                 <RaButton label="page.agv.show.reposition" onClick={reposition}> | 
 |  |  |                                     <AdjustIcon /> | 
 |  |  |                                 </RaButton> | 
 |  |  |                             </Stack> | 
 |  |  |                             <Stack direction="row" mt={.5}> | 
 |  |  |                                 <DeleteButton mutationMode="optimistic" /> | 
 |  |  |                             </Stack> | 
 |  |  |                             <Box mt={1} /> | 
 |  |  |                             <Typography variant="subtitle2" gutterBottom> | 
 |  |  |                                 {translate('common.edit.side.title')} | 
 |  |  |                             </Typography> | 
 |  |  |                             <Divider sx={{ mb: 1 }} /> | 
 |  |  |                             <Divider sx={{ mb: 2 }} /> | 
 |  |  |                             <Grid container rowSpacing={2} columnSpacing={1}> | 
 |  |  |                                 <Grid item xs={12} display="flex" gap={1}> | 
 |  |  |                                     <StatusField label="Status" /> |