import { SmsPaymentListProps } from '../../model/sms-payment/types';
import { AdditionalServiceCategory } from '../../model/types';
import { ListDateGroup } from '../list-date-group';

export const SmsPaymentList = ({
    listItems,
    mid,
    onResendClick
}: SmsPaymentListProps) => {

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

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