<?= $this->layout('_theme', ['title' => $title, 'subtitle' => 'Gerenciar todos os leilões']); ?>


<div class="flex flex-wrap gap-5 justify-center">
    <?php if ($auctions) :  foreach ($auctions as $auction) : ?>
            <div class="bg-gray-100 p-2 rounded-lg w-full max-w-xs text-[13px] text-center">
                <p class="bg-neutral-800 text-white p-1 rounded-lg"><?= $auction['title'] ?></p>
                <div class="mt-4">
                    <img src="<?= __resources("auctions/{$auction['image']}") ?>" class="w-28 h-32 object-container mx-auto">
                </div>
                <p class="text-neutral-900 p-1 mt-3 border-t border-neutral-300"><?= $auction['price'] ?> <?= $auction['coin_name'] ?></p>
                <p class="text-neutral-900 p-1 mt-3 border-t border-neutral-300">Fecha em: <?= date('d/m H:i', strtotime($auction['date'])) ?></p>

                <?php if ($auction['player_winner']) : ?>
                    <p class="text-neutral-900 p-1 mt-3 border-t border-neutral-300">Login: <?= $auction['player_winner']->account ?> | <?= $auction['player_winner']->price ?> <?= $auction['coin_name'] ?></p>
                <?php endif; ?>
                <div class="actions flex gap-5 justify-center mt-4">
                    <a class="bg-yellow-500 text-neutral-900 p-1 rounded-sm inline-block hover:bg-yellow-300" href="<?= __redirect("administration/to/edit/auction/{$auction['id']}") ?>" class="button-warning"> Editar </a>
                    <p class="button-danger bg-gray-500 text-white p-1 rounded-sm inline-block cursor-pointer hover:bg-gray-300"> Remover
                        <a class="hidden bg-gray-500 absolute top-0 left-0 text-white p-1 rounded-sm hover:bg-gray-300" href="<?= __redirect("administration/to/remove/auction/{$auction['id']}") ?>">Continuar?</a>
                    </p>
                </div>
            </div>
        <?php endforeach;
    else : ?>
        <div class="p-1 bg-yellow-300 text-sm rounded-full text-black text-center w-full">Não há leilão(ões) adicionado no momento</div>
    <?php endif; ?>

</div>