Commit 21ea1ee7e0607df81d96fb0c0f32be9a4bb7f0df
Exists in
master
Merge branch 'master' of https://github.com/lightbase/WSCacicNeo
Showing
9 changed files
with
99 additions
and
9 deletions
Show diff stats
wscacicneo/__init__.py
... | ... | @@ -50,11 +50,18 @@ def main(global_config, **settings): |
50 | 50 | cfg.add_route('edit_favoritos', 'edit_favoritos') |
51 | 51 | cfg.add_route('listuser', 'usuario/lista') |
52 | 52 | cfg.add_route('delete_user', 'usuario/delete/{matricula}') |
53 | - cfg.add_route('notify', 'lista/notificacoes') | |
53 | + cfg.add_route('notify', 'notificacoes/cadastro') | |
54 | 54 | cfg.add_route('post_notify', 'post_notify') |
55 | 55 | cfg.add_route('list_notify', 'notificacoes/lista') |
56 | 56 | cfg.add_route('cadastro_coleta', 'coleta/cadastro') |
57 | 57 | # |
58 | + # base orgaos | |
59 | + cfg.add_route('create_orgao', 'create/orgao/{nm_orgao}') | |
60 | + # | |
61 | + # relatorios | |
62 | + cfg.add_route('conf_report', 'relatorios/configuracao') | |
63 | + cfg.add_route('report_hd', 'relatorio/{orgao}/{item}') | |
64 | + # | |
58 | 65 | cfg.add_route('list', 'list') |
59 | 66 | cfg.add_route('gestao', 'gestao') |
60 | 67 | cfg.add_route('memoria', 'memoria') | ... | ... |
wscacicneo/model/coleta_manual.py
... | ... | @@ -20,10 +20,11 @@ class ColetaManualBase(): |
20 | 20 | """ |
21 | 21 | Classe para a base de usuários |
22 | 22 | """ |
23 | - def __init__(self, rest_url=None): | |
23 | + def __init__(self, nm_base, rest_url=None): | |
24 | 24 | """ |
25 | 25 | Método construtor |
26 | 26 | """ |
27 | + self.nm_base = nm_base | |
27 | 28 | if rest_url is None: |
28 | 29 | self.rest_url = config.REST_URL |
29 | 30 | else: |
... | ... | @@ -292,7 +293,7 @@ class ColetaManualBase(): |
292 | 293 | ) |
293 | 294 | |
294 | 295 | base_metadata = BaseMetadata( |
295 | - name='coleta_manual', | |
296 | + name = self.nm_base, | |
296 | 297 | ) |
297 | 298 | |
298 | 299 | content_list = Content() |
... | ... | @@ -336,4 +337,4 @@ class ColetaManualBase(): |
336 | 337 | if response.status_code == 200: |
337 | 338 | return True |
338 | 339 | else: |
339 | - raise IOError('Error excluding base from LB') | |
340 | 340 | \ No newline at end of file |
341 | + raise IOError('Error excluding base from LB') | ... | ... |
... | ... | @@ -0,0 +1,44 @@ |
1 | +<metal:main use-macro="load: master.pt"> | |
2 | + <metal:content fill-slot="conteudo"> | |
3 | + <div class="padd"> | |
4 | + <br /> | |
5 | + <!-- Form starts. --> | |
6 | + <form class="form-horizontal" role="form"> | |
7 | + <div class="form-group"> | |
8 | + <label class="col-lg-2 control-label">Órgão</label> | |
9 | + <div class="col-lg-2"> | |
10 | + <select id="orgao" class="form-control"> | |
11 | + <option></option> | |
12 | + <option tal:repeat="doc orgao_doc">${doc.sigla}</option> | |
13 | + </select> | |
14 | + </div> | |
15 | + </div> | |
16 | + <div class="form-group"> | |
17 | + <label class="col-lg-2 control-label">Item</label> | |
18 | + <div class="col-lg-2"> | |
19 | + <select id="coleta" class="form-control"> | |
20 | + <option></option> | |
21 | + <option>processador</option> | |
22 | + <option>hd</option> | |
23 | + <option>bios</option> | |
24 | + <option>memoria</option> | |
25 | + <option>Sistemas Operacionais</option> | |
26 | + </select> | |
27 | + </div> | |
28 | + </div> | |
29 | + <div class="form-group"> | |
30 | + <div class="col-lg-offset-2 col-lg-6"> | |
31 | + <button type="button" id="enviar" class="btn btn-sm" style="margin-left: 315px;" >Enviar</button> | |
32 | + </div> | |
33 | + </div> | |
34 | + </form> | |
35 | + </div> | |
36 | + </metal:content> | |
37 | + <metal:content fill-slot="javascript"> | |
38 | + <script type="text/javascript"> | |
39 | + $('#enviar').click(function(){ | |
40 | + window.location = "${request.route_url('root')}home" | |
41 | + }); | |
42 | + </script> | |
43 | + </metal:content> | |
44 | +</metal:main> | ... | ... |
wscacicneo/templates/list_orgao.pt
... | ... | @@ -36,7 +36,7 @@ |
36 | 36 | <td>${doc.endereco}</td> |
37 | 37 | <td>${doc.email}</td> |
38 | 38 | <td> |
39 | - <a class="btn btn-xs btn-success"><i class="fa fa-check"></i></a> | |
39 | + <a href="${request.route_url('root')}create/orgao/${doc.nome}" class="btn btn-xs btn-success" id="create"><i class="fa fa-check"></i></a> | |
40 | 40 | <a href="${request.route_url('root')}orgao/editar/${doc.sigla}" class="btn btn-xs btn-warning"><i class="fa fa-pencil"></i></a> |
41 | 41 | <a href="${request.route_url('root')}orgao/delete/${doc.sigla}" class="btn btn-xs btn-danger"><i class="fa fa-times"></i></a> |
42 | 42 | </td> | ... | ... |
wscacicneo/templates/menu.pt
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | <ul |
12 | 12 | > <li><a href="${request.route_url('root')}orgao/cadastro">Cadastrar Orgão</a></li> |
13 | 13 | <li><a href="${request.route_url('root')}orgao/lista">Listar Orgãos</a></li> |
14 | - <li><a href="${request.route_url('root')}notificacoes/lista">Notificalções</a></li> | |
14 | + <li><a href="${request.route_url('root')}notificacoes/lista">Notificações</a></li> | |
15 | 15 | </ul> |
16 | 16 | <li class="has_sub"> |
17 | 17 | <a href="#"><i class="fa fa-file-o"></i> Usuário <span class="pull-right"><i class="fa fa-chevron-right"></i></span></a> | ... | ... |
wscacicneo/test/test_coleta_manual_base.py
wscacicneo/utils/utils.py
wscacicneo/views.py
... | ... | @@ -16,6 +16,7 @@ from wscacicneo.model.user import User |
16 | 16 | from wscacicneo.model.user import UserBase |
17 | 17 | from wscacicneo.model.notify import Notify |
18 | 18 | from wscacicneo.model.notify import NotifyBase |
19 | +from wscacicneo.model import coleta_manual | |
19 | 20 | |
20 | 21 | from liblightbase.lbbase.struct import Base |
21 | 22 | from liblightbase.lbutils import conv |
... | ... | @@ -209,7 +210,33 @@ def confighome(request): |
209 | 210 | def db(request): |
210 | 211 | return {'project': 'WSCacicNeo'} |
211 | 212 | |
212 | -#URL Órgaos | |
213 | +@view_config(route_name='create_orgao') | |
214 | +def create_base(request): | |
215 | + nm_orgao = request.matchdict['nm_orgao'] | |
216 | + coletaManualBase = coleta_manual.ColetaManualBase(nm_orgao) | |
217 | + lbbase = coletaManualBase.lbbase | |
218 | + retorno = coletaManualBase.create_base() | |
219 | + | |
220 | + return HTTPFound(request.route_url('root') + 'orgao/lista') | |
221 | + | |
222 | +@view_config(route_name='conf_report', renderer='templates/conf_report.pt') | |
223 | +def conf_report(request): | |
224 | + orgao_obj = Orgao( | |
225 | + nome = 'sahuds', | |
226 | + cargo = 'cargo', | |
227 | + coleta = '4h', | |
228 | + sigla = 'MPOG', | |
229 | + endereco = 'Esplanada bloco C', | |
230 | + email = 'admin@planemaneto.gov.br', | |
231 | + telefone = '(61) 2025-4117', | |
232 | + url = 'http://api.brlight.net/api' | |
233 | + ) | |
234 | + search = orgao_obj.search_list_orgaos() | |
235 | + return {'orgao_doc': search.results} | |
236 | + | |
237 | +@view_config(route_name='report_hd', renderer='templates/report.pt') | |
238 | +def report_hd(request): | |
239 | + return { } | |
213 | 240 | |
214 | 241 | @view_config(route_name='post_orgao') |
215 | 242 | def post_orgao(request): |
... | ... | @@ -538,4 +565,4 @@ def post_notify(request): |
538 | 565 | |
539 | 566 | @view_config(route_name='cadastro_coleta', renderer='templates/cadastro_coleta.pt') |
540 | 567 | def cadastro_coleta(request): |
541 | - return {'project': 'WSCacicNeo'} | |
542 | 568 | \ No newline at end of file |
569 | + return {'project': 'WSCacicNeo'} | ... | ... |