<?php

    session_start();

    if(empty($_SESSION['login_appquadrata'])){

        echo"<script language='javascript'>window.location='/appquadrata/login'</script>;";

        exit();

    }

?>

<!DOCTYPE html>

<?php

/*inicializamos valores para la configuracion del template*/

$setting_template='../../../settings_template.txt';

$variables=[];

$_Color='';

$_Template='';

$_Theme_Template='';

$_Css='';

$_Js='';

$_Css_Version='';

$_Js_Version='';

if (file_exists($setting_template)) {

    $lines = file($setting_template, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);

    foreach ($lines as $line) {

        list($nombre_variable, $valor) = explode('=', $line);

        $variables[$nombre_variable] = $valor;

    }

    /*recogemos los valores de las variables*/

    if (isset($variables['Color'])) {

        $_Color = $variables['Color'];



        //echo "El color es: $_Color";

    }

    if (isset($variables['Template'])) {

        $_Template = $variables['Template'];

        //echo "El Template es: $_template";

    }

    if (isset($variables['Theme_Template'])) {

        $_Theme_Template = $variables['Theme_Template'];

        //echo "El Theme_Template es: $_Theme_Template";

    }

    if (isset($variables['css'])) {

        $_Css = $variables['css'];

        //echo "El css es: $_Css";

    }

    if (isset($variables['js'])) {

        $_Js = $variables['js'];

        //echo "El js es: $_Js";

    }

    if (isset($variables['Rows_Columns'])) {

        $_Rows_Columns = $variables['Rows_Columns'];

    }else{

        $_Rows_Columns=4;

    }

    if (isset($variables['css_version'])) {

        $_Css_Version = $variables['css_version'];

        //echo "El css es: $_Css";

    }

    if (isset($variables['js_version'])) {

        $_Js_Version = $variables['js_version'];

        //echo "El js es: $_Js";

    }

}

/*terminan valores de configuracion pára el template*/

?>

<html  style="background-color: rgb(241, 245, 249);" lang="es" class="<?php if($_Color!=''){ echo 'theme-user'; }else{ echo $_Theme_Template; }?>">

<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>

<meta name='description' content='Información sobre contenido de tu pagina'>

<meta name='keywords' content='aqui van los tags para ser encontrados por los boots de google ejemplo fibora,ti hyper solutions'>

<meta charset="UTF-8" />

<HEAD>



<?php

    //Declaramos la variable time, para que al modificar un archivo, este no se guarde en cache y se vizualicen los cambios

    $time_log_assets=time();

    include('../../path.php');

    //require('../modelo/qr_tag.php');

    require(ROOT_CONTROLLER.'qr_tag.php');

    $Obj_qr_tag = new qr_tag(); 

?>



    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"><!--se agrego esta dependencia para los iconos de lado izquierdo en los inputs-->

    <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.js'></script>

    <meta name="viewport" content="width=device-width,initial-scale=1">

    <!-- BEGIN: CSS Assets-->

    <link rel="stylesheet" href="../../../dist/css/<?=$_Css;?>?time=<?=$time_log_assets;?>" />

    <!-- END: CSS Assets-->

    <link rel="stylesheet" href="../../../dist/css/input_file.css?time=<?=$time_log_assets;?>" />

    <script src="../../../dist/js/noback.js?time=<?=$time_log_assets;?>" type="text/javascript"></script>

    <!--Comienza plugins JTABLE--->

    <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

    <!--Termina plugins JTABLE--->

    <!---llamamos la libreria de tinymce--->

    <script defer src="../../../dist/tinymce/tinymce/main.js?time=<?=$time_log_assets;?>"></script>

    <link rel="stylesheet" href="../../../dist/tinymce/tinymce/estilos.css?time=<?=$time_log_assets;?>" />

    <script src="../../../dist/tinymce/tinymce/tinymce.min.js?time=<?=$time_log_assets;?>" referrerpolicy="origin"></script>

    <!---Terminamos de agregar editor tinymce--->



    <!---incluimos dependencias para el select con buscador-->

    <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" crossorigin="anonymous"></script>

    <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />

    <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>

    <link rel="stylesheet" href="../../../dist/css/app_style.css?time=<?=$time_log_assets;?>" />

    <!--termina dependencias para el select con buscador--->

        

