
<?php \Laravel\Section::start('content'); ?>
	<div class="container">
		<div class="page-header">
			<h1>Distributeurs</h1>
		</div>
		<div style="margin-bottom: 15px;">
			<a class="btn" href="<?php echo  URL::to_route('new_distributeur') ; ?>"><i class="icon-plus"></i> Nouveau distributeur</a>
		</div>
		<?php echo  BHelpers::notification() ; ?>
		<?php if($distributeurs): ?>
		<table class="table table-striped table-hover datatable">
			<thead>
				<tr>
					<th>#</th>
					<th>Nom</th>
					<th>Pays</th>
					<th>Continent</th>
					<th>Actif</th>
					<th style="text-align:right;">Action</th>
				</tr>
			</thead>
			<tbody>
			<?php foreach($distributeurs as $c): ?>
				<tr>
					<td><?php echo  $c->id ; ?></td>
					<td><?php echo  $c->desc[0]->name ; ?></td>
					<td><?php echo  $c->desc[0]->pays ; ?></td>
					<td><?php echo  $c->desc[0]->continent ; ?></td>
					<td>
						<?php if($c->valid=='y'): ?>
						<span class="label label-success">Oui</span>
						<?php else: ?>
						<span class="label label-warning">Non</span>
						<?php endif; ?>
					</td>
					<td style="text-align:right;">
						<?php echo  Form::open(URL::to_route('delete_distributeur', $c->id), 'DELETE', array('id' => 'form_'.$c->id, 'style' => 'margin:0;')) ; ?>
						<div class="btn-group">
							<a class="btn btn-small" href="<?php echo  URL::to_route('edit_distributeur', array($c->id)) ; ?>"><i class="icon-pencil"></i> Modifier</a>
							<a class="btn btn-small btn-danger" href="javascript:delete_entry(<?php echo $c->id ?>);"><i class="icon-remove icon-white"></i> Supprimer</a>
						</div>
						<?php echo  Form::close() ; ?>
					</td>
				</tr>
			<?php endforeach; ?>
			</tbody>
		</table>
		<?php else: ?>
			<em>Aucun distributeur défini actuellement.</em>
		<?php endif; ?>
	</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(); ?>