Spaces:
Sleeping
Sleeping
Se muestra la primera categoria para tecnicas sensoriales
Browse files
tecnicas/controllers/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
from .tecnica_controller import TecnicaController
|
tecnicas/controllers/tecnica_controller.py
CHANGED
|
@@ -1,20 +1,22 @@
|
|
| 1 |
-
from models import TipoTecnica, CategoriaTecnica
|
| 2 |
|
| 3 |
class TecnicaController():
|
| 4 |
def __init__(self):
|
| 5 |
pass
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
|
|
|
| 9 |
categorias = CategoriaTecnica.objects.all()
|
| 10 |
|
| 11 |
-
for categoria in categorias:
|
| 12 |
-
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
| 1 |
+
from ..models import TipoTecnica, CategoriaTecnica
|
| 2 |
|
| 3 |
class TecnicaController():
|
| 4 |
def __init__(self):
|
| 5 |
pass
|
| 6 |
|
| 7 |
+
@staticmethod
|
| 8 |
+
def getTypesTechnique():
|
| 9 |
+
showTecnicas = {}
|
| 10 |
categorias = CategoriaTecnica.objects.all()
|
| 11 |
|
| 12 |
+
# for categoria in categorias:
|
| 13 |
+
# tipos_tecnica = TipoTecnica.objects.get(pk=categoria.id)
|
| 14 |
|
| 15 |
+
# tecnias = {categoria.nombre_categoria: tipos_tecnica}
|
| 16 |
+
# pass
|
| 17 |
|
| 18 |
+
for cata in categorias:
|
| 19 |
+
tecnicas = TipoTecnica.objects.filter(id_categoria_tecnica=cata.id)
|
| 20 |
+
showTecnicas[cata.nombre_categoria] = tecnicas
|
| 21 |
+
|
| 22 |
+
return showTecnicas
|
tecnicas/templates/tecnicas/seleccion-tecnica.html
CHANGED
|
@@ -4,17 +4,69 @@
|
|
| 4 |
|
| 5 |
{% block content %}
|
| 6 |
<article class="w-full flex flex-col justify-center items-center bg-gray-600 mt-10 mb-10">
|
| 7 |
-
<article class="flex flex-col gap-8 bg-gray-400 p-10 rounded-2xl w-4xl">
|
| 8 |
-
<header class="text-center flex flex-row gap-8 items-center w-full">
|
| 9 |
-
<div class="bg-gray-600 p-4 text-white rounded-xl flex-1">
|
| 10 |
<h1 class="font-bold text-2xl">Selección de<br>técnica sensorial</h1>
|
| 11 |
</div>
|
| 12 |
-
<div class="flex-1">
|
| 13 |
<a href="{% url 'cata_system:index' %}"
|
| 14 |
class="text-white bg-blue-600 hover:bg-blue-700 active:outline-none active:ring-4 active:ring-blue-300 font-medium rounded-xl text-xl p-4 text-center uppercase">Panel
|
| 15 |
principal</a>
|
| 16 |
</div>
|
| 17 |
</header>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
</article>
|
| 19 |
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
{% endblock %}
|
|
|
|
| 4 |
|
| 5 |
{% block content %}
|
| 6 |
<article class="w-full flex flex-col justify-center items-center bg-gray-600 mt-10 mb-10">
|
| 7 |
+
<article class="flex flex-col gap-8 bg-gray-400 md:p-10 p-5 rounded-2xl lg:w-4xl w-full">
|
| 8 |
+
<header class="text-center flex sm:flex-row flex-col md:gap-8 gap-3 items-center w-full">
|
| 9 |
+
<div class="bg-gray-600 p-4 text-white rounded-xl sm:flex-1 w-full">
|
| 10 |
<h1 class="font-bold text-2xl">Selección de<br>técnica sensorial</h1>
|
| 11 |
</div>
|
| 12 |
+
<div class="sm:flex-1 flex flex-row-reverse">
|
| 13 |
<a href="{% url 'cata_system:index' %}"
|
| 14 |
class="text-white bg-blue-600 hover:bg-blue-700 active:outline-none active:ring-4 active:ring-blue-300 font-medium rounded-xl text-xl p-4 text-center uppercase">Panel
|
| 15 |
principal</a>
|
| 16 |
</div>
|
| 17 |
</header>
|
| 18 |
+
<section class="text-white *:not-last:mb-4">
|
| 19 |
+
{% for cate, tecnicas in tipos.items %}
|
| 20 |
+
<article>
|
| 21 |
+
<button
|
| 22 |
+
class="p-4 bg-blue-700 hover:bg-blue-800 active:ring-4 active:outline-none active:ring-blue-300 flex flex-row gap-4 justify-center items-center rounded-lg text-2xl font-medium uppercase tracking-wider w-full z-20 relative"
|
| 23 |
+
onclick="showList('{{cate}}')" type="button">{{ cate }}</button>
|
| 24 |
+
<section
|
| 25 |
+
class="modal-list-{{ cate }} text-lg bg-blue-100 p-4 pr-6 pl-8 sm:pl-12 z-10 -translate-y-1 rounded-b-2xl *:not-last:mb-4 transition-all duration-1000 hidden">
|
| 26 |
+
{% for tecnica in tecnicas %}
|
| 27 |
+
<button
|
| 28 |
+
class="bg-green-700 border-l-10 border-gray-700 rounded-md px-3 py-2 w-full font-bold tracking-wider text-left uppercase">
|
| 29 |
+
{{ tecnica.nombre_tecnica }}
|
| 30 |
+
</button>
|
| 31 |
+
{% endfor %}
|
| 32 |
+
</section>
|
| 33 |
+
</article>
|
| 34 |
+
{% endfor %}
|
| 35 |
+
<article>
|
| 36 |
+
<button
|
| 37 |
+
class="p-4 bg-blue-700 hover:bg-blue-800 active:ring-4 active:outline-none active:ring-blue-300 flex flex-row gap-4 justify-center items-center rounded-lg text-2xl font-medium uppercase tracking-wider w-full z-20 relative"
|
| 38 |
+
onclick="showList('otro')" type="button">ejemplo sin funcion</button>
|
| 39 |
+
<section
|
| 40 |
+
class="modal-list-otro text-lg bg-blue-100 p-4 pr-6 pl-8 sm:pl-12 z-10 -translate-y-1 rounded-b-2xl *:not-last:mb-4 transition-all duration-1000 hidden">
|
| 41 |
+
<button
|
| 42 |
+
class="bg-green-700 border-l-10 border-gray-700 rounded-md px-3 py-2 w-full font-bold tracking-wider text-left">
|
| 43 |
+
Una tecnica sensorial
|
| 44 |
+
</button>
|
| 45 |
+
<button
|
| 46 |
+
class="bg-green-700 border-l-10 border-gray-700 rounded-md px-3 py-2 w-full font-bold tracking-wider text-left">
|
| 47 |
+
Una tecnica sensorial
|
| 48 |
+
</button>
|
| 49 |
+
<button
|
| 50 |
+
class="bg-green-700 border-l-10 border-gray-700 rounded-md px-3 py-2 w-full font-bold tracking-wider text-left">
|
| 51 |
+
Una tecnica sensorial
|
| 52 |
+
</button>
|
| 53 |
+
</section>
|
| 54 |
+
</article>
|
| 55 |
+
</section>
|
| 56 |
</article>
|
| 57 |
</article>
|
| 58 |
+
{% endblock %}
|
| 59 |
+
|
| 60 |
+
{% block extra_js %}
|
| 61 |
+
<script>
|
| 62 |
+
function showList (name) {
|
| 63 |
+
name = ".modal-list-" + name
|
| 64 |
+
const list = document.querySelector(name)
|
| 65 |
+
if (list.classList.contains("hidden")) {
|
| 66 |
+
list.classList.remove("hidden")
|
| 67 |
+
} else {
|
| 68 |
+
list.classList.add("hidden")
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
</script>
|
| 72 |
{% endblock %}
|
tecnicas/views/seleccion_tecnica.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from django.shortcuts import render
|
| 2 |
|
| 3 |
-
|
| 4 |
-
tipos = []
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
| 1 |
from django.shortcuts import render
|
| 2 |
|
| 3 |
+
from ..controllers import TecnicaController
|
|
|
|
| 4 |
|
| 5 |
+
def selecionTecnica(req):
|
| 6 |
+
tipos = TecnicaController.getTypesTechnique()
|
| 7 |
+
return render(req, "tecnicas/seleccion-tecnica.html", context={"tipos":tipos})
|