<?php



$action=!empty($_REQUEST['action'])?$_REQUEST['action']:'';

$_ScrollTo=!empty($_REQUEST['_ScrollTo'])?$_REQUEST['_ScrollTo']:'';

$_Buscar=!empty($_REQUEST['_Buscar'])?$_REQUEST['_Buscar']:'';

$_Action = $_Buscar!='' ? 'buscar' : '';

$_Pagina=!empty($_REQUEST['pagina'])?$_REQUEST['pagina']:'';

$_Clausula_Fk=!empty($_REQUEST['_Clausula_Fk'])?$_REQUEST['_Clausula_Fk']:'';

$_IdFk=!empty($_REQUEST['_IdFk'])?$_REQUEST['_IdFk']:'';

$Id_Qr_Tag=!empty($_REQUEST['Id_Qr_Tag'])?$_REQUEST['Id_Qr_Tag']:'';

$Id_Fk_Lote='';

$Lote='';

$Qr_Icon_Img='';

$Qr_Img1px='';

$Qr_Img3px='';

$Qr_Img5px='';

$Qr_Img10px='';

$Imagen_Portada='';

$Id_Fk_Objeto='';

$Titulo_Objeto='';

$Tag_Qr_Image='';

$Ficha_Descriptiva='';

$Observaciones='';

$Mostrar_Contacto='';

$Descargar_Contacto='';

$Mostrar_Qr='';

$Titulo_Boton='';

$Icono_Boton='';

$Modulo_Href_Boton='';

$Tema='';

$Pagina_Web='';

$Url_Base='';

$Url_Add='';

$Foto_Perfil_Contacto='';

$Nombre_Contacto='';

$Apellido_Paterno_Contacto='';

$Apellido_Materno_Contacto='';

$Direccion='';

$Telefono_Celular='';

$Correo='';

$Facebook='';

$Linkedin='';

$Instagram='';

$Twitter='';

$Youtube='';

$TikTok='';

$Hash_Tag_Qr='';

$Try_Insert='';

$Token='';

$Url_Calendario='';

$Mostrar_Calendario='';

$Borrado_Logico='';

$Status='';

$Reporte_Perdido='';

$Mensaje_Perdido='';

$Usuario_Registro='';

$Id_Fk_Usuario_Registro='';

$Usuario_Modifico='';

$Id_Fk_Usuario_Modifico='';

$Tag_Is_Empty='';

$Fecha_Registro='';

$Fecha_Modificacion='';



switch ($action) {

    case 'editar':



        echo"<TITLE>Editar qr tag</TITLE>";

        break;



    default:

        echo"<TITLE>Registrar qr tag</TITLE>";

        break;

}



require_once(ROOT_CHARACTER_FIX);

$Obj_fix_characters = new fix_characters();



//lee las variables del formulario.

if (!empty($_POST))

