<?php $__env->startSection('title', 'Administración SaaS - Ojo de Águila'); ?>
<?php $__env->startSection('header_title', 'Administración SaaS'); ?>

<?php $__env->startSection('content'); ?>
<div class="dashboard-grid">
    <!-- Formulario para Crear Recinto -->
    <div class="card">
        <div class="card-header">
            <h3 class="card-title">🏢 Registrar Nuevo Recinto</h3>
        </div>
        <div class="card-body">
            <form action="<?php echo e(route('admin.accounts.store')); ?>" method="POST">
                <?php echo csrf_field(); ?>
                <div class="form-group">
                    <label for="name" class="form-label required">Nombre del Recinto / Condominio</label>
                    <input type="text" name="name" id="name" class="form-control" placeholder="Ej: Condominio Las Encinas" required>
                </div>

                <div class="form-group">
                    <label for="plan_type" class="form-label required">Plan contratado</label>
                    <select name="plan_type" id="plan_type" class="form-control" required>
                        <option value="mvp">Plan MVP (Control básico)</option>
                        <option value="premium">Plan Premium (Geolocalización + Estacionamientos)</option>
                        <option value="enterprise">Plan Enterprise (Monitoreo avanzado + Integraciones)</option>
                    </select>
                </div>

                <div class="form-group">
                    <label for="address" class="form-label">Dirección</label>
                    <input type="text" name="address" id="address" class="form-control" placeholder="Av. Principal 1234">
                </div>

                <div class="form-group">
                    <label for="city" class="form-label">Ciudad / Comuna</label>
                    <input type="text" name="city" id="city" class="form-control" placeholder="Santiago, Viña del Mar...">
                </div>

                <button type="submit" class="btn btn-primary btn-full" style="height: 44px; margin-top: 8px;">
                    🏢 Registrar Recinto
                </button>
            </form>
        </div>
    </div>

    <!-- Listado de Recintos -->
    <div class="card" style="margin-bottom: 0;">
        <div class="card-header">
            <h3 class="card-title">🏢 Recintos Activos en la Plataforma</h3>
        </div>
        <div class="table-responsive">
            <table class="table">
                <thead>
                    <tr>
                        <th>Nombre</th>
                        <th>Detalles</th>
                        <th>Guardias / Zonas</th>
                        <th>Plan</th>
                        <th>Estado</th>
                        <th>Acción</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $accounts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $acc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td style="font-weight: 700; color: var(--text-primary);">
                                <?php echo e($acc->name); ?>

                            </td>
                            <td style="font-size: 12px; color: var(--text-secondary);">
                                <?php echo e($acc->address ?? 'Sin dirección'); ?><br>
                                <?php echo e($acc->city ?? 'Sin ciudad'); ?>

                            </td>
                            <td style="font-weight: 600; font-size: 13px;">
                                👮 <?php echo e($acc->users_count ?? 0); ?> guardias<br>
                                📍 <?php echo e($acc->zones_count ?? 0); ?> zonas
                            </td>
                            <td>
                                <span class="badge <?php echo e($acc->plan_type === 'enterprise' ? 'badge-danger' : ($acc->plan_type === 'premium' ? 'badge-info' : 'badge-warning')); ?>" style="font-size: 11px;">
                                    <?php echo e($acc->plan_type); ?>

                                </span>
                            </td>
                            <td>
                                <span class="badge <?php echo e($acc->is_active ? 'badge-success' : 'badge-danger'); ?>">
                                    <?php echo e($acc->is_active ? 'Activo' : 'Inactivo'); ?>

                                </span>
                            </td>
                            <td>
                                <form action="<?php echo e(route('admin.accounts.toggle', $acc->id)); ?>" method="POST">
                                    <?php echo csrf_field(); ?>
                                    <button type="submit" class="btn <?php echo e($acc->is_active ? 'btn-danger' : 'btn-primary'); ?>" style="font-size: 11px; padding: 6px 10px;">
                                        <?php echo e($acc->is_active ? 'Desactivar' : 'Activar'); ?>

                                    </button>
                                </form>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td colspan="6" style="text-align: center; color: var(--text-light); padding: 40px;">
                                No hay recintos creados.
                            </td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\ojodeaguila\resources\views/admin/accounts.blade.php ENDPATH**/ ?>