<?php $__env->startSection('content'); ?>	
	<h2>Brokers</h2>
	<div class="buttons">
		<a href="<?php echo URL::route('admin.rental-brokers.create'); ?>" class="btn btn-primary"><i class="glyphicon glyphicon-plus"></i> Add a new Broker</a>
	</div>
		
	<table class="table table-bordered table-striped">
		<thead>
			<tr>
				<th class="text-center">ID</th>
				<th class="col-lg-3">Full name</th>
				<th class="text-center">Email</th>
				<th class="text-center">Brokerage Co.</th>
				<th class="text-center"># Listings</th>
				<th class="text-center">Created</th>
				<th class="text-center" colspan="2">Actions</th>
			</tr>
		</thead>
		<tbody>
		<?php if($brokers): ?>
			<?php foreach($brokers as $broker): ?>
			<tr>
				<td class="text-center"><?php echo $broker->broker_id; ?></td>
				<td><?php echo $broker->fullname; ?></td>			
				<td class="text-center"><?php echo $broker->email; ?></td>						
				<td class="text-center"><?php echo $broker->brokerage ? $broker->brokerage->name : '-'; ?></td>
				<td class="text-center"><?php echo $broker->rentals()->count(); ?></td>	
				<td class="text-center"><?php echo date('M d, Y g:i A',strtotime($broker->created_at)); ?></td>
				<td class="text-center"><a href="<?php echo URL::route('admin.rental-brokers.edit', $broker->broker_id); ?>" title="Edit">Edit</a></td>
				<td class="text-center">
					<?php echo Form::open(array('route' => array('admin.rental-brokers.destroy', $broker->broker_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; ?>
		<?php else: ?>
			<tr>
				<td colspan="6">No brokers yet.</td>
			</tr>
		<?php endif; ?>
		</tbody>
	</table>
	
	<div class="pagination"><?php echo $brokers->links(); ?></div>

<?php $__env->stopSection(); ?>