feat: marketplaces editor in clients page
This commit is contained in:
@ -1,15 +1,24 @@
|
||||
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<ModuleNames>;
|
||||
};
|
||||
|
||||
export const useClientsTableColumns = ({ onChange, onDelete }: Props) => {
|
||||
export const useClientsTableColumns = ({
|
||||
onChange,
|
||||
onDelete,
|
||||
onOpenMarketplacesList,
|
||||
modulesSet,
|
||||
}: Props) => {
|
||||
return useMemo(
|
||||
() =>
|
||||
[
|
||||
@ -21,6 +30,17 @@ export const useClientsTableColumns = ({ onChange, onDelete }: Props) => {
|
||||
<UpdateDeleteTableActions
|
||||
onDelete={() => onDelete(client)}
|
||||
onChange={() => onChange(client)}
|
||||
otherActions={[
|
||||
{
|
||||
label: "Маркетплейсы",
|
||||
icon: <IconBasket />,
|
||||
onClick: () =>
|
||||
onOpenMarketplacesList(client),
|
||||
hidden: !modulesSet.has(
|
||||
ModuleNames.FULFILLMENT_BASE
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user