Browse Source

Adapta relatório uso de espaços para djbs-theme

pull/184/head
Sesóstris Vieira 3 weeks ago
parent
commit
22790ee494
  1. 52
      sigi/apps/espacos/templates/espacos/snippets/uso_espaco_snippet.html
  2. 57
      sigi/apps/espacos/templates/espacos/uso_espaco.html
  3. 33
      sigi/apps/espacos/templates/espacos/uso_espaco_pdf.html
  4. 11
      sigi/apps/espacos/views.py

52
sigi/apps/espacos/templates/espacos/snippets/uso_espaco_snippet.html

@ -0,0 +1,52 @@
{% load i18n static sigi_tags dict_get %}
<div class="table-responsive">
<table class="table table-sm table-stripped calendar-table" repeat="2">
<thead>
<tr>
{% if not espacos %}
<th rowspan="2">{% trans "Espaço" %}</th>
{% endif %}
<th rowspan="2">{% trans "SIGAD" %}</th>
<th rowspan="2">{% trans "Virtual" %}</th>
<th rowspan="2">{% trans "Data início" %}</th>
<th rowspan="2">{% trans "Data término" %}</th>
<th rowspan="2">{% trans "Propósito" %}</th>
<th rowspan="2">{% trans "Total participantes" %}</th>
<th rowspan="2">{% trans "Autoridade solicitante" %}</th>
<th colspan="2">{% trans "Contato" %}</th>
<th rowspan="2">{% trans "Informações adicionais" %}</th>
<th rowspan="2">{% trans "Recursos solicitados" %}</th>
</tr>
<tr>
<th>{% trans "Nome" %}</th>
<th>{% trans "Telefone" %}</th>
</tr>
</thead>
<tbody class="table-group-divider">
{% for reserva in reservas %}
<tr>
{% if not espacos %}
<th>{{ reserva.espaco.nome }}</th>
{% endif %}
<td>{{ reserva.num_processo }}</td>
<td>{{ reserva.virtual|yesno }}</td>
<td>{{ reserva.data_inicio }}</td>
<td>{{ reserva.data_termino }}</td>
<td>{{ reserva.proposito }}</td>
<td>{{ reserva.total_participantes|default:"-" }}</td>
<td>{{ reserva.solicitante }}</td>
<td>{{ reserva.contato }}</td>
<td>{{ reserva.telefone_contato }}</td>
<td>{{ reserva.informacoes }}</td>
<td>
{% for recurso in reserva.recursosolicitado_set.all %}
{{ recurso.quantidade|default:"" }} {{ recurso.recurso.sigla }}
{% if not forloop.last %}<br/>{% endif %}
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>

57
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 %}
<li class="breadcrumb-item">{% translate "Relatórios" %}</li>
<li class="breadcrumb-item">{% translate "Uso dos espaços" %}</li>
{% endblock %}
{% block content %}
<form>
<div class="card mb-3">
<div class="card-header">
<a class="icon-link" data-bs-toggle="collapse" href="#filterFormCollapse" aria-expanded="{% if reservas %}false{% else %}true{% endif %}" aria-controls="filterFormCollapse">
{% icon "filter" %} {% translate "Filtros" %}
</a>
</div>
<div class="card-body collapse{% if not reservas %} show{% endif %}" id="filterFormCollapse">
{{ form }}
</div>
<div class="card-footer d-flex justify-content-end">
<div>
<button type="submit" class="btn btn-primary">{% trans 'Visualizar' %}</button>
<button type="submit" name="pdf" value="1" class="btn btn-primary" title="{% trans 'Exportar para PDF' %}">
{% icon "pdf" %}
{% trans 'Exportar para PDF' %}
</button>
</div>
</div>
</div>
</form>
{% if reservas %}
{% if espacos %}
{% for espaco in espacos %}
<div class="card">
<div class="card-head">
{{ espaco.nome }}
</div>
<div class="card-body">
{% include "espacos/snippets/uso_espaco_snippet.html" with reservas=espaco.reservas %}
</div>
</div>
{% endfor %}
{% else %}
<div class="card">
<div class="card-body">
{% include "espacos/snippets/uso_espaco_snippet.html" %}
</div>
</div>
{% endif %}
{% endif %}
{% endblock %}

33
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 %}
<h4>
{% blocktranslate%}Semana de {{ data_inicio }} a {{ data_termino }}{% endblocktranslate %}
</h4>
<h5>{{ espaco.nome }}</h5>
<br/>
{% include "espacos/snippets/uso_espaco_snippet.html" with reservas=espaco.reservas %}
{% if not forloop.last %}
<div class="new-page"></div>
{% endif %}
{% endfor %}
{% else %}
<h4>
{% blocktranslate%}Semana de {{ data_inicio }} a {{ data_termino }}{% endblocktranslate %}
</h4>
<br/>
{% include "espacos/snippets/uso_espaco_snippet.html" %}
{% endif %}
{% endblock %}

11
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,

Loading…
Cancel
Save