<?php $__env->startSection('content'); ?>
	
	<h2>Events Manager</h2>
	<div class="buttons">
		<a href="<?php echo URL::route('admin.events.create'); ?>" class="btn btn-primary"><i class="glyphicon glyphicon-plus"></i> Add a new Event</a>
	</div>
	
	
	<table class="table table-bordered table-striped">
		<thead>
			<tr>
				<th class="text-center">ID</th>
				<th class="col-md-4">Event Title</th>
				<th class="text-center">Event Date</th>
				<th class="text-center">Venue</th>
				<th class="text-center">Last Updated</th>
				<th class="text-center" colspan="2">Actions</th>
			</tr>
		</thead>
		
		<?php if($events): ?>
		<tbody>
			<?php foreach($events as $event): ?>
			<tr>
				<td class="text-center"><?php echo $event->event_id; ?></td>
				<td><?php echo $event->title; ?></td>
				<td class="text-center"><?php echo date('M d, Y, g:ia',strtotime($event->start_time)); ?></td>
				<td class="text-center"><a href="<?php echo URL::to('admin/places/'.$event->place_id); ?>"><?php echo isset($event->place)?$event->place->name:'-'; ?></a></td>
				<td><?php echo date('m/d/y H:i',strtotime($event->updated_at)); ?></td>
				<td><a href="<?php echo URL::route('admin.events.edit', $event->event_id); ?>" title="Edit">Edit</a></td>
				<td>
					<?php echo Form::open(array('route' => array('admin.events.destroy', $event->event_id), 'method' => 'DELETE')); ?>
					<button type="submit" onclick="return confirm('Are you sure?')" class="btn btn-link"  title="Delete">Delete</button>
					<?php echo Form::close(); ?>
				</td>
			</tr>
			<?php endforeach; ?>
		</tbody>
		<tfoot>	
			<tr>
				<td colspan="7"><div class="pagination"><?php echo $events->links(); ?></div></td>
			</tr>
		</tfoot>
		<?php else: ?>
			<tr>
				<td colspan="7">No events yet.</td>
			</tr>
		<?php endif; ?>
		
	</table>

<?php $__env->stopSection(); ?>