import React from "react";
import { Box, Typography } from "@mui/material";
import Card from "@mui/material/Card";
import IconButton from "@mui/material/IconButton";
import PropTypes from "prop-types";
import { useTheme } from "@mui/material/styles";
import Table from "@mui/material/Table";
import TableHead from "@mui/material/TableHead";
import TableBody from "@mui/material/TableBody";
import TableCell from "@mui/material/TableCell";
import TableContainer from "@mui/material/TableContainer";
import TableFooter from "@mui/material/TableFooter";
import TablePagination from "@mui/material/TablePagination";
import TableRow from "@mui/material/TableRow";
import Paper from "@mui/material/Paper";
import FirstPageIcon from "@mui/icons-material/FirstPage";
import KeyboardArrowLeft from "@mui/icons-material/KeyboardArrowLeft";
import KeyboardArrowRight from "@mui/icons-material/KeyboardArrowRight";
import LastPageIcon from "@mui/icons-material/LastPage";
import Tooltip from "@mui/material/Tooltip";
import Checkbox from '@mui/material/Checkbox';
const label = { inputProps: { 'aria-label': 'Checkbox demo' } };
import Grid from "@mui/material/Grid";
import Button from "@mui/material/Button";
import TextField from "@mui/material/TextField";
import AddIcon from "@mui/icons-material/Add";
import ClearIcon from "@mui/icons-material/Clear";
import { styled } from '@mui/material/styles';
import Dialog from '@mui/material/Dialog';
import DialogTitle from '@mui/material/DialogTitle';
import CloseIcon from '@mui/icons-material/Close';
// Add Task modal
const BootstrapDialog = styled(Dialog)(({ theme }) => ({
'& .MuiDialogContent-root': {
padding: theme.spacing(2),
},
'& .MuiDialogActions-root': {
padding: theme.spacing(1),
},
}));
function BootstrapDialogTitle(props) {
const { children, onClose, ...other } = props;
return (
{children}
{onClose ? (
theme.palette.grey[500],
}}
>
) : null}
);
}
BootstrapDialogTitle.propTypes = {
children: PropTypes.node,
onClose: PropTypes.func.isRequired,
};
// End Add Task Modal
function MyTask(props) {
const theme = useTheme();
const { count, page, rowsPerPage, onPageChange } = props;
const handleFirstPageButtonClick = (event) => {
onPageChange(event, 0);
};
const handleBackButtonClick = (event) => {
onPageChange(event, page - 1);
};
const handleNextButtonClick = (event) => {
onPageChange(event, page + 1);
};
const handleLastPageButtonClick = (event) => {
onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
};
return (
{theme.direction === "rtl" ? : }
{theme.direction === "rtl" ? (
) : (
)}
= Math.ceil(count / rowsPerPage) - 1}
aria-label="next page"
>
{theme.direction === "rtl" ? (
) : (
)}
= Math.ceil(count / rowsPerPage) - 1}
aria-label="last page"
>
{theme.direction === "rtl" ? : }
);
}
MyTask.propTypes = {
count: PropTypes.number.isRequired,
onPageChange: PropTypes.func.isRequired,
page: PropTypes.number.isRequired,
rowsPerPage: PropTypes.number.isRequired,
};
function createData(task, dedline, status, badgeClass, assignee, memberName) {
return {
task,
dedline,
status,
badgeClass,
assignee,
memberName,
};
}
const rows = [
createData(
"Public Beta Release",
"14 Feb 2022",
"On Going",
"successBadge",
"/images/user1.png",
"Wade"
),
createData(
"Fix Platform Errors",
"15 Mar 2022",
"Completed",
"primaryBadge",
"/images/user2.png",
"Dave"
),
createData(
"Launch our Mobile App",
"15 Apr 2022",
"On Going",
"successBadge",
"/images/user3.png",
"Liam"
),
createData(
"Add the New Pricing Page",
"15 May 2022",
"Pending",
"dangerBadge",
"/images/user4.png",
"Nathaniel"
),
createData(
"Redesign New Online Shop",
"15 Jun 2022",
"On Going",
"successBadge",
"/images/user5.png",
"Lewis"
),
createData(
"Material Ui Design",
"15 Jul 2022",
"On Going",
"successBadge",
"/images/user6.png",
"Milton"
),
createData(
"Add Progress Track",
"15 Mar 2022",
"Completed",
"primaryBadge",
"/images/user7.png",
"Claude"
),
createData(
"Web Design",
"15 Aug 2022",
"On Going",
"successBadge",
"/images/user8.png",
"Harvey"
),
createData(
"Web Development",
"15 Nov 2022",
"On Going",
"successBadge",
"/images/user9.png",
"Blake"
),
createData(
"React App Development",
"15 Dec 2022",
"Completed",
"primaryBadge",
"/images/user10.png",
"Antonio"
),
createData(
"eCommerce Development",
"15 Nov 2022",
"On Going",
"successBadge",
"/images/user11.png",
"Conner"
),
createData(
"App Development",
"15 Nov 2022",
"On Going",
"successBadge",
"/images/user12.png",
"Shane"
),
].sort((a, b) => (a.task < b.task ? -1 : 1));
const MyTasks = () => {
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(8);
// Avoid a layout jump when reaching the last page with empty rows.
const emptyRows =
page > 0 ? Math.max(0, (1 + page) * rowsPerPage - rows.length) : 0;
const handleChangePage = (event, newPage) => {
setPage(newPage);
};
const handleChangeRowsPerPage = (event) => {
setRowsPerPage(parseInt(event.target.value, 10));
setPage(0);
};
// Add task modal
const [open, setOpen] = React.useState(false);
const handleClickOpen = () => {
setOpen(true);
};
const handleClose = () => {
setOpen(false);
};
const handleSubmit = (event) => {
event.preventDefault();
const data = new FormData(event.currentTarget);
console.log({
email: data.get("email"),
password: data.get("password"),
});
};
// End Add Task Modal
return (
<>
My Tasks
Task
Dedline
Status
Assignee
{(rowsPerPage > 0
? rows.slice(
page * rowsPerPage,
page * rowsPerPage + rowsPerPage
)
: rows
).map((row) => (
{row.task}
{row.dedline}
{row.status}
))}
{emptyRows > 0 && (
)}
{/* Add task modal */}
Add Task
Task
Member
Dedline
Status
>
);
};
export default MyTasks;