Norberto Montalvo García commited on
Commit
1e87f0c
·
unverified ·
2 Parent(s): f66aa88 6b0731f

Merge pull request #34 from CascoArcilla/HU10

Browse files
tecnicas/controllers/views_controller/create_session/panel_basic_controller.py CHANGED
@@ -1,4 +1,4 @@
1
- from tecnicas.forms import SesionBasicForm, SesionBasicCATAForm
2
  from django.http import HttpRequest
3
  from django.shortcuts import redirect, render
4
  from django.urls import reverse
@@ -12,9 +12,10 @@ class PanelBasicController():
12
 
13
  url_panel_basic = "tecnicas/create_sesion/configuracion-panel-basic.html"
14
  url_panel_basic_cata = "tecnicas/create_sesion/panel-basic-cata.html"
 
15
 
16
- url_next_panel_scales = "cata_system:panel_configuracion_tags"
17
- url_next_panel_cata = "cata_system:panel_configuracion_codes"
18
 
19
  url_select_technique = "cata_system:seleccion_tecnica"
20
 
@@ -50,7 +51,7 @@ class PanelBasicController():
50
  values["name_tecnica"] = name_tecnica
51
  request.session['form_basic'] = values
52
  response = redirect(
53
- reverse("cata_system:panel_configuracion_tags"))
54
  else:
55
  response = render(request, PanelBasicController.url_panel_basic, {
56
  "form_sesion": form, "error": "Información no valida"})
@@ -102,7 +103,7 @@ class PanelBasicController():
102
  values["name_tecnica"] = name_tecnica
103
  request.session['form_basic'] = values
104
  response = redirect(
105
- reverse("cata_system:panel_configuracion_tags"))
106
  else:
107
  response = render(request, PanelBasicController.url_panel_basic, {
108
  "form_sesion": form, "error": "Información no valida"})
@@ -139,9 +140,44 @@ class PanelBasicController():
139
  values["name_tecnica"] = name_tecnica
140
  request.session['form_basic'] = values
141
  response = redirect(
142
- reverse(PanelBasicController.url_next_panel_cata))
143
  else:
144
  response = render(request, PanelBasicController.url_panel_basic, {
145
  "form_sesion": form, "error": "Información no valida"})
146
 
147
  return response
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from tecnicas.forms import SesionBasicForm, SesionBasicCATAForm, SesionBasicPFForm
2
  from django.http import HttpRequest
3
  from django.shortcuts import redirect, render
4
  from django.urls import reverse
 
12
 
13
  url_panel_basic = "tecnicas/create_sesion/configuracion-panel-basic.html"
14
  url_panel_basic_cata = "tecnicas/create_sesion/panel-basic-cata.html"
15
+ url_panel_basic_pf = "tecnicas/create_sesion/panel-basic-pf.html"
16
 
17
+ url_next_panel_tags = "cata_system:panel_configuracion_tags"
18
+ url_next_panel_codes = "cata_system:panel_configuracion_codes"
19
 
20
  url_select_technique = "cata_system:seleccion_tecnica"
21
 
 
51
  values["name_tecnica"] = name_tecnica
52
  request.session['form_basic'] = values
53
  response = redirect(
54
+ reverse(PanelBasicController.url_next_panel_tags))
55
  else:
56
  response = render(request, PanelBasicController.url_panel_basic, {
57
  "form_sesion": form, "error": "Información no valida"})
 
103
  values["name_tecnica"] = name_tecnica
104
  request.session['form_basic'] = values
105
  response = redirect(
106
+ reverse(PanelBasicController.url_next_panel_tags))
107
  else:
108
  response = render(request, PanelBasicController.url_panel_basic, {
109
  "form_sesion": form, "error": "Información no valida"})
 
140
  values["name_tecnica"] = name_tecnica
141
  request.session['form_basic'] = values
142
  response = redirect(
143
+ reverse(PanelBasicController.url_next_panel_codes))
144
  else:
145
  response = render(request, PanelBasicController.url_panel_basic, {
146
  "form_sesion": form, "error": "Información no valida"})
147
 
148
  return response
