| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552 |
- {% from 'macros.html' import format_bandwidth %}
- <div class="w-full space-y-6">
- {# ── Barra de estado de proxies (solo visible si multi_proxy) ── #}
- {% if multi_proxy and proxy_statuses %}
- <div class="flex flex-wrap gap-2 items-center bg-white rounded-lg shadow px-4 py-2 border border-gray-100">
- <span class="text-xs font-semibold text-gray-500 uppercase tracking-wide mr-2">{{ _("Proxies:") }}</span>
- {% for ps in proxy_statuses %}
- <span class="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-semibold
- {% if ps.ok %}bg-green-100 text-green-800{% else %}bg-red-100 text-red-700{% endif %}">
- <i class="fas {% if ps.ok %}fa-circle-check{% else %}fa-circle-xmark{% endif %} text-[10px]"></i>
- {{ ps.label }}
- </span>
- {% endfor %}
- </div>
- {% endif %}
- {# ── Filtro por proxy (solo si multi_proxy) ── #}
- {% if multi_proxy and proxy_statuses %}
- <div class="flex flex-wrap gap-2 items-center">
- <button type="button"
- class="proxy-filter-btn px-3 py-1.5 rounded-full text-xs font-semibold bg-indigo-600 text-white shadow"
- data-proxy="all">{{ _("Todos") }}</button>
- {% for ps in proxy_statuses %}
- {% if ps.ok %}
- <button type="button"
- class="proxy-filter-btn px-3 py-1.5 rounded-full text-xs font-semibold bg-gray-100 text-gray-700 hover:bg-indigo-100 transition-colors"
- data-proxy="{{ ps.label }}">{{ ps.label }}</button>
- {% endif %}
- {% endfor %}
- </div>
- <script>
- (function(){
- document.addEventListener("click", function(e){
- const btn = e.target.closest(".proxy-filter-btn");
- if(!btn) return;
- const chosen = btn.dataset.proxy;
- document.querySelectorAll(".proxy-filter-btn").forEach(b=>{
- b.classList.toggle("bg-indigo-600", b.dataset.proxy === chosen);
- b.classList.toggle("text-white", b.dataset.proxy === chosen);
- b.classList.toggle("bg-gray-100", b.dataset.proxy !== chosen);
- b.classList.toggle("text-gray-700", b.dataset.proxy !== chosen);
- });
- document.querySelectorAll(".user-accordion[data-proxy]").forEach(el=>{
- el.style.display = (chosen === "all" || el.dataset.proxy === chosen) ? "" : "none";
- });
- });
- })();
- </script>
- {% endif %}
- {# Tarjetas de estadísticas #}
- <div class="flex justify-center mb-8">
- <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-4 gap-3 w-full">
- {# Tarjeta de información del Servidor Squid #}
- <div class="bg-white p-3 rounded-lg shadow flex items-center transition-all duration-300 ease-in-out hover:shadow-lg hover:-translate-y-0.5 min-w-0">
- <div class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center mr-3 flex-shrink-0">
- <i class="fas fa-server text-indigo-500 text-lg"></i>
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-gray-500 text-xs truncate">
- {{ _("Servidor Squid:") }}
- </p>
- <p class="text-lg font-bold truncate" title="{{ squid_version }}">
- {{ squid_version }}
- </p>
- </div>
- </div>
- {# Tarjeta de Bandwidth Total #}
- <div class="bg-white p-3 rounded-lg shadow flex items-center transition-all duration-300 ease-in-out hover:shadow-lg hover:-translate-y-0.5 min-w-0">
- <div class="w-10 h-10 rounded-full bg-teal-100 flex items-center justify-center mr-3 flex-shrink-0">
- <i class="fas fa-tachometer-alt text-teal-500 text-lg"></i>
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-gray-500 text-xs">{{ _("Total Bandwidth") }}</p>
- <p class="text-lg font-bold truncate">
- {% set total_bw = namespace(value=0) %}
- {% for user_data in valid_users.values() %}
- {% for connection in user_data.connections %}
- {% if connection.bandwidth_kbps is defined %}
- {% set total_bw.value = total_bw.value + (connection.bandwidth_kbps|float) %}
- {% endif %}
- {% endfor %}
- {% endfor %}
- {{ format_bandwidth(total_bw.value) }}
- </p>
- </div>
- </div>
- {# Tarjeta de Usuarios Activos #}
- <div class="bg-white p-3 rounded-lg shadow flex items-center transition-all duration-300 ease-in-out hover:shadow-lg hover:-translate-y-0.5 min-w-0">
- <div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center mr-3 flex-shrink-0">
- <i class="fas fa-users text-blue-500 text-lg"></i>
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-gray-500 text-xs">{{ _("Usuarios Activos") }}</p>
- <p class="text-lg font-bold">{{ valid_users|length }}</p>
- </div>
- </div>
- {# Tarjeta de Conexiones Totales #}
- <div class="bg-white p-3 rounded-lg shadow flex items-center transition-all duration-300 ease-in-out hover:shadow-lg hover:-translate-y-0.5 min-w-0">
- <div class="w-10 h-10 rounded-full bg-green-100 flex items-center justify-center mr-3 flex-shrink-0">
- <i class="fas fa-exchange-alt text-green-500 text-lg"></i>
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-gray-500 text-xs">{{ _("Conexiones Totales") }}</p>
- <p class="text-lg font-bold">
- {% set total = namespace(value=0) %}
- {% for user_data in valid_users.values() %}
- {% set total.value = total.value + user_data.connections|length %}
- {% endfor %}
- {{ total.value }}
- </p>
- </div>
- </div>
- {# Tiempo de Actividad de Squid #}
- {% if squid_info_stats and squid_info_stats.elapsed_hours %}
- <div class="bg-white p-3 rounded-lg shadow flex items-center transition-all duration-300 ease-in-out hover:shadow-lg hover:-translate-y-0.5 min-w-0">
- <div class="w-10 h-10 rounded-full bg-purple-100 flex items-center justify-center mr-3 flex-shrink-0">
- <i class="fas fa-clock text-purple-500 text-lg"></i>
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-gray-500 text-xs">{{ _("Tiempo Activo") }}</p>
- <p class="text-lg font-bold">
- {{ squid_info_stats.elapsed_hours }}h
- </p>
- </div>
- </div>
- {% endif %}
- {# Peticiones HTTP Totales #}
- {% if squid_info_stats and squid_info_stats.requests_received %}
- <div class="bg-white p-3 rounded-lg shadow flex items-center transition-all duration-300 ease-in-out hover:shadow-lg hover:-translate-y-0.5 min-w-0">
- <div class="w-10 h-10 rounded-full bg-red-100 flex items-center justify-center mr-3 flex-shrink-0">
- <i class="fas fa-globe text-red-500 text-lg"></i>
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-gray-500 text-xs">{{ _("Peticiones HTTP") }}</p>
- <p class="text-lg font-bold">
- {{ squid_info_stats.requests_received | int }}
- </p>
- </div>
- </div>
- {% endif %}
- {# Promedio de Peticiones por Minuto #}
- {% if squid_info_stats and squid_info_stats.avg_requests_per_minute %}
- <div class="bg-white p-3 rounded-lg shadow flex items-center transition-all duration-300 ease-in-out hover:shadow-lg hover:-translate-y-0.5 min-w-0">
- <div class="w-10 h-10 rounded-full bg-teal-100 flex items-center justify-center mr-3 flex-shrink-0">
- <i class="fas fa-chart-line text-teal-500 text-lg"></i>
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-gray-500 text-xs">{{ _("Peticiones/Min") }}</p>
- <p class="text-lg font-bold">
- {{ squid_info_stats.avg_requests_per_minute|round(1) }}
- </p>
- </div>
- </div>
- {% endif %}
- {# Estado de Conexión de Squid (oculto en modo multi-proxy, que ya muestra estado por proxy) #}
- {% if squid_info_stats and not multi_proxy %}
- <div class="bg-white p-3 rounded-lg shadow flex items-center transition-all duration-300 ease-in-out hover:shadow-lg hover:-translate-y-0.5 min-w-0">
- <div class="w-10 h-10 rounded-full {% if squid_info_stats.connection_status == 'connected' %}bg-green-100{% else %}bg-red-100{% endif %} flex items-center justify-center mr-3 flex-shrink-0">
- <i class="fas {% if squid_info_stats.connection_status == 'connected' %}fa-check-circle text-green-500{% else %}fa-exclamation-triangle text-red-500{% endif %} text-lg"></i>
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-gray-500 text-xs">{{ _("Estado Squid") }}</p>
- <p class="text-sm font-bold {% if squid_info_stats.connection_status == 'connected' %}text-green-600{% else %}text-red-600{% endif %} truncate">
- {% if squid_info_stats.connection_status == 'connected' %}{{ _("Conectado") }}
- {% elif squid_info_stats.connection_status == 'connected_but_parse_error' %}{{ _("Error Parsing") }}
- {% elif squid_info_stats.connection_status == 'timeout' %}{{ _("Timeout") }}
- {% elif squid_info_stats.connection_status == 'connection_refused' %}{{ _("Rechazado") }}
- {% elif squid_info_stats.connection_status == 'dns_error' %}{{ _("Error DNS") }}
- {% else %}{{ _("Error") }}
- {% endif %}
- </p>
- </div>
- </div>
- {% endif %}
- {# Tarjeta de Tipo de Sistema #}
- <div class="bg-white p-3 rounded-lg shadow flex items-center transition-all duration-300 ease-in-out hover:shadow-lg hover:-translate-y-0.5 min-w-0">
- <div class="w-10 h-10 rounded-full bg-orange-100 flex items-center justify-center mr-3 flex-shrink-0">
- <i class="fas fa-desktop text-orange-500 text-lg"></i>
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-gray-500 text-xs">{{ _("Tipo de Sistema") }}</p>
- <p class="text-lg font-bold truncate" title="{{ system_type }}">
- {{ system_type }}
- </p>
- </div>
- </div>
- </div>
- </div>
- {# El resto del código permanece igual #}
- {% if valid_users|length > 0 %}
- <div class="flex justify-end mb-4">
- <button id="toggle-all-button" class="bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded-lg transition-colors duration-300">
- {{ _("Ver Resumen") }}
- </button>
- </div>
- {% endif %}
- <div id="user-accordion-group">
- {% for user, user_data in valid_users.items() %}
- {% set connections = user_data.connections %}
- {% set client_ip = user_data.client_ip %}
- {# Determine the proxy label for this user (from first connection) #}
- {% set user_proxy = connections[0].proxy_host if connections and connections[0].proxy_host is defined else '' %}
- <div class="user-accordion bg-white rounded-lg shadow-md mb-3" {% if user_proxy %}data-proxy="{{ user_proxy }}"{% endif %}>
- <div class="w-full text-left p-4 border-b bg-white rounded-t-lg" id="header-{{ loop.index }}">
- <div class="flex flex-col sm:flex-row sm:items-center sm:justify-between">
- <div class="flex items-center mb-3 sm:mb-0">
- <div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center mr-3 flex-shrink-0">
- <i class="fas fa-user text-blue-600"></i>
- </div>
- <div class="min-w-0">
- <h2 class="text-lg font-bold text-gray-800 truncate" title="{{ user }}">{{ user }}</h2>
- {% if multi_proxy and user_proxy %}
- <span class="inline-flex items-center gap-1 mt-0.5 px-2 py-0.5 rounded-full text-[10px] font-semibold bg-indigo-100 text-indigo-700">
- <i class="fas fa-network-wired text-[9px]"></i> {{ user_proxy }}
- </span>
- {% endif %}
- </div>
- </div>
- <div class="flex flex-wrap items-center gap-x-4 gap-y-2">
- <div class="flex items-center text-sm text-gray-600" title="{{ _("IP del Cliente") }}">
- <i class="fas fa-network-wired mr-1.5 text-gray-500"></i>
- <span class="truncate max-w-[120px]">{{ client_ip }}</span>
- </div>
- <div class="flex items-center text-sm text-gray-600" title="{{ _("Conexiones totales de este usuario") }}">
- <i class="fas fa-link mr-1.5 text-blue-500"></i>
- <span>{{ connections|length }} conexiones</span>
- </div>
-
- {% set user_bw = namespace(value=0) %}
- {% for connection in connections %}
- {% if connection.bandwidth_kbps is defined %}
- {% set user_bw.value = user_bw.value + (connection.bandwidth_kbps|float) %}
- {% endif %}
- {% endfor %}
-
- <div class="flex items-center text-sm text-gray-600" title="{{ _("Total de velocidad del usuario") }}">
- <i class="fas fa-tachometer-alt mr-1.5 text-teal-500"></i>
- <span class="truncate max-w-[100px]">
- {{ format_bandwidth(user_bw.value) }}
- </span>
- </div>
- {% set total_data = namespace(value=0) %}
- {% set total_requests = namespace(value=0) %}
- {% for connection in connections %}
- {% if connection.fd_total != "N/A" %}
- {% set total_data.value = total_data.value + connection.fd_total %}
- {% endif %}
- {% set total_requests.value = total_requests.value + connection.nrequests %}
- {% endfor %}
- <div class="hidden md:flex items-center text-sm text-gray-600" title="{{ _("Total de datos transferidos") }}">
- <i class="fas fa-database mr-1.5 text-green-500"></i>
- <span>{{ (total_data.value / 1024 / 1024)|round(2) }} {{ _("MB") }}</span>
- </div>
- <div class="hidden lg:flex items-center text-sm text-gray-600" title="{{ _("Total de solicitudes") }}">
- <i class="fas fa-bullhorn mr-1.5 text-purple-500"></i>
- <span>{{ total_requests.value }} solicitudes</span>
- </div>
- <div class="relative">
- <button type="button" data-actions-toggle="{{ loop.index }}" class="inline-flex items-center px-3 py-1.5 rounded-full bg-slate-100 text-slate-700 text-sm font-semibold border border-slate-200 hover:bg-slate-200 transition-colors duration-200">
- {{ _("Acciones") }}
- <span class="ml-2 rounded-full bg-indigo-100 text-indigo-700 text-[10px] font-semibold uppercase px-2 py-0.5">{{ _("Beta") }}</span>
- <i class="fas fa-chevron-down ml-2 text-xs"></i>
- </button>
- <div data-actions-menu="{{ loop.index }}" class="hidden absolute right-0 mt-2 w-52 bg-white border border-gray-200 rounded-xl shadow-lg z-20 overflow-hidden py-1">
- <div class="px-3 py-1.5 text-xs font-semibold text-gray-400 uppercase tracking-wide border-b border-gray-100">{{ _("Acciones") }}
- <span class="ml-1 rounded-full bg-indigo-100 text-indigo-700 text-[10px] font-semibold uppercase px-2 py-0.5">{{ _("Beta") }}</span>
- </div>
- <button type="button"
- data-action="throttle" data-user="{{ user }}" data-ip="{{ client_ip }}"
- class="w-full text-left flex items-center gap-2 px-4 py-2 text-sm text-amber-700 hover:bg-amber-50 transition-colors duration-150">
- <i class="fas fa-tachometer-alt text-amber-500 w-4"></i> {{ _("Reducir velocidad") }}
- </button>
- <button type="button"
- data-action="unthrottle" data-user="{{ user }}" data-ip="{{ client_ip }}"
- class="w-full text-left flex items-center gap-2 px-4 py-2 text-sm text-green-700 hover:bg-green-50 transition-colors duration-150">
- <i class="fas fa-gauge-high text-green-500 w-4"></i> {{ _("Restaurar velocidad") }}
- </button>
- <div class="border-t border-gray-100 my-1"></div>
- <button type="button"
- data-action="block" data-user="{{ user }}" data-ip="{{ client_ip }}"
- class="w-full text-left flex items-center gap-2 px-4 py-2 text-sm text-red-700 hover:bg-red-50 transition-colors duration-150">
- <i class="fas fa-ban text-red-500 w-4"></i> {{ _("Bloquear") }}
- </button>
- <button type="button"
- data-action="unblock" data-user="{{ user }}" data-ip="{{ client_ip }}"
- class="w-full text-left flex items-center gap-2 px-4 py-2 text-sm text-blue-700 hover:bg-blue-50 transition-colors duration-150">
- <i class="fas fa-circle-check text-blue-500 w-4"></i> {{ _("Desbloquear") }}
- </button>
- <div class="border-t border-gray-100 my-1"></div>
- <button type="button"
- data-action="reset" data-user="{{ user }}" data-ip="{{ client_ip }}"
- class="w-full text-left flex items-center gap-2 px-4 py-2 text-sm text-orange-700 hover:bg-orange-50 transition-colors duration-150">
- <i class="fas fa-rotate text-orange-500 w-4"></i> {{ _("Resetear conexiones") }}
- </button>
- </div>
- </div>
- <button type="button" data-accordion-btn="{{ loop.index }}" class="w-6 text-center cursor-pointer">
- <i class="fas fa-chevron-down transition-transform duration-300 rotate-180" id="icon-{{ loop.index }}"></i>
- </button>
- </div>
- </div>
- </div>
- <div data-accordion-content data-user='{{ user|tojson }}' id="content-{{ loop.index }}" class="rounded-b-lg overflow-hidden">
- <div class="overflow-x-auto">
- <table class="min-w-full divide-y divide-gray-200">
- <thead class="bg-gray-50">
- <tr>
- <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">
- {{ _("Duración") }}
- </th>
- <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">
- {{ _("Método") }}
- </th>
- <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">
- {{ _("URL") }}
- </th>
- <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">
- {{ _("Datos") }}
- </th>
- <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">
- {{ _("Velocidad") }}
- </th>
- <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">
- {{ _("Delay Pool") }}
- </th>
- <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">
- {{ _("Solicitudes") }}
- </th>
- <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">
- {{ _("Dir. Remota") }}
- </th>
- {% if multi_proxy %}
- <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">
- {{ _("Proxy") }}
- </th>
- {% endif %}
- </tr>
- </thead>
- <tbody class="divide-y divide-gray-200">
- {% for connection in connections %}
- <tr class="transition-colors duration-200 ease-in-out hover:bg-gray-50">
- <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-500">
- {% set seconds = connection.elapsed_time|float %}
- {% if seconds >= 3600 %}{{ "%.2f"|format(seconds/3600) }} h
- {% elif seconds >= 60 %}{{ "%.2f"|format(seconds/60) }} min {% else %}
- {{ "%.2f"|format(seconds) }} seg
- {% endif %}
- </td>
- <td class="px-4 py-3 whitespace-nowrap">
- {% set method = connection.logType|lower %}
- <span class="px-2 py-1 rounded-full text-xs font-semibold ... {% if method == 'connect' or method == 'tcp_tunnel' %}bg-green-100 text-green-800 ... {% endif %}">
- {{ connection.logType }}
- </span>
- </td>
- <td class="px-4 py-3 max-w-xs">
- <div class="truncate text-sm transition-colors duration-200 hover:text-blue-600"
- title="{{ connection.uri }}">
- {{ connection.uri }}
- </div>
- </td>
- <td class="px-4 py-3 whitespace-nowrap text-sm">
- {% if connection.fd_total != "N/A" %}
- {{ (connection.fd_total / 1024 / 1024)|round(2) }} {{ _("MB") }}
- {% else %}{{ _("N/A") }}
- {% endif %}
- </td>
- <td class="px-4 py-3 whitespace-nowrap text-sm">
- {{ format_bandwidth(connection.bandwidth_kbps) }}
- </td>
- <td class="px-4 py-3 whitespace-nowrap">
- {% if connection.delay_pool != "N/A" %}
- {% set pool = connection.delay_pool|string %}
- <span class="px-2 py-1 rounded-full text-xs font-semibold ... {% if pool == '0' %}bg-sky-100 text-sky-800 ... {% endif %}">
- {{ _("Pool") }} {{ connection.delay_pool }}
- </span>
- {% endif %}
- </td>
- <td class="px-4 py-3 whitespace-nowrap text-sm font-medium">
- {{ connection.nrequests }}
- </td>
- <td class="px-4 py-3 whitespace-nowrap text-sm font-mono ... hover:text-blue-600">
- {{ connection.proxy_local_ip }}
- </td>
- {% if multi_proxy %}
- <td class="px-4 py-3 whitespace-nowrap">
- <span class="px-2 py-1 rounded-full text-[10px] font-semibold bg-indigo-100 text-indigo-700">
- {{ connection.proxy_host if connection.proxy_host is defined else '—' }}
- </span>
- </td>
- {% endif %}
- </tr>
- {% endfor %}
- </tbody>
- </table>
- </div>
- </div>
- </div>
- {% endfor %}
- </div>
- </div>
- <!-- ============================================================
- MODALES DE ACCIONES
- ============================================================ -->
- <!-- Modal: Resetear conexiones -->
- <div id="modal-reset" class="hidden fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/40 backdrop-blur-sm">
- <div class="bg-white rounded-2xl shadow-2xl w-full max-w-md p-6">
- <div class="flex items-center gap-3 mb-4">
- <div class="w-10 h-10 rounded-full bg-orange-100 flex items-center justify-center flex-shrink-0">
- <i class="fas fa-rotate text-orange-500"></i>
- </div>
- <div>
- <h3 class="text-lg font-bold text-gray-800">{{ _("Resetear conexiones") }}</h3>
- <p id="modal-reset-subtitle" class="text-sm text-gray-500"></p>
- </div>
- </div>
- <p class="text-sm text-gray-600 mb-6">{{ _("Se cerrarán los estados de red activos asociados a esta IP. Las nuevas conexiones podrán establecerse inmediatamente.") }}</p>
- <div class="flex justify-end gap-3">
- <button type="button" data-modal-cancel class="px-4 py-2 rounded-lg border border-gray-200 text-gray-600 text-sm hover:bg-gray-50 transition-colors">{{ _("Cancelar") }}</button>
- <button type="button" data-modal-confirm="reset" class="px-4 py-2 rounded-lg bg-orange-500 hover:bg-orange-600 text-white text-sm font-semibold transition-colors">
- <i class="fas fa-rotate mr-1.5"></i> {{ _("Resetear") }}
- </button>
- </div>
- </div>
- </div>
- <!-- Modal: Bloquear usuario -->
- <div id="modal-block" class="hidden fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/40 backdrop-blur-sm">
- <div class="bg-white rounded-2xl shadow-2xl w-full max-w-md p-6 animate-fade-in">
- <div class="flex items-center gap-3 mb-4">
- <div class="w-10 h-10 rounded-full bg-red-100 flex items-center justify-center flex-shrink-0">
- <i class="fas fa-ban text-red-500"></i>
- </div>
- <div>
- <h3 class="text-lg font-bold text-gray-800">{{ _("Bloquear usuario") }}</h3>
- <p id="modal-block-subtitle" class="text-sm text-gray-500"></p>
- </div>
- </div>
- <p class="text-sm text-gray-600 mb-6">
- {{ _("Esta acción bloqueará todo el tráfico del usuario. Se añadirá") }}
- <code class="bg-gray-100 px-1 rounded text-xs">{{ _("http_access deny") }}</code>
- {{ _("en Squid y se guardará en la base de datos para persistencia.") }}
- </p>
- <div class="flex justify-end gap-3">
- <button type="button" data-modal-cancel class="px-4 py-2 rounded-lg border border-gray-200 text-gray-600 text-sm hover:bg-gray-50 transition-colors">{{ _("Cancelar") }}</button>
- <button type="button" data-modal-confirm="block" class="px-4 py-2 rounded-lg bg-red-500 hover:bg-red-600 text-white text-sm font-semibold transition-colors">
- <i class="fas fa-ban mr-1.5"></i> {{ _("Confirmar bloqueo") }}
- </button>
- </div>
- </div>
- </div>
- <!-- Modal: Desbloquear usuario -->
- <div id="modal-unblock" class="hidden fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/40 backdrop-blur-sm">
- <div class="bg-white rounded-2xl shadow-2xl w-full max-w-md p-6">
- <div class="flex items-center gap-3 mb-4">
- <div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center flex-shrink-0">
- <i class="fas fa-circle-check text-blue-500"></i>
- </div>
- <div>
- <h3 class="text-lg font-bold text-gray-800">{{ _("Desbloquear usuario") }}</h3>
- <p id="modal-unblock-subtitle" class="text-sm text-gray-500"></p>
- </div>
- </div>
- <p class="text-sm text-gray-600 mb-6">{{ _("Se eliminará el bloqueo activo para esta IP y se recargará la configuración de Squid.") }}</p>
- <div class="flex justify-end gap-3">
- <button type="button" data-modal-cancel class="px-4 py-2 rounded-lg border border-gray-200 text-gray-600 text-sm hover:bg-gray-50 transition-colors">{{ _("Cancelar") }}</button>
- <button type="button" data-modal-confirm="unblock" class="px-4 py-2 rounded-lg bg-blue-500 hover:bg-blue-600 text-white text-sm font-semibold transition-colors">
- <i class="fas fa-circle-check mr-1.5"></i> {{ _("Confirmar") }}
- </button>
- </div>
- </div>
- </div>
- <!-- Modal: Reducir velocidad -->
- <div id="modal-throttle" class="hidden fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/40 backdrop-blur-sm">
- <div class="bg-white rounded-2xl shadow-2xl w-full max-w-md p-6">
- <div class="flex items-center gap-3 mb-4">
- <div class="w-10 h-10 rounded-full bg-amber-100 flex items-center justify-center flex-shrink-0">
- <i class="fas fa-tachometer-alt text-amber-500"></i>
- </div>
- <div>
- <h3 class="text-lg font-bold text-gray-800">{{ _("Reducir velocidad") }}</h3>
- <p id="modal-throttle-subtitle" class="text-sm text-gray-500"></p>
- </div>
- </div>
- <p class="text-sm text-gray-600 mb-4">
- {{ _("Asigna la IP del usuario a un") }} <strong>{{ _("delay pool") }}</strong> {{ _("existente. Sus conexiones estarán sujetas a los límites de ancho de banda configurados en ese pool.") }}
- </p>
- <label class="block text-sm font-medium text-gray-700 mb-1">{{ _("Selecciona el delay pool") }}</label>
- <select id="throttle-pool-select" class="w-full border border-gray-200 rounded-lg px-3 py-2 text-sm text-gray-700 focus:outline-none focus:ring-2 focus:ring-amber-300 mb-6">
- <option value="">{{ _("Cargando pools...") }}</option>
- </select>
- <div class="flex justify-end gap-3">
- <button type="button" data-modal-cancel class="px-4 py-2 rounded-lg border border-gray-200 text-gray-600 text-sm hover:bg-gray-50 transition-colors">{{ _("Cancelar") }}</button>
- <button type="button" data-modal-confirm="throttle" class="px-4 py-2 rounded-lg bg-amber-500 hover:bg-amber-600 text-white text-sm font-semibold transition-colors">
- <i class="fas fa-tachometer-alt mr-1.5"></i> {{ _("Aplicar") }}
- </button>
- </div>
- </div>
- </div>
- <!-- Modal: Restaurar velocidad -->
- <div id="modal-unthrottle" class="hidden fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/40 backdrop-blur-sm">
- <div class="bg-white rounded-2xl shadow-2xl w-full max-w-md p-6">
- <div class="flex items-center gap-3 mb-4">
- <div class="w-10 h-10 rounded-full bg-green-100 flex items-center justify-center flex-shrink-0">
- <i class="fas fa-gauge-high text-green-500"></i>
- </div>
- <div>
- <h3 class="text-lg font-bold text-gray-800">{{ _("Restaurar velocidad") }}</h3>
- <p id="modal-unthrottle-subtitle" class="text-sm text-gray-500"></p>
- </div>
- </div>
- <p class="text-sm text-gray-600 mb-6">{{ _("Se eliminará la restricción de velocidad activa para esta IP y se recargará la configuración de Squid.") }}</p>
- <div class="flex justify-end gap-3">
- <button type="button" data-modal-cancel class="px-4 py-2 rounded-lg border border-gray-200 text-gray-600 text-sm hover:bg-gray-50 transition-colors">{{ _("Cancelar") }}</button>
- <button type="button" data-modal-confirm="unthrottle" class="px-4 py-2 rounded-lg bg-green-500 hover:bg-green-600 text-white text-sm font-semibold transition-colors">
- <i class="fas fa-gauge-high mr-1.5"></i> {{ _("Confirmar") }}
- </button>
- </div>
- </div>
- </div>
- <!-- Toast de notificación -->
- <div id="action-toast"
- class="hidden fixed top-20 right-6 z-50 flex items-center gap-3 px-4 py-3 rounded-xl shadow-lg text-sm font-medium transition-all duration-300 max-w-sm">
- <i id="action-toast-icon" class="text-lg"></i>
- <span id="action-toast-message"></span>
- </div>
|