Commit b32bab3222670a536b3cf9ffdc81af121c9558ea

Authored by Adley
2 parents ca296b93 0e30f7e8
Exists in master

Merge branch 'master' of https://github.com/lightbase/WSCacicNeo

wscacicneo/__init__.py
@@ -52,6 +52,7 @@ def main(global_config, **settings): @@ -52,6 +52,7 @@ def main(global_config, **settings):
52 cfg.add_route('delete_user', 'usuario/delete/{matricula}') 52 cfg.add_route('delete_user', 'usuario/delete/{matricula}')
53 cfg.add_route('notify', 'lista/notificacoes') 53 cfg.add_route('notify', 'lista/notificacoes')
54 cfg.add_route('post_notify', 'post_notify') 54 cfg.add_route('post_notify', 'post_notify')
  55 + cfg.add_route('list_notify', 'notificacoes/lista')
55 # 56 #
56 cfg.add_route('list', 'list') 57 cfg.add_route('list', 'list')
57 cfg.add_route('gestao', 'gestao') 58 cfg.add_route('gestao', 'gestao')
wscacicneo/model/notify.py
@@ -133,7 +133,7 @@ class Notify(notify_base.metaclass): @@ -133,7 +133,7 @@ class Notify(notify_base.metaclass):
133 Classe genérica de órgãos 133 Classe genérica de órgãos
134 """ 134 """
135 def __init__(self, **args): 135 def __init__(self, **args):
136 - super(Orgao, self).__init__(**args) 136 + super(Notify, self).__init__(**args)
137 self.documentrest = notify_base.documentrest 137 self.documentrest = notify_base.documentrest
138 138
139 def notify_to_dict(self): 139 def notify_to_dict(self):
wscacicneo/templates/list_notify.pt 0 → 100644
@@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
  1 +<metal:main use-macro="load: master.pt">
  2 + <metal:content fill-slot="conteudo">
  3 + <div class="matter">
  4 + <div class="container">
  5 + <div class="row">
  6 + <div class="col-md-12">
  7 + <div class="widget">
  8 + <div class="widget-head">
  9 + <div class="pull-left">Data Tables</div>
  10 + <div class="widget-icons pull-right">
  11 + <a href="#" class="wminimize"><i class="fa fa-chevron-up"></i></a>
  12 + <a href="#" class="wclose"><i class="fa fa-times"></i></a>
  13 + </div>
  14 + <div class="clearfix"></div>
  15 + </div>
  16 + <div class="widget-content">
  17 + <div class="padd">
  18 + <div class="page-tables">
  19 + <div class="table-responsive">
  20 + <table cellpadding="0" cellspacing="0" border="0" id="data-table" width="100%">
  21 + <thead>
  22 + <tr>
  23 + <th>Órgão</th>
  24 + <th>ID da Coleta</th>
  25 + <th>Vizualizada</th>
  26 + <th>Notificação</th>
  27 + <th>Opções</th>
  28 + </tr>
  29 + </thead>
  30 + <tbody>
  31 + <tr tal:repeat="coleta doc">
  32 + <td>${coleta.orgao}</td>
  33 + <td>${coleta.id_coleta}</td>
  34 + <td>${coleta.status}</td>
  35 + <td>${coleta.notify}</td>
  36 + <td>
  37 + <a class="btn btn-xs btn-success"><i class="fa fa-check"></i></a>
  38 + <a href="${request.route_url('root')}" class="btn btn-xs btn-warning"><i class="fa fa-pencil"></i></a>
  39 + <a href="${request.route_url('root')}" class="btn btn-xs btn-danger"><i class="fa fa-times"></i></a>
  40 + </td>
  41 + </tr>
  42 + </tbody>
  43 +
  44 + </table>
  45 + <div class="clearfix"></div>
  46 + </div>
  47 + </div>
  48 + </div>
  49 + </div>
  50 + <div class="widget-foot">
  51 + </div>
  52 + </div>
  53 + </div>
  54 + </div>
  55 + </div>
  56 + </div>
  57 + </metal:content>
  58 + <metal:content fill-slot="javascript">
  59 + <script type="text/javascript">
  60 + </script>
  61 + </metal:content>
  62 +</metal:main>