149
+
150
+ @staticmethod
151
+ def controllGetPF(request: HttpRequest):
152
+ form_sesion = SesionBasicPFForm()
153
+
154
+ view_context = {
155
+ "form_sesion": form_sesion,
156
+ "use_technique": "perfil flash"
157
+ }
158
+
159
+ return render(
160
+ request, PanelBasicController.url_panel_basic_pf, view_context)
161
+
162
+ @staticmethod
163
+ def controllPostPF(request: HttpRequest, name_tecnica: str):
164
+ form = SesionBasicPFForm(request.POST)
165
+
166
+ if form.is_valid():
167
+ print(form.cleaned_data)
168
+ values = {}
169
+ for name, value in form.cleaned_data.items():
170
+ if name == "tipo_escala":
171
+ values[name] = value.id
172
+ else:
173
+ values[name] = value
174
+
175
+ values["name_tecnica"] = name_tecnica
176
+ request.session['form_basic'] = values
177
+ response = redirect(
178
+ reverse(PanelBasicController.url_next_panel_tags))
179
+ else:
180
+ response = render(request, PanelBasicController.url_panel_basic_pf, {
181
+ "form_sesion": form, "error": "Información no valida"})
182
+
183
+ return response
tecnicas/controllers/views_controller/create_session/panel_codes_controller.py CHANGED
@@ -8,7 +8,8 @@ import json
8
 
9
  class PanelCodesController():
10
  url_current_panel = "tecnicas/create_sesion/configuracion-panel-codes.html"
11
- url_next_panel = "cata_system:panel_configuracion_words"
 
12
 
13
  def __init__(self):
14
  pass
@@ -58,14 +59,14 @@ class PanelCodesController():
58
 
59
  codes_sort["sort_codes"] = sorts_code
60
  request.session["form_codes"] = codes_sort
61
- return redirect(reverse(PanelCodesController.url_next_panel))
62
  else:
63
  context_codes_form["error"] = "error en los datos recibidos"
64
 
65
  return render(request, PanelCodesController.url_current_panel, context_codes_form)
66
 
67
  @staticmethod
68
- def controllGetRATA(request: HttpRequest, data):
69
  num_products = data["numero_productos"]
70
  codes_products = generarCodigos(num_products)
71
  form_codes = CodesForm(codes=codes_products)
@@ -73,7 +74,7 @@ class PanelCodesController():
73
  context_codes_form = {
74
  "form_codes": form_codes,
75
  "num_tester": 0,
76
- "use_technique": "rata"
77
  }
78
 
79
  return render(request, PanelCodesController.url_current_panel, context_codes_form)
@@ -96,7 +97,7 @@ class PanelCodesController():
96
 
97
  if form_codes.is_valid():
98
  request.session["form_codes"] = codes
99
- return redirect(reverse(PanelCodesController.url_next_panel))
100
  else:
101
  context_codes_form["error"] = "error en los datos recibidos"
102
 
@@ -114,3 +115,27 @@ class PanelCodesController():
114
  }
115
 
116
  return render(request, PanelCodesController.url_current_panel, context_codes_form)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  class PanelCodesController():
10
  url_current_panel = "tecnicas/create_sesion/configuracion-panel-codes.html"
11
+ url_words = "cata_system:panel_configuracion_words"
12
+ url_create_session = "cata_system:creando_sesion"
13
 
14
  def __init__(self):
15
  pass
 
59
 
60
  codes_sort["sort_codes"] = sorts_code
61
  request.session["form_codes"] = codes_sort
62
+ return redirect(reverse(PanelCodesController.url_words))
63
  else:
64
  context_codes_form["error"] = "error en los datos recibidos"
65
 
66
  return render(request, PanelCodesController.url_current_panel, context_codes_form)
67
 
68
  @staticmethod
69
+ def controllGetRATA(request: HttpRequest, data, name_technique: str):
70
  num_products = data["numero_productos"]
71
  codes_products = generarCodigos(num_products)
72
  form_codes = CodesForm(codes=codes_products)
 
74
  context_codes_form = {
75
  "form_codes": form_codes,
76
  "num_tester": 0,
77
+ "use_technique": name_technique
78
  }
79
 
80
  return render(request, PanelCodesController.url_current_panel, context_codes_form)
 
97
 
98
  if form_codes.is_valid():
99
  request.session["form_codes"] = codes
100
+ return redirect(reverse(PanelCodesController.url_words))
101
  else:
102
  context_codes_form["error"] = "error en los datos recibidos"
103
 
 
115
  }
116
 
117
  return render(request, PanelCodesController.url_current_panel, context_codes_form)
