

<?php $__env->startSection('title', 'Beach Reservations'); ?>

<?php $__env->startSection('content'); ?>
<div class="content-wrapper">
    <div class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1 class="m-0">Beach Reservations</h1>
                </div>
                
            </div>
        </div>
    </div>

    <section class="content">
        <div class="container-fluid">
            <div class="card">
                <div class="card-header">
                    <h3 class="card-title">All Beach Reservations</h3>
                </div>
                <div class="card-body">
                    <form action="<?php echo e(route('beach-reservations.index')); ?>" method="GET" class="mb-4">
                        <div class="row">
                            <div class="col-md-3">
                                <div class="form-group">
                                    <div class="input-group">
                                        <input type="text" name="search" class="form-control" placeholder="Search by full name..." value="<?php echo e(request('search')); ?>">
                                        <div class="input-group-append">
                                            <button type="submit" class="btn btn-primary">
                                                <i class="fas fa-search"></i>
                                            </button>
                                            <?php if(request('search')): ?>
                                                <a href="<?php echo e(route('beach-reservations.index', array_merge(request()->except('search'), ['search' => '']))); ?>" class="btn btn-danger">
                                                    <i class="fas fa-times"></i>
                                                </a>
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-3">
                                <div class="form-group">
                                    <select name="status" class="form-control" onchange="this.form.submit()">
                                        <option value="">All Statuses</option>
                                        <option value="pending" <?php echo e(request('status') == 'pending' ? 'selected' : ''); ?>>Pending</option>
                                        <option value="approved" <?php echo e(request('status') == 'approved' ? 'selected' : ''); ?>>Approved</option>
                                        <option value="rejected" <?php echo e(request('status') == 'rejected' ? 'selected' : ''); ?>>Rejected</option>
                                    </select>
                                </div>
                            </div>
                            <div class="col-md-3">
                                <div class="form-group">
                                    <input type="date" name="date_from" class="form-control" placeholder="Date From" value="<?php echo e(request('date_from')); ?>" onchange="this.form.submit()">
                                </div>
                            </div>
                            <div class="col-md-3">
                                <div class="form-group">
                                    <input type="date" name="date_to" class="form-control" placeholder="Date To" value="<?php echo e(request('date_to')); ?>" onchange="this.form.submit()">
                                </div>
                            </div>
                        </div>
                    </form>

                    <div class="table-responsive">
                        <table class="table table-bordered table-striped">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>Customer</th>
                                    <th>Reservation Date</th>
                                    <th>Persons</th>
                                    <th>Instagram</th>
                                    <th>Status</th>
                                    <th>Created</th>
                                    <th>Actions</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $__empty_1 = true; $__currentLoopData = $reservations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $reservation): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <tr>
                                        <td><?php echo e($reservation->id); ?></td>
                                        <td>
                                            <div>
                                                <strong><?php echo e($reservation->full_name); ?></strong>
                                                <br>
                                                <small class="text-muted"><?php echo e($reservation->user->email); ?></small>
                                            </div>
                                        </td>
                                        <td><?php echo e($reservation->formatted_date); ?></td>
                                        <td>
                                            <span class="badge bg-info text-white"><?php echo e($reservation->number_of_persons); ?></span>
                                        </td>
                                        <td>
                                            <a href="<?php echo e($reservation->instagram_link); ?>" target="_blank" class="text-primary">
                                                <i class="fab fa-instagram"></i> View Profile
                                            </a>
                                        </td>
                                        <td>
                                            <?php
                                                $statusColors = [
                                                    'pending' => ['bg' => 'bg-warning', 'text' => 'text-dark'],
                                                    'approved' => ['bg' => 'bg-success', 'text' => 'text-white'],
                                                    'rejected' => ['bg' => 'bg-danger', 'text' => 'text-white']
                                                ];
                                                $status = $reservation->status;
                                                $colors = $statusColors[$status];
                                            ?>
                                            <span class="badge <?php echo e($colors['bg']); ?> <?php echo e($colors['text']); ?> p-2">
                                                <?php echo e(ucfirst($status)); ?>

                                            </span>
                                        </td>
                                        <td><?php echo e($reservation->created_at->format('M d, Y H:i')); ?></td>
                                        <td>
                                            <div class="btn-group" role="group">
                                                <a href="<?php echo e(route('beach-reservations.show', $reservation)); ?>" class="btn btn-sm btn-info" title="View Details">
                                                    <i class="fas fa-eye"></i>
                                                </a>
                                                <?php if($reservation->isPending()): ?>
                                                    <form method="POST" action="<?php echo e(route('beach-reservations.approve', $reservation)); ?>" class="d-inline">
                                                        <?php echo csrf_field(); ?>
                                                        <button type="submit" class="btn btn-sm btn-success" title="Approve" onclick="return confirm('Are you sure you want to approve this reservation?')">
                                                            <i class="fas fa-check"></i>
                                                        </button>
                                                    </form>
                                                    <form method="POST" action="<?php echo e(route('beach-reservations.reject', $reservation)); ?>" class="d-inline">
                                                        <?php echo csrf_field(); ?>
                                                        <button type="submit" class="btn btn-sm btn-danger" title="Reject" onclick="return confirm('Are you sure you want to reject this reservation?')">
                                                            <i class="fas fa-times"></i>
                                                        </button>
                                                    </form>
                                                <?php endif; ?>
                                            </div>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr>
                                        <td colspan="8" class="text-center">No beach reservations found</td>
                                    </tr>
                                <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="card-footer">
                    <?php echo e($reservations->appends(request()->query())->links()); ?>

                </div>
            </div>
        </div>
    </section>
</div>

<style>
.badge {
    font-size: 0.9em;
    font-weight: 500;
    padding: 0.5em 1em;
}
.badge.bg-warning {
    background-color: #ffc107 !important;
}
.badge.bg-info {
    background-color: #17a2b8 !important;
}
.badge.bg-success {
    background-color: #28a745 !important;
}
.badge.bg-danger {
    background-color: #dc3545 !important;
}
.btn-group .btn {
    margin-right: 2px;
}
.btn-group .btn:last-child {
    margin-right: 0;
}
</style>
<?php $__env->stopSection(); ?> 
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\solen-north-coast\resources\views/beach_reservations/index.blade.php ENDPATH**/ ?>