|
|
@@ -0,0 +1,148 @@
|
|
|
+{% extends "admin/base.html" %}
|
|
|
+
|
|
|
+{% block content %}
|
|
|
+{% include 'components/confirm_modal.html' %}
|
|
|
+{% include 'components/loading_spinner.html' %}
|
|
|
+
|
|
|
+<div x-data="{ activeTab: 'overview' }" class="bg-white rounded-lg shadow-lg p-4 sm:p-6">
|
|
|
+ <h2 class="text-xl sm:text-2xl font-bold text-gray-800 mb-4 sm:mb-6">Cuotas de Usuario - Administración Squid</h2>
|
|
|
+
|
|
|
+ <!-- Tabs -->
|
|
|
+ <div class="flex border-b border-gray-200 flex-wrap">
|
|
|
+ <button @click="activeTab = 'overview'" :class="activeTab === 'overview' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500'" class="py-2 px-4 border-b-2 font-medium text-sm whitespace-nowrap">Resumen</button>
|
|
|
+ <button @click="activeTab = 'user'" :class="activeTab === 'user' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500'" class="py-2 px-4 border-b-2 font-medium text-sm whitespace-nowrap">Por Usuario</button>
|
|
|
+ <button @click="activeTab = 'group'" :class="activeTab === 'group' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500'" class="py-2 px-4 border-b-2 font-medium text-sm whitespace-nowrap">Por Grupo</button>
|
|
|
+ <button @click="activeTab = 'rules'" :class="activeTab === 'rules' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500'" class="py-2 px-4 border-b-2 font-medium text-sm whitespace-nowrap">Reglas</button>
|
|
|
+ <button @click="activeTab = 'history'" :class="activeTab === 'history' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500'" class="py-2 px-4 border-b-2 font-medium text-sm whitespace-nowrap">Histórico</button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div x-show="activeTab === 'overview'" class="mt-6">
|
|
|
+ <h3 class="text-lg font-semibold mb-2">Resumen de Cuotas</h3>
|
|
|
+ <p class="text-sm text-gray-600 mb-4">Visualiza el estado general de las cuotas de ancho de banda y límites de datos para los usuarios y grupos.</p>
|
|
|
+
|
|
|
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
|
+ <div class="p-4 bg-gray-50 rounded border">
|
|
|
+ <p class="text-sm text-gray-500">Pools configurados</p>
|
|
|
+ <p class="text-2xl font-bold text-blue-700">{{ delay_pools|length }}</p>
|
|
|
+ </div>
|
|
|
+ <div class="p-4 bg-gray-50 rounded border">
|
|
|
+ <p class="text-sm text-gray-500">Usuarios con cuota</p>
|
|
|
+ <p class="text-2xl font-bold text-blue-700">0</p>
|
|
|
+ </div>
|
|
|
+ <div class="p-4 bg-gray-50 rounded border">
|
|
|
+ <p class="text-sm text-gray-500">Incidentes de exceso</p>
|
|
|
+ <p class="text-2xl font-bold text-blue-700">0</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div x-show="activeTab === 'user'" class="mt-6">
|
|
|
+ <h3 class="text-lg font-semibold mb-3">Cuotas por Usuario</h3>
|
|
|
+ <p class="text-sm text-gray-600 mb-4">Configura y revisa cuotas específicas por usuario de Squid.</p>
|
|
|
+
|
|
|
+ <form method="POST" action="/admin/quota/user/save" class="grid grid-cols-1 md:grid-cols-2 gap-4 bg-gray-50 p-4 rounded border">
|
|
|
+ <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
|
+ <div>
|
|
|
+ <label class="text-sm font-medium text-gray-700">Usuario</label>
|
|
|
+ <input name="username" type="text" class="w-full mt-2 p-2 border rounded" placeholder="Nombre de usuario" />
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <label class="text-sm font-medium text-gray-700">Cuota (MB)</label>
|
|
|
+ <input name="quota_mb" type="number" class="w-full mt-2 p-2 border rounded" placeholder="Ej. 2048" />
|
|
|
+ </div>
|
|
|
+ <div class="md:col-span-2 flex gap-2">
|
|
|
+ <button type="submit" class="bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded">Guardar Cuota</button>
|
|
|
+ <button type="button" class="bg-gray-200 hover:bg-gray-300 px-4 py-2 rounded">Cancelar</button>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+
|
|
|
+ <div class="mt-5">
|
|
|
+ <h4 class="font-semibold">Ejemplo: usuarios actuales</h4>
|
|
|
+ <table class="w-full text-left text-sm border-collapse">
|
|
|
+ <thead>
|
|
|
+ <tr class="bg-gray-100">
|
|
|
+ <th class="p-2 border">Usuario</th>
|
|
|
+ <th class="p-2 border">Cuota (MB)</th>
|
|
|
+ <th class="p-2 border">Uso (MB)</th>
|
|
|
+ <th class="p-2 border">Acción</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <td class="p-2 border">usuario1</td>
|
|
|
+ <td class="p-2 border">2048</td>
|
|
|
+ <td class="p-2 border">980</td>
|
|
|
+ <td class="p-2 border">-</td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div x-show="activeTab === 'group'" class="mt-6">
|
|
|
+ <h3 class="text-lg font-semibold mb-3">Cuotas por Grupo</h3>
|
|
|
+ <p class="text-sm text-gray-600 mb-4">Define límites grupales para los usuarios conectados al proxy.</p>
|
|
|
+
|
|
|
+ <form method="POST" action="/admin/quota/group/save" class="grid grid-cols-1 md:grid-cols-2 gap-4 bg-gray-50 p-4 rounded border">
|
|
|
+ <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
|
+ <div>
|
|
|
+ <label class="text-sm font-medium text-gray-700">Grupo</label>
|
|
|
+ <input name="group_name" type="text" class="w-full mt-2 p-2 border rounded" placeholder="Nombre del grupo" />
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <label class="text-sm font-medium text-gray-700">Cuota (MB)</label>
|
|
|
+ <input name="quota_mb" type="number" class="w-full mt-2 p-2 border rounded" placeholder="Ej. 10240" />
|
|
|
+ </div>
|
|
|
+ <div class="md:col-span-2 flex gap-2">
|
|
|
+ <button type="submit" class="bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded">Guardar Grupo</button>
|
|
|
+ <button type="button" class="bg-gray-200 hover:bg-gray-300 px-4 py-2 rounded">Cancelar</button>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div x-show="activeTab === 'rules'" class="mt-6">
|
|
|
+ <h3 class="text-lg font-semibold mb-3">Reglas de Control</h3>
|
|
|
+ <p class="text-sm text-gray-600 mb-4">Define el comportamiento al superar la cuota. (Por ejemplo: bloquear el acceso o degradar la velocidad).</p>
|
|
|
+
|
|
|
+ <form method="POST" action="/admin/quota/rules/save" class="bg-gray-50 p-4 rounded border space-y-3">
|
|
|
+ <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
|
+ <div>
|
|
|
+ <label class="text-sm font-medium text-gray-700">Política de excedente</label>
|
|
|
+ <select name="policy" class="w-full mt-2 p-2 border rounded">
|
|
|
+ <option value="block">Bloquear</option>
|
|
|
+ <option value="throttle">Degradar velocidad</option>
|
|
|
+ <option value="notify">Solo notificar</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <button type="submit" class="bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded">Guardar Regla</button>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div x-show="activeTab === 'history'" class="mt-6">
|
|
|
+ <h3 class="text-lg font-semibold mb-3">Histórico de Eventos de Cuotas</h3>
|
|
|
+ <p class="text-sm text-gray-600 mb-4">Revisa las acciones registradas cuando usuarios superaron sus límites.</p>
|
|
|
+
|
|
|
+ <div class="overflow-x-auto bg-white rounded border">
|
|
|
+ <table class="w-full text-left text-sm border-collapse">
|
|
|
+ <thead>
|
|
|
+ <tr class="bg-gray-100">
|
|
|
+ <th class="p-2 border">Fecha</th>
|
|
|
+ <th class="p-2 border">Usuario</th>
|
|
|
+ <th class="p-2 border">Evento</th>
|
|
|
+ <th class="p-2 border">Detalle</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <td class="p-2 border">-</td>
|
|
|
+ <td class="p-2 border">-</td>
|
|
|
+ <td class="p-2 border">-</td>
|
|
|
+ <td class="p-2 border">No hay registros disponibles</td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+
|
|
|
+{% endblock %}
|