{extends file="layout.tpl"}

{* Body Class *}
{block name="body-class"}page-login{/block}

{* Breadcrumb *}
{block name='no-return-functions' append}
    {$breadcrumbs = [
        ['title' => {intl l="Login"}, 'url'=>{url path="/login"}]
    ]}
{/block}


{block name="main-content"}
    <div class="main">
        <article class="col-main" role="main" aria-labelledby="main-label">
            <h1 id="main-label" class="page-header">{intl l="Login"}</h1>
            {form name="thelia.front.customer.login"}
            <form id="form-login" action="{url path="/login"}" method="post" {form_enctype form=$form} novalidate>
                {if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
                {form_field form=$form field='success_url'}
                    <input type="hidden" name="{$name}" value="{navigate to="return_to"}"> {* the url the user is redirected to on login success *}
                {/form_field}

                {form_field form=$form field='error_message'}
                    <input type="hidden" name="{$name}" value="{intl l="missing or invalid data"}"> {* the url the user is redirected to on login success *}
                {/form_field}
                {form_hidden_fields form=$form}
                <fieldset>
                    {form_field form=$form field="email"}
                        <div class="form-group group-email{if $error} has-error{/if}">
                            <label for="{$label_attr.for}">{$label}</label>
                            <div class="control-input">
                            <input type="email" name="{$name}" id="{$label_attr.for}" value="{$value}" class="form-control" maxlength="255" {$attr} {if $required}aria-required="true" required{/if}{if !$value || $error} autofocus{/if}>
                            {if $error}
                                <span class="help-block">{$message}</span>
                                {assign var="error_focus" value="true"}
                            {elseif !$value}
                                {assign var="error_focus" value="true"}
                            {/if}
                            </div>
                        </div>
                    {/form_field}

                    <fieldset>
                        {form_field form=$form field="account"}
                        <legend>{intl l="Do you have an account?"}</legend>
                            {foreach $choices as $choice}
                            <div class="radio radio-account{$choice->value}">
                                <label for="{$label_attr.for}{$choice->value}">
                                    <input type="radio" name="{$name}" id="{$label_attr.for}{$choice->value}" data-toggle="password" value="{$choice->value}"{if $value === {$choice->value}} checked{/if}> {$choice->label}
                                </label>
                            </div>
                            {/foreach}
                        {/form_field}
                        {form_field form=$form field="password"}
                        <div class="form-group group-password{if $error} has-error{/if}">
                            <label for="{$label_attr.for}" class="sr-only">{$label}</label>
                            <div class="control-input">
                            <input type="password" name="{$name}" id="{$label_attr.for}" class="form-control" maxlength="255" autocomplete="off"{if !isset($error_focus)} autofocus{/if}>
                            {if $error}
                                <span class="help-block">{$message}</span>
                            {/if}
                            </div>
                        </div>
                        {/form_field}
                    </fieldset>
                </fieldset>

                <div class="group-btn">
                    <a href="{url path="/password"}" data-toggle="confirmation" class="forgot-password">{intl l="Forgot your Password?"}</a>
                    <button type="submit" class="btn btn-login">{intl l="Next"}</button>
                </div>
            </form>
            {/form}
        </article>
    </div>
{/block}