{if !$frameDisplay}{include file='structure/top.tpl'}{/if}

<table class="table table-hover scrollingTableList">
    <thead>
        <th class="center visible-lg id">
            <a href={if $order=="ref" && $sens=="ASC"}"?order=ref&sens=DESC"
                {else}"?order=ref&sens=ASC"{/if} style="text-decoration: none;">
                #{if $order=="ref"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
            </a>
        </th>
        <th class="name">
            <a href={if $order=="prenom" && $sens=="ASC"}"?order=prenom&sens=DESC"
                {else}"?order=prenom&sens=ASC"{/if} style="text-decoration: none;">
                {if $order=="prenom"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}prénom
            </a>
            <a href={if $order=="nom" && $sens=="ASC"}"?order=nom&sens=DESC"
                {else}"?order=nom&sens=ASC"{/if} style="text-decoration: none;">
                nom{if $order=="nom"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
            </a>
        </th>
        <th class="visible-lg groupe">
            <a href={if $order=="groupe" && $sens=="ASC"}"?order=groupe&sens=DESC"
                {else}"?order=groupe&sens=ASC"{/if} style="text-decoration: none;">
                groupe{if $order=="groupe"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
            </a>
        </th>
        <th class="visible-lg contrat_type">
            <a href={if $order=="type" && $sens=="ASC"}"?order=type&sens=DESC"
                {else}"?order=type&sens=ASC"{/if} style="text-decoration: none;">
                type{if $order=="type"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
            </a>
        </th>
        <th class="visible-md visible-lg center date">
            <a href={if $order=="date" && $sens=="ASC"}"?order=date&sens=DESC"
                {else}"?order=date&sens=ASC"{/if} style="text-decoration: none;">
                début de contrat{if $order=="date"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
            </a>
        </th>
        <th class="visible-md visible-lg center freq">
            <a href={if $order=="frequence" && $sens=="ASC"}"?order=frequence&sens=DESC"
                {else}"?order=frequence&sens=ASC"{/if} style="text-decoration: none;">
                fréquence{if $order=="frequence"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
            </a>
        </th>
        <th class="visible-md visible-lg center panier_type">
            <a href={if $order=="panier_type" && $sens=="ASC"}"?order=panier_type&sens=DESC"
                {else}"?order=panier_type&sens=ASC"{/if} style="text-decoration: none;">
                type de panier{if $order=="panier_type"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
            </a>
        </th>
        <th class="visible-md visible-lg center items_long">
            <a href={if $order=="nb_paniers_livre" && $sens=="ASC"}"?order=nb_paniers_livre&sens=DESC"
                {else}"?order=nb_paniers_livre&sens=ASC"{/if} style="text-decoration: none;">
                livrés{if $order=="nb_paniers_livre"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
            </a>
        </th>
        <th class="visible-lg center items_long">
            <a href={if $order=="nb_paniers_restant" && $sens=="ASC"}"?order=nb_paniers_restant&sens=DESC"
                {else}"?order=nb_paniers_restant&sens=ASC"{/if} style="text-decoration: none;">
                restants{if $order=="nb_paniers_restant"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
            </a>
        </th>
        <th class="visible-md visible-lg center lieu">
            <a href={if $order=="lieu_depot" && $sens=="ASC"}"?order=lieu_depot&sens=DESC"
                {else}"?order=lieu_depot&sens=ASC"{/if} style="text-decoration: none;">
                lieu de dépôt{if $order=="lieu_depot"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
            </a>
        </th>
        <th class="btn_action right" colspan="2"><button class="btn btn-xs btn-info glyphicon glyphicon-plus" id="btnAddContrat"></button></th>
    </thead>
    <tbody class="table progressLoadList" id="contratsList" start="{$list_limits.start}" end="{$list_limits.end}" rest="{$list_limits.rest}">
    {include file='contrats/contrats_list_builder.tpl'}
    </tbody>
</table>

{include file='contrats/contrat_modal_view.tpl'}

<!-- MODAL ADD CONTRAT -->
<div class="modal fade" id="modalAddContrat" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <div class="pull-right hidden-xs">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
                    <button type="button" class="btn btn-custom btnSave">Enregistrer</button>
                </div>
                <h2 class="modal-title">
                    <img style="width:50px;" class="hidden-xs" src="img/contrat.svg">
                    Ajouter un contrat
                </h2>
            </div>
            <div class="modal-body">
                <form class="formContrat">
                    {include file='contrats/contrat_form.tpl'}
                </form>
            </div>
            <div class="modal-footer visible-xs">
                <div class="pull-right">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
                    <button type="button" class="btn btn-custom btnSave">Enregistrer</button>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- end MODAL ADD CONTRAT -->

<!-- MODAL EDIT CONTRAT -->
<div class="modal fade" id="modalEditContrat" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <div class="pull-right hidden-xs">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
                    <button type="button" class="btn btn-custom btnSave">Enregistrer</button>
                </div>
                <h2 class="modal-title">
                    <img style="width:50px;" class="hidden-xs" src="img/contrat.svg">
                    Modifier un contrat
                </h2>
            </div>
            <div class="modal-body">
                <form class="formContrat">
                    {include file='contrats/contrat_form.tpl'}
                </form>
            </div>
            <div class="modal-footer visible-xs">
                <div class="pull-right">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
                    <button type="button" class="btn btn-custom btnSave">Enregistrer</button>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- end MODAL EDIT CONTRAT -->

<!-- MODAL ARCHIVE CONTRAT -->
<div class="modal fade" id="modalArchiveContrat" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <h2 class="modal-title">
                    <img style="width:50px;" class="hidden-xs" src="img/contrat.svg">
                    Archiver un contrat
                </h2>
            </div>
            <div class="modal-body">
                <p>Etes-vous sûr de vouloir archiver le contrat <b class="ref">REF</b> de <b class="name">NAME</b> ?</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
                <button type="button" class="btn btn-danger btnSave">Confirmer</button>
            </div>
        </div>
    </div>
</div>
<!-- end MODAL ARCHIVE CONTRAT -->

<!-- MODAL DELETE CONTRAT -->
<div class="modal fade" id="modalDeleteContrat" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <h2 class="modal-title">
                    <img style="width:50px;" class="hidden-xs" src="img/contrat.svg">
                    Supprimer un contrat
                </h2>
            </div>
            <div class="modal-body">
                <p>Etes-vous sûr de vouloir supprimer le contrat <b class="ref">REF</b> de <b class="name">NAME</b> ?</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
                <button type="button" class="btn btn-danger btnSave">Confirmer</button>
            </div>
        </div>
    </div>
</div>
<!-- end MODAL DELETE CONTRAT -->

{if !$frameDisplay}{include file='structure/bottom.tpl'}{/if}