import { useMemo } from "react"; import { IconBasket } from "@tabler/icons-react"; import { DataTableColumn } from "mantine-datatable"; import { Center } from "@mantine/core"; import UpdateDeleteTableActions from "@/components/ui/BaseTable/components/UpdateDeleteTableActions"; import { ClientSchema } from "@/lib/client"; import { ModuleNames } from "@/modules/modules"; type Props = { onChange: (client: ClientSchema) => void; onDelete: (client: ClientSchema) => void; onOpenMarketplacesList: (client: ClientSchema) => void; modulesSet: Set; }; export const useClientsTableColumns = ({ onChange, onDelete, onOpenMarketplacesList, modulesSet, }: Props) => { return useMemo( () => [ { accessor: "actions", title:
Действия
, width: "0%", render: client => ( onDelete(client)} onChange={() => onChange(client)} otherActions={[ { label: "Маркетплейсы", icon: , onClick: () => onOpenMarketplacesList(client), hidden: !modulesSet.has( ModuleNames.FULFILLMENT_BASE ), }, ]} /> ), }, { accessor: "name", title: "Имя", }, { accessor: "details.telegram", title: "Телеграм", }, { accessor: "details.email", title: "Почта", }, { accessor: "details.phoneNumber", title: "Телефон", }, { accessor: "details.inn", title: "ИНН", }, { accessor: "companyName", title: "Название компании", }, { accessor: "comment", title: "Комментарий", }, ] as DataTableColumn[], [onChange, onDelete] ); };