{% extends "layouts/base.html" %}
{% load static i18n %}

{% block title %}{% trans "Editar Troca" %} - {% trans "Battle Pass Manager" %}{% endblock %}

{% block extrastyle %}
{% include 'battle_pass/manager/_base_styles.html' %}
{% endblock %}

{% block content %}
<div class="manager-bg">
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-lg-8">
                <div class="d-flex flex-column flex-md-row justify-content-between align-items-start align-items-md-center mb-5">
                    <div class="page-header mb-3 mb-md-0">
                        <h2 class="mb-2">
                            <i class="bi bi-pencil text-warning me-2"></i>
                            {% trans "Editar Troca" %}
                        </h2>
                        <p class="text-white-50 mb-0">{{ exchange.item_name }}</p>
                    </div>
                    <a href="{% url 'games:battle_pass_manager_exchange_list' %}" class="btn btn-solid-white">
                        <i class="bi bi-arrow-left me-2"></i>{% trans "Voltar" %}
                    </a>
                </div>

                <div class="card card-glow">
                    <div class="card-body">
                        <form method="post">
                            {% csrf_token %}
                            <div class="row">
                                <div class="col-md-6 mb-3">
                                    <label for="item_id" class="form-label text-white">{% trans "Item ID" %} *</label>
                                    <input type="number" class="form-control form-dark" id="item_id" name="item_id" 
                                           value="{{ exchange.item_id }}" required min="0">
                                </div>
                                <div class="col-md-6 mb-3">
                                    <label for="item_name" class="form-label text-white">{% trans "Nome do Item" %} *</label>
                                    <input type="text" class="form-control form-dark" id="item_name" name="item_name" 
                                           value="{{ exchange.item_name }}" required>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-6 mb-3">
                                    <label for="item_enchant" class="form-label text-white">{% trans "Encantamento" %}</label>
                                    <input type="number" class="form-control form-dark" id="item_enchant" name="item_enchant" 
                                           value="{{ exchange.item_enchant }}" min="0">
                                </div>
                                <div class="col-md-6 mb-3">
                                    <label for="xp_amount" class="form-label text-white">{% trans "XP Recebido" %} *</label>
                                    <input type="number" class="form-control form-dark" id="xp_amount" name="xp_amount" 
                                           value="{{ exchange.xp_amount }}" required min="1">
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-6 mb-3">
                                    <label for="max_exchanges" class="form-label text-white">{% trans "Limite de Trocas" %}</label>
                                    <input type="number" class="form-control form-dark" id="max_exchanges" name="max_exchanges" 
                                           value="{{ exchange.max_exchanges }}" min="0">
                                    <small class="text-white-50">{% trans "0 = sem limite. Trocas atuais: " %}{{ exchange.current_exchanges }}</small>
                                </div>
                                <div class="col-md-6 mb-3">
                                    <div class="form-check mt-4">
                                        <input class="form-check-input" type="checkbox" id="is_active" name="is_active" 
                                               {% if exchange.is_active %}checked{% endif %}>
                                        <label class="form-check-label text-white" for="is_active">
                                            {% trans "Troca Ativa" %}
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="d-flex gap-2 mt-4">
                                <button type="submit" class="btn btn-warning">
                                    <i class="bi bi-check-circle me-2"></i>{% trans "Salvar Alterações" %}
                                </button>
                                <a href="{% url 'games:battle_pass_manager_exchange_list' %}" class="btn btn-solid-white">
                                    {% trans "Cancelar" %}
                                </a>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}

