<?php $__env->startSection('title', $title); ?>
<?php $__env->startSection('ad_page_title', 'Inquiries'); ?>
<?php $__env->startSection('ad_page_subtitle', 'Contact form submissions from all pages'); ?>

<?php $__env->startSection('ad_content'); ?>
<div class="container-fluid py-4">
    <div class="d-flex flex-column flex-md-row justify-content-between align-items-md-center gap-3 mb-4">
        <div>
            <h1 class="h3 mb-1">Inquiries</h1>
            <p class="text-muted mb-0">Review contact form submissions with locale and source page.</p>
        </div>
    </div>

    <div class="card shadow-sm border-0">
        <div class="card-body p-4">
            <form action="<?php echo e(route('admin.inquiries.index')); ?>" method="GET" class="row g-3 mb-4">
                <div class="col-lg-4">
                    <input
                        type="text"
                        name="search"
                        value="<?php echo e(request('search')); ?>"
                        class="form-control"
                        placeholder="Search by name, mobile, email, message, page"
                    >
                </div>
                <div class="col-lg-2">
                    <select name="locale" class="form-select">
                        <option value="">All locales</option>
                        <option value="en" <?php if(request('locale') === 'en'): echo 'selected'; endif; ?>>EN</option>
                        <option value="ar" <?php if(request('locale') === 'ar'): echo 'selected'; endif; ?>>AR</option>
                    </select>
                </div>
                <div class="col-lg-2">
                    <input
                        type="text"
                        name="source_page"
                        value="<?php echo e(request('source_page')); ?>"
                        class="form-control"
                        placeholder="Source page"
                    >
                </div>
                <div class="col-lg-2">
                    <input type="date" name="date_from" value="<?php echo e(request('date_from')); ?>" class="form-control">
                </div>
                <div class="col-lg-2">
                    <input type="date" name="date_to" value="<?php echo e(request('date_to')); ?>" class="form-control">
                </div>
                <div class="col-lg-2 d-grid">
                    <button type="submit" class="btn btn-outline-primary">
                        <i class="fa-solid fa-magnifying-glass me-2"></i>Filter
                    </button>
                </div>
                <div class="col-lg-2 d-grid">
                    <a href="<?php echo e(route('admin.inquiries.index')); ?>" class="btn btn-outline-secondary">
                        Reset
                    </a>
                </div>
            </form>

            <div class="table-responsive">
                <table class="table table-hover align-middle mb-0">
                    <thead>
                        <tr>
                            <th style="width: 70px;">#</th>
                            <th>Contact</th>
                            <th>Message</th>
                            <th>Locale</th>
                            <th>Source</th>
                            <th>Submitted</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__empty_1 = true; $__currentLoopData = $inquiries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $inquiry): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <tr>
                                <td><?php echo e($inquiry->id); ?></td>

                                <td style="min-width: 220px;">
                                    <div class="fw-semibold"><?php echo e($inquiry->name); ?></div>
                                    <div class="small text-muted"><?php echo e($inquiry->mobile); ?></div>
                                    <div class="small text-muted"><?php echo e($inquiry->email ?: '-'); ?></div>
                                </td>

                                <td style="min-width: 280px;">
                                    <div class="small text-muted">
                                        <?php echo e(\Illuminate\Support\Str::limit((string) $inquiry->message, 140) ?: '-'); ?>

                                    </div>
                                </td>

                                <td>
                                    <span class="badge text-bg-light border"><?php echo e(strtoupper($inquiry->locale ?? 'en')); ?></span>
                                </td>

                                <td style="min-width: 230px;">
                                    <div><code><?php echo e($inquiry->source_page ?: '-'); ?></code></div>
                                    <div class="small text-muted mt-1">
                                        IP: <?php echo e($inquiry->ip_address ?: '-'); ?>

                                    </div>
                                </td>

                                <td style="min-width: 150px;">
                                    <?php echo e($inquiry->created_at?->format('Y-m-d H:i') ?: '-'); ?>

                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr>
                                <td colspan="6" class="text-center py-5 text-muted">
                                    No inquiries found.
                                </td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>

            <?php if($inquiries->hasPages()): ?>
                <div class="mt-4">
                    <?php echo e($inquiries->links()); ?>

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

<?php echo $__env->make('admin.ad_master', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/onesourceerp/public_html/project/resources/views/admin/inquiries/index.blade.php ENDPATH**/ ?>