<style>
    #block-scheduled-deliveries > div.scheduled-deliveries-list > table > thead > tr > th,
    #block-scheduled-deliveries > div.scheduled-deliveries-list > table > tbody > tr > td {
        text-align: center;
    }

    .nb-commandes {
        font-size: 14px;
        margin-left: 30px;
    }

    .nb-commandes b {
        color: orange;
        font-weight: bold;
    }
</style>


<div class="scheduled-deliveries-list">
    <table class="table table-striped">
        <thead>
            <th>&nbsp;</th>
            <th>{intl l="Order number" d="livraisonparsecteurs"}</th>
            <th>{intl l="Scheduled date" d="livraisonparsecteurs"}</th>
            <th>{intl l="Delivery delay" d="livraisonparsecteurs"}</th>
            <th>{intl l="City" d="livraisonparsecteurs"}</th>
            <th>{intl l="Area" d="livraisonparsecteurs"}</th>
        </thead>
        <tbody>
        {loop name="deliveries-loop" type="scheduled_deliveries" domicile_ou_retrait="domicile" only_future="true" order="date"}
            {if $DELTA <= 7}
                {assign var=path value="{image file='/assets/img/flag-green.png'}"}
                {assign var=alt value='Drapeau vert'}
            {/if}
            {if $DELTA <= 4}
                {assign var=path value="{image file='/assets/img/flag-orange.png'}"}
                {assign var=alt value='Drapeau orange'}
            {/if}
            {if $DELTA <= 1}
                {assign var=path value="{image file='/assets/img/flag-red.png'}"}
                {assign var=alt value='Drapeau rouge'}
            {/if}
            {assign var=title value="{$DELTA} jour(s) de délai"}

            {loop name="order-loop" type="order" id={$ORDER_ID} customer="*"}
                {loop type="customer" name="customer-loop" current="false" id=$CUSTOMER}
                    {assign var=client value="$FIRSTNAME $LASTNAME"}
                {/loop}
                {loop type="order_address" name="address-loop" id=$DELIVERY_ADDRESS}
                    {assign var=commune value=$CITY}
                {/loop}
            {/loop}

            <tr>
                <td><img src={$path} alt="{$alt}" title="{$title}" style="margin-left: 30px; width:25px"></td>
                <td><a href="/admin/order/update/{$ORDER_ID}" target="_blank" title="Client : {$client}">{$ORDER_ID}</a></td>
                <td>
                    {format_date date=$START_DATE format="d/m/Y"} entre {format_date date=$START_DATE format="H\hi"} et {format_date date=$END_DATE format="H\hi"}
                </td>
                <td>{$DELTA} jour(s)</td>
                <td>{$commune}</td>
                <td>{loop name="area-schedule-loop" type="lps_area_schedule" id={$SCHEDULE_ID}}
                        {loop name="area-loop" type="lps_area" id={$AREA_ID}}
                            {$TITLE}
                        {/loop}
                    {/loop}
                </td>
            </tr>
            {if $LOOP_COUNT == $LOOP_TOTAL}{assign var=nbCommandes value=$LOOP_TOTAL}{/if}

        {/loop}
        {elseloop rel="deliveries-loop"}
        <tr>
            <td colspan="1000">
                <div class="alert alert-info">
                    {intl l="There is no order to deliver" d="livraisonparsecteurs"}
                </div>
            </td>
        </tr>
        {/elseloop}
        </tbody>
    </table>
    <span class="nb-commandes">Total :&nbsp;&nbsp;<b>{$nbCommandes}</b>&nbsp;&nbsp;commande(s)</span>

</div>
