Fehler im Organigramm behoben bzgl. Funktion

This commit is contained in:
holger.trampe 2020-03-09 10:11:13 +01:00
parent 195b20d930
commit 7220b8185b
3 changed files with 19 additions and 3 deletions

View File

@ -20,17 +20,24 @@
<script type="text/javascript"> <script type="text/javascript">
var data = [ var data = [
{ 'id' : '{{request.user.profile.agency.pk}}', 'parent' : "", 'role': "", 'name': '{{request.user.profile.agency.name}}', 'color': '#71AF17', "imageUrl": "", 'children' : []}, { 'id' : '{{request.user.profile.agency.pk}}', 'parent' : "", 'role': "", 'name': '{{request.user.profile.agency.name}}', 'color': '#71AF17', "imageUrl": "", 'children' : []},
{% for u in agencyuser %} {% for u in agencyuser %}
{% if u.profile.parent == u %} {% if u.profile.parent == u %}
{ 'id': '{{u.pk}}' , 'name': "{{u.first_name}} {{u.last_name}}",'role': '<b>{{u.profile.get_func_display}}</b></br >{{u.profile.compfunc}}', 'parent': "{{request.user.profile.agency.pk}}", 'color': '#1859B7', "imageUrl": "{{u.profile.get_photo_url}}", 'userid' : '{{u.pk}}', 'children' : [] },
{ 'id': '{{u.pk}}' , 'name': "{{u.first_name}} {{u.last_name}}",'role': '<b>{% if u.profile.func == None %} n.a. {% else %} {{u.profile.func}} {% endif %}</b></br >{{u.profile.compfunc}}', 'parent': "{{request.user.profile.agency.pk}}", 'color': '#1859B7', "imageUrl": "{{u.profile.get_photo_url}}", 'userid' : '{{u.pk}}', 'children' : [] },
{% else %} {% else %}
{ 'id': '{{u.pk}}', 'name': "{{u.first_name}} {{u.last_name}}", 'role': '<b>{{u.profile.get_func_display}}</b></br >{{u.profile.compfunc}}', 'parent': '{{u.profile.parent.pk}}', 'color': '#1859B7', "imageUrl": "{{u.profile.get_photo_url }}", 'userid' : '{{u.pk}}', 'children' : []}, { 'id': '{{u.pk}}', 'name': "{{u.first_name}} {{u.last_name}}", 'role': '<b>{% if u.profile.func == None %} n.a. {% else %} {{u.profile.func}} {% endif %}</b></br >{{u.profile.compfunc}}', 'parent': '{{u.profile.parent.pk}}', 'color': '#1859B7', "imageUrl": "{{u.profile.get_photo_url }}", 'userid' : '{{u.pk}}', 'children' : []},
{% endif %} {% endif %}
{% endfor %} {% endfor %}
]; ];
//Check for Agency and User-IDs - dont touch the userid for URLs! //Check for Agency and User-IDs - dont touch the userid for URLs!
for(i = 0; i < data.length; i++){ for(i = 0; i < data.length; i++){
for(k = 0; k < data.length; k++){ for(k = 0; k < data.length; k++){

View File

@ -4,6 +4,7 @@ from django.contrib.auth.models import User
from areas.models import Areas from areas.models import Areas
from users.priomodel import Prio from users.priomodel import Prio
from tasks.models import Tasks from tasks.models import Tasks
from users.models import AgencyJob
import webcolors import webcolors
@login_required @login_required
@ -24,6 +25,9 @@ def mainorga(request):
except: except:
pass pass
agjobs = AgencyJob.objects.filter(agency=request.user.profile.agency)
context = { context = {
'active_link' : 'orga', 'active_link' : 'orga',
'agencyuser' : agencyuser, 'agencyuser' : agencyuser,
@ -59,6 +63,11 @@ def singleorga(request, pk):
user_first_name = user.first_name user_first_name = user.first_name
user_last_name = user.last_name user_last_name = user.last_name
user_id = user.pk user_id = user.pk
try:
userfuncname = AgencyJob.objects.get(pk=user.profile.func.pk).name
except:
userfuncname = "Nicht vergeben"
context = { context = {
'active_link' : 'orga', 'active_link' : 'orga',
'areas' : areas, 'areas' : areas,
@ -67,7 +76,7 @@ def singleorga(request, pk):
'user_id' : user_id, 'user_id' : user_id,
'prios' : prios, 'prios' : prios,
'mail' : user.email, 'mail' : user.email,
'userfunc' : "CHANGE", 'userfunc' : userfuncname,
'imageurl' : user.profile.get_photo_url, 'imageurl' : user.profile.get_photo_url,
'compfunc' : user.profile.compfunc, 'compfunc' : user.profile.compfunc,
'phoneland' : user.profile.phoneland, 'phoneland' : user.profile.phoneland,