<?php
$cookie_name = $this->Xin_model->get_cookie_name();
$domain_url = $this->Xin_model->domain_url();
if(!isset($_COOKIE[$cookie_name])) {
    
} else {
    
    $session_data = unserialize($_COOKIE[$cookie_name]);
    
    $session_data = array(
	'user_id' => $session_data['user_id'],
	'email' => $session_data['email'],
	'root_id' => '1',
	);
	
	$this->session->set_userdata($cookie_name, $session_data);
    
    $_SESSION['user_id'] = $session_data['user_id'];
    $_SESSION['root_id'] = $session_data['root_id'];
    
    if(isset($_REQUEST['next']))
    {
        if(!empty($_REQUEST['next']))
        {
            session_start();
            $_SESSION['next'] = $_REQUEST['next'];
            header('location:'.$_REQUEST['next']);
        }
    }
    else
    {
        header('location:./dashboard');
    }
    
}
$system = $this->Xin_model->read_company_setting_info(1);

if($system[0]->logo!='' && $system[0]->logo!='no file') {
    
    $logo =$domain_url.'uploads/system/'.$system[0]->small_logo;
}
else {
    
    $logo =$domain_url.'skin/img/default_logo.png';
}

if($system[0]->favicon!='' && $system[0]->logo!='no file') {
    
    $favicon =$domain_url.'uploads/system/'.$system[0]->favicon;
}
else {
    
    $favicon =$domain_url.'uploads/system/default_favicon.png';
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="icon" href="<?php echo $favicon?>" type="image/x-icon">
    <link rel="shortcut icon" href="<?php echo $favicon?>" type="image/x-icon">
    <title><?php echo $system[0]->name?> Admin Panel</title>

    <!-- Google font-->
    <link href="https://fonts.googleapis.com/css2?family=Urbanist:wght@100;200;300;500;600;900&display=swap" rel="stylesheet">

    <!-- Bootstrap css-->
    <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/vendors/bootstrap.css">

    <!-- App css-->
    <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/admin.css">
    
    <link rel="stylesheet" href="<?php echo base_url();?>assets/vendor/toastr/toastr.min.css">

</head>
<body>

<!-- page-wrapper Start-->
<div class="page-wrapper">
    <div class="authentication-box">
        <div class="container">
            <div class="row">
                <div class="col-md-5 p-0 card-left">
                    <div class="card bg-primary">
                        <div class="svg-icon">
                            <img class="blur-up lazyloaded img-fluid" src="<?php echo $logo ?>" alt="">
                        </div>

                        <div class="single-item">
                            <div>
                                <div>
                                    <h3>Welcome to <?php echo $system[0]->name?></h3>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-7 p-0 card-right">
                    <div class="card tab2-card">
                        <div class="card-body">
                            <ul class="nav nav-tabs nav-material" id="top-tab" role="tablist">
                                <li class="nav-item">
                                    <a class="nav-link active" id="top-profile-tab" data-bs-toggle="tab" href="#top-profile" role="tab" aria-controls="top-profile" aria-selected="true"><span class="icon-user me-2"></span>Login</a>
                                </li>
                            </ul>
                            <div class="tab-content" id="top-tabContent">
                                <div class="tab-pane fade show active" id="top-profile" role="tabpanel" aria-labelledby="top-profile-tab">
                                    <form class="form-horizontal auth-form" method="post" name="hrm-form" id="hrm-form" data-redirect="dashboard?module=dashboard" data-form-table="login" data-is-redirect="1">
                                        <div class="form-group">
                                            <input name="iusername" id="iusername" type="email" class="form-control" placeholder="Username" >
                                        </div>
                                        <div class="form-group">
                                            <input name="ipassword" id="ipassword" type="password" class="form-control" placeholder="Password">
                                        </div>
                                        <div class="form-terms">
                                            <div class="form-check mesm-2">
                                                <input type="checkbox" class="form-check-input" id="customControlAutosizing">
                                                <label class="form-check-label ps-2" for="customControlAutosizing">Remember me</label>
                                                <a href="forgot_password" class="btn btn-default forgot-pass">lost your password</a>
                                            </div>
                                        </div>
                                        <div class="form-button">
                                            <button class="btn btn-primary login-button" type="submit" name="registerForm">Login</button>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <a href="<?php echo base_url(); ?>" class="btn btn-primary back-btn"><i data-feather="arrow-left"></i>Back</a>
        </div>
    </div>
</div>

<!-- latest jquery-->
<script src="<?php echo base_url(); ?>assets/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>assets/vendor/toastr/toastr.min.js"></script> 
<script type="text/javascript">
$(document).ready(function(){
	toastr.options.closeButton = true;
	toastr.options.progressBar = true;
	toastr.options.timeOut = 3000;
	toastr.options.preventDuplicates = true;
	toastr.options.positionClass = "toast-bottom-right";
});
</script>
<script type="text/javascript">var base_url = '<?php echo base_url(); ?>';</script>
<script type="text/javascript" src="<?php echo base_url();?>skin/js_module/login.js"></script>
</body>
</html>
