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.

79 lines
2.4 KiB

  1. // material-ui
  2. import * as React from 'react';
  3. import { useTheme, useMediaQuery } from '@mui/material';
  4. import {FiDataGrid} from "components/FiDataGrid";
  5. import * as DateUtils from "utils/DateUtils"
  6. import * as StatusUtils from "utils/statusUtils/PublicNoteStatusUtils";
  7. import {GET_PUBLIC_NOTICE_APPLY_DETAIL_STATUS_HISTORY } from "utils/ApiPathConst"
  8. // ==============================|| EVENT TABLE ||============================== //
  9. export default function StatusHistoryTab({appId, setCount}) {
  10. const { useState, useEffect } = React;
  11. const theme = useTheme();
  12. const isMdOrLg = useMediaQuery(theme.breakpoints.up('md'));
  13. const [_appId, set_appId] = useState({});
  14. useEffect(() => {
  15. set_appId(appId);
  16. }, [appId]);
  17. useEffect(() => {
  18. set_appId(appId);
  19. }, []);
  20. const renderHeaderWithAria = (params) => (
  21. <span aria-label={params.colDef.headerName}>{params.colDef.headerName}</span>
  22. );
  23. const columns = [
  24. {
  25. id: 'created',
  26. field: 'created',
  27. headerName: 'Date',
  28. width: isMdOrLg ? 'auto' : 160,
  29. flex: isMdOrLg ? 1 : undefined,
  30. renderHeader: renderHeaderWithAria,
  31. valueGetter: (params) => {
  32. return DateUtils.datetimeStr(params?.value);
  33. }
  34. },
  35. {
  36. id: 'createdBy',
  37. field: 'createdBy',
  38. headerName: 'Changed By',
  39. width: isMdOrLg ? 'auto' : 160,
  40. flex: isMdOrLg ? 1 : undefined,
  41. renderHeader: renderHeaderWithAria,
  42. },
  43. {
  44. id: 'status',
  45. field: 'status',
  46. headerName: 'Status',
  47. width: isMdOrLg ? 'auto' : 160,
  48. flex: isMdOrLg ? 1 : undefined,
  49. renderHeader: renderHeaderWithAria,
  50. renderCell: (params) => {
  51. return StatusUtils.getStatusEng(params);
  52. },
  53. },
  54. ];
  55. return (
  56. <div style={{height:'20%', width: '100%'}}>
  57. <FiDataGrid
  58. columns={columns}
  59. customPageSize={10}
  60. doLoad={{
  61. url: GET_PUBLIC_NOTICE_APPLY_DETAIL_STATUS_HISTORY+"/"+_appId,
  62. params: {},
  63. callback: function (responseData) {
  64. setCount(responseData?.count);
  65. }
  66. }}
  67. />
  68. </div>
  69. );
  70. }