diff --git a/home/templates/partials/ban_history.html b/home/templates/partials/ban_history.html
index 7fc56e2..fc7d026 100644
--- a/home/templates/partials/ban_history.html
+++ b/home/templates/partials/ban_history.html
@@ -25,71 +25,12 @@
-
-
-
- | Fecha de Baneo |
- Fecha de Desbaneo |
- Motivo |
- Estado |
-
- {% if account_bans and character_bans %}
- Cuenta / Personaje
- {% elif account_bans %}
- Cuenta
- {% elif character_bans %}
- Personaje
- {% else %}
- Fuente
- {% endif %}
- |
-
-
-
- {% if account_bans %}
- {% for ban in account_bans %}
-
- | {{ ban.0|default:"No disponible" }} |
- {{ ban.1|default:"No disponible" }} |
- {{ ban.2 }} |
-
- {% if ban.3 == 1 %}
- Activo
- {% else %}
- Inactivo
- {% endif %}
- |
- Cuenta: {{ ban.4 }} |
-
- {% endfor %}
- {% else %}
-
- | No hay baneos en la cuenta. |
-
- {% endif %}
-
- {% if character_bans %}
- {% for ban in character_bans %}
-
- | {{ ban.0|default:"No disponible" }} |
- {{ ban.1|default:"No disponible" }} |
- {{ ban.2 }} |
-
- {% if ban.3 == 1 %}
- Activo
- {% else %}
- Inactivo
- {% endif %}
- |
- Personaje: {{ ban.4 }} |
-
- {% endfor %}
- {% else %}
-
- | No hay baneos en los personajes. |
-
- {% endif %}
-
-
+ {% load django_vite %}
+
+
+ {{ ban_rows|json_script:"history-table-data" }}
+ {% vite_asset 'src/entries/history_table.tsx' %}
\ No newline at end of file
diff --git a/home/views/history.py b/home/views/history.py
index 31ffee6..a71e6ea 100644
--- a/home/views/history.py
+++ b/home/views/history.py
@@ -55,10 +55,23 @@ def ban_history_view(request):
account_bans, character_bans = get_ban_history(account_id)
+ def _row(b, origen):
+ return {
+ 'fecha_baneo': b[0] or 'No disponible',
+ 'fecha_desbaneo': b[1] or 'No disponible',
+ 'motivo': b[2],
+ 'estado': 'Activo' if b[3] == 1 else 'Inactivo',
+ 'origen': f'{origen}: {b[4]}',
+ }
+
+ ban_rows = ([_row(b, 'Cuenta') for b in account_bans]
+ + [_row(b, 'Personaje') for b in character_bans])
+
return render(request, 'account/ban_history.html', {
'account_bans': account_bans,
'character_bans': character_bans,
- 'now': datetime.now(),
+ 'ban_rows': ban_rows,
+ 'now': datetime.now(),
})
def security_history_view(request):
username = request.session.get('username')