mirror of https://github.com/interlegis/sapl.git
committed by
GitHub
34 changed files with 938 additions and 90 deletions
@ -0,0 +1,385 @@ |
|||||
|
from datetime import date |
||||
|
|
||||
|
import pytest |
||||
|
from django.db import IntegrityError, transaction |
||||
|
from model_bakery import baker |
||||
|
from rest_framework.test import APIClient |
||||
|
|
||||
|
from sapl.base.models import AppConfig as BaseAppConfig |
||||
|
from sapl.materia.models import (MateriaLegislativa, RegimeTramitacao, |
||||
|
TipoMateriaLegislativa) |
||||
|
from sapl.parlamentares.models import Legislatura |
||||
|
|
||||
|
|
||||
|
# --------------------------------------------------------------------------- |
||||
|
# Helpers / fixtures |
||||
|
# --------------------------------------------------------------------------- |
||||
|
|
||||
|
@pytest.fixture |
||||
|
def tipo_materia(db): |
||||
|
"""TipoMateriaLegislativa sem sequencia_numeracao própria (usa global).""" |
||||
|
return baker.make(TipoMateriaLegislativa, descricao='Projeto de Lei', |
||||
|
sigla='PL', sequencia_numeracao='') |
||||
|
|
||||
|
|
||||
|
@pytest.fixture |
||||
|
def tipo_materia_anual(db): |
||||
|
return baker.make(TipoMateriaLegislativa, descricao='Requerimento', |
||||
|
sigla='REQ', sequencia_numeracao='A') |
||||
|
|
||||
|
|
||||
|
@pytest.fixture |
||||
|
def tipo_materia_unico(db): |
||||
|
return baker.make(TipoMateriaLegislativa, descricao='Indicação', |
||||
|
sigla='IND', sequencia_numeracao='U') |
||||
|
|
||||
|
|
||||
|
@pytest.fixture |
||||
|
def tipo_materia_legislatura(db): |
||||
|
return baker.make(TipoMateriaLegislativa, descricao='PEC', |
||||
|
sigla='PEC', sequencia_numeracao='L') |
||||
|
|
||||
|
|
||||
|
@pytest.fixture |
||||
|
def regime(db): |
||||
|
return baker.make(RegimeTramitacao, descricao='Normal') |
||||
|
|
||||
|
|
||||
|
@pytest.fixture |
||||
|
def app_config(db): |
||||
|
return BaseAppConfig.objects.create(sequencia_numeracao_protocolo='A') |
||||
|
|
||||
|
|
||||
|
def _criar_materia(tipo, numero, ano, regime, **kwargs): |
||||
|
"""Atalho para criar MateriaLegislativa com campos obrigatórios.""" |
||||
|
defaults = dict( |
||||
|
tipo=tipo, |
||||
|
numero=numero, |
||||
|
ano=ano, |
||||
|
data_apresentacao=date(ano, 1, 1), |
||||
|
regime_tramitacao=regime, |
||||
|
ementa='Ementa de teste', |
||||
|
) |
||||
|
defaults.update(kwargs) |
||||
|
return MateriaLegislativa.objects.create(**defaults) |
||||
|
|
||||
|
|
||||
|
# =========================================================================== |
||||
|
# Testes de get_proximo_numero – numeração por ano (padrão) |
||||
|
# =========================================================================== |
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_proximo_numero_primeiro_do_ano(tipo_materia_anual, regime, app_config): |
||||
|
"""Sem matérias existentes, o primeiro número gerado deve ser 1.""" |
||||
|
with transaction.atomic(): |
||||
|
numero, ano = MateriaLegislativa.get_proximo_numero( |
||||
|
tipo=tipo_materia_anual, ano=2024) |
||||
|
assert numero == 1 |
||||
|
assert ano == 2024 |
||||
|
|
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_proximo_numero_sequencial(tipo_materia_anual, regime, app_config): |
||||
|
"""Com matérias existentes 1, 2, 3 → próximo deve ser 4.""" |
||||
|
for n in (1, 2, 3): |
||||
|
_criar_materia(tipo_materia_anual, n, 2024, regime) |
||||
|
|
||||
|
with transaction.atomic(): |
||||
|
numero, ano = MateriaLegislativa.get_proximo_numero( |
||||
|
tipo=tipo_materia_anual, ano=2024) |
||||
|
assert numero == 4 |
||||
|
assert ano == 2024 |
||||
|
|
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_proximo_numero_ignora_outro_ano(tipo_materia_anual, regime, app_config): |
||||
|
"""Matérias em anos diferentes não influenciam a sequência.""" |
||||
|
_criar_materia(tipo_materia_anual, 10, 2023, regime, |
||||
|
data_apresentacao=date(2023, 6, 1)) |
||||
|
_criar_materia(tipo_materia_anual, 1, 2024, regime) |
||||
|
|
||||
|
with transaction.atomic(): |
||||
|
numero, ano = MateriaLegislativa.get_proximo_numero( |
||||
|
tipo=tipo_materia_anual, ano=2024) |
||||
|
assert numero == 2 |
||||
|
|
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_proximo_numero_ignora_outro_tipo(tipo_materia_anual, regime, app_config): |
||||
|
"""Matérias de outro tipo não influenciam a sequência.""" |
||||
|
outro_tipo = baker.make(TipoMateriaLegislativa, descricao='Moção', |
||||
|
sigla='MOC', sequencia_numeracao='A') |
||||
|
_criar_materia(outro_tipo, 50, 2024, regime) |
||||
|
_criar_materia(tipo_materia_anual, 3, 2024, regime) |
||||
|
|
||||
|
with transaction.atomic(): |
||||
|
numero, _ = MateriaLegislativa.get_proximo_numero( |
||||
|
tipo=tipo_materia_anual, ano=2024) |
||||
|
assert numero == 4 |
||||
|
|
||||
|
|
||||
|
# =========================================================================== |
||||
|
# Testes de get_proximo_numero – numeração única |
||||
|
# =========================================================================== |
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_proximo_numero_unico(tipo_materia_unico, regime, app_config): |
||||
|
"""Numeração 'U' ignora o ano – sequência é global por tipo.""" |
||||
|
_criar_materia(tipo_materia_unico, 1, 2022, regime, |
||||
|
data_apresentacao=date(2022, 1, 1)) |
||||
|
_criar_materia(tipo_materia_unico, 2, 2023, regime, |
||||
|
data_apresentacao=date(2023, 1, 1)) |
||||
|
|
||||
|
with transaction.atomic(): |
||||
|
numero, _ = MateriaLegislativa.get_proximo_numero( |
||||
|
tipo=tipo_materia_unico, ano=2024) |
||||
|
assert numero == 3 |
||||
|
|
||||
|
|
||||
|
# =========================================================================== |
||||
|
# Testes de get_proximo_numero – numeração por legislatura |
||||
|
# =========================================================================== |
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_proximo_numero_por_legislatura(tipo_materia_legislatura, regime, |
||||
|
app_config): |
||||
|
"""Numeração 'L' conta apenas matérias dentro da legislatura vigente.""" |
||||
|
baker.make(Legislatura, numero=1, |
||||
|
data_inicio=date(2021, 1, 1), |
||||
|
data_fim=date(2024, 12, 31), |
||||
|
data_eleicao=date(2020, 11, 15)) |
||||
|
|
||||
|
_criar_materia(tipo_materia_legislatura, 1, 2022, regime, |
||||
|
data_apresentacao=date(2022, 3, 1)) |
||||
|
_criar_materia(tipo_materia_legislatura, 2, 2023, regime, |
||||
|
data_apresentacao=date(2023, 5, 1)) |
||||
|
|
||||
|
with transaction.atomic(): |
||||
|
numero, _ = MateriaLegislativa.get_proximo_numero( |
||||
|
tipo=tipo_materia_legislatura, ano=2024) |
||||
|
assert numero == 3 |
||||
|
|
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_proximo_numero_legislatura_inexistente(tipo_materia_legislatura, |
||||
|
regime, app_config): |
||||
|
"""Sem legislatura vigente, número inicia em 1.""" |
||||
|
with transaction.atomic(): |
||||
|
numero, _ = MateriaLegislativa.get_proximo_numero( |
||||
|
tipo=tipo_materia_legislatura, ano=2050) |
||||
|
assert numero == 1 |
||||
|
|
||||
|
|
||||
|
# =========================================================================== |
||||
|
# Testes de get_proximo_numero – numero_candidato |
||||
|
# =========================================================================== |
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_numero_candidato_disponivel(tipo_materia_anual, regime, app_config): |
||||
|
"""Se o número candidato está disponível, deve ser retornado.""" |
||||
|
_criar_materia(tipo_materia_anual, 1, 2024, regime) |
||||
|
|
||||
|
with transaction.atomic(): |
||||
|
numero, _ = MateriaLegislativa.get_proximo_numero( |
||||
|
tipo=tipo_materia_anual, ano=2024, numero_candidato=5) |
||||
|
assert numero == 5 |
||||
|
|
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_numero_candidato_em_uso_retorna_sequencial(tipo_materia_anual, |
||||
|
regime, app_config): |
||||
|
"""Se o número candidato já existe, retorna o sequencial.""" |
||||
|
_criar_materia(tipo_materia_anual, 5, 2024, regime) |
||||
|
|
||||
|
with transaction.atomic(): |
||||
|
numero, _ = MateriaLegislativa.get_proximo_numero( |
||||
|
tipo=tipo_materia_anual, ano=2024, numero_candidato=5) |
||||
|
assert numero == 6 |
||||
|
|
||||
|
|
||||
|
# =========================================================================== |
||||
|
# Testes de get_proximo_numero – resolução de tipo por pk (int/str) |
||||
|
# =========================================================================== |
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_tipo_passado_como_int(tipo_materia_anual, app_config): |
||||
|
"""O tipo pode ser passado como int (pk).""" |
||||
|
with transaction.atomic(): |
||||
|
numero, _ = MateriaLegislativa.get_proximo_numero( |
||||
|
tipo=tipo_materia_anual.pk, ano=2024) |
||||
|
assert numero == 1 |
||||
|
|
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_tipo_passado_como_str(tipo_materia_anual, app_config): |
||||
|
"""O tipo pode ser passado como str representando o pk.""" |
||||
|
with transaction.atomic(): |
||||
|
numero, _ = MateriaLegislativa.get_proximo_numero( |
||||
|
tipo=str(tipo_materia_anual.pk), ano=2024) |
||||
|
assert numero == 1 |
||||
|
|
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_tipo_inexistente_levanta_excecao(app_config): |
||||
|
"""Pk inexistente deve levantar DoesNotExist.""" |
||||
|
with pytest.raises(TipoMateriaLegislativa.DoesNotExist): |
||||
|
with transaction.atomic(): |
||||
|
MateriaLegislativa.get_proximo_numero(tipo=99999, ano=2024) |
||||
|
|
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_tipo_invalido_levanta_validation_error(app_config): |
||||
|
"""Tipo não conversível para int deve levantar ValidationError.""" |
||||
|
from django.core.exceptions import ValidationError |
||||
|
with pytest.raises(ValidationError): |
||||
|
with transaction.atomic(): |
||||
|
MateriaLegislativa.get_proximo_numero(tipo='abc', ano=2024) |
||||
|
|
||||
|
|
||||
|
# =========================================================================== |
||||
|
# Testes de get_proximo_numero – ano padrão |
||||
|
# =========================================================================== |
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_ano_none_usa_ano_atual(tipo_materia_anual, app_config): |
||||
|
"""Se ano=None, deve usar o ano corrente.""" |
||||
|
from django.utils import timezone |
||||
|
with transaction.atomic(): |
||||
|
_, ano = MateriaLegislativa.get_proximo_numero( |
||||
|
tipo=tipo_materia_anual, ano=None) |
||||
|
assert ano == timezone.now().year |
||||
|
|
||||
|
|
||||
|
# =========================================================================== |
||||
|
# Testes de get_proximo_numero – select_for_update (proteção concorrência) |
||||
|
# =========================================================================== |
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_unique_together_protege_duplicata(tipo_materia_anual, regime, |
||||
|
app_config): |
||||
|
"""O unique_together (tipo, numero, ano) impede duplicatas no banco.""" |
||||
|
_criar_materia(tipo_materia_anual, 1, 2024, regime) |
||||
|
with pytest.raises(IntegrityError): |
||||
|
with transaction.atomic(): |
||||
|
_criar_materia(tipo_materia_anual, 1, 2024, regime) |
||||
|
|
||||
|
|
||||
|
# =========================================================================== |
||||
|
# Testes de global config – tipo sem sequencia_numeracao usa global |
||||
|
# =========================================================================== |
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_tipo_sem_sequencia_usa_config_global(tipo_materia, regime, app_config): |
||||
|
"""Tipo com sequencia_numeracao vazio deve usar a config global ('A').""" |
||||
|
_criar_materia(tipo_materia, 1, 2024, regime) |
||||
|
_criar_materia(tipo_materia, 2, 2024, regime) |
||||
|
_criar_materia(tipo_materia, 10, 2023, regime, |
||||
|
data_apresentacao=date(2023, 1, 1)) |
||||
|
|
||||
|
with transaction.atomic(): |
||||
|
numero, _ = MateriaLegislativa.get_proximo_numero( |
||||
|
tipo=tipo_materia, ano=2024) |
||||
|
# global default 'A' → sequencial por ano → MAX(2024) = 2 → próximo = 3 |
||||
|
assert numero == 3 |
||||
|
|
||||
|
|
||||
|
# =========================================================================== |
||||
|
# Testes do endpoint API create (MateriaLegislativaViewSet) |
||||
|
# =========================================================================== |
||||
|
|
||||
|
@pytest.fixture |
||||
|
def api_client_autenticado(db): |
||||
|
"""APIClient autenticado como superusuário (tem todas as permissões).""" |
||||
|
from django.contrib.auth import get_user_model |
||||
|
User = get_user_model() |
||||
|
user = User.objects.create_superuser( |
||||
|
username='admin_api', password='secret123', email='a@b.com') |
||||
|
client = APIClient() |
||||
|
client.force_authenticate(user=user) |
||||
|
return client |
||||
|
|
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_api_create_sem_numero_auto_gera(api_client_autenticado, |
||||
|
tipo_materia_anual, regime, |
||||
|
app_config): |
||||
|
"""POST sem 'numero' deve auto-gerar próximo sequencial.""" |
||||
|
_criar_materia(tipo_materia_anual, 1, 2024, regime) |
||||
|
|
||||
|
response = api_client_autenticado.post( |
||||
|
'/api/materia/materialegislativa/', |
||||
|
{ |
||||
|
'tipo': tipo_materia_anual.pk, |
||||
|
'ano': 2024, |
||||
|
'data_apresentacao': '2024-06-01', |
||||
|
'regime_tramitacao': regime.pk, |
||||
|
'ementa': 'Teste auto-gerar número', |
||||
|
}, |
||||
|
format='json', |
||||
|
) |
||||
|
assert response.status_code == 201 |
||||
|
assert response.data['numero'] == 2 |
||||
|
|
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_api_create_com_numero_respeita_dado(api_client_autenticado, |
||||
|
tipo_materia_anual, regime, |
||||
|
app_config): |
||||
|
"""POST com 'numero' explícito deve criar com o número informado.""" |
||||
|
response = api_client_autenticado.post( |
||||
|
'/api/materia/materialegislativa/', |
||||
|
{ |
||||
|
'tipo': tipo_materia_anual.pk, |
||||
|
'numero': 42, |
||||
|
'ano': 2024, |
||||
|
'data_apresentacao': '2024-06-01', |
||||
|
'regime_tramitacao': regime.pk, |
||||
|
'ementa': 'Número exato', |
||||
|
}, |
||||
|
format='json', |
||||
|
) |
||||
|
assert response.status_code == 201 |
||||
|
assert response.data['numero'] == 42 |
||||
|
|
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_api_create_numero_duplicado_retorna_erro(api_client_autenticado, |
||||
|
tipo_materia_anual, regime, |
||||
|
app_config): |
||||
|
"""POST com número já existente retorna erro. |
||||
|
|
||||
|
O DRF detecta a violação de unique_together via UniqueTogetherValidator |
||||
|
no serializer e retorna 400 antes de chegar ao banco. |
||||
|
""" |
||||
|
_criar_materia(tipo_materia_anual, 42, 2024, regime) |
||||
|
|
||||
|
response = api_client_autenticado.post( |
||||
|
'/api/materia/materialegislativa/', |
||||
|
{ |
||||
|
'tipo': tipo_materia_anual.pk, |
||||
|
'numero': 42, |
||||
|
'ano': 2024, |
||||
|
'data_apresentacao': '2024-06-01', |
||||
|
'regime_tramitacao': regime.pk, |
||||
|
'ementa': 'Duplicata', |
||||
|
}, |
||||
|
format='json', |
||||
|
) |
||||
|
assert response.status_code == 400 |
||||
|
|
||||
|
|
||||
|
@pytest.mark.django_db(transaction=False) |
||||
|
def test_api_create_sem_tipo_valida_serializer(api_client_autenticado, regime): |
||||
|
"""POST sem 'tipo' deve falhar na validação do serializer (400).""" |
||||
|
response = api_client_autenticado.post( |
||||
|
'/api/materia/materialegislativa/', |
||||
|
{ |
||||
|
'numero': 1, |
||||
|
'ano': 2024, |
||||
|
'data_apresentacao': '2024-06-01', |
||||
|
'regime_tramitacao': regime.pk, |
||||
|
'ementa': 'Sem tipo', |
||||
|
}, |
||||
|
format='json', |
||||
|
) |
||||
|
assert response.status_code == 400 |
||||
Binary file not shown.
@ -0,0 +1 @@ |
|||||
|
.painel-principal{background:#1c1b1b;font-family:Verdana;font-size:x-large}.painel-principal .text-title{color:#4fa64d;margin:.5rem;font-weight:700}.painel-principal .text-subtitle{color:#459170;font-weight:700}.painel-principal .data-hora{font-size:180%}.painel-principal .text-value{color:#fff}.painel-principal .logo-painel{max-width:100%}.painel-principal .painels{-ms-flex-wrap:wrap;flex-wrap:wrap}.painel-principal .painel{margin-top:1rem}.painel-principal .painel table{width:100%}.painel-principal .painel h2{margin-bottom:.5rem}.painel-principal .painel #oradores_list,.painel-principal .painel #votacao{text-align:left;display:inline-block;margin-bottom:1rem} |
||||
Binary file not shown.
@ -0,0 +1 @@ |
|||||
|
.painel-principal{background:#1c1b1b;font-family:Verdana;font-size:x-large}.painel-principal .text-title{color:#4fa64d;margin:.5rem;font-weight:700}.painel-principal .text-subtitle{color:#459170;font-weight:700}.painel-principal .data-hora{font-size:180%}.painel-principal .text-value{color:#fff}.painel-principal .logo-painel{max-width:100%}.painel-principal .painels{-ms-flex-wrap:wrap;flex-wrap:wrap}.painel-principal .painel{margin-top:1rem}.painel-principal .painel table{width:100%}.painel-principal .painel h2{margin-bottom:.5rem}.painel-principal .painel #oradores_list,.painel-principal .painel #votacao{text-align:left;display:inline-block;margin-bottom:1rem} |
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -0,0 +1,329 @@ |
|||||
|
/*! |
||||
|
* Bootstrap v4.6.2 (https://getbootstrap.com/) |
||||
|
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) |
||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* Vue.js v2.7.16 |
||||
|
* (c) 2014-2023 Evan You |
||||
|
* Released under the MIT License. |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery JavaScript Library v3.7.1 |
||||
|
* https://jquery.com/ |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license |
||||
|
* https://jquery.org/license |
||||
|
* |
||||
|
* Date: 2023-08-28T13:37Z |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI :data 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Autocomplete 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Button 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Checkboxradio 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Controlgroup 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Datepicker 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Dialog 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Disable Selection 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Draggable 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Droppable 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Effects 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Focusable 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Form Reset Mixin 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Keycode 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Labels 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Menu 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Mouse 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Position 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
* |
||||
|
* https://api.jqueryui.com/position/ |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Progressbar 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Resizable 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Scroll Parent 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Sortable 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Spinner 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Support for jQuery core 1.8.x and newer 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
* |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Tabbable 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Tabs 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Tooltip 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Unique ID 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* jQuery UI Widget 1.13.3 |
||||
|
* https://jqueryui.com |
||||
|
* |
||||
|
* Copyright OpenJS Foundation and other contributors |
||||
|
* Released under the MIT license. |
||||
|
* https://jquery.org/license |
||||
|
*/ |
||||
|
|
||||
|
/*! jQuery UI - v1.13.3 - 2024-04-26 |
||||
|
* https://jqueryui.com |
||||
|
* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js |
||||
|
* Copyright OpenJS Foundation and other contributors; Licensed MIT */ |
||||
|
|
||||
|
/** |
||||
|
* @license |
||||
|
* Lodash <https://lodash.com/> |
||||
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/> |
||||
|
* Released under MIT license <https://lodash.com/license> |
||||
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> |
||||
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors |
||||
|
*/ |
||||
|
|
||||
|
/**! |
||||
|
* @fileOverview Kickass library to create and place poppers near their reference elements. |
||||
|
* @version 1.16.1 |
||||
|
* @license |
||||
|
* Copyright (c) 2016 Federico Zivolo and contributors |
||||
|
* |
||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
|
* of this software and associated documentation files (the "Software"), to deal |
||||
|
* in the Software without restriction, including without limitation the rights |
||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
|
* copies of the Software, and to permit persons to whom the Software is |
||||
|
* furnished to do so, subject to the following conditions: |
||||
|
* |
||||
|
* The above copyright notice and this permission notice shall be included in all |
||||
|
* copies or substantial portions of the Software. |
||||
|
* |
||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
|
* SOFTWARE. |
||||
|
*/ |
||||
|
|
||||
|
//! moment.js |
||||
|
|
||||
|
//! moment.js locale configuration |
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -0,0 +1,5 @@ |
|||||
|
/*! |
||||
|
* jQuery-runner - v2.3.3 - 2014-08-06 |
||||
|
* https://github.com/jylauril/jquery-runner/ |
||||
|
* Copyright (c) 2014 Jyrki Laurila <https://github.com/jylauril> |
||||
|
*/ |
||||
Binary file not shown.
@ -0,0 +1 @@ |
|||||
|
(()=>{"use strict";var d,u,e,r={4049:(e,o,r)=>{r(3792),r(3362),r(9085),r(9391);var n=r(2893),t=r(8246),r=r(7906);r.A.defaults.xsrfCookieName="csrftoken",r.A.defaults.xsrfHeaderName="X-CSRFToken",n.Ay.use(t.m0),console.log("painel controle main.js carregado"),new n.Ay({delimiters:["[[","]]"],el:"#painel-controle",data:function(){return{sessao_plenaria:"74ª Sessão Ordinária da 1ª Sessão Legislativa da 18ª Legislatura",message:""}},watch:{},computed:{},created:function(){},methods:{},mounted:function(){console.log("Painel controle app mounted!")}})}},n={};function c(e){var o=n[e];return void 0!==o||(o=n[e]={id:e,loaded:!1,exports:{}},r[e].call(o.exports,o,o.exports,c),o.loaded=!0),o.exports}c.m=r,d=[],c.O=(e,o,r,n)=>{if(!o){for(var t=1/0,a=0;a<d.length;a++){for(var l,[o,r,n]=d[a],i=!0,s=0;s<o.length;s++)(!1&n||n<=t)&&Object.keys(c.O).every(e=>c.O[e](o[s]))?o.splice(s--,1):(i=!1,n<t&&(t=n));i&&(d.splice(a--,1),void 0!==(l=r()))&&(e=l)}return e}n=n||0;for(var a=d.length;0<a&&d[a-1][2]>n;a--)d[a]=d[a-1];d[a]=[o,r,n]},c.n=e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return c.d(o,{a:o}),o},c.d=(e,o)=>{for(var r in o)c.o(o,r)&&!c.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},c.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),c.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),c.j=833,u={833:0},c.O.j=e=>0===u[e],o=(e,o)=>{var r,n,t,[a,l,i]=o,s=0;if(a.some(e=>0!==u[e])){for(r in l)c.o(l,r)&&(c.m[r]=l[r]);i&&(t=i(c))}for(e&&e(o);s<a.length;s++)n=a[s],c.o(u,n)&&u[n]&&u[n][0](),u[n]=0;return c.O(t)},(e=self.webpackChunksapl_frontend=self.webpackChunksapl_frontend||[]).forEach(o.bind(null,0)),e.push=o.bind(null,e.push.bind(e));var o=c.O(void 0,[504],()=>c(4049));c.O(o)})(); |
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -0,0 +1 @@ |
|||||
|
(()=>{"use strict";var u,c,e,t={8020:(e,a,t)=>{t(3792),t(3362),t(9085),t(9391),t(6918),t(2008),t(2712),t(3288),t(6099),t(8781);var r=t(2893),s=t(8246),i=t(7906),n=t(2543);i.A.defaults.headers.get["Cache-Control"]="no-cache, no-store, must-revalidate",i.A.defaults.headers.get.Pragma="no-cache",i.A.defaults.headers.get.Expires="0",i.A.defaults.xsrfCookieName="csrftoken",i.A.defaults.xsrfHeaderName="X-CSRFToken",r.Ay.use(s.m0),new r.Ay({delimiters:["[[","]]"],el:"#app2",data:function(){return{nome_pesquisa:"",is_pesquisa:!1,legislatura_selecionada:"",legislaturas:[],parlamentares:[],visible_parlamentares:[],size_parlamentares:0,filter_ativo:!0,filter_titular:""}},watch:{nome_pesquisa:function(e){this.debouncepesquisaParlamentar()}},created:function(){this.debouncepesquisaParlamentar=n.debounce(this.pesquisaParlamentar,500)},methods:{getParlamentares:function(e){var a=this;!this.legislatura_selecionada&&"0"!==this.legislatura_selecionada.toString()||i.A.get("/api/parlamentares/legislatura/"+this.legislatura_selecionada+"/parlamentares/?get_all=true").then(function(e){a.parlamentares=e.data,a.visible_parlamentares=a.parlamentares,a.size_parlamentares=a.visible_parlamentares.length,a.checkTitularAtivo()}).catch(function(e){console.error("Ocorreu um erro ao obter os dados de parlamentares:"+e)})},pesquisaParlamentar:function(e){var a=this;i.A.get("/api/parlamentares/parlamentar/search_parlamentares/",{params:{nome_parlamentar:this.nome_pesquisa}}).then(function(e){a.parlamentares=e.data,a.visible_parlamentares=a.parlamentares,a.size_parlamentares=a.visible_parlamentares.length}).catch(function(e){console.error("Erro ao procurar parlamentar:"+e)})},checkTitularAtivo:function(e){this.visible_parlamentares=this.parlamentares,this.filter_ativo&&(this.visible_parlamentares=this.visible_parlamentares.filter(function(e){return e.ativo})),this.filter_titular&&(this.visible_parlamentares=this.visible_parlamentares.filter(function(e){return"Sim"===e.titular})),this.size_parlamentares=this.visible_parlamentares.length},pesquisaChange:function(e){this.is_pesquisa=!this.is_pesquisa,this.filter_ativo=!0,this.is_pesquisa?this.parlamentares=[]:this.getParlamentares()}},mounted:function(){var a=this;i.A.get("/api/parlamentares/legislatura/?get_all=true").then(function(e){a.legislaturas=e.data;var s=(new Date).getFullYear();a.legislatura_selecionada=a.legislaturas.reduce(function(e,a){var t=new Date(a.data_inicio+" 00:00").getFullYear(),r=new Date(a.data_fim+" 00:00").getFullYear();return e=t<=s&&s<=r?a.id:e},"")}).then(function(e){a.getParlamentares()}).catch(function(e){console.error("Ocorreu um erro ao obter os dados de legislação: "+e)})}})}},r={};function p(e){var a=r[e];return void 0!==a||(a=r[e]={id:e,loaded:!1,exports:{}},t[e].call(a.exports,a,a.exports,p),a.loaded=!0),a.exports}p.m=t,u=[],p.O=(e,a,t,r)=>{if(!a){for(var s=1/0,i=0;i<u.length;i++){for(var n,[a,t,r]=u[i],l=!0,o=0;o<a.length;o++)(!1&r||r<=s)&&Object.keys(p.O).every(e=>p.O[e](a[o]))?a.splice(o--,1):(l=!1,r<s&&(s=r));l&&(u.splice(i--,1),void 0!==(n=t()))&&(e=n)}return e}r=r||0;for(var i=u.length;0<i&&u[i-1][2]>r;i--)u[i]=u[i-1];u[i]=[a,t,r]},p.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return p.d(a,{a:a}),a},p.d=(e,a)=>{for(var t in a)p.o(a,t)&&!p.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:a[t]})},p.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),p.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),p.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),p.j=788,c={788:0},p.O.j=e=>0===c[e],a=(e,a)=>{var t,r,s,[i,n,l]=a,o=0;if(i.some(e=>0!==c[e])){for(t in n)p.o(n,t)&&(p.m[t]=n[t]);l&&(s=l(p))}for(e&&e(a);o<i.length;o++)r=i[o],p.o(c,r)&&c[r]&&c[r][0](),c[r]=0;return p.O(s)},(e=self.webpackChunksapl_frontend=self.webpackChunksapl_frontend||[]).forEach(a.bind(null,0)),e.push=a.bind(null,e.push.bind(e));var a=p.O(void 0,[504],()=>p(8020));p.O(a)})(); |
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue