feat: comment in WorkTimeTable
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
			
		||||
import {useMemo} from "react";
 | 
			
		||||
import {MRT_ColumnDef} from "mantine-react-table";
 | 
			
		||||
import {getDayOfWeek} from "../../../../../shared/lib/date.ts";
 | 
			
		||||
import {Box, Flex, NumberInput, rem} from "@mantine/core";
 | 
			
		||||
import {Box, Flex, NumberInput, rem, Text} from "@mantine/core";
 | 
			
		||||
import {isNumber, last} from "lodash";
 | 
			
		||||
import {processSelectedCells} from "../../../../../shared/lib/interpolateCells.ts";
 | 
			
		||||
import {TimeTrackingData} from "../../../../../client";
 | 
			
		||||
@@ -11,6 +11,7 @@ export type EmployeeData = {
 | 
			
		||||
    name: string;
 | 
			
		||||
    userId: number;
 | 
			
		||||
    totalAmount: number;
 | 
			
		||||
    comment: string;
 | 
			
		||||
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
 | 
			
		||||
    // @ts-expect-error
 | 
			
		||||
    data?: TimeTrackingData[],
 | 
			
		||||
@@ -61,7 +62,17 @@ const useWorkTableColumns = ({
 | 
			
		||||
    return useMemo<MRT_ColumnDef<EmployeeData>[]>(() => [
 | 
			
		||||
        {
 | 
			
		||||
            accessorKey: "name",
 | 
			
		||||
            header: "ФИО"
 | 
			
		||||
            header: "ФИО",
 | 
			
		||||
            Cell: ({row}) => (
 | 
			
		||||
                <Flex direction={"column"}>
 | 
			
		||||
                    <Text size={"sm"}>
 | 
			
		||||
                        {row.original.name}
 | 
			
		||||
                    </Text>
 | 
			
		||||
                    <Text size={"xs"}>
 | 
			
		||||
                        {row.original.comment}
 | 
			
		||||
                    </Text>
 | 
			
		||||
                </Flex>
 | 
			
		||||
            )
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        ...range.map(date => ({
 | 
			
		||||
 
 | 
			
		||||
@@ -50,6 +50,7 @@ const WorkTimeTable = () => {
 | 
			
		||||
        const existingUserIds = trackingRecords.map(tr => tr.user.id);
 | 
			
		||||
        const firstResult = trackingRecords.map((record) => ({
 | 
			
		||||
            name: `${record.user.firstName} ${record.user.secondName}`,
 | 
			
		||||
            comment: record.user.comment,
 | 
			
		||||
            userId: record.user.id,
 | 
			
		||||
            totalAmount: record.totalAmount,
 | 
			
		||||
            data: record.data,
 | 
			
		||||
@@ -63,6 +64,7 @@ const WorkTimeTable = () => {
 | 
			
		||||
        const restUsersResult = users.filter(user => !existingUserIds.includes(user.id)).map(user => ({
 | 
			
		||||
            name: `${user.firstName} ${user.secondName}`,
 | 
			
		||||
            userId: user.id,
 | 
			
		||||
            comment: user.comment,
 | 
			
		||||
            totalAmount: 0,
 | 
			
		||||
            ...Object.fromEntries(getDatesInMonth(month).reduce((acc, day) => {
 | 
			
		||||
                return acc.set(day.date().toString(), 0);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user