<div class="ml-[280px] min-h-screen space-y-6">

    <!-- HEADER -->
    <div class="flex justify-between items-center">
        <div>
            <h2 class="text-2xl font-semibold">Create Service</h2>
            <p class="text-sm text-gray-500">Add new service and assign works</p>
        </div>

        <a href="<?php echo e(route('admin.services')); ?>" class="text-sm text-gray-600 hover:underline">
            ← Back to Services
        </a>
    </div>

    <!-- SUCCESS -->
    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(session()->has('success')): ?>
        <div class="rounded-lg bg-green-50 border border-green-200 px-4 py-3 text-green-800 text-sm">
            <?php echo e(session('success')); ?>

        </div>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

    <!-- CARD -->
    <div class="bg-white rounded-xl border p-6 max-w-3xl">

        <form wire:submit.prevent="save" class="space-y-6">

            <!-- SERVICE TITLE (AUTO) -->
            <div>
                <label class="block text-sm font-medium mb-1">Service Title</label>
                <input type="text" value="Auto from selected page" disabled
                    class="w-full rounded-lg border px-4 py-2 bg-gray-100 cursor-not-allowed">
            </div>

            <!-- Category -->
            <!-- Category + Pages Wrapper -->
            <div class="space-y-4">

                <!-- Category -->
                <div>
                    <label class="block text-sm font-medium mb-1">
                        Category
                    </label>
                    <select wire:model="service_category_id" wire:change="loadMenus"
                        class="w-full rounded-lg border px-4 py-2">
                        <option value="">Select Category</option>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($cat->id); ?>">
                                <?php echo e($cat->name); ?>

                            </option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </select>

                </div>


                <!-- Pages (DEPENDENT) -->
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($menus->count() > 0): ?>

                    <div>
                        <label class="block text-sm font-medium mb-1">
                            Pages
                        </label>

                        <select wire:model="menu_id" class="w-full rounded-lg border px-4 py-2">
                            <option value="">Select Page</option>

                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $menus; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $menu): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($menu->id); ?>">
                                    <?php echo e($menu->title); ?>

                                </option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </select>
                    </div>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>


            </div>




            <!-- HERO VIDEO -->
            <div>
                <label class="block text-sm font-medium mb-1">Hero Video URL</label>
                <input type="text" wire:model.defer="hero_video" class="w-full rounded-lg border px-4 py-2"
                    placeholder="https://example.com/video.mp4">
            </div>

            <!-- DESCRIPTION -->
            <div>
                <label class="block text-sm font-medium mb-1">Description</label>
                <textarea wire:model.defer="description" rows="4" class="w-full rounded-lg border px-4 py-2"></textarea>
            </div>

            <!-- STATUS -->
            <div class="flex items-center gap-2">
                <input type="checkbox" wire:model.defer="status">
                <span>Active</span>
            </div>

            <!-- ASSIGN WORKS -->
            <div class="border-t pt-6">
                <h3 class="text-sm font-semibold mb-3">Assign Works</h3>

                <div class="grid grid-cols-1 sm:grid-cols-2 gap-2">
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $works; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $work): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <label class="flex items-center gap-2 text-sm">
                            <input type="checkbox" wire:model="selectedWorks" value="<?php echo e($work->id); ?>">
                            <?php echo e($work->client_name); ?>

                        </label>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </div>
            </div>

            <!-- ACTIONS -->
            <div class="flex items-center gap-3 pt-4">
                <button type="submit" class="bg-[#f38121] text-white px-6 py-2 rounded-lg">
                    Save Service
                </button>

                <a href="<?php echo e(route('admin.services')); ?>" class="text-sm text-gray-600 hover:underline">
                    Cancel
                </a>
            </div>

        </form>
    </div>
</div>

<!-- JS : OPEN PAGE -->
<script>
    document.addEventListener('livewire:init', () => {
        Livewire.on('open-page', ({
            url
        }) => {
            window.open(url, '_blank');
        });
    });
</script>
<?php /**PATH /home/eggfirst/public_html/video.eggfirst.com/resources/views/livewire/admin/services/create.blade.php ENDPATH**/ ?>