Your IP : 216.73.216.79


Current Path : /var/www/html/reddsis_bak_20260729/storage/framework/views/
Upload File :
Current File : /var/www/html/reddsis_bak_20260729/storage/framework/views/0dad375dfac82b0769498b6cd8746e39.php

<?php $__env->startSection('title', \App\Http\Helpers\MenuHelper::getPageTitle()); ?>

<?php $__env->startSection('content'); ?>
<div x-data="{ pageName: <?php echo \Illuminate\Support\Js::from(\App\Http\Helpers\MenuHelper::getPageTitle())->toHtml() ?> }" class="mb-6">
    <div class="mb-6 flex flex-wrap items-center justify-between gap-3">
        <h2 class="text-xl font-semibold text-gray-800 dark:text-white/90" x-text="pageName"></h2>
        <nav>
            <ol class="flex items-center gap-1.5">
                <li><a class="text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300" href="<?php echo e(route('admin.home')); ?>">Home</a></li>
                <li class="flex items-center gap-1.5 text-sm text-gray-800 dark:text-white/90"><svg class="stroke-current" width="17" height="16" viewBox="0 0 17 16" fill="none"><path d="M6.0765 12.667L10.2432 8.50033L6.0765 4.33366" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" /></svg><span x-text="pageName"></span></li>
            </ol>
        </nav>
    </div>
</div>

