- No pudimos abrir el comprobante.
+ {t('reported.receiptError')}
{INLINE_IMAGES.has(query.data.mime) ? (
-

+

) : query.data.mime === 'application/pdf' ? (
-
+
) : (
@@ -46,7 +48,7 @@ export function ReceiptViewer({ reportId, title, onClose }: ReceiptViewerProps)
className="flex min-h-11 items-center justify-center gap-2 rounded-xl border border-border text-sm font-medium text-primary hover:bg-primary-soft"
>
- Abrir en otra pestaña
+ {t('reported.openTab')}
)}
diff --git a/apps/web/src/features/payments/ReportedPaymentCard.tsx b/apps/web/src/features/payments/ReportedPaymentCard.tsx
index eacfdde..c550c9d 100644
--- a/apps/web/src/features/payments/ReportedPaymentCard.tsx
+++ b/apps/web/src/features/payments/ReportedPaymentCard.tsx
@@ -2,7 +2,10 @@ import { useEffect, useRef, useState } from 'react'
import type { ReportedPaymentDto } from '@gruperly/shared'
import { Check, ChevronRight, FileText, Loader2, X } from 'lucide-react'
import { Avatar, Button, Input, Label } from '../../components/ui'
+import { i18n } from '../../i18n/instance'
+import { useIntlLocale } from '../../i18n'
import { formatPrice } from '../../lib/format'
+import { useTranslation } from 'react-i18next'
const UNDO_MS = 6000
@@ -20,12 +23,14 @@ type ReportedPaymentCardProps = {
function feeName(fee: ReportedPaymentDto['fees'][number]): string {
if (fee.description) return fee.description
- const month = new Date(fee.dueDate).toLocaleDateString('es-AR', { month: 'long', timeZone: 'UTC' })
+ const month = new Date(fee.dueDate).toLocaleDateString(i18n.language, { month: 'long', timeZone: 'UTC' })
return month.charAt(0).toUpperCase() + month.slice(1)
}
export function ReportedPaymentCard({ report, onOpenReceipt, onConfirm, onReject, onUndo, onSettled }: ReportedPaymentCardProps) {
const [outcome, setOutcome] = useState
(null)
+ const { t } = useTranslation(['payments', 'common'])
+ const locale = useIntlLocale()
const [rejecting, setRejecting] = useState(false)
const [reason, setReason] = useState('')
const [busy, setBusy] = useState(false)
@@ -53,7 +58,7 @@ export function ReportedPaymentCard({ report, onOpenReceipt, onConfirm, onReject
}
const amount = formatPrice(report.totalAmount, report.currency)
- const reportedAt = new Date(report.createdAt).toLocaleString('es-AR', {
+ const reportedAt = new Date(report.createdAt).toLocaleString(locale, {
day: 'numeric',
month: 'short',
hour: '2-digit',
@@ -71,11 +76,14 @@ export function ReportedPaymentCard({ report, onOpenReceipt, onConfirm, onReject
)}
- {outcome === 'confirmed' ? 'Confirmado' : 'Rechazado'}: {report.attendee.fullName} · {amount}
+ {t(outcome === 'confirmed' ? 'reported.confirmed' : 'reported.rejected', {
+ name: report.attendee.fullName,
+ amount,
+ })}
)
@@ -109,7 +117,7 @@ export function ReportedPaymentCard({ report, onOpenReceipt, onConfirm, onReject
- {report.receipt.available ? 'Ver comprobante' : 'Comprobante eliminado'}
+ {report.receipt.available ? t('reported.viewReceipt') : t('reported.receiptDeleted')}
{report.fees.map(feeName).join(', ')}
@@ -118,7 +126,7 @@ export function ReportedPaymentCard({ report, onOpenReceipt, onConfirm, onReject
{report.note ? (
- Nota del alumno
+ {t('reported.studentNote')}
{report.note}
) : null}
@@ -131,22 +139,22 @@ export function ReportedPaymentCard({ report, onOpenReceipt, onConfirm, onReject
void run(() => onReject(reason.trim() || null), 'rejected')
}}
>
-
+
setReason(event.target.value)} className="h-11" />
) : (
)}
{failed ? (
- No pudimos guardar el cambio. Probá de nuevo.
+ {t('reported.error')}
) : null}
diff --git a/apps/web/src/features/payments/ReportedPaymentsSection.tsx b/apps/web/src/features/payments/ReportedPaymentsSection.tsx
index 5d45e77..46e3ddd 100644
--- a/apps/web/src/features/payments/ReportedPaymentsSection.tsx
+++ b/apps/web/src/features/payments/ReportedPaymentsSection.tsx
@@ -5,12 +5,14 @@ import { confirmReportedPayment, rejectReportedPayment, undoPaymentReview } from
import { ReceiptViewer } from './ReceiptViewer'
import { ReportedPaymentCard } from './ReportedPaymentCard'
import { REPORTED_PAYMENTS_KEY, useReportedPayments } from './reportedPayments'
+import { useTranslation } from 'react-i18next'
/* "Pagos para verificar": receipts the students reported. Confirming marks the
fees as paid; a reviewed card stays a few seconds with "Deshacer" before it
leaves the list. */
export function ReportedPaymentsSection() {
const queryClient = useQueryClient()
+ const { t } = useTranslation('payments')
const { data } = useReportedPayments()
const [viewing, setViewing] = useState(null)
const reports = data?.data ?? []
@@ -26,7 +28,7 @@ export function ReportedPaymentsSection() {
return (
- Pagos para verificar
+ {t('reported.title')}
{reports.length}
diff --git a/apps/web/src/features/payments/copy.ts b/apps/web/src/features/payments/copy.ts
index c485c16..e13d9e4 100644
--- a/apps/web/src/features/payments/copy.ts
+++ b/apps/web/src/features/payments/copy.ts
@@ -1,5 +1,6 @@
import type { PaymentDto } from '@gruperly/shared'
import type { BadgeVariant } from '../../components/ui'
+import { i18n } from '../../i18n/instance'
export const PAYMENT_STATUS_BADGE: Record = {
PENDING: 'neutral',
@@ -14,9 +15,9 @@ export function paymentPeriodLabel(payment: PaymentDto): string {
export function paymentDateLabel(payment: PaymentDto): string {
if (payment.status === 'PAID' && payment.paidAt) {
- return `Cobrada el ${formatDay(payment.paidAt)}`
+ return i18n.t('payments:row.paidOn', { date: formatDay(payment.paidAt) })
}
- return `Vence el ${formatDay(payment.dueDate)}`
+ return i18n.t('payments:row.dueOn', { date: formatDay(payment.dueDate) })
}
/* Fechas sin hora: el vencimiento es un día, no un instante. */
@@ -24,7 +25,7 @@ function formatDay(iso: string): string {
const date = new Date(iso)
const today = new Date()
const sameYear = date.getFullYear() === today.getFullYear()
- return date.toLocaleDateString('es-MX', {
+ return date.toLocaleDateString(i18n.language, {
day: 'numeric',
month: 'short',
...(sameYear ? {} : { year: 'numeric' }),
diff --git a/apps/web/src/i18n/i18next.d.ts b/apps/web/src/i18n/i18next.d.ts
index b05dc05..a121342 100644
--- a/apps/web/src/i18n/i18next.d.ts
+++ b/apps/web/src/i18n/i18next.d.ts
@@ -13,6 +13,7 @@ import type analytics from './locales/es-AR/analytics.json'
import type attention from './locales/es-AR/attention.json'
import type attendeeDetail from './locales/es-AR/attendeeDetail.json'
import type classAttendance from './locales/es-AR/classAttendance.json'
+import type payments from './locales/es-AR/payments.json'
import type validation from './locales/es-AR/validation.json'
// es-AR es la fuente: una clave que no exista ahí rompe el typecheck.
@@ -27,6 +28,7 @@ declare module 'i18next' {
pwa: typeof pwa
settings: typeof settings
validation: typeof validation
+ 'payments': typeof payments
'classAttendance': typeof classAttendance
'attendeeDetail': typeof attendeeDetail
'attention': typeof attention
diff --git a/apps/web/src/i18n/locales/en/payments.json b/apps/web/src/i18n/locales/en/payments.json
new file mode 100644
index 0000000..c90bc13
--- /dev/null
+++ b/apps/web/src/i18n/locales/en/payments.json
@@ -0,0 +1,64 @@
+{
+ "title": "Payments",
+ "subtitle": "Track your groups' payments.",
+ "statusFilterLabel": "Filter by status",
+ "filters": {
+ "ALL": "All",
+ "PENDING": "Pending",
+ "PAID": "Paid",
+ "OVERDUE": "Overdue",
+ "CANCELLED": "Cancelled"
+ },
+ "loading": "Loading payments",
+ "loadError": "We couldn't load your payments.",
+ "empty": {
+ "title": "No payments yet",
+ "description": "Open a group's page and create the payment links for the period."
+ },
+ "prev": "Previous",
+ "next": "Next",
+ "pageInfo": "Page {{page}} of {{pages}} · {{count}} payments",
+ "updating": "Updating…",
+ "row": {
+ "paidOn": "Paid on {{date}}",
+ "dueOn": "Due {{date}}",
+ "copied": "Copied",
+ "copyLink": "Copy link",
+ "noLink": "No link",
+ "generate": "Create link"
+ },
+ "groupFilter": {
+ "label": "Group: {{name}}",
+ "all": "All groups",
+ "groups": "Groups",
+ "choose": "Choose group",
+ "create": "Create a new group",
+ "groupCount_one": "{{count}} group",
+ "groupCount_other": "{{count}} groups",
+ "members_one": "{{count}} member",
+ "members_other": "{{count}} members",
+ "perClass": "{{price}}/class",
+ "perMonth": "{{price}}/month",
+ "unpaid_one": "{{count}} pending payment",
+ "unpaid_other": "{{count}} pending payments"
+ },
+ "reported": {
+ "title": "Payments to verify",
+ "receipt": "Receipt",
+ "loadingReceipt": "Loading receipt",
+ "receiptError": "We couldn't open the receipt.",
+ "receiptAlt": "Receipt: {{name}}",
+ "openTab": "Open in a new tab",
+ "confirmed": "Confirmed: {{name}} · {{amount}}",
+ "rejected": "Declined: {{name}} · {{amount}}",
+ "undo": "Undo",
+ "viewReceipt": "View receipt",
+ "receiptDeleted": "Receipt deleted",
+ "studentNote": "Student's note",
+ "reason": "Reason (optional, the student will see it)",
+ "rejectPayment": "Decline payment",
+ "reject": "Decline",
+ "confirm": "Confirm",
+ "error": "We couldn't save the change. Please try again."
+ }
+}
diff --git a/apps/web/src/i18n/locales/es-419/payments.json b/apps/web/src/i18n/locales/es-419/payments.json
new file mode 100644
index 0000000..7ed6c7a
--- /dev/null
+++ b/apps/web/src/i18n/locales/es-419/payments.json
@@ -0,0 +1,64 @@
+{
+ "title": "Cobros",
+ "subtitle": "Sigue los pagos de tus grupos.",
+ "statusFilterLabel": "Filtrar por estado",
+ "filters": {
+ "ALL": "Todos",
+ "PENDING": "Pendientes",
+ "PAID": "Pagados",
+ "OVERDUE": "Vencidos",
+ "CANCELLED": "Anulados"
+ },
+ "loading": "Cargando cobros",
+ "loadError": "No pudimos cargar tus cobros.",
+ "empty": {
+ "title": "Todavía no hay cobros",
+ "description": "Entra a un grupo, abre la ficha y crea los links de cobro del período."
+ },
+ "prev": "Anteriores",
+ "next": "Siguientes",
+ "pageInfo": "Página {{page}} de {{pages}} · {{count}} cobros",
+ "updating": "Actualizando…",
+ "row": {
+ "paidOn": "Cobrada el {{date}}",
+ "dueOn": "Vence el {{date}}",
+ "copied": "Copiado",
+ "copyLink": "Copiar link",
+ "noLink": "Sin link",
+ "generate": "Generar link"
+ },
+ "groupFilter": {
+ "label": "Grupo: {{name}}",
+ "all": "Todos los grupos",
+ "groups": "Grupos",
+ "choose": "Elegir grupo",
+ "create": "Crear un grupo nuevo",
+ "groupCount_one": "{{count}} grupo",
+ "groupCount_other": "{{count}} grupos",
+ "members_one": "{{count}} miembro",
+ "members_other": "{{count}} miembros",
+ "perClass": "{{price}}/clase",
+ "perMonth": "{{price}}/mes",
+ "unpaid_one": "{{count}} cobro pendiente",
+ "unpaid_other": "{{count}} cobros pendientes"
+ },
+ "reported": {
+ "title": "Pagos para verificar",
+ "receipt": "Comprobante",
+ "loadingReceipt": "Cargando comprobante",
+ "receiptError": "No pudimos abrir el comprobante.",
+ "receiptAlt": "Comprobante: {{name}}",
+ "openTab": "Abrir en otra pestaña",
+ "confirmed": "Confirmado: {{name}} · {{amount}}",
+ "rejected": "Rechazado: {{name}} · {{amount}}",
+ "undo": "Deshacer",
+ "viewReceipt": "Ver comprobante",
+ "receiptDeleted": "Comprobante eliminado",
+ "studentNote": "Nota del alumno",
+ "reason": "Motivo (opcional, lo ve el alumno)",
+ "rejectPayment": "Rechazar pago",
+ "reject": "Rechazar",
+ "confirm": "Confirmar",
+ "error": "No pudimos guardar el cambio. Inténtalo de nuevo."
+ }
+}
diff --git a/apps/web/src/i18n/locales/es-AR/payments.json b/apps/web/src/i18n/locales/es-AR/payments.json
new file mode 100644
index 0000000..fb2a1b1
--- /dev/null
+++ b/apps/web/src/i18n/locales/es-AR/payments.json
@@ -0,0 +1,64 @@
+{
+ "title": "Cobros",
+ "subtitle": "Seguí los pagos de tus grupos.",
+ "statusFilterLabel": "Filtrar por estado",
+ "filters": {
+ "ALL": "Todos",
+ "PENDING": "Pendientes",
+ "PAID": "Pagados",
+ "OVERDUE": "Vencidos",
+ "CANCELLED": "Anulados"
+ },
+ "loading": "Cargando cobros",
+ "loadError": "No pudimos cargar tus cobros.",
+ "empty": {
+ "title": "Todavía no hay cobros",
+ "description": "Entrá a un grupo, abrí la ficha y creá los links de cobro del período."
+ },
+ "prev": "Anteriores",
+ "next": "Siguientes",
+ "pageInfo": "Página {{page}} de {{pages}} · {{count}} cobros",
+ "updating": "Actualizando…",
+ "row": {
+ "paidOn": "Cobrada el {{date}}",
+ "dueOn": "Vence el {{date}}",
+ "copied": "Copiado",
+ "copyLink": "Copiar link",
+ "noLink": "Sin link",
+ "generate": "Generar link"
+ },
+ "groupFilter": {
+ "label": "Grupo: {{name}}",
+ "all": "Todos los grupos",
+ "groups": "Grupos",
+ "choose": "Elegir grupo",
+ "create": "Crear un grupo nuevo",
+ "groupCount_one": "{{count}} grupo",
+ "groupCount_other": "{{count}} grupos",
+ "members_one": "{{count}} miembro",
+ "members_other": "{{count}} miembros",
+ "perClass": "{{price}}/clase",
+ "perMonth": "{{price}}/mes",
+ "unpaid_one": "{{count}} cobro pendiente",
+ "unpaid_other": "{{count}} cobros pendientes"
+ },
+ "reported": {
+ "title": "Pagos para verificar",
+ "receipt": "Comprobante",
+ "loadingReceipt": "Cargando comprobante",
+ "receiptError": "No pudimos abrir el comprobante.",
+ "receiptAlt": "Comprobante: {{name}}",
+ "openTab": "Abrir en otra pestaña",
+ "confirmed": "Confirmado: {{name}} · {{amount}}",
+ "rejected": "Rechazado: {{name}} · {{amount}}",
+ "undo": "Deshacer",
+ "viewReceipt": "Ver comprobante",
+ "receiptDeleted": "Comprobante eliminado",
+ "studentNote": "Nota del alumno",
+ "reason": "Motivo (opcional, lo ve el alumno)",
+ "rejectPayment": "Rechazar pago",
+ "reject": "Rechazar",
+ "confirm": "Confirmar",
+ "error": "No pudimos guardar el cambio. Probá de nuevo."
+ }
+}
diff --git a/apps/web/src/i18n/locales/pt-BR/payments.json b/apps/web/src/i18n/locales/pt-BR/payments.json
new file mode 100644
index 0000000..a9bef5c
--- /dev/null
+++ b/apps/web/src/i18n/locales/pt-BR/payments.json
@@ -0,0 +1,64 @@
+{
+ "title": "Cobranças",
+ "subtitle": "Acompanhe os pagamentos dos seus grupos.",
+ "statusFilterLabel": "Filtrar por status",
+ "filters": {
+ "ALL": "Todas",
+ "PENDING": "Pendentes",
+ "PAID": "Pagas",
+ "OVERDUE": "Vencidas",
+ "CANCELLED": "Canceladas"
+ },
+ "loading": "Carregando cobranças",
+ "loadError": "Não conseguimos carregar suas cobranças.",
+ "empty": {
+ "title": "Ainda não há cobranças",
+ "description": "Entre em um grupo, abra a página dele e crie os links de cobrança do período."
+ },
+ "prev": "Anteriores",
+ "next": "Próximas",
+ "pageInfo": "Página {{page}} de {{pages}} · {{count}} cobranças",
+ "updating": "Atualizando…",
+ "row": {
+ "paidOn": "Paga em {{date}}",
+ "dueOn": "Vence em {{date}}",
+ "copied": "Copiado",
+ "copyLink": "Copiar link",
+ "noLink": "Sem link",
+ "generate": "Gerar link"
+ },
+ "groupFilter": {
+ "label": "Grupo: {{name}}",
+ "all": "Todos os grupos",
+ "groups": "Grupos",
+ "choose": "Escolher grupo",
+ "create": "Criar um novo grupo",
+ "groupCount_one": "{{count}} grupo",
+ "groupCount_other": "{{count}} grupos",
+ "members_one": "{{count}} membro",
+ "members_other": "{{count}} membros",
+ "perClass": "{{price}}/aula",
+ "perMonth": "{{price}}/mês",
+ "unpaid_one": "{{count}} cobrança pendente",
+ "unpaid_other": "{{count}} cobranças pendentes"
+ },
+ "reported": {
+ "title": "Pagamentos para verificar",
+ "receipt": "Comprovante",
+ "loadingReceipt": "Carregando comprovante",
+ "receiptError": "Não conseguimos abrir o comprovante.",
+ "receiptAlt": "Comprovante: {{name}}",
+ "openTab": "Abrir em outra aba",
+ "confirmed": "Confirmado: {{name}} · {{amount}}",
+ "rejected": "Recusado: {{name}} · {{amount}}",
+ "undo": "Desfazer",
+ "viewReceipt": "Ver comprovante",
+ "receiptDeleted": "Comprovante excluído",
+ "studentNote": "Observação do aluno",
+ "reason": "Motivo (opcional, o aluno vai ver)",
+ "rejectPayment": "Recusar pagamento",
+ "reject": "Recusar",
+ "confirm": "Confirmar",
+ "error": "Não conseguimos salvar a alteração. Tente novamente."
+ }
+}