Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

115 rader
3.7 KiB

  1. // material-ui
  2. import {
  3. // Button,
  4. Grid,
  5. Typography,
  6. Stack,
  7. Box,
  8. } from '@mui/material';
  9. import { useEffect, useState } from "react";
  10. import * as React from "react";
  11. import axios from "axios";
  12. // import { useNavigate,
  13. // useParams
  14. // } from "react-router-dom";
  15. import { GLD_USER_PROFILE_PATH,
  16. // DELETE_USER,
  17. // POST_ADMIN_USER_REGISTER
  18. } from "utils/ApiPathConst";
  19. import Loadable from 'components/Loadable';
  20. import { lazy } from 'react';
  21. const UserInformationCard = Loadable(lazy(() => import('./UserInformationCard')));
  22. const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent')));
  23. // const UserGroupCard = Loadable(lazy(() => import('./UserGroupCard')));
  24. // const UserAuthorityCard = Loadable(lazy(() => import('./UserAuthorityCard')));
  25. import {
  26. // GeneralConfirmWindow,
  27. // getDeletedRecordWithRefList,
  28. // notifyDeleteSuccess,
  29. // notifySaveSuccess,
  30. } from "utils/CommonFunction";
  31. // import ForwardIcon from '@mui/icons-material/Forward';
  32. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  33. import {
  34. getUserId,
  35. } from "utils/Utils";
  36. const BackgroundHead = {
  37. backgroundImage: `url(${titleBackgroundImg})`,
  38. width: '100%',
  39. height: '100%',
  40. backgroundSize: 'contain',
  41. backgroundRepeat: 'no-repeat',
  42. backgroundColor: '#0C489E',
  43. backgroundPosition: 'right'
  44. }
  45. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  46. const UserMaintainPage = () => {
  47. // const params = useParams();
  48. // const navigate = useNavigate();
  49. const [userData, setUserData] = React.useState({});
  50. const [onReady, setOnReady] = useState(false);
  51. useEffect(() => {
  52. axios.get(`${GLD_USER_PROFILE_PATH}/${getUserId()}`)
  53. .then((response) => {
  54. if (response.status === 200) {
  55. setUserData(response.data);
  56. }
  57. })
  58. .catch(error => {
  59. console.log(error);
  60. return false;
  61. });
  62. }, []);
  63. useEffect(() => {
  64. if (Object.keys(userData).length > 0 && userData !== undefined) {
  65. setOnReady(true);
  66. }
  67. }, [userData]);
  68. return (
  69. !onReady ?
  70. <Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center">
  71. <Grid item>
  72. <LoadingComponent />
  73. </Grid>
  74. </Grid>
  75. :
  76. <Grid container sx={{minHeight: '87vh', backgroundColor: 'backgroundColor.default' }}direction="column"
  77. justifyContent="flex-start">
  78. <Grid item xs={12}>
  79. <div style={BackgroundHead}>
  80. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  81. <Typography ml={15} color='#FFF' variant="h4" sx={{display: { xs: 'none', sm: 'none', md: 'block', pt:2 }}}>
  82. My Profile
  83. </Typography>
  84. </Stack>
  85. </div>
  86. </Grid>
  87. {/*col 1*/}
  88. <Grid item xs={12}>
  89. <Grid container>
  90. <Grid item xs={12} md={12} lg={12}>
  91. <Box xs={12} ml={4} mt={3} mr={4} mb={4} sx={{ p: 1, borderRadius: '10px', backgroundColor: '#fff' }}>
  92. <UserInformationCard
  93. userData={userData}
  94. />
  95. </Box>
  96. </Grid>
  97. </Grid>
  98. </Grid>
  99. {/*col 2*/}
  100. </Grid>
  101. );
  102. };
  103. export default UserMaintainPage;