import { PaymentOptionsConfig } from '@/lib/api'; import Card from '@/components/ui/Card'; import Button from '@/components/ui/Button'; import clsx from 'clsx'; import { CreditCardIcon, BuildingLibraryIcon, BoltIcon, BanknotesIcon, ArrowPathIcon, CheckCircleIcon, XCircleIcon, } from '@heroicons/react/24/outline'; import type { PaymentOverridesController } from '../_hooks/usePaymentOverrides'; interface PaymentsTabProps { locale: string; payments: PaymentOverridesController; } export function PaymentsTab({ locale, payments }: PaymentsTabProps) { const { loadingPayments, hasPaymentOverrides, savingPayments, globalPaymentOptions, paymentOverrides, getEffectivePaymentOption, updatePaymentOverride, handleResetToGlobal, handleSavePaymentOptions, } = payments; return (
{loadingPayments ? (
) : ( <> {/* Header */}

{locale === 'es' ? 'Métodos de Pago del Evento' : 'Event Payment Methods'}

{hasPaymentOverrides ? (locale === 'es' ? 'Configuración personalizada' : 'Custom settings') : (locale === 'es' ? 'Usando configuración global' : 'Using global settings')}

{hasPaymentOverrides && ( )}
{/* TPago */}

{locale === 'es' ? 'TPago / Tarjeta' : 'TPago / Card'}

{locale === 'es' ? 'Requiere aprobación' : 'Requires approval'}

{globalPaymentOptions && !globalPaymentOptions.tpagoEnabled && ( {locale === 'es' ? '(Deshabilitado global)' : '(Disabled globally)'} )}
{getEffectivePaymentOption('tpagoEnabled') && (

{locale === 'es' ? 'Cada enlace tiene un monto fijo. Un enlace distinto por cantidad de tickets.' : 'Each link has a fixed amount. One link per ticket quantity.'}

{([1, 2, 3, 4, 5] as const).map((qty) => { const key = (qty === 1 ? 'tpagoLink' : `tpagoLink${qty}`) as keyof PaymentOptionsConfig; return (
{qty} {qty === 1 ? 'ticket' : 'tickets'} updatePaymentOverride(key, (e.target.value || null) as any)} placeholder={(globalPaymentOptions?.[key] as string | null) || 'https://www.tpago.com.py/links?alias=...'} className="flex-1 px-3 py-2 text-sm rounded-btn border border-secondary-light-gray focus:outline-none focus:ring-2 focus:ring-primary-yellow" />
); })}