<?php
use App\Libraries\MyEncrypt;
use App\Models\CommonModel;
$session = session();
$validation =  \Config\Services::validation();
$this->db = db_connect();

$CommonModel = model('CommonModel');
$header_data = $CommonModel->GetSiteSettings('site');
if(!$header_data){
	$header_data = $CommonModel->defaultlangSettingall('site');
}
foreach ($header_data as $row) 
{
	$headers[$row->site_key] = $row->site_value;
}
?>
<!doctype html>
<html lang="en" translate="no" class="w-[640px] mx-auto md:w-full">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <title><?php echo $headers['site_meta_title'];?></title>
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <meta name="keywords" content="<?php echo $headers['site_meta_key'];?>" />
      <meta name="description" content="<?php echo $headers['site_meta_description'];?>" />
      <!--Basic Bootstrap-->
      <link href="<?php echo base_url();?>/styles/web_style/css/bootstrap.min.css" rel="stylesheet" type="text/css">
      <!--Font icons-->
      <link href="<?php echo base_url();?>/styles/web_style/css/all.css"  rel="stylesheet" type="text/css">
      <!--Carousel Slider-->
      <link href="<?php echo base_url();?>/styles/web_style/css/owl.carousel.min.css" rel="stylesheet" type="text/css">
      <link href="<?php echo base_url();?>/styles/web_style/css/owl.theme.default.min.css" rel="stylesheet" type="text/css">
      <!--fonts-->
      <link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;500;700&display=swap" rel="stylesheet">
      <!--Theme CSS -->
      <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>/styles/web_style/css/style.css">
   <style>
         .clr
         {
         color:gold;
         font-size:14px;
         font-weight:bold;
         padding:10px;
         }
         .clr1
         {
         color:#333;
         font-size:24px;
         padding:10px;
         }
         .btn1
         {
         border: 1px solid #fff;
         height: 34px;
         background: transparent;
         color: #fff;
         font-size: 14px;
         font-weight: bold;
         border-radius:10px;
         }
         .bg-login
         {
         border-radius:10px;
         padding:10px;
         border:1px solid #333;
         }
         .btn-submit
         {
         width: 4.188rem !important;
         height: 4.188rem !important;
         background: linear-gradient(#fae1a9, #f2c464);
         display: flex;
         align-items: center;
         justify-content: center;
         border-radius: 100%;
         color:#333;
         margin-top:-30px;
         }
         .help-block 
         {
         color:red;
         font-size:12px;
         font-weight:bold;
         }
         .img-captcha{  bottom:16px;}
         #message {
         display:block;
         background: transparent;
         color: #000;
         position: relative;
         padding: 10px;
         margin-top: 10px;
         }
         #message p {
         padding: 10px 35px;
         font-size: 11px;
         }
         /* Add a green text color and a checkmark when the requirements are right */
         .valid {
         color: green;
         }
         .valid:before {
         position: relative;
         left: -35px;
         content: "✔";
         }
         /* Add a red text color and an "x" when the requirements are wrong */
         .invalid {
         color: red;
         }
         .invalid:before {
         position: relative;
         left: -35px;
         content: "✖";
         }
         p.frgtpwd1 {
         background:#8DC540 !important
         }
         p.frgtpwd1 i {
         background:#8DC540 !important;
         color:#fff !important
         }
         p.frgtpwd {
         font-size: 13px;
         color: #fff;
         text-align: left;
         line-height: 24px;
         margin: 0 0 1em 0;
         background: #22313F;
         border-radius: 2px;
         padding:10px 39px 10px 10px;
         font-weight: 600;
         position: relative;
         }
         p.frgtpwd i {
         position: absolute;
         top: 0;
         right: 0;
         padding:15px 8px 8px 8px;
         font-size: 14px;
         background: #F5AB35;
         color: #22313F;
         height: 100%;
         }
         p.frgtpwdred {
         background:#EB5055 !important
         }
         p.frgtpwdred i {
         background:#EB5055 !important
         }
         .alert-success {
         color: #0f5132;
         background-color: #d1e7dd;
         border-color: #badbcc;
         font-size: 12px;
         }
         .span
         {
         font-size: 12px;
         color: #9395a1;
         margin-top: 14px;
         font-weight: 900;
         }
         .notify {
         position: fixed;
         top: 10px;
         left: 10px;
         -moz-box-sizing: border-box;
         box-sizing: border-box;
         width: 350px;
         font-size: 14px;
         text-align: center;
         }
         .user-box {
         position: relative;
         margin-bottom: 30px;
         }
         .user-box input {
         display: block;
         width: 100%;
         padding: 15px 10px;
         font-size: 12px;
         font-weight: 400;
         line-height: 1.5;
         color: #fff;
         background-color: #2e2d2c;
         background-clip: padding-box;
         border: 0;
         -webkit-appearance: none;
         -moz-appearance: none;
         appearance: none;
         border-radius: 10px;
         transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
         }
         .user-box input:focus ~ label,
         .user-box input:valid ~ label {
         transform: translateY(-20px);
         font-size: 14px;
         color: #333;
         }
 .password-toggle-icon {
         transform: translateY(-50%);
         cursor: pointer;
         }
      .password-toggle-icon i {
         transition: color 0.3s ease-in-out;
         }
         .password-toggle-icon i:hover {
         color: #fff;
         }
		 .login-ico .form-ico {
	padding: 17px 0px !important;
	text-align: center;
}
      </style>
   </head>
   <body class="reg-overflow banner-bg">
      <!---header---->
      <section class=" pb-1 login-page">
         <div class="container">
            <div class="innerpages-bg relative h-full m-auto md:w-full ">
               <div class="row bg-black mb-3">
                  <div class="col-lg-12">
                     <div class="company-title text-center">
                        <div class="logo">
                           <a href="">
                           <img src="<?php echo base_url();?>/styles/web_style/images/login-logo.png" alt="" style="width:100%;height:">
                           </a>
                        </div>
                        <!-- <h1 class="text-white mb-0 clarendo">REVOTECH</h1>
                           <h1 class="text-primary mb-0">BOT TRADING</h1> -->
                     </div>
                  </div>
               </div>
               <div class="login-scroller ">
                  <div class="reg-page">
                     <div class="row">
                        <div class="col-lg-12">
                           <div class="title py-2 text-center">
                              <h2 class="fw-bold text-primary mb-3">Sign in</h2>
                           </div>
                        </div>
                     </div>
                     <form class="steps-validation create-user" method="post" action="<?php echo base_url();?>/user/login">
                        <div class="form-page">
                           <?php 
                              $session = \Config\Services::session();
                              if($session->getFlashData('success_message')) 
                              {
                              ?>
                                <p class="frgtpwd frgtpwd1"><i class="fa fa-thumbs-up"></i><?php echo $session->getFlashData('success_message');?></p>
                            <?php 
                              } 
                              else if($session->getFlashData('error_message')) 
                              { 
                              ?>
                                 <p class="frgtpwd frgtpwd1 frgtpwdred"><i class="fa fa-thumbs-down"></i><?php echo $session->getFlashData('error_message');?></p>
                           <?php 
                              } 
                              ?>
                           <div class="row">
                                 <div class="col-sm-12">
                                    <div class="form-block form-group">
                                        <input type="text" class="form-control" placeholder=" Username" name="username" id="username">
                                    </div>
                                    </div>
                            
                                    <div class="col-lg-12">
                                            <div class=" form-block position-relative login-ico ">
                                              <div class="form-ico password-toggle-icon"><i class="fa-regular fa-eye-slash"></i></div>
                                            <input type="password" class="form-control " id="password" name="password" aria-describedby="" placeholder="Enter Password">
                                            </div>
                                          </div>
                                        </div>
                                
                                 <div class="forget text-center page-link mt-3">
                                    <h5 class="text-white fw-normal"> Forget <a href="<?php echo base_url();?>/reset" class="text-decoration-none text-white  fw-normal"> Password ?</a></h5>
                                 </div>
                                 <div class="form-btn-bg position-relative" >
                                    <div class="form-button ">
                                       <button class="btn btn-primary" type="submit">
                                          <iconify-icon icon="ep:d-arrow-right"></iconify-icon>
                                       </button>
                                    </div>
                                 </div>
                     </form>
                     </div>
                     </div>
                     </div>
                  </div>
                  <div class="row">
                     <div class="col-lg-12">
                        <div class="register-account text-center page-link ">
                           <h5 class="text-white fw-normal"> <a href="<?php echo base_url();?>/register" class="text-decoration-none text-white  fw-normal">Register an account</a> </h5>
                        </div>
                     </div>
                     <div class="copy-rights text-center ">
                        <span class="text-white"> <?php echo date("Y");?> <a href="" class="text-decoration-none"> @revotech </a>All Rights Reserved</span>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </section>
      <script src="<?php echo base_url();?>/styles/web_style/js/jquery.min.js"></script>
      <script src="<?php echo base_url();?>/styles/web_style/js/bootstrap.min.js"></script>
      <script src="<?php echo base_url();?>/styles/web_style/js/script.js"></script>
      <script src="<?php echo base_url();?>/styles/web_style/js/iconify-icon.min.js"></script>
      <script src="<?php echo base_url();?>/styles/web_style/js/owl.carousel.min.js"></script>
      <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
      <script type="text/javascript" src="<?php echo base_url();?>/assets/js/formValidation1.js"></script>
      <script type="text/javascript" src="<?php echo base_url();?>/assets/js/bootstrap.js"></script>
      <script type="text/javascript">
         jQuery.noConflict();
         (function( $ ) {
         $(document).on("click", '#getcode', function() {
             var referral=$('#invitor_code').val();
             var email=$('#email').val();
            if(email !="")
            {
         
               $.ajax({
                 type: 'post',
                 url : '<?php echo base_url();?>/user/register/verifyregcode',
                 data : {'email':email,'referral':referral},
                 dataType:'json',
                 success : function(msg)
                 {
                 
                   console.log(msg);
                   
                    if(msg!='exist' && msg!='exist1')
                    {
                       var myVar;
                       setTimeout(function(){
                           $("#otpmsg").html('<div class="help-block">'+msg+'</div>')},500);
                    }
                    else
                    {
                       if(msg=='exist')
                       {
                         var myVar;
                         setTimeout(function(){
                           $("#otpmsg").html('<div class="help-block">Email Already Exist</div>')},500);
         
                       }
                       else
                       {
                            var myVar;
                         setTimeout(function(){
                           $("#otpmsg").html('<div class="help-block">Given invite code not valid</div>')},500);
                       }
                   } 
                 }
             })
           }
           else
           {
             setTimeout(function(){
                           $("#otpmsg").html('<div class="help-block">Please Enter Email id first</div>')},500)
         
           }
           
         
         });
         
         $('.create-user').formValidation({
         framework: 'bootstrap',
         excluded: [':disabled'],
         
         fields: {
            
             username: {
             validators: {
             notEmpty: {
             message: 'Username is required'
             },
             regexp: {
             regexp: /^[a-zA-Z0-9]*$/,
             message: 'Username only accepts alphanumerics'
             }
         
             }
             },
             password: {
             validators: {
             notEmpty: {
             message: 'Password is Required'
             }
             }
           }
             
         }
         })
         
         })(jQuery);
         
         
         const passwordField = document.getElementById("password");
         const togglePassword = document.querySelector(".password-toggle-icon i");
         
         togglePassword.addEventListener("click", function () {
             
           if (passwordField.type === "password") {
             passwordField.type = "text";
             
             togglePassword.classList.remove("fa-eye-slash");
             togglePassword.classList.add("fa-eye");
           } else {
             passwordField.type = "password";
             togglePassword.classList.remove("fa-eye");
             togglePassword.classList.add("fa-eye-slash");
            
           }
         });
      </script>
   </body>
</html>
