37 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { useMemo } from "react";
 | 
						|
import { MRT_ColumnDef } from "mantine-react-table";
 | 
						|
import { CardEmployeesSchema } from "../../../../../client";
 | 
						|
 | 
						|
 | 
						|
const useEmployeeTableColumns = () => {
 | 
						|
    return useMemo<MRT_ColumnDef<CardEmployeesSchema>[]>(
 | 
						|
        () => [
 | 
						|
            {
 | 
						|
                accessorKey: "createdAt",
 | 
						|
                header: "Дата назначения",
 | 
						|
                Cell: ({ cell }) => new Date(cell.getValue() as string).toLocaleString("ru"),
 | 
						|
            },
 | 
						|
            {
 | 
						|
                header: "ФИО",
 | 
						|
                Cell: ({ row }) =>
 | 
						|
                    `${row.original.user.secondName} ${row.original.user.firstName} ${row.original.user.patronymic}`,
 | 
						|
            },
 | 
						|
            {
 | 
						|
                accessorKey: "user.role.name",
 | 
						|
                header: "Роль",
 | 
						|
            },
 | 
						|
            {
 | 
						|
                accessorKey: "user.position.name",
 | 
						|
                header: "Должность",
 | 
						|
            },
 | 
						|
            {
 | 
						|
                accessorKey: "user.comment",
 | 
						|
                header: "Дополнительная информация",
 | 
						|
            },
 | 
						|
        ],
 | 
						|
        [],
 | 
						|
    );
 | 
						|
};
 | 
						|
 | 
						|
export default useEmployeeTableColumns;
 |