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

OrganizationTable.js 3.6 KiB

2年前
2年前
1年前
2年前
1年前
2年前
1年前
1年前
2年前
2年前
2年前
1年前
2年前
1年前
2年前
1年前
2年前
2年前
1年前
2年前
2年前
1年前
2年前
1年前
2年前
2年前
1年前
1年前
1年前
2年前
2年前
2年前
1年前
2年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. // material-ui
  2. import * as React from 'react';
  3. // import {
  4. // GridActionsCellItem,
  5. // } from "@mui/x-data-grid";
  6. import { FiDataGrid } from "components/FiDataGrid";
  7. //import EditIcon from '@mui/icons-material/Visibility';
  8. import { useNavigate } from "react-router-dom";
  9. import * as DateUtils from "utils/DateUtils";
  10. import { clickableLink} from 'utils/CommonFunction';
  11. import {GET_ORG_PATH} from "utils/ApiPathConst";
  12. // ==============================|| EVENT TABLE ||============================== //
  13. export default function OrganizationTable({ searchCriteria }) {
  14. const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria);
  15. const navigate = useNavigate()
  16. React.useEffect(() => {
  17. set_searchCriteria(searchCriteria);
  18. }, [searchCriteria]);
  19. // const handleActionClick = (id) => () => {
  20. // navigate('/org/' + id);
  21. // };
  22. const columns = [
  23. // {
  24. // field: 'actions',
  25. // type: 'actions',
  26. // headerName: 'Actions',
  27. // width: 100,
  28. // cellClassName: 'actions',
  29. // getActions: ({ id }) => {
  30. // return [
  31. // <GridActionsCellItem
  32. // key="OutSave"
  33. // icon={<EditIcon />}
  34. // label="Edit"
  35. // className="textPrimary"
  36. // onClick={handleActionClick(id)}
  37. // color="primary"
  38. // />]
  39. // },
  40. // },
  41. {
  42. id: 'brNo',
  43. field: 'brNo',
  44. headerName: 'BR No.',
  45. flex: 1,
  46. minWidth: 150,
  47. renderCell: (params) => {
  48. return clickableLink('/org/'+ params.row.id, params.row.brNo);
  49. },
  50. },
  51. {
  52. id: 'enCompanyName',
  53. field: 'enCompanyName',
  54. headerName: 'Name (Eng)',
  55. flex: 1,
  56. minWidth: 200,
  57. },
  58. {
  59. id: 'chCompanyName',
  60. field: 'chCompanyName',
  61. headerName: 'Name (Ch)',
  62. flex: 1,
  63. minWidth: 150,
  64. },
  65. {
  66. id: 'contactTel',
  67. field: 'contactTel',
  68. headerName: 'Phone',
  69. flex: 1,
  70. minWidth: 150,
  71. renderCell: (params) => {
  72. let phone = JSON.parse(params.value);
  73. let contact = "";
  74. if (phone && phone.phoneNumber) {
  75. contact = phone?.countryCode + " " + phone?.phoneNumber
  76. }
  77. return contact;
  78. }
  79. },
  80. {
  81. id: 'brExpiryDate',
  82. field: 'brExpiryDate',
  83. headerName: 'BR Expiry Date',
  84. flex: 1,
  85. minWidth: 150,
  86. valueGetter: (params) => {
  87. return DateUtils.dateValue(params?.value);
  88. }
  89. },
  90. {
  91. id: 'creditor',
  92. field: 'creditor',
  93. headerName: 'Credit Client',
  94. width: 150,
  95. minWidth: 150,
  96. valueGetter: (params) => {
  97. return params?.value?"Yes":"";
  98. }
  99. },
  100. ];
  101. function handleRowDoubleClick(params) {
  102. navigate('/org/' + params.id);
  103. }
  104. return (
  105. <div style={{ height: "fit-content", width: '100%' }}>
  106. <FiDataGrid
  107. columns={columns}
  108. customPageSize={5}
  109. onRowDoubleClick={handleRowDoubleClick}
  110. doLoad={{
  111. url: GET_ORG_PATH,
  112. params: _searchCriteria,
  113. }}
  114. />
  115. </div>
  116. );
  117. }