@extends('adminlte::page')

@section('title', 'Usuario')


@section('content')
    <!--<section class="content">
                                                                                                                                        <div class="container-fluid">-->
    <div style="display:none;" id="loader"></div>
    <div id="DivPrincipal">
        <form id="usuario_form" method="post" enctype="multipart/form-data">
            @csrf
            <div class="container-fluid p-2">
                <div class="row">
                    <!-- left column -->
                    <div class="col-md-6">
                        <h3><i class="fa fa-th" aria-hidden="true"></i> Registro de Usuarios</h3>
                    </div>
                    <div class="col-md-6">
                        <br><br>
                        <div class="float-right">
                            <button type="button" class="btn btn-primary" id="busquedaVeh" data-toggle="modal"
                                onclick="CargarBusqueda()"> <i class="fas fa-search"></i>
                                Buscar
                            </button>
                            <button type="submit" class="btn btn-info toastrDefaultSuccess"> <i class="fas fa-save">
                                    Grabar</i></button>
                            <button type="button" class="btn btn-danger" onclick="Limpiar()"> <i class="fas fa-trash">
                                    Limpiar</i></button>
                        </div>

                    </div>
                </div>
            </div>
            <div class="row justify-content-center">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="card card-success" id="my-card">
                        <div class="card-header">
                            <h3 class="card-title">Datos Usuario</h3>
                        </div>
                        <div class="card-body">
                            <div class="row">
                                <input type="number" name='id_usuario' id="id_usuario" value="0" hidden readonly >
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label>Nombres Completo</label>
                                        <input type="text" class="form-control" placeholder="Ingrese Nombres" required
                                            name='nombre' id="nombre" onkeypress="return check(event)">
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <div class="form-group" id="grupo__usuario">
                                        <label>No.Identificación</label>
                                        <input type="number" class="form-control" name='identificacion' id="identificacion"
                                            placeholder="Identificación" required>
                                        <p class="formulario__input-error">No.identifiacion invalido.</p>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label>Correo Electronico</label>
                                        <input type="email" class="form-control" placeholder="Ingrese Correo Electronico"
                                            name='correo' id="correo" required>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label>Clave</label>
                                        <input type="password" class="form-control" placeholder="Ingrese CLave"
                                            name='clave' id="clave" required>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label>Rol: </label>
                                        <select class="form-control select2bs4"id="idrol" name="idrol">
                                            @foreach ($roles as $datos)
                                                <option value="{{ $datos->id }}">{{ $datos->name }}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>

        <!-- modal buscar Usuario-->
        <div class="modal fade" id="modal-buscar-usuarios">
            <div class="modal-dialog modal-xl">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title"> <i class="fas fa-search"> </i> Búsqueda de Usuarios</h4>
                        <button id="CloseModal" type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <!--<p>One fine body&hellip;</p>-->
                        <div class="row">
                            <div class="col-12">

                                <!-- /.card -->
                                <div class="card">
                                    <div class="card-header">
                                        <h3 class="card-title"></h3>
                                    </div>
                                    <!-- /.card-header -->
                                    <div class="card-body">
                                        <table id="tblBuscarUsuarios" class="table table-bordered table-striped">
                                            <thead>
                                                <tr>
                                                    <th>Codigo</th>
                                                    <th>Usuario</th>
                                                    <th>Correo</th>
                                                    <th>Cedula</th>
                                                    <th style="display: none;">role_id</th>
                                                </tr>
                                            </thead>
                                            <tfoot>

                                            </tfoot>
                                        </table>
                                    </div>
                                    <!-- /.card-body -->
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer justify-content-between">
                        <!--<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                                                                                                                                                                                                                                            <button type="button" class="btn btn-primary">Save changes</button>-->
                    </div>
                </div>
            </div>
        </div>
    </div>


@stop


@section('css')
    <link rel="stylesheet" href="{{ asset('css\mantenimiento\socio\estilos_socio.css') }}">
@stop


@section('js')
    <script src="../../js/mantenimientos/socio/create_usuario.js"></script>
    <script>
 function check(e) {
    tecla = (document.all) ? e.keyCode : e.which;

    //Tecla de retroceso para borrar, siempre la permite
    if (tecla == 8) {
        return true;
    }

    // Patr��n de entrada, en este caso solo acepta letras
    patron = /[A-Za-z�0�5�0�9 ]/;
    //patron = /[A-Za-z0-9]/;para letras y numeros
    tecla_final = String.fromCharCode(tecla);
    return patron.test(tecla_final);
}
     
        
    </script>
@stop
