<?php

 session_start();

 include '../config.php';

 require '../include/aws-sdk/aws-autoloader.php';

 use Aws\CloudFront\CloudFrontClient;

 $IAM_KEY = $aws_access_key_id_privado;

 $IAM_SECRET = $aws_secret_access_key_privado;



 if(strlen($_COOKIE['persistuserdf'])<5){

    header('Location: /#login');

    exit();

    //echo "SIN COOKIE" . $_COOKIE['persistuser'];

 }

 else{

    $correo = $_COOKIE['persistuserdf'];



    //echo $correo;

    if(strlen($correo) > 5){



        $logeado = true;

        $curluser = curl_init();

        curl_setopt_array($curluser, array(

        CURLOPT_URL => $endpoint_graph_cms,

        CURLOPT_RETURNTRANSFER => true,

        CURLOPT_ENCODING => '',

        CURLOPT_MAXREDIRS => 10,

        CURLOPT_TIMEOUT => 0,

        CURLOPT_FOLLOWLOCATION => true,

        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

        CURLOPT_CUSTOMREQUEST => 'POST',

        CURLOPT_POSTFIELDS =>'{"query":"query MyQuery {\\r\\n  usuariosSitioPrivado(where: {email: \\"'.$correo.'\\"}) {\\r\\n    id\\r\\n  resetPass\\r\\n fechaCambioPassword\\r\\n nombre\\r\\n  rol\\r\\n  tycAceptados\\r\\n  permisos\\r\\n  }\\r\\n}\\r\\n","variables":{}}',

        CURLOPT_HTTPHEADER => array(

          'Content-Type: application/json',

          'Cookie: __cfduid=da2693cdfd39b7377a8a05e305da45b8f1613001694'

        ),

      ));



      $responseuser = curl_exec($curluser);

      $_SESSION['requestDataUser'] = $responseuser;

      curl_close($curluser);



      $jsonrespuestauser = json_decode($responseuser, true);

      $idgraph = $jsonrespuestauser['data']['usuariosSitioPrivado'][0]['id'];

      $iduser = $jsonrespuestauser['data']['usuariosSitioPrivado'][0]['id'];

      $resetPass_privado = $jsonrespuestauser['data']['usuariosSitioPrivado'][0]['resetPass'];

      $fechaPass = $jsonrespuestauser['data']['usuariosSitioPrivado'][0]['fechaCambioPassword'];

      $rol_user_privado = $jsonrespuestauser['data']['usuariosSitioPrivado'][0]['rol'];

      $nombre_user_privado = $jsonrespuestauser['data']['usuariosSitioPrivado'][0]['nombre'];

      $tyc = $jsonrespuestauser['data']['usuariosSitioPrivado'][0]['tycAceptados'];

      $permisos = $jsonrespuestauser['data']['usuariosSitioPrivado'][0]['permisos'];



    }

 }



 if($resetPass_privado == 1){

     //header('location:/password');

 }



 $lang = 'en';

 $seccion = $_GET['s'];





 $curl = curl_init();

 curl_setopt_array($curl, array(

     CURLOPT_URL => $endpoint_graph_cms,

     CURLOPT_RETURNTRANSFER => true,

     CURLOPT_ENCODING => '',

     CURLOPT_MAXREDIRS => 10,

     CURLOPT_TIMEOUT => 0,

     CURLOPT_FOLLOWLOCATION => true,

     CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

     CURLOPT_CUSTOMREQUEST => 'POST',

     CURLOPT_POSTFIELDS =>'{"query":"query MyQuery {\\r\\n  __typename\\r\\n  generalidadesSitioPrivado(stage: PUBLISHED, where: {id: \\"ckuwqltrkpenm0b788cug2f0d\\"}) {\\r\\n    id\\r\\n    dominiosPermitidos\\r\\n    firmasDigitales\\r\\n    titulo\\r\\n   avisoTexto\\r\\n   avisoImagen\\r\\n   avisoLink\\r\\n  avisoTextoBoton\\r\\n  imagenLateral\\r\\n    terminosYCondiciones\\r\\n  avisoTyC\\r\\n versionTyC\\r\\n    localizations {\\r\\n      archivoIsin\\r\\n      dominiosPermitidos\\r\\n      firmasDigitales\\r\\n      titulo\\r\\n  avisoTexto\\r\\n   avisoImagen\\r\\n   avisoLink\\r\\n  avisoTextoBoton\\r\\n    imagenLateral\\r\\n       terminosYCondiciones\\r\\n avisoTyC\\r\\n  versionTyC\\r\\n      }\\r\\n    archivoIsin\\r\\n  }\\r\\n}","variables":{}}',

     CURLOPT_HTTPHEADER => array(

       'Content-Type: application/json',

       'Cookie: __cfduid=da2693cdfd39b7377a8a05e305da45b8f1613001694'

     ),

   ));

   

 $response = curl_exec($curl);

 

 curl_close($curl);

 //echo $response;

 

 

 

 $jsonrespuesta = json_decode($response, true);

 $id = $jsonrespuesta['data']['generalidadesSitioPrivado']['id'];

 

 if($lang == 'es'){

    $titulo_privado = $jsonrespuesta['data']['generalidadesSitioPrivado']['localizations'][0]['titulo'];

    $titulopag =  $titulo_privado;

    $aviso_texto = $jsonrespuesta['data']['generalidadesSitioPrivado']['localizations'][0]['avisoTexto'];

    $aviso_imagen = $jsonrespuesta['data']['generalidadesSitioPrivado']['localizations'][0]['avisoImagen'];

    $aviso_link = $jsonrespuesta['data']['generalidadesSitioPrivado']['localizations'][0]['avisoLink'];

    $aviso_texto_boton = $jsonrespuesta['data']['generalidadesSitioPrivado']['localizations'][0]['avisoTextoBoton'];

    $imagenLateral = $jsonrespuesta['data']['generalidadesSitioPrivado']['localizations'][0]['imagenLateral'];



    $avisoTyC = $jsonrespuesta['data']['generalidadesSitioPrivado']['localizations'][0]['avisoTyC'];

    $versionTyC = $jsonrespuesta['data']['generalidadesSitioPrivado']['localizations'][0]['versionTyC'];

     

    

     

     

 }

 

 if($lang == 'en'){

     $titulo_privado = $jsonrespuesta['data']['generalidadesSitioPrivado']['titulo'];

     $titulopag =  $titulo_privado;

     $aviso_texto = $jsonrespuesta['data']['generalidadesSitioPrivado']['avisoTexto'];

    $aviso_imagen = $jsonrespuesta['data']['generalidadesSitioPrivado']['avisoImagen'];

    $aviso_link = $jsonrespuesta['data']['generalidadesSitioPrivado']['avisoLink'];

    $aviso_texto_boton = $jsonrespuesta['data']['generalidadesSitioPrivado']['avisoTextoBoton'];

    $imagenLateral = $jsonrespuesta['data']['generalidadesSitioPrivado']['imagenLateral'];

    $avisoTyC = $jsonrespuesta['data']['generalidadesSitioPrivado']['avisoTyC'];

    $versionTyC = $jsonrespuesta['data']['generalidadesSitioPrivado']['versionTyC'];



 }

 

