feat: additional expenses
This commit is contained in:
		@@ -0,0 +1,37 @@
 | 
			
		||||
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}`;
 | 
			
		||||
                },
 | 
			
		||||
            },
 | 
			
		||||
        ],
 | 
			
		||||
        [],
 | 
			
		||||
    );
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user