// material-ui import * as React from 'react'; import { DataGrid, GridActionsCellItem, } from "@mui/x-data-grid"; 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 [rowModesModel] = React.useState({}); 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, }, { id: 'enCompanyName', field: 'enCompanyName', headerName: 'Name (Eng)', flex: 1, }, { id: 'chCompanyName', field: 'chCompanyName', headerName: 'Name (Ch)', flex: 1, }, { id: 'contactTel', field: 'contactTel', headerName: 'Tel.', flex: 1, 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: 'Expiry Date', flex: 1, valueGetter:(params)=>{ return DateUtils.dateStr(params?.value); } }, ]; return (
); }