diff --git a/digitaleagentur/__pycache__/settings.cpython-38.pyc b/digitaleagentur/__pycache__/settings.cpython-38.pyc index 1709d20..11e175b 100644 Binary files a/digitaleagentur/__pycache__/settings.cpython-38.pyc and b/digitaleagentur/__pycache__/settings.cpython-38.pyc differ diff --git a/digitaleagentur/settings.py b/digitaleagentur/settings.py index c378bef..0b9a80c 100644 --- a/digitaleagentur/settings.py +++ b/digitaleagentur/settings.py @@ -15,31 +15,35 @@ import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -############################################## DEV ##################################### -BASE_URL = "https://dev01.digitale-agentur.com/" +############################################## LOCAL ##################################### +BASE_URL = "http://localhost:8000/" CRONAPIKEY = "gCddsaz6NOnE9QbXZM5LasdEk122D" + # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = False - -# MAIL DEV -EMAIL_HOST = 'smtp.strato.de' -EMAIL_PORT = 587 -EMAIL_USE_TLS = True -EMAIL_HOST_USER = "support@dev01.digitale-agentur.com" -EMAIL_HOST_PASSWORD = "support@dev01.digitale-agentur.com" -DEFAULT_FROM_EMAIL = "support@dev01.digitale-agentur.com" +DEBUG = True +# Database +# https://docs.djangoproject.com/en/2.2/ref/settings/#databases # DEV DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', - 'NAME' : 'digitaleagentur_dev01', - 'USER' : 'digitaleagentur_dev01', - 'PASSWORD' : 't3TvtGAOkFHYXdJlUMIu9u3U', + 'NAME' : 'digitaleagentur', + 'USER' : 'root', + 'PASSWORD' : '', 'PORT' : 3306 } } -############################################## DEV ##################################### + +# MAIL DEV +EMAIL_HOST = 'gymhum.de' +EMAIL_PORT = 587 +EMAIL_USE_TLS = True +EMAIL_HOST_USER = "holger.trampe" +EMAIL_HOST_PASSWORD = "Motte2016_!" +DEFAULT_FROM_EMAIL = "holger.trampe@gymhum.de" + +################################################### LOCAL ############################### # Nach zehn Stunden läuft der Cookie ab! diff --git a/standards/templates/standards/standards_single.html b/standards/templates/standards/standards_single.html index c6f5f4c..c7e9a41 100644 --- a/standards/templates/standards/standards_single.html +++ b/standards/templates/standards/standards_single.html @@ -117,7 +117,7 @@
Quicklinks

{% for ql in standard.addedquicklinks.all %} - {{ ql.link|truncatechars:30 }}
+ {{ ql.name|truncatechars:30 }}
{% endfor %}

