<?php if (isset($component)) { $__componentOriginal91fdd17964e43374ae18c674f95cdaa3 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal91fdd17964e43374ae18c674f95cdaa3 = $attributes; } ?>
<?php $component = App\View\Components\AdminLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AdminLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
    <?php echo $__env->make('admin.tour_guide.send_contract', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
    <?php if(!empty($breadcrumbs)): ?>
        <?php if (isset($component)) { $__componentOriginal360d002b1b676b6f84d43220f22129e2 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal360d002b1b676b6f84d43220f22129e2 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.breadcrumbs','data' => ['items' => $breadcrumbs]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('breadcrumbs'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['items' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($breadcrumbs)]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal360d002b1b676b6f84d43220f22129e2)): ?>
<?php $attributes = $__attributesOriginal360d002b1b676b6f84d43220f22129e2; ?>
<?php unset($__attributesOriginal360d002b1b676b6f84d43220f22129e2); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal360d002b1b676b6f84d43220f22129e2)): ?>
<?php $component = $__componentOriginal360d002b1b676b6f84d43220f22129e2; ?>
<?php unset($__componentOriginal360d002b1b676b6f84d43220f22129e2); ?>
<?php endif; ?>
    <?php endif; ?>
    <?php if (isset($component)) { $__componentOriginal2342e1caa3b5224183b4572420a79d31 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal2342e1caa3b5224183b4572420a79d31 = $attributes; } ?>
<?php $component = App\View\Components\Message::resolve(['type' => 'success','message' => 'success'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('message'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\Message::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal2342e1caa3b5224183b4572420a79d31)): ?>
<?php $attributes = $__attributesOriginal2342e1caa3b5224183b4572420a79d31; ?>
<?php unset($__attributesOriginal2342e1caa3b5224183b4572420a79d31); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal2342e1caa3b5224183b4572420a79d31)): ?>
<?php $component = $__componentOriginal2342e1caa3b5224183b4572420a79d31; ?>
<?php unset($__componentOriginal2342e1caa3b5224183b4572420a79d31); ?>
<?php endif; ?>
    <?php if (isset($component)) { $__componentOriginal2342e1caa3b5224183b4572420a79d31 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal2342e1caa3b5224183b4572420a79d31 = $attributes; } ?>
