Dynamischer Steckbrief fertig

This commit is contained in:
holger.trampe 2020-04-24 02:20:24 +02:00
parent dcd8613ee4
commit 119a6b3425
9 changed files with 120 additions and 62 deletions

View File

@ -15,7 +15,7 @@
<div class="row">
<div class="col-3">
{% for formfield in agencyform %}
{% if forloop.counter|divisibleby:5 %}
{% if forloop.counter|divisibleby:6 %}
</div>
<div class="col-3">
{{formfield|as_crispy_field}}

View File

@ -14,33 +14,31 @@ import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
############################################## PROD #####################################
BASE_URL = "https://digitale-agentur.com/"
############################################## DEV #####################################
BASE_URL = "https://dev01.digitale-agentur.com/"
CRONAPIKEY = "gCddsaz6NOnE9QbXZM5LasdEk122D"
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG = True
# MAIL PROD
# MAIL DEV
EMAIL_HOST = 'smtp.strato.de'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = "support@digitale-agentur.com"
EMAIL_HOST_PASSWORD = "aPx9m3!7x3m@8o!t"
DEFAULT_FROM_EMAIL = "support@digitale-agentur.com"
EMAIL_HOST_USER = "support@dev01.digitale-agentur.com"
EMAIL_HOST_PASSWORD = "support@dev01.digitale-agentur.com"
DEFAULT_FROM_EMAIL = "support@dev01.digitale-agentur.com"
# PROD
# DEV
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME' : 'digitaleagentur',
'USER' : 'digitaleagentur',
'PASSWORD' : 'H9hzbzyBqtUCnZlIwL1qSrzh',
'NAME' : 'digitaleagentur_dev01',
'USER' : 'digitaleagentur_dev01',
'PASSWORD' : 't3TvtGAOkFHYXdJlUMIu9u3U',
'PORT' : 3306
}
}
############################################## PROD #####################################
############################################## DEV #####################################
# Nach zehn Stunden läuft der Cookie ab!

View File

