
<?php \Laravel\Section::start('content'); ?>
<div class="container">
	<div class="page-header">
		<h1><?php echo  Auth::user()->name ; ?> <small><?php echo  Auth::user()->email ; ?></small></h1>
	</div>

	<?php echo  Form::open(null, 'PUT', array('class' => 'form-horizontal')) ; ?>
	<div class="row-fluid">
		<div class="span7">
			<?php if (Session::has('errors')): ?>
				<div class="alert alert-error">
					<button type="button" class="close" data-dismiss="alert">×</button>
					<strong><?php echo __('admin.erreurs_inattendues'); ?></strong>
				</div>
			<?php elseif (Session::has('success')): ?>
				<div class="alert alert-success">
					<button type="button" class="close" data-dismiss="alert">×</button>
					<strong><?php echo __('admin.succes'); ?> !</strong> <?php echo __('admin.profil_mis_jour'); ?>
				</div>
			<?php endif; ?>

			<table class="table table-striped">
				<tr>
					<td><?php echo __('admin.email'); ?></td>
					<td><input type="text" value="<?php echo  Auth::user()->email ; ?>" disabled></td>
				</tr>
				<tr <?php if($errors->first('last_name')) echo 'class="error"'; ?>>
					<td><?php echo __('admin.nom'); ?> *</td>
					<td>
						<?php echo  Form::text('last_name', Auth::user()->last_name) ; ?>
					</td>
				</tr>
				<tr <?php if($errors->first('first_name')) echo 'class="error"'; ?>>
					<td><?php echo __('admin.prenom'); ?> *</td>
					<td>
						<?php echo  Form::text('first_name', Auth::user()->first_name) ; ?>
					</td>
				</tr>
				<tr>
					<td colspan="2"><h5><?php echo __('admin.mot_passe'); ?> <small>(<b>Note</b> : <?php echo __('admin.laisser_vide'); ?>)</small></h5></td>
				</tr>
				<tr <?php if($errors->first('new_password')) echo 'class="error"'; ?>>
					<td><?php echo __('admin.mot_passe_nouveau'); ?></td>
					<td>
						<?php echo  Form::password('new_password') ; ?>
					</td>
				</tr>
				<tr <?php if($errors->first('new_password_confirmation')) echo 'class="error"'; ?>>
					<td><?php echo __('admin.confirmer'); ?></td>
					<td>
						<?php echo  Form::password('new_password_confirmation') ; ?>
					</td>
				</tr>
				<tr>
					<td><b><?php echo __('admin.permissions'); ?></b></td>
					<td>
						<?php foreach(Auth::user()->roles as $r): ?>
							<?php echo  '&bull; '.$r->name.'<br>' ; ?>
						<?php endforeach; ?>
					</td>
				</tr>
			</table>
		</div>

		<div class="span5">
			<h4><?php echo __('admin.informations'); ?></h4>
			<p>
				<?php echo __('admin.derniere_modification'); ?> :<br><code><?php echo  Auth::user()->updated_at ; ?></code><br>
			</p>
			<p>
				<?php echo __('admin.date_creation'); ?> :<br><code><?php echo  Auth::user()->created_at ; ?></code><br><br>
			</p>
			<h4><?php echo __('admin.historique_connexion'); ?></h4>
			<table class="table table-condensed table-bordered">
				<thead>
					<tr>
						<th><?php echo __('admin.date'); ?></th>
						<th><?php echo __('admin.adresse_ip'); ?></th>
					</tr>
				</thead>
				<tbody>
					<?php foreach(Auth::user()->log_history()->order_by('created_at', 'desc')->take(10)->get() as $lh): ?>
					<tr>
						<td><?php echo  $lh->created_at ; ?></td>
						<td><?php echo  $lh->ip ; ?></td>
					</tr>
					<?php endforeach; ?>
				</tbody>
			</table>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span12">
			<div class="form-actions">
				<button type="submit" class="btn btn-primary"><?php echo __('admin.mettre_a_jour'); ?></button>
			</div>
		</div>
	</div>
	<?php echo  Form::close() ; ?>
</div>
<?php \Laravel\Section::stop(); ?>
<?php echo view('backend::template_default')->with(get_defined_vars())->render(); ?>