diff --git a/.gitignore b/.gitignore
index 8d54bba..9d79368 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,8 @@ media/agencymain/*
media/agencydata/*
!media/default.jpg
!media/ag_default.jpg
+!media/agencymain/default.jpg
+!media/agencymain/ag_default.jpg
!media/agencymain/linkdefault.png
digitaleagentur/__pycache__/*
diff --git a/dasettings/forms.py b/dasettings/forms.py
index cfcea11..8f1d43a 100644
--- a/dasettings/forms.py
+++ b/dasettings/forms.py
@@ -1,8 +1,9 @@
from django import forms
from django.db import models
from django.contrib.auth.models import User
-from users.models import AgencyGroup, Agency, Profile, AgencyJob, AgencyNetwork
+from users.models import AgencyGroup, Agency, Profile, AgencyJob, AgencyNetwork, UserTime
from PIL import Image
+from bootstrap_datepicker_plus import DatePickerInput
class AgencyOrganigrammForm(forms.ModelForm):
class Meta:
@@ -48,6 +49,25 @@ class UsersNotificationForm(forms.ModelForm):
#fields = ['news_mail', 'news_push', 'user_standard_public_mail', 'user_standard_public_push', 'agency_new_standard_mail', 'agency_new_standard_push', 'add_new_group_mail', 'add_new_group_push', 'add_task_mail', 'add_task_push', 'user_messages_mail', 'user_messages_push']
fields = ['news_mail', 'news_push', 'agency_new_standard_mail', 'agency_new_standard_push', 'add_new_group_mail', 'add_new_group_push', 'add_task_mail', 'add_task_push', 'user_messages_mail', 'user_messages_push']
+# Usertime Form
+class UserTimeForm(forms.ModelForm):
+ class Meta:
+ model = UserTime
+ labels = {
+ "holiday" : "Urlaubstage",
+ "loose_holidedate" : "Urlaubstage aus Vorjahr verfallen am",
+ "wd_mo" : "Montag",
+ "wd_tu" : "Dienstag",
+ "wd_we" : "Mittwoch",
+ "wd_th" : "Donnerstag",
+ "wd_fr" : "Freitag",
+ }
+ fields = ["holiday", "loose_holidedate", "wd_mo", "wd_tu", "wd_we", "wd_th", "wd_fr"]
+ widgets = {
+ 'loose_holidedate': DatePickerInput(options={"format":'DD.MM.YYYY', "locale":'de'})
+ }
+
+
# PERMISSION GROUPS FORM
class AgencyGroupPerms(forms.Form):
'''
@@ -77,8 +97,9 @@ class AgencyModulsForm(forms.ModelForm):
'module_files' : "Dateien",
'module_organigramm' : "Organigramm",
'module_messages' : "Mitteilungen",
+ 'module_timemanagement' : "Zeiterfassung",
}
- fields = ['module_news','module_organizer','module_files','module_organigramm', 'module_messages']
+ fields = ['module_news','module_organizer','module_files','module_organigramm', 'module_messages', 'module_timemanagement']
# NEW USER FORM
class UserNewUserForm(forms.ModelForm):
diff --git a/dasettings/templates/dasettings/groups_content.html b/dasettings/templates/dasettings/groups_content.html
index 81e47cd..4f6d88f 100644
--- a/dasettings/templates/dasettings/groups_content.html
+++ b/dasettings/templates/dasettings/groups_content.html
@@ -40,7 +40,7 @@
{% for perm in perms %}
- {% if forloop.counter|divisibleby:7 %}
+ {% if forloop.counter|divisibleby:8 %}
diff --git a/dasettings/templates/dasettings/moduls_content.html b/dasettings/templates/dasettings/moduls_content.html
index c434c2a..d9ca767 100644
--- a/dasettings/templates/dasettings/moduls_content.html
+++ b/dasettings/templates/dasettings/moduls_content.html
@@ -17,7 +17,7 @@
| {{formfield.label_tag}} |
{{formfield}} |
- |
+ {% if formfield.name == 'module_organigramm' %}{% endif %} |
{% endfor %}
@@ -26,7 +26,6 @@
-
{% for formfield in modulform %}
diff --git a/dasettings/views.py b/dasettings/views.py
index cea9182..3213588 100644
--- a/dasettings/views.py
+++ b/dasettings/views.py
@@ -1,13 +1,14 @@
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect,HttpResponse, JsonResponse
-from .forms import UsersSelfChangeForm, UsersNotificationForm, AgencyGroupPerms, AgencyModulsForm, UserNewUserForm, UserProfileForm, AgencyNetworkForm, AgencyOrganigrammForm
+from .forms import UsersSelfChangeForm, UsersNotificationForm, AgencyGroupPerms, AgencyModulsForm, UserNewUserForm, UserProfileForm, AgencyNetworkForm, AgencyOrganigrammForm, UserTimeForm
from django.contrib import messages
from django.contrib.auth import update_session_auth_hash
from django.contrib.auth.forms import PasswordChangeForm
from users.usersforms import AgencyUpdateForm
from users.models import AgencyJob, AgencyGroup, AgencyNetwork, Agency, AgencyNetworkPreperation
from django.contrib.auth.models import User, Group, Permission
+from users.models import UserTime
import random
import string
from django.template.loader import render_to_string
@@ -501,40 +502,70 @@ def UserProfileUpdate(request, pk, newuser=0):
usertochange.profile.image = request.FILES['image']
formtosave = False
- formtosave = UserProfileForm(request.POST, instance=usertochange.profile)
-
- if formtosave.is_valid():
- try:
- usertochange.profile.parent = User.objects.get(pk=request.POST['usertoparent'], profile__agency=request.user.profile.agency)
- usertochange.save()
- except Exception as e:
- usertochange.profile.parent = None
- usertochange.save()
+ if(request.POST["form_type"] == "profileform"):
+
+ formtosave = UserProfileForm(request.POST, instance=usertochange.profile)
+
+ if formtosave.is_valid():
+ try:
+ usertochange.profile.parent = User.objects.get(pk=request.POST['usertoparent'], profile__agency=request.user.profile.agency)
+ usertochange.save()
+ except Exception as e:
+ usertochange.profile.parent = None
+ usertochange.save()
+
+ formtosave.save()
+ messages.success(request, f'Profil gespeichert!')
+ return redirect('dasettings')
+ else:
+ messages.success(request, f'Fehlerhafte Eingabe!')
+ context = {
+ 'active_link' : 'dasettings',
+ 'user_fullname' : user_fullname,
+ 'first_name' : usertochange.first_name,
+ 'last_name' : usertochange.last_name,
+ 'usertime_form' : UserTimeForm(instance=UserTime.objects.get(user=usertochange)),
+ 'newuser' : newuser,
+ 'vieweduser' : usertochange.pk,
+ 'parentuser' : parentuser,
+ 'mail' : usertochange.email,
+ 'imagelink' : usertochange.profile.get_photo_url,
+ 'profileform' : UserProfileForm(instance=usertochange.profile),
+ 'usertoparent' : User.objects.filter(profile__agency__pk=usertochange.profile.agency.pk, profile__visible=True)
+ }
+ return render(request, 'dasettings/user_usprof.html', context)
+ elif(request.POST["form_type"] == "contract"):
+
+ formtosave = UserTimeForm(request.POST, instance=UserTime.objects.get(user=usertochange))
+ print(formtosave)
+ if(formtosave.is_valid()):
+ messages.success(request, f'Vertragsdaten gespeichert!')
+ formtosave.save()
+ return redirect('dasettings')
+ else:
+ messages.success(request, f'Fehlerhafte Eingabe!')
+ context = {
+ 'active_link' : 'dasettings',
+ 'user_fullname' : user_fullname,
+ 'first_name' : usertochange.first_name,
+ 'last_name' : usertochange.last_name,
+ 'usertime_form' : UserTimeForm(instance=UserTime.objects.get(user=usertochange)),
+ 'newuser' : newuser,
+ 'vieweduser' : usertochange.pk,
+ 'parentuser' : parentuser,
+ 'mail' : usertochange.email,
+ 'imagelink' : usertochange.profile.get_photo_url,
+ 'profileform' : UserProfileForm(instance=usertochange.profile),
+ 'usertoparent' : User.objects.filter(profile__agency__pk=usertochange.profile.agency.pk, profile__visible=True)
+ }
+ return render(request, 'dasettings/user_usprof.html', context)
- formtosave.save()
- messages.success(request, f'Profil gespeichert!')
- return redirect('dasettings')
- else:
- messages.success(request, f'Fehlerhafte Eingabe!')
- context = {
- 'active_link' : 'dasettings',
- 'user_fullname' : user_fullname,
- 'first_name' : usertochange.first_name,
- 'last_name' : usertochange.last_name,
- 'newuser' : newuser,
- 'vieweduser' : usertochange.pk,
- 'parentuser' : parentuser,
- 'mail' : usertochange.email,
- 'imagelink' : usertochange.profile.get_photo_url,
- 'profileform' : UserProfileForm(instance=usertochange.profile),
- 'usertoparent' : User.objects.filter(profile__agency__pk=usertochange.profile.agency.pk, profile__visible=True)
- }
- return render(request, 'dasettings/user_usprof.html', context)
else:
context = {
'active_link' : 'dasettings',
'user_fullname' : user_fullname,
+ 'usertime_form' : UserTimeForm(instance=UserTime.objects.get(user=usertochange)),
'first_name' : usertochange.first_name,
'last_name' : usertochange.last_name,
'newuser' : newuser,
diff --git a/digitaleagentur/__pycache__/settings.cpython-38.pyc b/digitaleagentur/__pycache__/settings.cpython-38.pyc
index 73fad64..6c473d8 100644
Binary files a/digitaleagentur/__pycache__/settings.cpython-38.pyc and b/digitaleagentur/__pycache__/settings.cpython-38.pyc differ
diff --git a/digitaleagentur/__pycache__/urls.cpython-38.pyc b/digitaleagentur/__pycache__/urls.cpython-38.pyc
index be0e15f..c61c031 100644
Binary files a/digitaleagentur/__pycache__/urls.cpython-38.pyc and b/digitaleagentur/__pycache__/urls.cpython-38.pyc differ
diff --git a/digitaleagentur/settings.py b/digitaleagentur/settings.py
index 80793ab..dc98465 100644
--- a/digitaleagentur/settings.py
+++ b/digitaleagentur/settings.py
@@ -72,6 +72,7 @@ INSTALLED_APPS = [
'tasks.apps.TasksConfig',
'organizer.apps.OrganizerConfig',
'standards.apps.StandardsConfig',
+ 'timemanagement.apps.TimemanagementConfig',
'news.apps.NewsConfig',
'crispy_forms',
'colorful',
@@ -83,7 +84,7 @@ INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
- 'django.contrib.staticfiles',
+ 'django.contrib.staticfiles',
'bootstrap_datepicker_plus',
'django_cleanup',
'django_user_agents',
diff --git a/digitaleagentur/urls.py b/digitaleagentur/urls.py
index 1ddc000..926a486 100644
--- a/digitaleagentur/urls.py
+++ b/digitaleagentur/urls.py
@@ -42,7 +42,8 @@ urlpatterns = [
path('register/', registerNewAgency, name='register'),
path('register/done', views.registerdone, name='register-done'),
path('summernote/', include('django_summernote.urls')),
- path('notifications/', include('notificsys.urls'), name="notifications")
+ path('notifications/', include('notificsys.urls'), name="notifications"),
+ path('tm/', include('timemanagement.urls'), name="timemanagement")
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
diff --git a/media/agencymain/ag_default.jpg b/media/agencymain/ag_default.jpg
new file mode 100644
index 0000000..c8d0904
Binary files /dev/null and b/media/agencymain/ag_default.jpg differ
diff --git a/media/default.jpg b/media/default.jpg
index c139055..1fb7d8c 100644
Binary files a/media/default.jpg and b/media/default.jpg differ
diff --git a/standards/templates/standards/standards_single_agn.html b/standards/templates/standards/standards_single_agn.html
index afb7b32..0d6b2ef 100644
--- a/standards/templates/standards/standards_single_agn.html
+++ b/standards/templates/standards/standards_single_agn.html
@@ -100,12 +100,19 @@
+ +
{{comment.content}}