// material-ui import * as React from 'react'; import { GridActionsCellItem, } from "@mui/x-data-grid"; import { FiDataGrid } from "components/FiDataGrid"; import EditIcon from '@mui/icons-material/Visibility'; import { useEffect } from "react"; import { useNavigate } from "react-router-dom"; import * as DateUtils from "utils/DateUtils"; // ==============================|| EVENT TABLE ||============================== // export default function OrganizationTable({ recordList }) { const [rows, setRows] = React.useState(recordList); const navigate = useNavigate() useEffect(() => { setRows(recordList); }, [recordList]); const handleActionClick = (id) => () => { navigate('/org/' + id); }; const columns = [ { field: 'actions', type: 'actions', headerName: 'Actions', width: 100, cellClassName: 'actions', getActions: ({ id }) => { return [ } label="Edit" className="textPrimary" onClick={handleActionClick(id)} color="primary" />] }, }, { id: 'brNo', field: 'brNo', headerName: 'BR No.', flex: 1, minWidth: 150, }, { id: 'enCompanyName', field: 'enCompanyName', headerName: 'Name (Eng)', flex: 1, minWidth: 200, }, { id: 'chCompanyName', field: 'chCompanyName', headerName: 'Name (Ch)', flex: 1, minWidth: 150, }, { id: 'contactTel', field: 'contactTel', headerName: 'Phone', flex: 1, minWidth: 150, renderCell: (params) => { let phone = JSON.parse(params.value); let contact = ""; if (phone && phone.phoneNumber) { contact = phone?.countryCode + " " + phone?.phoneNumber } return contact; } }, { id: 'brExpiryDate', field: 'brExpiryDate', headerName: 'BR Expiry Date', flex: 1, minWidth: 150, valueGetter: (params) => { return DateUtils.dateValue(params?.value); } }, { id: 'creditor', field: 'creditor', headerName: 'Credit Client', width: 150, minWidth: 150, valueGetter: (params) => { return params?.value?"Yes":""; } }, ]; function handleRowDoubleClick(params) { navigate('/org/' + params.id); } return (
); }