{

    require_once(ROOT_CONFIG);      

    $Odbj_conexion = new odbconexion;

    $conexion=$Odbj_conexion->openconection();

    $consulta="SELECT * FROM qr_tag_appquadrata WHERE Id_Qr_Tag='$Id_Qr_Tag' ORDER BY Id_Qr_Tag DESC";

    $Array_adapter_qr_tag=$conexion->query($consulta);

    $conexion->close();

    while($field_qr_tag=$Array_adapter_qr_tag->fetch_assoc())

    {

    $Id_Fk_Lote=$field_qr_tag['Id_Fk_Lote'];

   $Lote=$field_qr_tag['Lote'];

   $Qr_Icon_Img=$field_qr_tag['Qr_Icon_Img'];

   $Qr_Img1px=$field_qr_tag['Qr_Img1px'];

   $Qr_Img3px=$field_qr_tag['Qr_Img3px'];

   $Qr_Img5px=$field_qr_tag['Qr_Img5px'];

   $Qr_Img10px=$field_qr_tag['Qr_Img10px'];

   $Imagen_Portada=$field_qr_tag['Imagen_Portada'];

   $Id_Fk_Objeto=$field_qr_tag['Id_Fk_Objeto'];

   $Titulo_Objeto=$field_qr_tag['Titulo_Objeto'];

   $Tag_Qr_Image=$field_qr_tag['Tag_Qr_Image'];

   $Ficha_Descriptiva=$field_qr_tag['Ficha_Descriptiva'];

   $Observaciones=$field_qr_tag['Observaciones'];

   $Mostrar_Contacto=$field_qr_tag['Mostrar_Contacto'];

   $Descargar_Contacto=$field_qr_tag['Descargar_Contacto'];

   $Mostrar_Qr=$field_qr_tag['Mostrar_Qr'];

   $Titulo_Boton=$field_qr_tag['Titulo_Boton'];

   $Icono_Boton=$field_qr_tag['Icono_Boton'];

   $Modulo_Href_Boton=$field_qr_tag['Modulo_Href_Boton'];

   $Tema=$field_qr_tag['Tema'];

   $Pagina_Web=$field_qr_tag['Pagina_Web'];

   $Url_Base=$field_qr_tag['Url_Base'];

   $Url_Add=$field_qr_tag['Url_Add'];

   $Foto_Perfil_Contacto=$field_qr_tag['Foto_Perfil_Contacto'];

   $Nombre_Contacto=$field_qr_tag['Nombre_Contacto'];

   $Apellido_Paterno_Contacto=$field_qr_tag['Apellido_Paterno_Contacto'];

   $Apellido_Materno_Contacto=$field_qr_tag['Apellido_Materno_Contacto'];

   $Direccion=$field_qr_tag['Direccion'];

   $Telefono_Celular=$field_qr_tag['Telefono_Celular'];

   $Correo=$field_qr_tag['Correo'];

   $Facebook=$field_qr_tag['Facebook'];

   $Linkedin=$field_qr_tag['Linkedin'];

   $Instagram=$field_qr_tag['Instagram'];

   $Twitter=$field_qr_tag['Twitter'];

   $Youtube=$field_qr_tag['Youtube'];

   $TikTok=$field_qr_tag['TikTok'];

   $Hash_Tag_Qr=$field_qr_tag['Hash_Tag_Qr'];

   $Try_Insert=$field_qr_tag['Try_Insert'];

   $Token=$field_qr_tag['Token'];

   $Url_Calendario=$field_qr_tag['Url_Calendario'];

   $Mostrar_Calendario=$field_qr_tag['Mostrar_Calendario'];

   $Borrado_Logico=$field_qr_tag['Borrado_Logico'];

   $Status=$field_qr_tag['Status'];

   $Reporte_Perdido=$field_qr_tag['Reporte_Perdido'];

   $Mensaje_Perdido=$field_qr_tag['Mensaje_Perdido'];

   $Usuario_Registro=$field_qr_tag['Usuario_Registro'];

   $Id_Fk_Usuario_Registro=$field_qr_tag['Id_Fk_Usuario_Registro'];

   $Usuario_Modifico=$field_qr_tag['Usuario_Modifico'];

   $Id_Fk_Usuario_Modifico=$field_qr_tag['Id_Fk_Usuario_Modifico'];

   $Tag_Is_Empty=$field_qr_tag['Tag_Is_Empty'];

   $Fecha_Registro=$field_qr_tag['Fecha_Registro'];

   $Fecha_Modificacion=$field_qr_tag['Fecha_Modificacion'];

   

    }

}?>    



<?php  

    $row_registers=0;

    $arreglo_registers = array();

    $Odbj_conexion = new odbconexion;

    $conexion=$Odbj_conexion->openconection();

    $consulta="SELECT * FROM qr_tag_appquadrata ORDER BY Id_Qr_Tag ASC";

    $Array_adapter_qr_tag_registers=$conexion->query($consulta);

    $conexion->close();

    $rows_registers=$Array_adapter_qr_tag_registers->num_rows;

    while($field_qr_tag_register=$Array_adapter_qr_tag_registers->fetch_assoc())

    {

        $row_registers++;

        array_push($arreglo_registers, array("id" => $field_qr_tag_register['Id_Qr_Tag'], "numero" => $row_registers));

   

    }

