選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

index.js 4.3 KiB

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