{extends file="admin-layout.tpl"}

{* -- We do not check admin login on this page *}
{block name="check-auth"}{/block}

{block name="page-title"}{intl l='Welcome'}{/block}

{block name="main-content"}
<div class="loginpage">
	<div id="wrapper" class="container">
	
		<div class="row">
            <div class="col-md-12">
                <div class="general-block-decorator clearfix">
					
					<h1 class="title title-without-tabs">{intl l='Thelia Back Office'}</h1>

				   	<div class="col-md-6">
				   		{module_include location='index_top'}
				        
						{form name="thelia.admin.login"}
						<form action="{url path='/admin/checklogin'}" method="post" {form_enctype form=$form}>

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

			                <fieldset>
			                	<legend>{intl l='Login'}</legend>
			                
				                {form_hidden_fields form=$form}

								{form_field form=$form field='success_url'}
									<input type="hidden" name="{$name}" value="{url path='/admin'}" /> {* on success, redirect to /admin *}
								{/form_field}
								
								{form_field form=$form field='username'}
                                    <div class="form-group {if $error}has-error{/if}">
                                        <label for="{$label_attr.for}" class="control-label">{$label} : </label>
                                        <div class="input-group">
                                        	<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
                                        	<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" title="{$label}" placeholder="{intl l='Username'}" autofocus>
                                        </div>
                                    </div>
                                {/form_field}
								{form_field form=$form field='password'}
                                    <div class="form-group {if $error}has-error{/if}">
                                        <label for="{$label_attr.for}" class="control-label">{$label} : </label>
                                        <div class="input-group">
                                        	<span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
                                        	<input type="password" id="{$label_attr.for}" name="{$name}" class="form-control" title="{$label}" placeholder="{intl l='Password'}">
                                        </div>
                                    </div>
                                {/form_field}				                

								{form_field form=$form field='remember_me'}
									<div class="checkbox">
										<label for="{$label_attr.for}">
											<input type="checkbox" name="{$name}" id="{$label_attr.for}" value="{$value}" {$attr} {if $options.checked}checked="checked"{/if}/> {$label}
										</label>
									</div>								
								{/form_field}

								<button type="submit" class="btn btn-default btn-primary pull-right"><span class="glyphicon glyphicon-off"></span> {intl l='Login'}</button>
							</fieldset>
						</form>
						{/form}

						{module_include location='index_middle'}
					</div>

					<div class="col-md-6">
						<div class="row feed-list">
							<div class="col-md-6 col-md-offset-3">
								<div class="alert alert-info">{intl l="Loading Thelia lastest news..."}</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

		{module_include location='index_bottom'}

	</div>
</div>
{/block}

{block name="javascript-initialization"}
	<script>
		$(function () {
			$(".feed-list").load("{admin_viewurl view='ajax/thelia_news_feed'}");
		})
	</script>
{/block}