aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/templates/server/user_list.html21
-rw-r--r--server/views.py13
2 files changed, 33 insertions, 1 deletions
diff --git a/server/templates/server/user_list.html b/server/templates/server/user_list.html
index 22788e9..95e205c 100644
--- a/server/templates/server/user_list.html
+++ b/server/templates/server/user_list.html
@@ -34,6 +34,27 @@
{{user.first_name}} {{user.last_name}}
</div>
<div class="collapsible-body"><span>
+ <div id="modal{{user.id}}" class="modal">
+ <div class="modal-content">
+ <h4>Attenzione</h4>
+ <p>
+ Sei sicuro di volerlere riumuovere la persona {{user.first_name}} {{user.last_name}} dalla branca {{user.branca}}?<br>
+ Una volta rimossa dovrà essere riaggiunta dalla persona stessa o con un codice di trasferimento.
+ <br>
+ I dati dell'utente non verranno rimossi come anche i documenti.
+ </p>
+ </div>
+ <div class="modal-footer">
+ <a style="color:red" href="#!" class="modal-close waves-effect waves-green btn-flat">Annulla</a>
+ <a onclick="send('d{{user.id}}')" class="modal-close waves-effect waves-green btn-flat">Rimuovi</a>
+ </div>
+ </div>
+ <div class="hide-on-med-and-down">
+ <a class="waves-effect waves-light btn {{color}} modal-trigger" href="#modal{{user.id}}"><i class="material-icons left">remove_circle_outline</i>Rimuovi utente dalla branca</a>
+ </div>
+ <div style="margin-bottom: 0px;" class="hide-on-large-only row">
+ <a class="col s12 waves-effect waves-light btn {{color}} modal-trigger" href="#modal{{user.id}}"><i class="material-icons left">remove_circle_outline</i>Riumuovi utente dalla branca</a>
+ </div>
<ul class="collection">
<li class="collection-item">
<i class="material-icons left">confirmation_number</i>U{{user.code}}
diff --git a/server/views.py b/server/views.py
index 235c6e5..e264b68 100644
--- a/server/views.py
+++ b/server/views.py
@@ -375,8 +375,19 @@ def ulist(request):
groups = getGroups(request)
if request.method == "POST":
+ # request to remove uc from branca
+ if request.POST["action"][0] == 'd':
+ uc = UserCode.objects.get(id=request.POST["action"][1:])
+
+ # check if user has permission to remove usercode
+ if uc.branca not in groups:
+ return
+
+ uc.branca = None
+ uc.save()
+
# request to download document
- if request.POST["action"][0] == 'f':
+ elif request.POST["action"][0] == 'f':
document = Document.objects.get(id=request.POST["action"][1:])
# check if user has permission to view document
if document.group == groups[0]: