
<?php \Laravel\Section::start('content'); ?>
	<div class="container">
		<div class="page-header">
			<h1>Projets vidéos</h1>
		</div>
		<div style="margin-bottom: 15px;">
			<a class="btn" href="<?php echo  URL::to_route('new_project') ; ?>"><i class="icon-plus"></i> Ajouter un nouveau projet</a>
		</div>
		<?php echo  BHelpers::notification() ; ?>
		<?php if($projects): ?>
		<table class="table datatable table-striped table-hover datatablecustomers">
			<thead>
				<tr>
					<th>#</th>
					<th>Organisateur</th>
					<th>Projet</th>
					<th>Cible</th>
					<th>Participants</th>
					<th>Date limite</th>
					<th>Payé</th>
					<th>Livré</th>
					<th style="text-align:right"><?php echo __('admin.action'); ?></th>
				</tr>
			</thead>
			<tbody>
				<?php foreach($projects as $p): ?>
				<tr>
					<td><?php echo $p->id; ?></td>
					<td><a href="<?php echo  URL::to_route('edit_customer', array($p->customer_id)) ; ?>"><?php echo $p->customer->email; ?></a></td>
					<td><?php echo $p->name; ?></td>
					<td><?php echo $p->cible_last_name; ?> <?php echo $p->cible_first_name; ?></td>
					<td><?php echo count($p->invites); ?></td>
					<td><?php echo $p->date_limite; ?></td>
					<td>
						<?php if($p->is_paid=='y'): ?>
						<span class="label label-success">Oui</span>
						<?php else: ?>
						<span class="label label-warning">Non</span>
						<?php endif; ?>
					</td>
					<td>
						<?php if($p->dropbox_url!=''): ?>
						<span class="label label-success">Oui</span>
						<?php else: ?>
						<span class="label label-warning">Non</span>
						<?php endif; ?>
					</td>
					<td style="padding: 4px 8px; text-align:right;">
						<?php echo  Form::open(URL::to_route('delete_project', $p->id), 'DELETE', array('id' => 'form_'.$p->id, 'style' => 'margin:0;')) ; ?>
						<div class="btn-group">
							<a class="btn btn-small" href="<?php echo  URL::to_route('edit_project', array($p->id)) ; ?>"><i class="icon-pencil"></i> Détails</a>
							<a class="btn btn-small btn-danger" href="javascript:delete_entry(<?php echo $p->id ?>);"><i class="icon-remove icon-white"></i> <?php echo __('admin.supprimer'); ?></a>
						</div>
						<?php echo  Form::close() ; ?>
					</td>
				</tr>
				<?php endforeach; ?>
			</tbody>
		</table>
		<?php else: ?>
		<em>Aucun projet 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(); ?>