<?php
$this->load->library('ciext/ciext')->load_jquery();
$this->js_css->parse_js('user/js/login.js');
?>
<?php if (!$loggedIn) : ?>
    <div class="login_info">
        <a href="" data-toggle="modal" data-target="#sign_in_dialog"><?= $this->lang->line('Sign in') ?></a>
        <a href="<?= $this->config->item('registration_page') ?>"><?php echo $this->lang->line('Sign up') ?></a>
    </div>
    <div id="sign_in_dialog" class="modal fade">
        <div class="modal-dialog modal-sm">
            <div class="modal-content">
                <button class="close" type="button" data-dismiss="modal">
                    <img class="btn-close" src="/assets/img/close.png" alt=""/>
                </button>
                <?= form_open('ajax/user/action/ajax_login', ['class' => 'modal-body popup-entrance', 'id' => 'login_form'], ['status' => $status]) ?>
                <div class="row">
                    <div class="col-xs-6 col-sm-6 col-md-4 col-md-offset-2">
                        <h2><?= $this->lang->line('Sign in by email') ?></h2>
                        <div class="form-group">
                            <input class="form-control" type="email" name="login" required tabindex="1" value="<?php echo $login ?>" placeholder="<?= $this->lang->line('Your email') ?>"/>
                        </div>
                        <div class="form-group">
                            <input type="password" class="form-control" name="password" required tabindex="2"placeholder="<?= $this->lang->line('Your password') ?>"/>
                        </div>
                        <div class="form-group" id="error_login_message" style="display:none">
                            <label class="label label-danger"><?= $this->lang->line('Wrong login or password') ?></label>
                        </div>
                        <div class="form-group">
                            <a href="<?= $this->config->item('forgot_password_page') ?>"><?php echo $this->lang->line('Forgot your password?') ?></a>
                        </div>
                    </div>
                    <div class="col-xs-6 col-sm-6 col-md-4">
                        <h2>Войти через соц.сети</h2>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12">
                        <button type="submit" class="btn btn-default center-block"><?= $this->lang->line('Sign in') ?></button>
                    </div>
                </div>
                <?= form_close() ?>
            </div>
        </div>
    </div>
<?php else: ?>
    <div class="login_info">
        <a href="<?= $this->config->item('profile_page') ?>"><?php echo $this->lang->line('Cabinet') ?></a>
        <a href="/ajax/user/action/logout"></i><?php echo $this->lang->line('Logout') ?></a>
    </div>
<?php endif; ?>