<?php $__env->startSection('content'); ?>
<div class="headbar">
	<div class="container">
		<div class="row">
			<h2 class="col-lg-3">ALL EVENTS <span><?php echo $events->getTotal(); ?> results.</span></h2>
			
			<div class="pull-right col-lg-9 horizontal-form">
				<form method="get" id="events-search">
					<input type="hidden" name="view" value="<?php echo $active_view; ?>" />
					<label class="inline">
						Neighborhood: <br />
						<select id="input-neighborhood" class="form-control">
							<option value="">All</option>
							<?php foreach($neighborhoods as $row): ?>
							<option value="<?php echo $row->alias; ?>" <?php echo $row->alias==$fields['neighborhood']?'selected="selected"':''; ?>><?php echo $row->name; ?></option>
							<?php endforeach; ?>			
						</select>
					</label>
					<label class="inline">
						Date: <br />
						<?php echo Form::select('date', $dates, $fields['date'], array('class' => "form-control", 'id' => 'input-date')); ?>					
					</label>
					<label class="inline">
						Category: <br />
						<select name="category" id="input-category" class="form-control">
							<option value="*">All</option>
							<?php foreach($categories as $row): ?>
							<option value="<?php echo $row->slug; ?>" <?php echo $row->slug==$fields['category']?'selected="selected"':''; ?>><?php echo $row->name; ?></option>
							<?php endforeach; ?>			
						</select>
					</label>
				</form>
			</div>
		</div>
	</div>
</div>
<div class="body">
	<div class="container">
		<div class="filter row">
			<div id="view-mode" class="btn-group col-lg-4">
				<?php if($active_view=='list'): ?> 
				<a href="javascript:;" class="btn btn-green active"><i class="glyphicon glyphicon-list"></i> List View</a> <a href="?view=map&<?php echo http_build_query($form_fields); ?>" class="btn btn-green"><i class="glyphicon glyphicon-globe"></i> Map View</a>	
				<?php else: ?>
				<a href="?view=list&<?php echo http_build_query($form_fields); ?>" class="btn btn-green"><i class="glyphicon glyphicon-list"></i> List View</a> <a href="javascript:;" class="btn btn-green active"><i class="glyphicon glyphicon-globe"></i> Map View</a>
				<?php endif; ?>							
			</div> 
			<?php /* 
			<div class="pull-right form-inline col-lg-3" style="text-align:right">
				<div class="form-group">Sort By: </div>	
				<div class="form-group">							
					<select name="sort" id="input-sort" class="form-control">
						<option value="popularity">Popularity</option>
						<option value="date">Date</option>
					</select>
				</div>
			</div>  */ ?>
		</div>
	<?php if(! $events->isEmpty()): ?>
		<div class="events row">
			<?php foreach($events as $event): ?>
			
			<div class="item col-lg-4">
				<div class="inner clearfix">
					<div class="image">
						<a href="<?php echo Link::to('event', $event->event_id); ?>"><img src="<?php echo Image::link($event->cover_image); ?>" alt="<?php echo $event->title; ?>" /></a>
					</div>
					<div class="content">					
						<h4><a href="<?php echo Link::to('event', $event->event_id); ?>"><?php echo Str::limit($event->title, 40); ?></a></h4>
						<div class="date"><?php echo date('M j - g:i A', strtotime($event->start_time)); ?></div>
						<div class="desc"><?php echo Str::limit($event->place_name, 32); ?></div>
						<a href="<?php echo Link::to('event', $event->event_id); ?>" class="btn btn-details">Details</a>
					</div>
				</div>
			</div>
			<?php endforeach; ?>			
		</div>
	<?php echo $events->appends($form_fields)->links(); ?>		
	<?php else: ?>
		No Events found.
	<?php endif; ?>
	</div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
<script>
$(function(){
	$('#input-neighborhood, #input-date, #input-category').change(function(){
		$('#events-search').submit();
	});
});
</script> 
<?php $__env->stopSection(); ?>