feat: add country selection during onboarding and implement payment management features

- Introduced CountryStep component for selecting the country during onboarding, affecting payment currency.
- Updated FirstGroupStep to include country information.
- Enhanced PaymentsProvider to manage payment states and renewals.
- Created PaymentRow component for displaying individual payment details.
- Implemented PaymentsView for listing and filtering payments by group and status.
- Added API endpoints for fetching and creating payments, including batch processing.
- Defined payment schemas for validation and data handling.
- Updated GroupHeader and GroupDetailView to include charging functionality for group members.
This commit is contained in:
Jose Selesan
2026-10-08 11:42:13 -03:00
parent b11dd47534
commit 8c5caecdda
49 changed files with 2367 additions and 90 deletions

View File

@@ -0,0 +1,32 @@
import type { PaymentDto } from '@gruperly/shared'
import type { BadgeVariant } from '../../components/ui'
export const PAYMENT_STATUS_BADGE: Record<PaymentDto['status'], BadgeVariant> = {
PENDING: 'neutral',
PAID: 'success',
OVERDUE: 'danger',
CANCELLED: 'warning',
}
export function paymentPeriodLabel(payment: PaymentDto): string {
return payment.description ?? payment.groupName
}
export function paymentDateLabel(payment: PaymentDto): string {
if (payment.status === 'PAID' && payment.paidAt) {
return `Cobrada el ${formatDay(payment.paidAt)}`
}
return `Vence el ${formatDay(payment.dueDate)}`
}
/* Fechas sin hora: el vencimiento es un día, no un instante. */
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', {
day: 'numeric',
month: 'short',
...(sameYear ? {} : { year: 'numeric' }),
})
}