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

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

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

    <?php if(Session::has('success')): ?>
        <div class='alert alert-success'><?php echo Session::get('success'); ?></div>
    <?php elseif(Session::has('delete')): ?>
        <div class='alert alert-danger'><?php echo Session::get('delete'); ?></div>
    <?php endif; ?>

    <dl>
        <dt>Apartment</dt>
        <dd><?php echo $tenant->apartment; ?></dd>
        <dt>Building</dt>
        <dd><?php echo $tenant->building->address; ?></dd>
        <dt>Nights Used</dt>
        <dd><strong><?php echo $tenant->nights_used; ?>/<?php echo $tenant->building->total_nights; ?></strong></dd>
    </dl>

    <h1><i class="fa fa-users"></i>Upcoming Parking Requests<?php /* <a href="/logout" class="btn btn-default pull-right">Logout</a> */ ?></h1>

    <a href="parking/create" class="btn btn-success margin-bottom">Add Parking Request</a>

    <div class="table-responsive">
        <table class="table table-bordered table-striped">

            <thead>
                <tr>
                    <th>License Plate</th>
                    <th>Building</th>
                    <th>Make</th>
                    <th>Model</th>
                    <th>Colour</th>
                    <th>Start Date</th>
                    <th>End Date</th>
                    <th>Date/Time Added</th>
                    <th></th>
                </tr>
            </thead>

            <tbody>
                <?php $__empty_1 = true; foreach($parking_requests as $p): $__empty_1 = false; ?>
                    <tr>
                        <td><?php echo $p->car->license_plate; ?></td>
                        <td><?php echo $p->building->address; ?></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->start_date; ?></td>
                        <td><?php echo $p->end_date; ?></td>
                        <td><?php echo $p->created_at->format('F d, Y h:ia'); ?></td>
                        <td>
                            <?php echo Form::open(array('method' => 'delete', 'action' => array('ParkingController@destroy', $tenant->building->id, $tenant->user->username, $p->id))); ?>

                            <?php echo Form::submit('Delete', ['class' => 'btn btn-danger']); ?>

                            <?php echo Form::close(); ?>

                        </td>
                    </tr>
                <?php endforeach; if ($__empty_1): ?>
                    <tr><td colspan="12">No parking requests</td></tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>

<?php $__env->stopSection(); ?>

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