$urles = "/area-clientes";

$urlen = "/clients-area";



if($resetPass_privado == 1 || $resetPass_privado == "1"){

    $modalpass_privado = "RESETPASS";

}



if(strlen($_SESSION['userPassUpdated'])>2){

    $modalpass_privado = "RESETPASSNO";   

}





$ruta_imagenaviso = $aviso_imagen;

$ruta_lateral = $imagenLateral;



$cloudfront_url = $cloudfront_privado.$ruta_imagenaviso."?versionload=".time();

$cloudfront_url_lateral = $cloudfront_privado.$ruta_lateral."?versionload=".time();



// Crear CF signed URL





$resourceKey = $cloudfront_url;

$resourceKeylateral = $cloudfront_url_lateral;

$expires = time() + 400;





$cfClient = new Aws\CloudFront\CloudFrontClient([

    'version' => 'latest',

    'region' => 'us-east-1',

    'credentials' => array(

        'key' => $IAM_KEY,

        'secret' => $IAM_SECRET

    )

]);



$imagenaviso_signed = $cfClient->getSignedUrl([

    'url' => $resourceKey,

    'expires' => $expires,

    'private_key' => $privateKey,

    'key_pair_id' => $keyPairId

]);



$imagenlateral_signed = $cfClient->getSignedUrl([

    'url' => $resourceKeylateral,

    'expires' => $expires,

    'private_key' => $privateKey,

    'key_pair_id' => $keyPairId

]);



//echo $download_url;



?>



<!DOCTYPE html>

<html lang="es">

    <head>

        

        <?php  include '../include/generales.php';

        ?>

			

        <style>

            #formpassprivado.formprod .field-icon {

                float: right;

                margin-left: -25px;

                margin-top: 0;

                position: relative;

                z-index: 2;

            }

            h4.text-left {

                max-width: 300px;

            }

            .page-section {

                padding-top: 160px;

                padding-bottom: 30px;

            }

            .caja{

                    /* display: flex; */

                /* flex-flow: column wrap; */

                justify-content: center;

                align-items: center;

                height: 100%;

                overflow: hidden;

            }

            .box{

            /*width: 450px;*/

            /*height: 300px;*/

            overflow: hidden;

            }



            .box img{

            width: 100%;

            height: auto;

            }

            @supports(object-fit: cover){

                .box img{

                /*height: 100%;*/

                object-fit: cover;

                object-position: center center;

                }

            } 



            .padding-0{

                padding-right:0;

                padding-left:0;

            }



            .accordion a {

  position: relative;

  display: -webkit-box;

  display: -webkit-flex;

  display: flex;

  -webkit-box-orient: vertical;

  -webkit-box-direction: normal;

  -webkit-flex-direction: column;

  flex-direction: column;

  width: 100%;

  padding: 1rem 3rem 1rem 1rem;

  color: #7288a2;

  font-size: 1.15rem;

  font-weight: 400;

  border-bottom: 1px solid #e5e5e5;

}



.accordion a:hover,

.accordion a:hover::after {

  cursor: pointer;

  color: #48aa42;

}



.accordion a:hover::after {

  border: 1px solid #48aa42;

}



.accordion a.active {

  color: #48aa42;

  border-bottom: 1px solid #48aa42;

}



.accordion a::after {

    font-family: 'Ionicons';

    content: '\f218';

    position: absolute;

    float: right;

    right: 1rem;

    font-size: 20px;

    color:#2b4365;

    padding: 0;

    width: 30px;

    height: 30px;

    -webkit-border-radius: 50%;

    -moz-border-radius: 50%;

    border-radius: 50%;

    border: 1px solid #2b4365;

    text-align: center;

}

.accordion a.active::after {

  font-family: 'Ionicons';

  content: '\f209';

  color: #48aa42;

  border: 1px solid #48aa42;

}



.accordion .content {

  display: none;

  padding: 1rem;

  border-bottom: 1px solid #e5e5e5;

  overflow: hidden;

}



.accordion .content p {

    font-size: 13px;

    font-weight: 300;

    font-family: 'Noto Sans', sans-serif;

    color: #888;

}

.accordion {

    padding-top: 40px;

    font-family:"Montserrat", sans-serif;

}	

.accordion a {

    color:#2b4365!important;

    font-weight:bold;

    text-decoration:none;

}

.accordion-item {

    padding: 12.5px 0;





}

.accordion a.btndescarga {

    background: #48aa42;

    border-radius: 10px;

    display: inline-block;

    width: auto;

    color: #fff!important;

    transition: .35s all ease;

    font-size: 15px;

    margin-right: 15px;

    padding: 10px;

}

.accordion a.btndescarga:hover {

    background: #2b4365;

}

