adminFront/src/pages/dashboard/Content/Tariffs/Privileges/Privileges.tsx

39 lines
1.2 KiB
TypeScript
Raw Normal View History

import { GridColDef } from "@mui/x-data-grid";
import DataGrid from "@kitUI/datagrid";
import { useCombinedPrivileges } from "@root/hooks/useCombinedPrivileges.hook";
import { Typography } from "@mui/material";
const columns: GridColDef[] = [
{ field: "id", headerName: "id", width: 40 },
{ field: "name", headerName: "Привелегия", width: 150 },
{ field: "description", headerName: "Описание", width: 550 }, //инфо из гитлаба.
{ field: "type", headerName: "Тип", width: 150 },
{ field: "price", headerName: "Стоимость", width: 100 },
2023-03-06 13:26:55 +00:00
];
2023-05-23 12:21:54 +00:00
export default function Privileges() {
const { mergedPrivileges, isError, errorMessage } = useCombinedPrivileges();
const privilegesGridData = mergedPrivileges.map((privilege) => ({
id: privilege.privilegeId,
name: privilege.name,
description: privilege.description,
type: privilege.type,
price: privilege.price,
}));
return (
<>
{isError ? (
<Typography>{errorMessage}</Typography>
) : (
<DataGrid
// checkboxSelection={true}
rows={privilegesGridData}
columns={columns}
/>
)}
</>
);
}