<div class="space-y-5 sm:space-y-6">
    <div class="rounded-2xl border border-gray-200 bg-white dark:border-gray-800 dark:bg-white/[0.03]">
        <div class="px-5 py-4 sm:px-6 sm:py-5">
            <div class="mb-6 flex flex-wrap items-center justify-between gap-3">
                <h3 class="text-lg font-semibold text-gray-800 dark:text-white/90">All Sites</h3>
                <div class="flex items-center gap-3">
                    <form method="GET" action="<?php echo e(route('frontend-site.sites.index')); ?>">
                        <input type="text" name="search" value="<?php echo e($search ?? ''); ?>" placeholder="Search name, slug..."
                            oninput="debounceSearch(this)"
                            class="dark:bg-dark-900 shadow-theme-xs focus:border-brand-300 focus:ring-brand-500/10 dark:focus:border-brand-800 h-10 w-full max-w-xs rounded-lg border border-gray-300 bg-transparent px-4 py-2 text-sm text-gray-800 placeholder:text-gray-400 focus:ring-3 focus:outline-hidden dark:border-gray-700 dark:bg-gray-900 dark:text-white/90 dark:placeholder:text-white/30">
                    </form>
                    <a href="<?php echo e(route('frontend-site.sites.create')); ?>"
                        class="inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white px-4 py-2.5 text-theme-sm font-medium text-gray-700 shadow-theme-xs hover:bg-gray-50 hover:text-gray-800 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-white/[0.03] dark:hover:text-gray-200">
                        <svg class="fill-current" width="18" height="18" viewBox="0 0 20 20"><path d="M10 3a1 1 0 0 1 1 1v5h5a1 1 0 1 1 0 2h-5v5a1 1 0 1 1-2 0v-5H4a1 1 0 1 1 0-2h5V4a1 1 0 0 1 1-1Z"/></svg>
                        Create Site
                    </a>
                </div>
            </div>

            <div class="rounded-xl border border-gray-200 bg-white dark:border-gray-800 dark:bg-white/[0.02]">
                <div class="p-5">
                    <div class="max-w-full overflow-x-auto">
                        <div class="min-w-[800px]">
                            <table class="w-full">
                                <thead>
                                    <tr class="border-b border-gray-100 dark:border-gray-800">
                                        <th class="px-5 py-3 text-left"><span class="text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">#</span></th>
                                        <th class="px-5 py-3 text-left"><span class="text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">Name</span></th>
                                        <th class="px-5 py-3 text-left"><span class="text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">Slug</span></th>

                                        <th class="px-5 py-3 text-center"><span class="text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">Pages</span></th>
                                        <th class="px-5 py-3 text-center"><span class="text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">Default</span></th>
                                        <th class="px-5 py-3 text-left"><span class="text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">Status</span></th>
                                        <th class="px-5 py-3 text-right"><span class="text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">Actions</span></th>
                                    </tr>
                                </thead>
                                <tbody class="divide-y divide-gray-100 dark:divide-gray-800">
                                    <?php $__empty_1 = true; $__currentLoopData = $sites; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $site): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <tr class="transition-colors hover:bg-gray-50 dark:hover:bg-gray-800/50">
                                        <td class="px-5 py-4"><span class="text-sm font-medium text-gray-800 dark:text-white/90"><?php echo e(($sites->currentPage() - 1) * $sites->perPage() + $loop->iteration); ?></span></td>
                                        <td class="px-5 py-4"><span class="text-sm font-medium text-gray-800 dark:text-white/90"><?php echo e($site->name); ?></span></td>
                                        <td class="px-5 py-4"><span class="text-sm font-mono text-gray-600 dark:text-gray-400"><?php echo e($site->slug); ?></span></td>

                                        <td class="px-5 py-4 text-center"><span class="text-sm text-gray-600 dark:text-gray-400"><?php echo e($site->pages->count()); ?></span></td>
                                        <td class="px-5 py-4 text-center">
                                            <label x-data="{ checked: <?php echo e($site->is_default ? 'true' : 'false'); ?> }" class="inline-flex cursor-pointer">
                                                <input type="radio" name="default_site" value="<?php echo e($site->id); ?>"
                                                    <?php echo e($site->is_default ? 'checked' : ''); ?>

                                                    x-ref="input"
                                                    @change="checked = $refs.input.checked; if(checked) fetch('<?php echo e(route('frontend-site.sites.toggle-default', $site->id)); ?>', { method: 'POST', headers: { 'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>', 'Accept': 'application/json' } }).then(r => { if(r.ok) window.location.reload(); })"
                                                    class="sr-only">
                                                <svg :class="checked ? 'text-brand-500' : 'text-gray-300'" class="h-5 w-5 hover:text-gray-400 transition-colors" fill="currentColor" viewBox="0 0 24 24">
                                                    <path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/>
                                                </svg>
                                            </label>
                                        </td>
                                        <td class="px-5 py-4">
                                            <div x-data="{ on: <?php echo e($site->status ? 'true' : 'false'); ?> }" class="flex items-center gap-3">
                                                <button type="button" @click="on = !on; fetch('<?php echo e(route('frontend-site.sites.toggle-status', $site->id)); ?>', { method: 'POST', headers: { 'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>', 'Content-Type': 'application/json' } })"
                                                    :class="on ? 'bg-brand-500' : 'bg-gray-300 dark:bg-gray-600'"
                                                    class="relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200">
                                                    <span :class="on ? 'translate-x-full' : ''"
                                                        class="pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200"></span>
                                                </button>
                                                <span class="text-sm" :class="on ? 'text-success-600 dark:text-success-400' : 'text-gray-400'" x-text="on ? 'Active' : 'Inactive'"></span>
                                            </div>
                                        </td>
                                        <td class="px-5 py-4">
                                            <div class="flex items-center justify-end gap-2">
                                                <a href="<?php echo e(route('frontend-site.pages.index', ['site_id' => $site->id])); ?>"
                                                    class="inline-flex items-center justify-center rounded-lg bg-brand-50 p-2 text-brand-500 hover:bg-brand-100 dark:bg-brand-500/10 dark:text-brand-400 dark:hover:bg-brand-500/20"
                                                    title="View Pages">
                                                    <svg class="fill-current" width="18" height="18" viewBox="0 0 18 18"><path d="M11 2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V6l-4-4Zm1 12H5V4h5v4h4v6Z"/></svg>
                                                </a>
                                                <a href="<?php echo e(route('frontend-site.sites.edit', $site->id)); ?>"
                                                    class="inline-flex items-center justify-center rounded-lg bg-warning-50 p-2 text-warning-500 hover:bg-warning-100 dark:bg-warning-500/10 dark:text-warning-400 dark:hover:bg-warning-500/20"
                                                    title="Edit">
                                                    <svg class="fill-current" width="18" height="18" viewBox="0 0 18 18"><path fill-rule="evenodd" clip-rule="evenodd" d="M13.5 2.5L15.5 4.5L5 15H3V13L13.5 2.5ZM14.5 1.5L12.5 3.5L14.5 5.5L16.5 3.5L14.5 1.5Z"/></svg>
                                                </a>
                                                <form action="<?php echo e(route('frontend-site.sites.destroy', $site->id)); ?>" method="POST" class="inline delete-form">
                                                    <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                                                    <button type="submit"
                                                        class="inline-flex items-center justify-center rounded-lg bg-error-50 p-2 text-error-500 hover:bg-error-100 dark:bg-error-500/10 dark:text-error-400 dark:hover:bg-error-500/20"
                                                        title="Delete">
                                                        <svg class="fill-current" width="18" height="18" viewBox="0 0 18 18"><path fill-rule="evenodd" clip-rule="evenodd" d="M6 2.5H12L13 3.5H16V5H2V3.5H5L6 2.5ZM3.5 6H14.5L14 15.5H4L3.5 6ZM6.5 8.5H8V13.5H6.5V8.5ZM10 8.5H11.5V13.5H10V8.5Z"/></svg>
                                                    </button>
                                                </form>
                                            </div>
                                        </td>
                                    </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr>
                                        <td colspan="9" class="px-5 py-12 text-center">
                                            <div class="mx-auto max-w-md">
                                                <h4 class="mb-1 text-base font-medium text-gray-700 dark:text-gray-300">No sites found</h4>
                                                <p class="text-sm text-gray-500 dark:text-gray-500">Click "Create Site" to add your first site.</p>
                                            </div>
                                        </td>
                                    </tr>
                                    <?php endif; ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="mt-6 border-t border-gray-100 pt-5 dark:border-gray-800">
                        <?php echo e($sites->appends(request()->except('page'))->links('vendor.pagination.custom')); ?>

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

<script>
let searchTimer;
function debounceSearch(el) { clearTimeout(searchTimer); searchTimer = setTimeout(() => el.form.submit(), 1500); }
document.addEventListener('DOMContentLoaded', function () {
    document.querySelectorAll('.delete-form').forEach(form => {
        form.addEventListener('submit', function (e) {
            e.preventDefault();
            Swal.fire({
                title: 'Are you sure?',
                text: "This will delete the site and all its pages.",
                icon: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#ef4444',
                cancelButtonColor: '#6b7280',
                confirmButtonText: 'Yes, delete it!',
            }).then((result) => { if (result.isConfirmed) form.submit(); });
        });
    });
});
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('backend.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/reddsis/resources/views/backend/module/frontendSite/site/index.blade.php ENDPATH**/ ?>