import * as React from "react";
import { Box } from "@mui/material";
import Card from "@mui/material/Card";
import { Typography } from "@mui/material";
import InputLabel from "@mui/material/InputLabel";
import MenuItem from "@mui/material/MenuItem";
import FormControl from "@mui/material/FormControl";
import Select from "@mui/material/Select";
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 IconButton from "@mui/material/IconButton";
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";
function RecentOrder(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" ? : }
);
}
RecentOrder.propTypes = {
count: PropTypes.number.isRequired,
onPageChange: PropTypes.func.isRequired,
page: PropTypes.number.isRequired,
rowsPerPage: PropTypes.number.isRequired,
};
function createData(
orderID,
productImg,
productTitle,
customer,
price,
vendor,
date,
status,
badgeClass,
rating
) {
return {
orderID,
productImg,
productTitle,
customer,
price,
vendor,
date,
status,
badgeClass,
rating,
};
}
const rows = [
createData(
"#SK258",
"/images/product1.png",
"Laptop Macos Pro",
"Colin Firth",
"$289.50",
"Boetic Fashion",
"2021-12-19",
"Pending",
"primaryBadge",
"5.0 (61 votes)"
),
createData(
"#SK259",
"/images/product2.png",
"Smart Camera XD6",
"Wade Dave",
"$189.50",
"Aronic Conver",
"2021-12-19",
"Out of Stock",
"dangerBadge",
"5.0 (61 votes)"
),
createData(
"#SK260",
"/images/product3.png",
"Pixi 8 Wireless Airphone",
"Seth Riley",
"$250.50",
"Lotu Arnich",
"2021-12-19",
"Delivered",
"successBadge",
"5.0 (61 votes)"
),
createData(
"#SK261",
"/images/product4.png",
"Jebble Smart Watch",
"Gilbert Dan",
"$289.50",
"Zoetic Fashion",
"2021-12-19",
"Pending",
"primaryBadge",
"5.0 (61 votes)"
),
createData(
"#SK262",
"/images/product5.png",
"Admas Airpod x-Zon",
"Joshua Glen",
"$289.50",
"Airpod",
"2021-12-19",
"Pending",
"primaryBadge",
"5.0 (61 votes)"
),
createData(
"#SK263",
"/images/product6.png",
"Smart Satch F8 Pro",
"Lewis Milton",
"$289.50",
"Smart Satch",
"2021-12-19",
"Pending",
"primaryBadge",
"5.0 (61 votes)"
),
createData(
"#SK264",
"/images/product7.png",
"Nord Fold ZL",
"Liam Ethan",
"$289.50",
"Nord",
"2021-12-19",
"Pending",
"primaryBadge",
"5.0 (61 votes)"
),
createData(
"#SK265",
"/images/product8.png",
"Wall Clock Cimbina",
"Ramon Miles",
"$289.50",
"Clock",
"2021-12-19",
"Pending",
"primaryBadge",
"5.0 (61 votes)"
),
createData(
"#SK266",
"/images/product9.png",
"Galaxo T6 Munsun",
"Brian Roberto",
"$289.50",
"Smart Phone",
"2021-12-19",
"Pending",
"primaryBadge",
"5.0 (61 votes)"
),
createData(
"#SK267",
"/images/product1.png",
"Laptop Macos Pro",
"Colin Firth",
"$289.50",
"Boetic Fashion",
"2021-12-19",
"Pending",
"primaryBadge",
"5.0 (61 votes)"
),
createData(
"#SK268",
"/images/product2.png",
"Smart Camera XD6",
"Wade Dave",
"$189.50",
"Aronic Conver",
"2021-12-19",
"Out of Stock",
"dangerBadge",
"5.0 (61 votes)"
),
createData(
"#SK269",
"/images/product3.png",
"Pixi 8 Wireless Airphone",
"Seth Riley",
"$250.50",
"Lotu Arnich",
"2021-12-19",
"Delivered",
"successBadge",
"5.0 (61 votes)"
),
createData(
"#SK270",
"/images/product4.png",
"Jebble Smart Watch",
"Gilbert Dan",
"$289.50",
"Zoetic Fashion",
"2021-12-19",
"Pending",
"primaryBadge",
"5.0 (61 votes)"
),
createData(
"#SK271",
"/images/product5.png",
"Admas Airpod x-Zon",
"Joshua Glen",
"$289.50",
"Airpod",
"2021-12-19",
"Pending",
"primaryBadge",
"5.0 (61 votes)"
),
createData(
"#SK272",
"/images/product6.png",
"Smart Satch F8 Pro",
"Lewis Milton",
"$289.50",
"Smart Satch",
"2021-12-19",
"Pending",
"primaryBadge",
"5.0 (61 votes)"
),
createData(
"#SK273",
"/images/product7.png",
"Nord Fold ZL",
"Liam Ethan",
"$289.50",
"Nord",
"2021-12-19",
"Pending",
"primaryBadge",
"5.0 (61 votes)"
),
createData(
"#SK274",
"/images/product8.png",
"Wall Clock Cimbina",
"Ramon Miles",
"$289.50",
"Clock",
"2021-12-19",
"Pending",
"primaryBadge",
"5.0 (61 votes)"
),
createData(
"#SK275",
"/images/product9.png",
"Galaxo T6 Munsun",
"Brian Roberto",
"$289.50",
"Smart Phone",
"2021-12-19",
"Pending",
"primaryBadge",
"5.0 (61 votes)"
),
].sort((a, b) => (a.orderID < b.orderID ? -1 : 1));
export default function RecentOrders() {
// Select
const [select, setSelect] = React.useState("");
const handleChange = (event) => {
setSelect(event.target.value);
};
// Table
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(6);
// 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);
};
return (
<>
Recent Orders
Select
Order ID
Product
Customer
Price
Vendor
Date
Status
Rating
{(rowsPerPage > 0
? rows.slice(
page * rowsPerPage,
page * rowsPerPage + rowsPerPage
)
: rows
).map((row) => (
{row.orderID}
{row.productTitle}
{row.customer}
{row.price}
{row.vendor}
{row.date}
{row.status}
{row.rating}
))}
{emptyRows > 0 && (
)}
>
);
}