@php
    use App\Models\Group;
@endphp

@section('header')
	@include('common.header')
@stop

@section('content')
	<div class="row">
		<div class="col-sm-8">
			<div class="widget widget-classic">
				<div class="widget-content">
					<!-- Page title -->
					<p class="lead">
						Groups
						<a href="{!! URL::route('admin.settings.groups.create') !!}" class="btn btn-primary pull-right"><i class="fa fa-plus"></i> Add a new group</a>
					</p>

					@if (Session::has('message'))
						<div class="alert alert-success">
							<i class="fa fa-check-circle"></i> {!! Session::get('message') !!}
						</div>
					@endif


					<!-- Render the table -->
					<table class="table">
						<tbody>
							@foreach (Group::all() as $group)
								<tr>
									<td>{!! $group->id !!}</td>
									<td>{!! $group->name !!}</td>
									<td><span class="muted">Users:</span> {!! $group->users()->count() !!}</td>
									<td><a href="{!! URL::route('admin.settings.groups.edit', $group->id) !!}" class="pull-right">Edit</a></td>
								</tr>
							@endforeach
						</tbody>
					</table> <!-- end of table -->

				</div>
			</div>
		</div>
		<div class="col-sm-4">
			@include('admin::settings.groups.partials.info')
		</div>
	</div>
@stop