diff --git a/src/components/CustomTable/index.tsx b/src/components/CustomTable/index.tsx index c34da95..0f24bd7 100644 --- a/src/components/CustomTable/index.tsx +++ b/src/components/CustomTable/index.tsx @@ -1,317 +1,4 @@ -// import * as React from "react"; -// import { styled } from "@mui/material/styles"; -// import Table from "@mui/material/Table"; -// import TableBody from "@mui/material/TableBody"; -// import TableCell, { tableCellClasses } from "@mui/material/TableCell"; -// import TableContainer from "@mui/material/TableContainer"; -// import TableHead from "@mui/material/TableHead"; -// import TableRow from "@mui/material/TableRow"; -// import Paper, { paperClasses } from "@mui/material/Paper"; -// import { adminList, deleteAdmin } from "../../redux/slices/adminSlice"; -// import { useDispatch } from "react-redux"; -// import { -// Box, -// Button, -// dividerClasses, -// IconButton, -// listClasses, -// Menu, -// } from "@mui/material"; -// import MoreVertRoundedIcon from "@mui/icons-material/MoreVertRounded"; -// import DeleteModal from "../Modals/DeleteModal"; -// import { AppDispatch } from "../../redux/store/store"; -// import ViewModal from "../Modals/ViewModal"; -// // Styled components for customization -// const StyledTableCell = styled(TableCell)(({ theme }) => ({ -// [`&.${tableCellClasses.head}`]: { -// backgroundColor: " #1565c0", -// color: theme.palette.common.white, -// }, -// [`&.${tableCellClasses.body}`]: { -// fontSize: 14, -// }, -// })); - -// const StyledTableRow = styled(TableRow)(({ theme }) => ({ -// "&:nth-of-type(odd)": { -// backgroundColor: theme.palette.action.hover, -// }, -// "&:last-child td, &:last-child th": { -// border: 0, -// }, -// })); - -// export interface Column { -// id: string; -// label: string; -// align?: "left" | "center" | "right"; -// } - -// interface Row { -// [key: string]: any; -// } - -// interface CustomTableProps { -// columns: Column[]; -// rows: Row[]; -// setDeleteModal: Function; -// setRowData: Function; -// setModalOpen: Function; -// viewModal: boolean; -// setViewModal: Function; -// deleteModal: boolean; -// handleStatusToggle: (id: string, currentStatus: number) => void; -// tableType?: string; -// } - -// const CustomTable: React.FC = ({ -// columns, -// rows, -// setDeleteModal, -// deleteModal, -// viewModal, -// setRowData, -// setViewModal, -// setModalOpen, -// handleStatusToggle, -// tableType, -// }) => { -// const dispatch = useDispatch(); -// const [anchorEl, setAnchorEl] = React.useState(null); -// const [selectedRow, setSelectedRow] = React.useState(null); - -// const open = Boolean(anchorEl); - -// const handleClick = (event: React.MouseEvent, row: Row) => { -// setAnchorEl(event.currentTarget); -// setSelectedRow(row); // Ensure the row data is set -// setRowData(row); -// }; - -// const handleClose = () => { -// setAnchorEl(null); -// }; - -// const isImage = (value: any) => { -// if (typeof value === "string") { -// return value.startsWith("http") || value.startsWith("data:image"); // Check for URL or base64 image -// } -// return false; -// }; - -// const handleDeleteButton = (id: string | undefined) => { -// if (!id) console.error("ID not found", id); - -// dispatch(deleteAdmin(id || "")); -// setDeleteModal(false); // Close the modal only after deletion -// handleClose(); -// }; - -// const handleViewButton = (id: string | undefined) => { -// if (!id) console.error("ID not found", id); - -// dispatch(adminList()); -// setViewModal(false); -// }; - -// const handleToggleStatus = () => { -// if (selectedRow) { -// // Toggle the opposite of current status -// const newStatus = selectedRow.statusValue === 1 ? 0 : 1; -// handleStatusToggle(selectedRow.id, newStatus); -// } -// handleClose(); -// }; - -// return ( -// -// -// -// -// -// {columns.map((column) => ( -// -// {column.label} -// -// ))} -// -// -// -// {rows.map((row, rowIndex) => ( -// -// {columns.map((column) => ( -// -// {isImage(row[column.id]) ? ( -// Row -// ) : column.id !== "action" ? ( -// row[column.id] -// ) : ( -// { -// handleClick(e, row); -// setRowData(row); // Store the selected row -// }} -// > -// -// -// )} -// -// ))} -// -// ))} -// -//
-//
- -// {/* Menu Actions */} -// {open && ( -// -// -// -// {viewModal && ( -// -// handleViewButton(selectedRow?.id) -// } -// open={viewModal} -// setViewModal={setViewModal} -// id={selectedRow?.id} -// /> -// )} -// - -// {tableType === "roleList" && ( -// -// )} - -// -// {deleteModal && ( -// -// handleDeleteButton(selectedRow?.id) -// } -// open={deleteModal} -// setDeleteModal={setDeleteModal} -// id={selectedRow?.id} -// /> -// )} -// -// -// )} -//
-// ); -// }; - -// export default CustomTable; import * as React from "react"; import { styled } from "@mui/material/styles"; import Table from "@mui/material/Table";