?> 

    <script language='JavaScript'> 

    var statSend = false;

    function checkSubmit() {

        if (!statSend) {

            statSend = true;

            return true;

        } else {

            alert('La Informaci\u00F3n ya se est\u00E1 enviando, por favor espere...');

            return false;

        }

    }

    </script> 

    <style>

         ::-webkit-scrollbar {

            display: none;

        }



    </style>

</head>

<center>

<body onload="noback();">

  <?php

    //Comienza form del formulario

echo "<div class='intro-y box form-box'>";

    

    switch ($action) {

    case 'editar':

        echo "

            <div class='flex items-center p-5 border-b border-slate-200/60 dark:border-darkmode-400'>

                <h2 class='font-medium text-base mr-auto'>

                    EDITAR QR TAG

                </h2>";

            foreach ($arreglo_registers as $elemento) {

                    if ($elemento["id"] === $Id_Qr_Tag) {

                        $numeroEncontrado = $elemento["numero"];

                        break; // Detén el bucle una vez que se encuentre el elemento

                    }

                }

                echo "<p class='mr-3'>".$numeroEncontrado."/".$rows_registers."</p>";



                if($numeroEncontrado>1){

                    $registerPrev=$numeroEncontrado-1;

                    

                    foreach ($arreglo_registers as $elemento) {

                        if ($elemento["numero"] === $registerPrev) {

                            $idEncontradoPrev = $elemento["id"];

                            break; // Detén el bucle una vez que se encuentre el elemento

                        }

                    }

                    echo "<form action='./formulario.php' method='Post' onsubmit='loadingpage();'>

                        <input type='hidden' value='$idEncontradoPrev' name='Id_Qr_Tag'>

                        <input name='action' value='editar' type='hidden'>

                        <button type='submit' class='btn-navigation-registers'><svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' icon-name='chevron-left' data-lucide='chevron-left' class='lucide chevron-left w-6 h-6 mr-1 mt-1'><path d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'></path><circle cx='12' cy='12' r='3'></circle></svg></button>

                    </form>";

                }



                if($numeroEncontrado<$row_registers){

                    $registerNext=$numeroEncontrado+1;

                    

                    foreach ($arreglo_registers as $elemento) {

                        if ($elemento["numero"] === $registerNext) {

                            $idEncontradoNext = $elemento["id"];

                            break; // Detén el bucle una vez que se encuentre el elemento

                        }

                    }

                    echo "<form action='./formulario.php' method='Post' onsubmit='loadingpage();'>

                        <input type='hidden' value='$idEncontradoNext' name='Id_Qr_Tag'>

                        <input name='action' value='editar' type='hidden'>

                        <button type='submit' class='btn-navigation-registers'><svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' icon-name='chevron-right' data-lucide='chevron-right' class='lucide chevron-right w-6 h-6 mr-1 mt-1'><path d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'></path><circle cx='12' cy='12' r='3'></circle></svg></button>

                    </form>";

                }

        echo "</div>";

        break;

    

    default:

        echo"

            <div class='flex items-center p-5 border-b border-slate-200/60 dark:border-darkmode-400'>

                <h2 class='font-medium text-base mr-auto'>

                    REGISTRAR QR TAG

                </h2>

            </div>";

        break;

    }



    switch($_Rows_Columns){

        case 1:

        $cols_columns=12;

        break;

        case 2:

        $cols_columns=6;

        break;

        case 3:

        $cols_columns=4;

        break;

        case 4:

        $cols_columns=3;

        break;

        default:

        $cols_columns=12;

        break;



    }



    echo "<div class='p-5'>

            <form name='registrar'onsubmit='loadingpage();return checkSubmit();' action='../bussines/guardar.php' method='Post' enctype='multipart/form-data'>      

            <div class='grid grid-cols-12 gap-x-5'>

                <div class='col-span-12 xl:col-span-12'>";

                    echo "<input type='hidden' name='_ScrollTo' value='$_ScrollTo'>";

                    echo "<input type='hidden' name='_Pagina' value='$_Pagina'>";

                    echo "<input type='hidden' name='Id_Qr_Tag' value='$Id_Qr_Tag'>";

                    echo "<div class='grid grid-cols-12 gap-x-5'>";

                      echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Imagen Portada: </label>";

                                        if ($Imagen_Portada=='') {

                                            echo"<img id='blahImagen_Portada' src='../../../dist/images/upload.png' style='border-style: inset;width:140px;height:140px;border-radius:150px;padding:7px;' />";

                                        }else{

                                            $time=time();

                                            $time=filectime($Imagen_Portada);

                                            echo"<input type='hidden' name='Imagen_Portada' value='$Imagen_Portada'>";

                                            echo"<img id='blahImagen_Portada' src='$Imagen_Portada?dummy=$time' alt='Empresa' style='border-style: inset;width:140px;height:140px;border-radius:150px;padding:7px;' />";

                                        }

                            /*echo "

                                <br>

                                <input class='btn btn-primary' name='Imagen_Portada_file'  capture='camera'  accept='image/x-png,image/gif,image/jpeg' type='file' onchange=\"document.getElementById('blahImagen_Portada').src = window.URL.createObjectURL(this.files[0]);\" style='max-width:80%;'/>";*/

                             echo "<input type='file' name='Imagen_Portada_file' id='Imagen_Portada_file' class='inputfile inputfile-2' accept='image/x-png,image/gif,image/jpeg' onchange=\"document.getElementById('spanImagen_Portada').innerHTML=this.files[0].name;document.getElementById('blahImagen_Portada').src = window.URL.createObjectURL(this.files[0]);\"  style='max-width:80%;'/>

                                  <label for='Imagen_Portada_file'><svg xmlns='http://www.w3.org/2000/svg' class='iborrainputfile' width='20' height='17' viewBox='0 0 20 17'><path d='M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z'></path></svg><span class='iborrainputfile' id='spanImagen_Portada'>Seleccionar archivo</span>

                                  </label>";

                            echo "</div>";

                            

                               

                            if($_Clausula_Fk=="Titulo_Objeto"){

                                echo "<input type='hidden' name='Titulo_Objeto' value='{$_IdFk}'>";

                            }else{  

                                echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Titulo Objeto: </label>";

                                    echo "<select name='Titulo_Objeto' id='Titulo_Objeto' class='select-search form-control'>";

                                        $Odbj_conexion = new odbconexion;

                                        $conexion=$Odbj_conexion->openconection();

                                        $consulta="SELECT * FROM objeto_tag";

                                        $Adapter_objeto_tag=$conexion->query($consulta);

                                        $conexion->close();

                                        while($Field_objeto_tag=$Adapter_objeto_tag->fetch_assoc())

                                        {

                                            echo "<option value='{$Field_objeto_tag['Id_Objeto']}'>{$Field_objeto_tag['Titulo_Objeto']}</option>";

                                        }

                                    echo "</select>";

                                echo "

                                </div>

                                "; 

                            }

                              echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Ficha Descriptiva: </label>

                                    <textarea id='editor'  style='width:600px;height:400px;' name='Ficha_Descriptiva'>{$Ficha_Descriptiva}</textarea>

                                </div>";

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Mostrar Contacto: </label>

                                    <div style='display: flex;flex-wrap: wrap'>

                                        <div class='form-check form-switch mr-2'>

                                            <input type='checkbox' class='form-check-input' id='Mostrar_Contacto' name='Mostrar_Contacto' value='activa' " . ($Mostrar_Contacto == 'activa' ? 'checked' : '') . ">

                                            <label class='form-check-label' for='Mostrar_Contacto'>Activa</label>

                                        </div>

                                    </div>    

                                </div>

                                ";

                              echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Descargar Contacto: </label>

                                    <div style='display: flex;flex-wrap: wrap'>

                                        <div class='form-check form-switch mr-2'>

                                            <input type='checkbox' class='form-check-input' id='Descargar_Contacto' name='Descargar_Contacto' value='activa' " . ($Descargar_Contacto == 'activa' ? 'checked' : '') . ">

                                            <label class='form-check-label' for='Descargar_Contacto'>Activa</label>

                                        </div>

                                    </div>    

                                </div>

                                ";

                              echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Mostrar Qr: </label>

                                    <div style='display: flex;flex-wrap: wrap'>

                                        <div class='form-check form-switch mr-2'>

                                            <input type='checkbox' class='form-check-input' id='Mostrar_Qr' name='Mostrar_Qr' value='activa' " . ($Mostrar_Qr == 'activa' ? 'checked' : '') . ">

                                            <label class='form-check-label' for='Mostrar_Qr'>Activa</label>

                                        </div>

                                    </div>    

                                </div>

                                ";

                              echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Titulo Boton: </label>

                                   <input id='Titulo_Boton' name='Titulo_Boton' value='$Titulo_Boton' type='text' class='form-control'>

                                </div>";

                                   echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Icono Boton: </label

                                    <select name='Icono_Boton' id='Icono_Boton' class='select-search form-control'>

                                        <option value=''>Seleccionar opcion</option>

                                        <!---Aquí va tu catalogo de opciones a mostrar al usuario--->

                                    </select>

                                </div>

                                ";

                              echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Modulo Href Boton: </label>

                                   <input id='Modulo_Href_Boton' name='Modulo_Href_Boton' value='$Modulo_Href_Boton' type='text' class='form-control'>

                                </div>";

                                   echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Tema: </label

                                    <select name='Tema' id='Tema' class='select-search form-control'>

                                        <option value=''>Seleccionar opcion</option>

                                        <!---Aquí va tu catalogo de opciones a mostrar al usuario--->

                                    </select>

                                </div>

                                ";

                              echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Pagina Web: </label>

                                   <input id='Pagina_Web' name='Pagina_Web' value='$Pagina_Web' type='url' class='form-control'>

                                </div>";

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Url Base: </label>

                                   <input id='Url_Base' name='Url_Base' value='$Url_Base' type='text' class='form-control'>

                                </div>";

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Url Add: </label>

                                   <input id='Url_Add' name='Url_Add' value='$Url_Add' type='text' class='form-control'>

                                </div>";

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Foto Perfil Contacto: </label>";

                                        if ($Foto_Perfil_Contacto=='') {

                                            echo"<img id='blahFoto_Perfil_Contacto' src='../../../dist/images/upload.png' style='border-style: inset;width:140px;height:140px;border-radius:150px;padding:7px;' />";

                                        }else{

                                            $time=time();

                                            $time=filectime($Foto_Perfil_Contacto);

                                            echo"<input type='hidden' name='Foto_Perfil_Contacto' value='$Foto_Perfil_Contacto'>";

                                            echo"<img id='blahFoto_Perfil_Contacto' src='$Foto_Perfil_Contacto?dummy=$time' alt='Empresa' style='border-style: inset;width:140px;height:140px;border-radius:150px;padding:7px;' />";

                                        }

                            /*echo "

                                <br>

                                <input class='btn btn-primary' name='Foto_Perfil_Contacto_file'  capture='camera'  accept='image/x-png,image/gif,image/jpeg' type='file' onchange=\"document.getElementById('blahFoto_Perfil_Contacto').src = window.URL.createObjectURL(this.files[0]);\" style='max-width:80%;'/>";*/

                             echo "<input type='file' name='Foto_Perfil_Contacto_file' id='Foto_Perfil_Contacto_file' class='inputfile inputfile-2' accept='image/x-png,image/gif,image/jpeg' onchange=\"document.getElementById('spanFoto_Perfil_Contacto').innerHTML=this.files[0].name;document.getElementById('blahFoto_Perfil_Contacto').src = window.URL.createObjectURL(this.files[0]);\"  style='max-width:80%;'/>

                                  <label for='Foto_Perfil_Contacto_file'><svg xmlns='http://www.w3.org/2000/svg' class='iborrainputfile' width='20' height='17' viewBox='0 0 20 17'><path d='M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z'></path></svg><span class='iborrainputfile' id='spanFoto_Perfil_Contacto'>Seleccionar archivo</span>

                                  </label>";

                            echo "</div>";

                            

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Nombre Contacto: </label>

                                   <input id='Nombre_Contacto' name='Nombre_Contacto' value='$Nombre_Contacto' type='text' class='form-control'>

                                </div>";

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Apellido Paterno Contacto: </label>

                                   <input id='Apellido_Paterno_Contacto' name='Apellido_Paterno_Contacto' value='$Apellido_Paterno_Contacto' type='text' class='form-control'>

                                </div>";

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Apellido Materno Contacto: </label>

                                   <input id='Apellido_Materno_Contacto' name='Apellido_Materno_Contacto' value='$Apellido_Materno_Contacto' type='text' class='form-control'>

                                </div>";

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Direccion: </label>

                                   <input id='Direccion' name='Direccion' value='$Direccion' type='text' class='form-control'>

                                </div>";

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Telefono Celular: </label>

                                    <input id='Telefono_Celular'  onkeypress='return event.charCode >= 48 && event.charCode <= 57' name='Telefono_Celular' value='$Telefono_Celular' type='tel' class='form-control'>

                                </div>";

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Correo: </label>

                                   <input id='Correo' name='Correo' value='$Correo' type='text' class='form-control'>

                                </div>";

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Facebook: </label>

                                   <input id='Facebook' name='Facebook' value='$Facebook' type='url' class='form-control'>

                                </div>";

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Linkedin: </label>

                                   <input id='Linkedin' name='Linkedin' value='$Linkedin' type='url' class='form-control'>

                                </div>";

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Instagram: </label>

                                   <input id='Instagram' name='Instagram' value='$Instagram' type='url' class='form-control'>

                                </div>";

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Twitter: </label>

                                   <input id='Twitter' name='Twitter' value='$Twitter' type='url' class='form-control'>

                                </div>";

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Youtube: </label>

                                   <input id='Youtube' name='Youtube' value='$Youtube' type='url' class='form-control'>

                                </div>";

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>TikTok: </label>

                                   <input id='TikTok' name='TikTok' value='$TikTok' type='url' class='form-control'>

                                </div>";

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Url Calendario: </label>

                                   <input id='Url_Calendario' name='Url_Calendario' value='$Url_Calendario' type='url' class='form-control'>

                                </div>";

                                 echo " 

                                <div class='mt-3  col-span-12 lg:col-span-$cols_columns xl:col-span-$cols_columns'>

                                    <label for='update-profile-form-7' class='form-label'>Mostrar Calendario: </label>

                                    <div style='display: flex;flex-wrap: wrap'>

                                        <div class='form-check form-switch mr-2'>

                                            <input type='checkbox' class='form-check-input' id='Mostrar_Calendario' name='Mostrar_Calendario' value='activa' " . ($Mostrar_Calendario == 'activa' ? 'checked' : '') . ">

                                            <label class='form-check-label' for='Mostrar_Calendario'>Activa</label>

                                        </div>

                                    </div>    

                                </div>

                                ";

                                                

