<?php $__env->startSection('content'); ?>
<div class="body self">
	<div class="container">
		<div class="profile clearfix">
			<div class="menu pull-left">
				<ul class="nav nav-pills nav-stacked">
				  	<li <?php echo $active=='details'?'class="active"':''; ?>><a href="<?php echo URL::to('profile', $user_profile->username); ?>">Profile</a></li>
				  	<?php if(Cauth::isAgent($user_profile)): ?>
				  	<li <?php echo $active=='listings'?'class="active"':''; ?>><a href="<?php echo URL::to('profile/'.$user_profile->username.'/listings'); ?>">Listings</a></li>	
				  	<li <?php echo $active=='reviews'?'class="active"':''; ?>><a href="<?php echo URL::to('profile/'.$user_profile->username.'/reviews'); ?>">Reviews (<?php echo $broker->reviews->count(); ?>)</a></li>
				  	<?php endif; ?>			  	
				</ul>
			
			</div>
			
			<div class="content pull-left">
				<div class="inner">
					<div class="block row">
						<div class="profile-image col-xs-4">
							<img src="<?php echo Cauth::getAvatar($user_profile); ?>" alt="" class="img-thumbnail" />
						</div>
						<div class="details col-xs-8">
							<h4><?php echo $user_profile->fullname; ?> <span class="label label-info">Agent</span></h4>
							<div class="rating clearfix">
								<div class="pull-left"><div id="agent-rating" data-score="4" data-readonly="true"></div></div>
								<?php if(Cauth::isAgent($user_profile)): ?><div class="pull-left">(<a href="<?php echo URL::to('profile/'.$user_profile->username.'/reviews'); ?>"><?php echo $broker->reviews->count(); ?> reivews</a>)</div><?php endif; ?>
							</div>
							<?php if($user_profile->location!=''): ?> <p class="location"><i class="fa fa-map-marker"></i> <?php echo $user_profile->location; ?></p> <?php endif; ?>
							
							<a href="#" class="btn btn-green btn-sm"><i class="fa fa-pencil-square-o"></i> Write a Review</a>
							
						</div>						
					</div>
					<div class="block info">						
					<?php if(isset($broker)): ?>
						<?php if($active=='details'): ?>	
							<p>
								Languages: <?php echo $broker->languages; ?>
							</p>
							<?php if($broker->business_since!=''): ?>
							<p>
								Experience: <?php echo (date('Y') - $broker->business_since); ?> years in Real Estate
							</p>
							<?php endif; ?>
							<p><?php echo $broker->bio; ?></p>	
						<?php elseif($active=='listings'): ?>	
							<h4>Active Listings (<?php echo $listings->count(); ?>)</h4>
							
							<?php if(! $listings->isEmpty()): ?>
							<div class="listings">
								<?php foreach($listings as $rental): ?>
								<div class="item">
									<div class="image">
										<a href="<?php echo Link::to('rental', $rental->rental_id); ?>">
										<?php if($rental->pictures->count()>0): ?>					
											<img src="<?php echo Image::url($rental->pictures->last()->file, '/listings/'.$rental->rental_id, 'thumb'); ?>" alt="<?php echo $rental->title; ?>" />
										<?php else: ?>
											<img src="<?php echo Image::url('nopic.png', 'galleries', 'thumb'); ?>" alt="<?php echo $rental->title; ?>" />
										<?php endif; ?>
										</a>
									</div>
									<div class="address">
										<a href="<?php echo Link::to('rental', $rental->rental_id); ?>"><?php echo $rental->address; ?>, <?php echo $rental->city; ?>, <?php echo $rental->state; ?> <?php echo $rental->zipcode; ?></a> <br />											
										<?php echo $rental->bedroom(); ?>, <?php echo $rental->bathroom(); ?>
										<div class="price">$<?php echo number_format($rental->price); ?> month</div>										
									</div>
									
								</div>
								<?php endforeach; ?>
							</div>
							<?php else: ?>
								<p>No listings yet.</p>
							<?php endif; ?>
						<?php elseif($active=='reviews'): ?>	
							<h4>Reviews (<?php echo $reviews->count(); ?>)</h4>
							<?php if(! $reviews->isEmpty()): ?>
							
							<?php else: ?>
								<p>No reviews yet.</p>
							<?php endif; ?>
						<?php endif; ?>				
					<?php endif; ?>
					</div>
				</div>
			</div>
			
			<div class="sidebar pull-left">
				<div class="inner">
					<div class="buttons">						
						<a href="#contact-block" class="btn btn-default popup-inline"><i class="fa fa-envelope"></i> Contact</a> 
						<a href="#" class="btn btn-default addthis_button_compact"><i class="fa fa-share"></i> Share</a>
					</div>
					
					<hr />
					<dl class="dl-horizontal">
						<?php if(isset($broker)): ?>					
						<h5>Contact Information</h5>	
				  		<dt>Brokerage:</dt>
				  		<dd><?php echo $broker->brokerage->name; ?><br />
				  			<?php echo $broker->brokerage->address; ?>, <?php echo $broker->brokerage->address2; ?><br />
				  			<?php echo $broker->brokerage->city; ?>, <?php echo $broker->brokerage->state; ?> <?php echo $broker->brokerage->zipcode; ?>
				  		</dd>
				  		<dt>Office Phone:</dt>
				  		<dd><?php echo $broker->phone; ?></dd>
				  		<dt>Cell Phone:</dt>
				  		<dd><?php echo $broker->cell; ?></dd>
				  		<dt>Website:</dt>
				  		<dd><a href="http://<?php echo $broker->brokerage->website; ?>" rel="nofollow" target="_blank">Website</a> <sup class="fa fa-external-link"></sup></dd>
				  		<?php if($broker->facebook!=''): ?>
				  		<dt>Facebook Page:</dt>
				  		<dd><?php echo $broker->facebook; ?> <sup class="fa fa-external-link"></sup></dd>
				  		<?php endif; ?>
				  		<?php if($broker->linkedin!=''): ?>
				  		<dt>LinkedIn:</dt>
				  		<dd><?php echo $broker->linkedin; ?> <sup class="fa fa-external-link"></sup></dd>	
				  		<?php endif; ?>			  		
						<?php endif; ?>
				  		<dt>Member since:</dt>
				  		<dd><?php echo date('m/d/Y', strtotime($user_profile->created_at)); ?></dd>
					</dl>
					
					<hr />
					<div class="text-center">
						<img src="http://placehold.it/200x150" alt="" />
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<?php echo $__env->make('contact.form', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>;
<?php $__env->stopSection(); ?>


<?php $__env->startSection('scripts'); ?>
<script>
var addthis_config = {ui_click: true, services_compact: 'facebook, twitter, google_plusone_share, pinterest, linkedin', services_exclude: 'email, print'};
</script>
<script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-528ab01c4701adda"></script>
<?php echo HTML::script('/js/plugins/jquery.raty.min.js'); ?>
<?php echo HTML::script('/js/profile.js'); ?>    
<?php $__env->stopSection(); ?>