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

@section('js')
	<script type="text/ng-template" id="admin/modals/user.html">
		@include('admin::templates.modals.user')
	</script>
@stop

@section('content')
	<div class="row" ng-controller="AdminUsersCtrl" ng-cloak>
		<div class="col-sm-2">
			<span class="btn btn-block btn-primary" style="margin-top: 15px;" ng-click="showUserModal()"><i class="fa fa-plus"></i> Add a new user</span>

			<ul class="nav nav-list" style="margin-top: 20px;">
				<li class="nav-header">Filters</li>
				<li>
					<div class="checkbox">
						<label><input type="checkbox" ng-model="filters.active" ng-disabled="filters.inactive" value="1"> Active Members</label>
					</div>
				</li>
				<li>
					<div class="checkbox">
						<label><input type="checkbox" ng-model="filters.inactive" ng-disabled="filters.active" value="1"> Inactive Members</label>
					</div>
				</li>
				<li>
					<div class="checkbox">
						<label><input type="checkbox" ng-model="filters.suspended" value="1"> Suspended Members</label>
					</div>
				</li>
				<li class="nav-header">Search</li>
				<li><input type="text" class="form-control" placeholder="Search here..." ng-model="filters.q"></li>
			</ul>
		</div>

		<div class="col-sm-10">
			<div class="widget widget-classic">
				<div class="widget-content">

					<div class="headline">
						<h4><i class="fa fa-user"></i> Users settings</h4>
					</div>

					<div ng-if="users.length > 0">
						<table class="table table-striped">
							<thead>
								<th>ID</th>
								<th>Name</th>
								<th>Username</th>
								<th>E-mail</th>
								<th>Type</th>
								<th class="centered">Active</th>
								<th>Joined</th>
								<th></th>
							</thead>
							<tbody>
								<tr ng-repeat="user in users">
									<td>{[{ user.id }]}</td>
									<td>{[{ user.name }]}</td>
									<td>{[{ user.username }]}</td>
									<td>{[{ user.email }]}</td>
									<td>
										<span ng-show="user.account_type == 'local'">Local account</span>
										<span ng-show="user.account_type == 'ldap'">LDAP / Active Directory</span>
									</td>
									<td class="centered">{[{ user.active == '1' ? 'Yes' : 'No' }]}</td>
									<td><span tooltip="{[{ user.created_at }]}">{[{ user.created_at | fromNow }]}</span></td>
									<td><a href="#" class="pull-right" ng-click="showUserModal(user)">Edit</a></td>
								</tr>
							</tbody>
						</table>
						<div paginator="paginator"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
@stop