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ů.
 
 

151 řádky
5.8 KiB

  1. // material-ui
  2. import {
  3. Grid,
  4. Typography,
  5. Stack,
  6. Box,
  7. Button
  8. } from '@mui/material';
  9. import * as UrlUtils from "utils/ApiPathConst";
  10. import * as React from "react";
  11. import * as HttpUtils from "utils/HttpUtils";
  12. import * as DateUtils from "utils/DateUtils";
  13. import * as FormatUtils from "utils/FormatUtils";
  14. import { useParams } from "react-router-dom";
  15. import { useNavigate } from "react-router-dom";
  16. import ForwardIcon from '@mui/icons-material/Forward';
  17. import Loadable from 'components/Loadable';
  18. const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent')));
  19. const ApplicationDetails = Loadable(React.lazy(() => import('./ApplicationDetails')));
  20. const ProofForm = Loadable(React.lazy(() => import('./ProofForm')));
  21. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  22. const BackgroundHead = {
  23. backgroundImage: `url(${titleBackgroundImg})`,
  24. width: '100%',
  25. height: '100%',
  26. backgroundSize: 'contain',
  27. backgroundRepeat: 'no-repeat',
  28. backgroundColor: '#0C489E',
  29. backgroundPosition: 'right'
  30. }
  31. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  32. const Index = () => {
  33. const params = useParams();
  34. const navigate = useNavigate()
  35. const [record, setRecord] = React.useState();
  36. const [onReady, setOnReady] = React.useState(false);
  37. const _sx = {
  38. padding: "4 2 4 2",
  39. boxShadow: 1,
  40. border: 1,
  41. borderColor: '#DDD',
  42. '& .MuiDataGrid-cell': {
  43. borderTop: 1,
  44. borderBottom: 1,
  45. borderColor: "#EEE"
  46. },
  47. '& .MuiDataGrid-footerContainer': {
  48. border: 1,
  49. borderColor: "#EEE"
  50. }
  51. }
  52. React.useEffect(() => {
  53. loadForm();
  54. }, []);
  55. React.useEffect(() => {
  56. setOnReady(true);
  57. }, [record]);
  58. const loadForm = () => {
  59. if (params.id > 0) {
  60. HttpUtils.get({
  61. url: UrlUtils.GET_PROOF + "/" + params.id,
  62. onSuccess: (responseData) => {
  63. if (!responseData.data?.id) {
  64. navigate("/proof/search");
  65. }
  66. responseData.data["phoneNumber"] = JSON.parse(responseData.data.contactTelNo).phoneNumber;
  67. responseData.data["tel_countryCode"] = JSON.parse(responseData.data.contactTelNo).countryCode;
  68. responseData.data["faxNumber"] = JSON.parse(responseData.data.contactFaxNo).faxNumber;
  69. responseData.data["fax_countryCode"] = JSON.parse(responseData.data.contactFaxNo).countryCode;
  70. responseData.data["issueNoStr"] = responseData.data.issueYear
  71. + " Vol. " + FormatUtils.zeroPad(responseData.data.issueVolume, 3)
  72. + ", No. " + FormatUtils.zeroPad(responseData.data.issueNo, 2);
  73. responseData.data["issueDateStr"] = DateUtils.dateFormat(responseData.data.issueDate, "D MMM YYYY (ddd)");
  74. responseData.data["groupType"] = responseData.data.groupNo.charAt(0);
  75. responseData.data["action"] = responseData.data.replyDate ? responseData.data.action : true;
  76. setRecord(responseData.data);
  77. }
  78. });
  79. }
  80. }
  81. return (
  82. !onReady ?
  83. <LoadingComponent />
  84. :
  85. (
  86. <Grid container sx={{ minHeight: '110vh', backgroundColor: '#fff' }} direction="column" justifyContent="flex-start" alignItems="center" >
  87. <Grid item xs={12} width="100%">
  88. <div style={BackgroundHead} width="100%">
  89. <Stack direction="row" height='70px'>
  90. <Typography ml={15} color='#FFF' variant="h4" sx={{ pt: 2 }}>校對記錄</Typography>
  91. </Stack>
  92. </div>
  93. </Grid>
  94. <Grid item xs={12} width="95%">
  95. <Button sx={{ ml: 1.5, mt: 2.5 }} style={{ border: '2px solid' }} variant="outlined" onClick={() => { navigate("/proof/search") }}>
  96. <ForwardIcon style={{ height: 30, width: 50, transform: "rotate(180deg)" }} />
  97. </Button>
  98. </Grid>
  99. {/*row 1*/}
  100. <Grid item xs={12} md={12} >
  101. <Grid container justifyContent="flex-start" alignItems="center" >
  102. <center>
  103. <Grid item xs={12} md={12} sx={{ pt: 2 }}>
  104. <Box xs={12} md={12} sx={{ p: 4, border: '0px groove grey', borderRadius: '10px', ..._sx }}>
  105. <ApplicationDetails
  106. formData={record}
  107. style={{
  108. display: "flex",
  109. height: "100%",
  110. flex: 1
  111. }}
  112. />
  113. </Box>
  114. </Grid>
  115. <Grid item xs={12} md={12} sx={{ pt: 1, pb: 2 }}>
  116. <Box xs={12} md={12} sx={{ p: 4, border: '0px groove grey', borderRadius: '10px', ..._sx }}>
  117. <ProofForm
  118. formData={record}
  119. />
  120. </Box>
  121. </Grid>
  122. </center>
  123. </Grid>
  124. </Grid>
  125. {/*row 2*/}
  126. </Grid >
  127. )
  128. );
  129. };
  130. export default Index;