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 78dbf32 commit a76947a
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 15 deletions.
43 changes: 34 additions & 9 deletions src/components/tables/DebtsAllTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,21 @@ export default function DebtsAllTable({ userId }: Props) {
},
{
name: "Valor",
selector: (row: DebtDTO) =>
new Intl.NumberFormat("pt-br", {
style: "currency",
currency: "BRL",
}).format(Number(row.value)),
selector: (row: DebtDTO) => (
<Tag
size="md"
variant="solid"
borderRadius="full"
colorScheme={
row.status == "Aguardando Pagamento" ? "orange" : "green"
}
>
{new Intl.NumberFormat("pt-br", {
style: "currency",
currency: "BRL",
}).format(Number(row.value))}
</Tag>
),
},
{
name: "Data Vencimento",
Expand All @@ -80,9 +90,22 @@ export default function DebtsAllTable({ userId }: Props) {
),
},
{
name: "Data Pagamento",
name: "Dt. Pagamento",
selector: (row: DebtDTO) =>
row.paymentDate ? new Date(row.paymentDate).toLocaleDateString() : "-",
row.paymentDate ? (
<Tag
size="md"
variant="solid"
borderRadius="full"
colorScheme={
row.status == "Aguardando Pagamento" ? "orange" : "green"
}
>
{new Date(row.paymentDate).toLocaleDateString()}
</Tag>
) : (
"-"
),
},
{
name: "Status",
Expand All @@ -91,9 +114,11 @@ export default function DebtsAllTable({ userId }: Props) {
size="md"
variant="solid"
borderRadius="full"
colorScheme={row.status == "AWAITING_PAYMENT" ? "orange" : "green"}
colorScheme={
row.status == "Aguardando Pagamento" ? "orange" : "green"
}
>
{row.status === "AWAITING_PAYMENT" ? "Aguardando Pagamento" : "Pago"}
{row.status}
</Tag>
),
},
Expand Down
33 changes: 27 additions & 6 deletions src/pages/debt/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,21 @@ export default function Debt() {
},
{
name: "Valor",
selector: (row: DebtDTO) =>
new Intl.NumberFormat("pt-br", {
style: "currency",
currency: "BRL",
}).format(Number(row.value)),
selector: (row: DebtDTO) => (
<Tag
size="md"
variant="solid"
borderRadius="full"
colorScheme={
row.status == "Aguardando Pagamento" ? "orange" : "green"
}
>
{new Intl.NumberFormat("pt-br", {
style: "currency",
currency: "BRL",
}).format(Number(row.value))}
</Tag>
),
},
{
name: "Dt. Vencimento",
Expand All @@ -242,7 +252,18 @@ export default function Debt() {
{
name: "Dt. Pagamento",
selector: (row: DebtDTO) =>
row.paymentDate ? new Date(row.paymentDate).toLocaleDateString() : "-",
row.paymentDate ? (
<Tag
size="md"
variant="solid"
borderRadius="full"
colorScheme="green"
>
{new Date(row.paymentDate).toLocaleDateString()}
</Tag>
) : (
"-"
),
},
{
name: "Anexo",
Expand Down

0 comments on commit a76947a

Please sign in to comment.