diff --git a/standards/templates/standards/standards_update.html b/standards/templates/standards/standards_update.html index c699330..a3cfd60 100644 --- a/standards/templates/standards/standards_update.html +++ b/standards/templates/standards/standards_update.html @@ -832,5 +832,6 @@ $(document).ready(function() { }); }); + {% endblock content %} diff --git a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc index fd28685..74b17f9 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 c154809..2dbf71d 100644 --- a/standards/templatetags/counter_tag.py +++ b/standards/templatetags/counter_tag.py @@ -2,7 +2,7 @@ from django import template from django.contrib.auth.models import Group, User from users.models import AgencyGroup, Agency, AgencyNetwork, AgencyNetworkPreperation from standards.models import Standards, StandardCommentRate, StandardComments -from timemanagement.models import Workday +from timemanagement.models import Workday, FreeDays from message.models import Message import os from django.conf import settings @@ -383,4 +383,35 @@ def getsumbreak(workday): for ele in workday.breaks.all(): sum_break += (ele.end - ele.start).seconds - return int(sum_break/60) \ No newline at end of file + return int(sum_break/60) + +# DATE TIME HELPTER + +act_forloop_date_counter = ""; + +@register.simple_tag +def setdateforloopcounter(newcounter): + global act_forloop_date_counter + act_forloop_date_counter = newcounter + return "" + +@register.simple_tag +def getactdateforloopcounter(): + return act_forloop_date_counter + +@register.simple_tag +def isfreeday(user, daytocheck): + returnstat = False + fd = FreeDays.objects.filter(agency=user.profile.agency, day=daytocheck) + if len(fd) > 0: + returnstat = True + return returnstat + +@register.simple_tag +def isfreedayname(user, daytocheck): + returnstat = False + fd = FreeDays.objects.filter(agency=user.profile.agency, day=daytocheck) + if len(fd) > 0: + returnstat = True + returnstat = fd[0].name + return returnstat \ No newline at end of file diff --git a/timemanagement/forms.py b/timemanagement/forms.py new file mode 100644 index 0000000..b41aadf --- /dev/null +++ b/timemanagement/forms.py @@ -0,0 +1,19 @@ +from bootstrap_datepicker_plus import DatePickerInput +from django import forms +from django.forms import ModelForm +from .models import Absence + + +class AddAbsence(forms.ModelForm): + + class Meta: + model = Absence + labels = { + "start" : "Beginn der Abwesenheit", + "end" : "Ende der Abwesenheit", + } + fields = ['start', 'end'] + widgets = { + 'start': DatePickerInput(options={"format":'DD.MM.YYYY', "locale":'de'}), + 'end': DatePickerInput(options={"format":'DD.MM.YYYY', "locale":'de'}), + } \ No newline at end of file diff --git a/timemanagement/templates/timemanagement/rendered_table.html b/timemanagement/templates/timemanagement/rendered_table.html new file mode 100644 index 0000000..e9a2388 --- /dev/null +++ b/timemanagement/templates/timemanagement/rendered_table.html @@ -0,0 +1,207 @@ +{% load counter_tag %} + +
+ + + + +
+ + + + {% endfor %} + + + {% for us in usersofagency %} + {% setdateforloopcounter forloop.counter %} + {% getactdateforloopcounter as actfcounter %} + + + {% for da in days_this_month %} + + {% isfreeday user da as isfree %} + {% isfreedayname user da as isfreename %} + {% if isfree %} + + {% endfor %} + + {% endfor %} +
+ {% for da in days_this_month %} + {{da|date:"d D"}}
+ + {{us.get_full_name}} + + + + {% elif da.weekday == 5 or da.weekday == 6 %} + + {% else %} + + {% endif %} +
+ + + + + + + + + \ No newline at end of file diff --git a/timemanagement/templates/timemanagement/tm_ab_management.html b/timemanagement/templates/timemanagement/tm_ab_management.html index 65bd365..28be539 100644 --- a/timemanagement/templates/timemanagement/tm_ab_management.html +++ b/timemanagement/templates/timemanagement/tm_ab_management.html @@ -1,13 +1,83 @@ {% extends "users/base.html" %} {% block content %} +{% load crispy_forms_tags %} {% load counter_tag %} {% if request.user.profile.agency.module_timemanagement_ze %} -
-

Abwesenheiten 

-
- {{freedays}} + + + + + + +
+

Abwesenheiten{% if request.user.profile.showtooltips %} {% endif %}

