import { LinkPaymentDateGroup } from './link-payment-date-group';

interface LinkPaymentTransaction {
  transactionId: string;
  customerName: string;
  status: string;
  channel: string;
  paymentMethod: string;
  amount: number;
}

interface LinkPaymentListProps {
  listItems: Record<string, LinkPaymentTransaction[]>;
}

export const LinkPaymentList = ({
  listItems
}: LinkPaymentListProps) => {

  const getListDateGroup = () => {
    let rs = [];
    for (const [key, value] of Object.entries(listItems)) {
      rs.push(
        <LinkPaymentDateGroup
          key={key}
          date={key}
          items={value}
        />
      );  
    }
    return rs;
  };

  return (
    <>
      <div className="transaction-list">
        {getListDateGroup()}
      </div>
    </>
  )
};