

<?php $__env->startSection('title', 'Admin Limits'); ?>
<?php $__env->startSection('page-title', 'Admin Limits'); ?>

<?php $__env->startSection('content'); ?>
<div class="row justify-content-center">
    <div class="col-lg-8">
        <div class="table-container">
            <div class="d-flex justify-content-between align-items-center mb-4">
                <div>
                    <h5 class="mb-1">Limits for: <?php echo e($adminToEdit->name); ?></h5>
                    <p class="text-muted mb-0">Configure resource limits and capabilities for this admin</p>
                </div>
                <span class="badge badge-admin-role">
                    <i class="bi bi-person-badge me-1"></i>Admin Role
                </span>
            </div>

            <!-- Current Usage -->
            <div class="row mb-4">
                <div class="col-md-6">
                    <div class="stat-card">
                        <div class="d-flex align-items-center gap-3">
                            <div class="icon users">
                                <i class="bi bi-people"></i>
                            </div>
                            <div>
                                <div class="value"><?php echo e($adminToEdit->getManagedUserCount()); ?> / <?php echo e($limits->max_users); ?></div>
                                <div class="label">Users Created</div>
                            </div>
                        </div>
                        <?php
                            $usagePercent = $limits->max_users > 0 ? ($adminToEdit->getManagedUserCount() / $limits->max_users) * 100 : 0;
                        ?>
                        <div class="progress mt-3" style="height: 6px;">
                            <div class="progress-bar <?php echo e($usagePercent > 80 ? 'bg-danger' : ($usagePercent > 50 ? 'bg-warning' : 'bg-success')); ?>" 
                                 style="width: <?php echo e(min($usagePercent, 100)); ?>%"></div>
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="stat-card">
                        <div class="d-flex align-items-center gap-3">
                            <div class="icon success">
                                <i class="bi bi-arrow-repeat"></i>
                            </div>
                            <div>
                                <div class="value"><?php echo e($adminToEdit->getRemainingUserSlots()); ?></div>
                                <div class="label">Remaining Slots</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <form action="<?php echo e(route('dashboard.admins.limits.update', $adminToEdit->id)); ?>" method="POST">
                <?php echo csrf_field(); ?>
                <?php echo method_field('PUT'); ?>

                <!-- User Limits -->
                <div class="card mb-4">
                    <div class="card-header bg-light">
                        <h6 class="mb-0"><i class="bi bi-people me-2"></i>User Management Limits</h6>
                    </div>
                    <div class="card-body">
                        <div class="mb-4">
                            <label for="max_users" class="form-label fw-semibold">Maximum Users</label>
                            <input type="number" class="form-control <?php $__errorArgs = ['max_users'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" 
                                   id="max_users" name="max_users" value="<?php echo e(old('max_users', $limits->max_users)); ?>" min="0">
                            <div class="form-text">Maximum number of users this admin can create (0 = unlimited)</div>
                            <?php $__errorArgs = ['max_users'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="invalid-feedback"><?php echo e($message); ?></div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-check form-switch mb-3">
                                    <input class="form-check-input" type="checkbox" id="can_create_users" name="can_create_users" value="1"
                                           <?php echo e($limits->can_create_users ? 'checked' : ''); ?>>
                                    <label class="form-check-label" for="can_create_users">Can Create Users</label>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-check form-switch mb-3">
                                    <input class="form-check-input" type="checkbox" id="can_edit_users" name="can_edit_users" value="1"
                                           <?php echo e($limits->can_edit_users ? 'checked' : ''); ?>>
                                    <label class="form-check-label" for="can_edit_users">Can Edit Users</label>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-check form-switch mb-3">
                                    <input class="form-check-input" type="checkbox" id="can_disable_users" name="can_disable_users" value="1"
                                           <?php echo e($limits->can_disable_users ? 'checked' : ''); ?>>
                                    <label class="form-check-label" for="can_disable_users">Can Disable Users</label>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-check form-switch mb-3">
                                    <input class="form-check-input" type="checkbox" id="can_delete_users" name="can_delete_users" value="1"
                                           <?php echo e($limits->can_delete_users ? 'checked' : ''); ?>>
                                    <label class="form-check-label" for="can_delete_users">
                                        Can Delete Users
                                        <span class="badge bg-danger ms-1">Dangerous</span>
                                    </label>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Template Limits -->
                <div class="card mb-4">
                    <div class="card-header bg-light">
                        <h6 class="mb-0"><i class="bi bi-file-text me-2"></i>Template Capabilities</h6>
                    </div>
                    <div class="card-body">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-check form-switch mb-3">
                                    <input class="form-check-input" type="checkbox" id="can_view_templates" name="can_view_templates" value="1"
                                           <?php echo e($limits->can_view_templates ? 'checked' : ''); ?>>
                                    <label class="form-check-label" for="can_view_templates">Can View Templates</label>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-check form-switch mb-3">
                                    <input class="form-check-input" type="checkbox" id="can_assign_templates" name="can_assign_templates" value="1"
                                           <?php echo e($limits->can_assign_templates ? 'checked' : ''); ?>>
                                    <label class="form-check-label" for="can_assign_templates">Can Assign Templates</label>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-check form-switch mb-3">
                                    <input class="form-check-input" type="checkbox" id="can_edit_templates" name="can_edit_templates" value="1"
                                           <?php echo e($limits->can_edit_templates ? 'checked' : ''); ?>>
                                    <label class="form-check-label" for="can_edit_templates">Can Edit Templates</label>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Reports & Data Access -->
                <div class="card mb-4">
                    <div class="card-header bg-light">
                        <h6 class="mb-0"><i class="bi bi-graph-up me-2"></i>Reports & Data Access</h6>
                    </div>
                    <div class="card-body">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-check form-switch mb-3">
                                    <input class="form-check-input" type="checkbox" id="can_view_reports" name="can_view_reports" value="1"
                                           <?php echo e($limits->can_view_reports ? 'checked' : ''); ?>>
                                    <label class="form-check-label" for="can_view_reports">Can View Reports</label>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-check form-switch mb-3">
                                    <input class="form-check-input" type="checkbox" id="can_export_reports" name="can_export_reports" value="1"
                                           <?php echo e($limits->can_export_reports ? 'checked' : ''); ?>>
                                    <label class="form-check-label" for="can_export_reports">
                                        Can Export Reports
                                        <span class="badge bg-warning text-dark ms-1">Sensitive</span>
                                    </label>
                                </div>
                            </div>
                        </div>
                        
                        <hr>
                        
                        <div class="alert alert-danger mb-3">
                            <i class="bi bi-shield-exclamation me-2"></i>
                            <strong>Sensitive Data Access</strong> - These options expose private user data
                        </div>
                        
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-check form-switch mb-3">
                                    <input class="form-check-input" type="checkbox" id="can_view_full_phone" name="can_view_full_phone" value="1"
                                           <?php echo e($limits->can_view_full_phone ? 'checked' : ''); ?>>
                                    <label class="form-check-label" for="can_view_full_phone">
                                        Can View Full Phone Numbers
                                        <span class="badge bg-danger ms-1">PII</span>
                                    </label>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-check form-switch mb-3">
                                    <input class="form-check-input" type="checkbox" id="can_view_raw_logs" name="can_view_raw_logs" value="1"
                                           <?php echo e($limits->can_view_raw_logs ? 'checked' : ''); ?>>
                                    <label class="form-check-label" for="can_view_raw_logs">
                                        Can View Raw Logs
                                        <span class="badge bg-danger ms-1">PII</span>
                                    </label>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="d-flex gap-3">
                    <button type="submit" class="btn btn-primary">
                        <i class="bi bi-check-lg me-2"></i>Save Limits
                    </button>
                    <a href="<?php echo e(route('dashboard.admins')); ?>" class="btn btn-outline-secondary">
                        Cancel
                    </a>
                </div>
            </form>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.dashboard', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\xampp82\htdocs\AutoPromix\backend\resources\views\dashboard\admins-limits.blade.php ENDPATH**/ ?>