<?php $component = App\View\Components\Message::resolve(['type' => 'danger','message' => 'error'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('message'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\Message::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal2342e1caa3b5224183b4572420a79d31)): ?>
<?php $attributes = $__attributesOriginal2342e1caa3b5224183b4572420a79d31; ?>
<?php unset($__attributesOriginal2342e1caa3b5224183b4572420a79d31); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal2342e1caa3b5224183b4572420a79d31)): ?>
<?php $component = $__componentOriginal2342e1caa3b5224183b4572420a79d31; ?>
<?php unset($__componentOriginal2342e1caa3b5224183b4572420a79d31); ?>
<?php endif; ?>

    <!-- Search Filters -->
    <div class="mb-4 bg-white p-4 shadow rounded-lg">
       <!-- Tour Guide Name with search icon -->
       <div class="relative mb-4">
            <input type="text" id="name" class="w-full py-1 pl-4 pr-12 rounded-md border border-gray-300 text-gray-700 text-sm placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-gray-800 focus:border-gray-800 transition duration-100" placeholder="<?php echo e(__('common.search_tour_guide_name')); ?>">
            <!-- Search icon inside input -->
            <div class="absolute inset-y-0 right-0 flex items-center px-4 pointer-events-none text-gray-400 p-2">
                <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none"
                    viewBox="0 0 24 24" stroke="currentColor">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                        d="M21 21l-4.35-4.35M16.65 16.65A7.5 7.5 0 1116.65 2.5a7.5 7.5 0 010 14.15z" />
                </svg>
            </div>
        </div>
        <hr class="my-3">
        
        <div class="flex flex-row gap-2 mb-2">
            <!-- Status -->
            <div class="flex flex-col sm:w-1/2 md:w-1/4">
                <label for="status" class="text-gray-600 text-sm font-medium mb-2"><?php echo e(__('common.status')); ?></label>
                <select id="status" class="p-1 rounded-md border border-gray-300 text-gray-700 text-sm placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-gray-800 focus:border-gray-800 transition duration-100">
                    <option value="" selected disabled><?php echo e(__('common.select_status')); ?></option>
                    <option value="All">All</option>
                    <option value="0">Not Active</option>
                    <option value="1">Active</option>
                    <option value="2">Applied</option>
                    <option value="3">Interiewed</option>
                    <option value="4">Declined</option>
                    <option value="5">Rejected</option>
                </select>
            </div>

            <!-- Region -->
            <div class="flex flex-col w-full sm:w-1/2 md:w-1/4">
                <label for="region" class="text-gray-600 text-sm font-medium mb-2"><?php echo e(__('common.region')); ?></label>
                <select id="region" class="p-1 rounded-md border border-gray-300 text-gray-700 text-sm placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:border-gray-400 transition duration-100">
                    <option value="" selected disabled><?php echo e(__('common.select_a_region')); ?></option>
                    <?php $__currentLoopData = $regions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $region): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($region->id); ?>"><?php echo e($region->eng_name); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </div>

            <!-- Prefecture -->
            <div class="flex flex-col w-full sm:w-1/2 md:w-1/4">
                <label for="prefecture" class="text-gray-600 text-sm font-medium mb-2"><?php echo e(__('common.prefecture')); ?></label>
                <select id="prefecture" class="p-1 rounded-md border border-gray-300 text-gray-700 text-sm placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-gray-800 focus:border-gray-800 transition duration-100">
                    <option value="" selected disabled><?php echo e(__('common.select_a_prefecture')); ?></option>
                </select>
            </div>

            <!-- Position -->
            <div class="flex flex-col w-full sm:w-1/2 md:w-1/4">
                <label for="position" class="text-gray-600 text-sm font-medium mb-2"><?php echo e(__('common.position')); ?></label>
                <select id="position" class="p-1 rounded-md border border-gray-300 text-gray-700 text-sm placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-gray-800 focus:border-gray-800 transition duration-100">
                    <option value="" selected disabled><?php echo e(__('common.select_position')); ?></option>
                    <option value="All">All</option>
                    <option value="Tour Guide">Tour Guide</option>
                    <option value="Tour Support">Tour Support</option>
                    <option value="Photographer">Photographer</option>
                </select>
            </div>

            <!-- Invoice Registration -->
            <div class="flex flex-col w-full sm:w-1/2 md:w-1/4">
                <label for="invoice" class="text-gray-600 text-sm font-medium mb-2"><?php echo e(__('common.invoice_registration')); ?></label>
                <select id="invoice" class="p-1 rounded-md border border-gray-300 text-gray-700 text-sm placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-gray-800 focus:border-gray-800 transition duration-100">
                    <option value="" selected disabled><?php echo e(__('common.invoice_registration')); ?></option>
                    <option value="registered">Registered</option>
                    <option value="not_registered">Not Registered</option>
                </select>
            </div>
        </div>
        <!-- Reset Button -->
        <div class="">
            <button id="" class="mt-2 px-3 py-1 h-8 text-sm text-white rounded-md py-0" style="background-color: #2E8B57;">
                <?php echo e(__('common.apply_filter')); ?>

            </button>
            <button id="resetFilters" class="text-sm font-semibold text-black bg-white">
                <?php echo e(__('common.clear_all')); ?>

            </button>
        </div>
    </div>

    <!-- Table -->
    <div class="p-6 bg-white rounded-lg shadow-md">
        <div class="overflow-x-auto">
            <table class="min-w-full divide-y divide-gray-200">
                <thead>
                    <tr>
                        <th class="px-1 py-3 text-center">
                            <input type="checkbox" id="selectAll" class="border-1 border-gray-400" style="border-radius: 5px"/>
                        </th>
                        <th class="px-2 py-3 text-xs font-medium text-left text-gray-500 dark:text-gray-400">
                            <div class="flex items-center justify-between">
                                <?php echo e(__('common.status')); ?>

                                <a href="#">
                                    <svg width="8" height="10" viewBox="0 0 8 10" fill="none" xmlns="http://www.w3.org/2000/svg">
                                        <path d="M1.42712 6.35451L4.00017 8.82257L6.57322 6.35451" stroke="#8A8C92" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
                                        <path d="M1.42712 3.64618L4.00017 1.17745L6.57322 3.64618" stroke="#8A8C92" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
                                    </svg>
                                </a>
                            </div>

                        </th>
                        <th class="px-2 py-3 text-xs font-medium text-left text-gray-500 dark:text-gray-400">
                            <div class="flex items-center justify-between">
                                <?php echo e(__('common.first_name')); ?>

                                <a href="#">
                                    <svg width="8" height="10" viewBox="0 0 8 10" fill="none" xmlns="http://www.w3.org/2000/svg">
                                        <path d="M1.42712 6.35451L4.00017 8.82257L6.57322 6.35451" stroke="#8A8C92" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
                                        <path d="M1.42712 3.64618L4.00017 1.17745L6.57322 3.64618" stroke="#8A8C92" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
                                        </svg>
                                </a>
                            </div>
                        </th>
                        <th class="px-2 py-3 text-xs font-medium text-left text-gray-500 dark:text-gray-400">
                            <div class="flex items-center justify-between">
                                <?php echo e(__('common.last_name')); ?>

                                <a href="#">
                                    <svg width="8" height="10" viewBox="0 0 8 10" fill="none" xmlns="http://www.w3.org/2000/svg">
                                        <path d="M1.42712 6.35451L4.00017 8.82257L6.57322 6.35451" stroke="#8A8C92" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
                                        <path d="M1.42712 3.64618L4.00017 1.17745L6.57322 3.64618" stroke="#8A8C92" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
                                        </svg>
                                </a>
                            </div>
                        </th>
                        <th class="px-2 py-3 text-xs font-medium text-left text-gray-500 dark:text-gray-400">
                            <div class="flex items-center justify-between">
                                <?php echo e(__('common.email')); ?>

                                <a href="#">
                                    <svg width="8" height="10" viewBox="0 0 8 10" fill="none" xmlns="http://www.w3.org/2000/svg">
                                        <path d="M1.42712 6.35451L4.00017 8.82257L6.57322 6.35451" stroke="#8A8C92" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
                                        <path d="M1.42712 3.64618L4.00017 1.17745L6.57322 3.64618" stroke="#8A8C92" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
                                        </svg>
                                </a>
                            </div>
                        </th>
                        <th class="px-2 py-3 text-xs font-medium text-left text-gray-500 dark:text-gray-400">
                            <div class="flex items-center justify-between">
                                <?php echo e(__('common.phone')); ?>

                                <a href="#">
                                    <svg width="8" height="10" viewBox="0 0 8 10" fill="none" xmlns="http://www.w3.org/2000/svg">
                                        <path d="M1.42712 6.35451L4.00017 8.82257L6.57322 6.35451" stroke="#8A8C92" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
                                        <path d="M1.42712 3.64618L4.00017 1.17745L6.57322 3.64618" stroke="#8A8C92" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
                                        </svg>
                                </a>
                            </div>
                        </th>
                        <th class="px-2 py-3 text-xs font-medium text-left text-gray-500 dark:text-gray-400">
                            <div class="flex items-center justify-between">
                                <?php echo e(__('common.region')); ?>

                                <a href="#">
                                    <svg width="8" height="10" viewBox="0 0 8 10" fill="none" xmlns="http://www.w3.org/2000/svg">
                                        <path d="M1.42712 6.35451L4.00017 8.82257L6.57322 6.35451" stroke="#8A8C92" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
                                        <path d="M1.42712 3.64618L4.00017 1.17745L6.57322 3.64618" stroke="#8A8C92" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
                                        </svg>
                                </a>
                            </div>
                        </th>
                        <th class="px-2 py-3 text-xs font-medium text-left text-gray-500 dark:text-gray-400">
                            <div class="flex items-center justify-between">
                                <?php echo e(__('common.prefecture')); ?>

                                <a href="#">
                                    <svg width="8" height="10" viewBox="0 0 8 10" fill="none" xmlns="http://www.w3.org/2000/svg">
                                        <path d="M1.42712 6.35451L4.00017 8.82257L6.57322 6.35451" stroke="#8A8C92" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
                                        <path d="M1.42712 3.64618L4.00017 1.17745L6.57322 3.64618" stroke="#8A8C92" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
                                        </svg>
                                </a>
                            </div>
                        </th>
                        <th class="px-2 py-3 text-xs font-medium text-left text-gray-500 dark:text-gray-400"><?php echo e(__('common.position')); ?></th>
                        <th class="px-2 py-3"></th>
                    </tr>
                </thead>
                <tbody id="userTable">
                    <?php $__currentLoopData = $tour_guides; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $guide): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr x-data="{ open: false, hovered: false }" @mouseenter="hovered = true" @mouseleave="hovered = false" class="border-b hover:bg-gray-50 transition">
                            <td class="px-2 py-3">
                                <input type="checkbox" class="guideCheckbox border-1 border-gray-300" style="border-radius: 5px" value="<?php echo e($guide->id); ?>" />
                            </td>
                            <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100"><?php echo e($guide->status_text); ?></td>
                            <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100"><?php echo e($guide->first_name); ?></td>
                            <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100"><?php echo e($guide->last_name); ?></td>
                            <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100"><?php echo e($guide->email); ?></td>
                            <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100"><?php echo e($guide->phone); ?></td>
                            <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100"><?php echo e($guide->region->eng_name ?? 'N/A'); ?></td>
                            <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100"><?php echo e($guide->prefecture->eng_name ?? 'N/A'); ?></td>
                            <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100"><?php echo e($guide->position); ?></td>
                            <td class="relative">
                                <div class="relative">
                                    <!-- Three-dot button -->
                                    <button x-show="hovered" @click="open = !open" class="text-2xl font-bold text-gray-600 hover:text-gray-900 focus:outline-none transition-opacity">
                                        <i class="fas fa-ellipsis-v"></i>
                                    </button>
                                    <!-- Dropdown Menu -->
                                    <div x-show="open" @click.away="open = false" class="absolute right-0 mt-2 w-48 bg-white border rounded-lg shadow-lg z-10">
                                        <a href="/admin/tour-guides/<?php echo e($guide->id); ?>" class="flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100">
                                            <i class="fas fa-eye mr-2"></i>&nbsp;
                                            View
                                        </a>
                                        <a href="<?php echo e(route('admin.tour-guides.edit', $guide)); ?>" class="flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100">
                                            <i class="fas fa-edit mr-2"></i>&nbsp;
                                            Edit
                                        </a>
                                        <?php if($guide->status == 1): ?>   <!-- Active -->
                                            <!-- Send Contract -->
                                            <button type="button" onclick="populateModal(<?php echo e(json_encode($guide)); ?>)"
                                                class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100"
                                                data-bs-toggle="modal" data-bs-target="#sendContractModal">
                                                <i class="fas fa-paper-plane"></i>&nbsp;
                                                Send Contract
                                            </button>
                                            <!-- Send Password Reset -->
                                            <form method="POST" action="<?php echo e(route('admin.tour-guides.send-reset-password')); ?>">
                                                <?php echo csrf_field(); ?>
                                                <input type="hidden" name="email" value="<?php echo e($guide->email); ?>">
                                                <button type="submit" class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100">
                                                    <i class="fas fa-key"></i>&nbsp; Send Password Reset
                                                </button>
                                            </form>
                                            <!-- Login Without Password -->
                                            <form method="POST" action="<?php echo e(route('admin.tour-guides.login-without-password')); ?>">
                                                <?php echo csrf_field(); ?>
                                                <input type="hidden" name="email" value="<?php echo e($guide->email); ?>">
                                                <button type="submit" class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100">
                                                    <i class="fas fa-lock"></i>&nbsp; Login Without Password
                                                </button>
                                            </form>

                                        <?php elseif($guide->status == 2): ?>   <!-- Applied -->
                                            <form action="<?php echo e(route('admin.tour-guides.interview', $guide->id)); ?>" method="POST">
                                                <?php echo csrf_field(); ?>
                                                <button type="submit"
                                                    class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100"
                                                    onclick="return confirm('Are you sure you want to switch to Interviewed?');">
                                                    <i class="fas fa-user-check mr-2"></i>&nbsp;
                                                    Switch to Interviewed
                                                </button>
                                            </form>
                                        <?php elseif($guide->status == 3): ?>  <!-- Interviewed -->
                                            <button type="button" onclick="populateModal(<?php echo e(json_encode($guide)); ?>)"
                                                class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100"
                                                data-bs-toggle="modal" data-bs-target="#sendContractModal">
                                                <i class="fas fa-paper-plane"></i>&nbsp;
                                                Send Contract
                                            </button>
                                            <form action="<?php echo e(route('admin.tour-guides.active', $guide->id)); ?>" method="POST">
                                                <?php echo csrf_field(); ?>
                                                <button type="submit"
                                                    class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100"
                                                    onclick="return confirm('Are you sure you want to activate this tour guide?');">
                                                    <i class="fas fa-user-plus mr-2"></i>&nbsp;
                                                    Make Active User
                                                </button>
                                            </form>
                                            <form action="<?php echo e(route('admin.tour-guides.reject', $guide->id)); ?>" method="POST">
                                                <?php echo csrf_field(); ?>
                                                <button type="submit"
                                                    class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100"
                                                    onclick="return confirm('Are you sure you want to reject this tour guide?');">
                                                    <i class="fas fa-user-slash mr-2"></i>&nbsp;
                                                    JA Reject
                                                </button>
                                            </form>
                                            <form action="<?php echo e(route('admin.tour-guides.decline', $guide->id)); ?>" method="POST">
                                                <?php echo csrf_field(); ?>
                                                <button type="submit"
                                                    class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100"
                                                    onclick="return confirm('Are you sure you want to decline this tour guide?');">
                                                    <i class="fas fa-user-times mr-2"></i>&nbsp;
                                                    TG Decline
                                                </button>
                                            </form>

                                            <button type="button" class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100" data-bs-toggle="modal" data-bs-target="#deleteModal<?php echo e($guide->id); ?>">
                                                <i class="fas fa-trash mr-2"></i>&nbsp;
                                                Delete
                                            </button>
                                            <?php if (isset($component)) { $__componentOriginal37b7f052626c638ba0443fdb400d6f57 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal37b7f052626c638ba0443fdb400d6f57 = $attributes; } ?>