.accordion a.btndescarga:after {

    display:none;

}

a.btndescarga i {

    padding: 0 10px;

    

}

.comunicado-bg.right {

    background-color: rgba(205,205,212, 0.4);

    padding: 40px 40px 38px 40px;

    margin-bottom: 50px;

    background-repeat: no-repeat;

    padding-left: 5%;

    background-position: right;

    padding-right: 35%;

    background-size: 30% 100%;

}

.comunicado-bg.left {

    background-color: rgba(205,205,212, 0.4);

    padding: 40px 40px 38px 40px;

    margin-bottom: 50px;

    background-repeat: no-repeat;

    padding-left: 35%;

    background-size: 30% 100%;

    padding-right: 5%;

}



.extendido {

    right:0;

    position: absolute;

}

.extendido img {

    height: 300px;

    width: 100%;

}

.title {

    margin: 100px 0;

}

.innerbox {

    background: rgba(205,205,212, 0.4);

    padding: 30px;

    margin-bottom: 30px;

}

.innerbox h5 {

    min-height: 60px;

}

.innerbox .btn.btn-primary, .bannerinferior .btn.btn-primary {

    bottom: 60px!important;

}





#caractform {

        width: 100%;

        margin: 10px auto;

        padding: 3em 2em 2em 2em;

        background: #fafafa;

        /* min-width: 1500px; */

        border-radius: 10px;

        font-size: 12px;

        font-family: "Montserrat";

    }

    #caractform .group {

        position: relative;

        margin-bottom: 35px;

        width: 33.33%;

        float: left;

        padding: 0 10px;

    }



    #caractform input, #caractform textarea  {

        font-size: 18px;

        padding: 10px 10px 10px 5px;

        -webkit-appearance: none;

        display: block;

        background: #fafafa;

        color: #636363;

        width: 100%;

        border: none;

        border-radius: 0;

        border-bottom: 1px solid #757575;

    }



    #caractform input:focus { outline: none; }





    /* Label */



    #caractform label {

        color: #999; 

        font-size: 14px;

        font-weight: normal;

        position: absolute;

        pointer-events: none;

        left: 5px;

        top: 10px;

        transition: all 0.2s ease;

    }



    #caractform label span {

        font-size: 10px;



    }





    /* active */



    #caractform input:focus ~ label, #caractform input.used ~ label, #caractform textarea:focus ~ label, #caractform textarea.used ~ label  {

        top: -20px;

    transform: scale(.75); left: -2px;

        /* font-size: 14px; */

        color: #2b4365;

    }





    /* Underline */



    #caractform .bar {

        position: relative;

        display: block;

        width: 100%;

    }



    #caractform .bar:before, #caractform .bar:after {

        content: '';

        height: 2px; 

        width: 0;

        bottom: 1px; 

        position: absolute;

        background: #2b4365; 

        transition: all 0.2s ease;

    }



    #caractform .bar:before { left: 50%; }



    #caractform .bar:after { right: 50%; }





    /* active */



    #caractform input:focus ~ .bar:before, #caractform input:focus ~ .bar:after { width: 50%; }





    /* Highlight */



    #caractform .highlight {

        position: absolute;

        height: 60%; 

        width: 100px; 

        top: 25%; 

        left: 0;

        pointer-events: none;

        opacity: 0.5;

    }





    /* active */



    #caractform input:focus ~ .highlight {

        animation: inputHighlighter 0.3s ease;

    }





    /* Animations */



    @keyframes inputHighlighter {

        from { background: #2b4365; }

        to 	{ width: 0; background: transparent; }

    }





    /* Button */



    #caractform .button {

    position: relative;

    display: inline-block;

    padding: 12px 24px;

    margin: .3em 0 1em 0;

    width: 100%;

    vertical-align: middle;

    color: #fff;

    font-size: 16px;

    line-height: 20px;

    -webkit-font-smoothing: antialiased;

    text-align: center;

    letter-spacing: 1px;

    background: transparent;

    border: 0;

    border-bottom: 2px solid #48aa42;

    cursor: pointer;

    transition: all 0.15s ease;

    }

    #caractform .button:focus { outline: 0; }





    /* Button modifiers */



    #caractform .buttonBlue {

    background: #2b4365;

    text-shadow: 1px 1px 0 #48aa42;

    }



    #caractform .buttonBlue:hover { background: #48aa42; }





    /* Ripples container */



    #caractform .ripples {

    position: absolute;

    top: 0;

    left: 0;

    width: 100%;

    height: 100%;

    overflow: hidden;

    background: transparent;

    }





    /* Ripples circle */



    #caractform .ripplesCircle {

    position: absolute;

    top: 50%;

    left: 50%;

    transform: translate(-50%, -50%);

    opacity: 0;

    width: 0;

    height: 0;

    border-radius: 50%;

    background: rgba(255, 255, 255, 0.25);

    }



    #caractform .ripples.is-active .ripplesCircle {

    animation: ripples .4s ease-in;

    }



    .btn-primary {

        font-family: "Montserrat", sans-serif;

    }

    /* Ripples animation */



    @keyframes ripples {

    0% { opacity: 0; }



    25% { opacity: 1; }



    100% {

        width: 200%;

        padding-bottom: 200%;

        opacity: 0;

    }

    }



    .selects select {

    word-wrap: normal;

    font-size: 14px;

    padding: 10px 10px 10px 5px;

    -webkit-appearance: none;

    display: block;

    background: #fafafa;

    color: #636363;

    width: 100%;

    border: none;

    border-radius: 0;

    border-bottom: 1px solid #757575;

}

#caractform .selects label {

    position: relative;

    color: #2b4365;

    font-weight: 600;

}

#caractform .datos .group {

    width: 50%;

}

.infofinal {

    width: 100%;

    padding: 30px 10%;

    color:222;

}

.infofinal b {

    color: #2b4365;

    font-family: "Montserrat";

}

p#c1_text {

    margin-top: 40px;

}

