{% extends 'base.html' %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-6">
        <div class="glass-card">
            <h2 class="mb-4">Editar Opção de Pagamento</h2>
            <form method="POST" enctype="multipart/form-data">
                {% csrf_token %}
                <div class="mb-3">
                    <label class="form-label">Título da Opção</label>
                    <input type="text" name="title" value="{{ option.title }}" class="form-control bg-dark text-white border-secondary" required>
                </div>
                <div class="row">
                    <div class="col-md-6 mb-3">
                        <label class="form-label">Preço (R$)</label>
                        <input type="number" step="0.01" name="price" value="{{ option.price|stringformat:'.2f' }}" class="form-control bg-dark text-white border-secondary" required>
                    </div>
                    <div class="col-md-6 mb-3">
                        <label class="form-label">Duração (Dias)</label>
                        <input type="number" name="duration_days" value="{{ option.duration_days }}" class="form-control bg-dark text-white border-secondary" required>
                    </div>
                </div>
                <div class="mb-3">
                    <label class="form-label">QR Code 1 (Janela Principal)</label>
                    <input type="file" name="qr1" class="form-control bg-dark text-white border-secondary">
                    {% if option.qr_code_1 %}
                        <div class="mt-2 small text-info">Atual: {{ option.qr_code_1.name }}</div>
                    {% endif %}
                </div>
                <div class="mb-3">
                    <label class="form-label">QR Code 2 (Janela Secundária)</label>
                    <input type="file" name="qr2" class="form-control bg-dark text-white border-secondary">
                    {% if option.qr_code_2 %}
                        <div class="mt-2 small text-info">Atual: {{ option.qr_code_2.name }}</div>
                    {% endif %}
                </div>
                <div class="mt-4 d-flex gap-3">
                    <button type="submit" class="btn btn-primary px-5 rounded-pill">SALVAR</button>
                    <a href="{% url 'admin_dashboard' %}" class="btn btn-outline-light px-5 rounded-pill">VOLTAR</a>
                </div>
            </form>
        </div>
    </div>
</div>
{% endblock %}