<?php $component = App\View\Components\DeleteModal::resolve(['type' => 'Tour Guide','id' => $guide->id,'name' => $guide->first_name . ' ' . $guide->last_name,'route' => 'admin.tour-guides.destroy'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('delete-modal'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\DeleteModal::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal37b7f052626c638ba0443fdb400d6f57)): ?>
<?php $attributes = $__attributesOriginal37b7f052626c638ba0443fdb400d6f57; ?>
<?php unset($__attributesOriginal37b7f052626c638ba0443fdb400d6f57); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal37b7f052626c638ba0443fdb400d6f57)): ?>
<?php $component = $__componentOriginal37b7f052626c638ba0443fdb400d6f57; ?>
<?php unset($__componentOriginal37b7f052626c638ba0443fdb400d6f57); ?>
<?php endif; ?>

                                        <?php elseif($guide->status == 4): ?>  <!-- Decline -->
                                            <form action="<?php echo e(route('admin.tour-guides.interview', $guide->id)); ?>" method="POST">
                                                <?php echo csrf_field(); ?>
                                                <button type="submit"
                                                    class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100"
                                                    onclick="return confirm('Are you sure you want to switch to Interviewed?');">
                                                    <i class="fas fa-user-check mr-2"></i>&nbsp;
                                                    Switch to Interviewed
                                                </button>
                                            </form>
                                            <button type="button" class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100" data-bs-toggle="modal" data-bs-target="#deleteModal<?php echo e($guide->id); ?>">
                                                <i class="fas fa-trash mr-2"></i>&nbsp;
                                                Delete
                                            </button>
                                            <?php if (isset($component)) { $__componentOriginal37b7f052626c638ba0443fdb400d6f57 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal37b7f052626c638ba0443fdb400d6f57 = $attributes; } ?>
