// material-ui
import * as React from 'react';
import { GridActionsCellItem } from "@mui/x-data-grid";
import { FiDataGrid } from "components/FiDataGrid";
//import VisibilityIcon from '@mui/icons-material/Visibility';
import HighlightOff from '@mui/icons-material/HighlightOff';
import CheckCircleOutline from '@mui/icons-material/CheckCircleOutline';
import { useEffect } from "react";
import { useNavigate } from "react-router-dom";
import * as DateUtils from "utils/DateUtils";
import { GET_IND_USER_PATH } from "utils/ApiPathConst";
import { clickableLink} from 'utils/CommonFunction';
// ==============================|| EVENT TABLE ||============================== //
export default function UserTable_Individual({ searchCriteria }) {
const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria);
const navigate = useNavigate()
useEffect(() => {
set_searchCriteria(searchCriteria);
}, [searchCriteria]);
// const handleActionClick = (id) => () => {
// navigate('/indUser/' + id);
// };
const columns = [
// {
// field: 'actions',
// type: 'actions',
// headerName: 'Actions',
// width: 100,
// cellClassName: 'actions',
// getActions: ({ id }) => {
// return [
// }
// label="View"
// className="textPrimary"
// onClick={handleActionClick(id)}
// color="primary"
// />]
// },
// },
{
id: 'username',
field: 'username',
headerName: 'Username',
flex: 1,
minWidth: 150,
renderCell: (params) => {
return clickableLink('/indUser/'+ params.row.id, params.row.username);
},
},
{
id: 'enName',
field: 'enName',
headerName: 'Name (Eng)',
flex: 1,
minWidth: 150,
},
{
id: 'chName',
field: 'chName',
headerName: 'Name (Ch)',
flex: 1,
minWidth: 150,
},
{
id: 'mobileNumber',
field: 'mobileNumber',
headerName: 'Phone',
flex: 1,
minWidth: 150,
valueGetter: (params) => {
if (params.value) {
let tel = JSON.parse(params.value);
if(tel?.phoneNumber)
return "+" + tel?.countryCode + " " + tel?.phoneNumber;
else return "";
}
}
},
{
id: 'emailAddress',
field: 'emailAddress',
headerName: 'Email',
flex: 1,
minWidth: 150,
},
{
id: 'lastLogin',
field: 'lastLogin',
headerName: 'Last Login',
flex: 1,
minWidth: 200,
valueGetter: (params) => {
if (params.value) {
return DateUtils.datetimeStr(params.value);
}
}
},
{
id: 'locked',
field: 'locked',
headerName: 'Status',
flex: 1,
minWidth: 100,
valueGetter: (params) => {
if (params.value) {
return "Locked";
} else {
return "Active";
}
}
},
{
field: 'verifiedDate',
type: 'actions',
headerName: 'Verified',
width: 100,
cellClassName: 'actions',
getActions: (params) => {
if (params.row.verifiedDate)
return [
}
color="success"
/>];
return [
}
color="error"
/>];
},
},
];
function handleRowDoubleClick(params) {
navigate('/indUser/' + params.id);
}
return (
);
}