From 3e080a2d21744c269fd491de0890aff8a471e41e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Rafael=20Siqueira?= Date: Sun, 25 Jan 2026 21:22:18 -0300 Subject: [PATCH] add seats --- .../enrollments.tsx | 62 ++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/apps/admin.saladeaula.digital/app/routes/_.$orgid.payments.$id._index/enrollments.tsx b/apps/admin.saladeaula.digital/app/routes/_.$orgid.payments.$id._index/enrollments.tsx index 1f062a5..73bfb18 100644 --- a/apps/admin.saladeaula.digital/app/routes/_.$orgid.payments.$id._index/enrollments.tsx +++ b/apps/admin.saladeaula.digital/app/routes/_.$orgid.payments.$id._index/enrollments.tsx @@ -3,6 +3,7 @@ import { CheckCircle2Icon, CircleDashedIcon, ClockIcon, + EllipsisIcon, HelpCircleIcon, type LucideIcon } from 'lucide-react' @@ -11,13 +12,20 @@ import { Abbr } from '@repo/ui/components/abbr' import { DateTime } from '@repo/ui/components/datetime' import { Avatar, AvatarFallback } from '@repo/ui/components/ui/avatar' import { Badge } from '@repo/ui/components/ui/badge' +import { Button } from '@repo/ui/components/ui/button' import { Card, + CardAction, CardContent, CardDescription, CardHeader, CardTitle } from '@repo/ui/components/ui/card' +import { + Popover, + PopoverContent, + PopoverTrigger +} from '@repo/ui/components/ui/popover' import { Table, TableBody, @@ -50,6 +58,10 @@ export function Enrollments({ Acompanhe o status e os detalhes de todas as matrículas relacionadas a esta compra. + + + + @@ -149,7 +161,7 @@ const statuses: Record = { } const labels: Record = { - PENDING: 'Pendente', + PENDING: 'Aguardando', EXECUTED: 'Executado', SCHEDULED: 'Agendado', ROLLBACK: 'Revogado' @@ -166,3 +178,51 @@ function Status({ status: s }: { status: string }) { ) } + +function SeatsMenu({ seats: seats_ }: { seats: Seat[] }) { + const seats = Object.values( + seats_.reduce((acc: any, { course }) => { + acc[course.id] ??= { course, quantity: 0 } + acc[course.id].quantity++ + return acc + }, {}) + ) as { course: Seat['course']; quantity: number }[] + + return ( + + + + + +
+ {seats.length > 0 ? ( + <> +
+

Matrículas abertas

+

+ Matrículas que estão abertas e relacionadas a esta compra. +

+
+ +
    + {seats.map(({ course, quantity }) => { + return ( +
  • + {quantity}x {course.name} +
  • + ) + })} +
+ + ) : ( +

+ Nenhuma matrícula aberta foi encontrada para esta compra. +

+ )} +
+
+
+ ) +}