feat: add payment options on student portal
This commit is contained in:
@@ -103,7 +103,7 @@ export function InviteToAppSheet({
|
||||
}
|
||||
>
|
||||
<div className="space-y-4">
|
||||
<div className="rounded-2xl rounded-tl-sm bg-success-soft px-4 py-3 text-sm text-primary" aria-label="Vista previa del mensaje">
|
||||
<div className="rounded-2xl rounded-tl-sm bg-success-soft px-4 py-3 text-sm text-primary break-words" aria-label="Vista previa del mensaje">
|
||||
{preview}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Link } from '@tanstack/react-router'
|
||||
import type { StudentFee } from '@gruperly/shared'
|
||||
import { Receipt } from 'lucide-react'
|
||||
import { ExternalLink, Receipt } from 'lucide-react'
|
||||
import { Badge } from '../../components/ui'
|
||||
import { formatPrice } from '../../lib/format'
|
||||
import { feeLabel } from './format'
|
||||
@@ -12,6 +12,10 @@ export function FeeCard({ fees }: { fees: StudentFee[] }) {
|
||||
const first = fees[0] as StudentFee
|
||||
const toReport = fees.filter((fee) => fee.status !== 'reported')
|
||||
const total = toReport.reduce((sum, fee) => sum + fee.amount, 0)
|
||||
// Cada cuota tiene su propio link de MP: con varias, se elige en Pagos.
|
||||
const payable = toReport.filter((fee) => fee.checkoutUrl)
|
||||
const single = payable.length === 1 ? (payable[0] as StudentFee) : null
|
||||
const primary = 'flex min-h-12 items-center justify-center gap-2 rounded-xl bg-accent font-semibold text-on-accent hover:bg-accent-strong'
|
||||
|
||||
return (
|
||||
<article className="rounded-2xl border border-border bg-surface p-5">
|
||||
@@ -32,13 +36,29 @@ export function FeeCard({ fees }: { fees: StudentFee[] }) {
|
||||
) : null}
|
||||
</div>
|
||||
{toReport.length > 0 ? (
|
||||
<Link
|
||||
to="/student/report-payment"
|
||||
className="mt-4 flex min-h-12 items-center justify-center gap-2 rounded-xl bg-accent font-semibold text-on-accent hover:bg-accent-strong"
|
||||
>
|
||||
<Receipt className="size-5" aria-hidden="true" />
|
||||
Informar pago
|
||||
</Link>
|
||||
<div className="mt-4 space-y-2">
|
||||
{single ? (
|
||||
<a href={single.checkoutUrl ?? undefined} target="_blank" rel="noreferrer" className={primary}>
|
||||
Pagar con Mercado Pago
|
||||
<ExternalLink className="size-4" aria-hidden="true" />
|
||||
</a>
|
||||
) : payable.length > 1 ? (
|
||||
<Link to="/student/payments" className={primary}>
|
||||
Pagar con Mercado Pago
|
||||
</Link>
|
||||
) : null}
|
||||
<Link
|
||||
to="/student/report-payment"
|
||||
className={
|
||||
payable.length > 0
|
||||
? 'flex min-h-12 items-center justify-center gap-2 rounded-xl border border-border font-semibold text-primary hover:bg-primary-soft'
|
||||
: primary
|
||||
}
|
||||
>
|
||||
<Receipt className="size-5" aria-hidden="true" />
|
||||
Informar pago
|
||||
</Link>
|
||||
</div>
|
||||
) : (
|
||||
<p className="mt-3 text-sm text-secondary">Tu profe tiene que confirmar el pago que informaste.</p>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user