@extends('layouts.layout')
@section('content')
<div class="row">
<section class="content">
<div class="col-md-12 col-md-offset-0">
@if(Session::has('success'))
<div class="alert alert-info">
{{Session::get('success')}}
</div>
@endif
<div class="panel panel-default">
<div class="panel-body">
<div class="pull-left"><h3>Usuarios votantes</h3></div>
<div class="pull-right">
<div class="btn-group">
<div class="col-md-2">
<form action="{{route('usuario.fecha')}}" method="get">
<label for="from">From</label>
<input type="text" id="from" name="from">
<label for="to">to</label>
<input type="text" id="to" name="to">
<button class="btn btn-danger btn-xs" type="submit">enviar</button>
</form>
</div>
</div>
<div class="btn-group">
<div class="col-md-10">
<form action="{{route('usuario.selector')}}" method="get">
{{csrf_field()}}
<select name="tipo" id="tipo" class=" form-control" value="{{ old('tipo') }}" required>
@foreach($usuariosOpciones as $user_id => $usuario_ad)
<option value="{{ $user_id }}">{{ $usuario_ad }}</option>
@endforeach
</select>
<button class="btn btn-danger btn-xs" type="submit">enviar</button>
</form>
</div>
</div>
<div class="btn-group">
<div class="col-md-10">
<form action="{{route('usuario.cedula')}}" method="get">
{{csrf_field()}}
<input type="number" name="cc" id="cc" min="1111111" max="9999999999" class="form-control input-sm" value="{{ old('cedula') }}" placeholder="cedula">
<button class="btn btn-danger btn-xs" type="submit">enviar</button>
</form>
</div>
</div>
</div>
</div>
<div class="table-container">
<table id="mytable" class="table table-bordred table-striped table-bordered">
<thead>
<th>Usuario_ad</th>
<th>Nombre</th>
<th>Apellido</th>
<th>Cedula</th>
<th>Telefonos</th>
<th>Direccion</th>
<th>barrio</th>
<th>Lugar_v</th>
<th>Mesa_v</th>
<th>Email</th>
<th>Ciudad</th>
<th>Editar</th>
<th>Eliminar</th>
</thead>
<tbody>
@if($usuarios->count())
@foreach($usuarios as $usuario)
<tr>
<td>{{$usuario->usuario_ad}}</td>
<td>{{$usuario->nombre}}</td>
<td>{{$usuario->apellido}}</td>
<td>{{$usuario->cedula}}</td>
<td>{{$usuario->telefonos}}</td>
<td>{{$usuario->direccion}}</td>
<td>{{$usuario->barrio}}</td>
<td>{{$usuario->lugar_votacion}}</td>
<td>{{$usuario->mesa_votacion}}</td>
<td>{{$usuario->email}}</td>
<td>{{$usuario->ciudad}}</td>
<td><a class="btn btn-primary btn-xs" href="{{action('UsuarioController@edit', $usuario->id)}}" ><span class="glyphicon glyphicon-pencil"></span></a></td>
<td>
<form action="{{action('UsuarioController@destroy', $usuario->id)}}" method="post">
{{csrf_field()}}
<input name="_method" type="hidden" value="DELETE">
<button class="btn btn-danger btn-xs" type="submit"><span class="glyphicon glyphicon-trash"></span></button>
</form>
</td>
</tr>
@endforeach
@else
<tr>
<td colspan="8">No hay registro !!</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
{{ $usuarios->links() }}
</div>
</div>
</section>
@endsection
@section('scripts')
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$('#datepicker').datepicker({});
from = $( "#from" )
.datepicker({
dateFormat:'yy-mm-dd',
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1
})
.on( "change", function() {
to.datepicker( "option", "minDate", getDate( this ) );
}),
to = $( "#to" ).datepicker({
dateFormat:'yy-mm-dd',
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1
})
.on( "change", function() {
from.datepicker( "option", "maxDate", getDate( this ) );
});
function getDate( element ) {
var date;
try {
date = $.datepicker.parseDate( dateFormat, element.value );
} catch( error ) {
date = null;
}
return date;
}
} );
</script>
@endsection