// material-ui import * as React from 'react'; import { DataGrid, GridActionsCellItem, } from "@mui/x-data-grid"; import EditIcon from '@mui/icons-material/Edit'; import PictureAsPdfIcon from '@mui/icons-material/PictureAsPdf'; import {useContext, useEffect} from "react"; import {useNavigate} from "react-router-dom"; import {CustomNoRowsOverlay, dateComparator, getDateString} from "../../../utils/CommonFunction"; import AbilityContext from "../../../components/AbilityProvider"; import {LIONER_BUTTON_THEME} from "../../../themes/colorConst"; import {ThemeProvider} from "@emotion/react"; // ==============================|| PDF TABLE ||============================== // export default function PdfTable({recordList}) { const [rows, setRows] = React.useState(recordList); const [rowModesModel] = React.useState({}); const navigate = useNavigate() const ability = useContext(AbilityContext); const [paginationModel, setPaginationModel] = React.useState({ page: 0, pageSize:10 }); useEffect(() => { setPaginationModel({page:0,pageSize:10}); setRows(recordList); }, [recordList]); const handleEditClick = (id) => () => { navigate(`/pdf/maintain/${id}`); }; const columns = [ { field: 'actions', type: 'actions', headerName: 'Actions', // flex: 0.5, width: 100, cellClassName: 'actions', getActions: ({id}) => { return [ } label="Edit" className="textPrimary" onClick={handleEditClick(id)} color="edit" // disabled={'true'} // disabled={!ability.can('VIEW','DASHBOARD')} /> ] }, }, // { // id: 'title', // field: 'title', // headerName: 'Title', // // sortComparator: dateComparator, // flex: 0.75, // renderCell: (params) => ( //
// {params.value} //
// //
// // {getDateString(params.row.pdfFrom,false)} // //
// ), // }, { id: 'templateId', field: 'templateId', headerName: 'Form Name', flex: 2, renderCell: (params) => { return (
{params.value}
); } }, { id: 'createDate', field: 'createDate', headerName: 'Create Date', flex: 1, sortComparator: dateComparator, renderCell: (params) => (
{getDateString(params.row.created, 'dd/MM/yyyy')}
), }, { id: 'modified', field: 'modified', headerName: 'Modified Date', flex: 1, sortComparator: dateComparator, renderCell: (params) => (
{getDateString(params.row.modified, 'dd/MM/yyyy')}
), }, // { // id: 'lastname', // field: 'lastname', // headerName: 'Last Name', // flex: 1.5, // sortComparator: dateComparator, // renderCell: (params) => ( //
// {params.value} //
// //
// // {getDateString(params.row.startDate,false)} // //
// ), // }, // { // id: 'firstname', // field: 'firstname', // headerName: 'First Name', // // sortComparator: dateComparator, // flex: 2, // renderCell: (params) => ( //
// {params.value} //
// //
// // {getDateString(params.row.applicationDeadline,false)} // //
// ), // }, // { // id: 'email', // field: 'email', // headerName: 'Email', // flex: 1.5, // renderCell: (params) => { // return ( //
// {params.value} //
// ); // } // }, // { // id: 'phone1', // field: 'phone1', // headerName: 'Phone No.', // flex: 1, // renderCell: (params) => { // return ( //
// {params.value} //
// ); // } // }, // { // id: 'phone2', // field: 'phone2', // headerName: '2nd Phone No.', // flex: 1, // renderCell: (params) => { // return ( //
// {params.value} //
// ); // } // }, { id: 'remarks', field: 'remarks', headerName: 'Remarks', flex: 2, renderCell: (params) => { return (
{params.value}
); } }, ]; return ( 'auto'} paginationModel={paginationModel} onPaginationModelChange={setPaginationModel} slots={{ noRowsOverlay: () => ( CustomNoRowsOverlay() ) }} pageSizeOptions={[10]} autoHeight /> ); }