<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!DOCTYPE html>
<html lang="en" >
<!-- begin::Head -->
<head>
  <meta charset="utf-8" />
  <title>
    Login | <?= $this->config->item('company_name')?>
  </title>
  <meta name="description" content="Latest updates and statistic charts">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <!--begin::Web font -->
  <script src="https://ajax.googleapis.com/ajax/libs/webfont/1.6.16/webfont.js"></script>
  <script>
  WebFont.load({
    google: {"families":["Poppins:300,400,500,600,700","Roboto:300,400,500,600,700"]},
    active: function() {
      sessionStorage.fonts = true;
    }
  });
  </script>
  <!--end::Web font -->
  <!--begin::Base Styles -->
  <link href="<?php echo $this->config->item('Template_template_file_url'); ?>template/assets/vendors/base/vendors.bundle.css" rel="stylesheet" type="text/css" />
  <link href="<?php echo $this->config->item('Template_template_file_url'); ?>template/assets/demo/default/base/style.bundle.css" rel="stylesheet" type="text/css" />
  <!--end::Base Styles -->
  <!--    <link rel="shortcut icon" href="--><?php //echo base_url()?><!--template/assets/demo/default/media/img/logo/favicon.ico" />-->
</head>
<!-- end::Head -->
<!-- end::Body -->
<body  class="m--skin- m-header--fixed m-header--fixed-mobile m-aside-left--enabled m-aside-left--skin-dark m-aside-left--offcanvas m-footer--push m-aside--offcanvas-default"  >
  <!-- begin:: Page -->
  <div class="m-grid m-grid--hor m-grid--root m-page">
    <div class="m-grid__item m-grid__item--fluid m-grid m-grid--hor m-login m-login--signin m-login--2 m-login-2--skin-1" id="m_login" style="background-image: url(<?php echo $this->config->item('Template_template_file_url'); ?>template/assets/app/media/img//bg/bg-1.jpg);">
      <div class="m-grid__item m-grid__item--fluid m-login__wrapper">
        <div class="m-login__container">
          <div class="m-login__logo">
            <a href="#">
              <img src="<?php echo base_url()?>uploads/company/logo.png">
            </a>
          </div>
          <div class="m-login__signin">
            <div class="m-login__head">
              <h3 class="m-login__title">
                Sign In To Admin
              </h3>
            </div>
            <form autocomplete="off" class="m-login__form m-form" action="javascript:;" method="post">
              <?php if ($this->session->flashdata('flashdata_msg') != "")
              {?>
                <div class="alert alert-<?php echo $this->session->flashdata('alert_type')?> alert-dismissible fade show   m-alert m-alert--air m-alert--outline m-alert--outline-2x" role="alert">
                  <button type="button" class="close" data-dismiss="alert" aria-label="Close"></button>
                  <strong>
                    <?php echo $this->session->flashdata('flashdata_title')?>
                  </strong>
                  <?php echo $this->session->flashdata('flashdata_msg')?>
                </div>
              <?php } ?>
              <div class="form-group m-form__group">
                <input class="form-control m-input"   type="text" placeholder="Email" name="email" autocomplete="off">
              </div>
              <div class="form-group m-form__group">
                <input class="form-control m-input m-login__form-input--last" type="password" placeholder="Password" name="password">
              </div>

              <div class="m-login__form-action">
                <button id="m_login_signin_submit" class="btn btn-focus m-btn m-btn--pill m-btn--custom m-btn--air  m-login__btn m-login__btn--primary">
                  Sign In
                </button>
              </div>
            </form>
          </div>

          <div class="m-login__forget-password">
            <div class="m-login__head">
              <h3 class="m-login__title">
                Forgotten Password ?
              </h3>
              <div class="m-login__desc">
                Enter your email to reset your password:
              </div>
            </div>
            <form autocomplete="off" class="m-login__form m-form" action="">
              <div class="form-group m-form__group">
                <input class="form-control m-input" type="text" placeholder="Email" name="email" id="m_email" autocomplete="off">
              </div>
              <div class="m-login__form-action">
                <button id="m_login_forget_password_submit" class="btn m-btn m-btn--pill m-btn--custom m-btn--air m-login__btn m-login__btn--primary">
                  Request
                </button>
                <button id="m_login_forget_password_cancel" class="btn m-btn m-btn--pill m-btn--custom m-btn--air m-login__btn">
                  Cancel
                </button>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- end:: Page -->
  <!--begin::Base Scripts -->
  <script src="<?php echo $this->config->item('Template_template_file_url'); ?>template/assets/vendors/base/vendors.bundle.js" type="text/javascript"></script>
  <script src="<?php echo $this->config->item('Template_template_file_url'); ?>template/assets/demo/default/base/scripts.bundle.js" type="text/javascript"></script>
  <!--end::Base Scripts -->
  <script>
  jQuery(document).ready(function() {
    toastr.options = {
      "closeButton": true,
      "debug": false,
      "positionClass": 'toast-top-full-width',
      "onclick": null,
      "showDuration": "300",
      "hideDuration": "1000",
      "timeOut": "5000",
      "extendedTimeOut": "1000",
      "showEasing": "swing",
      "hideEasing": "linear",
      "showMethod": "fadeIn",
      "hideMethod": "fadeOut"
    };
  });