+
+
+
+ Lade Kalenderdaten... +
+ +
+ + + + diff --git a/timemanagement/urls.py b/timemanagement/urls.py index 0138381..9b1cf57 100644 --- a/timemanagement/urls.py +++ b/timemanagement/urls.py @@ -8,6 +8,7 @@ Permissions definiert in models.py bei USERS und dann hier vor die View geschrie urlpatterns = [ path('', TimeManagement, name='tm-management'), path('abs/', AbsenceManagmenet, name='tma-management'), + path('abs//', AbsenceManagmenet, name='tma-management'), path('ajax/', TimeAjax, name='tm-ajax'), #path('newsadd/', permission_required('users.modulenews')(views.NewsAdd), name='news-add'), #path('newsupdate//', permission_required('users.modulenews')(views.NewsUpdate), name='news-update'), diff --git a/timemanagement/views.py b/timemanagement/views.py index fa9a911..a72a7d6 100644 --- a/timemanagement/views.py +++ b/timemanagement/views.py @@ -1,12 +1,17 @@ from django.shortcuts import render from django.contrib.auth.decorators import login_required from django.http import JsonResponse -from .models import Workday, Breaks +from .models import Workday, Breaks, FreeDays from django.utils import timezone import requests, csv, os from django.templatetags.static import static from django.conf import settings from datetime import date +from django.contrib.auth.models import User +from calendar import monthrange +import datetime +import calendar +from .forms import AddAbsence def loadingFreeDays(plz): # Getting land @@ -34,16 +39,72 @@ def loadingFreeDays(plz): else: return False +def get_datetime_range(year, month): + nb_days = monthrange(year, month)[1] + return [datetime.date(year, month, day) for day in range(1, nb_days+1)] + + @login_required -def AbsenceManagmenet(request): - +def AbsenceManagmenet(request, activemonth=False, activeyear=False): + prevmonth = "" + nextmonth = "" + + #MONTH + if(not activemonth or activemonth > 12 or activemonth < 1): + activemonth = int(activemonth) + #Active month + activemonth=date.today().month + + if(activemonth == 1): + prevmonth = 12 + else: + prevmonth = activemonth-1 + if(activemonth == 12): + nextmonth = 1 + else: + nextmonth = activemonth + 1 + else: + + if(activemonth == 1): + prevmonth = 12 + else: + prevmonth = activemonth-1 + if(activemonth == 12): + nextmonth = 1 + else: + nextmonth = activemonth + 1 + + #YEAR + nextyear = date.today().year + prevyear = date.today().year + + if(not activeyear): + activeyear = date.today().year + else: + if(nextmonth == 1): + nextyear = activeyear + 1 + else: + nextyear = activeyear + if(prevmonth == 12): + prevyear = activeyear - 1 + else: + prevyear = activeyear + context = { "active_link" : "abscence", - "freedays" : loadingFreeDays(request.user.profile.agency.plz) - } + "usersofagency" : User.objects.filter(profile__agency=request.user.profile.agency).order_by("-last_name"), + "days_this_month" : get_datetime_range(activeyear,activemonth), + "nextmonth" : nextmonth, + "prevmonth" : prevmonth, + "nextyear" : nextyear, + "prevyear" : prevyear, + "activemonth" : activemonth, + "activeyear" : activeyear, + "abscenceform" : AddAbsence() + } return render(request, 'timemanagement/tm_ab_management.html', context) @@ -126,6 +187,70 @@ def TimeAjax(request): } else: data = { "success" : False} + # REMOVE WORKDAY + elif request.GET["action"] == "testdjango": + prevmonth = "" + nextmonth = "" + activemonth = int(request.GET["activemonth"]) + activeyear = int(request.GET["activeyear"]) + + #MONTH + if(not activemonth or activemonth > 12 or activemonth < 1): + activemonth = int(activemonth) + #Active month + activemonth=date.today().month + + if(activemonth == 1): + prevmonth = 12 + else: + prevmonth = activemonth-1 + + if(activemonth == 12): + nextmonth = 1 + else: + nextmonth = activemonth + 1 + else: + + if(activemonth == 1): + prevmonth = 12 + else: + prevmonth = activemonth-1 + + if(activemonth == 12): + nextmonth = 1 + else: + nextmonth = activemonth + 1 + + #YEAR + nextyear = date.today().year + prevyear = date.today().year + + if(not activeyear): + activeyear = date.today().year + else: + if(nextmonth == 1): + nextyear = activeyear + 1 + else: + nextyear = activeyear + if(prevmonth == 12): + prevyear = activeyear - 1 + else: + prevyear = activeyear + + context = { + "active_link" : "abscence", + "usersofagency" : User.objects.filter(profile__agency=request.user.profile.agency).order_by("-last_name"), + "days_this_month" : get_datetime_range(activeyear,activemonth), + "activemonth" : activemonth, + "activeyear" : activeyear, + "nextmonth" : nextmonth, + "prevmonth" : prevmonth, + "nextyear" : nextyear, + "prevyear" : prevyear + } + + + return render(request, "timemanagement/rendered_table.html", context) else: data = { "success" : False diff --git a/users/templates/users/base.html b/users/templates/users/base.html index 61388da..5ef0e75 100644 --- a/users/templates/users/base.html +++ b/users/templates/users/base.html @@ -606,11 +606,7 @@ function removeNotification(notifyid){ } $(document).ready(function(){ - console.log("{{root}}"); - console.log("{{url}}"); - - - + $("#notification_items").html(""); loadUnsendNotifications(); loadUnviewnNotifications(); diff --git a/users/templates/users/publicbase.html b/users/templates/users/publicbase.html index 8bfc389..7371edd 100644 --- a/users/templates/users/publicbase.html +++ b/users/templates/users/publicbase.html @@ -7,7 +7,7 @@ - + Digitale Agentur @@ -69,16 +69,26 @@ height: 100%; filter: blur(8px); } + +
+ diff --git a/users/views.py b/users/views.py index 02087ac..ce36cae 100644 --- a/users/views.py +++ b/users/views.py @@ -262,8 +262,6 @@ class AgencyCreateView(CreateView): @login_required def dashboard(request): - print("MEIDA ROOT:" + settings.MEDIA_ROOT) - print("MEDIA URL:" + settings.MEDIA_URL) # UPDATE FUNCTIONS BY NEW MODEL-CHANGES FOR COPIEN SOME DATA toUpdate(request) @@ -272,8 +270,6 @@ def dashboard(request): context = { 'active_link' : 'dashboard', - 'root' : settings.MEDIA_ROOT, - 'url' : settings.MEDIA_URL #"systemencode" : storageinfo } # Adding active_link