<div class="modal fade" id="modificar_user" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog " role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">Modificar Usuario</h4>
            </div>

<form  method="post" id="modificar_usuario" name="modificar_usuario" enctype="multipart/form-data">
   <div class="modal-body">
        <div class="widget-content">
            <div id="resultados_user"></div>  
            <div class="tabbable">
                <ul class="nav nav-tabs">
                    <li class="active"><a href="#MPERSONAL" data-toggle="tab">INFORMACIÓN PERSONAL</a> </li>
                    <li><a href="#MINGRESO" data-toggle="tab">INFORMACIÓN DE INGRESO</a></li>
                <!--    <li><a href="#MPERMISOS" data-toggle="tab">PERMISOS</a></li> -->
                </ul>
                <br>
                <div class="tab-content">
                    <div class="tab-pane active" id="MPERSONAL">
                        <div class="form-group ">
                            <label>  Identificación</label>
                            <input type="text" class="form-control" id="cc" name="cc"   required>
                        </div>
                        <div class="form-group ">
                            <label>  Nombre Completo</label>
                            <input type="hidden" class="form-control" id="id" name="id"  required>
                            <input type="text" class="form-control" id="nombre" name="nombre"  required>
                        </div>
                        <div class="form-group ">
                            <label>  Teléfono</label>
                             <input type="text" class="form-control" id="tel" name="tel" >
                        </div>
                        <div class="form-group ">
                            <label>  Dirección</label>
                            <input type="text" class="form-control" id="dir" name="dir"  >
                        </div>
                        <label>&nbsp</label>
                        <label for="imagen2" style="width: 100%;">Cambiar Imagen </label>
                        <input type="file"  name="imagen2" id="imagen2" >
                    </div>

                    <div class="tab-pane" id="MINGRESO">
                        <div class="form-group ">
                            <label>  Sucursal</label>
                                <select class="form-control" id="suc_id" name="suc_id" required>
                               <option value="">-- Selecciona Sucursal --</option>
                                <?php
                                    $datos = mysqli_query($con,"SELECT * FROM sucursal  WHERE empresa='$empresa'  ") ;
                                    while( $rol = mysqli_fetch_array( $datos ) )
                                        {
                                            echo' <option value="'.$rol['suc_id'].'">'.$rol['suc_nombre'].'</option>';
                                        }
                                ?>
                            </select> 
                        </div>
                        <div class="form-group ">
                            <label> Cargo</label>
                                <select class="form-control" id="rol_id" name="rol_id" required>
                                    <option value="">-- Selecciona Cargo --</option>
                                    <?php
                                      $datos = mysqli_query($con,"SELECT * FROM rol  WHERE empresa='$empresa'  ") ;
                                        while( $rol = mysqli_fetch_array( $datos ) )
                                            {
                                                echo' <option value="'.$rol['rol_id'].'">'.$rol['rol_nombre'].'</option>';
                                            }
                                    ?>
                                </select>   
                        </div>

                        <?php if($negocio_neg_id =='7'){ ?>
                        <div class="form-group ">
                        <label> Tarifa </label>
                            <select name="tarifam" id="tarifam"  class="form-control  btn-xs name_list" >
                                 <option value="">-- Selecciona Tarifa --</option>
                                <?php
                                        $datos = mysqli_query($con,"SELECT * FROM tarifas  WHERE empresa='$empresa' ") ;
                                        while( $fila = mysqli_fetch_array( $datos ) )
                                        {
                                        echo' <option value="'.$fila['tar_id'].'">'.$fila['tar_nombre'].'</option>';
                                        }
                                        ?>
                            </select>
                      </div>
                        <?php } else { ?>
                              <input type="hidden" class="form-control btn-xs" id="tarifam" name="tarifam" value="">
                        <?php } ?>



                    


                        <div class="form-group ">
                            <label>  Usuario</label>
                            <input type="text" class="form-control" id="username" name="username"  required autocomplete="new-password">
                        </div>
                        <div class="form-group ">
                            <label>  Email</label>
                            <input type="email" class="form-control" id="correo" name="correo"   >
                        </div>
                    </div>
                    <div class="tab-pane" id="MPERMISOS">
                        
                        <div class="form-group ">
                            <label> Bodega</label>
                            <section id="intro" >
                                <select class="form-control" id="bod_id" name="bod_id" required>
                              <option value="<?php echo $bod_id; ?>"><?php echo $bod_id; ?></option>
                                <?php
                                  $datos = mysqli_query($con,"SELECT * FROM bodegas  WHERE empresa='$empresa'  ") ;
                                    while( $rol = mysqli_fetch_array( $datos ) )
                                      {
                                        echo' <option value="'.$rol['bod_id'].'">'.$rol['bod_nombre'].'</option>';
                                      }
                                ?>
                                </select> 
                            </section>
                        </div>
                        <div class="form-group ">
                            <label for="nombres" class="col-sm-4 control-label">Estado</label>
                            <select class="form-control" id="estado" name="estado" required>
                                <option value="">-- Selecciona estado --</option>
                                <option value="Activo" selected>Activo</option>
                                <option value="Desactivo">Inactivo</option>
                            </select>
                            </br>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
                         <button type="submit" id="modificar" class="btn btn-primary">Modificar</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
        </div>
    </div>
</div>
<script type="text/javascript">

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


</script>