import PropTypes from 'prop-types'; import { Avatar, Box, Card, Checkbox, Icon, Stack, Tab, Table, TableBody, TableCell, TableHead, //TablePagination, TableRow, Typography, SvgIcon, Dialog, DialogActions, DialogTitle, DialogContent, DialogContentText, Button } from '@mui/material'; import { Scrollbar } from 'src/components/scrollbar'; import { getInitials } from 'src/utils/get-initials'; import TrashIcon from '@heroicons/react/24/outline/TrashIcon'; import { useState } from 'react'; export const CustomersTable = (props) => { const { count = 0, items = [], onDeselectAll, onDeselectOne, onPageChange = () => {}, onRowsPerPageChange, onSelectAll, onSelectOne, deleteUser, page = 0, rowsPerPage = 0, selected = [] } = props; // const selectedSome = (selected.length > 0) && (selected.length < items.length); // const selectedAll = (items.length > 0) && (selected.length === items.length); const [showDeleteDialog, setShowDeleteDialog] = useState(false); const [userToDelete, setUserToDelete] = useState("") return ( {/* */} {/* { if (event.target.checked) { onSelectAll?.(); } else { onDeselectAll?.(); } }} /> */} {/* */} Name Email {/* Location */} Phone Created At Level Actions {items.map((customer) => { const isSelected = selected.includes(customer._id); return ( {/* */} {/* { if (event.target.checked) { console.log(customer._id+" is selected"); onSelectOne(customer._id); } else { onDeselectOne(customer._id); } }} /> */} {/* */} {getInitials(customer.name)} {customer.name} {customer.email} {/* {customer.address} */} {customer.phone} {customer.createdAt} {customer.level == 1 ? "Admin" : "User"} { customer.level == 0 ? : } ); })}
{/* */} setShowDeleteDialog(false)} aria-labelledby="alert-dialog-title" aria-describedby="alert-dialog-description" > {"Delete User"} Are you sure you want to delete this user?
); }; CustomersTable.propTypes = { count: PropTypes.number, items: PropTypes.array, onDeselectAll: PropTypes.func, onDeselectOne: PropTypes.func, onPageChange: PropTypes.func, //onRowsPerPageChange: PropTypes.func, onSelectAll: PropTypes.func, onSelectOne: PropTypes.func, deleteUser: PropTypes.func, //page: PropTypes.number, //rowsPerPage: PropTypes.number, selected: PropTypes.array };