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