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.
 
 

105 lines
3.4 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 Index = () => {
  28. const [record,setRecord] = React.useState([]);
  29. const [searchCriteria, setSearchCriteria] = React.useState({
  30. dateTo: DateUtils.dateValue(new Date()),
  31. dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate()-14)),
  32. });
  33. const [onReady, setOnReady] = React.useState(false);
  34. React.useEffect(() => {
  35. setOnReady(true);
  36. }, [record]);
  37. React.useEffect(() => {
  38. loadGrid();
  39. }, [searchCriteria]);
  40. function loadGrid(){
  41. HttpUtils.get({
  42. url: UrlUtils.PAYMENT_LIST,
  43. params: searchCriteria,
  44. onSuccess: function(responseData){
  45. setRecord(responseData);
  46. }
  47. });
  48. }
  49. function applySearch(input) {
  50. setSearchCriteria(input);
  51. }
  52. return (
  53. !onReady ?
  54. <Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center">
  55. <Grid item>
  56. <LoadingComponent />
  57. </Grid>
  58. </Grid>
  59. :
  60. <Grid container sx={{minHeight: '87vh', backgroundColor: 'backgroundColor.default'}} direction="column">
  61. <Grid item xs={12}>
  62. <div style={BackgroundHead}>
  63. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  64. <Typography ml={15} color='#FFF' variant="h4" sx={{ "textShadow": "0px 0px 25px #0C489E" }}>
  65. Online Payment Record
  66. </Typography>
  67. </Stack>
  68. </div>
  69. </Grid>
  70. {/*row 1*/}
  71. <Grid item xs={12} md={12} lg={12} sx={{mb:-1}}>
  72. <SearchForm
  73. applySearch={applySearch}
  74. searchCriteria={searchCriteria}
  75. />
  76. </Grid>
  77. {/*row 2*/}
  78. <Grid item xs={12} md={12} lg={12}>
  79. <MainCard elevation={0}
  80. border={false}
  81. content={false}
  82. sx={{width: "-webkit-fill-available"}}
  83. >
  84. <EventTable
  85. recordList={record}
  86. />
  87. </MainCard>
  88. </Grid>
  89. </Grid>
  90. );
  91. };
  92. export default Index;