<?php
/**
 * @author      Open Source Team
 * @copyright   2022 Pagar.me (https://pagar.me)
 * @license     https://pagar.me Copyright
 *
 * @link        https://pagar.me
 */

/** @var \Woocommerce\Pagarme\Block\Order\Charge $this */

declare( strict_types=1 );

if (!function_exists('add_action')) {
    exit(0);
}
?>
<?php if ($this->getCharge() && $this->getCharge()->getTransactions()) : ?>
    <?php foreach ($this->getCharge()->getTransactions() as $transaction) : ?>
        <table aria-describedby="pagarme-payment-detail-title"  class="woocommerce-table">
            <thead>
                <tr>
                    <th colspan="2"><?= __($this->getTransactionType($transaction), 'woo-pagarme-payments'); ?></th>
                </tr>
            </thead>
            <tbody>
                <?=
                    $this->createBlock(
                        $this->getTransactionClass($transaction),
                        'pagarme.order.charge.transaction',
                        [
                            'transaction' => $transaction,
                            'orderId' => $this->getCharge()->getCode()
                        ]
                    )->toHtml();
                ?>
                <tr>
                    <th><?= __('Status', 'woo-pagarme-payments'); ?>:</th>
                    <td><?= $this->getChargeStatus(); ?></td>
                </tr>
            </tbody>
        </table>
    <?php endforeach; ?>
<?php endif; ?>
