Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

114 Zeilen
4.4 KiB

  1. // material-ui
  2. import {Grid, Typography, Stack, Box} 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 {useNavigate} from "react-router-dom";
  8. import * as UrlUtils from "utils/ApiPathConst";
  9. import * as DateUtils from "utils/DateUtils";
  10. import {getObjectByType} from "utils/CommonFunction";
  11. import * as ComboData from "utils/ComboData";
  12. import Loadable from 'components/Loadable';
  13. import { lazy } from 'react';
  14. const InfoCard = Loadable(lazy(() => import('./OrganizationCard_loadFromUser')));
  15. const LoadingComponent = Loadable(lazy(() => import('pages/extra-pages/LoadingComponent')));
  16. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  17. const BackgroundHead = {
  18. backgroundImage: `url(${titleBackgroundImg})`,
  19. width: '100%',
  20. height: '100%',
  21. backgroundSize: 'contain',
  22. backgroundRepeat: 'no-repeat',
  23. backgroundColor: '#0C489E',
  24. backgroundPosition: 'right'
  25. }
  26. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  27. const OrganizationDetailPage_FromUser = () => {
  28. const params = useParams();
  29. const [formData, setFormData] = useState({})
  30. const [isLoading, setLoding] = useState(true);
  31. const navigate = useNavigate();
  32. useEffect(()=>{
  33. // console.log(formData);
  34. loadData();
  35. },[]);
  36. const loadData = ()=>{
  37. setLoding(true);
  38. if(params.id>0){
  39. HttpUtils.get({
  40. url: UrlUtils.GET_ORG_FROM_USER_PATH+"/"+params.id,
  41. onSuccess: function(response){
  42. response.data["country"] = getObjectByType(ComboData.country, "type", response.data.addressTemp?.country);
  43. response.data["district"] = getObjectByType(ComboData.district, "type", response.data.addressTemp?.district);
  44. response.data["addressLine1"] = response.data.addressTemp?.addressLine1;
  45. response.data["addressLine2"] = response.data.addressTemp?.addressLine2;
  46. response.data["addressLine3"] = response.data.addressTemp?.addressLine3;
  47. response.data["phoneNumber"] = response.data.contactTel?.phoneNumber;
  48. response.data["tel_countryCode"] = response.data.contactTel?.countryCode;
  49. response.data["faxNumber"] = response.data.faxNo?.faxNumber;
  50. response.data["fax_countryCode"] = response.data.faxNo?.countryCode;
  51. response.data["brExpiryDate"] = response.data.brExpiryDate?DateUtils.dateStr(response.data.brExpiryDate): "";
  52. setFormData(response.data)
  53. }
  54. });
  55. }else{
  56. navigate('/org/0');
  57. }
  58. };
  59. useEffect(() => {
  60. setLoding(false);
  61. }, [formData]);
  62. return (
  63. isLoading ?
  64. <Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center">
  65. <Grid item>
  66. <LoadingComponent />
  67. </Grid>
  68. </Grid>
  69. :
  70. <Grid container direction="column" sx={{minHeight: '87vh',backgroundColor:'#ffffff' }}>
  71. <Grid item xs={12}>
  72. <div style={BackgroundHead}>
  73. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  74. <Typography ml={15} color='#FFF' variant="h4" sx={{display: { xs: 'none', sm: 'none', md: 'block' }}}>
  75. Organisation (Create From User)
  76. </Typography>
  77. </Stack>
  78. </div>
  79. </Grid>
  80. {/*col 1*/}
  81. <Grid item xs={12} >
  82. <Grid container>
  83. <Grid item xs={12} md={12} lg={12}>
  84. <Box xs={12} ml={0} mt={-1} mr={0} sx={{ p: 1, borderRadius: '10px' }}>
  85. <InfoCard
  86. userData={formData}
  87. userId={params.id}
  88. />
  89. </Box>
  90. </Grid>
  91. </Grid>
  92. </Grid>
  93. {/*col 2*/}
  94. </Grid>
  95. );
  96. };
  97. export default OrganizationDetailPage_FromUser;