diff --git a/client/src/app/quotes/components/QuotesDataTable.tsx b/client/src/app/quotes/components/QuotesDataTable.tsx index adda6d3..8740ad4 100644 --- a/client/src/app/quotes/components/QuotesDataTable.tsx +++ b/client/src/app/quotes/components/QuotesDataTable.tsx @@ -1,5 +1,3 @@ -import { Badge, Button, Card, CardContent, CardHeader } from "@/ui"; - import { DataTable, DataTableSkeleton, @@ -7,27 +5,21 @@ import { PDFViewer, SimpleEmptyState, } from "@/components"; - import { DataTableToolbar } from "@/components/DataTable/DataTableToolbar"; import { useDataTable, useDataTableContext } from "@/lib/hooks"; +import { Badge, Button, Card, CardContent, CardHeader } from "@/ui"; import { IListQuotes_Response_DTO, MoneyValue, UTCDateValue } from "@shared/contexts"; -import { ColumnDef, Row, Table } from "@tanstack/react-table"; +import { ColumnDef, Row } from "@tanstack/react-table"; import { t } from "i18next"; import { useMemo, useState } from "react"; import { Trans } from "react-i18next"; import { useNavigate } from "react-router-dom"; import { useQuotes } from "../hooks"; -export const QuotesDataTable = ({ - status = "all", - className, -}: { - status?: string; - className?: string; -}) => { +export const QuotesDataTable = ({ status = "all" }: { status?: string }) => { const navigate = useNavigate(); const { pagination, globalFilter, isFiltered } = useDataTableContext(); - const [focusedRow, setFocusedRow] = useState>(); + const [focusedQuote, setFocusedQuote] = useState(undefined); const { useList, useReport } = useQuotes(); const { data, isPending, isError, error } = useList({ @@ -41,10 +33,11 @@ export const QuotesDataTable = ({ const { data: reportData, + isLoading: reportIsLoading, isPending: reportIsPending, isError: reportIsError, error: errorReport, - } = useReport(focusedRow ? focusedRow.original.id : undefined); + } = useReport(focusedQuote); const columns = useMemo[]>( () => [ @@ -52,7 +45,7 @@ export const QuotesDataTable = ({ id: "date" as const, accessor: "date", header: () => <>{t("quotes.list.columns.date")}, - cell: ({ table, row: { index, original }, column, getValue }) => { + cell: ({ row: { original } }) => { const quoteDate = UTCDateValue.create(original.date); return quoteDate.isSuccess ? quoteDate.object.toLocaleDateString("es-ES") : "-"; }, @@ -94,6 +87,7 @@ export const QuotesDataTable = ({ id: "status" as const, accessorKey: "status", header: () => <>{t("quotes.list.columns.status")}, + // eslint-disable-next-line @typescript-eslint/no-explicit-any cell: ({ renderValue }: { renderValue: () => any }) => {renderValue()}, enableResizing: false, size: 10, @@ -114,7 +108,7 @@ export const QuotesDataTable = ({ { id: "edit-acion", header: () => null, - cell: ({ row, table }: { row: Row; table: Table }) => ( + cell: ({ row }: { row: Row }) => (