Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 

73 řádky
2.3 KiB

  1. // material-ui
  2. import {Grid, Typography} from '@mui/material';
  3. import {useEffect, useState} from "react";
  4. import * as React from "react";
  5. //import axios from "axios";
  6. import * as HttpUtils from "../../utils/HttpUtils";
  7. import {useParams} from "react-router-dom";
  8. import UserInformationCard from "./UserInformationCard_Individual";
  9. import LoadingComponent from "../extra-pages/LoadingComponent";
  10. import * as UrlUtils from "../../utils/ApiPathConst";
  11. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  12. const UserMaintainPage_Individual = () => {
  13. const params = useParams();
  14. const [userData, setUserData] = useState({})
  15. const [userFile, setUserFile] = useState({})
  16. const [isLoading, setLoding] = useState(true);
  17. useEffect(()=>{
  18. loadData();
  19. },[]);
  20. const loadData = ()=>{
  21. setLoding(true);
  22. HttpUtils.get({
  23. url: `${UrlUtils.GET_IND_USER_PATH}/${params.id}`,
  24. onSuccess: function(response){
  25. response.data["address"] = JSON.parse(response.data["address"]);
  26. response.data["contactTel"] = JSON.parse(response.data["contactTel"]);
  27. response.data["faxNo"] = JSON.parse(response.data["faxNo"]);
  28. setUserData(response.data);
  29. setUserFile(response.userFile)
  30. }
  31. });
  32. };
  33. useEffect(() => {
  34. setLoding(false);
  35. }, [userData]);
  36. return (
  37. isLoading ?
  38. <LoadingComponent/>
  39. :
  40. <Grid container rowSpacing={4.5} columnSpacing={2.75}>
  41. <Grid item xs={12} sx={{mb: -2.25}}>
  42. <Typography variant="h5">Individual User</Typography>
  43. </Grid>
  44. {/*col 1*/}
  45. <Grid item xs={12} >
  46. <Grid container>
  47. <Grid item xs={12} md={12} lg={12}>
  48. <UserInformationCard
  49. userData={userData}
  50. userFile={userFile}
  51. loadDataFun={loadData}
  52. />
  53. </Grid>
  54. </Grid>
  55. </Grid>
  56. {/*col 2*/}
  57. </Grid>
  58. );
  59. };
  60. export default UserMaintainPage_Individual;