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

@section('content')
	<header>
		<h1 class="module-title"><span class="glyphicon glyphicon-folder-open"></span>{{ trans('categories::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/categories/add') }}" class="btn btn-info"><span class="glyphicon glyphicon-plus"></span> {{ trans('categories::label.add_category') }}</a>
		</div>
    </div>
    <table class="table table-hover table-bordered" id="tablaPrincipal">
		<thead>
			<tr>
				<th>{{ trans('categories::label.title') }}</th>
				<th>{{ trans('categories::label.category_parent') }}</th>
				<th>{{ trans('categories::label.created') }}</th>
				<th>{{ trans('categories::label.updated') }}</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/categories/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/categories/edit/"+id;
			});
		});
	</script>
@stop