<?php
session_start();
require_once('conexion.php');
require_once('include/sesiones.php');
if (isset($_SESSION['usu_nombre']))
{
    $regis=mysqli_query($con,"SELECT * from permiso where modulo_mod_id='3' and usuario_usu_id='$usu_id'") or die(mysqli_error($con));
    $reg=mysqli_fetch_array($regis);
      if($reg['per_visualizar']=="Activo")
      {
?>
<!DOCTYPE html>
<html lang="en">
<head>
	   <?php include ('head.php'); ?>
<script>
function loadTabla(){
    $('#editModal').modal('hide');
    $.get("./php_configuraciones/tabla_roles.php","",function(data){
    $("#roles").html(data);
    })
}
loadTabla();

function loadiva(){
    $('#editModal').modal('hide');
    $.get("./php_configuraciones/tabla_iva.php","",function(data){
    $("#tabla_iva").html(data);
    })
}
loadiva();

function loadslider(){
    $('#editModal').modal('hide');
    $.get("./php_pagina_online/tabla_slider.php","",function(data){
    $("#tabla_slider").html(data);
    })
}
loadslider();

function loadretencion()
{
    $.get("./php_configuraciones/tabla_retencion.php","",function(data){
    $("#resul_rete").html(data);
    })
}
loadretencion();

function miFuncion() 
{
    loadTabla();
    loadiva();
    loadretencion();
    loadslider();
}
</script>
</head>
<body onload="miFuncion();">
<?php
  $inicio="";
  $M_inventario="";
  $M_contactos="";
  $M_compras="";
  $M_ventas="";
  $M_pedidos="";
  $M_pos="";
  $R_reportes="";

  $m_empresa="";
  $m_sucursales="";
  $m_mesas="";
  $m_configuraciones="";
  $m_online="active";

  include ('menu.php');
?>  
    
<div class="main">
    <div class="col-md-2">
		<?php include ('include/menu_inicio.php'); ?> 
	</div> <!-- /span6 -->
    <div class="col-md-10">	
        <div class="widget stacked ">

        <?php
            if (  $tienda_online=='si' ) { ?>
          

            <div class="widget stacked ">
                <div class="widget-content">
                    <div class="row-fluid user-row">
                        <div class="col-md-1">
                            <i class="fas fa-file-image fa-4x " ></i>
                        </div>
                        <div class="col-md-10">
                            <div id="resultados"></div>
                            </br>
                            <h4><strong>IMAGENES</strong></h4>
                            <span class="text-muted"></span>
                        </div>
                        <div class="col-md-1 dropdown-user" data-for=".online">
                            <i class="icon-chevron-down text-muted"></i>
                        </div>
                    </div>
                    <div class="row-fluid user-infos online">
                        <div class="span10 offset1">
                            <div id="resultados_iva"></div>
                            <div class="col-md-12">
                              <!--  <div class="col-md-3"> 
                                    <form  method="post" name="form_online" id="form_online" enctype="multipart/form-data">
                                         <label for="username" class="col-md-12">NUEVA IMAGEN</label><P></P>
                                                           
                                            <div class="form-group">
                                                <label class="col-md-12">Nombre </label>
                                               <div class="col-md-12">
                                                    <input type="text" class="form-control col-md-12" name="sli_nombre" id="sli_nombre" value="" placeholder="Nombre">   
                                                </div> 
                                            </div> 

                                             <div class="form-group">
                                                <label class="col-md-12">URL</label>
                                                <div class="col-md-12">
                                                    <input type="text" class="form-control col-md-12" name="sli_url" value="" placeholder="URL">   
                                                </div> 
                                            </div> 

                                             <div class="form-group">
                                                <label class="col-md-12">Ubicación</label>
                                                <div class="col-md-12">
                                                    <select class="form-control" name="sli_ubicacion">
                                                        <option>----</option>
                                                        <option value="slider">SLIDER</option>
                                                        <option value="imagen izquierda">IMAGEN IZQUIERDA</option>
                                                        <option value="imagen derecha">IMAGEN DERECHA</option>
                                                        <option value="pie pagina">IMAGEN PIE PAGINA</option>
                       
                                                    </select>

                                                </div> 
                                            </div> 
                                        </br>

                                             <div class="form-group">
                                               <div class="col-md-12">
                                                <center> <label  class="col-md-12"  for="imagen" >Selecionar Imagen</label>
                                                <input type="file" name="imagen" id="imagen" ></center>
                                              </div> 
                                            </div>
                                           
                                        <br>
                                        <div class="form-group pull-right">
                                            <div class=" col-md-8">
                                                <button id="submit" type="submit" class="btn btn-success">Registrar </button> 
                                            </div>
                                        </div>
                                    </form>  -->
                                </div><!-- /span6 -->
                                <div class="col-md-11" style="padding-left:20px;"> 
                                    <center><span id=""></span></center>
                                    <div id="tabla_slider"></div>
                                </div>  
                            </div>                
                        </div>
                    </div>
                </div>
            </div>
            <?php
            }
            
            if ( $negocio_neg_id=='5') { ?>
          
            <div class="widget stacked ">
                <div class="widget-content">
                    <div class="row-fluid user-row">
                        <div class="col-md-1">
                            <i class="fas fa-clock fa-4x " ></i>
                        </div>

                        <div class="col-md-10">
                            <div id="resultados"></div>
                            </br>
                            <h4><strong>TURNOS</strong></h4>
                            <span class="text-muted"></span>
                        </div>

                        <div class="col-md-1 dropdown-user" data-for=".horario">
                            <i class="icon-chevron-down text-muted"></i>
                        </div>
                    </div>

                    <div class="row-fluid user-infos horario">
                        <div class="span10 offset1">
                            <div class="col-md-12">
                                <div class="col-md-3"> 
                                    <div id="resultados_usu"></div>
                                    <form  method="post" name="form_res_usu" id="form_res_usu">
                                         <P></P>
                                        <div>
                                            <section>
                                                <label>Dias</label>
                                                <select name="usu" id="usu" class="form-control input-sm">
                                                    <option value="">-</option>
                                                    <?php
                                                    $datos = mysqli_query($con,"SELECT * FROM usuario WHERE empresa_emp_id ='$empresa' AND sucursal ='$sucursal' ") ;
                                                    while( $fila = mysqli_fetch_array( $datos ) )
                                                    {
                                                    echo' <option value="'.$fila['usu_id'].'">'.$fila['usu_nombre'].'</option>';
                                                    } ?>
                                                </select>
                                            </section>
                                        </div>
                                    </br>
                                        <div class="form-group pull-right">
                                            <div class=" col-md-8">
                                                <button id="regi_usu" type="submit" class="btn btn-success">Registrar </button> 
                                            </div>
                                        </div> <!-- /form-actions -->
                                    </form>  

                                </div><!-- /span6 -->
                                <div class="col-md-9" style="padding-left:20px;"> 
                                    <div class="col-md-4">
                                </br>
                                <div class="btn-group btn-group-justified" align="right">
                                    <a class="btn btn-hora btn-warning" data-toggle="modal" >
                                        <i class="btn-icon-only icon-plus"></i>Agregar Horarios
                                    </a>
                                </div></br>
                                </div>
                                    
                                    <div id="tabla_usu"></div>
                                </div>  
                            </div>                
                        </div>
                    </div>
                </div>
            </div>
        <?php } 

            if (   $tienda_online=='si' ) { ?>
            <div class="widget stacked ">
                <div class="widget-content">
                    <div class="row-fluid user-row">
                        <div class="col-md-1">
                            <i class="fas fa-cogs fa-4x " ></i>
                        </div>
                        <div class="col-md-10">
                            <br>
                            <h4> <strong>CONFIGURACIONES</strong></h4>
                            <span class="text-muted"></span>
                        </div>
                        <div class="col-md-1 dropdown-user" data-for=".roles">
                            <i class="icon-chevron-down text-muted"></i>
                        </div>
                    </div>
                    <div class="row-fluid user-infos roles">

                        <form method="post" name="form_favicon" id="form_favicon" action="" enctype="multipart/form-data">
                            <div class="col-md- offset1">

                                <div class="col-md-12"> 

                                        <div class="form-group"> 

                                            <div class="col-md-11">
                                                 <div id="resultados_favi"></div>
                                                <label>Selecione color para su pagina web</label> 
                                                <input type="color" class="form-control" name="conf_color" id="conf_color" value="<?php  echo $conf_color; ?>">
                                            </div>
                                        </div> <!-- /control-group -->
                                </div><!-- /span6 -->
                                <div class="col-md-12"> 
                                    <div class="form-group">                      
                                        <div class="col-md-11">
                                            <label>Configure las redes sociales</label> 
                                        </div>
                                        <?php 
                                        $datos = mysqli_query($con,"SELECT * FROM sucursal WHERE empresa ='$empresa' ") ;
                                            $fila = mysqli_fetch_array( $datos );
                                                     ?>
                                        <div class="col-md-2">
                                        <label>Facebook</label> 
                                        <input type="text" class="form-control" name="facebook" id="facebook" value="<?php echo  $fila['facebook'] ?>">
                                        </div>
                                        <div class="col-md-2">
                                        <label>Instagram</label> 
                                        <input type="text" class="form-control" name="instagram" id="instagram" value="<?php echo  $fila['instagram'] ?>">
                                        </div>
                                        <div class="col-md-2">
                                        <label>Tiktok</label> 
                                        <input type="text" class="form-control" name="tiktok" id="tiktok" value="<?php echo  $fila['tiktok'] ?>">
                                        </div>
                                        <div class="col-md-2">
                                        <label>X</label> 
                                        <input type="text" class="form-control" name="x" id="x" value="<?php echo  $fila['x'] ?>">
                                        </div>
                                        <div class="col-md-2">
                                        <label>Youtube</label> 
                                        <input type="text" class="form-control" name="youtube" id="youtube" value="<?php echo  $fila['youtube'] ?>">
                                        </div>
                                    </div> <!-- /control-group -->
                                </div><!-- /span6 -->
                                <div class="col-md-11">
                                    <label>URL google maps ubicación</label>
                                <?php $datosre = mysqli_query($con,"SELECT * FROM configuraciones WHERE empresa ='$empresa' ") ;
                                        $filare = mysqli_fetch_array( $datosre ); ?>
                                    <input type="text" name="ubicacion" id="ubicacion" value="<?php echo $filare['ubicacion_pagina'] ?>" class="form-control">
                                </div>
                                <div class="col-md-11">
                                    <label>Mensaje Whatsapp</label>
                                <?php $datosre = mysqli_query($con,"SELECT * FROM configuraciones WHERE empresa ='$empresa' ") ;
                                        $filare = mysqli_fetch_array( $datosre ); ?>
                                    <textarea id="mensaje_wp" name="mensaje_wp" rows="2" cols="160" class="form-control"><?php echo $filare['mensaje_wp']; ?></textarea>

                                </div>
                                <div class="col-md-11"> 
                                    <label>Selecione su imagen formato .ico</label> 
                                    <?php $nu=rand(1,1000); $nu; ?>
                                    <div class="contenedor_favi">
                                        <img class="favico" src="img/logos_vicpos/favicon <?php '.ico?'.$nu.'';?>" alt=""/>
                                    </div>
                                    <br>
                                    <div class="col-md-11">
                                        <div class="form-group">                      
                                            <label>&nbsp</label>
                                            <label for="imagen_ico" style="width: 30%;">Selecione Imagen </label>
                                            <input type="file" name="imagen_ico" id="imagen_ico" >
                                        </div>
                                    </div> <!-- /control-group -->
                                </div><!-- /span6 -->
                            </div>
                            <div class=" col-md-11">
                                <div class="form-group pull-right">
                                    <button id="registrar_favi" type="submit" class="btn btn-success">Registrar </button> 
                                </div>
                            </div> <!-- /form-actions -->
                        </form>  
                    </div>
                </div>
            </div>
         <?php   }  
          include ('include/pie_de_pagina.php'); ?>   
    </div> <!-- /container --></br></br></br>
</div> <!-- /main -->


<?php
	include ('php_caja/caja_abrir.php');
	include ('script.php');
?>


<script>
    $(".btn-hora").click(function(){
       // id = $(this).data("id");
        $.get("./php_pagina_online/form_horas.php",function(data){
            $("#form-dias").html(data);
        });
        $('#turno_dias').modal('show');
    });
</script>
<div class="modal fade" id="turno_dias" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">CREAR HORARIOS</h4>
            </div>
            <div class="modal-body">
                <div id="form-dias"></div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->


<div class="modal fade" id="Modaldetallehoras" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-xs">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">DETALLE HORAS</h4>
            </div>
            <div class="modal-body">
                <div id="form-detalle_horas"></div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<style type="text/css">
label.color {
height: auto;
width: 100%;
background-color: #<?php echo $conf_color ?>;
}

 input[type="file"]#imagen_ico {
 width: 0.1px;
 height: 0.1px;
 opacity: 0;
 overflow: hidden;
 position: absolute;
 z-index: -1;
 }

 label[for="imagen_ico"] {
 font-size: 14px;
 font-weight: 600px;
 color: #fff;
 background-color: #106BA0;
 display: inline-block;
 cursor: pointer;
 padding: 5px 40px ;
 width: fit-content;
 text-align: center;
 }


.contenedor_favi {
    background-color: #f3f3f3;
    width: 28%;
    height: 15%;
    display: flex;
    justify-content: center;
    align-items: center;
}
/*Aplicamos la propiedad object-fit cover, ajustar su tamaño y no perder la proporcion de nuestra imagen*/
.favico{
    object-fit: scale-down;
    width:50%;
    height:50%;
}

</style> 

<script type="text/javascript">



$( "#form_favicon" ).submit(function( event ) 
{ 
    $('#registrar_favi').attr("disabled", true);
    var formData = new FormData($("#form_favicon")[0]);
    var ruta = "php_pagina_online/registrar_confi.php";
    $.ajax({
        type: "POST",
        url: ruta,
        data: formData,
        contentType: false,
        processData: false, 
        beforeSend: function(objeto){
            $('#resultados_favi').html('<center><img src="./img/ajax-loader.gif"> CARGANDO...</center>');
        },
        success: function(datos){
        $("#resultados_favi").html(datos);
        $('#registrar_favi').attr("disabled", false);
        load();
    }
});
event.preventDefault();
})

$( "#form_res_usu" ).submit(function( event ) { 
    $('#regi_usu').attr("disabled", true);
    var parametros = $(this).serialize(); 
    $.ajax({
        type: "POST",
        url: "php_pagina_online/registrar_usuario.php",
        data: parametros,
        beforeSend: function(objeto){
        $('#resultados_usu').html('<center><img src="./img/ajax-loader.gif"> CARGANDO...</center>');
            },
            success: function(datos)
            {
                $("#resultados_usu").html(datos);
                $('#regi_usu').attr("disabled", false);
                loadTablausu();
                document.getElementById("form_res_usu").reset();
              }
      });
  event.preventDefault();
})

function loadTablausu(){
    $('#editModal').modal('hide');
    $.get("./php_pagina_online/tabla_usuarios.php","",function(data){
    $("#tabla_usu").html(data);
    })
}
loadTablausu();

function loadTablaslider(){
    $('#editModal').modal('hide');
    $.get("./php_pagina_online/tabla_slider.php","",function(data){
    $("#tabla_slider").html(data);
    })
}
loadTablaslider();




</script>


<script src="php_configuraciones\ajax.js"></script>
<script src="php_pagina_online\ajax.js"></script>


<style type="text/css">


.user-row {
    margin-bottom: 0px;
}

.user-row:last-child {
    margin-bottom: 0;
}

.dropdown-user {
    margin: 13px 0;
    padding: 5px;
    height: 100%;
}

.dropdown-user:hover {
    cursor: pointer;
}


</style>
<script type="text/javascript">
    $(document).ready(function() {
    var panels = $('.user-infos');
    var panelsButton = $('.dropdown-user');
    panels.hide();
    //Click dropdown
    panelsButton.click(function() {
        //get data-for attribute
        var dataFor = $(this).attr('data-for');
        var idFor = $(dataFor);

        //current button
        var currentButton = $(this);
        idFor.slideToggle(400, function() {
            //Completed slidetoggle
            if(idFor.is(':visible'))
            {
                currentButton.html('<i class="icon-chevron-up text-muted"></i>');
            }
            else
            {
                currentButton.html('<i class="icon-chevron-down text-muted"></i>');
            }
        })
    });
    $('[data-toggle="tooltip"]').tooltip();
});
</script>

  </body>
</html>
<?php
}
else
{
   echo '<script>alert("No tienes permiso para ver esta pagina")</script>';
   echo '<script> setTimeout("history.back(1)", 0); </script>';
}
}
else
{
    echo '<script>location.href = "index.php";</script>';
}
?>