<?= $this->layout('_theme', ['title' => $title, 'subtitle' => 'Todos os characters']); ?>

<div class="admin-form admin-datatable p-4 bg-gray-100 rounded-lg">
    <?php if ($characters) : ?>
        <table id="tableitem" class="display" style="width:100%">
            <thead>
                <tr>
                    <th>Nome</th>
                    <th>Conta</th>
                    <th>Condição</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($characters as $character) : ?>
                    <tr>
                        <td class="text-xs text-white" align="center"><?= $character->name ?></td>
                        <td class="text-xs" align="center"><?= $character->account ?></td>
                        <td class="text-xs" align="center"><?= ($character->code == 1 ? 'Banido' : 'Normal') ?  ($character->code >= config['number_staff'] ? 'staff' : 'normal') : 'banido' ?></td>
                        <td>
                            <a class="bg-sky-500 text-white p-1 text-xs rounded-sm hover:bg-sky-700" href="<?= __redirect("administration/character/edit/{$character->name}") ?>">Editar</a>
                        </td>
                    </tr>
                <?php endforeach; ?>
            </tbody>

        </table>
    <?php else : ?>
        <div class="p-1 bg-yellow-300 text-sm rounded-full text-black text-center w-full">Não há personagens criado no momento</div>
    <?php endif ?>
</div>