<?php $__env->startSection('content'); ?>
    <div class="panel panel-primary">
        <div class="panel-heading">Správa rezervací ve Vašem ubytování</div>
        <div class="panel-body">
            <?php echo e(Form::open(['class' => 'form-horizontal',  'route' => array('chooseRoom',$accommodation->accommodation_id)])); ?>

            <div class="form-group<?php echo e($errors->has('rooms') ? ' has-error' : ''); ?>">
                <label class="col-md-4 control-label">Vytvořit rezervaci pokoje</label>
                <div class="col-md-6">
                    <?php echo e(Form::select('rooms', $rooms,  null, ['class' => 'form-control' ])); ?> <?php if($errors->has('persons')): ?>
                        <span class="help-block">
                            <strong><?php echo e($errors->first('rooms')); ?></strong>
                        </span>
                    <?php endif; ?>
                </div>
                <?php echo e(Form::submit('Vytvořit rezervaci', array('class'=>'btn btn-primary'))); ?>

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

            </div>
        </div>
        <div class="panel-body">
            <?php echo $__env->make('flash::message', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

            <div class="table-responsive">
                <table class="table">
                    <tr>
                        <th>Jméno a příjmení</th>
                        <th>E-mail</th>
                        <th>Telefon</th>
                        <th>Pokoj</th>
                        <th>Od</th>
                        <th>Do</th>
                        <th>Počet osob</th>
                        <th>Potvrzení</th>
                        <th>Upravit</th>
                        <th>Odstranit</th>
                    </tr>
                    <?php $__currentLoopData = $reservations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $reservation): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td><?php echo e($reservation->customer_fname); ?> <?php echo e($reservation->customer_lname); ?></td>
                            <td><?php echo e($reservation->customer_email); ?></td>
                            <td><?php echo e($reservation->customer_phone_number); ?></td>
                            <td><?php echo e($reservation->room_name); ?></td>
                            <td><?php echo e(date('d. m. Y', strtotime($reservation->date_start))); ?></td>
                            <td><?php echo e(date('d. m. Y', strtotime($reservation->date_end))); ?></td>
                            <td><?php echo e($reservation->persons); ?></td>
                            <td><?php if($reservation->confirmation == 'true'): ?>
                                    Potvrzeno
                                <?php else: ?>
                                    <?php echo e(Form::open(array('method'=>'post', 'route' => array('confirmReservation', $reservation->reservation_id)))); ?>

                                    <?php echo e(Form::hidden('reservation_id', $reservation->reservation_id)); ?>

                                    <?php echo e(Form::submit('Potvrdit', array('class'=>'btn btn-primary'))); ?>

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

                                <?php endif; ?>
                            </td>
                            <td>
                                <a href="<?php echo e(url('edit_reservation/' . $reservation->reservation_id)); ?>">
                                    <button type="button" class="btn btn-primary">Upravit</button>
                                </a>
                            </td>
                            <td><?php echo e(Form::open(array('method'=>'post', 'route' => array('deleteReservation', $reservation->reservation_id)))); ?>

                                <?php echo e(Form::hidden('reservation_id', $reservation->reservation_id)); ?>

                                <?php echo e(Form::submit('Odstranit', array('class'=>'btn btn-primary'))); ?>

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

                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </table>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

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