<?php $__env->startSection('content'); ?>	
	<h2>Listings</h2>
	<div class="buttons">
		<a href="<?php echo URL::route('admin.rentals.create'); ?>" class="btn btn-primary"><i class="glyphicon glyphicon-plus"></i> Add a new Listing</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($rentals): ?>
			<?php foreach($rentals as $rental): ?>
			<tr>
				<td class="text-center"><?php echo $rental->rental_id; ?></td>
				<td><?php echo $rental->fullname; ?></td>			
				<td class="text-center"><?php echo $rental->email; ?></td>						
				<td class="text-center"><?php echo $rental->rentalage ? $rental->rentalage->name : '-'; ?></td>
				<td class="text-center"><?php echo $rental->rentals()->count(); ?></td>	
				<td class="text-center"><?php echo date('M d, Y g:i A',strtotime($rental->created_at)); ?></td>
				<td class="text-center"><a href="<?php echo URL::route('admin.rental-rentals.edit', $rental->rental_id); ?>" title="Edit">Edit</a></td>
				<td class="text-center">
					<?php echo Form::open(array('route' => array('admin.rental-rentals.destroy', $rental->rental_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 rentals yet.</td>
			</tr>
		<?php endif; ?>
		</tbody>
	</table>
	
	<div class="pagination"><?php echo $rentals->links(); ?></div>

<?php $__env->stopSection(); ?>