Agenturlöschen Message hinzugefügt

This commit is contained in:
holger.trampe 2020-12-04 19:52:48 +01:00
parent 04c00e6c7f
commit 80f3ae6dff
13 changed files with 119 additions and 36 deletions

View File

@ -0,0 +1,42 @@
{% extends "adm/adm_base.html" %}
{% block content %}
{% load adm_tags %}
{% load mathfilters %}
{% load humanize %}
{% load counter_tag %}
<div class="content-section col-12">
<h4>Agentur löschen
<span style="float: right">
<a style="float: right" class="btn btn-secondary btn-sm ml-2" href="{% url 'adm-agencys' %}"><small><i class="fas fa-chevron-circle-left"></i></small></a>
</span>
</h4>
<hr>
Sie sind im Begriff, die Agentur <b>{{object.name}}</b> zu löschen! Damit werden alle Daten der Agentur unwiderruflich entfernt. Möchten Sie fortfahren?
<hr>
Bitte bestätigen!
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="confirmDel" onclick="javascript:toggleDoDelBtn()">
<label class="form-check-label" for="confirmDel">
Ja, Agentur <b>{{object.name}}</b> wirklich und für immer löschen!
</label>
</div>
<hr>
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
<a class="btn btn-secondary" href="{% url 'adm-agencys' %}" name="action" disabled="true">Abbrechen</a>
<button style="float: right" class="btn btn-primary" type="submit" name="action" disabled="true" id="dodel"><b>Agentur <b>{{object.name}}</b> unwiderruflich löschen</button>
<script type="text/javascript">
function toggleDoDelBtn(){
if($('#confirmDel').prop('checked')){
$('#dodel').attr('disabled', false);
}
else{
$('#dodel').attr('disabled', true);
}
}
</script>
</form>
{% endblock content %}

View File

@ -3,7 +3,13 @@
{% load adm_tags %}
{% getAgencyData agency as agdata %}
<div class="content-section col-12">
<h4>Agentur {{agency.name}}</h4>
<h4>Agentur {{agency.name}}
<span style="float: right">
<a style="float: right" class="btn btn-secondary btn-sm ml-2" href="{% url 'adm-agency-delete' agency.pk %}"><small><i class="fas fa-trash"></i></small></a>
</span>
</h4>
<hr>
<h5>Daten der Agentur</h5>
<table>

View File

@ -11,6 +11,7 @@
<th scope="col">Registriert am</th>
<th scope="col">Mitarbeiter</th>
<th scope="col">Standards</th>
<th scope="col">Abo</th>
</tr>
</thead>
<tbody >
@ -21,6 +22,13 @@
<td>{{ele.registerdate}}</td>
<td>{{agdata.0}}</td>
<td>{{agdata.1}}</td>
<td>
{% if ele.paymentplan == 1 %}
Aktiv
{% else %}
-
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>

View File

@ -103,7 +103,7 @@
<li class="nav-item">
{%endif%}
<a class="nav-link" href="{% url 'adm-bills' %}">
<i class="fas fa-user"></i>
<i class="fas fa-file-invoice-dollar"></i>
<span>Rechnungen</span></a>
</li>

View File

@ -59,20 +59,4 @@
});
})
</script>
{% endblock content %}
<!--
billtype = models.CharField(default="", max_length=200)
billdate = models.DateField(default=timezone.now)
billnumber = models.CharField(default="", max_length=200)
billstatus = models.CharField(default="", max_length=200, null=True, blank=True)
start = models.DateField(default=timezone.now)
end = models.DateField(default=timezone.now)
plan = models.CharField(default="", max_length=20)
usercount = models.IntegerField(default=0)
def __str__(self):
return f'{self.lexid}'
-->
{% endblock content %}

View File

