From a76947ad331fa4455dd76445bc396eeef409e19e Mon Sep 17 00:00:00 2001 From: Karen Vicente Date: Mon, 10 Apr 2023 23:22:21 -0300 Subject: [PATCH] fix error datatable --- src/components/tables/DebtsAllTable.tsx | 43 +++++++++++++++++++------ src/pages/debt/index.tsx | 33 +++++++++++++++---- 2 files changed, 61 insertions(+), 15 deletions(-) diff --git a/src/components/tables/DebtsAllTable.tsx b/src/components/tables/DebtsAllTable.tsx index 334ed2d..9e1965c 100644 --- a/src/components/tables/DebtsAllTable.tsx +++ b/src/components/tables/DebtsAllTable.tsx @@ -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) => ( + + {new Intl.NumberFormat("pt-br", { + style: "currency", + currency: "BRL", + }).format(Number(row.value))} + + ), }, { name: "Data Vencimento", @@ -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 ? ( + + {new Date(row.paymentDate).toLocaleDateString()} + + ) : ( + "-" + ), }, { name: "Status", @@ -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} ), }, diff --git a/src/pages/debt/index.tsx b/src/pages/debt/index.tsx index e408000..9ee3169 100644 --- a/src/pages/debt/index.tsx +++ b/src/pages/debt/index.tsx @@ -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) => ( + + {new Intl.NumberFormat("pt-br", { + style: "currency", + currency: "BRL", + }).format(Number(row.value))} + + ), }, { name: "Dt. Vencimento", @@ -242,7 +252,18 @@ export default function Debt() { { name: "Dt. Pagamento", selector: (row: DebtDTO) => - row.paymentDate ? new Date(row.paymentDate).toLocaleDateString() : "-", + row.paymentDate ? ( + + {new Date(row.paymentDate).toLocaleDateString()} + + ) : ( + "-" + ), }, { name: "Anexo",