feat: clients page
This commit is contained in:
58
src/app/clients/components/shared/ClientsTable/columns.tsx
Normal file
58
src/app/clients/components/shared/ClientsTable/columns.tsx
Normal file
@ -0,0 +1,58 @@
|
||||
import { useMemo } from "react";
|
||||
import { DataTableColumn } from "mantine-datatable";
|
||||
import { Center } from "@mantine/core";
|
||||
import UpdateDeleteTableActions from "@/components/ui/BaseTable/components/UpdateDeleteTableActions";
|
||||
import { ClientSchema } from "@/lib/client";
|
||||
|
||||
type Props = {
|
||||
onChange: (client: ClientSchema) => void;
|
||||
onDelete: (client: ClientSchema) => void;
|
||||
};
|
||||
|
||||
export const useClientsTableColumns = ({ onChange, onDelete }: Props) => {
|
||||
return useMemo(
|
||||
() =>
|
||||
[
|
||||
{
|
||||
accessor: "actions",
|
||||
title: <Center>Действия</Center>,
|
||||
width: "0%",
|
||||
render: client => (
|
||||
<UpdateDeleteTableActions
|
||||
onDelete={() => onDelete(client)}
|
||||
onChange={() => onChange(client)}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
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<ClientSchema>[],
|
||||
[onChange, onDelete]
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user