| | |
| | | const handleOpen = () => setOpen(true); |
| | | const handleClose = () => setOpen(false); |
| | | |
| | | const [updateMany, { loading }] = useUpdateMany( |
| | | resource, |
| | | { ids: selectedIds, data: {} }, |
| | | { |
| | | onSuccess: () => { |
| | | setOpen(false); |
| | | refresh(); |
| | | notify('common.response.success', { type: 'info' }); |
| | | unselectAll(); |
| | | }, |
| | | onError: (error) => { |
| | | notify(error.msg || 'common.response.fail', { type: 'error' }); |
| | | } |
| | | } |
| | | ); |
| | | const [updateMany, { loading }] = useUpdateMany(); |
| | | |
| | | const handleSubmit = (data) => { |
| | | const filteredData = Object.fromEntries( |
| | |
| | | ); |
| | | delete filteredData['memoWrap']; |
| | | if (Object.keys(filteredData).length > 0) { |
| | | console.log(filteredData); |
| | | updateMany({ |
| | | updateMany( |
| | | resource, |
| | | { |
| | | ids: selectedIds, |
| | | data: filteredData, |
| | | }); |
| | | }, |
| | | { |
| | | onSuccess: () => { |
| | | setOpen(false); |
| | | refresh(); |
| | | notify('common.response.success', { type: 'success' }); |
| | | unselectAll(); |
| | | }, |
| | | onError: (error) => { |
| | | notify(error.message || 'common.response.fail', { type: 'error' }); |
| | | }, |
| | | } |
| | | ); |
| | | } else { |
| | | notify('common.response.fail', { type: 'warning' }); |
| | | } |
| | |
| | | color="inherit" |
| | | size='large' |
| | | label='ra.action.cancel' |
| | | aria-label={false} |
| | | sx={{ mr: 1 }} |
| | | > |
| | | <CloseIcon /> |
| | |
| | | color="primary" |
| | | size='large' |
| | | label='ra.action.save' |
| | | aria-label={false} |
| | | disabled={loading} |
| | | sx={{ mr: 1 }} |
| | | > |