Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

UserGroupSearchForm.js 5.5 KiB

​
​
​
vor 2 Jahren
​
vor 2 Jahren
vor 2 Jahren
​
​
​
​
​
​
​
​
vor 2 Jahren
​
​
​
​
​
​
​
vor 2 Jahren
​
​
​
vor 2 Jahren
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
vor 2 Jahren
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. // material-ui
  2. import {
  3. Button,
  4. Grid, TextField,
  5. Typography
  6. } from '@mui/material';
  7. import MainCard from "../../components/MainCard";
  8. import { useForm } from "react-hook-form";
  9. import * as React from "react";
  10. import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline';
  11. import { useNavigate } from "react-router";
  12. import { PNSPS_BUTTON_THEME } from "../../themes/buttonConst";
  13. import { ThemeProvider } from "@emotion/react";
  14. import { isGrantedAny } from "auth/utils";
  15. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  16. const UserGroupSearchForm = ({ applySearch, onGridReady, searchCriteria }) => {
  17. const navigate = useNavigate();
  18. const { reset, register, handleSubmit } = useForm()
  19. const onSubmit = (data) => {
  20. applySearch(data);
  21. };
  22. function resetForm() {
  23. reset({
  24. name:"",
  25. description:""
  26. });
  27. }
  28. const handleNewGroupClick = () => {
  29. navigate('/userGroup/-1');
  30. };
  31. return (
  32. <MainCard xs={12} md={12} lg={12}
  33. border={false}
  34. content={false}
  35. >
  36. <form onSubmit={handleSubmit(onSubmit)}>
  37. <Grid container sx={{ backgroundColor: '#ffffff', ml: 2, mt: 1 }} width="98%">
  38. {/*row 1*/}
  39. <Grid item justifyContent="space-between" alignItems="center" sx={{ mt: 1, ml: 3, mb: 2.5 }}>
  40. <Typography variant="pnspsFormHeader" >
  41. Search
  42. </Typography>
  43. </Grid>
  44. {/*row 2*/}
  45. <Grid container display="flex" alignItems={"center"}>
  46. <Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}>
  47. <TextField
  48. fullWidth
  49. {...register("name")}
  50. id='userGroupName'
  51. label="User Group Name"
  52. defaultValue={searchCriteria.name}
  53. InputLabelProps={{
  54. shrink: true
  55. }}
  56. />
  57. </Grid>
  58. <Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}>
  59. <TextField
  60. fullWidth
  61. {...register("description")}
  62. id="userGroupDescription"
  63. label="User Group Description"
  64. defaultValue={searchCriteria.description}
  65. InputLabelProps={{
  66. shrink: true
  67. }}
  68. />
  69. </Grid>
  70. </Grid>
  71. {/*last row*/}
  72. <Grid container direction="row"
  73. justifyContent="space-between"
  74. alignItems="center"
  75. spacing={3}
  76. sx={{ mb: 3 }}
  77. >
  78. <ThemeProvider theme={PNSPS_BUTTON_THEME}>
  79. {
  80. isGrantedAny("MAINTAIN_GROUP") ?
  81. <Grid item xs={3} md={3} >
  82. <Button
  83. variant="contained"
  84. onClick={handleNewGroupClick}
  85. startIcon={<AddCircleOutlineIcon sx={{ alignItems: "center" }} />}
  86. >
  87. New Group
  88. </Button>
  89. </Grid>
  90. :
  91. <Grid item xs={3} md={3}></Grid>
  92. }
  93. <Grid item xs={8} md={8}>
  94. <Grid container maxWidth justifyContent="flex-end" spacing={3}>
  95. <Grid item >
  96. <Button
  97. variant="contained"
  98. color="cancel"
  99. onClick={resetForm}
  100. >
  101. Reset
  102. </Button>
  103. </Grid>
  104. <Grid item >
  105. <Button
  106. variant="contained"
  107. type="submit"
  108. disabled={onGridReady}
  109. sx={{
  110. textTransform: 'capitalize',
  111. alignItems: 'end'
  112. }}>
  113. Search
  114. </Button>
  115. </Grid>
  116. </Grid>
  117. </Grid>
  118. </ThemeProvider>
  119. </Grid>
  120. </Grid>
  121. </form>
  122. </MainCard>
  123. );
  124. };
  125. export default UserGroupSearchForm;