import { LinkPaymentHistoryListProps } from '../../model/types';
import { ListDateGroup } from '../list-date-group';

export const LinkPaymentHistoryList = ({
  additionalServiceCategory,
  listItems
}: LinkPaymentHistoryListProps) => {

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

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