179 lines
8.4 KiB
HTML
179 lines
8.4 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Gestionar Feeds RSS{% endblock %}
|
|
|
|
{% block content %}
|
|
|
|
<div class="card feed-detail-card">
|
|
<div class="feed-header">
|
|
<h2>Lista de Feeds RSS</h2>
|
|
<div class="nav-actions">
|
|
<a href="{{ url_for('add_feed') }}" class="btn btn-small">
|
|
<i class="fas fa-plus"></i> Añadir Feed
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Filtros avanzados -->
|
|
<div class="feed-body" style="padding: 15px 15px 0 15px;">
|
|
<form class="feed-filters" method="get" action="{{ url_for('manage_feeds') }}">
|
|
<div class="filters-row" style="display:flex; flex-wrap:wrap; gap:10px;">
|
|
<div style="flex:1 1 200px;">
|
|
<label for="pais_id" class="form-label">País</label>
|
|
<select name="pais_id" id="pais_id" class="form-select">
|
|
<option value="">Todos los países</option>
|
|
{% for p in paises %}
|
|
<option value="{{ p.id }}"
|
|
{% if filtro_pais_id is not none and p.id == filtro_pais_id|int %}selected{% endif %}>
|
|
{{ p.nombre }}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
|
|
<div style="flex:1 1 200px;">
|
|
<label for="categoria_id" class="form-label">Categoría</label>
|
|
<select name="categoria_id" id="categoria_id" class="form-select">
|
|
<option value="">Todas las categorías</option>
|
|
{% for c in categorias %}
|
|
<option value="{{ c.id }}"
|
|
{% if filtro_categoria_id is not none and c.id == filtro_categoria_id|int %}selected{% endif %}>
|
|
{{ c.nombre }}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
|
|
<div style="flex:1 1 200px;">
|
|
<label for="estado" class="form-label">Estado</label>
|
|
<select name="estado" id="estado" class="form-select">
|
|
<option value="" {% if not filtro_estado %}selected{% endif %}>Todos</option>
|
|
<option value="activos" {% if filtro_estado == "activos" %}selected{% endif %}>Activos</option>
|
|
<option value="inactivos" {% if filtro_estado == "inactivos" %}selected{% endif %}>Inactivos</option>
|
|
<option value="errores" {% if filtro_estado == "errores" %}selected{% endif %}>Con errores</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div style="flex:0 0 auto; align-self:flex-end;">
|
|
<button type="submit" class="btn btn-small">
|
|
<i class="fas fa-filter"></i> Filtrar
|
|
</button>
|
|
<a href="{{ url_for('manage_feeds') }}" class="btn btn-small btn-secondary">
|
|
Limpiar
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<!-- Resumen resultados -->
|
|
<div class="mt-2" style="margin-top: 10px;">
|
|
<strong>{{ total_feeds }}</strong> feeds encontrados
|
|
{% if filtro_pais_id or filtro_categoria_id or filtro_estado %}
|
|
<span class="text-muted" style="font-size:0.9em;">(con filtros aplicados)</span>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="feed-body" style="padding: 0;">
|
|
<table style="width:100%; border-collapse: collapse;">
|
|
<thead>
|
|
<tr style="background-color: rgba(0,0,0,0.05);">
|
|
<th style="padding: 12px 15px; text-align: left;">Nombre</th>
|
|
<th style="padding: 12px 15px; text-align: left;">Categoría</th>
|
|
<th style="padding: 12px 15px; text-align: left;">País</th>
|
|
<th style="padding: 12px 15px; text-align: center;">Estado</th>
|
|
<th style="padding: 12px 15px; text-align: center;">Fallos</th>
|
|
<th style="padding: 12px 15px; text-align: right;">Acciones</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for feed in feeds %}
|
|
<tr {% if feed.fallos and feed.fallos > 0 %}style="background-color: rgba(192,57,43,0.05);" {% endif %}>
|
|
<td style="padding: 12px 15px; border-top: 1px solid var(--border-color);">
|
|
<a href="{{ feed.url }}" target="_blank" title="{{ feed.url }}">{{ feed.nombre }}</a>
|
|
</td>
|
|
<td style="padding: 12px 15px; border-top: 1px solid var(--border-color);">
|
|
{{ feed.categoria or 'N/A' }}
|
|
</td>
|
|
<td style="padding: 12px 15px; border-top: 1px solid var(--border-color);">
|
|
{{ feed.pais or 'Global' }}
|
|
</td>
|
|
<td style="padding: 12px 15px; border-top: 1px solid var(--border-color); text-align: center;">
|
|
{% if not feed.activo %}
|
|
<span style="color: #c0392b; font-weight: bold;"
|
|
title="Inactivo por {{ feed.fallos or 0 }} fallos">KO</span>
|
|
{% else %}
|
|
<span style="color: #27ae60; font-weight:bold;">OK</span>
|
|
{% endif %}
|
|
</td>
|
|
<td style="padding: 12px 15px; border-top: 1px solid var(--border-color); text-align:center;">
|
|
{{ feed.fallos or 0 }}
|
|
</td>
|
|
<td style="padding: 12px 15px; text-align: right; border-top: 1px solid var(--border-color);">
|
|
<a href="{{ url_for('edit_feed', feed_id=feed.id) }}"
|
|
class="btn btn-small btn-info" title="Editar">
|
|
<i class="fas fa-edit"></i>
|
|
</a>
|
|
<a href="{{ url_for('delete_feed', feed_id=feed.id) }}"
|
|
class="btn btn-small btn-danger" title="Eliminar"
|
|
onclick="return confirm('¿Estás seguro de que quieres eliminar este feed?')">
|
|
<i class="fas fa-trash"></i>
|
|
</a>
|
|
{% if not feed.activo %}
|
|
<a href="{{ url_for('reactivar_feed', feed_id=feed.id) }}"
|
|
class="btn btn-small" title="Reactivar">
|
|
<i class="fas fa-sync-alt"></i>
|
|
</a>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr>
|
|
<td colspan="6" style="padding: 20px; text-align: center;">
|
|
No hay feeds para mostrar.
|
|
<a href="{{ url_for('add_feed') }}">Añade el primero</a>.
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
{% if total_pages > 1 %}
|
|
<nav class="pagination">
|
|
{% if page > 1 %}
|
|
<a href="{{ url_for('manage_feeds',
|
|
page=page-1,
|
|
pais_id=filtro_pais_id,
|
|
categoria_id=filtro_categoria_id,
|
|
estado=filtro_estado) }}"
|
|
class="page-link">« Anterior</a>
|
|
{% endif %}
|
|
|
|
{% for p in range(1, total_pages + 1) %}
|
|
{% if p == page %}
|
|
<a href="#" class="page-link active">{{ p }}</a>
|
|
{% else %}
|
|
<a href="{{ url_for('manage_feeds',
|
|
page=p,
|
|
pais_id=filtro_pais_id,
|
|
categoria_id=filtro_categoria_id,
|
|
estado=filtro_estado) }}"
|
|
class="page-link">{{ p }}</a>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% if page < total_pages %}
|
|
<a href="{{ url_for('manage_feeds',
|
|
page=page+1,
|
|
pais_id=filtro_pais_id,
|
|
categoria_id=filtro_categoria_id,
|
|
estado=filtro_estado) }}"
|
|
class="page-link">Siguiente »</a>
|
|
{% endif %}
|
|
</nav>
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
|
|