p#nombre_completo_text {

    margin-top: 40px;

    text-align: center;

    border-top: 1px solid #2b4365;

    padding-top: 10px;

    margin-bottom: 0;

}

p#nombre_completo2_text, #puesto_text, #puesto2_text {

    text-align: center;

}

p#nombre_completo2_text {

    margin-bottom: 0;

}

p#puesto2_text {

    text-align: center;

}



div#resultsForm .btn-primary {

    float: right;

    /* position: absolute; */

}

h5#exampleModalLabel {

    width: 100%;

    float: left;

    padding: 10px 20px 30px;

}

@media(max-width:1024px){

            #linkdestacado .col-md-3 {

                max-width: 40%;

            }

            #linkdestacado .col-md-9 {

                max-width: 60%;

            }

        }

            

        @media(max-width:768px){

            #linkdestacado .col-md-3 {

                max-width: 100%;

            }

            #linkdestacado .col-md-9 {

                max-width: 100%;

            }

            img.logoevent {

                max-height: 300px;

            }

            .bannerinferior {

                background-size: cover;

                margin-bottom: 70px!important;

                margin-top: 0px;

            }

            #carouselExampleIndicators {

                margin-top: 60px;

                margin-bottom: 30px;

                height: 50vh;

            }

            .carousel-inner, .carousel-item {

                height: 50vh;

            }

            .carousel-item img {

                height: 50vh;

                object-fit: cover;

                object-position: 50%;

            }

            .masthead-heading {

                font-size: 45px;

            }

            .carousel-caption h5 {

                font-size: 15px;

            }

            

            

        }



        

        .avisobox {

            background: #cdcdd4;

            margin-top: 50px;

            float: right;

            margin-right: -12.5px;

            padding: 30px;

            margin-bottom: -50px;

        }



        .bannerinferior{

            background-size: cover;

            margin-bottom: 50px!important;

            margin-top: -30px;

        }

        .col-md-12 .innerbox.bg2 {

            background-color: #cdcdd4;

            float: left;

        }



        img.boximg {

            width: 100%;

            max-height: 180px;

            object-fit: cover;

            min-height: 180px;

            border: 1px solid #ccc;

        }

@media(max-width:700px){

    .extendido {

        transform: none;

        position: relative;

    }

    .estadisticas .title {

        margin: 0;

        text-align: left!important;

    }

    .estadisticas .title h4.text-left {

        text-align: left!important;

        margin-bottom: 20px;

    }

    .extendido img {

        height: 100px;

        width: 100%;

        object-fit: cover;

    }

    h4, .h4 {

        font-size: 2rem;

        color: #2b4365;

    }

}



div#linkdestacado {

    padding: 0;

    background: #cdcdd4!important;

}

img#logolinkdestacado {

    width: 100%;

    object-fit: cover;

}

.innerbox .btn.btn-primary, .bannerinferior .btn.btn-primary {

    float: right;

    right: 40px;

    position: absolute;

    bottom: 30px;

}

.innerbox2 h3.my-3 {

    padding: 30px;

    font-size: 16px;

}



#linkdestacado .btndest {

    bottom: 0!important;

}

#userslink{

    background: #2b4365;

    color: #fff;

    /* border-radius: 20px; */

}



#userslink h5 {

    color: #fff!important;

}



div#modaltyc {

    padding: 20px 10%;

}



.disabledbtn {

    pointer-events: none;

    opacity: .5;

}



.content.tyccontent {

    text-align: justify;

    padding: 5%;

}

.glyphicon-remove {

    color: #ed6e6e;

}

.glyphicon-ok {

    color: #9aee9a;

}



.formprod input, .formprod textarea {

    width: 100%;

    float: left;

    margin: 0 0 15px;

    min-height: 50px;

    border-radius: 0;

    border: 0;

    font-size: 15px;

    padding: 5px 5px 0;

    background: rgba(255, 255, 255, 0.95);

    color: #111;

    font-weight: 500;

    border-bottom: 2px solid #b4b4b4;

}



.field-icon.toggle-passwordpriv {

    float: right;

    position: absolute;

    right: 20px;

    font-size: 20px;

    top: 20px;

    cursor: pointer;

    opacity: .3;

    background: transparent;

}



#guardarprod, #guardarhorarios, #botonupdatepasspriv {

    /* background: #94b300; */

    color: #fff;

    float: none;

    width: 100%;

    padding: 10px;

    border-radius: 0;

    margin: 10px 0;

    font-weight: bold;

    max-width: 100%;

    display: inline-block;

    cursor: pointer;

    transition: .35s all ease;

    background: #2b4365;

    text-align: center;

}



