{form name='lps-area-schedule-update'}
<div class="form-container">

    {if $form_error}
    <div class="alert alert-danger">{$form_error_message}</div>
    {/if}

    {loop name="area" type="lps_area" id="$area_id"}
    <form action="{url path='/admin/module/LivraisonParSecteurs/edit' area_id={$area_id}}" method="POST" class="clearfix" {form_enctype form=$form}>
        {form_hidden_fields form=$form}

        {include
        file = "includes/inner-form-toolbar.html"
        hide_flags = true
        hide_submit_buttons = true
        close_url    = "{url path='/admin/module/LivraisonParSecteurs'}"
        current_tab = "schedule"
        }

        {form_field form=$form field="area_id"}
        <input type="hidden" name="{$name}" value="{$area_id}"/>
        {/form_field}

        <div class="row">
            <div class="col-md-12">

            <table class="table table-striped table-condensed">

                <caption class="clearfix">
                    {loop name="auth-create" type="auth" role="ADMIN" resource="admin.lps.schedule" access="CREATE" module="LivraisonParSecteurs"}
                    <div class="pull-right">
                        <a class="btn btn-default btn-primary area-schedule-add"
                           title="{intl l='Add a new delivery day' d='livraisonparsecteurs'}"
                           data-target="#area-schedule-create" data-toggle="modal">
                            <i class="glyphicon glyphicon-plus-sign"></i>
                        </a>
                    </div>
                    {/loop}
                </caption>

                <thead>
                <tr>
                    <th>{intl l="Delivery day" d="livraisonparsecteurs"}</th>
                    <th>{intl l="Delivery beginning time" d="livraisonparsecteurs"}</th>
                    <th>{intl l="Delivery ending time" d="livraisonparsecteurs"}</th>
                    <th>{intl l="Actions" d="livraisonparsecteurs"}</th>
                </tr>
                </thead>

                <tbody>
                {loop name="area-schedule" type="lps_area_schedule" area_id=$area_id}
                <tr>
                    <td>{$DAY_LABEL}</td>
                    <td>{format_date date=$BEGIN format="H\hi"}</td>
                    <td>{format_date date=$END format="H\hi"}</td>
                    {* Actions *}
                    <td>
                        <div class="btn-group">
                            {loop name="auth-edit" type="auth" role="ADMIN" resource="admin.lps.schedule" access="UPDATE" module="LivraisonParSecteurs"}
                            <a class="btn btn-info btn-responsive area-schedule-update-default"
                               title="{intl l='Modify this delivery day' d='livraisonparsecteurs'}"
                               data-target="#area-schedule-update" data-toggle="modal" data-id="{$ID}"
                               data-day="{$DAY}"
                               data-begin="{format_date date=$BEGIN format='H:i'}"
                               data-end="{format_date date=$END format='H:i'}">
                            <i class="glyphicon glyphicon-edit"></i>
                            </a>
                            {/loop}
                            {loop name="auth-delete" type="auth" role="ADMIN" resource="admin.lps.schedule" access="DELETE" module="LivraisonParSecteurs"}
                            <a class="btn btn-danger btn-responsive area-schedule-delete"
                               title="{intl l='Delete this delivery day' d='livraisonparsecteurs'}"
                               data-target="#area-schedule-delete" data-toggle="modal" data-id="{$ID}">
                                <i class="glyphicon glyphicon-trash"></i>
                            </a>
                            {/loop}
                        </div>
                        <input type="hidden" name="{$name}" value="{$ID}"/>
                    </td>
                </tr>
                {/loop}
                {elseloop rel="area-schedule"}
                <tr>
                    <td colspan="1000">
                        <div class="alert alert-info">
                            {intl l="There is no schedule for this area" d="livraisonparsecteurs"}
                        </div>
                    </td>
                </tr>
                {/elseloop}
                </tbody>
            </table>

        </div>
    </div>
    </form>
    {/loop}

</div>
{/form}