瀏覽代碼

inizio modifiche ordinamento utenti

mauro 9 月之前
父節點
當前提交
a4e0ca4d92
共有 3 個文件被更改,包括 24 次插入6 次删除
  1. 1 1
      documento/urls.py
  2. 6 5
      utente/templates/utente.welcome.html
  3. 17 0
      utente/views.py

+ 1 - 1
documento/urls.py

@@ -3,7 +3,7 @@ from . import views
 
 app_name='documento'
 urlpatterns = [
-  path('welcome/',views.welcome,name='welcome'),
+  path('welcome',views.welcome,name='welcome'),
   path('welcome/<int:utente>',views.welcome,name='welcome'),
   path('finalize/<int:did>',views.finalize_download,name='finalize'),
   path('finalize/<int:did>/<int:uid>',views.finalize_download,name='finalize'),

+ 6 - 5
utente/templates/utente.welcome.html

@@ -12,7 +12,8 @@ function toggle(source) {
 {% endblock %}
 
 {% block body %}
-  <form name="inputUtente" method="POST">
+  <form name="inputDocumenti" method="POST">
+  {% csrf_token %}
   <div class='form-control'>
     {% if "UTENTE.CREA" in permesso %}
     <button type='submit' class="btn btn-primary" name='scelta' value='Nuovo Dipendente'>Nuovo Dipendente</button>
@@ -25,13 +26,14 @@ function toggle(source) {
     Numero di dipendenti selezionati {{ numeroRecordAttuali }} su un totale di {{ numeroRecordAzienda }}.
   </div>
 
-  {% csrf_token %}
   <table class='table table-striped table-hover'>
     <thead class='thead-dark'>
       <tr>
         {% if "UTENTE.CREA" in permesso %}<th scope='col'>*</th>{% endif %}
-        <th scope='col'>Nome</th>
-        <th scope='col'>Codice Fiscale</th>
+        <th scope='col'>Dipendente&nbsp;<button name='utDW' type="submit" class="btn btn-outline-primary btn-sm">&#x2193;</button>
+                                        <button name='utUP' type="submit" class="btn btn-outline-primary btn-sm">&#x2191;</button></th>
+        <th scope='col'>CF&nbsp;<button name='cfDW' type="submit" class="btn btn-outline-primary btn-sm">&#x2193;</button>
+                                <button name="cfUP" type="submit" class="btn btn-outline-primary btn-sm">&#x2191;</button></th>
         <th scope='col'>Sede</th>
         <th scope='col'>Data di Nascita</th>
 	<th scope='col'>Luogo di Nascita</th>
@@ -49,7 +51,6 @@ function toggle(source) {
       </tr>
     </thead>
     <tbody>
-      {% csrf_token %}
       {% for uu in utenti %}
         <tr>
           {% if "UTENTE.EDIT" in permesso %}

+ 17 - 0
utente/views.py

@@ -18,6 +18,23 @@ import re
 import csv
 from io import StringIO
 
+def OrdinaUtenti(rq=None,ou=[]):
+  if rq.method == "POST" and 'utUP' in rq.POST:
+    print('utUP')
+    rq.session['docOrder'] = 'utUP'
+    
+  if request.method == "POST" and 'uteDW' in rq.POST:
+    print('utDW')
+    rq.session['docOrder'] = 'utDW'
+    
+  if 'docOrder' in request.session and 'uteDW' in request.session.get('docOrder'):
+    tmp = sorted(tmp, key = lambda x: x.utente.nome,reverse=False)
+  if 'docOrder' in request.session and 'uteUP' in request.session.get('docOrder'):
+    tmp = sorted(tmp, key = lambda x: x.utente.nome,reverse=True)
+
+  return tmp    
+
+ 
 def welcome(request):
   if not 'AdminId' in request.session or 'UserId' in request.session:
     print("Non rilevo presensa UserId e AdminId in request.session")