.formgroup {

    width: 100%;

    float: left;

    text-align: left;

    font-weight: 500;

    color: #222;

    font-size: 12px;

    padding: 5px;

    position:relative;

}

    </style>

    <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">

    </head>

    <body id="page-top" class="estadisticas" data-url = '<?php echo $page_url;?>' data-user="<?php echo $idgraph;?>"  data-permisos="<?php echo $permisos;?>" data-tyc="<?php echo  $tyc;?>">

		

		<?php include '../include/nav2.php';?>



                <!-- Services-->

                <section class="page-section" id="services">



                    <div class="container" style="padding-top:0;">

                        <div class="row">



                            <div class="col-lg-5 title" style="vertical-align: center;">

                                <h4 class="text-left"><?php echo urldecode($titulo_privado);?></h4>

                                <h5>Good day, <b><?php echo urldecode($nombre_user_privado);?></b></h5>

                                <a id="logout" href="/logout"><img src="/assets/img/logout.svg" style="width:20px; margin:5px;">Logout</a>

                            </div>	

                            

                            <div class="col-lg-7 padding-0 extendido">



                            <img src="<?php echo $imagenlateral_signed;?>" class="padding-0 img-fluid">

                                

                            </div>	

                                        

                        </div>	  

                    </div>

                    <div class="container">

			  <div class="row">

                

              <div class="innerbox bg2" id="linkdestacado" style="padding-bottom: 0 !important;">



                        <div class="innerbox2 col-md-3" style="float: left; padding:0">

                                <img src="<?php echo $imagenaviso_signed;?>" class="logoevent" id="logolinkdestacado" style="height: 235.6px;">                                

                            </div>



                            <div class="innerbox2 col-md-9" style="float: left;">

                                <h3 class="my-3"><?php echo urldecode($aviso_texto);?></h3>

                                <a class="btn btn-primary btn-xl text-uppercase js-scroll-trigger btnarticulo btndest" target="_blank" href="<?php echo urldecode($aviso_link);?>"><?php echo urldecode($aviso_texto_boton);?></a>

                            </div>

                            

                            

                            

                            

                            

                        </div>

                

                <div class="col-lg-12" style="margin-top: 30px;">

                <div class="container">

                    <div class="row">





               <?php 

               if($rol_user_privado == "total" || $rol_user_privado == "admin"){



                ?>

                <div class="col-lg-4 comunicado-bg" id="">

                    <div class="innerbox" id="userslink">

                        <h5 class="text-blue my-3 "> User Management</h5>

                        

                        

                        <a target="_blank" class="btn btn-primary btn-xl  js-scroll-trigger btnactioncard" href="users" googl="true"><i class="fas fa-users"></i>View more</a>

                    </div>

                    

                </div>

                

                

                <div class="col-lg-4 comunicado-bg" id="" style="display:none;">

                    <div class="innerbox" id="userslink">

                        <h5 class="text-blue my-3 ">Términos y condiciones</h5>

                        

                        

                        <a data-toggle="modal" data-target="#tycadmin" class="btn btn-primary btn-xl  js-scroll-trigger btnactioncard" href="#tycusers" googl="true"><i class="fas fa-file-contract"></i> Abrir</a>

                    </div>

                    

                </div>



                <?php

               }

               

               ?>





                <?php



                        if(strlen($_SESSION['actionCardsPriv'])>90 && strlen($_COOKIE['persistID'])<2)

                        {

                            $responseactionCards = $_SESSION['actionCardsPriv'];

                            //echo $_SESSION['actionCardsPriv'];

                        }

                        else{

                            $curl = curl_init();

                            curl_setopt_array($curl, array(

                            CURLOPT_URL => $endpoint_graph_cms,

                            CURLOPT_RETURNTRANSFER => true,

                            CURLOPT_ENCODING => '',

                            CURLOPT_MAXREDIRS => 10,

                            CURLOPT_TIMEOUT => 0,

                            CURLOPT_FOLLOWLOCATION => true,

                            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

                            CURLOPT_CUSTOMREQUEST => 'POST',

                            CURLOPT_POSTFIELDS =>'{"query":"query MyQuery {\\r\\n  actionCardsCumplimiento( stage: PUBLISHED, where: {estatus_not: \\"oculto\\", estatus_not_contains: \\"eliminado\\"}) {\\r\\n    archivo\\r\\n    enlace\\r\\n   layout\\r\\n   slug\\r\\n  estatus\\r\\n    id\\r\\n    nuevaPestana\\r\\n    texto\\r\\n    textoDelBoton\\r\\n    titulo\\r\\n    localizations {\\r\\n      archivo\\r\\n      enlace\\r\\n      enviadoRevision\\r\\n      layout\\r\\n   slug\\r\\n  estatus\\r\\n      id\\r\\n      nuevaPestana\\r\\n      texto\\r\\n      textoDelBoton\\r\\n      titulo\\r\\n    }\\r\\n  }\\r\\n}\\r\\n","variables":{}}',

                            CURLOPT_HTTPHEADER => array(

                                'Content-Type: application/json',

                                'Cookie: __cfduid=da2693cdfd39b7377a8a05e305da45b8f1613001694'

                            ),

                            ));

                        $responseactionCards = curl_exec($curl);

                        $_SESSION['actionCardsPriv'] = $responseactionCards;

                        curl_close($curl);

                        }



                        //echo $responseactionCards;

                        $arrayactionCards = json_decode($responseactionCards, true);



                        foreach ($arrayactionCards['data']['actionCardsCumplimiento'] as $item) {

                        

                        if($lang == 'en'){



                            $boton ="";



                                if (strpos($item['enlace'], 'https://') !== false) {

                                    $target = "_blank";

                                }

                                else{

                                    $target="_self";

                                }

                                                    

                                if(strlen($item['archivo'])>0){

                                    $icon = "fas fa-file-pdf";

                                    $ruta = $item['archivo'];



                                    $cloudfront_url = $cloudfront_privado.$ruta."?versionload=".time();



                                    // Crear CF signed URL

                                       



                                        $resourceKey = $cloudfront_url;

                                        $expires = time() + 400;

                                        



                                        $cfClient = new Aws\CloudFront\CloudFrontClient([

                                            'version' => 'latest',

                                            'region' => 'us-east-1',

                                            'credentials' => array(

                                                'key' => $IAM_KEY,

                                                'secret' => $IAM_SECRET

                                            )

                                        ]);



                                        $download_url = $cfClient->getSignedUrl([

                                            'url' => $resourceKey,

                                            'expires' => $expires,

                                            'private_key' => $privateKey,

                                            'key_pair_id' => $keyPairId

                                        ]);



                                        //echo $download_url;



                                    $boton = '

                                    <a target="_blank" class="btn btn-primary btn-xl text-uppercase js-scroll-trigger" href="'.$download_url.'"><i class="descarga-icon fas fa-file-pdf" aria-hidden="true"></i> '.urldecode($item['textoDelBoton']).'</a>

                                    ';

                                }

                        

                                if(strlen($item['enlace'])>3){

                                    $icon = "fas fa-link";

                        

                                    $boton = '<a target="'.$target.'" class="btn btn-primary btn-xl  js-scroll-trigger btnactioncard" href="'.$item['enlace'].'" googl="true"><i class="descarga-icon '.$icon.'" aria-hidden="true" googl="true"></i> '.urldecode($item['textoDelBoton']).'</a>';

                                }

                        

                                if($item['enlace'] == "#formulario"){

                                    $boton = '<a data-toggle="modal" data-target="#FormularioCaracteristicasEsp" onclick="limpiaisin();" class="btn btn-primary btn-xl  js-scroll-trigger btnactioncard" googl="true"><i class="descarga-icon fab fa-wpforms" aria-hidden="true"></i> '.urldecode($item['textoDelBoton']).'</a>';

                                }





                                $pos_permisos = strpos($permisos, $item['slug']);

                            

                                if ($pos_permisos === false) {}

                                else{



                                    if($item['layout'] == "priv-small"){

                                        echo '

                                        <div class="col-md-4 comunicado-bg" id="'.$item['slug'].'">

                                            <div class="innerbox" googl="true">

                                                <h5 class="text-blue my-3">'.urldecode($item['titulo']).'</h5>

                                                '.urldecode($item['texto']).'

    

                                                

                                                                    

                                                '.$boton.'

                                            </div>                    

                                        </div>';

                                    }

                                    

                                    if($item['layout'] == "priv-full"){

                                        echo '

                                        <div class="col-md-12 comunicado-bg" id="'.$item['slug'].'">

                                            <div class="innerbox" googl="true">

                                                <h5 class="text-blue my-3">'.urldecode($item['titulo']).'</h5>

                                                '.urldecode($item['texto']).'

    

                                                

                                                                    

                                                '.$boton.'

                                            </div>                    

                                        </div>';

                                    }

                                    if($item['layout'] == "priv-half"){

                                        echo '

                                        <div class="col-md-6 comunicado-bg" id="'.$item['slug'].'">

                                            <div class="innerbox" googl="true">

                                                <h5 class="text-blue my-3">'.urldecode($item['titulo']).'</h5>

                                                '.urldecode($item['texto']).'

    

                                               

                                                                    

                                                '.$boton.'

                                            </div>                    

                                        </div>';

                                    }

                                    if($item['layout'] == "priv-accordion"){

                                        echo '

                                        

                                        <div class="col-md-12 comunicado-bg" id="'.$item['slug'].'">

                                            <div class="innerbox" googl="true">

                                    

                                            <div class="accordion">

                                                <div class="accordion-item">

                                                    <a class="plus"><h5 class="text-blue my-3">'.urldecode($item['titulo']).'</h5></a>

                                                    <div class="content">

                                                    '.urldecode($item['texto']).'

    

                                                    <br>

                                                    <a target="_blank" class="btn btn-primary btn-xl text-uppercase js-scroll-trigger" href="'.$cloudfront.$item['archivo'].'"><i class="descarga-icon fas fa-file-pdf" aria-hidden="true"></i> '.urldecode($item['textoDelBoton']).'</a>

                                                    </div>

                                                </div>

                                            </div>

                                        </div>

                                    </div>

                                        

                                        ';

                                    }



                                }

   







                            

                            

                        }



                        if($lang == 'es'){



                            foreach ($item['localizations'] as $subitem) {

                                $boton ="";



                                if (strpos($subitem['enlace'], 'https://') !== false) {

                                    $target = "_blank";

                                }

                                else{

                                    $target="_self";

                                }

                                                    

                                if(strlen($subitem['archivo'])>0){



                                    $ruta = $subitem['archivo'];



                                    $cloudfront_url = $cloudfront_privado.$ruta."?versionload=".time();



                                    // Crear CF signed URL

                                       



                                        $resourceKey = $cloudfront_url;

                                        $expires = time() + 400;

                                        



                                        $cfClient = new Aws\CloudFront\CloudFrontClient([

                                            'version' => 'latest',

                                            'region' => 'us-east-1',

                                            'credentials' => array(

                                                'key' => $IAM_KEY,

                                                'secret' => $IAM_SECRET

                                            )

                                        ]);



                                        $download_url = $cfClient->getSignedUrl([

                                            'url' => $resourceKey,

                                            'expires' => $expires,

                                            'private_key' => $privateKey,

                                            'key_pair_id' => $keyPairId

                                        ]);



                                        //echo $download_url;



                                    $icon = "fas fa-file-pdf";

                                    $boton = '

                                    <a target="_blank" class="btn btn-primary btn-xl text-uppercase js-scroll-trigger" href="'.$download_url.'"><i class="descarga-icon fas fa-file-pdf" aria-hidden="true"></i> '.urldecode($subitem['textoDelBoton']).'</a>

                                    ';

                                }

                        

                                if(strlen($subitem['enlace'])>3){

                                    $icon = "fas fa-link";

                        

                                    $boton = '<a target="'.$target.'" class="btn btn-primary btn-xl  js-scroll-trigger btnactioncard" href="'.$subitem['enlace'].'" googl="true"><i class="descarga-icon '.$icon.'" aria-hidden="true" googl="true"></i> '.urldecode($subitem['textoDelBoton']).'</a>';

                                }

                        

                                if($subitem['enlace'] == "#formulario"){

                                    $boton = '<a data-toggle="modal" data-target="#FormularioCaracteristicasEsp" onclick="limpiaisin();" class="btn btn-primary btn-xl  js-scroll-trigger btnactioncard" googl="true"><i class="descarga-icon fab fa-wpforms" aria-hidden="true"></i> '.urldecode($subitem['textoDelBoton']).'</a>';

                                }



                                $pos_permisos = strpos($permisos, $subitem['slug']);

                            

                                if ($pos_permisos === false) {}

                                else{



                                    if($subitem['layout'] == "priv-small"){

                                        echo '

                                        <div class="col-md-4 comunicado-bg" id="'.$subitem['slug'].'">

                                            <div class="innerbox" googl="true">

                                                <h5 class="text-blue my-3">'.urldecode($subitem['titulo']).'</h5>

                                                '.urldecode($subitem['texto']).'

    

                                                

                                                                    

                                                '.$boton.'

                                            </div>                    

                                        </div>';

                                    }

                                    

                                    if($subitem['layout'] == "priv-full"){

                                        echo '

                                        <div class="col-md-12 comunicado-bg" id="'.$subitem['slug'].'">

                                            <div class="innerbox" googl="true">

                                                <h5 class="text-blue my-3">'.urldecode($subitem['titulo']).'</h5>

                                                '.urldecode($subitem['texto']).'

    

                                                

                                                                    

                                                '.$boton.'

                                            </div>                    

                                        </div>';

                                    }

                                    if($subitem['layout'] == "priv-half"){

                                        echo '

                                        <div class="col-md-6 comunicado-bg" id="'.$subitem['slug'].'">

                                            <div class="innerbox" googl="true">

                                                <h5 class="text-blue my-3">'.urldecode($subitem['titulo']).'</h5>

                                                '.urldecode($subitem['texto']).'

                                                

                                                                    

                                                '.$boton.'

                                            </div>                    

                                        </div>';

                                    }

                                    if($subitem['layout'] == "priv-accordion"){

                                        echo '

                                        

                                        <div class="col-md-12 comunicado-bg" id="'.$subitem['slug'].'">

                                            <div class="innerbox" googl="true">

                                    

                                            <div class="accordion">

                                                <div class="accordion-item">

                                                    <a class="plus"><h5 class="text-blue my-3">'.urldecode($subitem['titulo']).'</h5></a>

                                                    <div class="content">

                                                    '.urldecode($subitem['texto']).'

    

                                                    <br>

                                                    <a target="_blank" class="btn btn-primary btn-xl text-uppercase js-scroll-trigger" href="'.$cloudfront.$subitem['archivo'].'"><i class="descarga-icon fas fa-file-pdf" aria-hidden="true"></i> '.urldecode($subitem['textoDelBoton']).'</a>

                                                    </div>

                                                </div>

                                            </div>

                                        </div>

                                    </div>

                                        

                                        ';

                                    }

                                }









                                

                                

                            }

                            

                        }





                        }

                        ?>



                

               <?php include '../tyc-privado.php';?>





                

                



                    </div>

                </div>

				</div>	  

					

					  

				  

			  </div>	  

			</div>

			

							

        </section>



             <div id="formcarac"></div> 

             

             







