()
| 37 | // ==============================|| Evaluators ||============================== // |
| 38 | |
| 39 | const Evaluators = () => { |
| 40 | const theme = useTheme() |
| 41 | const customization = useSelector((state) => state.customization) |
| 42 | const dispatch = useDispatch() |
| 43 | const { confirm } = useConfirm() |
| 44 | useNotifier() |
| 45 | const { error } = useError() |
| 46 | |
| 47 | const enqueueSnackbar = (...args) => dispatch(enqueueSnackbarAction(...args)) |
| 48 | const closeSnackbar = (...args) => dispatch(closeSnackbarAction(...args)) |
| 49 | |
| 50 | const [search, setSearch] = useState('') |
| 51 | const [isLoading, setLoading] = useState(true) |
| 52 | const [showEvaluatorDialog, setShowEvaluatorDialog] = useState(false) |
| 53 | const [dialogProps, setDialogProps] = useState({}) |
| 54 | const [evaluators, setEvaluators] = useState([]) |
| 55 | |
| 56 | const getAllEvaluators = useApi(evaluatorsApi.getAllEvaluators) |
| 57 | |
| 58 | /* Table Pagination */ |
| 59 | const [currentPage, setCurrentPage] = useState(1) |
| 60 | const [pageLimit, setPageLimit] = useState(DEFAULT_ITEMS_PER_PAGE) |
| 61 | const [total, setTotal] = useState(0) |
| 62 | const onChange = (page, pageLimit) => { |
| 63 | setCurrentPage(page) |
| 64 | setPageLimit(pageLimit) |
| 65 | refresh(page, pageLimit) |
| 66 | } |
| 67 | |
| 68 | const refresh = (page, limit) => { |
| 69 | const params = { |
| 70 | page: page || currentPage, |
| 71 | limit: limit || pageLimit |
| 72 | } |
| 73 | getAllEvaluators.request(params) |
| 74 | } |
| 75 | |
| 76 | const onSearchChange = (event) => { |
| 77 | setSearch(event.target.value) |
| 78 | } |
| 79 | |
| 80 | const newEvaluator = () => { |
| 81 | const dialogProp = { |
| 82 | type: 'ADD', |
| 83 | cancelButtonName: 'Cancel', |
| 84 | confirmButtonName: 'Add', |
| 85 | data: {} |
| 86 | } |
| 87 | setDialogProps(dialogProp) |
| 88 | setShowEvaluatorDialog(true) |
| 89 | } |
| 90 | |
| 91 | const edit = (item) => { |
| 92 | const dialogProp = { |
| 93 | type: 'EDIT', |
| 94 | cancelButtonName: 'Cancel', |
| 95 | confirmButtonName: 'Save', |
| 96 | data: item |
nothing calls this directly
no test coverage detected