<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

use Magento\Braintree\Block\Customer\PayPal\VaultTokenRenderer;
use Magento\Vault\Api\Data\PaymentTokenInterface;

/** @var VaultTokenRenderer $block */

$payerEmail = $block->getPayerEmail();
$confirmDeleteMessage = sprintf('%s: %s?', __('Are you sure you want to delete this PayPal account'), $payerEmail);
?>
<tr>
    <td data-th="<?= $block->escapeHtml(__('PayPal Account')) ?>" class="col paypal-account">
        <img src="<?= /* @noEscape */ $block->getIconUrl() ?>"
             width="<?= /* @noEscape */ $block->getIconWidth() ?>"
             height="<?= /* @noEscape */ $block->getIconHeight() ?>"
             alt="<?= $block->escapeHtml(__('PayPal Logo')) ?>">
        <span><?= $block->escapeHtml($payerEmail) ?></span>
    </td>
    <td data-th="<?= $block->escapeHtml(__('Actions')) ?>" class="col actions">
        <form
            class="form"
            action="<?= $block->escapeUrl($block->getUrl('vault/cards/deleteaction')) ?>"
            method="post">
            <?= $block->getBlockHtml('formkey') ?>
            <input
                name="<?= /* @noEscape */ PaymentTokenInterface::PUBLIC_HASH ?>"
                value="<?= /* @noEscape */ $block->getToken()->getPublicHash() ?>"
                type="hidden"/>
            <button type="submit"
                    class="action delete"
                    data-mage-init='{
                        "Magento_Vault/js/customer_account/deleteWidget":{
                            "type": "popup",
                            "modalClass": "my-credit-cards-popup",
                            "toggleEvent": "click",
                            "title": "<?= $block->escapeHtml(__('Delete')) ?>",
                            "content":"<?= $block->escapeHtml($confirmDeleteMessage) ?>"
                        }
                    }'>
                <span><?= $block->escapeHtml(__('Delete')) ?></span>
            </button>
        </form>
    </td>
</tr>
