

<?php $__env->startSection('title', 'Lists'); ?>

<?php $__env->startSection('content'); ?>

<style>
    .action-buttons {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    .action-buttons a, .action-buttons form {
        flex: 1;
    }
    .table th, .table td {
        vertical-align: middle;
    }
    .actions-column {
        width: 180px; /* Adjust this value as needed */
    }
</style>

<div class="d-flex justify-content-between mb-3">
    <h1>Lists</h1>
    <a href="<?php echo e(route('create-list')); ?>" class="btn btn-primary">New</a>
</div>

<div class="mb-3">
    <form method="GET" action="<?php echo e(route('lists')); ?>" class="form-inline">
        <div class="form-group">
            <label for="city" class="mr-2">City:</label>
            <select name="city" id="city" class="form-control mr-2">
                <option value="">All</option>
                <?php $__currentLoopData = $cities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $city): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($city); ?>" <?php echo e(request('city') == $city ? 'selected' : ''); ?>><?php echo e($city); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
        </div>
        <div class="form-group">
            <label for="search" class="mr-2">Search:</label>
            <input type="text" name="search" id="search" class="form-control mr-2" value="<?php echo e(request('search')); ?>">
        </div>
        <button type="submit" class="btn btn-primary">Filter</button>
    </form>
</div>

<table class="table table-bordered">
    <thead>
        <tr>
            <th>Sl:No</th>
            <th>City</th>
            <th>Entity Type</th>
            <th>Title</th>
            <th>Short Title</th>
            <th>Image URL</th>
            <th>Listing Order</th>
            <th class="actions-column">Actions</th>
        </tr>
    </thead>
    <tbody>
        <?php $__currentLoopData = $lists; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $list): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <tr>
            <td><?php echo e($loop->iteration); ?></td>
            <td><?php echo e($list->city); ?></td>
            <td><?php if(isset($list->entity_type->type_name)): ?> <?php echo e($list->entity_type->type_name); ?> <?php else: ?> &nbsp; <?php endif; ?></td>
            <td><?php echo e($list->title); ?></td>
            <td><?php echo e($list->short_title); ?></td>
            <td>
                <?php if($list->imageURL): ?>
                    <a href="<?php echo e($list->imageURL); ?>" target="_blank"><?php echo e($list->imageURL); ?></a>
                <?php else: ?>
                    N/A
                <?php endif; ?>
            </td>
            <td><?php echo e($list->listing_order); ?></td>

            <td>
                <div class="action-buttons">
                    <a href="<?php echo e(route('view-list', encrypt($list->id))); ?>" class="btn btn-info btn-sm">View</a>
                    <a href="<?php echo e(route('edit-list', encrypt($list->id))); ?>" class="btn btn-warning btn-sm">Edit</a>
                    <form action="<?php echo e(route('delete-list', encrypt($list->id))); ?>" method="POST" onsubmit="return confirmDeletion();" style="display:inline;">
                        <?php echo csrf_field(); ?>
                        <?php echo method_field('POST'); ?>
                        <button type="submit" class="btn btn-danger btn-sm">Delete</button>
                    </form>
                    <a href="<?php echo e(route('filter-events-by-list', encrypt($list->id))); ?>" class="btn btn-success btn-sm">Go to Events</a>
                </div>
            </td>
        </tr>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </tbody>
</table>

<script>
    function confirmDeletion() {
        return confirm('Are you sure you want to delete this item?');
    }
    </script>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/listings/resources/views/lists.blade.php ENDPATH**/ ?>