<div class="modal fade" id="nuevo_usuario" 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">Nuevo Usuario</h4>
            </div>

<form id="datos_usuario" name="datos_usuario"  method="post" autocomplete="nope" enctype="multipart/form-data">
    <div class="modal-body">
        <div class="widget-content">
            <div id="resultados_usuario"></div> 
            <div class="tabbable">
                <ul class="nav nav-tabs">
                    <li class="active"><a href="#PERSONAL" data-toggle="tab">INFORMACIÓN PERSONAL</a> </li>
                    <li><a href="#INGRESO" data-toggle="tab">INFORMACIÓN DE INGRESO</a></li>
                  <!--   <li><a href="#PERMISOS" data-toggle="tab">PERMISOS</a></li> -->
                </ul>
                <br>
                <div class="tab-content">
                    <div class="tab-pane active" id="PERSONAL">
                        <div class="form-group ">
                            <label> Identificación</label>
                            <input type="number" class="form-control btn-xs" id="usu_cc" name="usu_cc"  value="" required>
                            <input type="hidden" class="form-control btn-xs" id="usu_estado" name="usu_estado"  value="Activo" >
                        </div>
                        <div class="form-group ">
                            <label> Nombre Completo</label>
                            <input type="text" class="form-control btn-xs" id="usu_nombre" name="usu_nombre" autocomplete="off"  value="" required>
                        </div>
                        <div class="form-group ">
                            <label> Teléfono</label>
                            <input type="number" class="form-control btn-xs" id="usu_tel" name="usu_tel" value="">
                        </div>
                        <div class="form-group ">
                            <label> Dirección</label>
                            <input type="text" class="form-control btn-xs" id="usu_dir" name="usu_dir" value="">
                        </div>
                        <label>&nbsp</label>
                        <label for="imagen" style="width: 100%;">Subir Imagen </label>
                        <input type="file"  name="imagen" id="imagen" >
                    </div>

                    <div class="tab-pane" id="INGRESO">
                        <div class="">
                            <!-- <label>Asceso al sistema</label>
                            <SELECT NAME="clie_credito" id="clie_credito" onChange="xxxOnChange(this)" class="form-control name_list input-sm" >
                                <option value="si">Si</option>
                                <option value="no">No</option>
                            </SELECT>-->

                            <div id="si" style="display: ;">
                                <div class="form-group ">
                                    <label> Cargo</label>
                                    <select name="rol" id="rol" class="form-control btn-xs name_list">
                                        <?php
                                            $datos = mysqli_query($con,"SELECT * FROM rol  WHERE empresa='$empresa'") ;
                                            while( $fila = mysqli_fetch_array( $datos ) )
                                            {
                                            echo' <option value="'.$fila['rol_id'].'">'.$fila['rol_nombre'].'</option>';
                                            }
                                        ?>
                                    </select>
                                </div>
                                <?php if($negocio_neg_id =='7'){ ?>
                                <div class="form-group ">
                                    <label> Tarifa </label>
                                    <select name="tarifa" id="tarifa"  class="form-control  btn-xs name_list" >
                                    <?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="tarifa" name="tarifa" value="1">
                                <?php } ?>
                                <div class="form-group ">
                                    <label>  Usuario</label>
                                    <input type="text" class="form-control btn-xs" id="usu_username" name="usu_username"  value="" required autocomplete="new-password" >
                                </div>
                                <div class="form-group ">
                                    <label>  Email</label>
                                    <input type="email" class="form-control btn-xs" id="usu_correo" name="usu_correo"  value="">
                                </div>
                                <div class="form-group ">
                                    <label>  Contraseña</label>
                                    <input class="strong-password form-control btn-xs" type="password" id="clave" name="clave" value="" autocomplete="new-password" required>
                                </div>
                            </div>


                            <div id="no" style="display:none"> 
                                <div class="form-group ">
                                    <label> Cargo</label>
                                    <select name="rol" id="rol" class="form-control btn-xs name_list">
                                        <?php
                                            $datos = mysqli_query($con,"SELECT * FROM rol  WHERE empresa='$empresa' and rol_id='$rol_ven' ") ;
                                            while( $fila = mysqli_fetch_array( $datos ) )
                                            {
                                            echo' <option value="'.$fila['rol_id'].'">'.$fila['rol_nombre'].'</option>';
                                            }
                                        ?>
                                    </select>
                                </div>
                            </div>
                        </div>

                      
                       
                    </div>
                    <div class="tab-pane" id="PERMISOS">
                        <div class="form-group ">
                            <label>  Sucursal</label>
                            <section id="intro" >
                                <select name="sucursal" id="sucursal" class="form-control btn-xs name_list" >
                                                    <?php
                                                        $datos = mysqli_query($con,"SELECT * FROM sucursal  WHERE empresa='$empresa'  ") ;
                                                        while( $fila = mysqli_fetch_array( $datos ) )
                                                        {
                                                        echo' <option value="'.$fila['suc_id'].'">'.$fila['suc_nombre'].'</option>';
                                                        }
                                                    ?>
                                </select>
                            </section>
                        </div>
                        <div class="form-group ">
                            <label> Bodega</label>
                            <section id="intro" >
                              <select name="bode" id="bode"  class="form-control btn-xs name_list" >
                                    <?php
                                            $datos = mysqli_query($con,"SELECT * FROM bodegas  WHERE empresa='$empresa'  ") ;
                                            while( $fila = mysqli_fetch_array( $datos ) )
                                            {
                                            echo' <option value="'.$fila['bod_id'].'">'.$fila['bod_nombre'].'</option>';
                                            }
                                            ?>
                              </select>
                            </section>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
                        <button id="registrar_usuario" type="submit" class="btn btn-success pull-right">Registrar</button> 
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
        </div>
    </div>
</div>    
<script type="text/javascript">

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



function xxxOnChange(sel) {
      if (sel.value=="si"){
           divC = document.getElementById("si");
           divC.style.display = "";
           divT = document.getElementById("no");
           divT.style.display = "none";
      }else  {
           divC = document.getElementById("si");
           divC.style.display="none";

           divT = document.getElementById("no");
           divT.style.display = "";
      }
}

</script>