<?php $component = App\View\Components\DeleteModal::resolve(['type' => 'Tour Guide','id' => $guide->id,'name' => $guide->first_name . ' ' . $guide->last_name,'route' => 'admin.tour-guides.destroy'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('delete-modal'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\DeleteModal::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal37b7f052626c638ba0443fdb400d6f57)): ?>
<?php $attributes = $__attributesOriginal37b7f052626c638ba0443fdb400d6f57; ?>
<?php unset($__attributesOriginal37b7f052626c638ba0443fdb400d6f57); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal37b7f052626c638ba0443fdb400d6f57)): ?>
<?php $component = $__componentOriginal37b7f052626c638ba0443fdb400d6f57; ?>
<?php unset($__componentOriginal37b7f052626c638ba0443fdb400d6f57); ?>
<?php endif; ?>
                                        <?php endif; ?>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>
            <div class="mt-4">
                <?php echo e($tour_guides->links('vendor.pagination.tailwind', ['perPage' => $perPage])); ?>

            </div>
        </div>
    </div>
    <script>
        $(document).ready(function () {
            $("#selectAll").change(function () {
                $(".guideCheckbox").prop("checked", $(this).prop("checked"));
            });

            function fetchData() {
                let status = $('#status').val();
                let region = $('#region').val();
                let prefecture = $('#prefecture').val();
                let city = $('#city').val();
                let name = $('#name').val();
                let position = $('#position').val();
                let invoice = $('#invoice').val();

                $.ajax({
                    url: "/admin/tour-guides/search",
                    type: 'GET',
                    data: {
                        status: status,
                        region: region,
                        prefecture: prefecture,
                        city: city,
                        name: name,
                        position: position,
                        invoice: invoice
                    },
                    success: function (data) {

                        $('#userTable').html('');
                        data.forEach(function (guide) {
                            $('#userTable').append(`
                                <tr>
                                    <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100 text-center">
                                        <input type="checkbox" class="guideCheckbox" value="${guide.id}" />
                                    </td>
                                    <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100 text-center">${guide.status_text}</td>
                                    <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100 text-center">${guide.first_name}</td>
                                    <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100 text-center">${guide.last_name}</td>
                                    <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100 text-center">${guide.email}</td>
                                    <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100 text-center">${guide.phone}</td>
                                    <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100 text-center">${guide.region?.eng_name || "N/A"}</td>
                                    <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100 text-center">${guide.prefecture?.eng_name || "N/A"}</td>
                                    <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100 text-center">${guide.city?.eng_name || "N/A"}</td>
                                    <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100 text-center">${guide.position}</td>
                                    <td class="px-2 py-3 text-sm font-medium text-gray-900 dark:text-gray-100 text-center relative">
                                        <div x-data="{ open: false }" class="relative">
                                            <button @click="open = !open" class="text-2xl font-bold text-gray-600 hover:text-gray-900 focus:outline-none">
                                                <i class="fas fa-ellipsis-v"></i>
                                            </button>
                                            <div x-show="open" @click.away="open = false" class="absolute right-0 mt-2 w-48 bg-white border rounded-lg shadow-lg z-10">
                                                <a href="/admin/tour-guides/${guide.id}" class="flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100">
                                                    <i class="fas fa-eye mr-2"></i>&nbsp; View
                                                </a>
                                                <a href="/admin/tour-guides/${guide.id}/edit" class="flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100">
                                                    <i class="fas fa-edit mr-2"></i>&nbsp; Edit
                                                </a>
                                                ${guide.status == 1 ? `
                                                    <button type="button" onclick="populateModal(${JSON.stringify(guide)})"
                                                        class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100"
                                                        data-bs-toggle="modal" data-bs-target="#sendContractModal">
                                                        <i class="fas fa-paper-plane"></i>&nbsp; Send Contract
                                                    </button>
                                                    <form method="POST" action="/admin/tour-guides/send-reset-password">
                                                        <input type="hidden" name="email" value="${guide.email}">
                                                        <button type="submit" class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100">
                                                            <i class="fas fa-key"></i>&nbsp; Send Password Reset
                                                        </button>
                                                    </form>
                                                    <form method="POST" action="/admin/tour-guides/login-without-password">
                                                        <input type="hidden" name="email" value="${guide.email}">
                                                        <button type="submit" class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100">
                                                            <i class="fas fa-lock"></i>&nbsp; Login Without Password
                                                        </button>
                                                    </form>
                                                ` : ''}
                                               ${guide.status == 2 ? `
                                                    <form action="/admin/tour-guides/interview/${guide.id}" method="POST">
                                                        <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
                                                        <button type="submit" class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100"
                                                            onclick="return confirm('Are you sure you want to switch to Interviewed?');">
                                                            <i class="fas fa-user-check mr-2"></i>&nbsp; Switch to Interviewed
                                                        </button>
                                                    </form>
                                                ` : ''}

                                               ${guide.status == 3 ? `
                                                    <button type="button" onclick="populateModal(${JSON.stringify(guide)})"
                                                        class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100"
                                                        data-bs-toggle="modal" data-bs-target="#sendContractModal">
                                                        <i class="fas fa-paper-plane"></i>&nbsp; Send Contract
                                                    </button>
                                                    <form action="/admin/tour-guides/active/${guide.id}" method="POST">
                                                        <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
                                                        <button type="submit" class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100"
                                                            onclick="return confirm('Are you sure you want to activate this tour guide?');">
                                                            <i class="fas fa-user-plus mr-2"></i>&nbsp; Make Active User
                                                        </button>
                                                    </form>
                                                    <form action="/admin/tour-guides/reject/${guide.id}" method="POST">
                                                        <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
                                                        <button type="submit" class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100"
                                                            onclick="return confirm('Are you sure you want to reject this tour guide?');">
                                                            <i class="fas fa-user-slash mr-2"></i>&nbsp; JA Reject
                                                        </button>
                                                    </form>
                                                    <form action="/admin/tour-guides/decline/${guide.id}" method="POST">
                                                        <?php echo csrf_field(); ?>
                                                        <button type="submit"
                                                            class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100"
                                                            onclick="return confirm('Are you sure you want to decline this tour guide?');">
                                                            <i class="fas fa-user-times mr-2"></i>&nbsp; TG Decline
                                                        </button>
                                                    </form>
                                                    <button type="button" class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100" data-bs-toggle="modal" data-bs-target="#deleteModal${guide.id}">
                                                        <i class="fas fa-trash mr-2"></i>&nbsp; Delete
                                                    </button>
                                                ` : ''}

                                                ${guide.status == 4 ? `
                                                    <form action="/admin/tour-guides/interview/${guide.id}" method="POST">
                                                        <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
                                                        <button type="submit" class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100"
                                                            onclick="return confirm('Are you sure you want to switch to Interviewed?');">
                                                            <i class="fas fa-user-check mr-2"></i>&nbsp; Switch to Interviewed
                                                        </button>
                                                    </form>
                                                    <button type="button" class="w-full text-left flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100" data-bs-toggle="modal" data-bs-target="#deleteModal${guide.id}">
                                                        <i class="fas fa-trash mr-2"></i>&nbsp; Delete
                                                    </button>
                                                ` : ''}
                                            </div>
                                        </div>
                                    </td>

                                </tr>
                            `);
                        });
                        setTimeout(() => {
                            Alpine.initTree(document.body);
                        }, 100);
                    }
                });
            }

            // Filter Events
            $('#status, #region, #prefecture, #city, #name, #position, #invoice').on('change keyup', function () {
                fetchData();
            });

            $('#region').change(function () {
                let regionId = $(this).val();
                if (!regionId) {
                    $('#prefecture').html('<option value="">Please select a prefecture</option>');
                    return;
                }

                $.get("<?php echo e(route('get.prefectures')); ?>?region_id=" + regionId, function (data) {
                    $('#prefecture').html('<option value="">Please select a prefecture</option>');
                    data.forEach(pref => {
                        $('#prefecture').append(`<option value="${pref.id}">${pref.eng_name}</option>`);
                    });
                });
            });

            $('#prefecture').change(function () {
                let prefectureId = $(this).val();
                if (!prefectureId) {
                    $('#city').html('<option value="">Please select a city</option>');
                    return;
                }

                $.get("<?php echo e(route('get.cities')); ?>?prefecture_id=" + prefectureId, function (data) {
                    $('#city').html('<option value="">Please select a city</option>');
                    data.forEach(city => {
                        $('#city').append(`<option value="${city.id}">${city.eng_name}</option>`);
                    });
                });
            });

            // Reset Filters
            $('#resetFilters').click(function () {
                resetFilters();
                fetchData();
            });
        });
        function resetFilters() {
            $('#status, #region, #prefecture, #city, #name, #position, #invoice').val('');
        }
        document.addEventListener("DOMContentLoaded", function() {
            setInterval(() => {
                document.querySelectorAll('.modal-backdrop').forEach(backdrop => {
                    backdrop.style.display = 'none'; // Hide forcibly
                    backdrop.classList.remove('show'); // Remove 'show' class if applied
                });
                document.body.classList.remove('modal-open'); // Body scrolling enable
            }, 500);
        });
        window.onload = resetFilters;
        window.onload = fetchData;
    </script>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal91fdd17964e43374ae18c674f95cdaa3)): ?>
<?php $attributes = $__attributesOriginal91fdd17964e43374ae18c674f95cdaa3; ?>
<?php unset($__attributesOriginal91fdd17964e43374ae18c674f95cdaa3); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal91fdd17964e43374ae18c674f95cdaa3)): ?>
<?php $component = $__componentOriginal91fdd17964e43374ae18c674f95cdaa3; ?>
<?php unset($__componentOriginal91fdd17964e43374ae18c674f95cdaa3); ?>
<?php endif; ?>
<?php /**PATH C:\xampp8.2\htdocs\Portal\resources\views/admin/tour_guide/index.blade.php ENDPATH**/ ?>