<?php $__env->startSection('pagetitle'); ?>
	Bookings <small>overview</small>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('crumbs'); ?>
	<li class="active">
		<i class="fa fa-ticket"></i> Booking
	</li>
<?php $__env->stopSection(); ?>

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

    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title pull-left"><i class="fa fa-th fa-fw"></i> Booking Panel</h3>
                    <p class="pull-right">
                        <?php if(Auth::user()->hasRole(['site-admin', 'super-user'])): ?>
                    	   <a href="<?php echo e(url('admin/bookings/create')); ?>" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> Add Booking</a>
                        <?php endif; ?>
                    </p>
                    <div class="clearfix"></div>
                </div>
                <div class="panel-body pages">
                    <?php if(isset($bookings)): ?>
                        <?php if(sizeof($bookings) == 0): ?>
                            <div class="alert alert-info">Booking list is currently empty. </div>
                        <?php else: ?>
                            <div class="table-responsive">
                                <table class="table table-bordered table-hover table-striped">
                                    <thead>
                                        <tr>
                                            <th>#</th>
                                            <th>Name</th>
                                            <th>Start Date</th>
                                            <th>End Date</th>
                                            <th>Guests</th>
                                            <th>Menu</th>
                                            <th width="100">Actions</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    	<?php foreach($bookings as $key => $b): ?>
        	                                <tr id="<?php echo e($b->id); ?>">
                                                <td><?php echo e($key +1); ?></td>
        	                                    <td><?php echo e($b->firstname); ?> <?php echo e($b->lastname); ?></td>
                                                <td><?php echo e(date('D, M d Y', strtotime($b->start_date))); ?></td>
                                                <td><?php echo e(date('D, M d Y', strtotime($b->end_date))); ?></td>
                                                <td><span class="label label-primary"><?php echo e($b->guests); ?></span></td>
                                                <td><span class="label label-primary"><?php echo e($b->menu); ?></span></td>
        	                                    <td class="text-center">
        	                                    	<div class="btn-group">
        	                                    		<button class="btn btn-warning btn-sm deltriggerbtn" data-toggle="modal" data-target="#myModal" data-id="<?php echo e($b->id); ?>"><i class="fa fa-trash"></i></button>
        	                                    		<a href="<?php echo e(url('/admin/bookings/')); ?>/<?php echo e($b->id); ?>/edit" class="btn btn-primary btn-sm"><i class="fa fa-pencil"></i></a>
        	                                    	</div>
        	                                    </td>
        	                                </tr>
                                        <?php endforeach; ?>
                                    </tbody>
                                </table>
                            </div>
                        <?php endif; ?>
                    <?php else: ?>
                        <div class="alert alert-info">
                            There are currently no bookings at this time.
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>

    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">Confirm Deletion</h4>
                </div>
                <div class="modal-body">
                    <div class="alert alert-info">
                        <p>Are you sure you wan to delete this Booking?</p>
                    </div>
                </div>
                <div class="modal-footer">
                    
                    <?php echo Form::open(['method' => 'DELETE', 'id' => 'pageDelete', 'route' => ['admin.bookings.destroy', 'test']]); ?>

                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        <?php echo Form::submit('Delete', ['class' => 'btn btn-primary']); ?>

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

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

<?php $__env->startSection('scripts'); ?>
    <script>
        $(function() {
            $('button.deltriggerbtn').click(function(e){
                var id = $(this).data('id');

                $('#pageDelete').attr('action', '<?php echo e(url("/admin/bookings/")); ?>'+'/'+id );
            });

            //delete a category

        });
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.masters.base', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>