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

{% block content %}
<div class="container-fluid">
    <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
        <h1 class="h2">{% trans "Import Suppliers" %}</h1>
        <div class="btn-toolbar mb-2 mb-md-0">
            <a href="{% url 'suppliers' %}" class="btn btn-secondary">
                <i class="bi bi-arrow-left"></i> {% trans "Back to Suppliers" %}
            </a>
        </div>
    </div>

    <div class="row justify-content-center">
        <div class="col-md-6">
            <div class="card">
                <div class="card-header">
                    <h5 class="mb-0">{% trans "Upload Excel File" %}</h5>
                </div>
                <div class="card-body">
                    <div class="alert alert-info">
                        <i class="bi bi-info-circle"></i> {% trans "Excel Format Instructions:" %}<br>
                        <ul>
                            <li><strong>{% trans "Column A" %}:</strong> {% trans "Supplier Name - Required" %}</li>
                            <li><strong>{% trans "Column B" %}:</strong> {% trans "Contact Person - Optional" %}</li>
                            <li><strong>{% trans "Column C" %}:</strong> {% trans "Phone - Optional" %}</li>
                        </ul>
                        <small>{% trans "Please skip the first row (header)." %}</small>
                    </div>

                    <form method="post" enctype="multipart/form-data">
                        {% csrf_token %}
                        {% for field in form %}
                        <div class="mb-3">
                            <label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
                            {{ field }}
                            {% if field.help_text %}
                                <div class="form-text">{{ field.help_text }}</div>
                            {% endif %}
                            {% for error in field.errors %}
                                <div class="text-danger">{{ error }}</div>
                            {% endfor %}
                        </div>
                        {% endfor %}
                        <button type="submit" class="btn btn-primary w-100">
                            <i class="bi bi-upload"></i> {% trans "Import Suppliers" %}
                        </button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
