{% extends 'aapayout/base.html' %}
{% load i18n %}

{% block details %}
<div class="container-fluid">
    <div class="row mb-4">
        <div class="col-12">
            <h2>{% translate "Create Loot Pool for" %} {{ fleet.name }}</h2>
        </div>
    </div>

    <div class="row">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
                    <h5>{% translate "Loot Information" %}</h5>
                </div>
                <div class="card-body">
                    <form method="post">
                        {% csrf_token %}

                        {% if form.non_field_errors %}
                        <div class="alert alert-danger">
                            {{ form.non_field_errors }}
                        </div>
                        {% endif %}

                        <div class="mb-3">
                            <label for="{{ form.name.id_for_label }}" class="form-label">
                                {{ form.name.label }} <span class="text-danger">*</span>
                            </label>
                            {{ form.name }}
                            {% if form.name.errors %}
                                <div class="text-danger">{{ form.name.errors }}</div>
                            {% endif %}
                        </div>

                        <div class="mb-3">
                            <label for="{{ form.pricing_method.id_for_label }}" class="form-label">
                                {{ form.pricing_method.label }} <span class="text-danger">*</span>
                            </label>
                            {{ form.pricing_method }}
                            {% if form.pricing_method.errors %}
                                <div class="text-danger">{{ form.pricing_method.errors }}</div>
                            {% endif %}
                        </div>

                        <div class="mb-3">
                            <label for="{{ form.raw_loot_text.id_for_label }}" class="form-label">
                                {{ form.raw_loot_text.label }} <span class="text-danger">*</span>
                            </label>
                            {{ form.raw_loot_text }}
                            {% if form.raw_loot_text.errors %}
                                <div class="text-danger">{{ form.raw_loot_text.errors }}</div>
                            {% endif %}
                            {% if form.raw_loot_text.help_text %}
                                <small class="form-text text-muted">{{ form.raw_loot_text.help_text }}</small>
                            {% endif %}
                        </div>

                        <div class="d-flex justify-content-between">
                            <a href="{% url 'aapayout:fleet_detail' fleet.pk %}" class="btn btn-secondary">
                                <i class="fas fa-arrow-left"></i> {% translate "Cancel" %}
                            </a>
                            <button type="submit" class="btn btn-primary">
                                <i class="fas fa-save"></i> {% translate "Create & Value Loot" %}
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <div class="col-md-4">
            <div class="card border-info">
                <div class="card-header bg-info text-white">
                    <h5>{% translate "Instructions" %}</h5>
                </div>
                <div class="card-body">
                    <h6>{% translate "Pasting Loot from EVE" %}</h6>
                    <ol class="small">
                        <li>{% translate "Open your EVE inventory" %}</li>
                        <li>{% translate "Select the items you want to value" %}</li>
                        <li>{% translate "Press Ctrl+C (or Cmd+C on Mac)" %}</li>
                        <li>{% translate "Paste into the loot text area" %}</li>
                    </ol>
                    <hr>
                    <h6>{% translate "Example Format" %}</h6>
                    <pre class="small bg-dark text-light p-2 rounded">Compressed Arkonor	1000
Compressed Bistot	500
Capital Armor Plates	10</pre>
                    <hr>
                    <h6>{% translate "What Happens Next" %}</h6>
                    <ul class="small">
                        <li>{% translate "Items will be sent to Janice API for valuation" %}</li>
                        <li>{% translate "Prices based on Jita buy orders" %}</li>
                        <li>{% translate "You can manually adjust prices after" %}</li>
                        <li>{% translate "Corp share is auto-set to 10% if per-character payout > 200k ISK" %}</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
