From 6b044f3bc578a4497cf68b6580a8c432355f524f Mon Sep 17 00:00:00 2001 From: Felipe Coutinho Date: Thu, 21 May 2026 13:47:30 +0000 Subject: [PATCH] feat(cartoes): exibe fatura atual e ajusta indicadores --- .../cards/[cardId]/invoice/page.tsx | 2 + src/features/cards/components/card-item.tsx | 49 ++++-- src/features/cards/components/cards-page.tsx | 4 +- src/features/cards/components/types.ts | 2 + src/features/cards/queries.ts | 156 ++++++++++++------ .../current-period-overview-queries.ts | 11 +- 6 files changed, 154 insertions(+), 70 deletions(-) diff --git a/src/app/(dashboard)/cards/[cardId]/invoice/page.tsx b/src/app/(dashboard)/cards/[cardId]/invoice/page.tsx index 663bdf0..c3fc878 100644 --- a/src/app/(dashboard)/cards/[cardId]/invoice/page.tsx +++ b/src/app/(dashboard)/cards/[cardId]/invoice/page.tsx @@ -134,6 +134,8 @@ export default async function Page({ params, searchParams }: PageProps) { accountName, limitInUse: 0, limitAvailable: limitAmount, + currentInvoiceAmount: 0, + currentInvoiceLabel: "", }; const { totalAmount, invoiceStatus, paymentDate } = invoiceData; diff --git a/src/features/cards/components/card-item.tsx b/src/features/cards/components/card-item.tsx index 5fe715c..2e75426 100644 --- a/src/features/cards/components/card-item.tsx +++ b/src/features/cards/components/card-item.tsx @@ -1,6 +1,8 @@ "use client"; import { + RiCalendarCloseLine, + RiCalendarScheduleLine, RiChat3Line, RiDeleteBin5Line, RiFileList2Line, @@ -33,6 +35,8 @@ interface CardItemProps { limit: number; limitInUse?: number; limitAvailable?: number; + currentInvoiceAmount: number; + currentInvoiceLabel: string; accountName: string; logo?: string | null; note?: string | null; @@ -52,6 +56,8 @@ export function CardItem({ limit, limitInUse, limitAvailable, + currentInvoiceAmount, + currentInvoiceLabel, accountName: _accountName, logo, note, @@ -77,7 +83,7 @@ export function CardItem({ return ( - +
{logoPath ? ( @@ -146,15 +152,17 @@ export function CardItem({ )}
-
- - Fecha em{" "} +
+ + + Fecha{" "} dia {formatDay(closingDay)} - - Vence em{" "} + + + Vence{" "} dia {formatDay(dueDay)} @@ -165,29 +173,40 @@ export function CardItem({
- Limite disponível + {currentInvoiceLabel}
-
-
+
+
Limite total
-
+ +
Limite utilizado +
+ +
+ + Limite disponível + +
@@ -200,7 +219,7 @@ export function CardItem({ aria-label={`${usagePercent.toFixed(0)}% do limite utilizado`} /> - {usagePercent.toFixed(1)}% utilizado + {usagePercent.toFixed(0)}% utilizado
@@ -220,7 +239,7 @@ export function CardItem({ className="flex items-center gap-1 font-medium text-primary transition-opacity hover:opacity-80" > - ver fatura + fatura