<?php
/**
 * Maho
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
 * @copyright   Copyright (c) 2021-2024 The OpenMage Contributors (https://openmage.org)
 * @copyright   Copyright (c) 2024 Maho (https://mahocommerce.com)
 * @license     https://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

/** @var Mage_Oauth_Block_Customer_Token_List $this */
?>
<?= $this->getMessagesBlock()->toHtml() ?>
<div class="page-title">
    <h1><?= $this->__('My Applications') ?></h1>
</div>
<?php if ($this->getCollection() && $this->count()): ?>
    <?= $this->getToolbarHtml() ?>
        <table class="data-table" id="my-apps-table">
            <col />
            <col width="100" align="right" />
            <col width="110" align="right" />
            <thead>
                <tr>
                    <th><?= $this->__('App Name') ?></th>
                    <th><?= $this->__('Status') ?></th>
                    <th>&nbsp;</th>
                </tr>
            </thead>
            <tbody>
                <?php /** @var Mage_Oauth_Model_Token $item */ ?>
                <?php foreach ($this->getCollection() as $item) : ?>
                <tr>
                    <td><span class="app-name">
                        <?= $this->escapeHtml($item->getName()) ?></span></td>
                    <td><em><?= $this->getStatusLabel($item->getRevoked()) ?></em></td>
                    <td align="right">
                        <a href="<?= $this->getUpdateRevokeLink($item) ?>" class="nobr"
                            onclick="return confirm('<?= $this->getChangeStatusConfirmMessage($item->getRevoked()) ?>')">
                            <?= $this->getChangeStatusLabel($item->getRevoked()) ?></a>
                        <span class="separator">|</span> <a href="<?= $this->getDeleteLink($item) ?>" class="nobr"
                            onclick="return confirm('<?= $this->__('Are you sure you want to delete this application?') ?>')">
                        <?= $this->__('Delete') ?></a></td>
                </tr>
                <?php endforeach ?>
            </tbody>
        </table>
    <?= $this->getToolbarHtml() ?>
<?php else: ?>
    <p><?= $this->__('You have no applications.') ?></p>
<?php endif ?>
