<?= $this->extend('backend/layout/login_layout'); ?>
<?= $this->section('title') ?>Login<?= $this->endSection() ?>
<?= $this->section('content') ?>
<div class="card ">
    <div class="card-header text-center">
        <?= view_cell('LogoCell') ?>
        <span class="splash-description">Please enter your user information.</span>
    </div>

    <div class="card-body">
        <?= view_cell('AlertCell') ?>
        <?php $validation = service('validation'); ?>
        <?= form_open(route_to('forgot_password'), [
            'csrf_id' => 'csrf_id',
            'novalidate' => '',
            'id' => 'loginForm'
        ]) ?>
        <div class="form-group">
            <?= form_input(
                [
                    'name' => 'email',
                    'id' => 'email',
                    'required' => true,
                    'placeholder' => 'Enter your email address',
                    'class' => 'form-control form-control-lg',
                ],
                set_value('email', ''),
            ) ?>
        </div>
        <p class="text-danger small ps-2"><?= $validation->getError('email') ?></p>
        <div class="form-group">
            <?= form_password(
                [
                    'name' => 'password',
                    'id' => 'password',
                    'placeholder' => 'Password',
                    'required' => true,
                    'class' => 'form-control form-control-lg',
                    'autocomplete' => 'off'
                ],
            ) ?>
        </div>
        <p class="text-danger small ps-2"><?= $validation->getError('password') ?></p>
        <?= form_button(
            [
                'type' => 'submit',
                'class' => 'btn btn-primary btn-lg btn-block',
            ],
            'Sign In',
        ) ?>
        <?= form_close() ?>
    </div>
    <div class="card-footer bg-white p-0  ">
        <div class="card-footer-item card-footer-item-bordered">
            <a href="<?= url_to('forgot') ?>" class="footer-link">Forgot Password</a>
        </div>
    </div>
</div>
<?= $this->endSection() ?>

<?= $this->section('js') ?>
<script src="assets/common/js/jquery.validate.min.js"></script>
<?= $this->endSection() ?>

<?= $this->section('scripts'); ?>
<script>
    $("#loginForm").submit(function(event) {
        var vForm = $(this);
        if (vForm[0].checkValidity() === false) {
            event.preventDefault()
            event.stopPropagation()
        }
        vForm.addClass('was-validated');
    });

    //signature pad
</script>
<?= $this->endSection() ?>