wscacicneo/templates/master.pt
@@ -13,20 +13,16 @@ @@ -13,20 +13,16 @@
13 <div class="navbar navbar-fixed-top bs-docs-nav" role="banner"> 13 <div class="navbar navbar-fixed-top bs-docs-nav" role="banner">
14 14
15 <div class="conjtainer"> 15 <div class="conjtainer">
16 -  
17 <!-- Menu button for smallar screens --> 16 <!-- Menu button for smallar screens -->
18 <div class="navbar-header"> 17 <div class="navbar-header">
19 <button class="navbar-toggle btn-navbar" type="button" data-toggle="collapse" data-target=".bs-navbar-collapse"> 18 <button class="navbar-toggle btn-navbar" type="button" data-toggle="collapse" data-target=".bs-navbar-collapse">
20 <span>Menu</span> 19 <span>Menu</span>
21 </button> 20 </button>
22 -  
23 <!-- Site name for smallar screens --> 21 <!-- Site name for smallar screens -->
24 <a href="index.html" class="navbar-brand hidden-lg">Super-Gerente</a> 22 <a href="index.html" class="navbar-brand hidden-lg">Super-Gerente</a>
25 </div> 23 </div>
26 -  
27 <!-- Navigation starts --> 24 <!-- Navigation starts -->
28 <nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation"> 25 <nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
29 -  
30 <!-- Links --> 26 <!-- Links -->
31 <ul class="nav navbar-nav pull-right"> 27 <ul class="nav navbar-nav pull-right">
32 <li class="dropdown pull-right"> 28 <li class="dropdown pull-right">
@@ -40,7 +36,6 @@ @@ -40,7 +36,6 @@
40 </ul> 36 </ul>
41 </li> 37 </li>
42 </ul> 38 </ul>
43 -  
44 <!-- Search form --> 39 <!-- Search form -->
45 <form class="navbar-form navbar-right" role="search"> 40 <form class="navbar-form navbar-right" role="search">
46 <div class="form-group"> 41 <div class="form-group">
@@ -51,12 +46,10 @@ @@ -51,12 +46,10 @@
51 46
52 </div> 47 </div>
53 </div> 48 </div>
54 -  
55 <!-- Header starts --> 49 <!-- Header starts -->
56 <header> 50 <header>
57 <div class="container"> 51 <div class="container">
58 <div class="row"> 52 <div class="row">
59 -  
60 <!-- Logo section --> 53 <!-- Logo section -->
61 <div class="col-md-4"> 54 <div class="col-md-4">
62 <!-- Logo. --> 55 <!-- Logo. -->
@@ -64,125 +57,10 @@ @@ -64,125 +57,10 @@
64 <h1><a href="${request.route_url('root')}home"><img src="${request.route_url('root')}static/caciclogo_transparent.png"> </a> 57 <h1><a href="${request.route_url('root')}home"><img src="${request.route_url('root')}static/caciclogo_transparent.png"> </a>
65 <a href="${request.route_url('root')}home">Super<span class="bold">Gerente</span></a></h1> 58 <a href="${request.route_url('root')}home">Super<span class="bold">Gerente</span></a></h1>
66 </div> 59 </div>
67 -  
68 <!-- Logo ends --> 60 <!-- Logo ends -->
69 </div> 61 </div>
70 -  
71 <!-- Button section --> 62 <!-- Button section -->
72 - <div class="col-md-4">  
73 -  
74 - <!-- Buttons -->  
75 - <ul class="nav nav-pills">  
76 -  
77 - <!-- Comment button with number of latest comments count -->  
78 - <li class="dropdown dropdown-big">  
79 - <a class="dropdown-toggle" href="#" data-toggle="dropdown">  
80 - <i class="fa fa-comments"></i> Chats <span class="label label-info">6</span>  
81 - </a>  
82 -  
83 - <ul class="dropdown-menu">  
84 - <li>  
85 - <!-- Heading - h5 -->  
86 - <h5><i class="fa fa-comments"></i> Chats</h5>  
87 - <!-- Use hr tag to add border -->  
88 - <hr />  
89 - </li>  
90 - <li>  
91 - <!-- List item heading h6 -->  
92 - <h6><a href="#">Hi :)</a> <span class="label label-warning pull-right">10:42</span></h6>  
93 - <div class="clearfix"></div>  
94 - <hr />  
95 - </li>  
96 - <li>  
97 - <h6><a href="#">How are you?</a> <span class="label label-warning pull-right">20:42</span></h6>  
98 - <div class="clearfix"></div>  
99 - <hr />  
100 - </li>  
101 - <li>  
102 - <h6><a href="#">What are you doing?</a> <span class="label label-warning pull-right">14:42</span></h6>  
103 - <div class="clearfix"></div>  
104 - <hr />  
105 - </li>  
106 - <li>  
107 - <div class="drop-foot">  
108 - <a href="#">View All</a>  
109 - </div>  
110 - </li>  
111 - </ul>  
112 - </li>  
113 -  
114 - <!-- Message button with number of latest messages count-->  
115 - <li class="dropdown dropdown-big">  
116 - <a class="dropdown-toggle" href="#" data-toggle="dropdown">  
117 - <i class="fa fa-envelope"></i> Inbox <span class="label label-primary">6</span>  
118 - </a>  
119 -  
120 - <ul class="dropdown-menu">  
121 - <li>  
122 - <!-- Heading - h5 -->  
123 - <h5><i class="fa fa-envelope"></i> Messages</h5>  
124 - <!-- Use hr tag to add border -->  
125 - <hr />  
126 - </li>  
127 - <li>  
128 - <!-- List item heading h6 -->  
129 - <h6><a href="#">Hello how are you?</a></h6>  
130 - <!-- List item para -->  
131 - <p>Quisque eu consectetur erat eget semper...</p>  
132 - <hr />  
133 - </li>  
134 - <li>  
135 - <h6><a href="#">Today is wonderful?</a></h6>  
136 - <p>Quisque eu consectetur erat eget semper...</p>  
137 - <hr />  
138 - </li>  
139 - <li>  
140 - <div class="drop-foot">  
141 - <a href="#">View All</a>  
142 - </div>  
143 - </li>  
144 - </ul>  
145 - </li>  
146 -  
147 - <!-- Members button with number of latest members count -->  
148 - <li class="dropdown dropdown-big">  
149 - <a class="dropdown-toggle" href="#" data-toggle="dropdown">  
150 - <i class="fa fa-user"></i> Users <span class="label label-success">6</span>  
151 - </a>  
152 -  
153 - <ul class="dropdown-menu">  
154 - <li>  
155 - <!-- Heading - h5 -->  
156 - <h5><i class="fa fa-user"></i> Users</h5>  
157 - <!-- Use hr tag to add border -->  
158 - <hr />  
159 - </li>  
160 - <li>  
161 - <!-- List item heading h6-->  
162 - <h6><a href="#">Ravi Kumar</a> <span class="label label-warning pull-right">Free</span></h6>  
163 - <div class="clearfix"></div>  
164 - <hr />  
165 - </li>  
166 - <li>  
167 - <h6><a href="#">Balaji</a> <span class="label label-important pull-right">Premium</span></h6>  
168 - <div class="clearfix"></div>  
169 - <hr />  
170 - </li>  
171 - <li>  
172 - <h6><a href="#">Kumarasamy</a> <span class="label label-warning pull-right">Free</span></h6>  
173 - <div class="clearfix"></div>  
174 - <hr />  
175 - </li>  
176 - <li>  
177 - <div class="drop-foot">  
178 - <a href="#">View All</a>  
179 </div> 63 </div>
180 - </li>  
181 - </ul>  
182 - </li>  
183 - </ul>  
184 - </div>  
185 - </div>  
186 </div> 64 </div>
187 </header> 65 </header>
188 66
wscacicneo/templates/menu.pt
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 <ul 11 <ul
12 > <li><a href="${request.route_url('root')}orgao/cadastro">Cadastrar Orgão</a></li> 12 > <li><a href="${request.route_url('root')}orgao/cadastro">Cadastrar Orgão</a></li>
13 <li><a href="${request.route_url('root')}orgao/lista">Listar Orgãos</a></li> 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 </ul> 15 </ul>
15 <li class="has_sub"> 16 <li class="has_sub">
16 <a href="#"><i class="fa fa-file-o"></i> Usuário <span class="pull-right"><i class="fa fa-chevron-right"></i></span></a> 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/templates/notify_coleta.pt
@@ -34,18 +34,17 @@ @@ -34,18 +34,17 @@
34 <metal:content fill-slot="javascript"> 34 <metal:content fill-slot="javascript">
35 <script type="text/javascript"> 35 <script type="text/javascript">
36 $('#enviar').click(function(){ 36 $('#enviar').click(function(){
37 - alert('asdasdasd')  
38 var data = { 37 var data = {
39 'orgao' : $('#orgao').val(), 38 'orgao' : $('#orgao').val(),
40 'id_coleta' : $('#id_coleta').val(), 39 'id_coleta' : $('#id_coleta').val(),
41 'notify' : $('#notify').val(), 40 'notify' : $('#notify').val(),
42 - 'status' : True  
43 - } 41 + 'status' : 'True'
  42 + };
44 $.ajax({ 43 $.ajax({
45 type: "POST", 44 type: "POST",
46 url: "${request.route_url('root')}post_notify", 45 url: "${request.route_url('root')}post_notify",
47 data: data, 46 data: data,
48 - success: function(){ alert('asdasdasd') }, 47 + success: function(){ alert('22222222') },
49 error: function(){ alert('Não foi desta vez Tente novamente mais tarde') }, 48 error: function(){ alert('Não foi desta vez Tente novamente mais tarde') },
50 }); 49 });
51 }); 50 });
wscacicneo/views.py
@@ -14,6 +14,9 @@ from wscacicneo.model.orgao import Orgao @@ -14,6 +14,9 @@ from wscacicneo.model.orgao import Orgao
14 from wscacicneo.model.orgao import OrgaoBase 14 from wscacicneo.model.orgao import OrgaoBase
15 from wscacicneo.model.user import User 15 from wscacicneo.model.user import User
16 from wscacicneo.model.user import UserBase 16 from wscacicneo.model.user import UserBase
  17 +from wscacicneo.model.notify import Notify
  18 +from wscacicneo.model.notify import NotifyBase
  19 +
