<div id="container" class="row">
    <div class="col-lg-12">
        <div class="panel">
            <form action="index.php" method="get" class="form-horizontal">
                <input type="hidden" name="controller" value="AdminMyVetShopExportComptable">
                <input type="hidden" name="token" value="{getAdminToken tab='AdminMyVetShopExportComptable'}">
                <div class="row row-margin-bottom">
                    <div class="col-md-2">
                        <select name="type">
                            <option value="comptable"{if $type == 'comptable'} selected{/if}>Export comptable</option>
                            <option value="remboursement"{if $type == 'remboursement'} selected{/if}>Remboursements</option>
                        </select>
                    </div>
                    <div class="col-md-10">
                        Période du <input type="date" name="start" value="{$start}" required/>
                        au <input type="date" name="end" value="{$end}" required/> inclu
                        <button type="submit">Générer</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

{if isset($info_exports) and not empty($info_exports) }
    <div id="container" class="row">
        <div class="col-md-12 panel">
            <div class="panel-heading">
                Informations de l'export
            </div>
            {if isset($info_exports.nb_commandes)}
                <div class="row">
                    <div class="col-md-2"><strong>Nombre de commandes</strong></div>
                    <div class="col-md-10">{$info_exports.nb_commandes}</div>
                </div>
            {/if}
            {if isset($info_exports.nb_remboursements)}
                <div class="row">
                    <div class="col-md-2"><strong>Nombre de remboursements</strong></div>
                    <div class="col-md-10">{$info_exports.nb_remboursements}</div>
                </div>
            {/if}
            {if isset($info_exports.nb_errors)}
                <div class="row">
                    <div class="col-md-2"><strong>Nombre de commandes en erreur</strong></div>
                    <div class="col-md-10">{$info_exports.nb_errors}</div>
                </div>
            {/if}
            {if isset($info_exports.nb_success)}
                <div class="row">
                    <div class="col-md-2"><strong>Nombre de commandes valides</strong></div>
                    <div class="col-md-10">{$info_exports.nb_success}</div>
                </div>
            {/if}
            {if isset($info_exports.nb_lignes)}
                <div class="row">
                    <div class="col-md-2"><strong>Nombre de lignes</strong></div>
                    <div class="col-md-10">{$info_exports.nb_lignes}</div>
                </div>
            {/if}
            {if $info_exports.nb_errors > 0}
                <div class="row">
                    <div class="col-md-2"><strong>Liste des commandes en erreur</strong></div>
                    <div class="col-md-10">
                        <ul>
                            {foreach from=$info_exports.commandes_erreurs item=id_order name=orderError}
                                <li>Commande n° : {$id_order}</li>
                            {/foreach}
                        </ul>
                    </div>
                </div>
            {/if}

            <div class="row">
                <div class="col-md-12">
                    <form action="index.php" method="post" class="form-horizontal">
                        <input type="hidden" name="controller" value="AdminMyVetShopExportComptable">
                        <input type="hidden" name="token" value="{getAdminToken tab='AdminMyVetShopExportComptable'}">
                        <input type="hidden" name="action" value="download{$type|capitalize}">
                        <input type="hidden" name="start" value="{$start}">
                        <input type="hidden" name="end" value="{$end}">
                        <button type="submit">Télécharger l'export</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
{else}
    <div id="container" class="row">
        <div class="col-lg-12 panel">
            <div class="panel-heading">
                Sélectionnez une plage de date
            </div>
            <div class="row">
                <div class="col-md-12">Sélectionnez les dates de début / fin de l'export comptable puis cliquez sur "Générer" pour afficher les informations</div>
            </div>
        </div>
    </div>
{/if}
