33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import { GridColDef } from '@mui/x-data-grid'
|
|
import React from 'react'
|
|
import { hasPermission } from "../../helpers/userPermissions";
|
|
import ListActionsPopover from "../ListActionsPopover";
|
|
|
|
export const loadColumns = (user: any, deleteHandler: any) => {
|
|
const hasUpdatePermission = hasPermission(user, 'UPDATE_RETAILERS')
|
|
|
|
const columns: GridColDef[] = [
|
|
{
|
|
field: 'name',
|
|
headerName: 'Name',
|
|
flex: 1,
|
|
},
|
|
{
|
|
field: 'actions',
|
|
headerName: 'Actions',
|
|
sortable: false,
|
|
width: 100,
|
|
renderCell: (params) => (
|
|
<ListActionsPopover
|
|
itemId={params?.row?.id}
|
|
pathEdit={`/retailers/retailers-edit/?id=${params?.row?.id}`}
|
|
pathView={`/retailers/retailers-view/?id=${params?.row?.id}`}
|
|
hasUpdatePermission={hasUpdatePermission}
|
|
onDelete={deleteHandler}
|
|
/>
|
|
),
|
|
},
|
|
]
|
|
|
|
return columns
|
|
} |