{% extends "industry_reforged/base.html" %}
{% load i18n %}

{% block details %}
<div class="container-fluid">
    <div class="row mb-3">
        <div class="col-12">
            <h3>{% trans "Create New Order" %}</h3>
            <a href="{% url 'industry_reforged:orders_dashboard' %}" class="btn btn-primary"><i class="fas fa-arrow-left"></i> {% trans "Back to Orders" %}</a>
        </div>
    </div>



    <div class="row">
        <div class="col-md-8">
            <div class="card border-0 mb-4">
                <div class="card-header">
                    <h3 class="card-title">{% trans "Paste EFT Fit" %}</h3>
                </div>
                <form method="post" action="{% url 'industry_reforged:create_order' %}">
                    {% csrf_token %}
                    <div class="card-body">
                        <div class="mb-3">
                            <label for="character_id" class="form-label">{% trans "Order for Character" %}</label>
                            <select name="character_id" id="character_id" class="form-select bg-dark text-white border-secondary" required>
                                <option value="">-- {% trans "Select Character" %} --</option>
                                {% for char in characters %}
                                    <option value="{{ char.character_id }}">{{ char.character_name }}</option>
                                {% endfor %}
                            </select>
                        </div>
                        <div class="mb-3">
                            <label for="fit_text" class="form-label">{% trans "EFT / Pyfa Fit" %}</label>
                            <textarea name="fit_text" id="fit_text" rows="15" class="form-control bg-dark text-white border-secondary" placeholder="[Drake, My Fit]&#10;Heavy Missile Launcher II&#10;...&#10;&#10;Scourge Fury Heavy Missile x1000" required></textarea>
                            <small class="form-text text-muted">Paste your fit directly from EVE Online or Pyfa. The system will automatically parse the items and quantities to generate a quote.</small>
                        </div>
                    </div>
                    <div class="card-footer bg-transparent border-0 text-end">
                        <button type="submit" class="btn btn-success"><i class="fas fa-calculator"></i> {% trans "Generate Quote" %}</button>
                    </div>
                </form>
            </div>
        </div>
        <div class="col-md-4">
            <div class="card border-0 mb-4 bg-dark">
                <div class="card-header border-bottom border-secondary">
                    <h3 class="card-title text-warning">{% trans "How it works" %}</h3>
                </div>
                <div class="card-body">
                    <ol>
                        <li>Select the character requesting the order.</li>
                        <li>Paste your EFT format fit in the text box.</li>
                        <li>Click <strong>Generate Quote</strong>.</li>
                        <li>The system will fetch real-time Jita Sell prices via Fuzzwork and apply any corporation discounts.</li>
                        <li>You can review the itemized quote before confirming your order.</li>
                    </ol>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
