Browse Source

Finaliza os detalhes adicionais da tela e resolve alguns bugs

pull/339/head
Eduardo Calil 9 years ago
parent
commit
47ed37e3e0
  1. 18
      protocoloadm/forms.py
  2. 2
      protocoloadm/views.py
  3. 6
      templates/paginacao.html
  4. 37
      templates/paginacao_pesquisa_materia.html
  5. 8
      templates/protocoloadm/protocolo_filter.html

18
protocoloadm/forms.py

@ -104,22 +104,20 @@ class ProtocoloFilterSet(django_filters.FilterSet):
self.filters['assunto_ementa'].label = 'Assunto' self.filters['assunto_ementa'].label = 'Assunto'
row1 = crispy_layout_mixin.to_row( row1 = crispy_layout_mixin.to_row(
[('numero', 6), [('numero', 4),
('ano', 6)]) ('ano', 4),
('data', 4)])
row2 = crispy_layout_mixin.to_row( row2 = crispy_layout_mixin.to_row(
[('data', 12)])
row3 = crispy_layout_mixin.to_row(
[('tipo_documento', 4), [('tipo_documento', 4),
('tipo_protocolo', 4), ('tipo_protocolo', 4),
('tipo_materia', 4)]) ('tipo_materia', 4)])
row4 = crispy_layout_mixin.to_row( row3 = crispy_layout_mixin.to_row(
[('interessado', 6), [('interessado', 6),
('assunto_ementa', 6)]) ('assunto_ementa', 6)])
row5 = crispy_layout_mixin.to_row( row4 = crispy_layout_mixin.to_row(
[('autor', 0), [('autor', 0),
(Button('pesquisar', (Button('pesquisar',
'Pesquisar Autor', 'Pesquisar Autor',
@ -127,7 +125,7 @@ class ProtocoloFilterSet(django_filters.FilterSet):
(Button('limpar', (Button('limpar',
'Limpar Autor', 'Limpar Autor',
css_class='btn btn-primary btn-sm'), 10)]) css_class='btn btn-primary btn-sm'), 10)])
row6 = crispy_layout_mixin.to_row( row5 = crispy_layout_mixin.to_row(
[('o', 12)]) [('o', 12)])
self.form.helper = FormHelper() self.form.helper = FormHelper()
@ -135,10 +133,10 @@ class ProtocoloFilterSet(django_filters.FilterSet):
self.form.helper.layout = Layout( self.form.helper.layout = Layout(
Fieldset(_('Pesquisar Protocolo'), Fieldset(_('Pesquisar Protocolo'),
row1, row2, row1, row2,
row3, row4, row3,
HTML(sapl.utils.autor_label), HTML(sapl.utils.autor_label),
HTML(sapl.utils.autor_modal), HTML(sapl.utils.autor_modal),
row5, row6, row4, row5,
form_actions(save_label='Pesquisar')) form_actions(save_label='Pesquisar'))
) )

2
protocoloadm/views.py

@ -80,7 +80,7 @@ class ProtocoloPesquisaView(FilterView):
data = self.filterset.data data = self.filterset.data
if (data and data.get('numero') is not None): if (data and data.get('numero') is not None):
url = "&"+str(self.request.environ['QUERY_STRING']) url = "&"+str(self.request.environ['QUERY_STRING'])
if url[:5] == "&page": if url.startswith("&page"):
ponto_comeco = url.find('numero=') - 1 ponto_comeco = url.find('numero=') - 1
url = url[ponto_comeco:] url = url[ponto_comeco:]
else: else:

6
templates/paginacao.html

@ -3,7 +3,7 @@
<ul class="pagination"> <ul class="pagination">
{% if page_obj.has_previous %} {% if page_obj.has_previous %}
<li class="page-item"> <li class="page-item">
<a class="page-link" href="?page={{ page_obj.previous_page_number }}"> <a class="page-link" href="?page={{ page_obj.previous_page_number }}{{filter_url}}">
<span class="pager-prev">Anterior</span> <span class="pager-prev">Anterior</span>
</a> </a>
</li> </li>
@ -18,14 +18,14 @@
</li> </li>
{% else %} {% else %}
<li {% if page == page_obj.number %} class="page-item active" {% endif %}> <li {% if page == page_obj.number %} class="page-item active" {% endif %}>
<a class="page-link" href="?page={{ page }}">{{ page }}</a> <a class="page-link" href="?page={{ page }}{{filter_url}}">{{ page }}</a>
</li> </li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if page_obj.has_next %} {% if page_obj.has_next %}
<li class="page-item"> <li class="page-item">
<a class="page-link" href="?page={{ page_obj.next_page_number }}"> <a class="page-link" href="?page={{ page_obj.next_page_number }}{{filter_url}}">
<span class="pager-next">Próxima</span> <span class="pager-next">Próxima</span>
</a> </a>
</li> </li>

37
templates/paginacao_pesquisa_materia.html

@ -1,37 +0,0 @@
{% if is_paginated %}
<nav class="text-center">
<ul class="pagination">
{% if page_obj.has_previous %}
<li class="page-item">
<a class="page-link" href="?page={{page_obj.previous_page_number}}{{filter_url}}">
<span class="pager-prev">Anterior</span>
</a>
</li>
{% else %}
<li class="pager-prev disabled"><a href="">Anterior</a></li>
{% endif %}
{% for page in page_range %}
{% if page == None or page == 'None' %}
<li class="page-item disabled">
<a class="page-link" href="">...</a>
</li>
{% else %}
<li {% if page == page_obj.number %} class="page-item active" {% endif %}>
<a class="page-link" href="?page={{page}}{{filter_url}}">{{ page }}</a>
</li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li class="page-item">
<a class="page-link" href="?page={{page_obj.next_page_number}}{{filter_url}}">
<span class="pager-next">Próxima</span>
</a>
</li>
{% else %}
<li class="pager-next disabled"><a href="">Próxima</a></li>
{% endif %}
</ul>
</nav>
{% endif %}

8
templates/protocoloadm/protocolo_filter.html

@ -28,11 +28,11 @@
{% for p in page_obj %} {% for p in page_obj %}
<tr> <tr>
<td> <td>
<strong>Protocolo:</strong> <strong>Protocolo:
<a href="{% url 'protocoloadm:protocolo_mostrar' p.numero p.ano %}"> <a href="{% url 'protocoloadm:protocolo_mostrar' p.numero p.ano %}">
{{ p.numero|stringformat:'06d' }}/{{ p.ano }} {{ p.numero|stringformat:'06d' }}/{{ p.ano }}
</a> </a></strong>
&nbsp;&nbsp;-&nbsp;&nbsp; &nbsp;&nbsp;<strong>-</strong>&nbsp;&nbsp;
<a href="{% url 'relatorios:relatorio_etiqueta_protocolo' p.numero p.ano %}"> <a href="{% url 'relatorios:relatorio_etiqueta_protocolo' p.numero p.ano %}">
<img src="{% static 'img/etiqueta.png' %}" alt="Etiqueta Individual"> <img src="{% static 'img/etiqueta.png' %}" alt="Etiqueta Individual">
@ -65,6 +65,6 @@
</table> </table>
{% include "paginacao_pesquisa_materia.html" %} {% include "paginacao.html" %}
{% endblock detail_content %} {% endblock detail_content %}
Loading…
Cancel
Save