
<?php \Laravel\Section::start('content'); ?>
	<div class="container">
		<div class="page-header">
			<h1>Devis</h1>
		</div>
		<div style="margin-bottom: 15px;">
			<a class="btn" href="<?php echo  URL::to_route('new_devis') ; ?>"><i class="icon-plus"></i> Créer un devis</a>
		</div>
		<?php echo  BHelpers::notification() ; ?>
		<?php if($devis): ?>
		<table class="table table-striped table-hover datatable">
			<thead>
				<tr>
					<th>#</th>
					<th>Client</th>
					<th>Devis</th>
					<th>Prix HT</th>
					<th>Prix TTC</th>
					<th>Crée le</th>
					<th style="text-align:right;"><?php echo __('admin.action'); ?></th>
				</tr>
			</thead>
			<tbody>
			<?php foreach($devis as $c): ?>
				<tr>
					<td><?php echo  $c->id ; ?></td>
					<td><a href="<?php echo  URL::to_route('edit_customer', array($c->customer->id)) ; ?>"><?php echo  $c->customer->societe ; ?></a></td>
					<td><?php echo  GeneralFunctions::cleanCut($c->label,50) ; ?></td>
					<td><?php echo  number_format($c->total_ht(), 2, ',', ' ') ; ?> &euro;</td>
					<td><?php echo  number_format($c->total_ttc(), 2, ',', ' ') ; ?> &euro;</td>
					<td><?php echo  substr($c->created_at,0,10) ; ?></td>
					<td style="padding: 4px 8px; text-align:right;">
						<?php echo  Form::open(URL::to_route('delete_devis', $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('devispdf', array($c->id)) ; ?>" target="_blank"><i class="icon-file"></i></a>
							<a class="btn btn-small" href="<?php echo  URL::to_route('edit_devis', array($c->id)) ; ?>"><i class="icon-pencil"></i></a>
							<a class="btn btn-small btn-danger" href="javascript:delete_entry(<?php echo $c->id ?>);"><i class="icon-remove icon-white"></i></a>
						</div>
						<?php echo  Form::close() ; ?>
					</td>
				</tr>
			<?php endforeach; ?>
			</tbody>
		</table>
		<?php else: ?>
			<em>Aucun devis actuellement.</em>
		<?php endif; ?>
	</div>
	<script type="text/javascript">
	function delete_entry(id)
	{
		if(confirm("<?php echo __('admin.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(); ?>