17 from liblightbase.lbbase.struct import Base 20 from liblightbase.lbbase.struct import Base
18 from liblightbase.lbutils import conv 21 from liblightbase.lbutils import conv
19 from liblightbase.lbrest.document import DocumentREST 22 from liblightbase.lbrest.document import DocumentREST
@@ -36,7 +39,7 @@ def blankmaster(request): @@ -36,7 +39,7 @@ def blankmaster(request):
36 39
37 @view_config(route_name='master', renderer='templates/master.pt') 40 @view_config(route_name='master', renderer='templates/master.pt')
38 def master(request): 41 def master(request):
39 - return {'project': 'WSCacicNeo'} 42 + return { }
40 43
41 @view_config(route_name='root') 44 @view_config(route_name='root')
42 def root(request): 45 def root(request):
@@ -46,9 +49,18 @@ def root(request): @@ -46,9 +49,18 @@ def root(request):
46 def home(request): 49 def home(request):
47 return {'project': 'WSCacicNeo'} 50 return {'project': 'WSCacicNeo'}
48 51
49 -@view_config(route_name='reports', renderer='templates/reports.pt') 52 +@view_config(route_name='list_notify', renderer='templates/list_notify.pt')
50 def reports(request): 53 def reports(request):
51 - return {'project': 'WSCacicNeo'} 54 + notify_obj = Notify(
  55 + orgao = 'deasdsd',
  56 + id_coleta = 'saudhasd',
  57 + notify = 'sadsad',
  58 + status = 'sadasd'
  59 + )
  60 + reg = notify_obj.search_list_notify()
  61 + doc = reg.results
  62 + print(doc,'aaaaaaaaaaaaaaa')
  63 + return {'doc': doc}
