You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

178 lines
8.7 KiB

  1. // material-ui
  2. import {
  3. Button,
  4. CardContent, Divider,
  5. Grid, InputAdornment, TextField
  6. } from '@mui/material';
  7. import MainCard from "../../components/MainCard";
  8. import {useForm} from "react-hook-form";
  9. import Radio from '@mui/material/Radio';
  10. import RadioGroup from '@mui/material/RadioGroup';
  11. import FormControlLabel from '@mui/material/FormControlLabel';
  12. import FormControl from '@mui/material/FormControl';
  13. import {useState} from "react";
  14. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  15. const SettingPage = () => {
  16. const [notificationType, setNotificationType] = useState(null);
  17. const { reset, register, handleSubmit } = useForm()
  18. const onSubmit = (data) => {
  19. console.log(data);
  20. console.log(notificationType);
  21. };
  22. function resetForm(){
  23. setNotificationType(null);
  24. reset();
  25. }
  26. return (
  27. <Grid container rowSpacing={4.5} columnSpacing={2.75} justifyContent="center">
  28. <Grid item xs={12} md={11} lg={10} >
  29. <MainCard xs={12} md={12} lg={12}
  30. border={false}
  31. content={false}>
  32. <form onSubmit={handleSubmit(onSubmit)}>
  33. {/*Title*/}
  34. <CardContent sx={{ px: 2.5, pt: 3 }}>
  35. <Grid item justifyContent="space-between" alignItems="center">
  36. System Configuration
  37. </Grid>
  38. </CardContent>
  39. <Grid container alignItems={"center"} justifyContent="center">
  40. {/*row 1*/}
  41. <Grid item s={12} md={9} lg={8} sx={{ml:3, mr:3, mb:3}}>
  42. <Grid container sx={{mb:3}}>
  43. <Grid item xs={12} s={12} md={12} lg={5} sx={{ml:3, mr:3, display: 'flex'}}>
  44. Notification Frequency
  45. </Grid>
  46. <FormControl>
  47. <RadioGroup
  48. aria-labelledby="notification-group-label"
  49. defaultValue="None"
  50. value={notificationType === null ? null : notificationType}
  51. onChange={(event, newValue) => {
  52. setNotificationType(newValue);
  53. }}
  54. name="radio-buttons-group"
  55. >
  56. <FormControlLabel value="Weekly" control={
  57. <Radio
  58. checked={notificationType === null ? false : notificationType === "Weekly"}
  59. />
  60. } label="Weekly" />
  61. <FormControlLabel value="Monthly" control={
  62. <Radio
  63. checked={notificationType === null ? false : notificationType === "Monthly"}
  64. />
  65. } label="Monthly" />
  66. <FormControlLabel value="Bi-Monthly" control={
  67. <Radio
  68. checked={notificationType === null ? false : notificationType === "Bi-Monthly"}
  69. />
  70. } label="Bi-Monthly" />
  71. <FormControlLabel value="None" control={
  72. <Radio
  73. checked={notificationType === null ? false : notificationType === "None"}
  74. />
  75. } label="None" />
  76. </RadioGroup>
  77. </FormControl>
  78. </Grid>
  79. <Divider variant="middle" />
  80. </Grid>
  81. {/*row 2*/}
  82. <Grid item s={12} md={9} lg={8} sx={{ml:3, mr:3, mb:3}}>
  83. <Grid container sx={{mb:3}}>
  84. <Grid item xs={12} s={12} md={12} lg={5} sx={{ml:3, mr:3, display: 'flex', alignItems: 'center'}}>
  85. Number of days to keep the Government Directory Sync Indicator
  86. </Grid>
  87. <Grid item xs={12} s={12} md={12} lg={5} justifyContent="space-between" alignItems="right">
  88. <TextField
  89. fullWidth
  90. {...register("syncDateCount")}
  91. id='syncDateCount'
  92. InputProps={{
  93. endAdornment: <InputAdornment position="end">days</InputAdornment>,
  94. }}
  95. />
  96. </Grid>
  97. </Grid>
  98. <Divider variant="middle" />
  99. </Grid>
  100. {/*row 3*/}
  101. <Grid item s={12} md={9} lg={8} sx={{ml:3, mr:3, mb:3}}>
  102. <Grid container sx={{mb:3}}>
  103. <Grid item xs={12} s={12} md={12} lg={5} sx={{ml:3, mr:3, display: 'flex', alignItems: 'center'}}>
  104. Idle Logout Time
  105. </Grid>
  106. <Grid item xs={12} s={12} md={12} lg={5} justifyContent="space-between" alignItems="right">
  107. <TextField
  108. fullWidth
  109. {...register("idleLogoutTime")}
  110. id="idleLogoutTime"
  111. InputProps={{
  112. endAdornment: <InputAdornment position="start">minutes</InputAdornment>,
  113. }}
  114. />
  115. </Grid>
  116. </Grid>
  117. <Divider variant="middle" />
  118. </Grid>
  119. {/*row 4*/}
  120. <Grid item s={12} md={9} lg={8} sx={{ml:3, mr:3, mb:3}} alignItems={"center"} justifyContent="center">
  121. <Grid container maxWidth justifyContent="flex-end">
  122. <Grid item sx={{ml:3, mr:3}}>
  123. <Button
  124. size="large"
  125. variant="contained"
  126. onClick={resetForm}
  127. sx={{
  128. textTransform: 'capitalize',
  129. alignItems: 'end'
  130. }}>
  131. Clear
  132. </Button>
  133. </Grid>
  134. <Grid item sx={{ml:3, mr:3}}>
  135. <Button
  136. size="large"
  137. variant="contained"
  138. type="submit"
  139. sx={{
  140. textTransform: 'capitalize',
  141. alignItems: 'end'
  142. }}>
  143. Save Change
  144. </Button>
  145. </Grid>
  146. </Grid>
  147. </Grid>
  148. </Grid>
  149. </form>
  150. </MainCard>
  151. </Grid>
  152. </Grid>
  153. );
  154. };
  155. export default SettingPage;