Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 

74 lignes
2.1 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 * as HttpUtils from "../../utils/HttpUtils";
  6. import {useParams} from "react-router-dom";
  7. import InfoCard from "./OrganizationCard_loadFromUser";
  8. import LoadingComponent from "../extra-pages/LoadingComponent";
  9. import {useNavigate} from "react-router-dom";
  10. import * as UrlUtils from "../../utils/ApiPathConst";
  11. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  12. const OrganizationDetailPage = () => {
  13. const params = useParams();
  14. const [formData, setFormData] = useState({})
  15. const [isLoading, setLoding] = useState(true);
  16. const navigate = useNavigate();
  17. useEffect(()=>{
  18. console.log(formData);
  19. loadData();
  20. },[]);
  21. const loadData = ()=>{
  22. setLoding(true);
  23. if(params.id>0){
  24. HttpUtils.get({
  25. url: UrlUtils.GET_ORG_FROM_USER_PATH+"/"+params.id,
  26. onSuccess: function(response){
  27. setFormData(response.data)
  28. }
  29. });
  30. }else{
  31. navigate('/org/0');
  32. }
  33. };
  34. useEffect(() => {
  35. setLoding(false);
  36. }, [formData]);
  37. return (
  38. isLoading ?
  39. <LoadingComponent/>
  40. :
  41. <Grid container rowSpacing={4.5} columnSpacing={2.75}>
  42. <Grid item xs={12} sx={{mb: -2.25}}>
  43. <Typography variant="h5">Organization (Create From User)</Typography>
  44. </Grid>
  45. {/*col 1*/}
  46. <Grid item xs={12} >
  47. <Grid container>
  48. <Grid item xs={12} md={12} lg={12}>
  49. <InfoCard
  50. userData={formData}
  51. loadDataFun={loadData}
  52. id={params.id}
  53. />
  54. </Grid>
  55. </Grid>
  56. </Grid>
  57. {/*col 2*/}
  58. </Grid>
  59. );
  60. };
  61. export default OrganizationDetailPage;