<?php $__env->startSection('title'); ?>History <?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>

<div class="col-lg-10 col-lg-offset-1">

    <h1><i class="fa fa-users"></i> History for <?php echo $tenant->first_name; ?> <?php echo $tenant->last_name; ?></h1>

    <?php if($tenant->parking_requests()->get()->isEmpty()): ?>
    <h3>No Parking Requests</h3>
    <?php else: ?>
    <div class="table-responsive">
        <table class="table table-bordered table-striped">

            <thead>
            <tr>
                <th>License Plate</th>
                <th>Make</th>
                <th>Model
                <th>Colour</th>
                <th>Nights</th>
                <th>Apartment</th>
                <th>Active</th>
                <th>Date/Time Added</th>
            </tr>
            </thead>

            <tbody>
            <?php foreach($tenant->parking_requests()->get()->sortByDesc('created_at') as $p): ?>
            <tr>
                <td><?php echo $p->car->license_plate; ?></td>
                <td><?php echo $p->car->make; ?></td>
                <td><?php echo $p->car->model; ?></td>
                <td><?php echo $p->car->colour; ?></td>
                <td><?php echo $p->nights; ?></td>
                <td><?php echo $p->tenant->apartment; ?></td>
                <td><?php
                        if ($p->active) {
                            echo "TRUE";
                        } else {
                            echo "FALSE";
                        }
                    ?></td>
                <td><?php echo $p->created_at->format('F d, Y h:ia'); ?></td>
            </tr>
            <?php if(!empty($p->comments)): ?>
            <tr>
                <td colspan="8">
                    <div>
                        <dt>Comments</dt>
                        <dd><?php echo $p->comments; ?></dd>
                    </div>
                </td>
            </tr>
            <?php endif; ?>
            <?php endforeach; ?>
            </tbody>

        </table>
    </div>
    <?php endif; ?>

</div>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>