Envios recentes
diff --git a/apps/admin.saladeaula.digital/app/routes/_.$orgid.payments.$id._index/route.tsx b/apps/admin.saladeaula.digital/app/routes/_.$orgid.payments.$id._index/route.tsx
index 6d410ca..7a119ce 100644
--- a/apps/admin.saladeaula.digital/app/routes/_.$orgid.payments.$id._index/route.tsx
+++ b/apps/admin.saladeaula.digital/app/routes/_.$orgid.payments.$id._index/route.tsx
@@ -2,7 +2,7 @@ import type { Route } from './+types/route'
import { formatCEP } from '@brazilian-utils/brazilian-utils'
import { zodResolver } from '@hookform/resolvers/zod'
-import { useRequest } from 'ahooks'
+import { useRequest, useToggle } from 'ahooks'
import {
AlertCircleIcon,
ArrowLeftRightIcon,
@@ -13,7 +13,7 @@ import {
} from 'lucide-react'
import { useEffect } from 'react'
import { useForm } from 'react-hook-form'
-import { Link } from 'react-router'
+import { Link, useRevalidator } from 'react-router'
import { z } from 'zod'
import { Currency } from '@repo/ui/components/currency'
@@ -31,13 +31,6 @@ import {
CardHeader,
CardTitle
} from '@repo/ui/components/ui/card'
-import {
- Command,
- CommandEmpty,
- CommandGroup,
- CommandItem,
- CommandList
-} from '@repo/ui/components/ui/command'
import {
Item,
ItemActions,
@@ -121,6 +114,13 @@ type User = {
type Invoice = {
invoice_id: string
secure_url: string
+ bank_slip?: {
+ bank_slip_pdf_url: string
+ }
+ pix?: {
+ qrcode: string
+ qrcode_text: string
+ }
}
type Attempts = {
@@ -180,6 +180,8 @@ export default function Route({ loaderData: { order } }: Route.ComponentProps) {
reset()
}, [])
+ console.log(order)
+
return (
@@ -203,7 +205,8 @@ export default function Route({ loaderData: { order } }: Route.ComponentProps) {
- -
+
-
+ {/* Billing address */}
Endereço de cobrança
@@ -218,14 +221,12 @@ export default function Route({ loaderData: { order } }: Route.ComponentProps) {
-
+ {/* Payment method */}
-
Forma de pagamento
- {Component && (
-
- )}
+ {Component && }
@@ -315,8 +316,6 @@ export default function Route({ loaderData: { order } }: Route.ComponentProps) {
-
- {/*{JSON.stringify(order, null, 2)}*/}
)
}
@@ -326,7 +325,7 @@ function Status({ status: s }: { status: string }) {
const { icon: Icon, color } = statuses?.[s] ?? { icon: HelpCircleIcon }
return (
-
+
{status}
@@ -337,7 +336,7 @@ type PaymentMethodProps = {
id: string
status: string
total: number
- invoice_id: string
+ invoice: Invoice
installments: number
}
@@ -345,7 +344,7 @@ type BankSlipPaymentMethodProps = PaymentMethodProps & {}
function BankSlipPaymentMethod({ status }: BankSlipPaymentMethodProps) {
return (
-
+
- Boleto bancário
-
@@ -356,8 +355,27 @@ function BankSlipPaymentMethod({ status }: BankSlipPaymentMethodProps) {
type PixPaymentMethodrops = PaymentMethodProps & {}
-function PixPaymentMethod({}: PixPaymentMethodrops) {
- return <>Pix>
+function PixPaymentMethod({ invoice, status }: PixPaymentMethodrops) {
+ return (
+
+
+
+ {invoice?.pix ? (
+
+ {invoice.pix.qrcode_text}
+
+ ) : null}
+
+ )
}
function UnknownPaymentMethod() {
@@ -365,7 +383,7 @@ function UnknownPaymentMethod() {
}
type CreditCardPaymentMethodProps = PaymentMethodProps & {
- stats: { last_attempt_succeeded: boolean }
+ stats?: { last_attempt_succeeded: boolean }
credit_card: { last4: string; brand: string }
}
@@ -375,22 +393,20 @@ function CreditCardPaymentMethod({
total,
credit_card,
installments,
- invoice_id,
+ invoice,
stats
}: CreditCardPaymentMethodProps) {
return (
<>
-
+
-
- {credit_card.brand} (Crédito) **** {credit_card.last4}
+ {credit_card.brand}
+ - (Crédito) **** {credit_card.last4}
-
- {stats.last_attempt_succeeded === false ? (
-
- Pagamento não aprovado
+ {stats?.last_attempt_succeeded === false ? (
+
+ Negado
) : (
@@ -402,13 +418,13 @@ function CreditCardPaymentMethod({
{installments}x {total / Number(installments)}
- {stats.last_attempt_succeeded === false ? (
-
+ {stats?.last_attempt_succeeded === false && invoice?.invoice_id ? (
+