|
|
|
@ -1,6 +1,26 @@
|
|
|
|
|
import Board from '../board/Board';
|
|
|
|
|
import { useCallback, useEffect, useState } from 'react';
|
|
|
|
|
import { findJudgeDetails } from 'apis/judge';
|
|
|
|
|
import { findJudge, findJudgeDetails } from 'apis/judge';
|
|
|
|
|
import {
|
|
|
|
|
Box,
|
|
|
|
|
Checkbox,
|
|
|
|
|
IconButton,
|
|
|
|
|
Table,
|
|
|
|
|
TableBody,
|
|
|
|
|
TableCell,
|
|
|
|
|
TableContainer,
|
|
|
|
|
TableHead,
|
|
|
|
|
TablePagination,
|
|
|
|
|
TableSortLabel,
|
|
|
|
|
TableRow,
|
|
|
|
|
Toolbar,
|
|
|
|
|
Tooltip,
|
|
|
|
|
Typography
|
|
|
|
|
} from '@mui/material';
|
|
|
|
|
import { visuallyHidden } from '@mui/utils';
|
|
|
|
|
|
|
|
|
|
// project imports
|
|
|
|
|
import MainCard from 'ui-component/cards/MainCard';
|
|
|
|
|
|
|
|
|
|
const ModalDetails = ({ msDatagb, msSdate, msEdate, msChasu, msuTeam }) => {
|
|
|
|
|
const [rowData, setRowData] = useState({});
|
|
|
|
@ -12,6 +32,11 @@ const ModalDetails = ({ msDatagb, msSdate, msEdate, msChasu, msuTeam }) => {
|
|
|
|
|
rows: []
|
|
|
|
|
// loading: false
|
|
|
|
|
});
|
|
|
|
|
const [rows, setRows] = useState([]);
|
|
|
|
|
|
|
|
|
|
const columns = [];
|
|
|
|
|
|
|
|
|
|
const tableHeader = null;
|
|
|
|
|
|
|
|
|
|
const search = useCallback(() => {
|
|
|
|
|
const params = {
|
|
|
|
@ -27,27 +52,36 @@ const ModalDetails = ({ msDatagb, msSdate, msEdate, msChasu, msuTeam }) => {
|
|
|
|
|
console.log(response.data);
|
|
|
|
|
const totUserList = response.data?.totUserList;
|
|
|
|
|
const resultList = response.data?.resultList;
|
|
|
|
|
const gridRows = [];
|
|
|
|
|
const aaa = resultList.map((m) => {
|
|
|
|
|
// const users = m.simsa.map((u) => ({ ...m, name: u.NAME, msResult: u.msResult, msuResult: u.msuResult }));
|
|
|
|
|
m.simsa.reduce((pre, cur) => {
|
|
|
|
|
console.log(pre, cur);
|
|
|
|
|
// return pre.concat(cur);
|
|
|
|
|
return { pre, ...cur };
|
|
|
|
|
setRows(() => {
|
|
|
|
|
resultList.map((m) => {
|
|
|
|
|
let result = { ...m };
|
|
|
|
|
const users = [...m.simsa];
|
|
|
|
|
delete result.simsa;
|
|
|
|
|
users.map((u) => {
|
|
|
|
|
result = { ...result, [u.NAME]: u.msResult };
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
// return users.map((u) => ({ ...result, [u.NAME]: u.msResult }));
|
|
|
|
|
});
|
|
|
|
|
Object.keys(rows[0]).forEach((k) => {
|
|
|
|
|
columns.push(k);
|
|
|
|
|
});
|
|
|
|
|
return m;
|
|
|
|
|
});
|
|
|
|
|
/*
|
|
|
|
|
gridRows.push({
|
|
|
|
|
msMainCode: m.msMainCode,
|
|
|
|
|
msSeq: m.msSeq,
|
|
|
|
|
msCarnum: m.msCarnum,
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
*/
|
|
|
|
|
// Object.keys(gridRows[0]).forEach((k) => {
|
|
|
|
|
// // console.log(k, v);
|
|
|
|
|
// columns.push({ headerName: k, headerAlign: 'center', field: k, align: 'center' });
|
|
|
|
|
// });
|
|
|
|
|
// setColdef(columns);
|
|
|
|
|
|
|
|
|
|
// for (const k in gridRows[0]) {
|
|
|
|
|
// columns.push({ headerName: k, headerAlign: 'center', field: k, align: 'center' });
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
setTotalCount(totUserList.length);
|
|
|
|
|
setRowsState((prevState) => ({ ...prevState, rows: response.data }));
|
|
|
|
|
setTotalCount(rows.length);
|
|
|
|
|
setRowsState((prevState) => ({ ...prevState, rows }));
|
|
|
|
|
// apiRef.current.forceUpdate(); // .updateRowData([]);
|
|
|
|
|
// apiRef.current.updateRowData([]);
|
|
|
|
|
}
|
|
|
|
@ -64,9 +98,34 @@ const ModalDetails = ({ msDatagb, msSdate, msEdate, msChasu, msuTeam }) => {
|
|
|
|
|
}, [search]);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<h2>dkdkkdkd</h2>
|
|
|
|
|
</>
|
|
|
|
|
<MainCard content={false}>
|
|
|
|
|
<TableContainer>
|
|
|
|
|
<Table sx={{ minWidth: 650 }} size="small" aria-label="a dense table">
|
|
|
|
|
<TableHead>
|
|
|
|
|
<TableRow>
|
|
|
|
|
{columns.map((k) => (
|
|
|
|
|
<TableCell sx={{ pl: 3 }}>{k}</TableCell>
|
|
|
|
|
))}
|
|
|
|
|
</TableRow>
|
|
|
|
|
</TableHead>
|
|
|
|
|
<TableBody>
|
|
|
|
|
{/* {rows.map((row) => ( */}
|
|
|
|
|
{/* <TableRow hover key={row.name}> */}
|
|
|
|
|
{/* <TableCell sx={{ pl: 3 }} component="th" scope="row"> */}
|
|
|
|
|
{/* {row.name} */}
|
|
|
|
|
{/* </TableCell> */}
|
|
|
|
|
{/* <TableCell align="right">{row.calories}</TableCell> */}
|
|
|
|
|
{/* <TableCell align="right">{row.fat}</TableCell> */}
|
|
|
|
|
{/* <TableCell align="right">{row.carbs}</TableCell> */}
|
|
|
|
|
{/* <TableCell sx={{ pr: 3 }} align="right"> */}
|
|
|
|
|
{/* {row.protein} */}
|
|
|
|
|
{/* </TableCell> */}
|
|
|
|
|
{/* </TableRow> */}
|
|
|
|
|
{/* ))} */}
|
|
|
|
|
</TableBody>
|
|
|
|
|
</Table>
|
|
|
|
|
</TableContainer>
|
|
|
|
|
</MainCard>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
export default ModalDetails;
|
|
|
|
|