52 64
53 @view_config(route_name='gestao', renderer='templates/gestao.pt') 65 @view_config(route_name='gestao', renderer='templates/gestao.pt')
54 def gestao(request): 66 def gestao(request):
@@ -345,11 +357,6 @@ def edituser(request): @@ -345,11 +357,6 @@ def edituser(request):
345 'senha' : search.results[0].senha 357 'senha' : search.results[0].senha
346 } 358 }
347 359
348 -@view_config(route_name='post_notify')  
349 -def post_notify(request):  
350 - print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')  
351 - return { }  
352 -  
353 @view_config(route_name='put_user') 360 @view_config(route_name='put_user')
354 def put_user(request): 361 def put_user(request):
355 """ 362 """
@@ -517,4 +524,15 @@ def logout(request): @@ -517,4 +524,15 @@ def logout(request):
517 return HTTPFound(location = request.route_url('login'), 524 return HTTPFound(location = request.route_url('login'),
518 headers = headers) 525 headers = headers)
519 526
  527 +@view_config(route_name='post_notify')
  528 +def post_notify(request):
  529 + requests = request.params
  530 + notify_obj = Notify(
  531 + orgao = requests['orgao'],
  532 + id_coleta = requests['id_coleta'],
  533 + notify = requests['notify'],
  534 + status = requests['status']
  535 + )
  536 + results = notify_obj.create_notify()
  537 + return Response(str(results))
520 538