From 22790ee494eff282f473f59905c4c94fb3950a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Fri, 6 Dec 2024 20:36:06 -0300 Subject: [PATCH] =?UTF-8?q?Adapta=20relat=C3=B3rio=20uso=20de=20espa=C3=A7?= =?UTF-8?q?os=20para=20djbs-theme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../espacos/snippets/uso_espaco_snippet.html | 52 +++++++++++++++++ .../espacos/templates/espacos/uso_espaco.html | 57 +++++++++++++++++++ .../templates/espacos/uso_espaco_pdf.html | 33 +++++++++++ sigi/apps/espacos/views.py | 11 +--- 4 files changed, 145 insertions(+), 8 deletions(-) create mode 100644 sigi/apps/espacos/templates/espacos/snippets/uso_espaco_snippet.html create mode 100644 sigi/apps/espacos/templates/espacos/uso_espaco.html create mode 100644 sigi/apps/espacos/templates/espacos/uso_espaco_pdf.html diff --git a/sigi/apps/espacos/templates/espacos/snippets/uso_espaco_snippet.html b/sigi/apps/espacos/templates/espacos/snippets/uso_espaco_snippet.html new file mode 100644 index 0000000..2bd404c --- /dev/null +++ b/sigi/apps/espacos/templates/espacos/snippets/uso_espaco_snippet.html @@ -0,0 +1,52 @@ +{% load i18n static sigi_tags dict_get %} + +
+ + + + {% if not espacos %} + + {% endif %} + + + + + + + + + + + + + + + + + + {% for reserva in reservas %} + + {% if not espacos %} + + {% endif %} + + + + + + + + + + + + + {% endfor %} + +
{% trans "Espaço" %}{% trans "SIGAD" %}{% trans "Virtual" %}{% trans "Data início" %}{% trans "Data término" %}{% trans "Propósito" %}{% trans "Total participantes" %}{% trans "Autoridade solicitante" %}{% trans "Contato" %}{% trans "Informações adicionais" %}{% trans "Recursos solicitados" %}
{% trans "Nome" %}{% trans "Telefone" %}
{{ reserva.espaco.nome }}{{ reserva.num_processo }}{{ reserva.virtual|yesno }}{{ reserva.data_inicio }}{{ reserva.data_termino }}{{ reserva.proposito }}{{ reserva.total_participantes|default:"-" }}{{ reserva.solicitante }}{{ reserva.contato }}{{ reserva.telefone_contato }}{{ reserva.informacoes }} + {% for recurso in reserva.recursosolicitado_set.all %} + {{ recurso.quantidade|default:"" }} {{ recurso.recurso.sigla }} + {% if not forloop.last %}
{% endif %} + {% endfor %} +
+
\ No newline at end of file diff --git a/sigi/apps/espacos/templates/espacos/uso_espaco.html b/sigi/apps/espacos/templates/espacos/uso_espaco.html new file mode 100644 index 0000000..3a85903 --- /dev/null +++ b/sigi/apps/espacos/templates/espacos/uso_espaco.html @@ -0,0 +1,57 @@ +{% extends "admin/base_site.html" %} +{% load i18n static djbs_extras %} + +{% block extrastyle %} + {{ block.super }} + {{ form.media }} +{% endblock %} + +{% block breadcrumbs %} + + +{% endblock %} + +{% block content %} +
+
+ +
+ {{ form }} +
+ +
+
+ + {% if reservas %} + {% if espacos %} + {% for espaco in espacos %} +
+
+ {{ espaco.nome }} +
+
+ {% include "espacos/snippets/uso_espaco_snippet.html" with reservas=espaco.reservas %} +
+
+ {% endfor %} + {% else %} +
+
+ {% include "espacos/snippets/uso_espaco_snippet.html" %} +
+
+ {% endif %} + {% endif %} +{% endblock %} diff --git a/sigi/apps/espacos/templates/espacos/uso_espaco_pdf.html b/sigi/apps/espacos/templates/espacos/uso_espaco_pdf.html new file mode 100644 index 0000000..f879597 --- /dev/null +++ b/sigi/apps/espacos/templates/espacos/uso_espaco_pdf.html @@ -0,0 +1,33 @@ +{% extends "pdf/base_report.html" %} +{% load i18n static %} + +{% block extra_style %} + {{ block.super }} + h4 { + margin: 20px 0; + padding-left: 1.5rem; + border-left: 5px solid #ee6e73; + } +{% endblock %} + +{% block main_content %} + {% if espacos %} + {% for espaco in espacos %} +

+ {% blocktranslate%}Semana de {{ data_inicio }} a {{ data_termino }}{% endblocktranslate %} +

+
{{ espaco.nome }}
+
+ {% include "espacos/snippets/uso_espaco_snippet.html" with reservas=espaco.reservas %} + {% if not forloop.last %} +
+ {% endif %} + {% endfor %} + {% else %} +

+ {% blocktranslate%}Semana de {{ data_inicio }} a {{ data_termino }}{% endblocktranslate %} +

+
+ {% include "espacos/snippets/uso_espaco_snippet.html" %} + {% endif %} +{% endblock %} \ No newline at end of file diff --git a/sigi/apps/espacos/views.py b/sigi/apps/espacos/views.py index e7fe409..94c6072 100644 --- a/sigi/apps/espacos/views.py +++ b/sigi/apps/espacos/views.py @@ -142,6 +142,7 @@ class UsoEspacos(ReportViewMixin, StaffMemberRequiredMixin, TemplateView): pagesize = "A4 landscape" def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) form = UsoEspacoReportForm(self.request.GET) if form.is_valid(): data_inicio = form.cleaned_data["data_inicio"] @@ -150,15 +151,10 @@ class UsoEspacos(ReportViewMixin, StaffMemberRequiredMixin, TemplateView): virtual = form.cleaned_data["virtual"] agrupar_espacos = form.cleaned_data["agrupar_espacos"] else: - form = UsoEspacoReportForm( + context["form"] = UsoEspacoReportForm( initial={"espaco": Espaco.objects.all()} ) - semana = form.get_semana() - data_inicio = semana["first"] - data_fim = semana["last"] - virtual = UsoEspacoReportForm.VIRTUAL_ALL - agrupar_espacos = False - sel_espacos = None + return context if not sel_espacos: sel_espacos = Espaco.objects.all() @@ -200,7 +196,6 @@ class UsoEspacos(ReportViewMixin, StaffMemberRequiredMixin, TemplateView): else: espacos = None - context = super().get_context_data(**kwargs) context.update( { "espacos": espacos,