| | |
| | | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; |
| | | import React, { useState } from "react"; |
| | | import { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material'; |
| | | import { |
| | | useTranslate |
| | |
| | | const ConfirmButton = (props) => { |
| | | const { label, onConfirm, renderButton, ...rest } = props; |
| | | const translate = useTranslate(); |
| | | const buttonRef = useRef(null); |
| | | const [open, setOpen] = useState(false); |
| | | |
| | | const handleClickOpen = (event) => { |
| | |
| | | onConfirm(); |
| | | }; |
| | | |
| | | const defaultButtonProps = { |
| | | onClick: handleClickOpen, |
| | | 'aria-label': translate(label), |
| | | ...rest, |
| | | }; |
| | | |
| | | const buttonElement = renderButton |
| | | ? renderButton({ |
| | | buttonProps: { |
| | | ref: buttonRef, |
| | | onClick: handleClickOpen, |
| | | 'aria-label': translate(label), |
| | | ...rest, |
| | | }, |
| | | buttonProps: defaultButtonProps, |
| | | label, |
| | | translate, |
| | | }) |
| | | : ( |
| | | <Button |
| | | ref={buttonRef} |
| | | onClick={handleClickOpen} |
| | | aria-label={translate(label)} |
| | | {...rest} |
| | | {...defaultButtonProps} |
| | | > |
| | | {translate(label)} |
| | | </Button> |
| | |
| | | })); |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <SearchInput source="codes" alwaysOn />, |
| | | // <DateInput label='common.time.after' source="timeStart" alwaysOn />, |
| | | // <DateInput label='common.time.before' source="timeEnd" alwaysOn />, |
| | | |