revoked changes
This commit is contained in:
parent
5d0bba824f
commit
995643abd5
@ -9,7 +9,6 @@ import TablePagination from '@mui/material/TablePagination';
|
|||||||
import TableRow from '@mui/material/TableRow';
|
import TableRow from '@mui/material/TableRow';
|
||||||
import { Button } from '@mui/material';
|
import { Button } from '@mui/material';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { useState } from 'react';
|
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
@ -33,7 +32,7 @@ const columns = [
|
|||||||
{
|
{
|
||||||
id: 'term',
|
id: 'term',
|
||||||
label: 'Term',
|
label: 'Term',
|
||||||
Cell: (row: any) => (
|
Cell: (row:any) => (
|
||||||
(row.perpetuity !== '' && row.perpetuity !== null)
|
(row.perpetuity !== '' && row.perpetuity !== null)
|
||||||
? (row.perpetuity !== "Yes" ? <span>{row.effective_from1} - {row.effective_to1}</span> : `${row.effective_from1} - Perpetual`)
|
? (row.perpetuity !== "Yes" ? <span>{row.effective_from1} - {row.effective_to1}</span> : `${row.effective_from1} - Perpetual`)
|
||||||
: ""
|
: ""
|
||||||
@ -42,7 +41,7 @@ const columns = [
|
|||||||
{
|
{
|
||||||
id: 'link',
|
id: 'link',
|
||||||
label: 'Link',
|
label: 'Link',
|
||||||
Cell: (row: any) => (
|
Cell: (row:any) => (
|
||||||
(row.cid === null || row.cid === 0 || row.effective_from1 === null)
|
(row.cid === null || row.cid === 0 || row.effective_from1 === null)
|
||||||
? <Button component={Link} to={{ pathname: `${process.env.PUBLIC_URL}/${row.id}/project-details` }} variant="contained" size="small">Link</Button>
|
? <Button component={Link} to={{ pathname: `${process.env.PUBLIC_URL}/${row.id}/project-details` }} variant="contained" size="small">Link</Button>
|
||||||
: (row.published === 1
|
: (row.published === 1
|
||||||
@ -55,82 +54,79 @@ const columns = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
type Props={
|
||||||
const ProjectTableHead = () => (
|
projectData:any
|
||||||
<TableHead>
|
}
|
||||||
<TableRow>
|
|
||||||
{columns.map((column) => (
|
|
||||||
<TableCell
|
|
||||||
sx={{ bgcolor: '#171716', color: 'white', borderBottom: '#171716' }}
|
|
||||||
key={column.id}
|
|
||||||
style={{ minWidth: column.minWidth }}
|
|
||||||
>
|
|
||||||
{column.label}
|
|
||||||
</TableCell>
|
|
||||||
))}
|
|
||||||
</TableRow>
|
|
||||||
</TableHead>
|
|
||||||
);
|
|
||||||
|
|
||||||
type Props = {
|
|
||||||
projectData: any;
|
|
||||||
page:any;
|
|
||||||
rowsPerPage:any
|
|
||||||
};
|
|
||||||
|
|
||||||
const ProjectTable = ({ projectData, page, rowsPerPage }:Props) => (
|
|
||||||
<Table stickyHeader aria-label="sticky table">
|
|
||||||
<TableBody>
|
|
||||||
{projectData &&
|
|
||||||
projectData
|
|
||||||
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
||||||
.map((row:any) => (
|
|
||||||
<TableRow hover role="checkbox" tabIndex={-1} key={row.code}>
|
|
||||||
{columns.map((column) => (
|
|
||||||
<TableCell key={column.id}>{ typeof row[column.id] === 'number' ? (row[column.id]) : row[column.id]}</TableCell>
|
|
||||||
))}
|
|
||||||
</TableRow>
|
|
||||||
))}
|
|
||||||
</TableBody>
|
|
||||||
</Table>
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
export default function ProjectList({projectData}:Props) {
|
||||||
|
const [page, setPage] = React.useState(0);
|
||||||
|
const [rowsPerPage, setRowsPerPage] = React.useState(10);
|
||||||
|
|
||||||
|
const handleChangePage = (event:any, newPage:any) => {
|
||||||
const ProjectList = ({ projectData}: any) => {
|
|
||||||
const [page, setPage] = useState(0);
|
|
||||||
const [rowsPerPage, setRowsPerPage] = useState(10);
|
|
||||||
|
|
||||||
const handleChangePage = (event: any, newPage: React.SetStateAction<number>) => {
|
|
||||||
setPage(newPage);
|
setPage(newPage);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleChangeRowsPerPage = (event: { target: { value: string | number; }; }) => {
|
const handleChangeRowsPerPage = (event:any) => {
|
||||||
setRowsPerPage(+event.target.value);
|
setRowsPerPage(+event.target.value);
|
||||||
setPage(0);
|
setPage(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper square className="projectScreen-background" sx={{ width: '100%', overflow: 'hidden', backgroundColor: 'rgb(13 13 13)' }}>
|
<Paper square className='projectScreen-background' sx={{ width: '100%', overflow: 'hidden',backgroundColor:'rgb(13 13 13)' }}>
|
||||||
<Paper className="projectScreen-background" sx={{ margin: '1%', width: '100%', overflow: 'hidden' }}>
|
<Paper className='projectScreen-background' sx={{ margin:'1%', width: '100%', overflow: 'hidden' }}>
|
||||||
<TableContainer sx={{ maxHeight: '600px' }}>
|
<TableContainer sx={{ maxHeight: '600px'}}>
|
||||||
<ProjectTableHead />
|
<Table stickyHeader aria-label="sticky table">
|
||||||
<ProjectTable projectData={projectData} page={page} rowsPerPage={rowsPerPage} />
|
<TableHead >
|
||||||
</TableContainer>
|
<TableRow >
|
||||||
<TablePagination
|
{columns.map((column) => (
|
||||||
sx={{ bgcolor: '#171716', color: 'white' }}
|
<TableCell
|
||||||
rowsPerPageOptions={[10, 25, 100]}
|
sx={{bgcolor:'#171716',color:'white', borderBottom:'#171716'}}
|
||||||
component="div"
|
key={column.id}
|
||||||
count={projectData && projectData.length}
|
// align={column.align}
|
||||||
rowsPerPage={rowsPerPage}
|
style={{ minWidth: column.minWidth }}
|
||||||
page={page}
|
>
|
||||||
onPageChange={handleChangePage}
|
{column.label}
|
||||||
onRowsPerPageChange={handleChangeRowsPerPage}
|
</TableCell>
|
||||||
/>
|
))}
|
||||||
</Paper>
|
</TableRow>
|
||||||
|
</TableHead>
|
||||||
|
<TableBody>
|
||||||
|
{projectData && projectData
|
||||||
|
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
||||||
|
.map((row:any) => {
|
||||||
|
return (
|
||||||
|
<TableRow hover role="checkbox" tabIndex={-1} key={row.code}>
|
||||||
|
{columns.map((column:any) => {
|
||||||
|
const value = row[column.id];
|
||||||
|
return (
|
||||||
|
<TableCell key={column.id}
|
||||||
|
// align={column.align}
|
||||||
|
>
|
||||||
|
{column.format && typeof value === 'number'
|
||||||
|
? column.format(value)
|
||||||
|
: value}
|
||||||
|
</TableCell>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</TableRow>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</TableContainer>
|
||||||
|
<TablePagination
|
||||||
|
sx={{bgcolor:'#171716',color:'white'}}
|
||||||
|
rowsPerPageOptions={[10, 25, 100]}
|
||||||
|
component="div"
|
||||||
|
count={projectData && projectData.length}
|
||||||
|
rowsPerPage={rowsPerPage}
|
||||||
|
page={page}
|
||||||
|
onPageChange={handleChangePage}
|
||||||
|
onRowsPerPageChange={handleChangeRowsPerPage}
|
||||||
|
/>
|
||||||
|
</Paper>
|
||||||
</Paper>
|
</Paper>
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
export default ProjectList;
|
|
||||||
Loading…
x
Reference in New Issue
Block a user