<html>
<head>
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>Vega Business Software</title>
<link rel="stylesheet" href="{{ asset('new_theme/css/font-awesome.min.css') }}">

<link href="{{ asset('css/bootstrap.min.css') }}" rel="stylesheet">


<style>

body {
    background: #222D32;
    font-family: 'Roboto', sans-serif;
}

.login-box {
    margin-top: 75px;
    height: auto;
    background: #1A2226;
    text-align: center;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
}

.login-key {
    height: 100px;
    font-size: 80px;
    line-height: 100px;
    background: -webkit-linear-gradient(#27EF9F, #0DB8DE);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-title {
    margin-top: 15px;
    text-align: center;
    font-size: 30px;
    letter-spacing: 2px;
    margin-top: 15px;
    font-weight: bold;
    color: #ECF0F5;
}

.login-form {
    margin-top: 25px;
    text-align: left;
}

input[type=text] {
    background-color: #1A2226;
    border: none;
    border-bottom: 2px solid #0DB8DE;
    border-top: 0px;
    border-radius: 0px;
    font-weight: bold;
    outline: 0;
    margin-bottom: 20px;
    padding-left: 0px;
    color: #ECF0F5;
}

input[type=password] {
    background-color: #1A2226;
    border: none;
    border-bottom: 2px solid #0DB8DE;
    border-top: 0px;
    border-radius: 0px;
    font-weight: bold;
    outline: 0;
    padding-left: 0px;
    margin-bottom: 20px;
    color: #ECF0F5;
}

.form-group {
    margin-bottom: 40px;
    outline: 0px;
}

.form-control:focus {
    border-color: inherit;
    -webkit-box-shadow: none;
    box-shadow: none;
    border-bottom: 2px solid #0DB8DE;
    outline: 0;
    background-color: #1A2226;
    color: #ECF0F5;
}

input:focus {
    outline: none;
    box-shadow: 0 0 0;
}

label {
    margin-bottom: 0px;
}

.form-control-label {
    font-size: 10px;
    color: #6C6C6C;
    font-weight: bold;
    letter-spacing: 1px;
}

.btn-outline-primary {
    border-color: #0DB8DE;
    color: #0DB8DE;
    border-radius: 0px;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

.btn-outline-primary:hover {
    background-color: #0DB8DE;
    right: 0px;
}

.login-btm {
    float: left;
}

.login-button {
    padding-right: 0px;
    text-align: right;
    margin-bottom: 25px;
}

.login-text {
    text-align: left;
    padding-left: 0px;
    color: #A2A4A4;
}

.loginbttm {
    padding: 0px;
}
.login-box {
  -webkit-animation-name: login-box;
  animation-name: login-box;
  -webkit-animation-duration: 1s;
  animation-duration: 1s;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
}
@keyframes login-box {
  0% {
    opacity: 0;
    -webkit-transform: translate3d(0, -100%, 0);
    transform: translate3d(0, -100%, 0);
  }
  100% {
    opacity: 1;
    -webkit-transform: none;
    transform: none;
  }
}

</style>

</head>

<body>
    
<div class="container">
        <div class="row">
            <div class="col-lg-3 col-md-2"></div>


         
            <div class="col-lg-6 col-md-8 login-box">
                <div class="col-lg-12 login-key">
                    <i class="fa fa-key" aria-hidden="true"></i>
                </div>
                <div class="col-lg-12 login-title">
                    Registration
                </div>

                <div class="col-lg-12 login-form">
                    <div class="col-lg-12 login-form">
                     
                            <div class="form-group">
                                <label class="form-control-label">Enter Key</label>
                                <input type="text" class="form-control" id="reg_key">
                            </div>
                            

                            <div class="col-lg-12 loginbttm">
                                <div class="col-lg-6 login-btm login-text">
                                    <!-- Error Message -->
                                </div>
                                <div class="col-lg-7 login-btm login-button">
                                    <button type="button" onclick="submit_save_form();" class="btn btn-outline-primary">Proceed</button>
                                </div>
                            </div>
                    
                    </div>
                </div>
                <div class="col-lg-3 col-md-2"></div>
            </div>

        </div>
</body>
<script src="{{ asset('js/jquery-3.6.3.min.js') }}" ></script>



<script>

$('#reg_key').keypress(function (e) {
 var key = e.which;
 if(key == 13) 
  {
    submit_save_form();
  }
});   

function check_cookie_name(name) 
    {
      var match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
      if (match) {
        window.location.href = "{{ route('login')}}";
      }
      else{
           console.log('--something went wrong---');
      }
   }
   check_cookie_name('c_id');



function submit_save_form(){

    status=0;

    if($("#reg_key").val()==""){
        status=0;
        alert("Enter Key");
        return;
    }

    if(status==0){
        Save_form();
    }
}


function setCookie(name,value,days) {
   var expires = "";
   if (days) {
       var date = new Date();
       date.setTime(date.getTime() + (days*24*60*60*1000));
       expires = "; expires=" + date.toUTCString();
   }
   document.cookie = name + "=" + (value || "")  + expires + "; path=/";
}






function Save_form() {

$.ajax({
url: "/verify_reg",
type: "POST",
data:{
  '_token': "{{ csrf_token() }}",
      reg_key:$.trim($('#reg_key').val())

},
success:function(response){
 

if(response.length>0){


    if (response[0]['company_id']!='') {


setCookie('c_id', response[0]['company_id'], 7);


window.location.href = "{{ route('login')}}";

    
 }
}
 
 else{

alert("Registration Failed");

 }
},
error: function(response) {
}
});
}

</script>

</html>









