No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

161 líneas
7.2 KiB

  1. // material-ui
  2. import {
  3. FormControl,
  4. // IconButton,
  5. Grid,
  6. // InputAdornment,
  7. Typography, FormLabel,
  8. OutlinedInput,
  9. } from '@mui/material';
  10. import MainCard from "components/MainCard";
  11. import * as React from "react";
  12. import {useEffect, useState} from "react";
  13. import Loadable from 'components/Loadable';
  14. import { lazy } from 'react';
  15. const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent')));
  16. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  17. const UserInformationCard = ({userData}) => {
  18. const [currentUserData, setCurrentUserData] = React.useState({});
  19. // const [locked, setLocked] = useState(false);
  20. const [onReady, setOnReady] = useState(false);
  21. useEffect(() => {
  22. //if user data from parent are not null
  23. if (Object.keys(userData).length > 0 && userData !== undefined) {
  24. setCurrentUserData(userData.data);
  25. }
  26. }, [userData]);
  27. useEffect(() => {
  28. //if state data are ready and assign to different field
  29. if (Object.keys(userData).length > 0 &&currentUserData !== undefined&&currentUserData.id!==undefined) {
  30. console.log(currentUserData)
  31. // setLocked(currentUserData.locked);
  32. setOnReady(true);
  33. }
  34. }, [currentUserData]);
  35. return (
  36. !onReady ?
  37. <LoadingComponent/>
  38. :
  39. <MainCard elevation={0}
  40. border={false}
  41. content={false}
  42. >
  43. <Typography variant="h5" sx={{mt: 3, ml: 3, mr: 3, borderBottom: "1px solid black"}}>
  44. Information
  45. </Typography>
  46. <form>
  47. <Grid container>
  48. <Grid item xs={12} s={12} md={12} lg={12} sx={{ml: 3, mr: 3, mb: 3, mt:3}}>
  49. <Grid container alignItems={"center"}>
  50. <Grid item xs={4} s={4} md={4} lg={4}
  51. sx={{ml: 3, mr: 3, display: 'flex', alignItems: 'center'}}>
  52. <FormLabel required>Username:</FormLabel>
  53. </Grid>
  54. <Grid item xs={7} s={7} md={7} lg={6}>
  55. <FormControl variant="outlined" fullWidth required>
  56. <OutlinedInput
  57. required
  58. fullWidth
  59. size="small"
  60. // {...register("username",
  61. // {
  62. // })}
  63. id='username'
  64. disabled={true}
  65. value={currentUserData.username}
  66. />
  67. </FormControl>
  68. </Grid>
  69. </Grid>
  70. </Grid>
  71. <Grid item xs={12} s={12} md={12} lg={12} sx={{ml: 3, mr: 3, mb: 3}}>
  72. <Grid container alignItems={"center"}>
  73. <Grid item xs={4} s={4} md={4} lg={4}
  74. sx={{ml: 3, mr: 3, display: 'flex', alignItems: 'center'}}>
  75. <FormLabel required >Full Name:</FormLabel>
  76. </Grid>
  77. <Grid item xs={7} s={7} md={7} lg={6}>
  78. <FormControl variant="outlined" fullWidth required>
  79. <OutlinedInput
  80. required
  81. fullWidth
  82. size="small"
  83. value= {currentUserData.enName}
  84. disabled={true}
  85. // {...register("enName",
  86. // {
  87. // })}
  88. id='enName'
  89. />
  90. </FormControl>
  91. </Grid>
  92. </Grid>
  93. </Grid>
  94. <Grid item xs={12} s={12} md={12} lg={12} sx={{ml: 3, mr: 3, mb: 3}}>
  95. <Grid container alignItems={"center"}>
  96. <Grid item xs={4} s={4} md={4} lg={4}
  97. sx={{ml: 3, mr: 3, display: 'flex', alignItems: 'center'}}>
  98. <FormLabel>Post:</FormLabel>
  99. </Grid>
  100. <Grid item xs={7} s={7} md={7} lg={6}>
  101. <FormControl variant="outlined" fullWidth required>
  102. <OutlinedInput
  103. fullWidth
  104. size="small"
  105. value= {currentUserData.post}
  106. disabled={true}
  107. // {...register("post",
  108. // {
  109. // })}
  110. id='post'
  111. />
  112. </FormControl>
  113. </Grid>
  114. </Grid>
  115. </Grid>
  116. <Grid item xs={12} s={12} md={12} lg={12} sx={{ml: 3, mr: 3, mb: 3}}>
  117. <Grid container alignItems={"center"}>
  118. <Grid item xs={4} s={4} md={4} lg={4}
  119. sx={{ml: 3, mr: 3, display: 'flex', alignItems: 'center'}}>
  120. <FormLabel required>Email:</FormLabel>
  121. </Grid>
  122. <Grid item xs={7} s={7} md={7} lg={6}>
  123. <FormControl variant="outlined" fullWidth required>
  124. <OutlinedInput
  125. fullWidth
  126. size="small"
  127. value={currentUserData.emailAddress}
  128. disabled={true}
  129. // {...register("emailAddress",
  130. // {
  131. // })}
  132. id='emailAddress'
  133. />
  134. </FormControl>
  135. </Grid>
  136. </Grid>
  137. </Grid>
  138. </Grid>
  139. </form>
  140. </MainCard>
  141. );
  142. };
  143. export default UserInformationCard;