<?= $this->layout('_theme', ['title' => $title, 'subtitle' => 'Editar pacote ' . $package['title']]); ?>

<div class="p-4 bg-gray-100 rounded-lg">
    <form action="<?= __redirect('administration/auth/update/package') ?>">
        <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="hidden" name="id" value="<?= $package['id'] ?>">
        <div>
            <p class="px-1 py-3 text-[13px]">Título do pacote</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="Digite aqui o título do pacote" maxlength="80" value="<?= $package['title'] ?>">
        </div>

        <div>
            <p class="px-1 py-3 text-[13px]">Descrição do pacote</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="description" placeholder="Descrição do pacote" value="<?= $package['description'] ?>">
        </div>

        <div>
            <p class="px-1 py-3 text-[13px]">Moeda a ser cobrada</p>
            <div>
                <select class="rounded-sm p-2 my-1 text-xs w-full border border-neutral-400 focus:outline-none focus:bg focus:bg-neutral-100" name="coin_demand" id="">
                    <option value="">-- Selecione uma moeda</option>
                    <?php foreach ($coins_deman as $key => $coin) : ?>
                        <option value="<?= $key ?>" <?= $coin['name_coin']  == $package['coin_demand_name'] ? 'selected' : '' ?>><?= $coin['name_coin'] ?></option>
                    <?php endforeach; ?>
                </select>
            </div>
        </div>

        <div>
            <p class="px-1 py-3 text-[13px]">Preço do pacote</p>
            <div>
                <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="number" name="price" placeholder="0" value="<?= $package['price'] ?>">
            </div>
        </div>

        <div class="p-2 bg-gray-200 mt-2">
            <div>
                <p class="px-1 py-3 text-[13px]"><sup class="text-red-500 font-semibold">Preecha os campo somente se o pacote for receber moedas</sup></p>
                <p class="px-1 py-3 text-[13px]">Moeda a receber</p>
                <div class="categorys d-flex f-wrap gap-40 align-center">
                    <select class="rounded-sm p-2 my-1 text-xs w-full border border-neutral-400 focus:outline-none focus:bg focus:bg-neutral-100" name="coin" id="">
                        <option value="">-- Selecione a moeda</option>
                        <?php foreach ($coins_deman as $key => $coin) : ?>
                            <option value="<?= $key ?>" <?= $coin['name_coin']  == $package['coin_name'] ? 'selected' : '' ?>><?= $coin['name_coin'] ?></option>
                        <?php endforeach; ?>
                    </select>
                </div>
            </div>

            <div>
                <p class="px-1 py-3 text-[13px]">Quantidade de moeda</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="number" name="quantity" placeholder="0" value="<?= $package['quantity'] ?>">
            </div>
        </div>

        <div class="p-2 bg-gray-200 mt-2">
            <div>
                <p class="px-1 py-3 text-[13px]"><sup class="text-red-500 font-semibold">Preecha os campo somente se o pacote for receber vip</sup></p>
                <p class="px-1 py-3 text-[13px]">Vips</p>
                <div class="categorys d-flex f-wrap gap-40 align-center">
                    <select class="rounded-sm p-2 my-1 text-xs w-full border border-neutral-400 focus:outline-none focus:bg focus:bg-neutral-100" name="vip_type" id="">
                        <option value="">-- Selecione o tipo de vip</option>
                        <?php foreach ($vips as $key => $vip) : if ($key >= 1) :  ?>
                                <option value="<?= $key ?>" <?= $key  == $package['vip_type'] ? 'selected' : '' ?>><?= $vip ?></option>
                        <?php endif;
                        endforeach;
                        ?>
                    </select>
                </div>
            </div>

            <div>
                <p class="px-1 py-3 text-[13px]">Quantidade de dias</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="number" name="vip_time" placeholder="0" value="<?= $package['vip_time'] ?>">
            </div>
        </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>