diff --git a/src/views/biz/judge/ModalJudgeDetail.jsx b/src/views/biz/judge/ModalJudgeDetail.jsx index 65f98c4..b052aaf 100644 --- a/src/views/biz/judge/ModalJudgeDetail.jsx +++ b/src/views/biz/judge/ModalJudgeDetail.jsx @@ -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 ( - <> -