
<?php \Laravel\Section::start('content'); ?>
	<div class="container">
		<div class="page-header">
			<h1>Gestionnaires du site</h1>
		</div>
		<div style="margin-bottom: 15px;">
			<a class="btn" href="<?php echo  URL::to_route('new_user') ; ?>"><i class="icon-plus"></i> Nouvel Administrateur</a>
		</div>
		<table class="table table-striped table-hover">
			<thead>
				<tr>
					<th>#</th>
					<th>Prénom</th>
					<th>Nom</th>
					<th>Email</th>
					<th>Last Login</th>
					<th style="text-align:right">Action</th>
				</tr>
			</thead>
			<tbody>
				<?php foreach($users as $u): ?>
				<tr>
					<td><?php echo  $u->id ; ?></td>
					<td><?php echo  $u->first_name ; ?></td>
					<td><?php echo  $u->last_name ; ?></td>
					<td><?php echo  $u->email ; ?></td>
					<td>
						<?php if($u->last_login): ?>
							<?php echo  $u->last_login[0]->created_at ; ?>
						<?php else: ?>
							<em>Aucune connexion</em>
						<?php endif; ?>
					</td>
					<td style="text-align:right">
						<?php echo  Form::open(URL::to_route('delete_user', $u->id), 'DELETE', array('id' => 'form_'.$u->id, 'style' => 'margin:0;')) ; ?>
						<div class="btn-group">
							<a class="btn btn-small" href="<?php echo  URL::to_route('edit_user', array($u->id)) ; ?>"><i class="icon-pencil"></i> Modifier</a>
							<a class="btn btn-small btn-danger" href="javascript:delete_entry(<?php echo $u->id ?>);"><i class="icon-remove icon-white"></i> Supprimer</a>
						</div>
						<?php echo  Form::close() ; ?>
					</td>
				</tr>
				<?php endforeach; ?>
			</tbody>
		</table>
	</div>
	<script type="text/javascript">
	function delete_entry(id)
	{
		if(confirm('Etes-vous sur?'))
			$('#form_'+id).submit();
		else
			return false;
	}
	</script>
<?php \Laravel\Section::stop(); ?>
<?php echo view('backend::template_default')->with(get_defined_vars())->render(); ?>