</script>
<script>
var SnippetLogin = function() {
  var e = $("#m_login"),
  i = function(e, i, a) {
    var l = $('<div class="m-alert m-alert--outline alert alert-' + i + ' alert-dismissible" role="alert">\t\t\t<button type="button" class="close" data-dismiss="alert" aria-label="Close"></button>\t\t\t<span></span>\t\t</div>');
    e.find(".alert").remove(), l.prependTo(e), mUtil.animateClass(l[0], "fadeIn animated"), l.find("span").html(a)
  },
  a = function() {
    e.removeClass("m-login--forget-password"), e.removeClass("m-login--signup"), e.addClass("m-login--signin"), mUtil.animateClass(e.find(".m-login__signin")[0], "flipInX animated")
  },
  l = function() {
    $("#m_login_forget_password").click(function(i) {
      i.preventDefault(), e.removeClass("m-login--signin"), e.removeClass("m-login--signup"), e.addClass("m-login--forget-password"), mUtil.animateClass(e.find(".m-login__forget-password")[0], "flipInX animated")
    }), $("#m_login_forget_password_cancel").click(function(e) {
      e.preventDefault(), a()
    }), $("#m_login_signup").click(function(i) {
      i.preventDefault(), e.removeClass("m-login--forget-password"), e.removeClass("m-login--signin"), e.addClass("m-login--signup"), mUtil.animateClass(e.find(".m-login__signup")[0], "flipInX animated")
    }), $("#m_login_signup_cancel").click(function(e) {
      e.preventDefault(), a()
    })
  };
  return {
    init: function() {
      l(), $("#m_login_signin_submit").click(function(e) {
        e.preventDefault();
        var a = $(this),
        l = $(this).closest("form"),
        action = "<?php echo base_url()?>login/process";
        l.validate({
          rules: {
            email: {
              required: !0,
              email: !0
            },
            password: {
              required: !0
            }
          }
        }), l.valid() && (a.addClass("m-loader m-loader--right m-loader--light").attr("disabled", !0), l.ajaxSubmit({
          url: action,
          success: function(e, t, r, s) {
            var obj = $.parseJSON(e);
            if(obj.status==1){
              a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1), i(l, "success", "You Are Successfully Logged In.");
              toastr["success"]("You Are Successfully Logged In.", "Logged In");
              window.open('<?php echo base_url()?>dashboard', '_self');
            }else if(obj.status==2){
              a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1), i(l, "danger", "Your Account Has been Suspended!!.");
              toastr["error"]("Your Account Has been Suspended!!.", "Account Suspended");
            }else if(obj.status==0){
              a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1), i(l, "warning", "You Have No Access to This Area!!.");
              toastr["error"]("Incorrect username or password. Please try again.", "Incorrect Data");
            }else if(obj.status==3){
              a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1), i(l, "warning", "You Have No Access to This Area!!.");
              toastr["warning"]("You Have No Access to Web Application.", "No Access to This Area");
            }else if(obj.status==4){
              a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1), i(l, "warning", "Your branch is no longer active, Contact system administrator !!.");
              toastr["warning"]("No Access.", "No Access");
            }else{
              a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1), i(l, "danger", "Incorrect username or password. Please try again.");
              toastr["error"]("Sorry. There Has Been Some Error Occurred. Please Try Again.", "Error");
            }
            setTimeout(function() {
              a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1), i(l, "danger", "Incorrect username or password. Please try again.")
              toastr["warning"]("Your Attempt is Timed Out. Please Try Again.", "Timed Out");
            }, 2e4)
          }
        }))
      }),$("#m_login_forget_password_submit").click(function(l) {
        l.preventDefault();
        var t = $(this),
        r = $(this).closest("form");
        r.validate({
          rules: {
            email: {
              required: !0,
              email: !0
            }
          }
        }), r.valid() && (t.addClass("m-loader m-loader--right m-loader--light").attr("disabled", !0), r.ajaxSubmit({
          url: "",
          success: function(l, s, n, o) {
            setTimeout(function() {
              t.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1), r.clearForm(), r.validate().resetForm(), a();
              var l = e.find(".m-login__signin form");
              l.clearForm(), l.validate().resetForm(), i(l, "success", "Cool! Password recovery instruction has been sent to your email.")
            }, 2e3)
          }
        }))
      })
    }
  }
}();
jQuery(document).ready(function() {
  SnippetLogin.init()
});
</script>
<script>
<?php if ($this->session->flashdata('flashdata_msg') != "")
{?>
  toastr.options = {
    "closeButton": false,
    "debug": false,
    "newestOnTop": false,
    "progressBar": true,
    "positionClass": "toast-top-full-width",
    "preventDuplicates": false,
    "onclick": null,
    "showDuration": "300",
    "hideDuration": "1000",
    "timeOut": "5000",
    "extendedTimeOut": "1000",
    "showEasing": "swing",
    "hideEasing": "linear",
    "showMethod": "fadeIn",
    "hideMethod": "fadeOut"
  };

  toastr.<?php echo $this->session->flashdata('flashdata_type')?>("<?php echo $this->session->flashdata('flashdata_msg')?>","<?php echo $this->session->flashdata('flashdata_title')?>");
  <?php } ?>
</script>
</body>
<!-- end::Body -->
</html>
