tr4ck3ur des JM2L 8 лет назад
Родитель
Сommit
27cf4dd24f
4 измененных файлов: 136 добавлений и 1 удалений
  1. +1
    -0
      jm2l/__init__.py
  2. +81
    -0
      jm2l/templates/Staff/compta.mako
  3. +1
    -0
      jm2l/templates/layout.mako
  4. +53
    -1
      jm2l/views.py

+ 1
- 0
jm2l/__init__.py Просмотреть файл

@@ -109,6 +109,7 @@ def main(global_config, **settings):
# HTML Routes - Staff
config.add_route('Live', '/Live')
config.add_route('list_expenses', '/Staff/compta')
config.add_route('list_task', '/Staff')
config.add_route('handle_pole', '/Staff/poles{sep:/*}{pole_id:(\d+)?}')
config.add_route('handle_task', '/Staff/tasks{sep:/*}{task_id:(\d+)?}')


+ 81
- 0
jm2l/templates/Staff/compta.mako Просмотреть файл

@@ -0,0 +1,81 @@
# -*- coding: utf-8 -*-
<%inherit file="jm2l:templates/layout.mako"/>
<%namespace name="helpers" file="jm2l:templates/helpers.mako"/>
<%namespace name="h" file="jm2l:templates/helpers.mako"/>
<%def name="jsAddOn()">
<script src="/js/jm2l.js"></script>
<script src="/vendor/ckeditor/ckeditor.js"></script>
<script src="/vendor/select2/js/select2.js"></script>
</%def>
<%def name="cssAddOn()">
<link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload.css">
<link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload-ui.css">
<link rel="stylesheet" href="/css/jm2l.css" />
<link rel="stylesheet" href="/vendor/select2/css/select2.css" type="text/css" media="screen" />
<!-- CSS adjustments for browsers with JavaScript disabled -->
<noscript><link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload-noscript.css"></noscript>
<noscript><link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload-ui-noscript.css"></noscript>
</%def>

<div class="row-fluid">
<div class="span10 offset1">

<h3>Liste des justificatifs</h3>

<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th colspan="3" style="text-align:center;">
Liste des Frais
</th>
</tr>
<tr>
<th style="text-align:center;">
Nom
</th>
<th style="text-align:center;">
Justificatif
</th>
<th style="text-align:center;">
RIB
</th>
</tr>
</thead>
<tbody>
% if len(found)==0:
<tr>
<td colspan="3" style="text-align:center;">
<i>Aucun justificatif trouvé</i>
</td>
</tr>
% endif
% for item, one_dic in found.iteritems():
<tr>
<td>
<a href="/user/${item}">
<span class="name">${one_dic["User"]["prenom"]} ${one_dic["User"]["nom"]}</span>
</a>
</td>
% if one_dic.has_key("Justif"):
<td style="text-align:center;">
${h.uploader("Justif", one_dic["User"]["uid"], "Justif")}
</td>
% else:
<td><i>Rien</i></td>
% endif
</tr>
<tr>
% if one_dic.has_key("RIB"):
<td style="text-align:center;">
${h.uploader("RIB", one_dic["User"]["uid"], "RIB")}
</td>
% else:
<td><i>Rien</i></td>
% endif
</tr>
% endfor
</tbody>
</table>

</div>
</div>

+ 1
- 0
jm2l/templates/layout.mako Просмотреть файл

@@ -134,6 +134,7 @@ ${helpers.uploader_js()}
<li><a href="/ListSalles">Gérer les salles</a></li>
<li><a href="/entities">Gérer les entités</a></li>
<li><a href="/ListOrga">Participations à l'orga</a></li>
<li><a href="/Staff/compta">Comptabilité</a></li>
<li role="separator" class="divider"></li>
% endif
<li><a href="/MesJM2L">Mon profil</a></li>


+ 53
- 1
jm2l/views.py Просмотреть файл

@@ -25,7 +25,8 @@ import unicodedata
import datetime
import re
import shutil

import glob
CurrentYear = 2015

## =-=- Here, We keep some usefull function -=-=
@@ -459,6 +460,57 @@ def list_view(request):
DicTask[grp] = tasks
return {'tasks': DicTask }


@view_config(route_name='list_expenses', renderer='jm2l:templates/Staff/compta.mako')
def expenses(request):
if request.user is None:
# Don't answer to users that aren't logged
raise HTTPForbidden(u'Vous devez vous identifier pour obtenir une réponse.')
if not request.user.Staff:
# Don't answer to users that aren't logged
raise HTTPForbidden(u'Vous n\'avez pas l\'autorité suffisante pour effectuer cette action.')

output = []
dic_out = {}
for name in glob.glob('jm2l/upload/images/users/*/RIB/*'):
tab_path = name.split('/')
if tab_path[6]=='thumbnails' or tab_path[6].endswith('.type'):
continue
if dic_out.get(tab_path[4]) is None:
dic_out[tab_path[4]] = {}
if dic_out[tab_path[4]].get('RIB') is None:
dic_out[tab_path[4]]['RIB'] = {'files':[], 'thumb':[]}
u = User.by_slug(tab_path[4])
dic_out[tab_path[4]]['User'] = {
'uid':u.uid,
'nom':u.nom,
'prenom':u.prenom,
'slug':u.slug
}
dic_out[tab_path[4]]['RIB']['files'].append( name )
dic_out[tab_path[4]]['RIB']['thumb'].append( name + ".jpg" )

for name in glob.glob('jm2l/upload/images/users/*/Justif/*'):
tab_path = name.split('/')
if tab_path[6]=='thumbnails' or tab_path[6].endswith('.type'):
continue
if dic_out.get(tab_path[4]) is None:
dic_out[tab_path[4]] = {}
if dic_out[tab_path[4]].get('Justif') is None:
dic_out[tab_path[4]]['Justif'] = {'files':[], 'thumb':[]}
u = User.by_slug(tab_path[4])
dic_out[tab_path[4]]['User'] = {
'uid':u.uid,
'nom':u.nom,
'prenom':u.prenom,
'slug':u.slug
}
dic_out[tab_path[4]]['Justif']['files'].append( name )
dic_out[tab_path[4]]['Justif']['thumb'].append( name + ".jpg" )

return dict(found=dic_out)


@view_config(route_name='handle_task', renderer='jm2l:templates/Staff/tasks.mako')
def tasks(request):
if request.user is None:


Загрузка…
Отмена
Сохранить