37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { useMemo } from "react";
|
|
import { MRT_ColumnDef } from "mantine-react-table";
|
|
import { ExpenseSchemaBase } from "../../../../../client";
|
|
import { formatDate } from "../../../../../types/utils.ts";
|
|
|
|
|
|
export const useExpensesTableColumns = () => {
|
|
return useMemo<MRT_ColumnDef<ExpenseSchemaBase>[]>(
|
|
() => [
|
|
{
|
|
accessorKey: "spentDate",
|
|
header: "Дата",
|
|
Cell: ({ row }) => formatDate(row.original.spentDate as string),
|
|
},
|
|
{
|
|
accessorKey: "name",
|
|
header: "Наименование",
|
|
},
|
|
{
|
|
accessorKey: "comment",
|
|
header: "Комментарий",
|
|
},
|
|
{
|
|
accessorKey: "amount",
|
|
header: "Сумма",
|
|
},
|
|
{
|
|
accessorKey: "createdByUser",
|
|
header: "Создал запись",
|
|
Cell: ({ row }) => {
|
|
return `${row.original.createdByUser.firstName} ${row.original.createdByUser.secondName}`;
|
|
},
|
|
},
|
|
],
|
|
[],
|
|
);
|
|
}; |