<?php $__env->startSection('content'); ?>	
	<h2>Buildings</h2>
	<div class="buttons">
		<a href="<?php echo URL::route('admin.rental-buildings.create'); ?>" class="btn btn-primary"><i class="glyphicon glyphicon-plus"></i> Add a new Building</a>
	</div>
		
	<table class="table table-bordered table-striped">
		<thead>
			<tr>
				<th class="text-center">ID</th>
				<th class="col-lg-3">Building name</th>
				<th class="text-center">Address</th>
				<th class="text-center">Floors</th>
				<th class="text-center">Units</th>
				<th class="text-center">Created</th>
				<th class="text-center" colspan="2">Actions</th>
			</tr>
		</thead>
		<tbody>
		<?php if(! $buildings->isEmpty()): ?>
			<?php foreach($buildings as $building): ?>
			<tr>
				<td class="text-center"><?php echo $building->building_id; ?></td>
				<td><?php echo $building->name; ?></td>		
				<td class="text-center"><?php echo $building->brokers()->count(); ?></td>	
				<td class="text-center"></td>				
				<td class="text-center"><?php echo date('M d, Y g:i A',strtotime($building->created_at)); ?></td>
				<td class="text-center"><a href="<?php echo URL::route('admin.rental-buildings.edit', $building->building_id); ?>" class="btn btn-link" title="Edit">Edit</a></td>
				<td class="text-center">
					<?php echo Form::open(array('route' => array('admin.rental-buildings.destroy', $building->building_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="7" class="text-center">No buildings yet.</td>
			</tr>
		<?php endif; ?>
		</tbody>
	</table>
	
	<div class="pagination"><?php echo $buildings->links(); ?></div>

<?php $__env->stopSection(); ?>