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


@section('content')
	<header>
		<h1 class="module-title"><span class="glyphicon glyphicon-briefcase"></span>{{ trans('usergroups::label.module_name') }}</h1>
    </header>
    {{ Alert::render() }}
    <div class="row btn-bar">
    	<div class="btn-group pull-left">
			<a href="{{ url('admin/users') }}" class="btn btn-default">{{ trans('dashboard::label.go_back') }}</a>
		</div>
		<div class="btn-group pull-right">
			<a href="{{ url('admin/usergroups/add') }}" class="btn btn-info"><span class="glyphicon glyphicon-plus"></span> {{ trans('usergroups::label.add_group') }}</a>
		</div>
    </div>
    <table class="table table-hover table-bordered" id="tablaPrincipal">
		<thead>
			<tr>
				<th>{{ trans('usergroups::label.group') }}</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/usergroups/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/usergroups/edit/"+id;
			});
		});
	</script>
@stop