<?= $this->extend(config('Auth')->views['layout']) ?>
<?= $this->section('title') ?><?= lang('Auth.login') ?> <?= $this->endSection() ?>
<?= $this->section('main') ?>

<div class="login-box">
    <div class="login-logo">
        <img src="<?= base_url('pegadaian.svg') ?>" alt="Satria" class="img img-round" width="250"><br>
        <a href="#"><b>G-Round</b> | Pegadaian</a>
    </div>
    <!-- /.login-logo -->
    <div class="login-box-body">
        <p class="login-box-msg">Akun Anda belum aktif. Silakan hubungi Administrator untuk mengaktifkan akun Anda.</p>
    </div>
    <!-- /.login-box-body -->
    <div class="row">
        <div class="foot text-center">
            Copyright &copy; <?= date('Y') ?> Pegadaian<br>
        </div>
    </div>
</div>
<!-- /.login-box -->

<?= $this->endSection() ?>

<?= $this->section('pageScripts') ?>
<script type="text/javascript">
$("#users_form").submit(function(e){
    e.preventDefault();
    var url = ''
    var formData = $(this).serialize();
    $.ajax({
        url: url,
        type: "post",
        dataType: 'json',
        data: formData,
        beforeSend  : function() {
            $(".form-group").removeClass("has-error");
            $(".error-message").html('').hide();
            $("#btn_users").button('loading');
        },
        error: function (xhr, status, message) {
            if (xhr.status == 400) {
                var res = JSON.parse(xhr.responseText);
                $(res.messages).each(function(i,val){
                    var inputname = Object.keys(val)[0];
                    $.each(val,function(k,v){
                        $("#"+inputname).focus();
                        $("#fg_"+k).addClass("has-error");
                        $("#em_"+k).html(v).fadeIn();
                    });
                });
            } else {
                alert(xhr.statusText );
            }
        },
        success: function(result) {
            window.location.href = result.message;
        },
        complete: function() {
            $("#btn_users").button('reset');
        }
    });
});
</script>
<?= $this->endSection() ?>