mirror of https://github.com/interlegis/sigi.git
Sesóstris Vieira
1 year ago
10 changed files with 281 additions and 30 deletions
@ -0,0 +1,44 @@ |
|||
import calendar |
|||
from django.utils import timezone |
|||
from django import forms |
|||
from material.admin.widgets import MaterialAdminDateWidget |
|||
from django.forms.widgets import CheckboxSelectMultiple |
|||
from django.utils.translation import gettext as _ |
|||
from sigi.apps.espacos.models import Espaco |
|||
|
|||
|
|||
class UsoEspacoReportForm(forms.Form): |
|||
class Media: |
|||
css = {"all": ["css/change_form.css"]} |
|||
js = [ |
|||
"/admin/js/vendor/select2/select2.full.js", |
|||
"/admin/js/change_form.js", |
|||
"/admin/js/vendor/select2/i18n/pt-BR.js", |
|||
"/material/admin/js/widgets/TimeInput.js", |
|||
"/admin/js/core.js", |
|||
] |
|||
|
|||
def get_semana(self): |
|||
return [ |
|||
{"first": s[0], "last": s[-1]} |
|||
for s in calendar.Calendar().monthdatescalendar( |
|||
timezone.localdate().year, timezone.localdate().month |
|||
) |
|||
if s[0] <= timezone.localdate() <= s[-1] |
|||
][0] |
|||
|
|||
data_inicio = forms.DateField( |
|||
label=_("Data início"), required=True, widget=MaterialAdminDateWidget |
|||
) |
|||
data_fim = forms.DateField( |
|||
label=_("Data fim"), required=True, widget=MaterialAdminDateWidget |
|||
) |
|||
espaco = forms.ModelMultipleChoiceField( |
|||
label=_("Espaços"), required=True, queryset=Espaco.objects.all(), widget=CheckboxSelectMultiple |
|||
) |
|||
|
|||
def __init__(self, *args, **kwargs): |
|||
super().__init__(*args, **kwargs) |
|||
semana = self.get_semana() |
|||
self.fields["data_inicio"].initial = semana["first"] |
|||
self.fields["data_fim"].initial = semana["last"] |
@ -0,0 +1,43 @@ |
|||
{% load i18n static sigi_tags dict_get %} |
|||
|
|||
<table class="calendar-table" repeat="2"> |
|||
<thead> |
|||
<tr> |
|||
<th rowspan="2">{% trans "Espaço" %}</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 "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> |
|||
{% for reserva in reservas %} |
|||
<tr> |
|||
{% ifchanged reserva.espaco %} |
|||
<th rowspan="{{ rowspans|get:reserva.espaco.id }}">{{ reserva.espaco.nome }}</th> |
|||
{% endifchanged %} |
|||
<td>{{ reserva.inicio }}</td> |
|||
<td>{{ reserva.termino }}</td> |
|||
<td>{{ reserva.proposito }}</td> |
|||
<td>{{ reserva.solicitante }}</td> |
|||
<td>{{ reserva.contato }}</td> |
|||
<td>{{ reserva.telefone_contato }}</td> |
|||
<td>{{ reserva.informacoes }}</td> |
|||
<td> |
|||
<ul> |
|||
{% for recurso in reserva.recursosolicitado_set.all %} |
|||
<li>{{ recurso.quantidade}} {{ recurso.recurso }} ( {{ recurso.observacoes }})</li> |
|||
{% endfor %} |
|||
</ul> |
|||
</td> |
|||
</tr> |
|||
{% endfor %} |
|||
</tbody> |
|||
</table> |
@ -0,0 +1,56 @@ |
|||
{% extends "admin/base_site.html" %} |
|||
{% load i18n static %} |
|||
|
|||
{% block extrastyle %} |
|||
{{ block.super }} |
|||
<link rel="stylesheet" type="text/css" href="{% static "css/calendario.css" %}"> |
|||
<style> |
|||
tr { |
|||
border-bottom: 1px solid var(--border-color); |
|||
} |
|||
th { |
|||
background: var(--darkened-bg); |
|||
} |
|||
</style> |
|||
{% endblock %} |
|||
|
|||
{% block breadcrumbs %}{% endblock %} |
|||
{% block coltype %}colMS{% endblock %} |
|||
|
|||
{% block content %} |
|||
<div class="row"> |
|||
<div class="col s12"> |
|||
<form method="get" action=""> |
|||
<div class="card"> |
|||
<div class="card-content"> |
|||
{{ form }} |
|||
</div> |
|||
<div class="card-action"> |
|||
<button class="btn waves-effect waves-light" type="submit"> |
|||
{% trans "View" %} |
|||
<i class="material-icons right">send</i> |
|||
</button> |
|||
<button class="btn waves-effect waves-light" type="submit" name="pdf" value="1"> |
|||
{% trans "PDF" %} |
|||
<i class="material-icons right">picture_as_pdf</i> |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col s12"> |
|||
<div class="card"> |
|||
<div class="card-content"> |
|||
{% include "espacos/snippets/uso_espaco_snippet.html" %} |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
{% endblock %} |
|||
|
|||
{% block footer %} |
|||
{{ block.super }} |
|||
{{ form.media }} |
|||
{% endblock %} |
@ -0,0 +1,19 @@ |
|||
{% 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 %} |
|||
<h4> |
|||
{% blocktranslate%}Semana de {{ data_inicio }} a {{ data_termino }}{% endblocktranslate %} |
|||
</h4> |
|||
<br/> |
|||
{% include "espacos/snippets/uso_espaco_snippet.html" %} |
|||
{% endblock %} |
Loading…
Reference in new issue