- Pilotversion bis auf Style-Feinheiten fertig

This commit is contained in:
Holger Trampe 2019-12-06 00:24:38 +01:00
parent 92e794fe0f
commit 8c448ae029
48 changed files with 276 additions and 52 deletions

View File

@ -124,6 +124,3 @@ def area_addareas_ajax(request):
return JsonResponse({'userid' : userid, 'username_clean' : username_clean, 'remaining_users':possible_users_js, 'remaining_users_counter' : final_possible_users})
else:
return HttpResponse("Request method is not a GET")

View File

@ -34,6 +34,7 @@ ALLOWED_HOSTS = []
INSTALLED_APPS = [
'users.apps.UsersConfig',
'areas.apps.AreasConfig',
'orga.apps.OrgaConfig',
'tasks.apps.TasksConfig',
'standards.apps.StandardsConfig',
'crispy_forms',

View File

@ -21,6 +21,7 @@ urlpatterns = [
path('areas/', include('areas.urls'), name="areas-management"),
path('tasks/', include('tasks.urls'), name="tasks-management"),
path('standards/', include('standards.urls'), name="standards"),
path('orga/', include('orga.urls'), name="orga"),
path('password-reset/', auth_views.PasswordResetView.as_view(template_name='users/password_reset.html'), name='password-reset'),
path('password-reset/done/', auth_views.PasswordResetDoneView.as_view(template_name='users/password_reset_done.html'), name='password_reset_done'),
path('password-reset-confirm/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view(template_name='users/password_reset_confirm.html'), name='password_reset_confirm'),
@ -32,6 +33,6 @@ if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += [
path(r'^ckeditor/upload/', login_required(upload), name='ckeditor_upload'),
path(r'^ckeditor/', include('ckeditor_uploader.urls')),
path('ckeditor/upload/', login_required(upload), name='ckeditor_upload'),
path('ckeditor/', include('ckeditor_uploader.urls')),
]

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

0
orga/__init__.py Normal file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

3
orga/admin.py Normal file
View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

5
orga/apps.py Normal file
View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class OrgaConfig(AppConfig):
name = 'orga'

View File

Binary file not shown.

3
orga/models.py Normal file
View File

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

View File

@ -0,0 +1,88 @@
{% extends "users/base.html" %}
{% block content %}
<div class="content-section">
<h3>{{request.user.profile.agency.name}}</h3>
<hr>
<h4>Agenturübersicht</h4>
<table class="table borderless">
<tbody>
<tr>
<td colspan="3" class="text-center">
<a href="{% url 'orga-single' leader.pk %}">
<div>
<img class="img-profile mb-2 " width="12%" src="{{ leader.profile.image.url }}">
</div>
<h5>{{ leader.first_name }} {{ leader.last_name }}</h5>
&nbsp;&nbsp;{{ leader.profile.get_func_display }}
</a>
</td>
</tr>
<tr>
<td class="text-center"><h4>Außendienst</h4></td>
<td class="text-center"><h4>Innendienst</h4></td>
<td class="text-center"><h4>Auszubildende</h4></td>
</tr>
<tr>
<td class="text-center">
{% for us in external %}
<a href="{% url 'orga-single' us.pk %}">
<div class="mb-4">
<div>
<img class="img-profile mb-2 " width="30%" src="{{ us.profile.image.url }}">
</div>
<h5>{{ us.first_name }} {{ us.last_name }}</h5>
<span>{{ us.profile.get_func_display }}</span>
</div>
</a>
{% endfor %}
</td>
<td class="text-center">
{% for us in indoor %}
<a href="{% url 'orga-single' us.pk %}">
<div class="mb-4">
<div>
<img class="img-profile mb-2 " width="30%" src="{{ us.profile.image.url }}">
</div>
<h5>{{ us.first_name }} {{ us.last_name }}</h5>
<span>{{ us.profile.get_func_display }}</span>
</div>
</a>
{% endfor %}
</td>
<td class="text-center">
{% for us in trainee %}
<a href="{% url 'orga-single' us.pk %}">
<div class="mb-4">
<div>
<img class="img-profile mb-2 " width="30%" src="{{ us.profile.image.url }}">
</div>
<h5>{{ us.first_name }} {{ us.last_name }}</h5>
<span>{{ us.profile.get_func_display }}</span>
</div>
</a>
{% endfor %}
</td>
</tr>
</tbody>
</table>
</div>
{% endblock content %}
<!--
context = {
'active_link' : 'orga',
'leader' : leader,
'indoor' : indoor,
'external' : external,
'trainee' : trainee
}
-->

View File

@ -0,0 +1,58 @@
{% extends "users/base.html" %}
{% block content %}
<div class="content-section">
<h3>Bereiche und Aufgaben von {{user_first_name}} {{user_last_name}}</h3>
<hr>
<div class="media">
<img class="img-profile" width="12%" src="{{ imageurl }}">
<div class="media-body col-7">
<div class="col-8">
<h6><b>Name</b></h6>
<p>
{{ user_first_name }} {{ user_last_name }}
</p>
<h6><b>Agenturfunktion</b></h6>
<p>
{{ userfunc }}
</p>
<h6><b>E-Mail</b></h6>
<p>
{{ mail }}
</p>
</div>
</div>
</div>
<table class="table borderless mt-3">
<tbody>
<tr >
{% for area in areas %}
<td class="text-center" style="background-color: rgba({{area.color.0}},{{area.color.1}},{{area.color.2}}, 0.3); color: #ffffff"><h4 style="color: rgba(0,0,0, 1);"><b>{{area.name}}</b></h4></td>
<td>&nbsp;</td>
{% endfor %}
</tr>
<tr style="background-color: {{area.hex}}">
{% for area in areas %}
<td class="text-center">
{%for prio in prios %}
{% if prio.task.area.pk == area.pk %}
<div style="background-color: rgba({{area.color.0}},{{area.color.1}},{{area.color.2}}, 1)" class="mb-2 p-2">
<span style=" color: #FFFFFF;"><h5>{{prio.task.name}}</h5></span>
</div>
{% endif %}
{% endfor %}
</td><td>&nbsp;</td>
{% endfor %}
</tr>
</tbody>
</table>
</div>
{% endblock content %}

3
orga/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

12
orga/urls.py Normal file
View File

@ -0,0 +1,12 @@
from django.urls import path
from . import views
'''
'''
urlpatterns = [
path('', views.mainorga, name='orga-main'),
path('single/<int:pk>', views.singleorga, name='orga-single')
]

63
orga/views.py Normal file
View File

@ -0,0 +1,63 @@
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from areas.models import Areas
from users.priomodel import Prio
from tasks.models import Tasks
import webcolors
@login_required
def mainorga(request):
leader = list(User.objects.filter(profile__agency__pk=request.user.profile.agency.pk).filter(profile__func='lead'))[0]
indoor = list(User.objects.filter(profile__agency__pk=request.user.profile.agency.pk).filter(profile__func='indoor'))
external = list(User.objects.filter(profile__agency__pk=request.user.profile.agency.pk).filter(profile__func='external'))
trainee = list(User.objects.filter(profile__agency__pk=request.user.profile.agency.pk).filter(profile__func='trainee'))
context = {
'active_link' : 'orga',
'leader' : leader,
'indoor' : indoor,
'external' : external,
'trainee' : trainee
}
return render(request, 'orga/orga_main.html', context)
@login_required
def singleorga(request, pk):
user = User.objects.get(pk=pk)
prios = Prio.objects.filter(user__pk=pk).order_by('-prio')[::-1]
areas = list(Areas.objects.filter(agency__pk=request.user.profile.agency.pk))
i = 0
for area in areas:
areas[i].hex = areas[i].color
areas[i].color = list(webcolors.hex_to_rgb(areas[i].color))
i += 1
user_first_name = user.first_name
user_last_name = user.last_name
user_id = user.pk
context = {
'active_link' : 'orga',
'areas' : areas,
'user_first_name' : user_first_name,
'user_last_name' : user_last_name,
'user_id' : user_id,
'prios' : prios,
'mail' : user.email,
'userfunc' : user.profile.get_func_display,
'imageurl' : user.profile.image.url
}
return render(request, 'orga/orga_single.html', context)

View File

@ -10,7 +10,11 @@
</nav>
<small>
<h2>{{standard.name}}</h2>
Erstellt durch {{standard.created_standard_by.first_name}} {{standard.created_standard_by.last_name}} am {{standard.created_standard_date}} | Zuletzt bearbeitet von {{ standard.last_modified_by.first_name}} {{ standard.last_modified_by.last_name}} am {{ standard.last_modified_on}}</small>
Erstellt durch {{standard.created_standard_by.first_name}} {{standard.created_standard_by.last_name}} am {{standard.created_standard_date}} | Zuletzt bearbeitet von {{ standard.last_modified_by.first_name}} {{ standard.last_modified_by.last_name}} am {{ standard.last_modified_on}}
{% if standard.created_standard_by == user or perms.users.standard_management %}
&nbsp;|&nbsp;<a href="{% url 'standard-update' standard.pk %}">Bearbeiten</a>
{% endif%}
</small>
<hr>
{{standard.media}}
{{standard.content|safe}}

View File

@ -87,16 +87,23 @@ class Profile(models.Model):
return reverse('users-update', kwargs={'pk':self.pk})
# Erst Oberklasse speichern, dann Bild verkleinern
def save(self, **kwargs):
super().save()
img = Image.open(self.image.path)
# Bildspeichergröße
if(img.height > 300 or img.width > 300):
output_size = (300,300)
img.thumbnail(output_size)
#if(img.height > 300 or img.width > 300):
# output_size = (300,300)
# img.thumbnail(output_size)
# img.save(self.image.path)
baseheight = 560
hpercent = (baseheight / float(img.size[1]))
wsize = int((float(img.size[0]) * float(hpercent)))
img = img.resize((wsize, baseheight), Image.ANTIALIAS)
img.save(self.image.path)
# PERMISSIONS - Über alle Modelle hinweg, in der url.py wird dann die route verhindert!
# Im template: if perms.users.PERMISSION
class Meta:

View File

View File

@ -35,6 +35,7 @@ body {
.sidebar .nav-link {
font-weight: 500;
color: #333;
}
.sidebar .nav-link .feather {

File diff suppressed because one or more lines are too long

View File

@ -21,7 +21,9 @@
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="{%static 'users/css/sb-admin-2.css' %}" rel="stylesheet">
<link href="{% static 'users/css/sb-admin-2.css' %}" rel="stylesheet">
<link href="{% static 'users/css/custom.css' %}" rel="stylesheet">
<!--<link href="{%static 'users/css/bootstrap.min.css' %}" rel="stylesheet">-->
</head>
@ -32,7 +34,7 @@
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-primary sidebar sidebar-dark accordion" id="accordionSidebar">
<ul class="navbar-nav bg-gradient-primary sidebar sidebar-dark accordion " id="accordionSidebar">
<!-- Sidebar - Brand -->
<a class="sidebar-brand d-flex align-items-center justify-content-center" href="{% url 'users-dashboard' %}">
@ -73,8 +75,12 @@
</a>
</li>
{% if active_link == 'orga' %}
<li class="nav-item active">
{% else%}
<li class="nav-item">
<a class="nav-link " href="#" aria-expanded="true">
{%endif%}
<a class="nav-link " href="{% url 'orga-main' %}" aria-expanded="true">
<i class="fas fa-fw fa-sitemap"></i>
<span>Organigramm</span>
</a>
@ -186,7 +192,7 @@
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">{{request.user.first_name}} {{request.user.last_name}}</span>
<img class="img-profile rounded-circle" src="{{ user.profile.image.url }}">
<img class="img-profile " src="{{ user.profile.image.url }}">
</a>
<!-- Dropdown - User Information -->
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
@ -273,7 +279,6 @@
<script src="{%static 'users/js/sb-admin-2.min.js' %}"></script>
<!-- Page level plugins -->
<!--<script src="vendor/chart.js/Chart.min.js"></script>-->

View File

@ -3,7 +3,7 @@
{% block content %}
<div class="content-section">
<div class="media">
<img class="img-profile rounded-circle mr-5" width="180px" height="180px" src="{{ user.profile.image.url }}">
<img class="img-profile" width="17%" src="{{ user.profile.image.url }}">
<div class="media-body col-5">
<h2 class="account-heading">Profil von {{ user.first_name }} {{ user.last_name }}</h2>
<hr>
@ -40,7 +40,7 @@
</div>
</div>
<!-- Für das Speichern der Bilder enctype -->
<div class="col-7">
<div class="col-7 mt-5">
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
<fieldset class="form-group mb-2">

View File

@ -3,12 +3,11 @@
{% block content %}
<div class="content-section">
<div class="media">
<img class="img-profile rounded-circle mr-5" width="180px" height="180px" src="{{ object.image.url }}">
<img class="img-profile " width="17%" src="{{ object.image.url }}">
<div class="media-body col-5">
<h2 class="account-heading">Profil von {{ object.user.first_name }} {{ object.user.last_name }}</h2>
<hr>
<div class="row">
<div class="row mt-2">
<div class="col-md-6">
<h6><b>Name</b></h6>
<p>
@ -41,7 +40,7 @@
</div>
</div>
<!-- Für das Speichern der Bilder enctype -->
<div class="col-7">
<div class="col-7 mt-5">
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
<fieldset class="form-group">

View File

@ -3,11 +3,11 @@
{% block content %}
<div class="content-section">
<h3>Priorisierung von {{ user_first_name }} {{ user_last_name }} verändern</h3>
<small>Elemente mit einer hohen Zahl werden im Organigramm weiter oben angezeigt. Die Änderungen werden sofort gespeichert.</small>
<small>Elemente mit einer kleineren Zahl werden im Organigramm weiter oben angezeigt. Die Änderungen werden sofort gespeichert.</small>
<hr>
<div class="col-12">
{% for area in areas %}
<h3>Bereich {{ area.name }}</h3>
<h4>Bereich {{ area.name }}</h4>
{% for prio in prios %}
{% if prio.task.area == area %}
<div class="form-group row">

View File

@ -235,24 +235,8 @@ class AgencyUpdateView(LoginRequiredMixin, UpdateView):
'''
def UsersPrio(request, pk):
user = User.objects.get(pk=pk)
prios = Prio.objects.filter(user__pk=pk)
areas = Areas.objects.filter(agency__pk=request.user.profile.agency.pk)
'''
fulldata = []
areas_dict = list(areas)
for area in areas_dict:
fulldata.append({"areaname" : area.name, "area" : area, "tasks" : 0})
for fulldataarea in fulldata:
tasks_of_area = Tasks.objects.filter(area__pk=fulldataarea['area'].pk).exclude(pk__in=prios)
fulldataarea['tasks'] = list(tasks_of_area)
print(fulldataarea)
'''
user_first_name = user.first_name
user_last_name = user.last_name
user_id = user.pk