<?php $__env->startSection('content'); ?>
<div class="map-search">
	<div class="map">
		<div id="map-container"></div>
	</div>
	<div class="content">		
		<div class="neighborhoods">
			<h1>ALL APARTMENTS</h1>
		
			<form method="get" id="apartments-search" onsubmit="return false;">
				<input type="hidden" name="nofee" id="type-nofee" value="ok" />
				<input type="hidden" name="exclusive" id="type-exclusive" value="ok" />
				<div class="apartment-search clearfix">			
					<span class="inline">
						<label>Fee:</label>
						<span class="btn-group" data-toggle="buttons-checkbox" id="fee-type">
					  		<button type="button" class="btn btn-default active" data-value="nofee">No Fee</button>
					  		<button type="button" class="btn btn-default active" data-value="exclusive">Exclusive</button>
						</span>						
					</span>
					<span class="inline">
						<label>Neighborhood:</label>
						<select id="input-neighborhood" name="neighborhood" class="form-control">
							<option value="">All</option>
							<?php foreach($neighborhoods as $row): ?>
							<option value="<?php echo $row->alias; ?>" <?php echo isset($fields['neighborhood'])&&$row->alias==$fields['neighborhood']?'selected="selected"':''; ?>><?php echo $row->name; ?></option>
							<?php endforeach; ?>			
						</select>
					</span>	
					<span class="inline">
						<label>Price:</label>
						<input type="text" name="price_from" id="input-price_from" class="form-control form-small" placeholder="Min" value="<?php echo isset($fields['price_from'])?$fields['price_from']:''; ?>" /> to 
						<input type="text" name="price_to" id="input-price_to" class="form-control form-small" placeholder="Max" value="<?php echo isset($fields['price_to'])?$fields['price_to']:''; ?>" />  
					</span>
					<span class="inline half">
						<label>Bedrooms:</label>
						<select id="input-bedrooms" name="bedrooms" class="form-control form-small">
							<option value="">Any</option>
							<?php foreach(\Config::get('site.bedrooms') as $num => $val): ?>
							<option value="<?php echo $num; ?>" <?php echo isset($fields['bedrooms'])&&$num==$fields['bedrooms']?'selected="selected"':''; ?>><?php echo $val; ?></option>
							<?php endforeach; ?>			
						</select>
					</span>
					
					<span class="inline dropdown">
						<label>&nbsp;</label>
						<div class="btn-group">
  							<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown">Advanced <span id="advanced-count"></span> <span class="caret"></span></button>
  							<div class="dropdown-menu" id="advanced-down">
  								<div class="row">
	  								<div class="col-xs-6">
	  									<h5>Bathrooms</h5>
										<select id="input-bathrooms" name="bathrooms" class="form-control form-small">
											<option value="">Any</option>
											<?php foreach(\Config::get('site.bathrooms') as $num => $val): ?>
											<option value="<?php echo $num; ?>" <?php echo isset($fields['bathrooms'])&&$num==$fields['bathrooms']?'selected="selected"':''; ?>><?php echo $val; ?></option>
											<?php endforeach; ?>			
										</select>								
	  									<h5>Pets</h5>
	    								<label class="checkbox"><input type="checkbox" name="dogs" value="ok" <?php echo isset($fields['dogs'])?'checked="checked"':''; ?> /> Dogs OK</label>
	    								<label class="checkbox"><input type="checkbox" name="cats" value="ok" <?php echo isset($fields['cats'])?'checked="checked"':''; ?> /> Cats OK</label>
	    							</div>
	    							<div class="col-xs-6">
	    								<h5>Amenities</h5>
	    								<label class="checkbox"><input type="checkbox" name="laundry" value="true" <?php echo isset($fields['laundry'])?'checked="checked"':''; ?> /> Laundry</label>
	    								<label class="checkbox"><input type="checkbox" name="parking" value="true" <?php echo isset($fields['parking'])?'checked="checked"':''; ?> /> Parking</label>
	    								<label class="checkbox"><input type="checkbox" name="furnished" value="true" <?php echo isset($fields['furnished'])?'checked="checked"':''; ?> /> Furnished</label>
	    								<label class="checkbox"><input type="checkbox" name="doorman" value="true" <?php echo isset($fields['doorman'])?'checked="checked"':''; ?> /> Doorman</label>
	    							</div>
    							</div>
  							</div>
						</div>
	
						<button type="submit" class="btn btn-blue pull-right"><i class="fa fa-search"></i> Search</button>
					</span>				
				</div>
			</form>
			<div class="total" id="total-events">
				<?php echo $total>1000?'1000+':$total; ?> apartments found.
			</div>	
			<div class="rentals row" id="paginate-container">
				<?php echo $__env->make('apartments.items', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>				
			</div>
		</div>
	</div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<?php echo HTML::script('/js/map/infobox.js'); ?> 
<?php echo HTML::script('/js/plugins/jquery.history.js'); ?>
<?php echo HTML::script('/js/boundaries.js'); ?> 
<?php echo HTML::script('/js/maps.js'); ?> 
<script>		
	<?php if(!is_null($neighborhood)): ?>
	defaultSettings = {
		mapCenter: {lat: <?php echo $neighborhood->lat; ?>, lng: <?php echo $neighborhood->lng; ?> },
		mapZoom: 15,
		mapNeighborhood: <?php echo $neighborhood->neighborhood_id; ?>,				
	};
	<?php endif; ?>
	<?php if(! $apartments->isEmpty()): ?>
	defaultPoints = '<?php echo addslashes(json_encode($apartments_json)); ?>';	
	<?php endif; ?>
</script>
<?php echo HTML::script('/js/apartments.js'); ?> 
<?php $__env->stopSection(); ?>