From 7ef0c14528ce346e1e6a5080f8b5e0a5a680b1c9 Mon Sep 17 00:00:00 2001 From: Cesar Carvalho Date: Wed, 29 May 2019 12:13:21 -0300 Subject: [PATCH] =?UTF-8?q?Cria=C3=A7=C3=A3o=20de=20sess=C3=A3o=20solene?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/painel/views.py | 1 + sapl/sessao/views.py | 175 ++++++++++++++++++++++- sapl/templates/painel/index.html | 17 ++- sapl/templates/sessao/subnav-solene.yaml | 34 +++++ 4 files changed, 219 insertions(+), 8 deletions(-) create mode 100644 sapl/templates/sessao/subnav-solene.yaml diff --git a/sapl/painel/views.py b/sapl/painel/views.py index 333c3771e..41fe67b9d 100644 --- a/sapl/painel/views.py +++ b/sapl/painel/views.py @@ -528,6 +528,7 @@ def get_dados_painel(request, pk): 'sessao_plenaria': str(sessao), 'sessao_plenaria_data': sessao.data_inicio.strftime('%d/%m/%Y'), 'sessao_plenaria_hora_inicio': sessao.hora_inicio, + 'sessao_solene': sessao.tipo.nome == "Solene", 'cronometro_aparte': get_cronometro_status(request, 'aparte'), 'cronometro_discurso': get_cronometro_status(request, 'discurso'), 'cronometro_ordem': get_cronometro_status(request, 'ordem'), diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index b720bf619..93d9d9ff6 100755 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -598,6 +598,15 @@ class OradorCrud(MasterDetailCrud): class ListView(MasterDetailCrud.ListView): ordering = ['numero_ordem', 'parlamentar'] + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + sessao_pk = context['root_pk'] + sessao = SessaoPlenaria.objects.get(id=sessao_pk) + tipo_sessao = sessao.tipo + if tipo_sessao.nome == "Solene": + context.update({'subnav_template_name': 'sessao/subnav-solene.yaml'}) + return context + class CreateView(MasterDetailCrud.CreateView): form_class = OradorForm @@ -609,7 +618,7 @@ class OradorCrud(MasterDetailCrud): return reverse('sapl.sessao:orador_list', kwargs={'pk': self.kwargs['pk']}) - class UpdateView(MasterDetailCrud.UpdateView): +class UpdateView(MasterDetailCrud.UpdateView): form_class = OradorForm @@ -621,6 +630,75 @@ class OradorCrud(MasterDetailCrud): return initial +class OradorExpedienteCrud(OradorCrud): + model = OradorExpediente + + class CreateView(MasterDetailCrud.CreateView): + + form_class = OradorForm + + def get_initial(self): + return {'id_sessao': self.kwargs['pk']} + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + sessao_pk = context['root_pk'] + sessao = SessaoPlenaria.objects.get(id=sessao_pk) + tipo_sessao = sessao.tipo + if tipo_sessao.nome == "Solene": + context.update({'subnav_template_name': 'sessao/subnav-solene.yaml'}) + return context + + def get_success_url(self): + return reverse('sapl.sessao:orador_list', + kwargs={'pk': self.kwargs['pk']}) + + + class UpdateView(MasterDetailCrud.UpdateView): + + form_class = OradorForm + + def get_initial(self): + initial = super(UpdateView, self).get_initial() + initial.update({'id_sessao': self.object.sessao_plenaria.id}) + initial.update({'numero':self.object.numero_ordem}) + + return initial + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + sessao_pk = context['root_pk'] + sessao = SessaoPlenaria.objects.get(id=sessao_pk) + tipo_sessao = sessao.tipo + if tipo_sessao.nome == "Solene": + context.update({'subnav_template_name': 'sessao/subnav-solene.yaml'}) + return context + + + class DetailView(MasterDetailCrud.DetailView): + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + sessao_pk = context['root_pk'] + sessao = SessaoPlenaria.objects.get(id=sessao_pk) + tipo_sessao = sessao.tipo + if tipo_sessao.nome == "Solene": + context.update({'subnav_template_name': 'sessao/subnav-solene.yaml'}) + return context + + + class DeleteView(MasterDetailCrud.DeleteView): + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + sessao_pk = context['root_pk'] + sessao = SessaoPlenaria.objects.get(id=sessao_pk) + tipo_sessao = sessao.tipo + if tipo_sessao.nome == "Solene": + context.update({'subnav_template_name': 'sessao/subnav-solene.yaml'}) + return context + + class OradorExpedienteCrud(OradorCrud): model = OradorExpediente @@ -631,6 +709,17 @@ class OradorExpedienteCrud(OradorCrud): def get_initial(self): return {'id_sessao': self.kwargs['pk']} + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + pk = context['root_pk'] + sessao = SessaoPlenaria.objects.get(id=pk) + tipo_sessao = sessao.tipo + if tipo_sessao.nome == "Solene": + context.update({'subnav_template_name': 'sessao/subnav-solene.yaml'}) + return context + + def get_success_url(self): return reverse('sapl.sessao:oradorexpediente_list', kwargs={'pk': self.kwargs['pk']}) @@ -643,6 +732,40 @@ class OradorExpedienteCrud(OradorCrud): 'numero': self.object.numero_ordem} + class ListView(MasterDetailCrud.ListView): + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + pk = context['root_pk'] + sessao = SessaoPlenaria.objects.get(id=pk) + tipo_sessao = sessao.tipo + if tipo_sessao.nome == "Solene": + context.update({'subnav_template_name': 'sessao/subnav-solene.yaml'}) + return context + + class DetailView(MasterDetailCrud.DetailView): + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + pk = context['root_pk'] + sessao = SessaoPlenaria.objects.get(id=pk) + tipo_sessao = sessao.tipo + if tipo_sessao.nome == "Solene": + context.update({'subnav_template_name': 'sessao/subnav-solene.yaml'}) + return context + + + class UpdateView(MasterDetailCrud.UpdateView): + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + pk = context['root_pk'] + sessao = SessaoPlenaria.objects.get(id=pk) + tipo_sessao = sessao.tipo + if tipo_sessao.nome == "Solene": + context.update({'subnav_template_name': 'sessao/subnav-solene.yaml'}) + return context + class OradorOrdemDiaCrud(OradorCrud): model = OradorOrdemDia @@ -748,6 +871,14 @@ class SessaoCrud(Crud): form_class = SessaoPlenariaForm + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + sessao = context['object'] + tipo_sessao = sessao.tipo + if tipo_sessao.nome == "Solene": + context.update({'subnav_template_name': 'sessao/subnav-solene.yaml'}) + return context + def get_initial(self): return {'sessao_legislativa': self.object.sessao_legislativa} @@ -788,6 +919,16 @@ class SessaoCrud(Crud): namespace = self.model._meta.app_config.name return reverse('%s:%s' % (namespace, 'sessaoplenaria_list')) + class DetailView(Crud.DetailView): + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + sessao = context['object'] + tipo_sessao = sessao.tipo + if tipo_sessao.nome == "Solene": + context.update({'subnav_template_name': 'sessao/subnav-solene.yaml'}) + return context + class SessaoPermissionMixin(PermissionRequiredForAppCrudMixin, FormMixin, @@ -821,6 +962,10 @@ class PresencaView(FormMixin, PresencaMixin, DetailView): context = FormMixin.get_context_data(self, **kwargs) context['title'] = '%s (%s)' % ( _('Presença'), self.object) + sessao = context['object'] + tipo_sessao = sessao.tipo + if tipo_sessao.nome == "Solene": + context.update({'subnav_template_name': 'sessao/subnav-solene.yaml'}) return context @method_decorator(permission_required( @@ -905,17 +1050,25 @@ class PainelView(PermissionRequiredForAppCrudMixin, TemplateView): cronometro_ordem = cronometro_ordem.seconds cronometro_consideracoes = cronometro_consideracoes.seconds + sessao_pk = kwargs['pk'] + sessao = SessaoPlenaria.objects.get(pk=sessao_pk) context = TemplateView.get_context_data(self, **kwargs) context.update({ 'head_title': str(_('Painel Plenário')), - 'sessao_id': kwargs['pk'], - 'root_pk': kwargs['pk'], - 'sessaoplenaria': SessaoPlenaria.objects.get(pk=kwargs['pk']), + 'sessao_id': sessao_pk, + 'root_pk': sessao_pk, + 'sessaoplenaria': sessao, 'cronometro_discurso': cronometro_discurso, 'cronometro_aparte': cronometro_aparte, 'cronometro_ordem': cronometro_ordem, 'cronometro_consideracoes': cronometro_consideracoes}) + context.update({'sessao_solene': False}) + tipo_sessao = sessao.tipo + if tipo_sessao.nome == "Solene": + context.update({'subnav_template_name': 'sessao/subnav-solene.yaml'}) + context.update({'sessao_solene': True}) + return context @@ -1138,8 +1291,12 @@ class MesaView(FormMixin, DetailView): context = FormMixin.get_context_data(self, **kwargs) context['title'] = '%s (%s)' % ( _('Mesa Diretora'), self.object) + sessao = context['object'] + tipo_sessao = sessao.tipo + if tipo_sessao.nome == "Solene": + context.update({'subnav_template_name': 'sessao/subnav-solene.yaml'}) return context - + def get_success_url(self): pk = self.kwargs['pk'] return reverse('sapl.sessao:mesa', kwargs={'pk': pk}) @@ -1832,6 +1989,10 @@ class ExpedienteView(FormMixin, DetailView): context = FormMixin.get_context_data(self, **kwargs) context['title'] = '%s (%s)' % ( _('Expediente Diversos'), self.object) + sessao = context['object'] + tipo_sessao = sessao.tipo + if tipo_sessao.nome == "Solene": + context.update({'subnav_template_name': 'sessao/subnav-solene.yaml'}) return context @method_decorator(permission_required('sessao.add_expedientesessao')) @@ -1921,6 +2082,10 @@ class OcorrenciaSessaoView(FormMixin, DetailView): context = FormMixin.get_context_data(self, **kwargs) context['title'] = 'Ocorrências da Sessão (%s)' % ( self.object) + sessao = context['object'] + tipo_sessao = sessao.tipo + if tipo_sessao.nome == "Solene": + context.update({'subnav_template_name': 'sessao/subnav-solene.yaml'}) return context def delete(self): diff --git a/sapl/templates/painel/index.html b/sapl/templates/painel/index.html index f5772315d..6e6bbe7ad 100644 --- a/sapl/templates/painel/index.html +++ b/sapl/templates/painel/index.html @@ -89,18 +89,23 @@ Considerações Finais: - -
+ +

Resultado

-
+

Matéria em Votação

+ +
+

Tema da Sessão Solene

+ +
@@ -205,6 +210,12 @@ $("#message").text(""); } + if (data["sessao_solene"]){ + $("#resultado_votacao_div").hide(); + $("#obs_materia_div").hide(); + $('#tema_solene_div').show(); + } + if (data["brasao"] != null) $("#logo-painel").attr("src", data["brasao"]); diff --git a/sapl/templates/sessao/subnav-solene.yaml b/sapl/templates/sessao/subnav-solene.yaml new file mode 100644 index 000000000..34f381005 --- /dev/null +++ b/sapl/templates/sessao/subnav-solene.yaml @@ -0,0 +1,34 @@ +{% load i18n common_tags %} + +- title: {% trans 'Abertura' %} + children: + - title: {% trans 'Dados Básicos' %} + url: sessaoplenaria_detail + - title: {% trans 'Mesa' %} + url: mesa + - title: {% trans 'Presença' %} + url: presenca + - title: {% trans 'Explicações Pessoais' %} + url: orador_list + - title: {% trans 'Ocorrências da Sessão' %} + url: ocorrencia_sessao + +- title: {% trans 'Expedientes' %} + children: + - title: {% trans 'Expediente Diversos' %} + url: expediente + - title: {% trans 'Oradores do Expediente' %} + url: oradorexpediente_list + +- title: {% trans 'Painel Eletrônico' %} + url: painel + {% if not 'painel_aberto'|get_config_attr %}check_permission: painel.list_painel{%endif%} + check_permission: painel.list_painel + +- title: {% trans 'Resumo' %} + children: + - title: {% trans 'Resumo' %} + url: resumo + - title: {% trans 'Extrato' %} + url: resumo_ata + check_permission: sessao.add_sessaoplenaria