Skip to content

Commit

Permalink
fix error datatable
Browse files Browse the repository at this point in the history
  • Loading branch information
karenyov committed Apr 11, 2023
1 parent 7cd7fb8 commit 9ea0e7e
Showing 1 changed file with 30 additions and 16 deletions.
46 changes: 30 additions & 16 deletions src/components/tables/HistoryTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
useDisclosure,
useToast,
Heading,
Tag,
} from "@chakra-ui/react";
import { useEffect, useRef, useState } from "react";
import { FiTrash2 } from "react-icons/fi";
Expand Down Expand Up @@ -49,31 +50,44 @@ export default function HistoryTable({ registerId }: Props) {
const columns = [
{
name: "Período",
selector: (row: HistoryDTO) => row.period,
selector: (row: HistoryDTO) => (
<Tag size="md" variant="solid" borderRadius="full" bg="primary.700">
{row.period}
</Tag>
),
},
{
name: "Entradas",
selector: (row: HistoryDTO) =>
new Intl.NumberFormat("pt-br", {
style: "currency",
currency: "BRL",
}).format(Number(row.balanceCredit)),
selector: (row: HistoryDTO) => (
<Tag size="md" variant="solid" borderRadius="full" colorScheme="green">
{new Intl.NumberFormat("pt-br", {
style: "currency",
currency: "BRL",
}).format(Number(row.balanceCredit))}
</Tag>
),
},
{
name: "Débito",
selector: (row: HistoryDTO) =>
new Intl.NumberFormat("pt-br", {
style: "currency",
currency: "BRL",
}).format(Number(row.totalDebt)),
selector: (row: HistoryDTO) => (
<Tag size="md" variant="solid" borderRadius="full" colorScheme="red">
{new Intl.NumberFormat("pt-br", {
style: "currency",
currency: "BRL",
}).format(Number(row.totalDebt))}
</Tag>
),
},
{
name: "Saldo",
selector: (row: HistoryDTO) =>
new Intl.NumberFormat("pt-br", {
style: "currency",
currency: "BRL",
}).format(Number(row.totalCredit)),
selector: (row: HistoryDTO) => (
<Tag size="md" variant="solid" borderRadius="full" colorScheme="blue">
{new Intl.NumberFormat("pt-br", {
style: "currency",
currency: "BRL",
}).format(Number(row.totalCredit))}
</Tag>
),
},
{
name: "Deletar",
Expand Down

0 comments on commit 9ea0e7e

Please sign in to comment.