118
+
119
+ @staticmethod
120
+ def controllPostPF(request: HttpRequest):
121
+ codes = []
122
+ context_codes_form = {}
123
+
124
+ for name, value in request.POST.items():
125
+ if name.__contains__("producto_"):
126
+ codes.append(value)
127
+
128
+ form_codes = CodesForm(request.POST, codes=codes)
129
+
130
+ context_codes_form = {
131
+ "form_codes": form_codes,
132
+ "use_technique": "perfil flash"
133
+ }
134
+
135
+ if form_codes.is_valid():
136
+ request.session["form_codes"] = codes
137
+ return redirect(reverse(PanelCodesController.url_create_session))
138
+ else:
139
+ context_codes_form["error"] = "error en los datos recibidos"
140
+
141
+ return render(request, PanelCodesController.url_current_panel, context_codes_form)
tecnicas/controllers/views_controller/create_session/panel_create_controller.py CHANGED
@@ -444,3 +444,104 @@ class PanelCreateController():
444
  return general_error(f"Error: {e}")
445
  else:
446
  return general_error("No se ha establecido acción")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
444
  return general_error(f"Error: {e}")
445
  else:
446
  return general_error("No se ha establecido acción")
447
+
448
+ @staticmethod
449
+ def controllPostPF(request: HttpRequest):
450
+ if request.POST.get('action') == 'create_session':
451
+ if not request.session.get("form_codes") or not request.session.get("form_tags"):
452
+ deleteDataSession(request)
453
+ return general_error("No se ha especificado información necesaria para la creación de la sesión, por favor, vuelve a intentarlo")
454
+ try:
455
+ with transaction.atomic():
456
+ # ////////////////////////////////////////////////////// #
457
+ #
458
+ # First step: Create technique and scale with their tags #
459
+ #
460
+ # ////////////////////////////////////////////////////// #
461
+ data_basic = request.session["form_basic"]
462
+ data_basic["numero_repeticiones"] = 0
463
+
464
+ technique = Tecnica.objects.create(
465
+ tipo_tecnica=TipoTecnica.objects.get(
466
+ nombre_tecnica=data_basic["name_tecnica"]),
467
+ id_estilo=EstiloPalabra.objects.get(
468
+ nombre_estilo="vocabulario"),
469
+ repeticiones_max=data_basic["numero_repeticiones"],
470
+ limite_catadores=data_basic["numero_catadores"],
471
+ instrucciones=data_basic["instrucciones"] or "Espere instrucciones del Presentador",
472
+ )
473
+
474
+ if not technique:
475
+ raise ValueError("Error al guardar la técnica")
476
+
477
+ data_scale = {
478
+ "id_scale": data_basic["tipo_escala"],
479
+ "size": data_basic["tamano_escala"],
480
+ "technique": technique
481
+ }
482
+
483
+ controllerScale = EscalaController(data=data_scale)
484
+
485
+ scale = controllerScale.saveScale()
486
+ if isinstance(scale, dict):
487
+ raise ValueError(scale["error"])
488
+
489
+ dict_tags = request.session["form_tags"]
490
+ saved_related_tags = controllerScale.realteTags(dict_tags)
491
+ if "error" in saved_related_tags:
492
+ raise ValueError(saved_related_tags["error"])
493
+
494
+ # ////////////////////////////////////////////// #
495
+ #
496
+ # Second step: Create productos with their codes #
497
+ #
498
+ # ////////////////////////////////////////////// #
499
+ codes = request.session["form_codes"]
500
+
501
+ if not codes:
502
+ raise ValueError("No hay códigos de productos")
503
+
504
+ products_without_save = []
505
+ for code in codes:
506
+ product = Producto(
507
+ codigoProducto=code,
508
+ id_tecnica=technique
509
+ )
510
+ products_without_save.append(product)
511
+
512
+ Producto.objects.bulk_create(products_without_save)
513
+
514
+ # /////////////////////////////////////////////////////// #
515
+ #
516
+ # Third step: Create session and relat with the technique #
517
+ #
518
+ # /////////////////////////////////////////////////////// #
519
+ session = SesionSensorial.objects.create(
520
+ nombre_sesion=data_basic["nombre_sesion"] if data_basic["nombre_sesion"] != "" else None,
521
+ tecnica=technique,
522
+ creadoPor=request.user.user_presentador
523
+ )
524
+
525
+ if not session:
526
+ raise ValueError("Error al crear sesion sensorial")
527
+
528
+ context = {
529
+ "message": "sesión creada",
530
+ "data": {
531
+ "codigo_sesion": session.codigo_sesion,
532
+ "nombre_sesion": session.nombre_sesion
533
+ }
534
+ }
535
+
536
+ # ////////////////////////////////// #
537
+ #
538
+ # Final step: Delete date en session #
539
+ #
540
+ # ////////////////////////////////// #
541
+ deleteDataSession(request)
542
+ return JsonResponse(context)
543
+
544
+ except ValueError as e:
545
+ return general_error(f"Error: {e}")
546
+ else:
547
+ return general_error("No se ha establecido acción")
tecnicas/forms/__init__.py CHANGED
@@ -1,5 +1,6 @@
1
  from .create_session.sesion_basic_form import SesionBasicForm