@ -12,6 +12,7 @@ urlpatterns = [
path('ag/', AdmAgencys.as_view(), name="adm-agencys"),
path('us/', AdmUsers.as_view(), name="adm-users"),
path('agsingle/<int:agpk>', AdmAgencySingle.as_view(), name="adm-agency-single"),
path('ad/del/<int:pk>', delAgency.as_view(), name='adm-agency-delete'),
path('ag/bills/', AdmBills.as_view(), name="adm-bills"),
path('usersingle/<int:uspk>', AdmUserSingle.as_view(), name="adm-user-single"),
path('cron/<slug:code>', statisticCronJob, name="adm-cron"),

View File

@ -1,6 +1,7 @@
from django.views.generic import CreateView, ListView, UpdateView, DetailView, DeleteView, FormView, TemplateView
from django.contrib import messages
from django.shortcuts import render, redirect, reverse
from django.urls import reverse_lazy
from django.conf import settings
from django.http import HttpResponseRedirect,HttpResponse, JsonResponse
from .models import MainStatistic
@ -49,7 +50,21 @@ def getCSVRDOrders(request):
pass
class delAgency(DeleteView):
model = Agency
success_url = reverse_lazy("adm-agencys")
template_name = "adm/adm_admdelconfirm.html"
def delete(self, *args, **kwargs):
messages.success(self.request, f'Agentur erfolgreich gelöscht!')
return super(delAgency, self).delete(*args, **kwargs)
def dispatch(self, *args, **kwargs):
if(checkForStuffUser(self.request)):
return super().dispatch(*args, **kwargs)
else:
messages.warning(self.request, f'Sie benötigen einen Mitarbeiter-Account, um diese Seiten aufzurufen!')
return redirect("login")
'''
Hauptansicht Statisik

View File

@ -24,7 +24,11 @@
{% ifaginadminagn agn.pk request.user.profile.agency.pk as is_adminag %}
<tr id="agn_{{agn.pk}}">
<td><a href="{% url 'standard-agn' agn.pk %}">{{agn.name}}</a></td>
<td>{{agn.creator_agency.name }}&nbsp;<i style="float: right; " class="fas fa-info-circle" onclick="javascript:$('#showAgencyInfo_{{agn.creator_agency.pk}}').modal('toggle');"></i></td>
<td>
{% if agn.creator_agency == None %}
Agentur gelöscht
{% endif %}
{{agn.creator_agency.name }}&nbsp;<i style="float: right; " class="fas fa-info-circle" onclick="javascript:$('#showAgencyInfo_{{agn.creator_agency.pk}}').modal('toggle');"></i></td>
<td>{{agn.lastactivity}}</td>
<td>{{agsum}}</td>
<td>{{agn.standards.all|length}}</td>

View File

@ -836,7 +836,21 @@ def getHistoryClassOfObject(value):
return finalclass
# BILLCHECK
'''
Rückgabewerte zur Kontrolle des aktuellen Rechnungsstatus:
0 - Keine Rechnung, kein Plan, aber noch im Freien Zeitraum
1 - Keine Rechnung, keinen Plan, Freiraum um max. 14 Tage überschritten
2 - Keine Rechnung, keinen Plan, Freiraum um mehr als 14 Tage überschritten
3 - Keine Rechnung, keinen Plan, Freiraum um mehr als 30 Tage überschritten - AGENTUR SPERREN!
10 - Plan erstellt!
'''
@register.simple_tag
def getAgencyBillStatus(agency):
print(agency)
return True

View File

@ -47,8 +47,8 @@ Bildet einen Agenturverbund ab
class AgencyNetwork(models.Model):
name = models.CharField(default="", max_length=200)
adminagencys = models.ManyToManyField("Agency", related_name="AdministrationAgencys")
creator = models.ForeignKey(User, on_delete=models.PROTECT, blank=True)
creator_agency = models.ForeignKey("Agency", on_delete=models.PROTECT, blank=True)
creator = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True)
creator_agency = models.ForeignKey("Agency", on_delete=models.SET_NULL, blank=True, null=True)
created_on = models.DateTimeField(default=timezone.now)
lastactivity = models.DateTimeField(default=timezone.now)
members = models.ManyToManyField("Agency", related_name="MemberAgencys", blank=True)

View File

@ -33,6 +33,12 @@ from channels_presence.signals import presence_changed
from organizer.models import *
from chat.models import ChatMessage
@receiver(signal=request_started)
def requestStart(**kwargs):
pass
# TASK: Hier AuditLog implementieren
def loadingFreeDays(plz, year):
# Getting land
file_path = os.path.join(settings.STATIC_ROOT, 'users/extra/plz_short.csv')

View File

@ -155,7 +155,7 @@ def toUpdate(request):
agencygroups = AgencyGroup.objects.filter(agency__pk=request.user.profile.agency.pk)
if(len(agencygroups) == 0):
print("default groups not existing - creating")
#print("default groups not existing - creating")
# MITARBEITER
letters = string.ascii_lowercase
temgroup_mitarbeiter = Group(name=str(request.user.profile.agency.pk) + "_" + randomString(8))
@ -169,7 +169,7 @@ def toUpdate(request):
temgroup_verwaltung_ag = AgencyGroup(savefordel=True, is_admin=True, group=temgroup_verwaltung, agency=request.user.profile.agency, agencygroupname="Administratoren")
temgroup_verwaltung_ag.save()
print("default groups created...adding users...")
#print("default groups created...adding users...")
users_of_agency = User.objects.filter(profile__agency__pk=request.user.profile.agency.pk)
for user in users_of_agency:
#print(temgroup_verwaltung_ag)
@ -182,14 +182,15 @@ def toUpdate(request):
for p in perms:
tempperm = Permission.objects.get(codename=p[0])
temgroup_verwaltung_ag.group.permissions.add(tempperm)
print("default groups created and users added")
#print("default groups created and users added")
else:
print("default groups existing")
#print("default groups existing")
pass
# UPDATE - Notfallhilfe
# Gruppe Notfallhilfe wird hinzugefügt, wenn die Anzahl der Gruppen savefordel=True zwei ist
if (len(AgencyGroup.objects.filter(agency=request.user.profile.agency, savefordel=True)) == 2):
print("missing recoverdir-group...adding")
#print("missing recoverdir-group...adding")
# Notfallhilfe
letters = string.ascii_lowercase
temgroup_Notfallhilfe = Group(name=str(request.user.profile.agency.pk) + "_" + randomString(8))
@ -199,7 +200,7 @@ def toUpdate(request):
recoverdirmanagingperm = Permission.objects.get(codename='recoverdirmanager')
temgroup_Notfallhilfe_ag.group.permissions.add(recoverdirmanagingperm)
print("recoverdirgroup added and perms set")
#print("recoverdirgroup added and perms set")
# CHECK FOR ALL POSSIBLE RIGHTS ON ADMINGROUP
m2m_changed.disconnect(adjust_group_notifications_permission, sender=Group.permissions.through)
@ -216,12 +217,13 @@ def toUpdate(request):
rootdir = DataDir.objects.filter(is_root=True, agency__pk=request.user.profile.agency.pk)
if(len(rootdir) == 0):
print("NO MAIN DIR FOUND - CREATE")
#print("NO MAIN DIR FOUND - CREATE")
rootdir = DataDir(is_root=True, agency=request.user.profile.agency)
rootdir.save()
print("AGENCY ROOT DIR CREATED")
#print("AGENCY ROOT DIR CREATED")
else:
print("MAIN ROOT DIR FOUND - FILESMODULE READY")
pass
#print("MAIN ROOT DIR FOUND - FILESMODULE READY")
# CHECK IF AGENCY DIRS EXIST
path = settings.MEDIA_ROOT + "/agencydata/agency_" + str(request.user.profile.agency.pk)
@ -236,13 +238,14 @@ def toUpdate(request):
defstandard = DataDir.objects.filter(is_defaultstandard=True, agency__pk=request.user.profile.agency.pk)
if(len(defstandard) == 0):
print("NO DEF STANDARD FOUND - CREATE")
#print("NO DEF STANDARD FOUND - CREATE")
rootdir = list(DataDir.objects.filter(is_root=True, agency__pk=request.user.profile.agency.pk))[0]
defstandard = DataDir(is_defaultstandard=True, agency=request.user.profile.agency, name="Standards Uploadbereich", parent_id=rootdir.pk)
defstandard.save()
print("AGENCY DEF STANDARD DIR CREATED")
#print("AGENCY DEF STANDARD DIR CREATED")
else:
print("AGENCY DEF STANDARD DIR - FILESMODULE READY")
#print("AGENCY DEF STANDARD DIR - FILESMODULE READY")
pass
# CHANGE RIGHTS ORGNAIZER
@ -784,7 +787,7 @@ class ProfileDeleteView(LoginRequiredMixin, DeleteView):
writer.writerow(['1001', 'John', 'Domil', 'CA'])
writer.writerow(['1002', 'Amit', 'Mukharji', 'LA', '"Testing"'])
context.update({"response" : response})
print(response)
#print(response)
return context