echo "          

                   </div><!---Este div cierra el grid para los campos del formulario -->     

                </div>

            </div>";

         switch ($action) {

            case 'editar':

            if($_Clausula_Fk!='' && $_IdFk!=''){

          echo "<div class='flex justify-end mt-4'>

                    <input type='hidden' name='action' value='editar'>

                    <a href='./?_Clausula_Fk=$_Clausula_Fk&_IdFk=$_IdFk&pagina=$_Pagina&buscar=$_Buscar&action=$_Action&_Id_Registro=$Id_Qr_Tag&_ScrollTo=$_ScrollTo' class='btn btn-danger flex items-center w-20 mr-auto'> Cancelar</a>

                    <button type='submit' class='btn btn-primary'>Guardar</button>

                </div>";

            }else{

          echo "<div class='flex justify-end mt-4'>

                    <input type='hidden' name='action' value='editar'>

                    <a href='./?pagina=$_Pagina&buscar=$_Buscar&action=$_Action&_Id_Registro=$Id_Qr_Tag&_ScrollTo=$_ScrollTo' class='btn btn-danger flex items-center w-20 mr-auto'> Cancelar</a>

                    <button type='submit' class='btn btn-primary'>Guardar</button>

                </div>";

            }

            break;

            case 'duplicar':

            if($_Clausula_Fk!='' && $_IdFk!=''){

        echo   "<div class='flex justify-end mt-4'>

                    <input type='hidden' name='action' value='duplicar'>

                    <a href='./?_Clausula_Fk=$_Clausula_Fk&_IdFk=$_IdFk&pagina=$_Pagina&buscar=$_Buscar&action=$_Action&_Id_Registro=$Id_Qr_Tag&_ScrollTo=$_ScrollTo' class='btn btn-danger flex items-center w-20 mr-auto'> Cancelar</a>

                    <button type='submit' class='btn btn-primary'>Guardar</button>

                </div>";

            }else{

        echo   "<div class='flex justify-end mt-4'>

                    <input type='hidden' name='action' value='duplicar'>

                    <a href='./?pagina=$_Pagina&buscar=$_Buscar&action=$_Action&_Id_Registro=$Id_Qr_Tag&_ScrollTo=$_ScrollTo' class='btn btn-danger flex items-center w-20 mr-auto'> Cancelar</a>

                    <button type='submit' class='btn btn-primary'>Guardar</button>

                </div>";

            }

            break;

            default:

            if($_Clausula_Fk!='' && $_IdFk!=''){

        echo   "<div class='flex justify-end mt-4'>

                    <input type='hidden' name='action' value='registrar'>

                    <a href='./?_Clausula_Fk=$_Clausula_Fk&_IdFk=$_IdFk&pagina=$_Pagina&buscar=$_Buscar&action=$_Action&_Id_Registro=$Id_Qr_Tag&_ScrollTo=$_ScrollTo' class='btn btn-danger flex items-center w-20 mr-auto'> Cancelar</a>

                    <button type='submit' class='btn btn-primary'>Guardar</button>

                </div>";

            }else{

        echo   "<div class='flex justify-end mt-4'>

                    <input type='hidden' name='action' value='registrar'>

                    <a href='./?pagina=$_Pagina&buscar=$_Buscar&action=$_Action&_Id_Registro=$Id_Qr_Tag&_ScrollTo=$_ScrollTo' class='btn btn-danger flex items-center w-20 mr-auto'> Cancelar</a>

                    <button type='submit' class='btn btn-primary'>Guardar</button>

                </div>";

            }

            break;

        }                

