chartManD commited on
Commit
9c0bcad
·
1 Parent(s): 45882da

Salida del sistema Catador, manejo sesion vacio por Catador

Browse files
tecnicas/controllers/views_controller/list_sessions_tester_controller.py CHANGED
@@ -68,7 +68,7 @@ class ListSessionsTesterController():
68
  return controller_error("índice inválido")
69
 
70
  if not sessions_in_page.object_list:
71
- return controller_error("Sin registros de Catadores")
72
 
73
  current_page = sessions_in_page.number
74
  is_last_page = not current_page < paginator.num_pages
 
68
  return controller_error("índice inválido")
69
 
70
  if not sessions_in_page.object_list:
71
+ return controller_error("Sin registros de Participaciones")
72
 
73
  current_page = sessions_in_page.number
74
  is_last_page = not current_page < paginator.num_pages
tecnicas/templates/tecnicas/forms_tester/main_panel_tester.html CHANGED
@@ -1,4 +1,5 @@
1
  {% extends 'tecnicas/layouts/base.html' %}
 
2
 
3
  {% block title %}Panel Principal Tester{% endblock %}
4
 
@@ -11,7 +12,8 @@
11
  <div class="flex flex-col md:flex-row md:items-center md:justify-between gap-3">
12
  <h2 class="card-title text-2xl font-semibold">Información del Usuario</h2>
13
 
14
- <button class="cts-btn-general-compress px-4 py-2 cts-btn-error btn-push">
 
15
  Salir del Sistema
16
  </button>
17
  </div>
@@ -55,7 +57,8 @@
55
  ➕ Nueva sesión
56
  </button>
57
  </a>
58
- <a href="{% url 'cata_system:catador_list_sessions' num_page=1 %}" class="w-fit max-sm:w-full grow">
 
59
  <button class="cts-btn-general-compress px-4 py-2 cts-btn-primary btn-push w-full">
60
  🔍 Ver sesiones
61
  </button>
@@ -63,6 +66,15 @@
63
  </article>
64
  </div>
65
  </div>
 
 
 
 
 
66
  </article>
67
  </article>
 
 
 
 
68
  {% endblock %}
 
1
  {% extends 'tecnicas/layouts/base.html' %}
2
+ {% load static %}
3
 
4
  {% block title %}Panel Principal Tester{% endblock %}
5
 
 
12
  <div class="flex flex-col md:flex-row md:items-center md:justify-between gap-3">
13
  <h2 class="card-title text-2xl font-semibold">Información del Usuario</h2>
14
 
15
+ <button class="cts-btn-general-compress px-4 py-2 cts-btn-error btn-push"
16
+ onclick="exit_sesion('cts-action-form')">
17
  Salir del Sistema
18
  </button>
19
  </div>
 
57
  ➕ Nueva sesión
58
  </button>
59
  </a>
60
+ <a href="{% url 'cata_system:catador_list_sessions' num_page=1 %}"
61
+ class="w-fit max-sm:w-full grow">
62
  <button class="cts-btn-general-compress px-4 py-2 cts-btn-primary btn-push w-full">
63
  🔍 Ver sesiones
64
  </button>
 
66
  </article>
67
  </div>
68
  </div>
69
+
70
+ <form action="" method="post" class="hidden cts-action-form">
71
+ <input type="hidden" name="action" class="action-input">
72
+ {% csrf_token %}
73
+ </form>
74
  </article>
75
  </article>
76
+ {% endblock %}
77
+
78
+ {% block extra_js %}
79
+ <script src="{% static 'js/actions-form.js' %}"></script>
80
  {% endblock %}
tecnicas/templates/tecnicas/forms_tester/sessions_list_tester.html CHANGED
@@ -23,11 +23,7 @@
23
 
24
  {% if error %}
25
  {% include "../components/error-message.html" with message=error %}
26
- {% endif %}
27
- {% if message %}
28
- {% include "../components/error-message.html" with message=message %}
29
- {% endif %}
30
-
31
  <div class="space-y-4">
32
  <h3 class="text-xl font-semibold">Sesiones en las que ha participado</h3>
33
  <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
@@ -42,7 +38,7 @@
42
 
43
  <section class="flex justify-center items-center gap-2">
44
  <div class="join space-x-2">
45
- {% if page != 1 %}
46
  <a href="{% url 'cata_system:catador_list_sessions' num_page=page|add:-1 %}" class="w-fit">
47
  <button class="join-item btn bg-btn-secondary py-1 text-2xl">
48
  ⏮️
@@ -59,6 +55,7 @@
59
  {% endif %}
60
  </div>
61
  </section>
 
62
  </div>
63
  </article>
64
  </article>
 
23
 
24
  {% if error %}
25
  {% include "../components/error-message.html" with message=error %}
26
+ {% else %}
 
 
 
 
27
  <div class="space-y-4">
28
  <h3 class="text-xl font-semibold">Sesiones en las que ha participado</h3>
29
  <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
 
38
 
39
  <section class="flex justify-center items-center gap-2">
40
  <div class="join space-x-2">
41
+ {% if page > 1 %}
42
  <a href="{% url 'cata_system:catador_list_sessions' num_page=page|add:-1 %}" class="w-fit">
43
  <button class="join-item btn bg-btn-secondary py-1 text-2xl">
44
  ⏮️
 
55
  {% endif %}
56
  </div>
57
  </section>
58
+ {% endif %}
59
  </div>
60
  </article>
61
  </article>
tecnicas/views/tester_forms/panel_main_tester.py CHANGED
@@ -1,5 +1,6 @@
 
1
  from django.http import HttpRequest, JsonResponse
2
- from django.shortcuts import render
3
 
4
 
5
  def mainPanelTester(req: HttpRequest):
@@ -13,5 +14,11 @@ def mainPanelTester(req: HttpRequest):
13
  "birthday": req.user.user_catador.nacimiento
14
  }
15
  return render(req, "tecnicas/forms_tester/main_panel_tester.html", view_context)
 
 
 
 
 
 
16
  else:
17
  return JsonResponse({"message": "Método no permitido"})
 
1
+ from django.contrib.auth import logout
2
  from django.http import HttpRequest, JsonResponse
3
+ from django.shortcuts import render, redirect
4
 
5
 
6
  def mainPanelTester(req: HttpRequest):
 
14
  "birthday": req.user.user_catador.nacimiento
15
  }
16
  return render(req, "tecnicas/forms_tester/main_panel_tester.html", view_context)
17
+ elif req.method == "POST":
18
+ if req.POST["action"] == "exit_session":
19
+ logout(req)
20
+ return redirect("cata_system:catador_login")
21
+ else:
22
+ return JsonResponse({"message": "Acción no definida"})
23
  else:
24
  return JsonResponse({"message": "Método no permitido"})