diff --git a/api.saladeaula.digital/app/routes/orders/__init__.py b/api.saladeaula.digital/app/routes/orders/__init__.py index c97f154..505996a 100644 --- a/api.saladeaula.digital/app/routes/orders/__init__.py +++ b/api.saladeaula.digital/app/routes/orders/__init__.py @@ -23,7 +23,7 @@ def get_order(order_id: str): order = dyn.collection.get_items( TransactKey(order_id) + SortKey('0') - + SortKey('ITEMS', rename_key='items') + + SortKey('ITEMS', rename_key='items', path_spec='items') + SortKey('CREATED_BY', rename_key='created_by') + SortKey('ADDRESS', rename_key='address') + SortKey('CREDIT_CARD', rename_key='credit_card') @@ -45,5 +45,7 @@ def get_order(order_id: str): 'payment_attempts': attempts['items'], 'enrollments': enrollments['items'], } + # Post-migration (orders): remove the following lines + | ({'created_at': order['create_date']} if 'create_date' in order else {}) | ({'paid_at': order['payment_date']} if 'payment_date' in order else {}) ) diff --git a/apps/admin.saladeaula.digital/app/routes/_.$orgid.enrollments.buy/route.tsx b/apps/admin.saladeaula.digital/app/routes/_.$orgid.enrollments.buy/route.tsx index 4e95927..c122737 100644 --- a/apps/admin.saladeaula.digital/app/routes/_.$orgid.enrollments.buy/route.tsx +++ b/apps/admin.saladeaula.digital/app/routes/_.$orgid.enrollments.buy/route.tsx @@ -149,7 +149,7 @@ export default function Route({ -
+
Comprar matrĂ­culas 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 6789bdf..9358055 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 @@ -1,11 +1,12 @@ import type { Route } from './+types/route' import { formatCEP } from '@brazilian-utils/brazilian-utils' -import { Suspense, useEffect } from 'react' -import { Await, Link } from 'react-router' +import { CalendarClockIcon, CalendarIcon, UserIcon } from 'lucide-react' +import { useEffect } from 'react' +import { Link } from 'react-router' import { Currency } from '@repo/ui/components/currency' -import { Skeleton } from '@repo/ui/components/skeleton' +import { DateTime } from '@repo/ui/components/datetime' import { Breadcrumb, BreadcrumbItem, @@ -17,6 +18,8 @@ import { import { Card, CardContent, + CardDescription, + CardFooter, CardHeader, CardTitle } from '@repo/ui/components/ui/card' @@ -27,6 +30,15 @@ import { ItemGroup, ItemTitle } from '@repo/ui/components/ui/item' +import { + Table, + TableBody, + TableCell, + TableFooter, + TableHead, + TableHeader, + TableRow +} from '@repo/ui/components/ui/table' import { paymentMethods } from '@repo/ui/routes/orders/data' import { request as req } from '@repo/util/request' import { useWizardStore } from '../_.$orgid.enrollments.buy/store' @@ -51,8 +63,22 @@ export async function loader({ context, request, params }: Route.LoaderArgs) { export default function Route({ loaderData: { order } }: Route.ComponentProps) { const { reset } = useWizardStore() - const { address, total, credit_card, payment_method, invoice, installments } = - order + const { + status, + address, + total, + credit_card, + payment_method, + due_date, + created_at, + invoice, + installments, + interest_amount, + discount, + subtotal, + items = [], + created_by + } = order useEffect(() => { reset() @@ -74,12 +100,19 @@ export default function Route({ loaderData: { order } }: Route.ComponentProps) { - + Detalhes do pagamento + +
    +
  • + {due_date} +
  • +
+
- + @@ -120,7 +153,88 @@ export default function Route({ loaderData: { order } }: Route.ComponentProps) { {/*
{JSON.stringify(order, null, 2)}
*/} + + + + + Curso + Quantidade + Valor unit. + Total + + + + {items?.map(({ name, unit_price, quantity }, index) => { + return ( + + {name} + {quantity} + + {unit_price} + + + {unit_price * quantity} + + + ) + })} + + + {/* Summary */} + + + + Subtotal + + + {subtotal} + + + {/* Discount */} + + + Descontos + + + {discount} + + + {/* Interest */} + {interest_amount ? ( + + + Juros + + + {interest_amount} + + + ) : ( + <> + )} + {/* Total */} + + + Total + + + {total} + + + +
+ + {/* +
    +
  • + {created_at} +
  • {' '} +
  • + {created_by.name} +
  • +
+
*/}
)