<?php
use Livewire\Component;
use App\Models\Faq;
?>

<div class="max-content">
    <header class="flex justify-between items-center mb-10">
        <div>
            <h1 class="text-2xl font-semibold tracking-tight">Essential Inquiries (FAQs)</h1>
            <p class="text-sm text-gray-500 mt-1">Manage the frequently asked questions shown on the about page.</p>
        </div>
        <a href="<?php echo e(route('admin.faqs.create')); ?>" wire:navigate class="btn-primary" style="background-color: #99BC85; color: white; padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px;">
            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path></svg>
            New FAQ
        </a>
    </header>

    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(session()->has('message')): ?>
        <div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded relative mb-4" role="alert">
            <span class="block sm:inline"><?php echo e(session('message')); ?></span>
        </div>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

    <div class="card">
        <div class="overflow-x-auto">
            <table>
                <thead>
                    <tr>
                        <th>Question</th>
                        <th width="150">Order</th>
                        <th class="text-right">Actions</th>
                    </tr>
                </thead>
                <tbody class="bg-white divide-y divide-gray-200">
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $faqs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $faq): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoop($loop->index); ?><?php endif; ?>
                        <tr>
                            <td class="px-6 py-4 font-medium max-w-[500px]">
                                <div class="text-sm text-gray-900"><?php echo e($faq->question); ?></div>
                                <div class="text-[11px] text-gray-400 mt-1 truncate"><?php echo e(Str::limit($faq->answer, 100)); ?></div>
                            </td>
                            <td class="px-6 py-4">
                                <input type="number" wire:change="updateOrder(<?php echo e($faq->id); ?>, $event.target.value)" class="input-field w-20 py-1" value="<?php echo e($faq->sort_order); ?>">
                            </td>
                            <td class="px-6 py-4 text-right">
                                <a href="<?php echo e(route('admin.faqs.edit', $faq->id)); ?>" wire:navigate class="text-sage font-semibold text-xs px-2" style="color: #99BC85;">Edit</a>
                                <button wire:click="delete(<?php echo e($faq->id); ?>)" wire:confirm="Are you sure?" wire:loading.attr="disabled" class="text-red-500 font-semibold text-xs px-2">Delete</button>
                            </td>
                        </tr>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
                        <tr>
                            <td colspan="3" class="px-6 py-4 text-center text-gray-500 text-sm">No FAQs found.</td>
                        </tr>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
</div><?php /**PATH D:\02-my freelance\00-DR_Padhi\DR_PADHI\storage\framework/views/livewire/views/7fb864cb.blade.php ENDPATH**/ ?>