remove cc button on invalid order

This commit is contained in:
2026-01-26 14:12:51 -03:00
parent 2d191c5fc8
commit fa555dd166
2 changed files with 48 additions and 6 deletions

View File

@@ -39,8 +39,7 @@ import type { Enrollment, Seat } from './route'
const dtOptions: Intl.DateTimeFormatOptions = { const dtOptions: Intl.DateTimeFormatOptions = {
hour: '2-digit', hour: '2-digit',
minute: '2-digit', minute: '2-digit'
second: '2-digit'
} }
export function Enrollments({ export function Enrollments({

View File

@@ -154,6 +154,9 @@ type Order = Order_ & {
interest_amount: number interest_amount: number
due_date: string due_date: string
created_at: string created_at: string
paid_at?: string
canceled_at?: string
expired_at?: string
subtotal: number subtotal: number
discount: number discount: number
address: Address address: Address
@@ -196,6 +199,9 @@ export default function Route({ loaderData: { order } }: Route.ComponentProps) {
enrollments = [], enrollments = [],
seats = [], seats = [],
items = [], items = [],
created_at,
expired_at,
paid_at,
subtotal subtotal
} = order } = order
@@ -251,9 +257,44 @@ export default function Route({ loaderData: { order } }: Route.ComponentProps) {
<Item variant="outline" className="items-start"> <Item variant="outline" className="items-start">
<ItemContent> <ItemContent>
<ItemTitle>Forma de pagamento</ItemTitle> <ItemTitle>Forma de pagamento</ItemTitle>
<div className="text-muted-foreground text-sm leading-normal font-normal text-balance"> <div className="text-muted-foreground text-sm leading-normal font-normal text-balance space-y-2.5">
<div>
{Component && <Component {...order} invoice={invoice} />} {Component && <Component {...order} invoice={invoice} />}
</div> </div>
<ul>
{paid_at && (
<li>
Pago em{' '}
<DateTime
options={{ hour: '2-digit', minute: '2-digit' }}
>
{paid_at}
</DateTime>
</li>
)}
{expired_at && (
<li>
Expirado em{' '}
<DateTime
options={{ hour: '2-digit', minute: '2-digit' }}
>
{expired_at}
</DateTime>
</li>
)}
<li>
Comprado em{' '}
<DateTime
options={{ hour: '2-digit', minute: '2-digit' }}
>
{created_at}
</DateTime>
</li>
</ul>
</div>
</ItemContent> </ItemContent>
{payment_attempts.length > 0 ? ( {payment_attempts.length > 0 ? (
@@ -454,7 +495,7 @@ function CreditCardPaymentMethod({
</li> </li>
<li>(Crédito) **** {credit_card.last4}</li> <li>(Crédito) **** {credit_card.last4}</li>
<li> <li>
{stats?.last_attempt_succeeded === false ? ( {stats?.last_attempt_succeeded === false && status === 'PENDING' ? (
<Badge variant="outline" className="text-red-400 px-1.5"> <Badge variant="outline" className="text-red-400 px-1.5">
<AlertCircleIcon /> Negado <AlertCircleIcon /> Negado
</Badge> </Badge>
@@ -468,7 +509,9 @@ function CreditCardPaymentMethod({
{installments}x <Currency>{total / Number(installments)}</Currency> {installments}x <Currency>{total / Number(installments)}</Currency>
</p> </p>
{stats?.last_attempt_succeeded === false && invoice?.invoice_id ? ( {stats?.last_attempt_succeeded === false &&
status === 'PENDING' &&
invoice?.invoice_id ? (
<div className="lg:flex justify-center mt-2"> <div className="lg:flex justify-center mt-2">
<CreditCardPaymentDialog <CreditCardPaymentDialog
id={id} id={id}