{% extends '@PrestaShop/Admin/layout.html.twig' %}

{% block content %}
    <div class="row justify-content-center">
        <div class="col">
            <div class="card">
                <div class="card-header">Export comptable</div>
                <div class="card-block row">
                    <div class="card-text">
                        {{ form(exportForm, {attr : {class: 'form'}}) }}
                    </div>
                </div>
            </div>
        </div>
    </div>

    {% if stats is not null %}
        <div class="row justify-content-center">
            <div class="col">
                <div class="card">
                    <div class="card-header">Export du {{ startDate|date('d/m/Y') }} au {{ endDate|date('d/m/Y') }}
                        inclus
                    </div>
                    <div class="card-block">
                        <div class="card-text">
                            <div class="row">
                                <div class="col-md-2">Nombre de factures</div>
                                <div class="col-md-10">{{ stats.nbInvoices }}</div>
                            </div>
                            <div class="row">
                                <div class="col-md-2">Nombre d'avoirs</div>
                                <div class="col-md-10">{{ stats.nbSlips }}</div>
                            </div>
                            <div class="row">
                                <div class="col-md-2">Nombre d'erreurs</div>
                                <div class="col-md-10">{{ stats.nbErrors }}</div>
                            </div>
                            <div class="row">
                                <div class="col-md-2">Nombre de lignes</div>
                                <div class="col-md-10">{{ stats.nbLines }}</div>
                            </div>
                            <div class="row">
                                <div class="col-md-2">Documents en erreur</div>
                                <div class="col-md-10">
                                    <ul>
                                        {% for document in stats.errors %}
                                            <li>{{ document }}</li>
                                        {% endfor %}
                                    </ul>
                                </div>
                            </div>
                        </div>

                        {{ form(downloadForm) }}
                    </div>
                </div>
            </div>
        </div>
    {% endif %}
{% endblock %}