2
  from .create_session.sesiob_basic_cata_form import SesionBasicCATAForm
 
3
  from .create_session.sesion_tags_form import SesionTagsForm
4
 
5
  from .etiqueta_form import EtiquetaForm
 
1
  from .create_session.sesion_basic_form import SesionBasicForm
2
  from .create_session.sesiob_basic_cata_form import SesionBasicCATAForm
3
+ from .create_session.sesion_basic_pf_form import SesionBasicPFForm
4
  from .create_session.sesion_tags_form import SesionTagsForm
5
 
6
  from .etiqueta_form import EtiquetaForm
tecnicas/forms/create_session/sesion_basic_pf_form.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from django import forms
2
+ from tecnicas.models import TipoEscala
3
+
4
+
5
+ class SesionBasicPFForm(forms.Form):
6
+ nombre_sesion = forms.CharField(max_length=255, widget=forms.TextInput(attrs={
7
+ "class": "bg-surface-ligt border-b-1 text-center w-full p-1",
8
+ "name": "nombre_sesion",
9
+ "placeholder": "Ej. Mermelada de mango picante"
10
+ }), required=False)
11
+
12
+ numero_productos = forms.IntegerField(widget=forms.NumberInput(attrs={
13
+ "class": "bg-surface-ligt p-1 border-b-1 text-center w-full",
14
+ "placeholder": "Solo números"
15
+ }), required=True)
16
+
17
+ numero_catadores = forms.IntegerField(widget=forms.NumberInput(attrs={
18
+ "class": "bg-surface-ligt p-1 border-b-1 text-center w-full",
19
+ "placeholder": "Solo números"
20
+ }), required=True)
21
+
22
+ instrucciones = forms.CharField(max_length=255, widget=forms.TextInput(attrs={
23
+ "class": "bg-surface-ligt border-b-1 text-center w-full p-1",
24
+ "placeholder": "Este campo es opcional"
25
+ }), required=False)
26
+
27
+ def __init__(self, *args, **kwargs):
28
+ super().__init__(*args, **kwargs)
29
+
30
+ self.fields['tipo_escala'] = forms.ModelChoiceField(queryset=TipoEscala.objects.all(), widget=forms.RadioSelect(attrs={
31
+ "class": "uppercase text-lg tracking-wider font-medium p-2 px-4 active:px-5 transition-all rounded-xl bg-blue-500 text-white",
32
+ }), required=True, initial=TipoEscala.objects.first())
33
+
34
+ self.fields['tamano_escala'] = forms.IntegerField(widget=forms.HiddenInput(attrs={
35
+ "class": "cts-size-input",
36
+ }), required=True)
tecnicas/static/js/panel-basic-cata.js CHANGED
@@ -10,6 +10,7 @@ let radiosStyleWords;
10
 
