diff --git a/.eslintrc.json b/.eslintrc.json index 13015d6..0149fec 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,8 @@ { "extends": "next/core-web-vitals", "rules": { - "@typescript-eslint/no-explicit-any": "off" + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/no-empty-object-type": "off" } } diff --git a/src/app/DRE/analitico.tsx b/src/app/DRE/analitico.tsx index 157458c..28bdd1b 100644 --- a/src/app/DRE/analitico.tsx +++ b/src/app/DRE/analitico.tsx @@ -114,7 +114,8 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { { accessorKey: "data_competencia", header: "Data Comp.", - cell: ({ getValue }: any) => { + filterFn: "advancedText", + cell: ({ getValue }: { getValue: () => string }) => { const value = getValue(); return new Date(value).toLocaleDateString('pt-BR'); } @@ -122,7 +123,8 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { { accessorKey: "data_vencimento", header: "Data Venc.", - cell: ({ getValue }: any) => { + filterFn: "advancedText", + cell: ({ getValue }: { getValue: () => string }) => { const value = getValue(); return new Date(value).toLocaleDateString('pt-BR'); } @@ -130,20 +132,22 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { { accessorKey: "data_caixa", header: "Data Caixa", - cell: ({ getValue }: any) => { + filterFn: "advancedText", + cell: ({ getValue }: { getValue: () => string }) => { const value = getValue(); return new Date(value).toLocaleDateString('pt-BR'); } }, - { accessorKey: "codigo_fornecedor", header: "Cód. Fornec." }, - { accessorKey: "nome_fornecedor", header: "Fornecedor" }, - { accessorKey: "codigo_centrocusto", header: "Cód. Centro" }, - { accessorKey: "codigo_conta", header: "Cód. Conta" }, - { accessorKey: "conta", header: "Conta" }, + { accessorKey: "codigo_fornecedor", header: "Cód. Fornec.", filterFn: "advancedText" }, + { accessorKey: "nome_fornecedor", header: "Fornecedor", filterFn: "advancedText" }, + { accessorKey: "codigo_centrocusto", header: "Cód. Centro", filterFn: "advancedText" }, + { accessorKey: "codigo_conta", header: "Cód. Conta", filterFn: "advancedText" }, + { accessorKey: "conta", header: "Conta", filterFn: "advancedText" }, { accessorKey: "valor", header: "Valor", - cell: ({ getValue }: any) => { + filterFn: "advancedText", + cell: ({ getValue }: { getValue: () => number }) => { const value = getValue(); const formatted = new Intl.NumberFormat('pt-BR', { style: 'currency', @@ -157,9 +161,9 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { ); } }, - { accessorKey: "historico", header: "Histórico" }, - { accessorKey: "historico2", header: "Histórico 2" }, - { accessorKey: "recnum", header: "Recnum" }, + { accessorKey: "historico", header: "Histórico", filterFn: "advancedText" }, + { accessorKey: "historico2", header: "Histórico 2", filterFn: "advancedText" }, + { accessorKey: "recnum", header: "Recnum", filterFn: "advancedText" }, ], [] ); @@ -228,9 +232,15 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { }, []); const applyFilters = () => { - const filters = conditions - .filter((c) => c.column && (c.operator === "empty" || c.operator === "notEmpty" || (c.value ?? "") !== "")) - .map((c) => ({ id: c.column, value: { operator: c.operator, value: c.value } })); + const validConditions = conditions.filter((c) => + c.column && (c.operator === "empty" || c.operator === "notEmpty" || (c.value ?? "") !== "") + ); + + const filters = validConditions.map((c) => ({ + id: c.column, + value: { operator: c.operator, value: c.value } + })); + setColumnFilters(filters); setOpen(false); }; @@ -336,16 +346,16 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) { )} - +
|
{flexRender(header.column.columnDef.header, header.getContext())}
-
+
{sorted === "asc" ? (
- )}
-
-
+ )}
+
+
|
);
})}
@@ -389,7 +399,7 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) {
|---|
|
{flexRender(cell.column.columnDef.cell, cell.getContext())}
-
+
|
))}