<?= $this->layout('_theme', ['title' => $title, 'subtitle' => 'Adicionar leilão']); ?>

<div class="p-4 bg-gray-100 rounded-lg">
    <form action="<?= __redirect('administration/auth/auction/update/' . $auction->id) ?>">
        <div>
            <p class="px-1 py-3 text-[13px]">Título</p>
            <input class="rounded-sm p-2 my-1 text-xs w-full border border-neutral-400 focus:outline-none focus:bg focus:bg-neutral-100" type="text" name="title" placeholder="Título do leilão" maxlength="80" value="<?= $auction->title ?>">
        </div>

        <div>
            <p class="px-1 py-3 text-[13px]">Imagem</p>
            <input class="rounded-sm p-2 my-1 text-xs w-full border border-neutral-400 focus:outline-none focus:bg focus:bg-neutral-100" type="file" name="image">
        </div>

        <div>
            <p class="px-1 py-3 text-[13px]">Moedas</p>
            <ul class="items-center w-full text-[13px] font-medium text-gray-900 bg-white border border-gray-200 rounded-lg sm:flex dark:bg-gray-700 dark:border-gray-600 dark:text-white">
                <?php foreach ($coins as $key => $coin) : ?>
                    <li class="w-full border-b border-gray-200 sm:border-b-0 sm:border-r dark:border-gray-600">
                        <div class="flex items-center pl-3">
                            <input id="<?= $key ?>" type="radio" <?= $coin['column_coin'] == $auction->coin ? 'checked' : '' ?> value="<?= $key ?>" name="coin" class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500">
                            <label for="<?= $key ?>" class="w-full py-3 ml-2 text-[13px] font-medium text-gray-900"><?= $coin['name_coin'] ?></label>
                        </div>
                    </li>
                <?php endforeach; ?>
            </ul>
        </div>
        <div>
            <p class="px-1 py-3 text-[13px]" >Preço</p>
            <input class="rounded-sm p-2 my-1 text-xs w-full border border-neutral-400 focus:outline-none focus:bg focus:bg-neutral-100" type="text" name="price" placeholder="Valor a cobrar" maxlength="5" value="<?= $auction->price ?>">
        </div>

        <div>
            <p class="px-1 py-3 text-[13px]">Data e hora</p>
            <input class="rounded-sm p-2 my-1 text-xs w-full border border-neutral-400 focus:outline-none focus:bg focus:bg-neutral-100" type="datetime-local" name="date" value="<?= date('Y-m-d H:i:s', strtotime($auction->date)) ?>">
        </div>

        <button class="rounded-lg py-3 px-6 bg-sky-500 text-white block mt-4 mx-auto text-sm border-2 border-sky-400 hover:bg-sky-700 transition ease-in-out duration-500" type="submit">Salvar</button>
    </form>
</div>