<section class="content-header">
    <h1><?= __('Search results') ?></h1>
</section>

<section class="content">
    <?php if (empty($accounts)): ?>
        <div class="callout callout-warning">
            <h4>Ops!</h4>
            <p><?= __('No account found') ?></p>
        </div>
    <?php else: ?>
        <div class="box box-default">
            <table class="table table-condensed table-hover table-striped">
                <thead>
                    <tr>
                        <th width="120"><?= __('Account') ?></th>
                        <th><?= __('Characters') ?></th>
                        <th><?= __('Email') ?></th>
                        <th><?= __('Last IP') ?></th>
                    </tr>
                </thead>

                <tbody>

                    <?php foreach ($accounts as $account): ?>
                        <tr<?= $account['blocked'] ? ' class="border-error"' : '' ?>>
                            <td style="white-space:nowrap">
                                <a data-ajax href="<?= admin_url_to('/accounts/edit/' . $account['username']) ?>"><?= $account['username'] ?></a>
                                <?php if ($account['blocked']): ?>
                                    <span class="label label-danger" style="vertical-align:1px;"><?= strtoupper(__('Blocked')) ?></span>
                                <?php endif ?>
                            </td>
                            <td>
                                <?php foreach ($account['characters'] as $key => $character): ?>
                                    <span class="label label-default">
                                        <a data-ajax href="<?= admin_url_to('/characters/edit/' . $character['name']) ?>"><?= $character['name'] ?></a>
                                    </span>
                                <?php endforeach ?>
                            </td>
                            <td><?= $account['email'] ?></td>
                            <td><?= $account['ip'] ?></td>
                        </tr>
                    <?php endforeach ?>
                </tbody>
            </table>
        </div>
    <?php endif ?>
</section>