<?php $__env->startSection('content'); ?>	
	<h2>Places</h2>
	
	<div class="buttons">
		<div class="pull-left">
		<form action="<?php echo URL::route('admin.places.index'); ?>" method="get" class="form-inline">
			<div class="form-group">
				<select name="neighborhood_id" class="form-control inline" style="width:200px">
				<?php if($neighborhoods): ?>
					<option value="">All Neighborhoods</option>
					<?php foreach($neighborhoods as $neighborhood): ?>
					<option value="<?php echo $neighborhood->neighborhood_id; ?>" <?php echo isset($fields['neighborhood_id']) && $fields['neighborhood_id']==$neighborhood->neighborhood_id ?'selected="selected"':''; ?>><?php echo $neighborhood->name; ?></option>
					<?php endforeach; ?>					
				<?php endif; ?>
				</select>
			</div>
			<div class="form-group">
				<select name="interest_id" class="form-control inline" style="width:200px">
				<?php if($interests): ?>
					<option value="">All Interests</option>
					<?php foreach($interests as $interest): ?>
					<option value="<?php echo $interest->interest_id; ?>" <?php echo isset($fields['interest_id']) && $fields['interest_id']==$interest->interest_id ?'selected="selected"':''; ?>><?php echo $interest->name; ?></option>
					<?php endforeach; ?>					
				<?php endif; ?>
				</select>
			</div>
			<div class="form-group">OR</div>
			<div class="form-group">
				<select name="category_id" class="form-control inline" style="width:200px">
				<?php if($categories): ?>
					<option value="">All Categories</option>
					<?php foreach($categories as $category): ?>
					<optgroup label="<?php echo $category['name']; ?>">
					<?php if(isset($category['childs'])): ?> 
						<?php foreach($category['childs'] as $row): ?>
						<option value="<?php echo $row['category_id']; ?>" <?php echo isset($fields['category_id']) && $fields['category_id']==$row['category_id'] ?'selected="selected"':''; ?>><?php echo $row['name']; ?></option>
						<?php endforeach; ?>
					<?php endif; ?>
					</optgroup>					
					<?php endforeach; ?>					
				<?php endif; ?>
				</select>
			</div>
			<div class="form-group">
			<button type="submit" class="btn btn-success"><i class="fa fa-search"></i> Search</button>
			</div>
		</form>	
		</div>
		<a href="<?php echo URL::route('admin.places.create'); ?>" class="btn btn-primary"><i class="fa fa-plus"></i> Add a place</a>
	</div>
	
	<div class="text-right">Total places: <?php echo $places->getTotal(); ?></div>
	<table class="table table-bordered table-striped">
		<thead>
			<tr>
				<th class="text-center">Place ID</th>
				<th class="text-left">Name</th>		
				<th class="text-left">Address</th>				
				<th class="text-center">Actions</th>
			</tr>
		</thead>
		<tbody>
		<?php if($places): ?>
			<?php foreach($places as $place): ?>
			<tr>
				<td class="text-center"><?php echo $place->place_id; ?></td>
				<td class="text-left"><?php echo $place->name; ?></td>
				<td class="text-left"><?php echo $place->address; ?>, <?php echo $place->city; ?>, <?php echo $place->state; ?> <?php echo $place->zipcode; ?></td>			
				<td class="text-center"><a href="<?php echo URL::route('admin.places.edit', $place->place_id); ?>" title="Edit">Edit</a></td>
			</tr>
			<?php endforeach; ?>
		<?php else: ?>
			<tr>
				<td colspan="3">No places yet.</td>
			</tr>
		<?php endif; ?>
		</tbody>
	</table>
	
	<div class="pagination"><?php echo $places->appends($fields)->links(); ?></div>

<?php $__env->stopSection(); ?>