{form name='pdr.place.view.schedule'}
<div class="form-container">

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

    <form action="{url path="/admin/module/PointRetrait/edit?place_id={$place_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/PointRetrait'}"
        current_tab = "schedule"
        }

        {form_field form=$form field="place_id"}
        <input type="hidden" name="{$name}" value="{$place_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.pdr.schedule" access="CREATE" module="PointRetrait"}
                    <div class="pull-right">
                        <a class="btn btn-default btn-primary place-schedule-create"
                           title="{intl l='Add a new withdrawal day' d='pointretrait'}"
                           data-target="#place-schedule-create" data-toggle="modal">
                            <i class="glyphicon glyphicon-plus-sign"></i>
                        </a>
                    </div>
                    {/loop}
                </caption>

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

                <tbody>
                {loop name="place-schedule-loop" type="pdr_schedule" place_id=$place_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.pdr.schedule" access="UPDATE" module="PointRetrait"}
                            <a class="btn btn-info btn-responsive place-schedule-update-default"
                               title="{intl l='Edit this withdrawal day' d='pointretrait'}"
                               data-target="#place-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.pdr.schedule" access="DELETE" module="PointRetrait"}
                            <a class="btn btn-danger btn-responsive place-schedule-delete"
                               title="{intl l='Delete this withdrawal day' d='pointretrait'}"
                               data-target="#place-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="place-schedule-loop"}
                <tr>
                    <td colspan="1000">
                        <div class="alert alert-info">
                            {intl l="There is no schedule for this place" d="pointretrait"}
                        </div>
                    </td>
                </tr>
                {/elseloop}
                </tbody>
            </table>

        </div>
    </div>
    </form>

</div>
{/form}