

<?php $__env->startSection('title', 'Modules'); ?>
<?php $__env->startSection('page_class', 'page-modules'); ?>

<?php $__env->startSection('content'); ?>
    <div class="page-header">
        <div>
            <h1 class="page-title">Modules</h1>
            <nav class="breadcrumb">
                <a href="<?php echo e(route('dashboard')); ?>" class="breadcrumb-item">Home</a>
                <span class="breadcrumb-item active">Modules</span>
            </nav>
        </div>
        <div class="page-header-actions">
            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('viewAny', \App\Http\Controllers\Marketplace\MarketplaceController::class)): ?>
                <a href="<?php echo e(route('marketplace.index')); ?>" class="btn btn-outline-primary btn-sm">
                    <i class="bi bi-shop me-1"></i> Browse Marketplace
                </a>
            <?php endif; ?>
        </div>
    </div>

    <div class="row g-3 mb-4">
        <div class="col-sm-6 col-xl-3">
            <?php if (isset($component)) { $__componentOriginal9a1670e652e0ac1fb1f785465a27d6dd = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9a1670e652e0ac1fb1f785465a27d6dd = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'eliteadmin::components.stat-card','data' => ['label' => 'Installed','value' => (string) $installedCount,'icon' => 'bi-puzzle','accent' => 'var(--accent-color)']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('eliteadmin::stat-card'); ?>
<?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(['label' => 'Installed','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute((string) $installedCount),'icon' => 'bi-puzzle','accent' => 'var(--accent-color)']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9a1670e652e0ac1fb1f785465a27d6dd)): ?>
<?php $attributes = $__attributesOriginal9a1670e652e0ac1fb1f785465a27d6dd; ?>
<?php unset($__attributesOriginal9a1670e652e0ac1fb1f785465a27d6dd); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9a1670e652e0ac1fb1f785465a27d6dd)): ?>
<?php $component = $__componentOriginal9a1670e652e0ac1fb1f785465a27d6dd; ?>
<?php unset($__componentOriginal9a1670e652e0ac1fb1f785465a27d6dd); ?>
<?php endif; ?>
        </div>
        <div class="col-sm-6 col-xl-3">
            <?php if (isset($component)) { $__componentOriginal9a1670e652e0ac1fb1f785465a27d6dd = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9a1670e652e0ac1fb1f785465a27d6dd = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'eliteadmin::components.stat-card','data' => ['label' => 'Enabled','value' => (string) $enabledCount,'icon' => 'bi-check-circle','accent' => 'var(--success-color)']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('eliteadmin::stat-card'); ?>
<?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(['label' => 'Enabled','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute((string) $enabledCount),'icon' => 'bi-check-circle','accent' => 'var(--success-color)']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9a1670e652e0ac1fb1f785465a27d6dd)): ?>
<?php $attributes = $__attributesOriginal9a1670e652e0ac1fb1f785465a27d6dd; ?>
<?php unset($__attributesOriginal9a1670e652e0ac1fb1f785465a27d6dd); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9a1670e652e0ac1fb1f785465a27d6dd)): ?>
<?php $component = $__componentOriginal9a1670e652e0ac1fb1f785465a27d6dd; ?>
<?php unset($__componentOriginal9a1670e652e0ac1fb1f785465a27d6dd); ?>
<?php endif; ?>
        </div>
        <div class="col-sm-6 col-xl-3">
            <?php if (isset($component)) { $__componentOriginal9a1670e652e0ac1fb1f785465a27d6dd = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9a1670e652e0ac1fb1f785465a27d6dd = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'eliteadmin::components.stat-card','data' => ['label' => 'Disabled','value' => (string) $disabledCount,'icon' => 'bi-pause-circle','accent' => 'var(--warning-color)']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('eliteadmin::stat-card'); ?>
<?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(['label' => 'Disabled','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute((string) $disabledCount),'icon' => 'bi-pause-circle','accent' => 'var(--warning-color)']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9a1670e652e0ac1fb1f785465a27d6dd)): ?>
<?php $attributes = $__attributesOriginal9a1670e652e0ac1fb1f785465a27d6dd; ?>
<?php unset($__attributesOriginal9a1670e652e0ac1fb1f785465a27d6dd); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9a1670e652e0ac1fb1f785465a27d6dd)): ?>
<?php $component = $__componentOriginal9a1670e652e0ac1fb1f785465a27d6dd; ?>
<?php unset($__componentOriginal9a1670e652e0ac1fb1f785465a27d6dd); ?>
<?php endif; ?>
        </div>
        <div class="col-sm-6 col-xl-3">
            <?php if (isset($component)) { $__componentOriginal9a1670e652e0ac1fb1f785465a27d6dd = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9a1670e652e0ac1fb1f785465a27d6dd = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'eliteadmin::components.stat-card','data' => ['label' => 'Updates Available','value' => (string) $updatesCount,'icon' => 'bi-arrow-up-circle','accent' => 'var(--info-color)']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('eliteadmin::stat-card'); ?>
<?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(['label' => 'Updates Available','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute((string) $updatesCount),'icon' => 'bi-arrow-up-circle','accent' => 'var(--info-color)']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9a1670e652e0ac1fb1f785465a27d6dd)): ?>
<?php $attributes = $__attributesOriginal9a1670e652e0ac1fb1f785465a27d6dd; ?>
<?php unset($__attributesOriginal9a1670e652e0ac1fb1f785465a27d6dd); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9a1670e652e0ac1fb1f785465a27d6dd)): ?>
<?php $component = $__componentOriginal9a1670e652e0ac1fb1f785465a27d6dd; ?>
<?php unset($__componentOriginal9a1670e652e0ac1fb1f785465a27d6dd); ?>
<?php endif; ?>
        </div>
    </div>

    <div class="d-flex flex-wrap align-items-center justify-content-between gap-2 mb-3">
        <h5 class="mb-0">Installed Modules</h5>
        <span class="text-muted small">Click a module card to open its dashboard. Uninstalling removes module access.</span>
    </div>

    <div class="row g-4">
        <?php $__empty_1 = true; $__currentLoopData = $modules; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $module): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <?php
                $isInstalled = $module->status === \App\Enums\ModuleStatus::Installed;
                $entryUrl = $entryRoutes[$module->id] ?? null;
            ?>
            <div class="col-sm-6 col-lg-4 col-xl-3">
                <div class="<?php echo \Illuminate\Support\Arr::toCssClasses(['card h-100 module-card', 'module-card-clickable' => $isInstalled && $entryUrl]); ?>">
                    <?php if($isInstalled && $entryUrl): ?>
                        <a href="<?php echo e($entryUrl); ?>" class="module-card-link text-decoration-none text-reset">
                            <div class="card-body d-flex flex-column pb-2">
                                <div class="d-flex align-items-start justify-content-between mb-2">
                                    <div class="module-card-icon">
                                        <i class="bi bi-puzzle"></i>
                                    </div>
                                    <span class="badge bg-success"><?php echo e(ucfirst($module->status->value)); ?></span>
                                </div>

                                <h5 class="card-title mb-1"><?php echo e($module->name); ?></h5>
                                <p class="card-text text-muted small flex-grow-1 mb-0">
                                    Version <?php echo e($module->version); ?>

                                    <?php if($module->installed_at): ?>
                                        · Installed <?php echo e($module->installed_at->format('M j, Y')); ?>

                                    <?php endif; ?>
                                </p>

                                <p class="small text-primary mb-0 mt-3">
                                    <i class="bi bi-box-arrow-in-right me-1"></i> Click to open dashboard
                                </p>
                            </div>
                        </a>
                    <?php else: ?>
                        <div class="card-body d-flex flex-column">
                            <div class="d-flex align-items-start justify-content-between mb-2">
                                <div class="module-card-icon">
                                    <i class="bi bi-puzzle"></i>
                                </div>
                                <span class="<?php echo \Illuminate\Support\Arr::toCssClasses([
                                    'badge',
                                    'bg-success' => $isInstalled,
                                    'bg-secondary' => $module->status === \App\Enums\ModuleStatus::Disabled,
                                    'bg-danger' => $module->status === \App\Enums\ModuleStatus::Failed,
                                ]); ?>">
                                    <?php echo e(ucfirst($module->status->value)); ?>

                                </span>
                            </div>

                            <h5 class="card-title mb-1"><?php echo e($module->name); ?></h5>
                            <p class="card-text text-muted small flex-grow-1 mb-0">
                                Version <?php echo e($module->version); ?>

                                <?php if($module->installed_at): ?>
                                    · Installed <?php echo e($module->installed_at->format('M j, Y')); ?>

                                <?php endif; ?>
                            </p>
                        </div>
                    <?php endif; ?>

                    <div class="card-footer bg-transparent border-top-0 pt-0">
                        <div class="d-flex gap-2">
                            <a href="<?php echo e(route('modules.show', $module)); ?>" class="btn btn-outline-secondary btn-sm flex-grow-1">
                                Details
                            </a>
                            <?php if($isInstalled): ?>
                                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('uninstall', $module)): ?>
                                    <form
                                        action="<?php echo e(route('modules.destroy', $module)); ?>"
                                        method="POST"
                                        class="flex-grow-1"
                                        onsubmit="return confirm('Uninstall <?php echo e($module->name); ?>? Users will lose access to this module until it is reinstalled.');"
                                    >
                                        <?php echo csrf_field(); ?>
                                        <?php echo method_field('DELETE'); ?>
                                        <button type="submit" class="btn btn-outline-danger btn-sm w-100" title="Uninstall">
                                            <i class="bi bi-trash"></i>
                                        </button>
                                    </form>
                                <?php endif; ?>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
            </div>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <div class="col-12">
                <div class="card">
                    <div class="card-body text-center text-muted py-5">
                        <i class="bi bi-puzzle display-4 d-block mb-3"></i>
                        <p class="mb-0">
                            No modules installed.
                            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('viewAny', \App\Http\Controllers\Marketplace\MarketplaceController::class)): ?>
                                <a href="<?php echo e(route('marketplace.index')); ?>">Browse the marketplace</a> to get started.
                            <?php endif; ?>
                        </p>
                    </div>
                </div>
            </div>
        <?php endif; ?>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('styles'); ?>
<style>
    .module-card-clickable {
        transition: transform 0.15s ease, box-shadow 0.15s ease;
    }

    .module-card-clickable:hover {
        transform: translateY(-2px);
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12);
    }

    .module-card-link {
        display: block;
        cursor: pointer;
    }

    .module-card-link:hover .card-title {
        color: var(--accent-color);
    }

    .module-card-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        border-radius: 0.5rem;
        background: color-mix(in srgb, var(--accent-color), transparent 88%);
        color: var(--accent-color);
    }
</style>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('eliteadmin::layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH D:\RABI\rabi\module-laravel-platform\apps\admin\resources\views/modules/index.blade.php ENDPATH**/ ?>