<?php $this->layout('main', ['title' => __('API Keys'), 'manual' => true]); ?>

<div class="card">
    <div class="card-header ch-alt">
        <h2><?=__('API Keys') ?></h2>
    </div>
    <div class="table-responsive">
        <table class="table table-striped">
            <colgroup>
                <col width="20%">
                <col width="25%">
                <col width="30%">
                <col width="25%">
            </colgroup>
            <thead>
            <tr>
                <th>&nbsp;</th>
                <th><?=__('API Key') ?></th>
                <th><?=__('Comments') ?></th>
                <th><?=__('Owner') ?></th>
            </tr>
            </thead>
            <tbody>
            <?php foreach($records as $record): ?>
                <tr class="input">
                    <td class="center">
                        <a class="btn btn-sm btn-primary" href="<?=$router->named('admin:api:edit', ['id' => $record['id']]) ?>"><?=__('Edit') ?></a>
                        <a class="btn btn-sm btn-danger" href="<?=$router->named('admin:api:delete', ['id' => $record['id'], 'csrf' => $csrf]) ?>"><?=__('Revoke') ?></a>
                    </td>
                    <td><code><?=$record['id'] ?></code></td>
                    <td><?=$this->e($record['comment']) ?></td>
                    <td><?=$this->e($record['user']['email']) ?></td>
                </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>
</div>
