diff --git a/wscacicneo/__init__.py b/wscacicneo/__init__.py index 52d346e..f745187 100755 --- a/wscacicneo/__init__.py +++ b/wscacicneo/__init__.py @@ -54,6 +54,13 @@ def main(global_config, **settings): cfg.add_route('post_notify', 'post_notify') cfg.add_route('list_notify', 'notificacoes/lista') # + # base orgaos + cfg.add_route('create_orgao', 'create/orgao/{nm_orgao}') + # + # relatorios + cfg.add_route('conf_report', 'relatorios/configuracao') + cfg.add_route('report_hd', 'relatorio/{orgao}/{item}') + # cfg.add_route('list', 'list') cfg.add_route('gestao', 'gestao') cfg.add_route('memoria', 'memoria') diff --git a/wscacicneo/model/coleta_manual.py b/wscacicneo/model/coleta_manual.py index 2aa13cb..faaaf53 100644 --- a/wscacicneo/model/coleta_manual.py +++ b/wscacicneo/model/coleta_manual.py @@ -20,10 +20,11 @@ class ColetaManualBase(): """ Classe para a base de usuários """ - def __init__(self, rest_url=None): + def __init__(self, nm_base, rest_url=None): """ Método construtor """ + self.nm_base = nm_base if rest_url is None: self.rest_url = config.REST_URL else: @@ -292,7 +293,7 @@ class ColetaManualBase(): ) base_metadata = BaseMetadata( - name='coleta_manual', + name = self.nm_base, ) content_list = Content() @@ -336,4 +337,4 @@ class ColetaManualBase(): if response.status_code == 200: return True else: - raise IOError('Error excluding base from LB') \ No newline at end of file + raise IOError('Error excluding base from LB') diff --git a/wscacicneo/templates/conf_report.pt b/wscacicneo/templates/conf_report.pt new file mode 100644 index 0000000..68d8c7a --- /dev/null +++ b/wscacicneo/templates/conf_report.pt @@ -0,0 +1,44 @@ + + +
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+ + + +
diff --git a/wscacicneo/templates/list_orgao.pt b/wscacicneo/templates/list_orgao.pt index e887720..b7042d6 100755 --- a/wscacicneo/templates/list_orgao.pt +++ b/wscacicneo/templates/list_orgao.pt @@ -36,7 +36,7 @@ ${doc.endereco} ${doc.email} - + diff --git a/wscacicneo/templates/report.pt b/wscacicneo/templates/report.pt new file mode 100644 index 0000000..73821f6 --- /dev/null +++ b/wscacicneo/templates/report.pt @@ -0,0 +1,8 @@ + + + + + + + diff --git a/wscacicneo/test/test_coleta_manual_base.py b/wscacicneo/test/test_coleta_manual_base.py index 529d5d1..d14f134 100644 --- a/wscacicneo/test/test_coleta_manual_base.py +++ b/wscacicneo/test/test_coleta_manual_base.py @@ -28,4 +28,4 @@ class TestColetaManualBase(unittest.TestCase): self.assertIsInstance(retorno, Base) def tearDown(self): - pass \ No newline at end of file + pass diff --git a/wscacicneo/utils/utils.py b/wscacicneo/utils/utils.py index a293945..2631541 100755 --- a/wscacicneo/utils/utils.py +++ b/wscacicneo/utils/utils.py @@ -1,5 +1,8 @@ import requests import json +from wscacicneo.model.orgao import Orgao +from wscacicneo.model.orgao import OrgaoBase + class Utils: diff --git a/wscacicneo/views.py b/wscacicneo/views.py index 88009a4..6dd7418 100755 --- a/wscacicneo/views.py +++ b/wscacicneo/views.py @@ -16,6 +16,7 @@ from wscacicneo.model.user import User from wscacicneo.model.user import UserBase from wscacicneo.model.notify import Notify from wscacicneo.model.notify import NotifyBase +from wscacicneo.model import coleta_manual from liblightbase.lbbase.struct import Base from liblightbase.lbutils import conv @@ -209,7 +210,33 @@ def confighome(request): def db(request): return {'project': 'WSCacicNeo'} -#URL Órgaos +@view_config(route_name='create_orgao') +def create_base(request): + nm_orgao = request.matchdict['nm_orgao'] + coletaManualBase = coleta_manual.ColetaManualBase(nm_orgao) + lbbase = coletaManualBase.lbbase + retorno = coletaManualBase.create_base() + + return HTTPFound(request.route_url('root') + 'orgao/lista') + +@view_config(route_name='conf_report', renderer='templates/conf_report.pt') +def conf_report(request): + orgao_obj = Orgao( + nome = 'sahuds', + cargo = 'cargo', + coleta = '4h', + sigla = 'MPOG', + endereco = 'Esplanada bloco C', + email = 'admin@planemaneto.gov.br', + telefone = '(61) 2025-4117', + url = 'http://api.brlight.net/api' + ) + search = orgao_obj.search_list_orgaos() + return {'orgao_doc': search.results} + +@view_config(route_name='report_hd', renderer='templates/report.pt') +def report_hd(request): + return { } @view_config(route_name='post_orgao') def post_orgao(request): -- libgit2 0.21.2