Benachrichtigungen hinzugefügt, Logik folgt
This commit is contained in:
parent
9f7c598d16
commit
3aded3aa94
3
.cred
3
.cred
|
|
@ -1,3 +0,0 @@
|
|||
https://holger.trampe:Zerogoogle123_@git.vhevents.de/
|
||||
https://holger.trampe:Zerogoogle123_@git.vhevents.de/
|
||||
https://holger.trampe:Zerogoogle123_@git.vhevents.de/
|
||||
|
|
@ -9,6 +9,8 @@ media/agencydata/*
|
|||
digitaleagentur/__pycache__/*
|
||||
digitaleagentur/sec.py
|
||||
|
||||
.cred
|
||||
|
||||
collectedstatic/*
|
||||
|
||||
media/userprofilepics/*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
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, UserTime
|
||||
from users.models import AgencyGroup, Agency, Profile, AgencyJob, AgencyNetwork, UserTime, UserNotifications
|
||||
from PIL import Image
|
||||
from bootstrap_datepicker_plus import DatePickerInput
|
||||
from django.utils.translation import gettext as _
|
||||
|
|
@ -35,6 +35,7 @@ class UsersSelfChangeForm(forms.ModelForm):
|
|||
fields = ['email']
|
||||
|
||||
# Form für die Benachrichtigungseinstellungen
|
||||
'''
|
||||
class UsersNotificationForm(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
|
|
@ -49,6 +50,200 @@ 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']
|
||||
'''
|
||||
# Form für die Benachrichtigungseinstellungen STANDARDS
|
||||
class UsersNotificationFormStandard(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = UserNotifications
|
||||
labels = {
|
||||
"standard_created_mail" : "Neuer Standard",
|
||||
"standard_update_mail" : "Standard verändert",
|
||||
"standard_delete_mail" : "Standard gelöscht",
|
||||
"standard_created_unpub_mail" : "Neuer, unveröffentlichter Standard"
|
||||
|
||||
}
|
||||
fields = [
|
||||
'standard_created_mail',
|
||||
'standard_created_push',
|
||||
'standard_update_mail',
|
||||
'standard_update_push',
|
||||
'standard_delete_mail',
|
||||
'standard_delete_push',
|
||||
'standard_created_unpub_mail',
|
||||
'standard_created_unpub_push',
|
||||
]
|
||||
|
||||
|
||||
# Form für die Benachrichtigungseinstellungen NEWS
|
||||
class UsersNotificationFormNews(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = UserNotifications
|
||||
labels = {
|
||||
"news_created_mail" : "Neuer Agenturnews",
|
||||
|
||||
}
|
||||
fields = [
|
||||
'news_created_mail',
|
||||
'news_created_push',
|
||||
]
|
||||
|
||||
# Form für die Benachrichtigungseinstellungen MESSAGES
|
||||
class UsersNotificationFormMessages(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = UserNotifications
|
||||
labels = {
|
||||
"message_received_mail" : "Neuer Mitteilung",
|
||||
|
||||
}
|
||||
fields = [
|
||||
'message_received_mail',
|
||||
'message_received_push',
|
||||
]
|
||||
|
||||
# Form für die Benachrichtigungseinstellungen CHAT
|
||||
class UsersNotificationFormChat(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = UserNotifications
|
||||
labels = {
|
||||
"chat_received_mail" : "Verpasste Chatnachrichten",
|
||||
"chat_room_activity_mail" : "Raumaktivitäten",
|
||||
|
||||
}
|
||||
fields = [
|
||||
'chat_received_mail',
|
||||
'chat_received_push',
|
||||
'chat_room_activity_mail',
|
||||
'chat_room_activity_push',
|
||||
]
|
||||
|
||||
# Form für die Benachrichtigungseinstellungen FILES
|
||||
class UsersNotificationFormFiles(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = UserNotifications
|
||||
labels = {
|
||||
"filedir_created_mail" : "Datei/Ordner erstellt",
|
||||
"filedir_update_mail" : "Datei/Ordner aktualisiert",
|
||||
"filedir_delete_mail" : "Datei/Ordner gelöscht",
|
||||
|
||||
}
|
||||
fields = [
|
||||
'filedir_created_mail',
|
||||
'filedir_created_push',
|
||||
'filedir_update_mail',
|
||||
'filedir_update_push',
|
||||
'filedir_delete_mail',
|
||||
'filedir_delete_push',
|
||||
]
|
||||
|
||||
# Form für die Benachrichtigungseinstellungen ABSENCE AND TIME
|
||||
class UsersNotificationFormAbTime(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = UserNotifications
|
||||
labels = {
|
||||
"absence_created_mail" : "Anfrage erstellt",
|
||||
"absence_user_is_rep_mail" : "Als Vertreter eingesetzt",
|
||||
"absence_user_is_rep_reminder_mail" : "Erinnerung für Vertretung",
|
||||
"time_data_changed_push" : "Datei/Ordner gelöscht",
|
||||
}
|
||||
fields = [
|
||||
'absence_created_mail',
|
||||
'absence_created_push',
|
||||
'absence_user_is_rep_mail',
|
||||
'absence_user_is_rep_push',
|
||||
'absence_user_is_rep_reminder_mail',
|
||||
'absence_user_is_rep_reminder_push',
|
||||
'time_data_changed_mail',
|
||||
'time_data_changed_push',
|
||||
]
|
||||
|
||||
# Form für die Benachrichtigungseinstellungen GRUPPEN
|
||||
class UsersNotificationFormGroups(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = UserNotifications
|
||||
labels = {
|
||||
"group_activity_mail" : "Mitgliedschaftsänderung",
|
||||
"group_rights_mail" : "Rechteänderung",
|
||||
|
||||
}
|
||||
fields = [
|
||||
'group_activity_mail',
|
||||
'group_activity_push',
|
||||
'group_rights_mail',
|
||||
'group_rights_push',
|
||||
]
|
||||
|
||||
# Form für die Benachrichtigungseinstellungen GRUPPEN
|
||||
class UsersNotificationFormAgn(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = UserNotifications
|
||||
labels = {
|
||||
"agn_standard_created_mail" : "Neuer Standard",
|
||||
"agn_standard_copied_mail" : "Standard wurde übernommen",
|
||||
"agn_standard_comment_mail" : "Kommentar zu Standard aus meiner Agentur",
|
||||
"agn_standard_comment_react_mail" : "Reaktion zu meinem Kommentar",
|
||||
"agn_own_change_mail" : "Änderungen meiner Mitgliedschaften",
|
||||
"agn_other_change_mail" : "Änderungen anderer Mitgliedschaften",
|
||||
|
||||
}
|
||||
fields = [
|
||||
'agn_standard_created_mail',
|
||||
'agn_standard_created_push',
|
||||
'agn_standard_copied_mail',
|
||||
'agn_standard_copied_push',
|
||||
'agn_standard_comment_mail',
|
||||
'agn_standard_comment_push',
|
||||
'agn_standard_comment_react_mail',
|
||||
'agn_standard_comment_react_push',
|
||||
'agn_own_change_mail',
|
||||
'agn_own_change_push',
|
||||
'agn_other_change_mail',
|
||||
'agn_other_change_push',
|
||||
]
|
||||
|
||||
|
||||
class UsersNotificationFormOrganizer(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = UserNotifications
|
||||
labels = {
|
||||
"ql_created_mail" : "Quicklink erstellt",
|
||||
"ql_update_mail" : "Quicklink aktualisiert",
|
||||
"ql_delete_mail" : "Quicklink gelöscht",
|
||||
"contact_created_mail" : "Kontakt erstellt",
|
||||
"contact_update_mail" : "Kontakt aktualisiert",
|
||||
"contact_delete_push" : "Kontakt gelöscht",
|
||||
"password_created_mail" : "Passwort erstellt",
|
||||
"password_update_mail" : "Passwort aktualisiert",
|
||||
"password_delete_mail" : "Passwort gelöscht",
|
||||
}
|
||||
fields = [
|
||||
'ql_created_mail',
|
||||
'ql_created_push',
|
||||
'ql_update_mail',
|
||||
'ql_update_push',
|
||||
'ql_delete_mail',
|
||||
'ql_delete_push',
|
||||
'contact_created_mail',
|
||||
'contact_created_push',
|
||||
'contact_update_mail',
|
||||
'contact_update_push',
|
||||
'contact_delete_mail',
|
||||
'contact_delete_push',
|
||||
'password_created_mail',
|
||||
'password_created_push',
|
||||
'password_update_mail',
|
||||
'password_update_push',
|
||||
'password_delete_mail',
|
||||
'password_delete_push',
|
||||
]
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,347 @@
|
|||
{% load crispy_forms_tags %}
|
||||
<div class="col-6 mt-3">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Benachrichtigung</th>
|
||||
<th scope="col">E-Mail</th>
|
||||
<th scope="col">Push</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="checkboxes">
|
||||
{% for formfield in notificationform %}
|
||||
{% if forloop.counter|divisibleby:2 %}
|
||||
<td>{{formfield}}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td>{{formfield.label_tag}}</td>
|
||||
<td>{{formfield}}</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- Flexbox container for aligning the toasts -->
|
||||
</div>
|
||||
|
||||
<div id="accordion">
|
||||
|
||||
<!-- STANDARDS -->
|
||||
<div class="card">
|
||||
<div class="card-header" id="notification_standards_acc">
|
||||
<h5 class="mb-0">
|
||||
<button class="btn btn-link" data-toggle="collapse" data-target="#notification_standards" aria-expanded="true" aria-controls="notification_standards">
|
||||
Standards
|
||||
</button>
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
<div id="notification_standards" class="collapse" aria-labelledby="notification_standards_acc" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Benachrichtigung</th>
|
||||
<th scope="col">E-Mail</th>
|
||||
<th scope="col">Push</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for formfield in notificationforms_standard %}
|
||||
{% if forloop.counter|divisibleby:2 %}
|
||||
<td>{{formfield}}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td>{{formfield.label_tag}}</td>
|
||||
<td>{{formfield}}</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- END STANDARDS -->
|
||||
|
||||
<!-- News -->
|
||||
<div class="card">
|
||||
<div class="card-header" id="notification_news_acc">
|
||||
<h5 class="mb-0">
|
||||
<button class="btn btn-link" data-toggle="collapse" data-target="#notification_news" aria-expanded="true" aria-controls="notification_news">
|
||||
News
|
||||
</button>
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
<div id="notification_news" class="collapse" aria-labelledby="notification_news_acc" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Benachrichtigung</th>
|
||||
<th scope="col">E-Mail</th>
|
||||
<th scope="col">Push</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for formfield in notificationforms_news %}
|
||||
{% if forloop.counter|divisibleby:2 %}
|
||||
<td>{{formfield}}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td>{{formfield.label_tag}}</td>
|
||||
<td>{{formfield}}</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- END News -->
|
||||
|
||||
|
||||
<!-- GROUPS -->
|
||||
<div class="card">
|
||||
<div class="card-header" id="notification_groups_acc">
|
||||
<h5 class="mb-0">
|
||||
<button class="btn btn-link" data-toggle="collapse" data-target="#notification_groups" aria-expanded="true" aria-controls="notification_groups">
|
||||
Gruppen
|
||||
</button>
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
<div id="notification_groups" class="collapse" aria-labelledby="notification_groups_acc" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Benachrichtigung</th>
|
||||
<th scope="col">E-Mail</th>
|
||||
<th scope="col">Push</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for formfield in notificationforms_groups %}
|
||||
{% if forloop.counter|divisibleby:2 %}
|
||||
<td>{{formfield}}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td>{{formfield.label_tag}}</td>
|
||||
<td>{{formfield}}</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- END GROUPS -->
|
||||
|
||||
|
||||
|
||||
<!-- FILES -->
|
||||
<div class="card">
|
||||
<div class="card-header" id="notification_files_acc">
|
||||
<h5 class="mb-0">
|
||||
<button class="btn btn-link" data-toggle="collapse" data-target="#notification_files" aria-expanded="true" aria-controls="notification_files">
|
||||
Dateien und Ordner
|
||||
</button>
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
<div id="notification_files" class="collapse" aria-labelledby="notification_files_acc" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Benachrichtigung</th>
|
||||
<th scope="col">E-Mail</th>
|
||||
<th scope="col">Push</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for formfield in notificationforms_files %}
|
||||
{% if forloop.counter|divisibleby:2 %}
|
||||
<td>{{formfield}}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td>{{formfield.label_tag}}</td>
|
||||
<td>{{formfield}}</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- END FILES -->
|
||||
|
||||
<!-- ORGANIZER -->
|
||||
<div class="card">
|
||||
<div class="card-header" id="notification_organizer_acc">
|
||||
<h5 class="mb-0">
|
||||
<button class="btn btn-link" data-toggle="collapse" data-target="#notification_organizer" aria-expanded="true" aria-controls="notification_organizer">
|
||||
Organizer
|
||||
</button>
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
<div id="notification_organizer" class="collapse" aria-labelledby="notification_organizer_acc" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Benachrichtigung</th>
|
||||
<th scope="col">E-Mail</th>
|
||||
<th scope="col">Push</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for formfield in notificationforms_organizer %}
|
||||
{% if forloop.counter|divisibleby:2 %}
|
||||
<td>{{formfield}}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td>{{formfield.label_tag}}</td>
|
||||
<td>{{formfield}}</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- END ORGANIZER -->
|
||||
|
||||
<!-- Messages -->
|
||||
<div class="card">
|
||||
<div class="card-header" id="notification_messages_acc">
|
||||
<h5 class="mb-0">
|
||||
<button class="btn btn-link" data-toggle="collapse" data-target="#notification_messages" aria-expanded="true" aria-controls="notification_messages">
|
||||
Mitteilungen
|
||||
</button>
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
<div id="notification_messages" class="collapse" aria-labelledby="notification_messages_acc" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Benachrichtigung</th>
|
||||
<th scope="col">E-Mail</th>
|
||||
<th scope="col">Push</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for formfield in notificationforms_messages %}
|
||||
{% if forloop.counter|divisibleby:2 %}
|
||||
<td>{{formfield}}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td>{{formfield.label_tag}}</td>
|
||||
<td>{{formfield}}</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- END Messages -->
|
||||
|
||||
<!-- CHAT -->
|
||||
<div class="card">
|
||||
<div class="card-header" id="notification_chat_acc">
|
||||
<h5 class="mb-0">
|
||||
<button class="btn btn-link" data-toggle="collapse" data-target="#notification_chat" aria-expanded="true" aria-controls="notification_chat">
|
||||
Chat
|
||||
</button>
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
<div id="notification_chat" class="collapse" aria-labelledby="notification_chat_acc" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Benachrichtigung</th>
|
||||
<th scope="col">E-Mail</th>
|
||||
<th scope="col">Push</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for formfield in notificationforms_chat %}
|
||||
{% if forloop.counter|divisibleby:2 %}
|
||||
<td>{{formfield}}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td>{{formfield.label_tag}}</td>
|
||||
<td>{{formfield}}</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- END CHAT -->
|
||||
|
||||
<!-- ABSENCE AND TIME -->
|
||||
<div class="card">
|
||||
<div class="card-header" id="notification_abtime_acc">
|
||||
<h5 class="mb-0">
|
||||
<button class="btn btn-link" data-toggle="collapse" data-target="#notification_abtime" aria-expanded="true" aria-controls="notification_abtime">
|
||||
Abwesenheits- und Zeiterfassung
|
||||
</button>
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
<div id="notification_abtime" class="collapse" aria-labelledby="notification_abtime_acc" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Benachrichtigung</th>
|
||||
<th scope="col">E-Mail</th>
|
||||
<th scope="col">Push</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for formfield in notificationforms_abtime %}
|
||||
{% if forloop.counter|divisibleby:2 %}
|
||||
<td>{{formfield}}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td>{{formfield.label_tag}}</td>
|
||||
<td>{{formfield}}</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- END ABSENCE AND TIME -->
|
||||
|
||||
|
||||
<!-- AGENCY NETWORK -->
|
||||
<div class="card">
|
||||
<div class="card-header" id="notification_agn_acc">
|
||||
<h5 class="mb-0">
|
||||
<button class="btn btn-link" data-toggle="collapse" data-target="#notification_agn" aria-expanded="true" aria-controls="notification_agn">
|
||||
Agenturverbund
|
||||
</button>
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
<div id="notification_agn" class="collapse" aria-labelledby="notification_agn_acc" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Benachrichtigung</th>
|
||||
<th scope="col">E-Mail</th>
|
||||
<th scope="col">Push</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for formfield in notificationforms_agn %}
|
||||
{% if forloop.counter|divisibleby:2 %}
|
||||
<td>{{formfield}}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td>{{formfield.label_tag}}</td>
|
||||
<td>{{formfield}}</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- END AGENCY NETWORK -->
|
||||
|
||||
</div><!-- END ACCORDION -->
|
||||
</div><!-- END CONTENT -->
|
||||
<script>
|
||||
$('input:checkbox').change(
|
||||
function(){
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
{% load crispy_forms_tags %}
|
||||
<div class="col-6 mt-3">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Benachrichtigung</th>
|
||||
<th scope="col">E-Mail</th>
|
||||
<th scope="col">Push</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="checkboxes">
|
||||
{% for formfield in notificationform %}
|
||||
{% if forloop.counter|divisibleby:2 %}
|
||||
<td>{{formfield}}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td>{{formfield.label_tag}}</td>
|
||||
<td>{{formfield}}</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- Flexbox container for aligning the toasts -->
|
||||
</div>
|
||||
<script>
|
||||
$('input:checkbox').change(
|
||||
function(){
|
||||
ele = $(this).prop("name");
|
||||
if(ele.indexOf("module") == -1){
|
||||
new_stat = 0;
|
||||
if($(this).prop("checked")){
|
||||
new_stat = 1;
|
||||
}
|
||||
$.ajax(
|
||||
{
|
||||
type: "GET",
|
||||
url: "/dasettings/ajax",
|
||||
data:{
|
||||
action : "update_notifications",
|
||||
fieldname : ele,
|
||||
new_stat : new_stat
|
||||
},
|
||||
success: function( data )
|
||||
{
|
||||
if(data['success']){
|
||||
$('#notchange_done').toast('show');
|
||||
}
|
||||
else{
|
||||
$('#notchange_err').toast('show');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
$(".toast").toast({
|
||||
autohide: true,
|
||||
delay : 3000
|
||||
});
|
||||
})
|
||||
|
||||
</script>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
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, UserTimeForm, AbsenceReasonForm
|
||||
from .forms import UsersSelfChangeForm, UsersNotificationFormStandard, AgencyGroupPerms, AgencyModulsForm, UserNewUserForm, UserProfileForm, AgencyNetworkForm, AgencyOrganigrammForm, UserTimeForm, AbsenceReasonForm, UsersNotificationFormNews, UsersNotificationFormFiles, UsersNotificationFormMessages ,UsersNotificationFormOrganizer, UsersNotificationFormChat, UsersNotificationFormAbTime, UsersNotificationFormGroups, UsersNotificationFormAgn
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth import update_session_auth_hash
|
||||
from django.contrib.auth.forms import PasswordChangeForm
|
||||
|
|
@ -57,9 +57,37 @@ def getAllForms(request, context):
|
|||
context.update({'passwordform' : passwordform})
|
||||
|
||||
# NOTIFICTAION FORMS
|
||||
notificationform = UsersNotificationForm(instance=request.user.profile)
|
||||
context.update({'notificationform' : notificationform})
|
||||
# STANDARDS
|
||||
notificationforms_standard = UsersNotificationFormStandard(instance=request.user.profile)
|
||||
context.update({'notificationforms_standard' : notificationforms_standard})
|
||||
|
||||
notificationforms_news = UsersNotificationFormNews(instance=request.user.profile)
|
||||
context.update({'notificationforms_news' : notificationforms_news})
|
||||
|
||||
notificationforms_files = UsersNotificationFormFiles(instance=request.user.profile)
|
||||
context.update({'notificationforms_files' : notificationforms_files})
|
||||
|
||||
notificationforms_organizer = UsersNotificationFormOrganizer(instance=request.user.profile)
|
||||
context.update({'notificationforms_organizer' : notificationforms_organizer})
|
||||
|
||||
notificationforms_messages = UsersNotificationFormMessages(instance=request.user.profile)
|
||||
context.update({'notificationforms_messages' : notificationforms_messages})
|
||||
|
||||
notificationforms_chat = UsersNotificationFormChat(instance=request.user.profile)
|
||||
context.update({'notificationforms_chat' : notificationforms_chat})
|
||||
|
||||
notificationforms_abtime = UsersNotificationFormAbTime(instance=request.user.profile)
|
||||
context.update({'notificationforms_abtime' : notificationforms_abtime})
|
||||
|
||||
notificationforms_groups = UsersNotificationFormGroups(instance=request.user.profile)
|
||||
context.update({'notificationforms_groups' : notificationforms_groups})
|
||||
|
||||
notificationforms_agn = UsersNotificationFormAgn(instance=request.user.profile)
|
||||
context.update({'notificationforms_agn' : notificationforms_agn})
|
||||
|
||||
|
||||
|
||||
|
||||
# AGENCY UPDATE FORMS
|
||||
agencyform = AgencyUpdateForm(instance=request.user.profile.agency)
|
||||
context.update({'agencyform' : agencyform})
|
||||
|
|
@ -176,9 +204,34 @@ def DASettings(request):
|
|||
context.update({'userform' : userform})
|
||||
context.update({'passwordform' : passwordform})
|
||||
|
||||
# NOTIFICTAION FORMS
|
||||
notificationform = UsersNotificationForm(instance=request.user.profile)
|
||||
context.update({'notificationform' : notificationform})
|
||||
############################### NOTIFIFORMS START ##########################################
|
||||
notificationforms_standard = UsersNotificationFormStandard(instance=request.user.profile)
|
||||
context.update({'notificationforms_standard' : notificationforms_standard})
|
||||
|
||||
notificationforms_news = UsersNotificationFormNews(instance=request.user.profile)
|
||||
context.update({'notificationforms_news' : notificationforms_news})
|
||||
|
||||
notificationforms_files = UsersNotificationFormFiles(instance=request.user.profile)
|
||||
context.update({'notificationforms_files' : notificationforms_files})
|
||||
|
||||
notificationforms_organizer = UsersNotificationFormOrganizer(instance=request.user.profile)
|
||||
context.update({'notificationforms_organizer' : notificationforms_organizer})
|
||||
|
||||
notificationforms_messages = UsersNotificationFormMessages(instance=request.user.profile)
|
||||
context.update({'notificationforms_messages' : notificationforms_messages})
|
||||
|
||||
notificationforms_chat = UsersNotificationFormChat(instance=request.user.profile)
|
||||
context.update({'notificationforms_chat' : notificationforms_chat})
|
||||
|
||||
notificationforms_abtime = UsersNotificationFormAbTime(instance=request.user.profile)
|
||||
context.update({'notificationforms_abtime' : notificationforms_abtime})
|
||||
|
||||
notificationforms_groups = UsersNotificationFormGroups(instance=request.user.profile)
|
||||
context.update({'notificationforms_groups' : notificationforms_groups})
|
||||
|
||||
notificationforms_agn = UsersNotificationFormAgn(instance=request.user.profile)
|
||||
context.update({'notificationforms_agn' : notificationforms_agn})
|
||||
############################### NOTIFIFORMS END ############################################
|
||||
|
||||
# AGENCY UPDATE FORMS
|
||||
agencyform = AgencyUpdateForm(instance=request.user.profile.agency)
|
||||
|
|
@ -408,6 +461,7 @@ def SettingsAjaxRouter(request):
|
|||
success = False
|
||||
data = {}
|
||||
# UPDATE NOTIFICATIONS BY FIELDNAME AND NEW VALUE
|
||||
'''
|
||||
if request.method == 'GET' and request.GET['action'] == "update_notifications" :
|
||||
success = False
|
||||
new_stat = request.GET['new_stat']
|
||||
|
|
@ -419,6 +473,18 @@ def SettingsAjaxRouter(request):
|
|||
setattr(request.user.profile, request.GET['fieldname'], False)
|
||||
request.user.profile.save()
|
||||
success = True
|
||||
'''
|
||||
if request.method == 'GET' and request.GET['action'] == "update_notifications" :
|
||||
success = False
|
||||
new_stat = request.GET['new_stat']
|
||||
field_to_change = getattr(request.user.usernotifications, request.GET['fieldname'])
|
||||
if(field_to_change or not field_to_change):
|
||||
if(new_stat == "1"):
|
||||
setattr(request.user.usernotifications, request.GET['fieldname'], True)
|
||||
else:
|
||||
setattr(request.user.usernotifications, request.GET['fieldname'], False)
|
||||
request.user.usernotifications.save()
|
||||
success = True
|
||||
# UPDATE TOOLTUP
|
||||
elif request.method == 'GET' and request.GET['action'] == "change_showtooltips" :
|
||||
newtooltipvalue = False
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ from django.contrib.auth.models import User
|
|||
from users.models import Agency
|
||||
from django.core.exceptions import ValidationError
|
||||
from colorful.fields import RGBColorField
|
||||
from django.utils import timezone
|
||||
|
||||
# Create your models here.
|
||||
class Workday(models.Model):
|
||||
|
|
@ -45,7 +46,7 @@ class Absence(models.Model):
|
|||
end = models.DateField(default=None, null=True, blank=True)
|
||||
start_ishalf = models.BooleanField(default=False, blank=True)
|
||||
end_ishalf = models.BooleanField(default=False, blank=True)
|
||||
|
||||
created_date = models.DateTimeField(default=timezone.now, blank=True)
|
||||
reason = models.ForeignKey("AbsenceReason", on_delete=models.PROTECT, null=True, blank=True)
|
||||
info = models.TextField(blank=True, verbose_name='Abwesenheitsbegründung', default="")
|
||||
'''
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from django.contrib import admin
|
||||
from .models import Profile, Agency, AgencyGroup, AgencyJob, AgencyNetwork, AgencyNetworkPreperation, UserTime, UserYearAbsenceInfo
|
||||
from .models import Profile, Agency, AgencyGroup, AgencyJob, AgencyNetwork, AgencyNetworkPreperation, UserTime, UserYearAbsenceInfo, UserNotifications
|
||||
from .priomodel import Prio
|
||||
from standards.models import StandardCommentRate, StandardComments
|
||||
from django.contrib.auth.models import Permission
|
||||
|
|
@ -30,3 +30,4 @@ admin.site.register(Absence)
|
|||
admin.site.register(FreeDays)
|
||||
admin.site.register(UserYearAbsenceInfo)
|
||||
admin.site.register(ChatRoom)
|
||||
admin.site.register(UserNotifications)
|
||||
|
|
|
|||
134
users/models.py
134
users/models.py
|
|
@ -264,6 +264,138 @@ class UserTime(models.Model):
|
|||
startdate = models.DateField(default=None, blank=True, null=True)
|
||||
usetime = models.BooleanField(default=False)
|
||||
usetime_start = models.DateField(default=None, blank=True, null=True)
|
||||
'''
|
||||
|
||||
UserNotifications
|
||||
|
||||
Beherbergt alle Benachrichtigungseinstellungen für die User. Ehemals direkt im
|
||||
User-Model gepflegt, aber da es zu viele sind hierher umgezogen
|
||||
|
||||
'''
|
||||
class UserNotifications(models.Model):
|
||||
user = models.OneToOneField(User, on_delete=models.CASCADE, blank=True, null=True, default=None)
|
||||
# NOTIFICATIONS
|
||||
|
||||
# STANDARDS
|
||||
standard_created_mail = models.BooleanField(default=False)
|
||||
standard_created_push = models.BooleanField(default=True)
|
||||
|
||||
standard_update_mail = models.BooleanField(default=False)
|
||||
standard_update_push = models.BooleanField(default=True)
|
||||
|
||||
standard_delete_mail = models.BooleanField(default=False)
|
||||
standard_delete_push = models.BooleanField(default=True)
|
||||
# Wenn neue Standards erstellt wurden, erhalten alle User mit entsprechenden Recht eine Info, dass neue, unveröffentlichte Standards vorhanden sind
|
||||
standard_created_unpub_mail = models.BooleanField(default=False)
|
||||
standard_created_unpub_push = models.BooleanField(default=True)
|
||||
|
||||
# NEWS
|
||||
news_created_mail = models.BooleanField(default=True)
|
||||
news_created_push = models.BooleanField(default=True)
|
||||
|
||||
# FILES
|
||||
filedir_created_mail = models.BooleanField(default=False)
|
||||
filedir_created_push = models.BooleanField(default=True)
|
||||
|
||||
filedir_update_mail = models.BooleanField(default=False)
|
||||
filedir_update_push = models.BooleanField(default=True)
|
||||
|
||||
filedir_delete_mail = models.BooleanField(default=False)
|
||||
filedir_delete_push = models.BooleanField(default=True)
|
||||
|
||||
# Quicklinks
|
||||
ql_created_mail = models.BooleanField(default=False)
|
||||
ql_created_push = models.BooleanField(default=True)
|
||||
|
||||
ql_update_mail = models.BooleanField(default=False)
|
||||
ql_update_push = models.BooleanField(default=True)
|
||||
|
||||
ql_delete_mail = models.BooleanField(default=False)
|
||||
ql_delete_push = models.BooleanField(default=True)
|
||||
|
||||
# Contacts
|
||||
contact_created_mail = models.BooleanField(default=False)
|
||||
contact_created_push = models.BooleanField(default=True)
|
||||
|
||||
contact_update_mail = models.BooleanField(default=False)
|
||||
contact_update_push = models.BooleanField(default=True)
|
||||
|
||||
contact_delete_mail = models.BooleanField(default=False)
|
||||
contact_delete_push = models.BooleanField(default=True)
|
||||
|
||||
# Password
|
||||
password_created_mail = models.BooleanField(default=False)
|
||||
password_created_push = models.BooleanField(default=True)
|
||||
|
||||
password_update_mail = models.BooleanField(default=False)
|
||||
password_update_push = models.BooleanField(default=True)
|
||||
|
||||
password_delete_mail = models.BooleanField(default=False)
|
||||
password_delete_push = models.BooleanField(default=True)
|
||||
|
||||
# MESSAGES
|
||||
message_received_mail = models.BooleanField(default=True)
|
||||
message_received_push = models.BooleanField(default=True)
|
||||
|
||||
# CHAT
|
||||
# Diese Einstellung sorgt dafür, dass User eine Mail/Push erhalten, wenn neue Chatnachrichten vorhanden sind.
|
||||
chat_received_mail = models.BooleanField(default=True)
|
||||
chat_received_push = models.BooleanField(default=True)
|
||||
|
||||
# Benachrichtigunge, wenn es Raumaktivitäten gab
|
||||
chat_room_activity_mail = models.BooleanField(default=False)
|
||||
chat_room_activity_push = models.BooleanField(default=True)
|
||||
|
||||
# TIMEMANAGEMENT
|
||||
# Wenn neue Abwesenheitsanfragen kommen, Rechte werden gecheckt und dann wird gesendet
|
||||
absence_created_mail = models.BooleanField(default=True)
|
||||
absence_created_push = models.BooleanField(default=True)
|
||||
|
||||
# Info, ob ein Nutzer als Vertreter eingesetzt worden ist.
|
||||
absence_user_is_rep_mail = models.BooleanField(default=True)
|
||||
absence_user_is_rep_push = models.BooleanField(default=True)
|
||||
|
||||
# Info, ob ein Nutzer als Vertreter eingesetzt worden ist REMINDER CronJob zwei Tage vorher
|
||||
absence_user_is_rep_reminder_mail = models.BooleanField(default=True)
|
||||
absence_user_is_rep_reminder_push = models.BooleanField(default=True)
|
||||
|
||||
# Zeiterfassung
|
||||
# Info an den User, wenn seine Zeitdaten verändert wurden
|
||||
time_data_changed_mail = models.BooleanField(default=True)
|
||||
time_data_changed_push = models.BooleanField(default=True)
|
||||
|
||||
# GRUPPEN
|
||||
group_activity_mail = models.BooleanField(default=False)
|
||||
group_activity_push = models.BooleanField(default=True)
|
||||
|
||||
group_rights_mail = models.BooleanField(default=False)
|
||||
group_rights_push = models.BooleanField(default=True)
|
||||
|
||||
# AGENCYNETWORK
|
||||
# Neuer Standard im Verbund
|
||||
agn_standard_created_mail = models.BooleanField(default=False)
|
||||
agn_standard_created_push = models.BooleanField(default=True)
|
||||
|
||||
# Neuer Agenturstandard wurde von anderer Agentur übernommen
|
||||
agn_standard_copied_mail = models.BooleanField(default=False)
|
||||
agn_standard_copied_push = models.BooleanField(default=True)
|
||||
|
||||
# Neuer Kommentar zu einem Standard aus meinem Verbund
|
||||
agn_standard_comment_mail = models.BooleanField(default=False)
|
||||
agn_standard_comment_push = models.BooleanField(default=True)
|
||||
|
||||
# Reaktion auf einen Kommentar von mir
|
||||
agn_standard_comment_react_mail = models.BooleanField(default=False)
|
||||
agn_standard_comment_react_push = models.BooleanField(default=True)
|
||||
|
||||
# Änderungen eigener Mitgliedsanfragen in anderen Verbünden
|
||||
agn_own_change_mail = models.BooleanField(default=True)
|
||||
agn_own_change_push = models.BooleanField(default=True)
|
||||
|
||||
# Änderungen anderer Mitgliedschaften (Beitrittsanfragen!)
|
||||
agn_other_change_mail = models.BooleanField(default=False)
|
||||
agn_other_change_push = models.BooleanField(default=True)
|
||||
|
||||
|
||||
|
||||
class UserYearAbsenceInfo(models.Model):
|
||||
|
|
@ -315,4 +447,4 @@ class UserFullName(User):
|
|||
return "placeholder"
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.first_name + " " + self.last_name}'
|
||||
return f'{self.first_name + " " + self.last_name}'
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
from django.db.models.signals import post_save, pre_delete, m2m_changed, pre_save
|
||||
from django.contrib.auth.models import User, Group
|
||||
from django.dispatch import receiver
|
||||
from .models import Profile, Agency, AgencyGroup, AgencyNetworkPreperation, UserYearAbsenceInfo, UserTime
|
||||
from .models import Profile, Agency, AgencyGroup, AgencyNetworkPreperation, UserYearAbsenceInfo, UserTime, UserNotifications
|
||||
from news.models import News
|
||||
from django.contrib.auth.models import Permission
|
||||
from notificsys.models import UserNotification
|
||||
|
|
@ -389,6 +389,19 @@ def receiver_function(sender, **kwargs):
|
|||
now_minus = datetime.datetime.now() - datetime.timedelta(minutes=2)
|
||||
Presence.objects.filter(last_seen__lt=now_minus).delete()
|
||||
|
||||
users = User.objects.all()
|
||||
|
||||
for user in users:
|
||||
user_notification = []
|
||||
try:
|
||||
user_notification = UserNotifications.objects.get(user=user)
|
||||
except:
|
||||
if(len(user_notification) == 0):
|
||||
user_notification = UserNotifications(user=user)
|
||||
user_notification.save()
|
||||
|
||||
|
||||
|
||||
# PREENCE CHANGED
|
||||
@receiver(signal=presence_changed)
|
||||
def update_presence_live(sender, **kwargs):
|
||||
|
|
|
|||
Loading…
Reference in New Issue