// material-ui
import * as React from 'react';
import {FiDataGrid} from "components/FiDataGrid";
// import dayjs from "dayjs";
// import {
//     Button
// } from '@mui/material';
import * as DateUtils from "utils/DateUtils"
import * as StatusUtils from "utils/statusUtils/PublicNoteStatusUtils";
import {useTheme} from "@emotion/react";
import {useMediaQuery} from "@mui/material";

// ==============================|| EVENT TABLE ||============================== //

export default function StatusHistoryTab({rows}) {
    const theme = useTheme();
    const isMdOrLg = useMediaQuery(theme.breakpoints.up('md'));

    const columns = [
        {
            id: 'created',
            field: 'created',
            headerName: 'Date',
            width: isMdOrLg ? 'auto' : 160,
            flex: isMdOrLg ? 1 : undefined,
            valueGetter: (params) => {
                return DateUtils.datetimeStr(params?.value);
            }
            
        },
        {
            id: 'createdBy',
            field: 'createdBy',
            headerName: 'Changed By',
            width: isMdOrLg ? 'auto' : 160,
            flex: isMdOrLg ? 1 : undefined,
        },
        {
            id: 'status',
            field: 'status',
            headerName: 'Status',
            width: isMdOrLg ? 'auto' : 160,
            flex: isMdOrLg ? 1 : undefined,
            renderCell: (params) => {
                return [StatusUtils.getStatusEng(params)]
            },
        },
    ];

    return (
        <div style={{height:'20%', width: '98%'}}>
            <FiDataGrid
                rows={rows}
                columns={columns}
                customPageSize={5}
            />
        </div>
    );
}
