@@ -99,6 +103,16 @@ new Chart(document.getElementById("all_stats"),{
"borderColor":"#FA746A",
"lineTension":0.1
},
+ {"label":"MRR",
+ "data":[
+ {% for ele in statistik %}
+ {{ele.mrr|stringformat:".2f"}},
+ {% endfor %}
+ ],
+ "fill":false,
+ "borderColor":"#FA746A",
+ "lineTension":0.1
+ },
{"label":"Chatnachrichten",
"data":[
{% for ele in statistik %}
diff --git a/adm/templatetags/__pycache__/adm_tags.cpython-38.pyc b/adm/templatetags/__pycache__/adm_tags.cpython-38.pyc
index 998ecd8..2f3a5ee 100644
Binary files a/adm/templatetags/__pycache__/adm_tags.cpython-38.pyc and b/adm/templatetags/__pycache__/adm_tags.cpython-38.pyc differ
diff --git a/adm/templatetags/adm_tags.py b/adm/templatetags/adm_tags.py
index 785c7ca..25bc2b8 100644
--- a/adm/templatetags/adm_tags.py
+++ b/adm/templatetags/adm_tags.py
@@ -70,6 +70,25 @@ def loadBillValue(bill):
return returnvalue
+'''
+
+ Hier wird der aktuelle Umsatz berechnet anhand Abos und Mitarbeiterzahlen
+
+'''
+@register.simple_tag
+def getMRR():
+ # Berechnung das MRR
+ finalmrr = 0
+ allag_withabo = Agency.objects.filter(paymentplan=1)
+ abos = len(allag_withabo) * 21
+ extrausercount = 0
+ for ag in allag_withabo:
+ user_ag = User.objects.filter(profile__agency=ag)
+ if len(user_ag) > 3:
+ extrausercount += len(user_ag) - 3
+ finalmrr = abos + 3*extrausercount
+
+ return finalmrr
diff --git a/adm/views.py b/adm/views.py
index c8218ca..11ff67d 100644
--- a/adm/views.py
+++ b/adm/views.py
@@ -503,7 +503,19 @@ def statisticCronJob(request, code):
nm = MainSalesMonth(value=monthvalue, salesmonthdate=lastmonth)
nm.save()
- newMainS = MainStatistic(agencys=agencycount,users=usercount,standards=standardcount,chatmessages=chatmesscount, active_abos=abocount, absenceobjects=absenceobjects, user_active_timemanagement=user_active_timemanagement, organizerobjects=organizerobjects, agency_recoverobjects=agency_recoverobjects, allfiles=allfiles, allfiles_storage=allfiles_storage, logins=logins)
+
+ # Monatlicher MRR
+ finalrma = 0
+ allag_withabo = Agency.objects.filter(paymentplan=1)
+ abos = len(allag_withabo) * 21
+ extrausercount = 0
+ for ag in allag_withabo:
+ user_ag = User.objects.filter(profile__agency=ag)
+ if len(user_ag) > 3:
+ extrausercount += len(user_ag) - 3
+ finalmrr = abos + 3*extrausercount
+
+ newMainS = MainStatistic(agencys=agencycount,users=usercount,standards=standardcount,chatmessages=chatmesscount, active_abos=abocount, absenceobjects=absenceobjects, user_active_timemanagement=user_active_timemanagement, organizerobjects=organizerobjects, agency_recoverobjects=agency_recoverobjects, allfiles=allfiles, allfiles_storage=allfiles_storage, logins=logins, mrr=finalmrr)
newMainS.save()
data.update({"status" : "success"})
else:
diff --git a/dasettings/forms.py b/dasettings/forms.py
index 688d3e4..2f47f1c 100644
--- a/dasettings/forms.py
+++ b/dasettings/forms.py
@@ -22,7 +22,7 @@ class AgencyNetworkForm(forms.ModelForm):
fields = ['name', 'publicjoin']
labels = {
- "name" : "Name des Agentuverbunds",
+ "name" : "Name des Agenturverbunds",
"publicjoin" : "Beitritt ohne Bestätigung"
}
diff --git a/digitaleagentur/__pycache__/settings.cpython-38.pyc b/digitaleagentur/__pycache__/settings.cpython-38.pyc
index ca650f7..26b5111 100644
Binary files a/digitaleagentur/__pycache__/settings.cpython-38.pyc and b/digitaleagentur/__pycache__/settings.cpython-38.pyc differ
diff --git a/dump.rdb b/dump.rdb
index a6311c9..c660362 100644
Binary files a/dump.rdb and b/dump.rdb differ
diff --git a/standards/templates/standards/standards_add.html b/standards/templates/standards/standards_add.html
index 306d3dc..96991a3 100644
--- a/standards/templates/standards/standards_add.html
+++ b/standards/templates/standards/standards_add.html
@@ -243,10 +243,12 @@
- Wenn ein Standard erstellt/bearbeitet wurde, kann er nur von einer Person mit dem Recht Standards bearbeiten und freischalten veröffentlicht werden.
+
+ {% if perms.users.standardgopublic %}
+ {{ normalForm.public }} Veröffentlichen
+ {% else %}
+ Wenn ein Standard erstellt/bearbeitet wurde, kann er nur von einer Person mit dem Recht Standards freischalten veröffentlicht werden.
- {% if perms.users.standardmanager %}
- {{ normalForm.public }} Veröffentlichen
{% endif %}
diff --git a/standards/templates/standards/standards_management.html b/standards/templates/standards/standards_management.html
index b00fb7e..1b98504 100644
--- a/standards/templates/standards/standards_management.html
+++ b/standards/templates/standards/standards_management.html
@@ -137,7 +137,7 @@
- {% if perms.users.standardmanager %}
+ {% if perms.users.standardgopublic %}
{% if standard.public %}
Veröffentlichung aufheben
{% else %}
@@ -148,9 +148,9 @@
{% endif %}
{% if standard.created_standard_by == request.user or perms.users.standardmanager %}
Bearbeiten
- {% endif %}
Löschen
+ {% endif %}
diff --git a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc
index a57cd5d..40e7208 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 dea2901..2d3af8f 100644
--- a/standards/templatetags/counter_tag.py
+++ b/standards/templatetags/counter_tag.py
@@ -64,11 +64,25 @@ def getbool():
global groupbool
return groupbool
-
+# Zähler ungelesener Nachrichten
@register.simple_tag
def getmesscounter(user):
return len(Message.objects.filter(target_user=user))
+# Zähler unveröffentlichter Standards
+@register.simple_tag
+def getUnpubStandards(user):
+ unpubstandards = 0
+ if user.has_perm("users.standardgopublic"):
+ unpubstandards = len(Standards.objects.filter(agency=user.profile.agency, public=False))
+
+ return unpubstandards
+
+@register.simple_tag
+def getAbsenceAsks(user):
+ unconfirmedab = len(Absence.objects.filter(agency=user.profile.agency, confirm_status=1))
+ return unconfirmedab
+
# WORKDAY HISTORY
# TASK: Hier flag prüfen, ob der User selbst den Tag bearbeitet hat - aktuell werden nur fremde Änderugnen angezeigt
@register.simple_tag
@@ -291,6 +305,16 @@ def getifuserdidcomment(standard, user):
return didcomment
+'''
+
+ Hier wird der dynamische Steckbrief generiert. Es wird geprüft, ob Nutzer in Standards verlinkt sind bzw. in Gruppen
+
+
+representative_group = models.ManyToManyField(AgencyGroup, blank=True, related_name="group_rep")
+executor_group = models.ManyToManyField(AgencyGroup, blank=True, related_name="group_ex")
+authority_group = models.ManyToManyField(AgencyGroup, blank=True, related_name="group_aut")
+
+'''
@register.simple_tag
def isUserInAuth(task, area, user_id):
@@ -300,10 +324,19 @@ def isUserInAuth(task, area, user_id):
#st_auth = Standards.objects.filter(agency=user.profile.agency, task=task, area=area)
st_auth = Standards.objects.filter(agency=user.profile.agency, task=task, area=area, authority__in=[user])
found = False
-
+ user_to_check = User.objects.get(pk=user_id)
if len(st_auth) > 0:
found = True
+ # Wenn der User noch nicht gefunden wurde, werden die Gruppen der Standards durchgearbeitet
+ if found == False:
+ standards_to_check = Standards.objects.filter(agency=user.profile.agency, task=task, area=area)
+ for s in standards_to_check:
+ for group in s.authority_group.all():
+ if user.groups.filter(name = group.group.name).exists():
+ found = True
+
+
return found
@register.simple_tag
@@ -320,6 +353,14 @@ def isUserInEx(task, area, user_id):
if len(st_auth) > 0:
found = True
+ # Wenn der User noch nicht gefunden wurde, werden die Gruppen der Standards durchgearbeitet
+ if found == False:
+ standards_to_check = Standards.objects.filter(agency=user.profile.agency, task=task, area=area)
+ for s in standards_to_check:
+ for group in s.executor_group.all():
+ if user.groups.filter(name = group.group.name).exists():
+ found = True
+
return found
@@ -335,6 +376,14 @@ def isUserInRep(task, area, user_id):
if len(st_auth) > 0:
found = True
+ # Wenn der User noch nicht gefunden wurde, werden die Gruppen der Standards durchgearbeitet
+ if found == False:
+ standards_to_check = Standards.objects.filter(agency=user.profile.agency, task=task, area=area)
+ for s in standards_to_check:
+ for group in s.representative_group.all():
+ if user.groups.filter(name = group.group.name).exists():
+ found = True
+
return found
# REALTIME
@@ -1051,13 +1100,8 @@ def getTrialDays(agency):
return finaldays
-
-
-
-
-
-
-
-
+@register.simple_tag
+def getAbsenceLastHistory(absence):
+ return absence.history.first()
diff --git a/timemanagement/models.py b/timemanagement/models.py
index 0a85135..8abc698 100644
--- a/timemanagement/models.py
+++ b/timemanagement/models.py
@@ -16,6 +16,8 @@ class Workday(models.Model):
end = models.DateTimeField(default=None, null=True, blank=True)
target = models.FloatField(default=8.0)
freefield = models.TextField(max_length=10000, default="", blank=True)
+ lastManualChangeUser = models.ForeignKey(User, on_delete=models.CASCADE, blank=True, null=True, default=None, related_name="manuelChangeUser")
+ lastManualChangeDate = models.DateTimeField(default=None, null=True, blank=True)
history = HistoricalRecords()
class Breaks(models.Model):
diff --git a/timemanagement/templates/timemanagement/timemanagement_management.html b/timemanagement/templates/timemanagement/timemanagement_management.html
index cf23714..ac9f13e 100644
--- a/timemanagement/templates/timemanagement/timemanagement_management.html
+++ b/timemanagement/templates/timemanagement/timemanagement_management.html
@@ -9,7 +9,7 @@
-{% if user|usergperm:"absencemanager" %}
+{% if user|usergperm:"timemanager" %}
{% if user.usertime.usetime == True %}
@@ -282,11 +282,14 @@ $('#absencetabs a').on('click', function (e) {
beforeSend: function(){
$("#confirm-delete_{{workday.pk}}").modal("toggle");
},
- success: function( data )
+ success: function(data)
{
$('#confirm-delete_{{workday.pk}}').on('hidden.bs.modal', function (e) {
$("#errorDelWorkday").modal("toggle");
});
+ },
+ error: function(xhr){
+ location.href = location.href;
}
});
});
diff --git a/timemanagement/templates/timemanagement/timemanagement_singleview.html b/timemanagement/templates/timemanagement/timemanagement_singleview.html
index 5dc2fda..a388f95 100644
--- a/timemanagement/templates/timemanagement/timemanagement_singleview.html
+++ b/timemanagement/templates/timemanagement/timemanagement_singleview.html
@@ -44,8 +44,7 @@
{% else %}
{% for workday in workdays %}
{% if workday.start|date:"d-m-y" == da|date:"d-m-y" %}
- {% getWorkDayHistory workday as wd_history %}
- {% if wd_history.history_user != None %}
+ {% if workday.lastManualChangeUser != None %}
style="background-color: #fdcc98;"
{% endif %}
{% endif %}
diff --git a/timemanagement/templates/timemanagement/timemanagement_teamview_single.html b/timemanagement/templates/timemanagement/timemanagement_teamview_single.html
index be72813..3310ab2 100644
--- a/timemanagement/templates/timemanagement/timemanagement_teamview_single.html
+++ b/timemanagement/templates/timemanagement/timemanagement_teamview_single.html
@@ -51,8 +51,7 @@
{% else %}
{% for workday in workdays %}
{% if workday.start|date:"d-m-y" == da|date:"d-m-y" %}
- {% getWorkDayHistory workday as wd_history %}
- {% if wd_history.history_user != None %}
+ {% if workday.lastManualChangeUser != None %}
style="background-color: #fdcc98;"
{% endif %}
{% endif %}
@@ -312,9 +311,8 @@
{% endif %}
{% counterWDUp %}
- {% getWorkDayHistory workday as wd_history %}
- {% if wd_history.history_user != None %}
+ {% if workday.lastManualChangeUser != None %}
@@ -327,7 +325,7 @@
-
Geändert am {{wd_history.history_date|date:"d.m.Y, H:i"}} von {{wd_history.history_user.first_name}} {{wd_history.history_user.last_name}}
+
Geändert am {{workday.lastManualChangeDate|date:"d.m.Y, H:i"}} von {{workday.lastManualChangeUser.first_name}} {{workday.lastManualChangeUser.last_name}}
+
Begründung
-
{{absence.info}}
+
{% if absence.info|length > 0 %}
+ {{absence.info}}
+ {% else %}
+ Keine Begründung
+ {% endif %}
An- oder Ablehnung
-
{{absence.confirm_info}}
+
{% if absence.confirm_info|length > 0 %}
+ {{absence.confirm_info}}
+ {% else %}
+ Kein Hinweis
+ {% endif %}
+
+
+ {% getAbsenceLastHistory absence as ab_history %}
+ {% if ab_history != None %}
+ Zuletzt geändert am {{ab_history.history_date|date:"d.m.Y, H:i"}} von {{ab_history.history_user.get_full_name}}
+ {% endif %}
diff --git a/timemanagement/views.py b/timemanagement/views.py
index 6331e93..e780909 100644
--- a/timemanagement/views.py
+++ b/timemanagement/views.py
@@ -288,7 +288,7 @@ def AbsenceManagmenet(request, activemonth=False, activeyear=False):
@login_required
def TimeManagementTeamSingle(request, pk, activemonth=False, activeyear=False):
- if(request.user.has_perm("users.usermanager")):
+ if(request.user.has_perm("users.timemanager")):
# Setzt die Monatsausgabe auf Deutsch
locale.setlocale(locale.LC_TIME, 'de_DE.UTF-8')
user = User.objects.get(pk=pk)
@@ -403,7 +403,7 @@ def TimeManagement(request, activemonth=False, activeyear=False):
"workdays" : Workday.objects.filter(agency=request.user.profile.agency, user=request.user, start__month=activemonth, start__year=active_year).order_by("start").exclude(end=None),
"userhasworkdays" : user_has_workdays
}
- if(request.user.has_perm("users.usermanager")):
+ if(request.user.has_perm("users.timemanager")):
context.update({"usersofagencytm" : User.objects.filter(profile__agency=request.user.profile.agency).order_by('last_name')})
return render(request, 'timemanagement/timemanagement_management.html', context)
@@ -427,6 +427,11 @@ def TimeUpdate(request, pk, team=0):
workday.end = end
workday.freefield = form["freefield"].value()
workday.target = form["target"].value()
+
+ # Speichern, das jemand den Arbeitstag bearbeitet hat
+ workday.lastManualChangeUser = request.user
+ workday.lastManualChangeDate = datetime.datetime.now()
+
workday.save()
messages.success(request, f'Arbeitstag aktualisiert')
if(team == 1):
diff --git a/users/models.py b/users/models.py
index c9898b6..acd88d2 100644
--- a/users/models.py
+++ b/users/models.py
@@ -490,7 +490,8 @@ class AgencyGroup(models.Model):
('usermanager', 'Mitarbeiter bearbeiten'),
('groupmanager', 'Gruppen bearbeiten'),
('structuremanager', 'Struktur bearbeiten'),
- ('standardmanager', 'Standards bearbeiten und freischalten'),
+ ('standardmanager', 'Standards bearbeiten'),
+ ('standardgopublic', 'Standards freischalten'),
('modulenews', 'News bearbeiten und veröffentlichen'),
('modulesconfig', 'Module verwalten'),
('moduleorganizer', 'Organizer bearbeiten'),
@@ -498,6 +499,7 @@ class AgencyGroup(models.Model):
('filedirmanager', 'Ordner bearbeiten'),
('filesviewer', 'Dateien lesen'),
('absencemanager', 'Abwesenheiten verwalten'),
+ ('timemanager', 'Zeiterfassung verwalten'),
('recoverdirmanager', 'Notfallhilfe verwalten')
]
diff --git a/users/templates/users/base.html b/users/templates/users/base.html
index 3d280ab..cdb9f26 100644
--- a/users/templates/users/base.html
+++ b/users/templates/users/base.html
@@ -156,6 +156,8 @@
Agentur
+
+ {% getUnpubStandards request.user as standardUnPubCount %}
{% if active_link == 'standards' %}
{% else%}
@@ -163,8 +165,11 @@
{%endif%}
-
- Standards
+ Standards
+ {% if standardUnPubCount > 0 %}
+ {{standardUnPubCount}}
+ {% endif %}
+
@@ -245,6 +250,9 @@
-->
{% if request.user.profile.agency.module_timemanagement %}
+
+ {% getAbsenceAsks request.user as ab_ask %}
+
{% if active_link == 'abscence' %}
{% else%}
@@ -253,7 +261,11 @@
- Abwesenheiten BETA
+ Abwesenheiten
+ {% if ab_ask > 0 and request.user|usergperm:"absencemanager" %}
+ {{ab_ask}}
+ {% endif %}
+
{% endif %}