|  |  | 
 |  |  |     DeleteButton, | 
 |  |  |     FunctionField, | 
 |  |  |     Pagination, | 
 |  |  |     useNotify, | 
 |  |  | } from 'react-admin'; | 
 |  |  | import { Box, Typography, Card, Chip } from '@mui/material'; | 
 |  |  | import { Box, Typography, Button, Chip } from '@mui/material'; | 
 |  |  | import { styled } from '@mui/material/styles'; | 
 |  |  | import BusCreate from "./BusCreate"; | 
 |  |  | import BusPanel from "./BusPanel"; | 
 |  |  | 
 |  |  | import * as Common from '@/utils/common'; | 
 |  |  | import BusListAside from "./BusListAside"; | 
 |  |  | import { getBusStsColor } from '@/utils/color-util'; | 
 |  |  | import CancelIcon from '@mui/icons-material/Cancel'; | 
 |  |  | import request from '@/utils/request'; | 
 |  |  | import ConfirmButton from "../components/ConfirmButton"; | 
 |  |  |  | 
 |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
 |  |  |     '& .css-1vooibu-MuiSvgIcon-root': { | 
 |  |  | 
 |  |  |         whiteSpace: 'nowrap', | 
 |  |  |     }, | 
 |  |  |     '& .opt': { | 
 |  |  |         width: 80 | 
 |  |  |         width: 120 | 
 |  |  |     }, | 
 |  |  | })); | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  | const BusList = () => { | 
 |  |  |     const translate = useTranslate(); | 
 |  |  |  | 
 |  |  |     const notify = useNotify(); | 
 |  |  |     const [createDialog, setCreateDialog] = useState(false); | 
 |  |  |     const [drawerVal, setDrawerVal] = useState(false); | 
 |  |  |  | 
 |  |  |     const onCancel = (busId) => { | 
 |  |  |         request.get("/bus/cancel/" + busId).then(res => { | 
 |  |  |             const { code, msg, data } = res.data; | 
 |  |  |             if (code === 200) { | 
 |  |  |                 notify(msg || 'common.response.success', { type: 'success', messageArgs: { _: msg } }); | 
 |  |  |             } else { | 
 |  |  |                 notify(msg || 'common.response.fail', { type: 'error', messageArgs: { _: msg } }); | 
 |  |  |             } | 
 |  |  |         }) | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     return ( | 
 |  |  |         <Box display="flex"> | 
 |  |  | 
 |  |  |                     {/* <BooleanField source="statusBool" label="common.field.status" sortable={false} /> */} | 
 |  |  |                     <TextField source="memo" label="common.field.memo" sortable={false} emptyText="-" /> | 
 |  |  |                     <FunctionField label="common.field.opt" cellClassName="opt" render={record => ( | 
 |  |  |                         (record.busSts === 15) && ( | 
 |  |  |                             <DeleteButton label="" sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> | 
 |  |  |                         (record.busSts === 15 || true) && ( | 
 |  |  |                             <ConfirmButton | 
 |  |  |                                 label="ra.action.cancel" | 
 |  |  |                                 size="small" | 
 |  |  |                                 color="error" | 
 |  |  |                                 startIcon={<CancelIcon />} | 
 |  |  |                                 sx={{ padding: '1px', fontSize: '.75rem' }} | 
 |  |  |                                 data={record.busNo} | 
 |  |  |                                 onConfirm={() => { | 
 |  |  |                                     onCancel(record.id); | 
 |  |  |                                 }} | 
 |  |  |                             /> | 
 |  |  |                         ) | 
 |  |  |                     )} /> | 
 |  |  |                 </StyledDatagrid> |