<button id="opentyc" style="display:none;" type="button" data-toggle="modal" data-target="#tycadmin" class="btn btn-primary">TyC</button>



<button id="openpass" style="display:none;" type="button" data-toggle="modal" data-target="#resetpassprivado" class="btn btn-primary">Pass</button>





<!-- Modal Login -->

<div class="modal fade" id="resetpassprivado" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">

                <div class="modal-dialog" role="document">

                    <div class="modal-content">

                    <div class="modal-header">

                        <h5 class="modal-title" id="exampleModalLabel">RESET PASSWORD</h5>

                        

                    </div>

                    <div class="modal-body" id="modaltyc">

                    

                    <p style="padding:10px; font-size:10px;">It must contain the following:</p>



                  <form class="formprod" id="formpassprivado" enctype='multipart/form-data' autocomplete="off">

                    <input name="idprodmod" id="idprodmod" type="hidden" value="<?php echo $id; ?>">

                    

                    <div class="formgroup">

                        <input name="passpriv1" type="password" id="passpriv1" placeholder="Al menos 10 caracteres">

                        <span toggle="#passpriv1" class="fa fa-fw fa-eye field-icon toggle-passwordpriv"></span>

                    </div>

                    

                    <div class="formgroup">

                        <input name="passpriv2" type="password" id="passpriv2" placeholder="Confirme la contraseña">

                        <span toggle="#passpriv2" class="fa fa-fw fa-eye field-icon toggle-passwordpriv"></span>

                        <div id="Lengthpriv" class="glyphicon glyphicon-remove">&#8226; At least 10 characters</div>

                        <span class="glyphicon glyphicon-lock form-control-feedback"></span>

                        <div id="UpperCase" class="glyphicon glyphicon-remove">&#8226; At least 1 uppercase</div>

                        <div id="LowerCase" class="glyphicon glyphicon-remove">&#8226; At least 1 lowecase</div>

                        <div id="Numbers" class="glyphicon glyphicon-remove">&#8226; At least 1 number</div>

                        <div id="Symbols" class="glyphicon glyphicon-remove">&#8226; At least 1 special character (*, $, #, & , etc)</div>

                       

                    </div>



                    <a id="botonupdatepasspriv" style="pointer-events:none; opacity:.4;" onclick="updatePassPrivadoClientArea();">Reset password</a>

                    <div id="respuestapasspriv"></div>



                    <div id="respuestapriv"></div>



        </form> 









                    </div>

                    <div class="modal-footer">

                        <button type="button" class="btn btn-secondary" data-dismiss="modal"></button>



                       

                        

                    </div>

                    </div>

                </div>

                </div>



