| import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; | 
| import { useLocation, useNavigate } from 'react-router-dom'; | 
| import { | 
|     List, | 
|     DatagridConfigurable, | 
|     SearchInput, | 
|     TopToolbar, | 
|     SelectColumnsButton, | 
|     EditButton, | 
|     FilterButton, | 
|     CreateButton, | 
|     ExportButton, | 
|     BulkDeleteButton, | 
|     WrapperField, | 
|     useRecordContext, | 
|     useTranslate, | 
|     useNotify, | 
|     useListContext, | 
|     FunctionField, | 
|     TextField, | 
|     NumberField, | 
|     DateField, | 
|     BooleanField, | 
|     ReferenceField, | 
|     TextInput, | 
|     DateTimeInput, | 
|     DateInput, | 
|     SelectInput, | 
|     NumberInput, | 
|     ReferenceInput, | 
|     ReferenceArrayInput, | 
|     AutocompleteInput, | 
|     DeleteButton, | 
|     useGetOne, | 
|     useGetRecordId, | 
|     SimpleForm, | 
| } from 'react-admin'; | 
| import { Box, Typography, Card, Stack } from '@mui/material'; | 
| import { styled } from '@mui/material/styles'; | 
| import DeliveryItemCreate from "./DeliveryItemCreate"; | 
| import MyCreateButton from "../../components/MyCreateButton"; | 
| import PageDrawer from "../../components/PageDrawer"; | 
| import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_ITEM_PAGE_SIZE } from '@/config/setting'; | 
| import DeliveryItemEdit from "./DeliveryItemEdit"; | 
|   | 
| const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
|     '& .css-1vooibu-MuiSvgIcon-root': { | 
|         height: '.9em' | 
|     }, | 
|     '& .RaDatagrid-row': { | 
|         cursor: 'auto' | 
|     }, | 
|     '& .opt': { | 
|         width: 150 | 
|     }, | 
|     '& .MuiTableCell-root': { | 
|         whiteSpace: 'nowrap', | 
|         overflow: 'visible', | 
|         textOverflow: 'unset' | 
|     } | 
|   | 
| })); | 
|   | 
| const filters = [ | 
|     <SearchInput source="condition" alwaysOn />, | 
|     <DateInput label='common.time.after' source="timeStart" />, | 
|     <DateInput label='common.time.before' source="timeEnd" />, | 
|     <TextInput source="platItemId" label="table.field.deliveryItem.platItemId" />, | 
|     <TextInput source="matnrCode" label="table.field.deliveryItem.matnrCode" />, | 
|     <TextInput source="matnrName" label="table.field.deliveryItem.matnrName" />, | 
|     <TextInput source="splrName" label="table.field.deliveryItem.splrName" />, | 
|     <TextInput source="splrCode" label="table.field.deliveryItem.splrCode" />, | 
|     <TextInput source="splrBatch" label="table.field.deliveryItem.splrBatch" />, | 
|     <SelectInput | 
|         label="common.field.status" | 
|         source="status" | 
|         choices={[ | 
|             { id: '1', name: 'common.enums.statusTrue' }, | 
|             { id: '0', name: 'common.enums.statusFalse' }, | 
|         ]} | 
|         resettable | 
|     />, | 
| ] | 
|   | 
| const DeliveryItemList = () => { | 
|     const translate = useTranslate(); | 
|     const doId = useGetRecordId(); | 
|     const [createDialog, setCreateDialog] = useState(false); | 
|     const [drawerVal, setDrawerVal] = useState(false); | 
|     const [editDialog, setEditDialog] = useState(false); | 
|     const location = useLocation(); | 
|     const [select, setSelect] = useState({}); | 
|     const { data: dicts, isPending, error } = useGetOne('delivery', { id: doId }); | 
|     return ( | 
|         <Box display="flex"> | 
|             <List | 
|                 resource="deliveryItem" | 
|                 sx={{ | 
|                     flexGrow: 1, | 
|                     transition: (theme) => | 
|                         theme.transitions.create(['all'], { | 
|                             duration: theme.transitions.duration.enteringScreen, | 
|                         }), | 
|                     marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, | 
|                 }} | 
|                 title={"menu.deliveryItem"} | 
|                 empty={false} | 
|                 filters={filters} | 
|                 filter={{ deliveryId: doId }} | 
|                 sort={{ field: "create_time", order: "desc" }} | 
|                 actions={( | 
|                     <TopToolbar> | 
|                         <FilterButton /> | 
|                         <MyCreateButton onClick={() => { setCreateDialog(true) }} /> | 
|                         <SelectColumnsButton preferenceKey='deliveryItem' /> | 
|                         {/* <MyExportButton /> */} | 
|                     </TopToolbar> | 
|                 )} | 
|                 perPage={DEFAULT_ITEM_PAGE_SIZE} | 
|             > | 
|                 <StyledDatagrid | 
|                     preferenceKey='deliveryItem' | 
|                     bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} | 
|                     rowClick={(id, resource, record) => { | 
|                         setSelect(record) | 
|                         setEditDialog(true) | 
|                     }} | 
|                     expand={false} | 
|                     expandSingle={true} | 
|                     omit={['id', 'createTime', 'deliveryId', 'fieldsIndex', 'printQty', 'nromQty', 'createBy', 'memo','statusBool','createBy$','splrCode']} | 
|                 > | 
|                     <NumberField source="id" /> | 
|                     <NumberField source="deliveryId" label="table.field.deliveryItem.deliveryId" /> | 
|                     <TextField source="platItemId" label="table.field.deliveryItem.platItemId" /> | 
|                     <TextField source="matnrCode" label="table.field.deliveryItem.matnrCode" /> | 
|                     <TextField source="maktx" label="table.field.deliveryItem.matnrName" /> | 
|                     <TextField source="fieldsIndex" label="table.field.deliveryItem.fieldsIndex" /> | 
|                     <NumberField source="anfme" label="table.field.deliveryItem.anfme" /> | 
|                     <NumberField source="workQty" label="table.field.deliveryItem.workQty" /> | 
|                     <NumberField source="qty" label="table.field.deliveryItem.qty" /> | 
|                     <NumberField source="nromQty" label="table.field.deliveryItem.nromQty" /> | 
|                     <TextField source="unit" label="table.field.deliveryItem.unit" /> | 
|                     <TextField source="splrName" label="table.field.deliveryItem.splrName" /> | 
|                     <TextField source="splrCode" label="table.field.deliveryItem.splrCode" /> | 
|                     <TextField source="splrBatch" label="table.field.deliveryItem.splrBatch" /> | 
|                     <TextField source="updateBy$" label="common.field.updateBy" /> | 
|                     <DateField source="updateTime" label="common.field.updateTime" showTime /> | 
|                     <TextField source="createBy$" label="common.field.createBy" /> | 
|                     <DateField source="createTime" label="common.field.createTime" showTime /> | 
|                     <BooleanField source="statusBool" label="common.field.status" sortable={false} /> | 
|                     <TextField source="memo" label="common.field.memo" sortable={false} /> | 
|                     <WrapperField cellClassName="opt" label="common.field.opt"> | 
|                         <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} redirect={location.pathname + '/' + doId} /> | 
|                     </WrapperField> | 
|                 </StyledDatagrid> | 
|             </List> | 
|             <DeliveryItemEdit | 
|                 open={editDialog} | 
|                 setOpen={setEditDialog} | 
|                 record={select} | 
|             /> | 
|             <DeliveryItemCreate | 
|                 open={createDialog} | 
|                 setOpen={setCreateDialog} | 
|                 record={dicts} | 
|             /> | 
|             <PageDrawer | 
|                 title='DeliveryItem Detail' | 
|                 drawerVal={drawerVal} | 
|                 setDrawerVal={setDrawerVal} | 
|             > | 
|             </PageDrawer> | 
|         </Box> | 
|     ) | 
| } | 
|   | 
| export default DeliveryItemList; |