|  |  | 
 |  |  |     ReferenceArrayInput, | 
 |  |  |     AutocompleteInput, | 
 |  |  |     DeleteButton, | 
 |  |  |     Button, | 
 |  |  |     useRefresh | 
 |  |  | } from 'react-admin'; | 
 |  |  | import { Box, Typography, Card, Stack } from '@mui/material'; | 
 |  |  | import { styled } from '@mui/material/styles'; | 
 |  |  | 
 |  |  | import MyField from "../components/MyField"; | 
 |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; | 
 |  |  | import * as Common from '@/utils/common'; | 
 |  |  | import AddIcon from '@mui/icons-material/Add'; | 
 |  |  | import request from '@/utils/request'; | 
 |  |  |  | 
 |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
 |  |  |     '& .css-1vooibu-MuiSvgIcon-root': { | 
 |  |  | 
 |  |  |             > | 
 |  |  |                 <StyledDatagrid | 
 |  |  |                     preferenceKey='waitPakin' | 
 |  |  |                     bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} | 
 |  |  |                     bulkActionButtons={<> <CreateTaskButton /> <BulkDeleteButton mutationMode={OPERATE_MODE} /></>} | 
 |  |  |                     rowClick={(id, resource, record) => false} | 
 |  |  |                     expand={() => <WaitPakinPanel />} | 
 |  |  |                     expandSingle={true} | 
 |  |  | 
 |  |  | } | 
 |  |  |  | 
 |  |  | export default WaitPakinList; | 
 |  |  |  | 
 |  |  | const CreateTaskButton = () => { | 
 |  |  |     const record = useRecordContext(); | 
 |  |  |     const notify = useNotify(); | 
 |  |  |     const refresh = useRefresh(); | 
 |  |  |     const { selectedIds, onUnselectItems, data } = useListContext(); | 
 |  |  |     const createTask = async () => { | 
 |  |  |         const rows = data.filter((item) => selectedIds.includes(item.id)) || []; | 
 |  |  |         const res = await request.post(`/waitPakin/merge`, rows); | 
 |  |  |         if (res?.data?.code === 200) { | 
 |  |  |             refresh() | 
 |  |  |             notify(res.data.msg); | 
 |  |  |  | 
 |  |  |         } else { | 
 |  |  |             notify(res.data.msg); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     return ( | 
 |  |  |         <> | 
 |  |  |             <Button onClick={() => createTask()} label={"toolbar.createTask"}> | 
 |  |  |                 <AddIcon /> | 
 |  |  |             </Button> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         </> | 
 |  |  |  | 
 |  |  |     ) | 
 |  |  | } |