echo "

        <input type='hidden' name='_IdFk' value='$_IdFk'>

        <input type='hidden' name='_Clausula_Fk' value='$_Clausula_Fk'>

";

echo "  </form>

        </div>

    </div>";





    //Termina form del formulario

?>



    </BODY>

    <script src="../../../dist/js/form_keypad.js?time=<?=$time_log_assets;?>"></script> 

<script src="https://mozilla.github.io/pdf.js/build/pdf.js"></script>

<script type="text/javascript">

    // Loaded via <script> tag, create shortcut to access PDF.js exports.

    var pdfjsLib = window['pdfjs-dist/build/pdf'];

    // The workerSrc property shall be specified.

    pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://mozilla.github.io/pdf.js/build/pdf.worker.js';

</script>

       

<script type="text/javascript">

    window.onload=function(){

        window.scrollTo(0,0);

        window.parent.scrollTo(0,0);

        if(parent.document.getElementById('loadingpage')){

            parent.document.getElementById('loadingpage').style.display='none';

        }

    }



    function loadingpage(){

        if(parent.document.getElementById('loadingpage')){

          parent.document.getElementById('loadingpage').style.display='block'; 

        }

    }

</script>

<script>

    //document.getElementsByClassName('').select2();

    $('.select-search').select2();

</script>   



    <script src="../../../dist/js/app.js"></script> 

    </center>

</HTML>