You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

115 lines
3.5 KiB

  1. // material-ui
  2. import {
  3. Grid,
  4. Typography,
  5. Stack
  6. } from '@mui/material';
  7. import MainCard from "components/MainCard";
  8. import * as UrlUtils from "utils/ApiPathConst";
  9. import * as React from "react";
  10. import * as HttpUtils from "utils/HttpUtils";
  11. import * as DateUtils from "utils/DateUtils";
  12. import Loadable from 'components/Loadable';
  13. const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent')));
  14. const SearchForm = Loadable(React.lazy(() => import('./SearchForm')));
  15. const EventTable = Loadable(React.lazy(() => import('./DataGrid')));
  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 UserSearchPage_Individual = () => {
  28. const [record,setRecord] = React.useState([]);
  29. const [issueCombo,setIssueCombo] = React.useState([]);
  30. const [searchCriteria, setSearchCriteria] = React.useState({
  31. dateTo: DateUtils.dateStr(new Date()),
  32. dateFrom: DateUtils.dateStr(new Date().setDate(new Date().getDate()-14)),
  33. });
  34. const [onReady, setOnReady] = React.useState(false);
  35. React.useEffect(() => {
  36. getIssueCombo();
  37. }, []);
  38. React.useEffect(() => {
  39. setOnReady(true);
  40. }, [record]);
  41. React.useEffect(() => {
  42. loadGrid();
  43. }, [searchCriteria]);
  44. function loadGrid(){
  45. HttpUtils.get({
  46. url: UrlUtils.LIST_PROOF,
  47. params: searchCriteria,
  48. onSuccess: function(responseData){
  49. setRecord(responseData);
  50. }
  51. });
  52. }
  53. function getIssueCombo(){
  54. HttpUtils.get({
  55. url: UrlUtils.GET_ISSUE_COMBO,
  56. onSuccess: function(responseData){
  57. let combo = responseData;
  58. setIssueCombo(combo);
  59. }
  60. });
  61. }
  62. function applySearch(input) {
  63. setSearchCriteria(input);
  64. }
  65. return (
  66. !onReady ?
  67. <LoadingComponent/>
  68. :
  69. <Grid container sx={{minHeight: '85vh',backgroundColor:'#ffffff'}} direction="column">
  70. <Grid item xs={12}>
  71. <div style={BackgroundHead}>
  72. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  73. <Typography ml={15} color='#FFF' variant="h4">校對記錄</Typography>
  74. </Stack>
  75. </div>
  76. </Grid>
  77. {/*row 1*/}
  78. <Grid item xs={12} md={12} lg={12}>
  79. <SearchForm
  80. applySearch={applySearch}
  81. issueComboData={issueCombo}
  82. searchCriteria={searchCriteria}
  83. />
  84. </Grid>
  85. {/*row 2*/}
  86. <Grid item xs={12} md={12} lg={12}>
  87. <MainCard elevation={0}
  88. border={false}
  89. content={false}
  90. sx={{width: "-webkit-fill-available"}}
  91. >
  92. <EventTable
  93. recordList={record}
  94. />
  95. </MainCard>
  96. </Grid>
  97. </Grid>
  98. );
  99. };
  100. export default UserSearchPage_Individual;