feat: actions for services and categories
This commit is contained in:
@ -1,8 +1,7 @@
|
||||
import { useMemo } from "react";
|
||||
import { IconEdit, IconTrash } from "@tabler/icons-react";
|
||||
import { DataTableColumn } from "mantine-datatable";
|
||||
import { Box, Flex, Text } from "@mantine/core";
|
||||
import ActionIconWithTip from "@/components/ui/ActionIconWithTip/ActionIconWithTip";
|
||||
import { Box, Text } from "@mantine/core";
|
||||
import UpdateDeleteTableActions from "@/components/ui/BaseTable/components/UpdateDeleteTableActions";
|
||||
import { ProductServiceSchema } from "@/lib/client";
|
||||
|
||||
type Props = {
|
||||
@ -32,21 +31,11 @@ const useProductServicesTableColumns = ({
|
||||
textAlign: "center",
|
||||
width: "0%",
|
||||
render: dealProductService => (
|
||||
<Flex
|
||||
gap="md"
|
||||
px={"sm"}
|
||||
my={"sm"}>
|
||||
<ActionIconWithTip
|
||||
tipLabel={"Удалить услугу"}
|
||||
onClick={() => onDelete(dealProductService)}>
|
||||
<IconTrash />
|
||||
</ActionIconWithTip>
|
||||
<ActionIconWithTip
|
||||
tipLabel="Редактировать"
|
||||
onClick={() => onChange(dealProductService)}>
|
||||
<IconEdit />
|
||||
</ActionIconWithTip>
|
||||
</Flex>
|
||||
<UpdateDeleteTableActions
|
||||
onDelete={() => onDelete(dealProductService)}
|
||||
onChange={() => onChange(dealProductService)}
|
||||
style={{ padding: "var(--mantine-spacing-xs)" }}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { useMemo } from "react";
|
||||
import { IconEdit, IconTrash } from "@tabler/icons-react";
|
||||
import { DataTableColumn } from "mantine-datatable";
|
||||
import { ActionIcon, Flex } from "@mantine/core";
|
||||
import UpdateDeleteTableActions from "@/components/ui/BaseTable/components/UpdateDeleteTableActions";
|
||||
import { DealServiceSchema } from "@/lib/client";
|
||||
|
||||
type Props = {
|
||||
@ -36,19 +35,10 @@ const useDealServicesTableColumns = ({ onChange, onDelete }: Props) => {
|
||||
textAlign: "center",
|
||||
width: "0%",
|
||||
render: dealService => (
|
||||
<Flex gap={"sm"}>
|
||||
<ActionIcon
|
||||
variant={"subtle"}
|
||||
c={"red"}
|
||||
onClick={() => onDelete(dealService)}>
|
||||
<IconTrash />
|
||||
</ActionIcon>
|
||||
<ActionIcon
|
||||
variant={"subtle"}
|
||||
onClick={() => onChange(dealService)}>
|
||||
<IconEdit />
|
||||
</ActionIcon>
|
||||
</Flex>
|
||||
<UpdateDeleteTableActions
|
||||
onDelete={() => onDelete(dealService)}
|
||||
onChange={() => onChange(dealService)}
|
||||
/>
|
||||
),
|
||||
},
|
||||
] as DataTableColumn<DealServiceSchema>[],
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { useMemo } from "react";
|
||||
import { IconEdit, IconTrash } from "@tabler/icons-react";
|
||||
import { DataTableColumn } from "mantine-datatable";
|
||||
import { ActionIcon, Flex, Text } from "@mantine/core";
|
||||
import { Text } from "@mantine/core";
|
||||
import UpdateDeleteTableActions from "@/components/ui/BaseTable/components/UpdateDeleteTableActions";
|
||||
import { ProductServiceSchema } from "@/lib/client";
|
||||
|
||||
type Props = {
|
||||
@ -31,19 +31,10 @@ const useProductServicesTableColumns = ({
|
||||
textAlign: "center",
|
||||
width: "0%",
|
||||
render: dealProductService => (
|
||||
<Flex gap="md">
|
||||
<ActionIcon
|
||||
variant={"subtle"}
|
||||
color={"red"}
|
||||
onClick={() => onDelete(dealProductService)}>
|
||||
<IconTrash />
|
||||
</ActionIcon>
|
||||
<ActionIcon
|
||||
variant={"subtle"}
|
||||
onClick={() => onChange(dealProductService)}>
|
||||
<IconEdit />
|
||||
</ActionIcon>
|
||||
</Flex>
|
||||
<UpdateDeleteTableActions
|
||||
onDelete={() => onDelete(dealProductService)}
|
||||
onChange={() => onChange(dealProductService)}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
|
||||
@ -55,7 +55,7 @@ export const useServiceCategoriesCrud = ({
|
||||
UpdateServiceCategorySchema,
|
||||
CreateServiceCategorySchema
|
||||
>({
|
||||
key: "getServiceCategories",
|
||||
key: "getServices",
|
||||
queryKey,
|
||||
mutations: {
|
||||
create: createServiceCategoryMutation(),
|
||||
|
||||
Reference in New Issue
Block a user