@ -6,13 +6,13 @@
<link href="{% static 'users/css/jsLists.css' %}" rel="stylesheet">
<div class="content-section">
<h3>Bereiche und Aufgaben von {{user_first_name}} {{user_last_name}}<span style="float: right">
<h3>Bereiche und Tätigkeiten von {{user_first_name}} {{user_last_name}}<span style="float: right">
{% if user|usergperm:"usermanager" %}
<button type="button" id="activatechangingorder" style="float: right" class="btn btn-secondary btn-sm" onclick="javascript:activateChangeTaskOrder()" data-toggle="tooltip" data-placement="top" title="Reihenfolge der Tätigkeiten anpassen"><small><i class="fas fa-pen"></i></small></button>
<button type="button" id="changingorder" style="float: right; display: none" class="btn btn-primary btn-sm" onclick="javascript:activateChangeTaskOrder()" data-toggle="tooltip" data-placement="top" title="Reihenfolge der Tätigkeiten anpassen"><small><i class="fas fa-check"></i></small></button>
<span style="float: right;">
{% if request.user.profile.agency.dynamicprofile == False %}
{% if request.user.profile.agency.dynamicprofile %}
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle btn-sm mr-1" type="button" id="changeViewDynamic" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Ansicht wechseln
@ -65,6 +65,15 @@
</div>
</div>
<hr>
<h4 class="ml-4">{{ user_first_name }} {{ user_last_name }}
{% if request.user.profile.agency.dynamicprofile %}
als <span id="view_info_0">Verantwortlicher</span>
<span id="view_info_1" style="display: none;">Ausführender</span>
<span id="view_info_2" style="display: none;">Vertreter</span>
{% endif %}
</h4>
<table class="table" id="orgasingle">
<thead>
<tr >
@ -78,34 +87,31 @@
{% for area in areas %}
<td class="text-center" style="background-color: rgba({{area.color.0}},{{area.color.1}},{{area.color.2}}, 0.3)">
<div class="areaCollapseContent" id="sortarea_{{area.pk}}">
{% if request.user.profile.agency.dynamicprofile == False %}
{% if request.user.profile.agency.dynamicprofile %}
{% for ex in executor %}
{% if ex.area == area %}
<div style="background-color: rgba({{area.color.0}},{{area.color.1}},{{area.color.2}}, 1)" class="mb-2 pt-3 pb-1 view_0" id="ele_{{ex.task.pk}}">
<span ><h6 ><a style=" color: #FFFFFF;"href="{% url 'standard-task' ex.task.pk %}"><span class="arrows_area_{{area.pk}} ml-4" style="display:none; float: left;"><i class="fas fa-sort"></i></span>{{ex.task.name}}</a></h6></span>
{% for task in tasks %}
{% isUserInAuth task area request.user as checkIsUserAuth %}
{% if task.area.pk == area.pk and task.visible and checkIsUserAuth %}
<div style="background-color: rgba({{area.color.0}},{{area.color.1}},{{area.color.2}}, 1)" class="mb-2 pt-3 pb-1 view_0" id="ele_{{task.pk}}">
<span ><h6 ><a style=" color: #FFFFFF;"href="{% url 'standard-task' task.pk %}"><span class="arrows_area_{{area.pk}} ml-4" style="display:none; float: left;"><i class="fas fa-sort"></i></span>{{task.name}}</a></h6></span>
</div>
{% endif %}
{% endfor %}
{% for auth in authority %}
{% if auth.area == area %}
<div style=" background-color: rgba({{area.color.0}},{{area.color.1}},{{area.color.2}}, 1)" class="mb-2 pt-3 pb-1 view_1 " id="ele_{{auth.task.pk}}">
<span ><h6 ><a style=" color: #FFFFFF;"href="{% url 'standard-task' auth.task.pk %}"><span class="arrows_area_{{area.pk}} ml-4" style="display:none; float: left;"><i class="fas fa-sort"></i></span>{{auth.task.name}}</a></h6></span>
{% isUserInEx task area request.user as checkIsUserEx %}
{% if task.area.pk == area.pk and task.visible and checkIsUserEx %}
<div style="background-color: rgba({{area.color.0}},{{area.color.1}},{{area.color.2}}, 1)" class="mb-2 pt-3 pb-1 view_1" id="ele_{{task.pk}}">
<span ><h6 ><a style=" color: #FFFFFF;"href="{% url 'standard-task' task.pk %}"><span class="arrows_area_{{area.pk}} ml-4" style="display:none; float: left;"><i class="fas fa-sort"></i></span>{{task.name}}</a></h6></span>
</div>
{% endif %}
{% endfor %}
{% for rep in representative %}
{% if rep.area == area %}
<div style="background-color: rgba({{area.color.0}},{{area.color.1}},{{area.color.2}}, 1)" class="mb-2 pt-3 pb-1 view_2 " id="ele_{{rep.task.pk}}">
<span ><h6 ><a style=" color: #FFFFFF;"href="{% url 'standard-task' rep.task.pk %}"><span class="arrows_area_{{area.pk}} ml-4" style="display:none; float: left;"><i class="fas fa-sort"></i></span>{{rep.task.name}}</a></h6></span>
{% isUserInRep task area request.user as checkIsUserRep %}
{% if task.area.pk == area.pk and task.visible and checkIsUserRep %}
<div style="background-color: rgba({{area.color.0}},{{area.color.1}},{{area.color.2}}, 1)" class="mb-2 pt-3 pb-1 view_2" id="ele_{{task.pk}}">
<span ><h6 ><a style=" color: #FFFFFF;"href="{% url 'standard-task' task.pk %}"><span class="arrows_area_{{area.pk}} ml-4" style="display:none; float: left;"><i class="fas fa-sort"></i></span>{{task.name}}</a></h6></span>
</div>
{% endif %}
{% endfor %}
</div>
</td>
{% else %}
{% for prio in prios %}
@ -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();
}
</script>

View File

@ -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)

View File

@ -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

View File

@ -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()