<div id="respuestatyc"></div>



		

    		<?php 

            

            include '../include/footer.php'; ?>

		<script>

            $(document).ready(function() {



                $(".innerbox p").each(function(){

                    if($(this).text().length < 4){

                        $(this).hide();

                    }

                })



                <?php

                    if($modalpass_privado == "RESETPASS"){

                ?>



                //alert("Newpass");

                    

                    $('#resetpassprivado').modal({

                        backdrop: 'static',

                        keyboard: false

                    })



                    $("#openpass").click();

                <?php

                    }

                ?>

                //alert("<?php echo $tyc; ?>");

                <?php



                

                    if($tyc != $versionTyC && $modalpass_privado !="RESETPASS"){

                        

                ?>

                    var newtyc = '<?php echo $tyc;?>';



                    if (newtyc == '<?php echo $versionTyC;?>'){}

                    else{

                        $('#tycadmin').modal({

                            backdrop: 'static',

                            keyboard: false

                        })



                        $("#opentyc").click();

                    }



                    

                <?php

                    }

                ?>





                <?php



                                

                if($avisoTyC != "0" && $modalpass_privado !="RESETPASS" && $tyc != $versionTyC){

                ?>





                $('#tycadmin').modal({

                    backdrop: 'static',

                    keyboard: false

                })



                $("#opentyc").click();

                <?php

                }

                ?>



                 

                

                $("#formcarac").load('https://indeval.trafikatest.com/formulariosic.php?lang=en');

                $('.accordion a').click(function(){

                    $(this).toggleClass('active');

                    $(this).next('.content').slideToggle(400);

                });

                



                <?php

                if(strlen($seccion)>2){

                    echo' 

                    

                    $("html, body").animate({

                            scrollTop: $("#'.$seccion.'").offset().top - 140

                    }, 1000);



                    setTimeout(() => {

                        $("#'.$seccion.' a").click();

                    }, 750);

                    

                    ';

                }

                ?>

            });



            function aceptaTyC(){

                $.ajax({

                    url : "/include/acepta-terminos.php?new=<?php echo $versionTyC;?>&lang=en",

                    type: "GET",

                    data : "id=<?php echo $idgraph;?>",

                    success:function(data){

                        $('#respuestatyc').html(data);

                        

                }

                });

            }





            $(document).on("change", "#leido", function () {

    if($(this).is(':checked')){

     $("#botontyc").removeClass("disabledbtn");

                   }

                else{

                    $("#botontyc").addClass("disabledbtn");  

                }});  





    

