<?php $acc = account($account['account']) ?>

<h1 class="title"><?= __('Market') ?></h1>

<ul class="breadcrumber">
    <li><a href="<?= url_to('/') ?>" data-ajax><?= __('Home') ?></a></li>
    <li><a href="<?= url_to('/market/accounts') ?>" data-ajax><?= __('Account Market') ?></a></li>
    <li class="active"><?= $acc->getName() ?></li>
</ul>

<div class="box-panel">
    <div class="box-panel-title"><?= __('Account') ?></div>
    <div class="box-panel-content">
        <table class="list">
            <tr>
                <td width="100"><?= __('Name') ?></td>
                <td><?= $acc->getName() ?></td>
            </tr>
            <?php if (has_vip_system()): ?>
                <tr>
                    <td><?= __('Account type') ?></td>
                    <td><?= util('Account')->vipName($acc->getVipType()) ?></td>
                </tr>

                <?php if ($acc->getVipType()): ?>
                    <tr>
                        <td><?= __('Maturity') ?></td>
                        <td><?= ($acc->getVipExpire() ? util('Date')->date($acc->getVipExpire()) : '') ?></td>
                    </tr>
                <?php endif ?>
            <?php endif ?>
            <tr>
                <td><?= __('Credits') ?></td>
                <td><?= util('Number')->currency($acc->getCredit()) ?></td>
            </tr>
            <?php foreach (config('coins', []) as $id => $coin): ?>
                <tr>
                    <td><?= $coin['name'] ?></td>
                    <td><?= util('Number')->format($acc->getCoin($coin['id'])) ?></td>
                </tr>
            <?php endforeach ?>
        </table>
    </div>
</div>


<div class="box-panel" style="margin-top:10px">
    <div class="box-panel-title"><?= __('Characters') ?></div>
    <div class="box-panel-content">
        <table class="list">
            <thead>
            <tr>
                <th><?= __('Name') ?></th>
                <th><?= __('Class') ?></th>
                <?php if (config('columns.resets')): ?>
                    <th><?= __('Resets') ?></th>
                <?php endif ?>
                <th><?= __('Level') ?></th>
                <th><?= __('Strength') ?></th>
                <th><?= __('Agility') ?></th>
                <th><?= __('Vitality') ?></th>
                <th><?= __('Energy') ?></th>
                <th><?= __('Command') ?></th>
            </tr>
            </thead>

            <tbody>
            <?php foreach ($acc->getCharacters() as $character): ?>
                <tr>
                    <td><?= $character->getName() ?></td>
                    <td><?= util('Character')->className($character->getClass()) ?></td>
                    <?php if (config('columns.resets')): ?>
                        <td><?= $character->getResets() ?></td>
                    <?php endif ?>
                    <td><?= $character->getLevel() ?></td>
                    <td><?= $character->getStrength() ?></td>
                    <td><?= $character->getAgility() ?></td>
                    <td><?= $character->getVitality() ?></td>
                    <td><?= $character->getEnergy() ?></td>
                    <td><?= $character->isDl() ? $character->getCommand() : '-' ?></td>
                </tr>
            <?php endforeach ?>
            </tbody>
        </table>
    </div>
</div>

<div class="align-center" style="margin-top: 20px">
    <a data-ajax href="<?= url_to('/market/accounts/' . $account['id'] . '/pay') ?>" class="btn"><?= __('Buy account') ?></a>
</div>