import React from 'react'; import { Button, Icon } from '@akinon/next/components'; import type { InstallmentListProps } from '../types/custom-render.types'; const InstallmentList: React.FC = ({ installments, cardType, onInstallmentSelect, selectedInstallment, isLoading, onProceedToPayment, paymentLoading, texts }) => { return (
{texts.installmentOptionsText}
{/* Card Type Display */} {cardType && (
{texts.cardTypeLabel} {cardType.name}
)} {/* Installment Options */}
{installments.map((installment) => { const isSelected = selectedInstallment?.pk === installment.pk; const isNoInterest = installment.installment_count === 1; return (
onInstallmentSelect(installment)} className={` relative flex items-center justify-between p-3 border transition-all cursor-pointer ${ isSelected ? 'border-[#000000] bg-[#000000]/5' : 'border-[#eeeeee] hover:border-[#ebebeb]' } `} > {/* Radio Button */}
{isSelected && (
)}
{/* Installment Info */}
{installment.installment_count === 1 ? texts.singlePaymentText : texts.installmentsText?.replace( '{count}', installment.installment_count.toString() )} {isNoInterest && ( {texts.noInterestText} )}
{installment.price_with_accrued_interest}
{installment.installment_count > 1 && (
{installment.monthly_price_with_accrued_interest} {texts.perMonthText}
)}
); })}
{/* Payment Button */} {selectedInstallment && onProceedToPayment && (
)}
); }; export default InstallmentList;