/*Bind our event to key up for the field. It doesn't matter if it's delete or not*/

$(document).ready(function() {

      $("#passpriv1").on('keyup', ValidatePasswordPriv)

    });



    $("#formpassprivado .toggle-passwordpriv").click(function() {

        $(this).toggleClass("fa-eye fa-eye-slash");

        var input = $($(this).attr("toggle"));

        if (input.attr("type") == "password") {

            input.attr("type", "text");

        } 

        else {

            input.attr("type", "password");

        }

    });





        /*Actual validation function*/

function ValidatePasswordPriv() {

  /*Array of rules and the information target*/

  var rules = [{

      Pattern: "[A-Z]",

      Target: "UpperCase"

    },

    {

      Pattern: "[a-z]",

      Target: "LowerCase"

    },

    {

      Pattern: "[0-9]",

      Target: "Numbers"

    },

    {

      Pattern: "[!@@#$%^&*]",

      Target: "Symbols"

    }

  ];



  //Just grab the password once

  var password = $(this).val();



  /*Length Check, add and remove class could be chained*/

  /*I've left them seperate here so you can see what is going on */

  /*Note the Ternary operators ? : to select the classes*/

  $("#Lengthpriv").removeClass(password.length > 9 ? "glyphicon-remove" : "glyphicon-ok");

  $("#Lengthpriv").addClass(password.length > 9 ? "glyphicon-ok" : "glyphicon-remove");

  

  /*Iterate our remaining rules. The logic is the same as for Length*/

    for (var i = 0; i < rules.length; i++) {

        $("#" + rules[i].Target).removeClass(new RegExp(rules[i].Pattern).test(password) ? "glyphicon-remove" : "glyphicon-ok"); 

        $("#" + rules[i].Target).addClass(new RegExp(rules[i].Pattern).test(password) ? "glyphicon-ok" : "glyphicon-remove");

        }



        var count = $("#formpassprivado .glyphicon-remove").length;



        if(count > 0){

            $("#botonupdatepasspriv").css("opacity", ".4");

            $("#botonupdatepasspriv").css("pointer-events", "none");

        }

        else{

            $("#botonupdatepasspriv").css("opacity", "1");

            $("#botonupdatepasspriv").css("pointer-events", "inherit");

        }



        

    }





    function updatePassPrivado(){

        $('#respuestapriv').html("");

        $("#respuestapasspriv").html("");

        $("#passpriv1").css("border-color", "#fff");

        $("#botonupdatepasspriv").css("opacity", ".5");

        $("#botonupdatepasspriv").css("pointer-events", "none");

        var code =$("#passpriv1").val();

        var code2 =$("#passpriv2").val();

        var  errores = false;

        if(code.length<10){

            $("#respuestauser").html("<p class='errormsg'>Al menos 10 caracteres");

            $("#user").css("border-color", "#fa5555");

            setTimeout(() => {

                        $("#botonupdatepasspriv").css("opacity", "1");

                        $("#botonupdatepasspriv").css("pointer-events", "inherit");

                    }, 2000);

            errores = true;

        }



        if(code2.length<10 ){

            $("#respuestauser").html("<p class='errormsg'>Al menos 10 caracteres");

            $("#user2").css("border-color", "#fa5555");

            setTimeout(() => {

                        $("#botonupdatepasspriv").css("opacity", "1");

                        $("#botonupdatepasspriv").css("pointer-events", "inherit");

                    }, 2000);

            errores = true;

        }

        

        if(code2 != code  ){

            $("#respuestauser").html("<p class='errormsg'>Las contraseñas no coinciden");

            $("#user2").css("border-color", "#fa5555");

            setTimeout(() => {

                        $("#botonupdatepasspriv").css("opacity", "1");

                        $("#botonupdatepasspriv").css("pointer-events", "inherit");

                    }, 2000);

            errores = true;

        }





        if(errores == false){

            $.ajax({

                url : "/include/updatePassPrivado.php",

                type: "GET",

                data : "pass="+code,

                success:function(data){

                    $('#respuestapriv').html(data);



                    setTimeout(() => {

                        $("#botonupdatepasspriv").css("opacity", "1");

                        $("#botonupdatepasspriv").css("pointer-events", "inherit");

                    }, 2000);

                }

            })

        }

        

    }

		

    function loginSuccess(){

        setTimeout(() => {

            window.location.href = '/area-clientes'; 

        }, 3000);

        

    }



		</script>

    </body>

</html>

