diff --git a/areas/views.py b/areas/views.py index 9fbe650..95ea9ce 100644 --- a/areas/views.py +++ b/areas/views.py @@ -75,11 +75,21 @@ def area_neworder(request): tempuser = User.objects.get(pk=request.GET['userid']) neworderdata = json.loads(request.GET['finalod']) for ele in neworderdata: - prio = list(Prio.objects.filter(user__pk=request.GET['userid'], task__pk=ele['id']))[0] - task = Tasks.objects.get(pk=ele['id']) - if(task.agency == request.user.profile.agency): - prio.prio = ele['neworder'] - prio.save() + print(request.GET['userid']) + print(ele) + prio = Prio.objects.filter(user__pk=request.GET['userid'], task__pk=ele['id']) + # PRIO FOUND + if(len(prio) > 0): + task = Tasks.objects.get(pk=ele['id']) + if(task.agency == request.user.profile.agency): + prio[0].prio = ele['neworder'] + prio[0].save() + # NO PRIO FOUND - CREATE, SET NEW ORDER AND SAVE + else: + task = Tasks.objects.get(pk=ele['id']) + if(task.agency == request.user.profile.agency): + newprio = Prio(user=tempuser, task=Tasks.objects.get(pk=ele['id']), prio=ele['neworder']).save() + return HttpResponse("UPDATED") else: return HttpResponse("Request method is not a GET") \ No newline at end of file diff --git a/dasettings/templates/dasettings/agencynetwork_agmanagement_content.html b/dasettings/templates/dasettings/agencynetwork_agmanagement_content.html index 2b6ba2e..b4e2207 100644 --- a/dasettings/templates/dasettings/agencynetwork_agmanagement_content.html +++ b/dasettings/templates/dasettings/agencynetwork_agmanagement_content.html @@ -11,7 +11,7 @@
| Agenturname | +Rechte | +
|---|---|
| {{agn_s.name}} | ++ {% if agn_s in agn.adminagencys.all %}Administratives Mitglied + {% elif agn_s in agn.members.all %}Mitglied + {% elif agn_s in agn.sharemembers.all %}Inhalte teilen + {% endif %} + | +
| Agenturname | +Rechte | +
|---|---|
| {{agn_s.name}} | ++ {% if agn_s in agn.adminagencys.all %}Administratives Mitglied + {% elif agn_s in agn.members.all %}Mitglied + {% elif agn_s in agn.sharemembers.all %}Inhalte teilen + {% endif %} + | +
| {{agn_s.name}} | ++ {% if agn_s in agn.adminagencys.all %}Administratives Mitglied + {% elif agn_s in agn.members.all %}Mitglied + {% elif agn_s in agn.sharemembers.all %}Inhalte teilen + {% endif %} + | +
| {{agn_s.name}} | ++ {% if agn_s in agn.adminagencys.all %}Administratives Mitglied + {% elif agn_s in agn.members.all %}Mitglied + {% elif agn_s in agn.sharemembers.all %}Inhalte teilen + {% endif %} + | +
{{area.name}} |
+ {% endfor %}
+
|
+
+ {% if request.user.profile.agency.dynamicprofile %}
+
+ {% for task in tasks %}
+ {% isUserInAuth task area user_id as checkIsUserAuth %}
+ {% if task.area.pk == area.pk and task.visible and checkIsUserAuth %}
+
+
+
+ {% endif %}
+
+ {% endfor %}
+ {% else %}
+
+ {% for prio in prios %}
+ {% if prio.task.area.pk == area.pk and prio.task.visible %}
+
+ {% endif %}
+ {% endfor %}
+ {{task.name}}+ |
+ {% endif %}
+ {% endfor %}
+
{{area.name}} |
+ {% endfor %}
+
|
+
+ {% if request.user.profile.agency.dynamicprofile %}
+
+ {% for task in tasks %}
+
+ {% isUserInEx task area user_id as checkIsUserEx %}
+ {% if task.area.pk == area.pk and task.visible and checkIsUserEx %}
+
+
+
+ {% endif %}
+ {% endfor %}
+ {% else %}
+
+ {% for prio in prios %}
+ {% if prio.task.area.pk == area.pk and prio.task.visible %}
+
+ {% endif %}
+ {% endfor %}
+ {{task.name}}+ |
+ {% endif %}
+ {% endfor %}
+
{{area.name}} |
+ {% endfor %}
+
|
+
+ {% if request.user.profile.agency.dynamicprofile %}
+
+ {% for task in tasks %}
+ {% isUserInRep task area user_id as checkIsUserRep %}
+ {% if task.area.pk == area.pk and task.visible and checkIsUserRep %}
+
+
+
+ {% endif %}
+
+ {% endfor %}
+ {% else %}
+
+ {% for prio in prios %}
+ {% if prio.task.area.pk == area.pk and prio.task.visible %}
+
+ {% endif %}
+ {% endfor %}
+ {{task.name}}+ |
+ {% endif %}
+ {% endfor %}
+