11
  function initRadiosStyleWords() {
12
  radiosStyleWords = document.getElementsByName("estilo_palabras");
 
13
 
14
  for (let index = 0; index < radiosStyleWords.length; index++) {
15
  const radio = radiosStyleWords[index];
 
10
 
11
  function initRadiosStyleWords() {
12
  radiosStyleWords = document.getElementsByName("estilo_palabras");
13
+ console.log(radiosStyleWords);
14
 
15
  for (let index = 0; index < radiosStyleWords.length; index++) {
16
  const radio = radiosStyleWords[index];
tecnicas/static/js/panel-basic.js CHANGED
@@ -22,12 +22,13 @@ initPanel();
22
 
23
  function initPanel() {
24
  initRadios();
 
25
  }
26
 
27
  function initRadios() {
28
- inputsScale = document.getElementsByName("tipo_escala");
29
  inputTamano = document.getElementsByName("tamano_escala").item(0);
30
- sizeOptionsContainer = document.getElementsByClassName("cts-options-size-scale")[0];
 
31
 
32
  for (let index = 0; index < inputsScale.length; index++) {
33
  let parent = inputsScale.item(index).parentElement;
@@ -52,14 +53,16 @@ function initRadios() {
52
  showDescriptionStyle(parent);
53
  }
54
  }
55
-
56
- initSizeOptions();
57
  }
58
 
59
  function initSizeOptions() {
 
 
 
 
60
  for (let i = 0; i < inputsScale.length; i++) {
61
  const radio = inputsScale.item(i);
62
- radio.addEventListener('change', () => {
63
  const tag = getTagFromLabel(radio);
64
  populateSizeOptions(tag);
65
  });
@@ -69,17 +72,21 @@ function initSizeOptions() {
69
  }
70
  }
71
 
72
- const form = document.querySelector('form');
73
  if (!form) return;
74
 
75
- form.addEventListener('submit', (e) => {
76
- const chosen = document.querySelector('input[name="option_size_scale"]:checked');
 
 
77
  if (chosen && inputTamano) {
78
  inputTamano.value = chosen.value;
79
  }
80
 
81
  if (sizeOptionsContainer) {
82
- const toRemove = sizeOptionsContainer.querySelectorAll('input[name="option_size_scale"]');
 
 
83
  toRemove.forEach((el) => el.remove());
84
  }
85
  });
@@ -88,37 +95,42 @@ function initSizeOptions() {
88
  function getTagFromLabel(radio) {
89
  try {
90
  const parent = radio.parentElement;
91
- if (!parent) return '';
92
- const text = parent.textContent || '';
93
  return text.trim().split(/\s+/)[0].toLowerCase();
94
  } catch (err) {
95
- return '';
96
  }
97
  }
98
 
99
  function populateSizeOptions(tag) {
100
- const options = SIZE_OPTIONS[tag] || SIZE_OPTIONS['estructurada'];
101
  if (!sizeOptionsContainer) return;
102
- sizeOptionsContainer.innerHTML = '';
103
 
104
  options.forEach((val) => {
105
- const label = document.createElement('label');
106
- label.className = 'flex flex-col items-center cursor-pointer';
107
 
108
- const input = document.createElement('input');
109
- input.type = 'radio';
110
- input.name = 'option_size_scale';
111
  input.value = String(val);
112
- input.className = 'radio radio-lg checked:bg-pink-500';
113
 
114
- const span = document.createElement('span');
115
- span.className = 'mt-2 text-xl text-gray-700 font-medium';
116
  span.textContent = String(val);
117
 
118
  label.appendChild(input);
119
  label.appendChild(span);
120
  sizeOptionsContainer.appendChild(label);
121
  });
 
 
 
 
 
122
  }
123
 
124
  function showDescriptionStyle(label) {
 
22
 
23
  function initPanel() {
24
  initRadios();
25
+ initSizeOptions();
26
  }
27
 
28
  function initRadios() {
 
29
  inputTamano = document.getElementsByName("tamano_escala").item(0);
30
+ inputsScale = document.getElementsByName("tipo_escala");
31
+ inputsScale.item(0).checked = true;
32
 
33
  for (let index = 0; index < inputsScale.length; index++) {
34
  let parent = inputsScale.item(index).parentElement;
 
53
  showDescriptionStyle(parent);
54
  }
55
  }
 
 
56
  }
57
 
58
  function initSizeOptions() {
59
+ sizeOptionsContainer = document.getElementsByClassName(
60
+ "cts-options-size-scale"
61
+ )[0];
62
+
63
  for (let i = 0; i < inputsScale.length; i++) {
64
  const radio = inputsScale.item(i);
65
+ radio.addEventListener("change", () => {
66
  const tag = getTagFromLabel(radio);
67
  populateSizeOptions(tag);
68
  });
 
72
  }
73
  }
74
 
75
+ const form = document.querySelector("form");
76
  if (!form) return;
77
 
78
+ form.addEventListener("submit", (e) => {
79
+ const chosen = document.querySelector(
80
+ 'input[name="option_size_scale"]:checked'
81
+ );
82
  if (chosen && inputTamano) {
83
  inputTamano.value = chosen.value;
84
  }
85
 
86
  if (sizeOptionsContainer) {
87
+ const toRemove = sizeOptionsContainer.querySelectorAll(
88
+ 'input[name="option_size_scale"]'
89
+ );
90
  toRemove.forEach((el) => el.remove());
91
  }
92
  });
 
95
  function getTagFromLabel(radio) {
96
  try {
97
  const parent = radio.parentElement;
98
+ if (!parent) return "";
99
+ const text = parent.textContent || "";
100
  return text.trim().split(/\s+/)[0].toLowerCase();
101
  } catch (err) {
102
+ return "";
103
  }
104
  }
105
 
106
  function populateSizeOptions(tag) {
107
+ const options = SIZE_OPTIONS[tag] || SIZE_OPTIONS["estructurada"];
108
  if (!sizeOptionsContainer) return;
109
+ sizeOptionsContainer.innerHTML = "";
110
 
111
  options.forEach((val) => {
112
+ const label = document.createElement("label");
113
+ label.className = "flex flex-col items-center cursor-pointer";
114
 
115
+ const input = document.createElement("input");
116
+ input.type = "radio";
117
+ input.name = "option_size_scale";
118
  input.value = String(val);
119
+ input.className = "radio radio-lg checked:bg-pink-500";
120
 
121
+ const span = document.createElement("span");
122
+ span.className = "mt-2 text-xl text-gray-700 font-medium";
123
  span.textContent = String(val);
124
 
125
  label.appendChild(input);
126
  label.appendChild(span);
127
  sizeOptionsContainer.appendChild(label);
128
  });
129
+
130
+ const firstRadioSize = document
131
+ .getElementsByName("option_size_scale")
132
+ .item(0);
133
+ firstRadioSize.checked = true;
134
  }
135
 
136
  function showDescriptionStyle(label) {
tecnicas/templates/tecnicas/create_sesion/panel-basic-pf.html ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'tecnicas/layouts/base.html' %}
2
+ {% load static %}
3
+
4
+ {% block title %}Panel Configuracion{% endblock %}
5
+
6
+ {% block content %}
7
+ <article class="cts-container-main">
8
+ <article class="cts-wrap-content text-black">
9
+ <h1 class="text-center font-bold text-4xl">Panel de configuración</h1>
10
+
11
+ {% if error %}
12
+ {% include "../components/error-message.html" with message=error %}
13
+ {% endif %}
14
+ {% if message %}
15
+ {% include "../components/error-message.html" with message=message %}
16
+ {% endif %}
17
+
18
+ <form method="post" action="" class="space-y-4">
19
+ {% csrf_token %}
20
+ <article>
21
+ <h2 class="text-2xl mb-2 font-bold">Información Basica</h2>
22
+ <section class="flex justify-center items-center">
23
+ <label for="{{form_sesion.nombre_sesion.id_for_label}}"
24
+ class="text-lg flex flex-col items-center px-2 w-fit font-medium tracking-wide mb-4">
25
+ <p class="tracking-normal text-xl font-bold">Ingrese el nombre de la sesion si lo desea:</p>
26
+ {{ form_sesion.nombre_sesion }}
27
+ </label>
28
+ </section>
29
+ <section class="flex flex-row flex-wrap justify-center gap-4">
30
+ <label for="{{ form_sesion.numero_productos.id_for_label }}"
31
+ class="text-lg flex flex-col items-center px-2 font-medium tracking-wide">
32
+ <p class="tracking-normal text-base font-bold">
33
+ Número de Productos:
34
+ </p>
35
+ {{ form_sesion.numero_productos }}
36
+ </label>
37
+ <label for="{{ form_sesion.numero_catadores.id_for_label }}"
38
+ class="text-lg flex flex-col items-center px-2 font-medium tracking-wide">
39
+ <p class="tracking-normal text-base font-bold">
40
+ Número de Catadores:
41
+ </p>
42
+ {{ form_sesion.numero_catadores }}
43
+ </label>
44
+ </section>
45
+ <section class="flex justify-center items-center mt-2">
46
+ <label for="{{form_sesion.instrucciones.id_for_label}}"
47
+ class="text-lg flex flex-col items-center px-2 w-fit font-medium tracking-wide mb-4">
48
+ <p class="tracking-normal text-base font-bold">Ingrese las instrucciones para la tecnica:</p>
49
+ {{ form_sesion.instrucciones }}
50
+ </label>
51
+ </section>
52
+ </article>
53
+
54
+ <article class="cs-escalas-radio flex flex-col gap-4">
55
+ <h2 class="text-2xl font-bold">Selecciona una escala</h2>
56
+ <section class="flex flex-row gap-4 justify-around flex-wrap">
57
+ {% for escala in form_sesion.tipo_escala %}
58
+ <label for="{{escala.id_for_label}}"
59
+ class="ct-radio-escala uppercase text-lg tracking-wider font-bold p-2 px-4 rounded-xl cts-btn-primary btn-push">
60
+ {{ escala.tag }}
61
+ {{ escala.choice_label }}
62
+ </label>
63
+ {% endfor %}
64
+ {% if form_sesion.tipo_escala.errors %}
65
+ <div class="w-full text-center text-red-600 text-xl font-medium tracking-wide">
66
+ {{ form_sesion.tipo_escala.errors }}
67
+ </div>
68
+ {% endif %}
69
+ </section>
70
+
71
+ <section class="py-2 px-5 flex flex-col justify-center items-center gap-2 relative">
72
+ <label for="{{ form_sesion.tamano_escala.id_for_label }}"
73
+ class="ct-size-scale text-xl flex flex-col items-center px-2 font-bold">
74
+ <p>Establece número de segmentos:</p>
75
+ {{ form_sesion.tamano_escala }}
76
+ </label>
77
+ <div class="flex justify-around max-sm:flex-col gap-8 cts-options-size-scale">
78
+ <label class="flex flex-col items-center cursor-pointer">
79
+ <input type="radio" name="option_size_scale" value="5"
80
+ class="radio radio-lg checked:bg-pink-500" />
81
+ <span class="mt-2 text-xl text-gray-700 font-medium">5</span>
82
+ </label>
83
+ <label class="flex flex-col items-center cursor-pointer">
84
+ <input type="radio" name="option_size_scale" value="7"
85
+ class="radio radio-lg checked:bg-pink-500" />
86
+ <span class="mt-2 text-xl text-gray-700 font-medium">7</span>
87
+ </label>
88
+ <label class="flex flex-col items-center cursor-pointer">
89
+ <input type="radio" name="option_size_scale" value="9"
90
+ class="radio radio-lg checked:bg-pink-500" />
91
+ <span class="mt-2 text-xl text-gray-700 font-medium">9</span>
92
+ </label>
93
+ </div>
94
+ {% if form_sesion.tamano_escala.errors %}
95
+ <article
96
+ class="w-fit rounded px-2 py-0.5 text-center text-white text-sm font-medium tracking-wide bg-red-500">
97
+ {{ form_sesion.tamano_escala.errors }}
98
+ </article>
99
+ {% endif %}
100
+ </section>
101
+ </article>
102
+
103
+ <article class="w-full flex max-sm:flex-col flex-wrap items-center justify-center gap-4">
104
+ <button type="submit" class="cts-btn-general cts-btn-primary btn-push flex-1/4 w-full">
105
+ Continuar
106
+ </button>
107
+ <a href="{% url 'cata_system:seleccion_tecnica' %}" class="flex-1/4 w-full">
108
+ <button type="button" class="cts-btn-general cts-btn-error btn-push w-full">
109
+ Cancelar la creación
110
+ </button>
111
+ </a>
112
+ </article>
113
+ </form>
114
+ </article>
115
+ </article>
116
+ {% endblock %}
117
+
118
+ {% block extra_js %}
119
+ <script src="{% static 'js/panel-basic.js' %}"></script>
120
+ {% endblock %}
tecnicas/views/sessions_config/configuration_panel_basic.py CHANGED
@@ -17,6 +17,8 @@ def configurationPanelBasic(req: HttpRequest):
17
  response = PanelBasicController.controllGetRATA(request=req)
18
  elif name_tecnica == "cata":
19
  response = PanelBasicController.controllGetCATA(request=req)
 
 
20
  else:
21
  response = redirect(
22
  reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida o sin implementar")
@@ -34,6 +36,9 @@ def configurationPanelBasic(req: HttpRequest):
34
  elif name_tecnica == "cata":
35
  response = PanelBasicController.controllPostCATA(
36
  request=req, name_tecnica=name_tecnica)
 
 
 
37
  else:
38
  response = redirect(
39
  reverse("cata_system:seleccion_tecnica") + "?error=¡Oh, vaya! Cambio de técnica repentino, vuelve a elegir otra vez")
 
17
  response = PanelBasicController.controllGetRATA(request=req)
18
  elif name_tecnica == "cata":
19
  response = PanelBasicController.controllGetCATA(request=req)
20
+ elif name_tecnica == "perfil flash":
21
+ response = PanelBasicController.controllGetPF(request=req)
22
  else:
23
  response = redirect(
24
  reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida o sin implementar")
 
36
  elif name_tecnica == "cata":
37
  response = PanelBasicController.controllPostCATA(
38
  request=req, name_tecnica=name_tecnica)
39
+ elif name_tecnica == "perfil flash":
40
+ response = PanelBasicController.controllPostPF(
41
+ request=req, name_tecnica=name_tecnica)
42
  else:
43
  response = redirect(
44
  reverse("cata_system:seleccion_tecnica") + "?error=¡Oh, vaya! Cambio de técnica repentino, vuelve a elegir otra vez")
tecnicas/views/sessions_config/configuration_panel_codes.py CHANGED
@@ -18,12 +18,9 @@ def configurationPanelCodes(req: HttpRequest):
18
  if name_technique == "escalas":
19
  response = PanelCodesController.controllGetEscalas(
20
  req, data_basic)
21
- elif name_technique == "rata":
22
  response = PanelCodesController.controllGetRATA(
23
- req, data_basic)
24
- elif name_technique == "cata":
25
- response = PanelCodesController.controllGetCATA(
26
- req, data_basic)
27
  else:
28
  response = redirect(
29
  reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
@@ -38,6 +35,9 @@ def configurationPanelCodes(req: HttpRequest):
38
  elif name_technique == "cata":
39
  response = PanelCodesController.controllPostRATA(
40
  request=req, is_rata=False)
 
 
 
41
  else:
42
  response = redirect(
43
  reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
 
18
  if name_technique == "escalas":
19
  response = PanelCodesController.controllGetEscalas(
20
  req, data_basic)
21
+ elif name_technique == "rata" or name_technique == "cata" or "perfil flash":
22
  response = PanelCodesController.controllGetRATA(
23
+ request=req, data=data_basic, name_technique=name_technique)
 
 
 
24
  else:
25
  response = redirect(
26
  reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
 
35
  elif name_technique == "cata":
36
  response = PanelCodesController.controllPostRATA(
37
  request=req, is_rata=False)
38
+ elif name_technique == "perfil flash":
39
+ response = PanelCodesController.controllPostPF(
40
+ request=req)
41
  else:
42
  response = redirect(
43
  reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
tecnicas/views/sessions_config/configuration_panel_tags.py CHANGED
@@ -12,9 +12,10 @@ def configurationPanelTags(req: HttpRequest):
12
  "?error=datos requeridos no encontrados")
13
 
14
  basic_data = req.session.get("form_basic")
 
15
 
16
  if req.method == "GET":
17
- if basic_data["name_tecnica"] == "escalas" or basic_data["name_tecnica"] == "rata":
18
  response = PanelTagsController.controllGetEscalas(
19
  request=req, data=basic_data)
20
  else:
@@ -23,7 +24,7 @@ def configurationPanelTags(req: HttpRequest):
23
 
24
  return response
25
  elif req.method == "POST":
26
- if basic_data["name_tecnica"] == "escalas" or basic_data["name_tecnica"] == "rata":
27
  response = PanelTagsController.controllPostEscalas(
28
  request=req, data=basic_data)
29
  else:
 
12
  "?error=datos requeridos no encontrados")
13
 
14
  basic_data = req.session.get("form_basic")
15
+ name_technique = basic_data["name_tecnica"]
16
 
17
  if req.method == "GET":
18
+ if name_technique == "escalas" or name_technique == "rata" or name_technique == "perfil flash":
19
  response = PanelTagsController.controllGetEscalas(
20
  request=req, data=basic_data)
21
  else:
 
24
 
25
  return response
26
  elif req.method == "POST":
27
+ if name_technique == "escalas" or name_technique == "rata" or name_technique == "perfil flash":
28
  response = PanelTagsController.controllPostEscalas(
29
  request=req, data=basic_data)
30
  else:
tecnicas/views/sessions_config/create_session.py CHANGED
@@ -15,7 +15,7 @@ def createSession(req: HttpRequest):
15
  name_technique = basic_data["name_tecnica"]
16
 
17
  if req.method == "GET":
18
- if name_technique == "escalas" or name_technique == "rata" or name_technique == "cata":
19
  response = PanelCreateController.controllGetEscalas(req)
20
  else:
21
  response = redirect(
@@ -29,6 +29,8 @@ def createSession(req: HttpRequest):
29
  response = PanelCreateController.controllPostRATA(req)
30
  elif name_technique == "cata":
31
  response = PanelCreateController.controllPostCATA(req)
 
 
32
  else:
33
  response = redirect(
34
  reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
 
15
  name_technique = basic_data["name_tecnica"]
16
 
17
  if req.method == "GET":
18
+ if name_technique == "escalas" or name_technique == "rata" or name_technique == "cata" or name_technique == "perfil flash":
19
  response = PanelCreateController.controllGetEscalas(req)
20
  else:
21
  response = redirect(
 
29
  response = PanelCreateController.controllPostRATA(req)
30
  elif name_technique == "cata":
31
  response = PanelCreateController.controllPostCATA(req)
32
+ elif name_technique == "perfil flash":
33
+ response = PanelCreateController.controllPostPF(req)
34
  else:
35
  response = redirect(
36
  reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")