{form name=$form_name}
{form_hidden_fields form=$form}

{render_form_field form=$form field="success_url" value={url path="/admin/module/LivraisonParSecteurs/edit?area_id={$area_id}#schedule"}}
{render_form_field form=$form field="error_url" value={url path="/admin/module/LivraisonParSecteurs/edit?area_id={$area_id}#schedule"}}

{form_field form=$form field="area_id"}
<div class="form-group hidden">
    <input type="hidden" class="form-control" name="{$name}" id="{$label_attr.for}"
           value="{$area_id}"/>
</div>
{/form_field}
{if {$update|default:false} == true}
    {form_field form=$form field="area-schedule_id"}
    <div class="form-group hidden">
        <input type="hidden" class="form-control" name="{$name}" id="{$label_attr.for}"
                      value=""/>
    </div>
    {/form_field}
{/if}

{form_field form=$form field="day"}
<div class="form-group {if $error}has-error{/if}">
    <label class="control-label" for="{$label_attr.for}">
        {intl l=$label d="livraisonparsecteurs"}
        {if $required}<span class="required">*</span>{/if}
    </label>
    {form_error form=$form field="day"}{$message}{/form_error}

    <select class="form-control" name="{$name}" id="{$label_attr.for}">
    {if {$update|default:false} == true}
    <option value="" selected></option>
    {/if}
    {foreach $choices as $choice}
    <option value="{$choice->value}" {if $DAY == $choice->value}selected{/if} >{$choice->label}</option>
    {/foreach}
    </select>
</div>
{/form_field}


{if {$update|default:false} == false}
<!--    Mode Création d'un nouveau créneau /-->
<div class="row">
    <div class="col-sm-12">
        {form_field form=$form field="begin_time"}
        <div class="form-group {if $error}has-error{/if}">
            <label class="control-label" for="{$label_attr.for}">
                {intl l=$label d='livraisonparsecteurs'}
                {if $required}<span class="required">*</span>{/if}
            </label>

            {form_error form=$form field="begin_time"}{$message}{/form_error}
            <div class='input-group time' id="{$label_attr.for}">
                <input type='text' class="form-control" name="{$name}" value="{$BEGIN|default:"14:00"}"/>
                <span class="input-group-addon">
                        <span class="glyphicon glyphicon-time"></span>
                    </span>
            </div>
        </div>
        {/form_field}
        {form_field form=$form field="end_time"}
        <div class="form-group {if $error}has-error{/if}">
            <label class="control-label" for="{$label_attr.for}">
                {intl l=$label d='livraisonparsecteurs'}
                {if $required}<span class="required">*</span>{/if}
            </label>

            {form_error form=$form field="end_time"}{$message}{/form_error}
            <div class='input-group time' id="{$label_attr.for}">
                <input type='text' class="form-control" name="{$name}" value="{$END|default:"16:00"}"/>
                <span class="input-group-addon">
                        <span class="glyphicon glyphicon-time"></span>
                    </span>
            </div>
        </div>
        {/form_field}
    </div>
</div>
{else}
<!--    Mode Modification d'un créneau existant /-->
    {form_field form=$form field="begin_time"}
    <div class="form-group {if $error}has-error{/if}">
        <label class="control-label" for="{$label_attr.for}">
            {intl l=$label d='livraisonparsecteurs'}
            {if $required}<span class="required">*</span>{/if}
        </label>

        {form_error form=$form field="begin_time"}{$message}{/form_error}
        <div class='input-group time' id="{$label_attr.for}">
            <input type='text' class="form-control" name="{$name}" value="{$BEGIN}"/>
            <span class="input-group-addon">
                <span class="glyphicon glyphicon-time"></span>
            </span>
        </div>
    </div>
    {/form_field}
    {form_field form=$form field="end_time"}
    <div class="form-group {if $error}has-error{/if}">
        <label class="control-label" for="{$label_attr.for}">
            {intl l=$label d='livraisonparsecteurs'}
            {if $required}<span class="required">*</span>{/if}
        </label>

        {form_error form=$form field="end_time"}{$message}{/form_error}
        <div class='input-group time' id="{$label_attr.for}">
            <input type='text' class="form-control" name="{$name}" value="{$END}"/>
            <span class="input-group-addon">
                <span class="glyphicon glyphicon-time"></span>
            </span>
        </div>
    </div>
    {/form_field}
{/if}

{/form}