Commit b32bab3222670a536b3cf9ffdc81af121c9558ea
Exists in
master
Merge branch 'master' of https://github.com/lightbase/WSCacicNeo
Showing
7 changed files
with
94 additions
and
135 deletions
Show diff stats
wscacicneo/__init__.py
... | ... | @@ -52,6 +52,7 @@ def main(global_config, **settings): |
52 | 52 | cfg.add_route('delete_user', 'usuario/delete/{matricula}') |
53 | 53 | cfg.add_route('notify', 'lista/notificacoes') |
54 | 54 | cfg.add_route('post_notify', 'post_notify') |
55 | + cfg.add_route('list_notify', 'notificacoes/lista') | |
55 | 56 | # |
56 | 57 | cfg.add_route('list', 'list') |
57 | 58 | cfg.add_route('gestao', 'gestao') | ... | ... |
wscacicneo/model/notify.py
... | ... | @@ -133,7 +133,7 @@ class Notify(notify_base.metaclass): |
133 | 133 | Classe genérica de órgãos |
134 | 134 | """ |
135 | 135 | def __init__(self, **args): |
136 | - super(Orgao, self).__init__(**args) | |
136 | + super(Notify, self).__init__(**args) | |
137 | 137 | self.documentrest = notify_base.documentrest |
138 | 138 | |
139 | 139 | def notify_to_dict(self): | ... | ... |
... | ... | @@ -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 | 13 | <div class="navbar navbar-fixed-top bs-docs-nav" role="banner"> |
14 | 14 | |
15 | 15 | <div class="conjtainer"> |
16 | - | |
17 | 16 | <!-- Menu button for smallar screens --> |
18 | 17 | <div class="navbar-header"> |
19 | 18 | <button class="navbar-toggle btn-navbar" type="button" data-toggle="collapse" data-target=".bs-navbar-collapse"> |
20 | 19 | <span>Menu</span> |
21 | 20 | </button> |
22 | - | |
23 | 21 | <!-- Site name for smallar screens --> |
24 | 22 | <a href="index.html" class="navbar-brand hidden-lg">Super-Gerente</a> |
25 | 23 | </div> |
26 | - | |
27 | 24 | <!-- Navigation starts --> |
28 | 25 | <nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation"> |
29 | - | |
30 | 26 | <!-- Links --> |
31 | 27 | <ul class="nav navbar-nav pull-right"> |
32 | 28 | <li class="dropdown pull-right"> |
... | ... | @@ -40,7 +36,6 @@ |
40 | 36 | </ul> |
41 | 37 | </li> |
42 | 38 | </ul> |
43 | - | |
44 | 39 | <!-- Search form --> |
45 | 40 | <form class="navbar-form navbar-right" role="search"> |
46 | 41 | <div class="form-group"> |
... | ... | @@ -51,12 +46,10 @@ |
51 | 46 | |
52 | 47 | </div> |
53 | 48 | </div> |
54 | - | |
55 | 49 | <!-- Header starts --> |
56 | 50 | <header> |
57 | 51 | <div class="container"> |
58 | 52 | <div class="row"> |
59 | - | |
60 | 53 | <!-- Logo section --> |
61 | 54 | <div class="col-md-4"> |
62 | 55 | <!-- Logo. --> |
... | ... | @@ -64,125 +57,10 @@ |
64 | 57 | <h1><a href="${request.route_url('root')}home"><img src="${request.route_url('root')}static/caciclogo_transparent.png"> </a> |
65 | 58 | <a href="${request.route_url('root')}home">Super<span class="bold">Gerente</span></a></h1> |
66 | 59 | </div> |
67 | - | |
68 | 60 | <!-- Logo ends --> |
69 | 61 | </div> |
70 | - | |
71 | 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 | 63 | </div> |
180 | - </li> | |
181 | - </ul> | |
182 | - </li> | |
183 | - </ul> | |
184 | - </div> | |
185 | - </div> | |
186 | 64 | </div> |
187 | 65 | </header> |
188 | 66 | ... | ... |
wscacicneo/templates/menu.pt
... | ... | @@ -11,6 +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 | 15 | </ul> |
15 | 16 | <li class="has_sub"> |
16 | 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 | 34 | <metal:content fill-slot="javascript"> |
35 | 35 | <script type="text/javascript"> |
36 | 36 | $('#enviar').click(function(){ |
37 | - alert('asdasdasd') | |
38 | 37 | var data = { |
39 | 38 | 'orgao' : $('#orgao').val(), |
40 | 39 | 'id_coleta' : $('#id_coleta').val(), |
41 | 40 | 'notify' : $('#notify').val(), |
42 | - 'status' : True | |
43 | - } | |
41 | + 'status' : 'True' | |
42 | + }; | |
44 | 43 | $.ajax({ |
45 | 44 | type: "POST", |
46 | 45 | url: "${request.route_url('root')}post_notify", |
47 | 46 | data: data, |
48 | - success: function(){ alert('asdasdasd') }, | |
47 | + success: function(){ alert('22222222') }, | |
49 | 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 | 14 | from wscacicneo.model.orgao import OrgaoBase |
15 | 15 | from wscacicneo.model.user import User |
16 | 16 | from wscacicneo.model.user import UserBase |
17 | +from wscacicneo.model.notify import Notify | |
18 | +from wscacicneo.model.notify import NotifyBase | |
19 | + | |
17 | 20 | from liblightbase.lbbase.struct import Base |
18 | 21 | from liblightbase.lbutils import conv |
19 | 22 | from liblightbase.lbrest.document import DocumentREST |
... | ... | @@ -36,7 +39,7 @@ def blankmaster(request): |
36 | 39 | |
37 | 40 | @view_config(route_name='master', renderer='templates/master.pt') |
38 | 41 | def master(request): |
39 | - return {'project': 'WSCacicNeo'} | |
42 | + return { } | |
40 | 43 | |
41 | 44 | @view_config(route_name='root') |
42 | 45 | def root(request): |
... | ... | @@ -46,9 +49,18 @@ def root(request): |
46 | 49 | def home(request): |
47 | 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 | 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 | 65 | @view_config(route_name='gestao', renderer='templates/gestao.pt') |
54 | 66 | def gestao(request): |
... | ... | @@ -345,11 +357,6 @@ def edituser(request): |
345 | 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 | 360 | @view_config(route_name='put_user') |
354 | 361 | def put_user(request): |
355 | 362 | """ |
... | ... | @@ -517,4 +524,15 @@ def logout(request): |
517 | 524 | return HTTPFound(location = request.route_url('login'), |
518 | 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 | ... | ... |