<head>
{foreach from=$cssFiles item=file}
    <link href="{$file}" rel="stylesheet" media="all">
{/foreach}
</head>

<body class="print contrats" orientation="portrait">
    <table class="printHeader">
        <tr>
            <th class="titre">{$date}<br/>{$time}</th>
            <th class="page">
                LISTE DES CONTRATS
                {if $list|@count==1}
                    {assign var=first value=$list|@key}
                    <br/><span class="groupe">{$list.$first.nom}</span>
                    {if $list.$first.lieux|@count>1}<br/><span class="nb_contrats">({$list.$first.nb_contrats} contrat{if $list.$first.nb_contrats>1}s{/if})</span>{/if}
                {/if}
            </th>
            <th class="logo"><img src="{$logo}"></th>
        </tr>
    </table>
    
{foreach from=$list item=groupe name=list}
    {if $list|@count>1}
    <h1 class="groupe_contrat{if !$smarty.foreach.list.first} page_break{/if}">{$groupe.nom}</h1>
    <h3 class="groupe_nb_contrat">({$groupe.nb_contrats} contrat{if $groupe.nb_contrats>1}s{/if})</h3>
    {/if}
    {foreach from=$groupe.lieux item=lieu}
    <table class="table listPrint no-break">
        <thead>
            <tr class="main_title">
                <th colspan="2">{if $list|@count>1}{$groupe.nom|upper} - {/if}{$lieu.nom}</th>
                <th class="right">{$lieu.nb_contrats} contrat{if $lieu.nb_contrats>1}s{/if}</th>
            </tr>
            <tr class="head">
                <th class="nom">client</th>
                <th class="frequence center">fréquence</th>
                <th class="nb_paniers center">nb. de paniers restant</th>
            </tr>
        </thead>
        <tbody>
        {foreach from=$lieu.paniers item=pType}
            <tr class="second_title">
                <th colspan="3">{$pType.type_nom} <small>(x{$pType.nb_contrats})</small></th>
            </tr>
            {foreach from=$pType.contrats item=c}
            <tr>
                <td class="nom">{$c.client_prenom} {$c.client_nom}</td>
                <td class="frequence center">{$c.frequence_print}</td>
                <td class="nb_paniers center">{$c.nb_paniers_restants} / {$c.nb_paniers}</td>
            </tr>
            {/foreach}
        {/foreach}
        </tbody>
    </table>
    {/foreach}
{/foreach}
</body>