"use client"; import MoneyValues from "@/shared/components/money-values"; import { Badge } from "@/shared/components/ui/badge"; import { Checkbox } from "@/shared/components/ui/checkbox"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/shared/components/ui/table"; import type { EligibleInstallment } from "@/shared/lib/installments/anticipation-types"; import { formatCurrentInstallment } from "@/shared/lib/installments/utils"; import { formatShortPeriodLabel } from "@/shared/utils/period"; import { cn } from "@/shared/utils/ui"; interface InstallmentSelectionTableProps { installments: EligibleInstallment[]; selectedIds: string[]; onSelectionChange: (ids: string[]) => void; } export function InstallmentSelectionTable({ installments, selectedIds, onSelectionChange, }: InstallmentSelectionTableProps) { const toggleSelection = (id: string) => { const newSelection = selectedIds.includes(id) ? selectedIds.filter((selectedId) => selectedId !== id) : [...selectedIds, id]; onSelectionChange(newSelection); }; const toggleAll = () => { if (selectedIds.length === installments.length && installments.length > 0) { onSelectionChange([]); } else { onSelectionChange(installments.map((inst) => inst.id)); } }; if (installments.length === 0) { return (
Nenhuma parcela elegível para antecipação encontrada.
Todas as parcelas desta compra já foram pagas ou antecipadas.