{% extends 'mainapp/base.html' %}

{% block title %}Загрузка данных из CSV{% endblock %}

{% block content %}
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-lg-8">
                <div class="card shadow-sm">
                    <div class="card-header bg-success text-white">
                        <h2 class="mb-0">Загрузка данных из CSV</h2>
                    </div>
                    <div class="card-body">
                        <p class="card-text">Загрузите CSV-файл для загрузки данных в базу.</p>
                        
                        <form method="post" enctype="multipart/form-data">
                            {% csrf_token %}
                            
                            <!-- Form fields with Bootstrap styling -->
                            {% include 'mainapp/components/_form_field.html' with field=form.file %}
                            
                            <!-- Automatic checkbox -->
                            <div class="mb-3">
                                <div class="form-check">
                                    {{ form.is_automatic }}
                                    <label class="form-check-label" for="{{ form.is_automatic.id_for_label }}">
                                        {{ form.is_automatic.label }}
                                    </label>
                                    {% if form.is_automatic.help_text %}
                                    <div class="form-text">{{ form.is_automatic.help_text }}</div>
                                    {% endif %}
                                </div>
                            </div>
                            
                            <div class="d-grid gap-2 d-md-flex justify-content-md-end">
                                <a href="{% url 'mainapp:source_list' %}" class="btn btn-secondary me-md-2">Назад</a>
                                <button type="submit" class="btn btn-success">Добавить в базу</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}