@extends('dashboard::master')
{{--
    Autor: Giovanni López O.
    @gmlo_89
--}}

@section('content')
	<header>
		<h1 class="module-title"><span class="glyphicon glyphicon-user"></span>{{ trans('users::label.module_name') }}</h1>
    </header>
    {{ Alert::render() }}
    <div class="row btn-bar">
    	<div class="btn-group pull-left">
			<a href="{{ url('admin') }}" class="btn btn-default">{{ trans('dashboard::label.go_home') }}</a>
		</div>
		<div class="btn-group pull-right">
			
			<a href="{{ url('admin/usergroups') }}" class="btn btn-default"><span class="glyphicon glyphicon-briefcase"></span> {{ trans('usergroups::label.admin_groups') }}</a>

			<a href="{{ url('admin/users/add') }}" class="btn btn-info"><span class="glyphicon glyphicon-plus"></span> {{ trans('users::label.add_user') }}</a>
		</div>
    </div>
    <table class="table table-hover table-bordered" id="tablaPrincipal">
		<thead>
			<tr>
				<th>{{ trans('users::label.username') }}</th>
				<th>{{ trans('users::label.name') }}</th>
				<th>{{ trans('users::label.email') }}</th>
				<th>{{ trans('users::label.status') }}</th>
			</tr>
		</thead>
	</table>
@stop

@section('scripts')
	
	<script>
		$(document).ready(function() {
		    $('#tablaPrincipal').dataTable({
		    	"oLanguage": {
		    		"sUrl": inncore.lang_dir+"datatables.txt"
		    	},
		    	"bProcessing": true,
		        "bServerSide": true,
		        "sAjaxSource": inncore.url_base+"/admin/users/tabla-ajax"
		    }).on('click', 'td:not(.dataTables_empty)', function(event) {
				var id = $(this).parent().find('input.id').val();
				document.location.href=inncore.url_base+"/admin/users/edit/"+id;
			});
		});
	</script>
@stop