<?php
/**
 * OpenMage
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available at https://opensource.org/license/afl-3-0-php
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
 * @copyright   Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
 * @license     https://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

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