diff --git a/dasettings/templates/dasettings/agency_content.html b/dasettings/templates/dasettings/agency_content.html index 9784143..584dccc 100644 --- a/dasettings/templates/dasettings/agency_content.html +++ b/dasettings/templates/dasettings/agency_content.html @@ -15,7 +15,7 @@
|
- {% if request.user.profile.agency.dynamicprofile == False %}
+ {% if request.user.profile.agency.dynamicprofile %}
- {% for ex in executor %}
- {% if ex.area == area %}
-
-
-
+ {% for task in tasks %}
+ {% isUserInAuth task area request.user as checkIsUserAuth %}
+ {% if task.area.pk == area.pk and task.visible and checkIsUserAuth %}
+ {{ex.task.name}}-
+
{% endif %}
- {% endfor %}
- {% for auth in authority %}
- {% if auth.area == area %}
-
+ {% isUserInEx task area request.user as checkIsUserEx %}
+ {% if task.area.pk == area.pk and task.visible and checkIsUserEx %}
+ {{task.name}}+
+
{% endif %}
- {% endfor %}
- {% for rep in representative %}
- {% if rep.area == area %}
-
-
+ {% isUserInRep task area request.user as checkIsUserRep %}
+ {% if task.area.pk == area.pk and task.visible and checkIsUserRep %}
+ {{task.name}}+
+
{% endif %}
- {% endfor %}
- {{task.name}}+ |
- {% else %}
+
+ {% endfor %}
+ {% else %}
{% for prio in prios %}
{% if prio.task.area.pk == area.pk and prio.task.visible %}
@@ -197,19 +203,29 @@ $( document ).ready(function() {
$( "#sortarea_" + sortablearea_ids[i]).sortable("disable");
}
+
+ //AUTH
$(document).find(".view_0").hide();
+ //EX
$(document).find(".view_1").hide();
+ //REP
$(document).find(".view_2").hide();
- $(document).find(".view_2").show();
+ $(document).find(".view_0").show();
+
});
function changeView(newview){
+
$(document).find(".view_0").hide();
$(document).find(".view_1").hide();
$(document).find(".view_2").hide();
$(document).find(".view_" + newview).show();
-
+
+ $(document).find("#view_info_0").hide();
+ $(document).find("#view_info_1").hide();
+ $(document).find("#view_info_2").hide();
+ $(document).find("#view_info_" + newview).show();
}
diff --git a/orga/views.py b/orga/views.py
index 538a617..39f613c 100644
--- a/orga/views.py
+++ b/orga/views.py
@@ -55,6 +55,20 @@ def singleorga(request, pk):
if(user.profile.agency.pk==request.user.profile.agency.pk):
prios = Prio.objects.filter(user__pk=pk).order_by('prio')
areas = list(Areas.objects.filter(agency__pk=request.user.profile.agency.pk).order_by('areaorder'))
+ alltasks = Tasks.objects.filter(agency__pk=request.user.profile.agency.pk).order_by('name')
+
+ '''
+ Hier werden die Tasks entsprechend ihrer Prio gespeichert, anschließend werden noch die übrigen Tasks übertragen, die noch keinen Prio-Eintrag haben. Diese haben 0 und landen dementsprechend hinten.
+ '''
+
+ tasks = []
+ for p in prios:
+ tasks.append(p.task)
+
+ for at in alltasks:
+ if at not in tasks:
+ tasks.append(at)
+
i = 0
for area in areas:
areas[i].hex = areas[i].color
@@ -69,22 +83,6 @@ def singleorga(request, pk):
except:
userfuncname = "Nicht vergeben"
- st = Standards.objects.filter(agency=request.user.profile.agency)
-
- representative = []
- executor = []
- authority = []
-
- for s in st:
- if request.user in s.representative.all():
- representative.append(s)
-
- if request.user in s.executor.all():
- executor.append(s)
-
- if request.user in s.authority.all():
- authority.append(s)
-
context = {
'active_link' : 'orga',
@@ -98,9 +96,10 @@ def singleorga(request, pk):
'imageurl' : user.profile.get_photo_url,
'compfunc' : user.profile.compfunc,
'phoneland' : user.profile.phoneland,
- 'representative' : representative,
- 'executor' : executor,
- 'authority' : authority,
+ 'tasks' : tasks,
+ #'representative' : representative,
+ #'executor' : executor,
+ #'authority' : authority,
'phonemobile' : user.profile.phonemobile
}
print(context)
diff --git a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc
index c786c9b..59ca8c1 100644
Binary files a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc and b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc differ
diff --git a/standards/templatetags/counter_tag.py b/standards/templatetags/counter_tag.py
index 08f0103..a341a8d 100644
--- a/standards/templatetags/counter_tag.py
+++ b/standards/templatetags/counter_tag.py
@@ -215,3 +215,47 @@ def getifuserdidcomment(standard, user):
didcomment = True
return didcomment
+
+
+@register.simple_tag
+def isUserInAuth(task, area, user):
+ st_auth = Standards.objects.filter(agency=user.profile.agency, task=task, area=area)
+
+ found = False
+
+ for st in st_auth:
+ if user in st.authority.all():
+ found = True
+ print("AUTH FOUND")
+ break
+
+ return found
+
+@register.simple_tag
+def isUserInEx(task, area, user):
+ st_auth = Standards.objects.filter(agency=user.profile.agency, task=task, area=area)
+
+ found = False
+
+ for st in st_auth:
+ if user in st.executor.all():
+ found = True
+ print("EX FOUND")
+ break
+
+ return found
+
+
+@register.simple_tag
+def isUserInRep(task, area, user):
+ st_auth = Standards.objects.filter(agency=user.profile.agency, task=task, area=area)
+
+ found = False
+
+ for st in st_auth:
+ if user in st.representative.all():
+ found = True
+ print("REP FOUND")
+ break
+
+ return found
\ No newline at end of file
diff --git a/users/usersforms.py b/users/usersforms.py
index 26f7f4b..e7c8fd1 100644
--- a/users/usersforms.py
+++ b/users/usersforms.py
@@ -78,9 +78,10 @@ class AgencyUpdateForm(forms.ModelForm):
"city" : "Stadt",
"agency_email" : "E-Mail",
"phone" : "Telefon",
+ "dynamicprofile" : "Dynamischer Steckbrief",
"agencypic" : "Agenturbild"
}
- fields = ['name','inhaber','agency_email', 'phone', 'street', 'plz', 'city', 'agencypic', 'x', 'y', 'width', 'height', 'rotation']
+ fields = ['name','inhaber','agency_email', 'phone', 'street', 'plz', 'city', 'dynamicprofile', 'agencypic', 'x', 'y', 'width', 'height', 'rotation']
def save(self):
photo = super(AgencyUpdateForm, self).save()