2025-07-22 12:27:06 -07:00
|
|
|
import Typography from "@mui/material/Typography";
|
2025-09-27 14:54:55 -07:00
|
|
|
import DataTable from "@/Components/v1/Table/index.jsx";
|
2026-01-15 23:37:50 -05:00
|
|
|
import Icon from "@/Components/v1/Icon";
|
2025-07-22 12:27:06 -07:00
|
|
|
|
|
|
|
|
import { useTranslation } from "react-i18next";
|
2026-01-12 23:57:39 +00:00
|
|
|
import { ROLES } from "../../../../Utils/roleUtils.js";
|
2025-07-22 12:27:06 -07:00
|
|
|
|
|
|
|
|
const RoleTable = ({ roles, handleDeleteRole }) => {
|
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
const HEADERS = [
|
|
|
|
|
{
|
|
|
|
|
id: "name",
|
|
|
|
|
content: <Typography>{t("editUserPage.table.roleHeader")}</Typography>,
|
|
|
|
|
render: (row) => {
|
|
|
|
|
return row;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: "delete",
|
|
|
|
|
content: <Typography>{t("editUserPage.table.actionHeader")}</Typography>,
|
|
|
|
|
render: (row) => {
|
|
|
|
|
if (row === ROLES.SUPERADMIN) return null;
|
|
|
|
|
return (
|
2026-01-15 23:37:50 -05:00
|
|
|
<Icon
|
|
|
|
|
name="Trash2"
|
|
|
|
|
size={20}
|
2025-07-22 12:27:06 -07:00
|
|
|
onClick={() => {
|
|
|
|
|
handleDeleteRole(row);
|
|
|
|
|
}}
|
2026-01-15 23:37:50 -05:00
|
|
|
style={{ cursor: "pointer" }}
|
2025-07-22 12:27:06 -07:00
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
return (
|
|
|
|
|
<DataTable
|
|
|
|
|
headers={HEADERS}
|
|
|
|
|
data={roles}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default RoleTable;
|