Settings Profil fertig, andere Seiten vorbereitet, ein wenig aufgeräumt

This commit is contained in:
holger.trampe 2020-02-03 20:30:43 +01:00
parent c0a8925eec
commit adefeb1224
11 changed files with 10 additions and 288 deletions

View File

@ -1,153 +0,0 @@
{% extends "users/base.html" %}
{% block content %}
<script src="https://cdn.syncfusion.com/ej2/dist/ej2.min.js" type="text/javascript"></script>
<link href="https://cdn.syncfusion.com/ej2/material.css" rel="stylesheet">
<div class="content-section">
<h3>{{request.user.profile.agency.name}}</h3>
<hr>
<h4>Organigramm</h4>
<div class="text-center">
<div id="diagram"></div>
</div>
<div id="spinner" class="text-center" style="margin-top: 15%; width: 100%; height: 100%; display: none;">
<div class="spinner-border text-danger" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
<script type="text/javascript">
var data = [
{ 'id': 'parent', 'role': "", 'name': '{{request.user.profile.agency.name}}', 'color': '#71AF17', "imageUrl": ""},
{% for u in agencyuser %}
{% if u.profile.parent == u %}
{ 'id': '{{u.pk}}' , 'name': "{{u.first_name}} {{u.last_name}}",'role': '{{u.profile.get_func_display}}\n{{u.profile.compfunc}}', 'manager': 'parent', 'color': '#1859B7', "imageUrl": "{{u.profile.get_photo_url}}", 'userid' : '{{u.pk}}' },
{% else %}
{ 'id': '{{u.pk}}', 'name': "{{u.first_name}} {{u.last_name}}", 'role': '{{u.profile.get_func_display}}\n{{u.profile.compfunc}}', 'manager': '{{u.profile.parent.pk}}', 'color': '#1859B7', "imageUrl": "{{u.profile.get_photo_url }}", 'userid' : '{{u.pk}}'},
{% endif %}
{% endfor %}
];
var items = new ej.data.DataManager(data);
var diagram = new ej.diagrams.Diagram({
width: "1350px", height: "800px",
/*tool: ej.diagrams.DiagramTools.ZoomPan,*/
dataSourceSettings: {
// set the unique field from data source
id: 'id',
// set the field which is used to identify the reporting person
parentId: 'manager',
// define the employee data
dataManager: items
},
layout: {
// set the layout type
type: 'OrganizationalChart',
},
getConnectorDefaults: connectorDefaults,
setNodeTemplate: setNodeTemplate,
// hide the gridlines in the diagram
snapSettings: { constraints: ej.diagrams.SnapConstraints.None }
});
diagram.appendTo('#diagram');
diagram.selectionChange = goToUser
function goToUser(){
if(diagram.selectedItems['nodes'][0] != undefined){
selected_id = diagram.selectedItems['nodes'][0]['properties']['data']['id'];
if(selected_id != 'parent'){
$("#diagram").hide();
$("#spinner").show();
window.location.href = "/orga/single/"+selected_id;
}
else{
$("#diagram").hide();
$("#spinner").show();
window.location.href = "/orga/";
}
}
}
//Define the common settings for connectors.
function connectorDefaults(connector) {
connector.targetDecorator.shape = 'None';
connector.type = 'Orthogonal';
connector.style.strokeColor = 'gray';
return connector;
}
//Funtion to add the Template of the Node.
function setNodeTemplate(obj, diagram) {
// create the stack panel
var content = new ej.diagrams.StackPanel();
content.id = obj.id + '_outerstack';
content.orientation = 'Horizontal';
content.style.strokeColor = 'gray';
content.padding = { left: 5, right: 10, top: 5, bottom: 5 };
// create the image element to map the image data from the data source
var image = new ej.diagrams.ImageElement();
if(obj['properties']['data']['id'] == 'parent'){
image.id = obj.id + '_pic';
image.width = 0; image.height = 0; image.style.strokeColor = 'none';
image.source = obj.data.imageUrl;
}
else{
image.id = obj.id + '_pic';
image.width = 75; image.height = 75; image.style.strokeColor = 'none';
image.source = obj.data.imageUrl;
}
// create the stack panel to append the text elements.
var innerStack = new ej.diagrams.StackPanel();
innerStack.style.strokeColor = 'none';
innerStack.margin = { left: 5, right: 0, top: 0, bottom: 0 };
innerStack.id = obj.id + '_innerstack';
if(obj['properties']['data']['id'] == 'parent'){
var text = new ej.diagrams.TextElement();
text.style.bold = true;
text.style.fontSize = 24;
text.id = obj.id + '_name';
text.content = obj.data.name;
}
else{
var text = new ej.diagrams.TextElement();
text.style.bold = true;
text.style.fontSize = 18;
text.id = obj.id + '_name';
text.content = obj.data.name;
}
// create the text element to map the name data from the data source
if(obj['properties']['data']['id'] == 'parent'){
var desigText = new ej.diagrams.TextElement();
desigText.id = obj.id + '_desig';
desigText.style.fontSize = 0;
desigText.content = obj.data.role;
}
else{
var desigText = new ej.diagrams.TextElement();
desigText.id = obj.id + '_desig';
desigText.style.fontSize = 16;
desigText.content = obj.data.role;
}
// create the text element to map the role data from the data source
// append the text elements
innerStack.children = [text, desigText];
// append the image and inner stack elements
content.children = [image, innerStack];
return content;
}
</script>
{% endblock content %}

View File

@ -30,7 +30,8 @@ class Agency(models.Model):
street = models.CharField(default="", max_length=200, blank=True)
city = models.CharField(default="", max_length=200, blank=True)
email = models.EmailField(default="", blank=True)
phone = models.CharField(default="", max_length=20, blank=True)
phone = models.CharField(default="", max_length=50, blank=True)
persnumber = models.CharField(default="", max_length=50, blank=True)
agencypic = models.ImageField(default='agencymain/default.jpg', upload_to='agencymain', blank=True)
def __str__(self):

View File

@ -295,14 +295,10 @@
</a>
<!-- Dropdown - User Information -->
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
<a class="dropdown-item" href="{% url 'users-profile' %}">
<a class="dropdown-item" href="{% url 'orga-single' user.pk %}">
<i class="fas fa-user fa-sm fa-fw mr-2 text-gray-400"></i>
Profil
</a>
<a class="dropdown-item" href="{% url 'users-prio' user.pk %}">
<i class="fab fa-product-hunt fa-sm fa-fw mr-2 text-gray-400"></i>
Priorisierung
</a>
Orga-Profil
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="{% url 'users-logout' %}">
<i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
@ -356,12 +352,11 @@
<!-- Bootstrap core JavaScript-->
<!--<script src="{%static 'users/vendor/jquery/jquery.min.js' %}"></script>-->
<script src="{%static 'users/vendor/bootstrap/js/bootstrap.bundle.min.js' %}"></script>
<!-- Core plugin JavaScript-->
<script src="{%static 'users/vendor/jquery-easing/jquery.easing.min.js' %}"></script>
<!-- DATABLES JS -->
<script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.20/js/dataTables.bootstrap4.min.js"></script>
<script src="https://cdn.datatables.net/1.10.20/js/dataTables.bootstrap4.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="{%static 'users/js/sb-admin-2.js' %}"></script>

View File

@ -1,62 +0,0 @@
{% extends "users/base.html" %}
{% load crispy_forms_tags %}
{% block content %}
<div class="content-section">
<div class="media">
<img class="img-profile " width="17%" src="{{ user.profile.get_photo_url }}">
<div class="media-body col-5">
<h2 class="account-heading">Profil von {{ user.first_name }} {{ user.last_name }}</h2>
<hr>
<div class="row">
<div class="col-6">
<h6><b>Name</b></h6>
<p>
{{ user.first_name }} {{ user.last_name }}
</p>
<h6><b>E-Mail</b></h6>
<p>
{{ user.email }}
</p>
<h6><b>Agenturfunktion</b></h6>
<p>
{{ user.profile.get_func_display }}
</p>
</div>
<div class="col-6">
<h6><b>Tätigkeit</b></h6>
<p>
{{ user.profile.compfunc }}
</p>
<h6><b>Festnetz</b></h6>
<p>
{{ user.profile.phoneland }}
</p>
<h6><b>Mobil</b></h6>
<p>
{{ user.profile.phonemobile }}
</p>
</div>
</div>
</div>
</div>
<!-- Für das Speichern der Bilder enctype -->
<div class="col-7 mt-5">
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
<fieldset class="form-group mb-2">
<legend class="border-bottom mb-4">
Profil bearbeiten
</legend>
<!-- FORMS LADEN -->
{{ u_form|crispy }}
</fieldset>
<small>Agenturrelevante Daten werden in der Benutzerverwaltung verändert.</small>
<div class="form-group mt-3">
<button type="submit" class="btn btn-success">Speichern</button>&nbsp;
<a href="{% url 'users-management' %}" class="btn">Abbrechen</a>
</div>
</form>
</div>
</div>
{% endblock content %}

View File

@ -1,7 +1,7 @@
{% extends "users/base.html" %}
{% load crispy_forms_tags %}
{% block content %}
<div class="content-section">
<div class="content-section col-6">
<h3>Supportanfrage stellen</h3>
<hr>
<form method="POST" enctype="multipart/form-data">
@ -15,12 +15,6 @@
</div>
<script type="text/javascript">
/*
$(document).ready(function() {
$('#id_problem').summernote({
height: 400
});
});*/
</script>
{% endblock content %}

View File

@ -50,8 +50,6 @@
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Benutzerdaten</div>
<a class="dropdown-item" href="{% url 'users-update' item.profile.pk %}">Bearbeiten</a>
<a class="dropdown-item" href="{% url 'users-prio' item.pk %}">Priorisierung</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="{% url 'users-perm-update' item.profile.pk %}">Rechte</a>
<!--<div class="dropdown-header"></div>-->

View File

@ -1,51 +0,0 @@
{% extends "users/base.html" %}
{% load crispy_forms_tags %}
{% block content %}
<div class="content-section">
<h3>Reihenfolge im Organigramm von {{ user_first_name }} {{ user_last_name }}</h3>
<small>Elemente mit einer größeren Zahl werden im Organigramm weiter oben angezeigt. Die Änderungen werden sofort gespeichert.</small>
<hr>
<div class="col-12">
{% for area in areas %}
<h4>Bereich {{ area.name }}</h4>
{% for prio in prios %}
{% if prio.task.area == area %}
<div class="form-group row">
<label for="{{forloop.counter}}" class="col-sm-2 col-form-label"><h5>{{ prio.task.name }}</h5></label>
<div class="col-sm-1" style="float:right" >
<input type="number" min="0" class="form-control" id="{{forloop.counter}}" value="{{ prio.prio}}" onkeyup="javascript:updatePrio({{prio.pk}}, {{prio.task.pk}}, this.value)" onchange="javascript:updatePrio({{prio.pk}}, {{prio.task.pk}}, this.value)"></div><span class="badge badge-success mt-1 mb-3" id="save_{{prio.pk}}" style="display: none; font-size: 0.8em;">Gespeichert</span>
</div>
{% endif %}
{% endfor%}
<hr>
{% endfor %}
</div>
<a href="{% url 'users-dashboard' %}" class="btn btn-success">Zum Dashboard</a>
</div>
<script type="text/javascript">
function updatePrio(prio, task, value)
{
console.log({{userprio.pk}} + " " + prio + " " + task + " VAL: " + value);
$.ajax(
{
type: "GET",
url: "/dashboard/prioupdate",
data:{
userid: {{user_id}},
prioid : 'adduser',
taskid : task,
value : value
},
success: function( data )
{
$('#save_'+prio).show();
setTimeout(function() {
$('#save_'+prio).fadeOut();
}, 1000 );
}
});
}
</script>
{% endblock content %}

View File

@ -18,15 +18,15 @@ urlpatterns = [
path('logout/', auth_views.LogoutView.as_view(template_name='users/logout.html'), name='users-logout'),
path('usersman/', permission_required('users.users_usermanagement')(UsersManagement.as_view(template_name="users/users_management.html")), name='users-management'),
path('usersman/adduser/', permission_required('users.users_usermanagement')(UsersCreateUser.as_view(template_name="users/users_adduser.html")), name='users-adduser'),
path('usersman/profile/', views.profile, name='users-profile'),
path('usersman/<int:pk>/', views.ProfileUpdateView, name='users-update'),
#path('usersman/profile/', views.profile, name='users-profile'),
#path('usersman/<int:pk>/', views.ProfileUpdateView, name='users-update'),
#path('usersman/<int:pk>/', permission_required('users.users_usermanagement')(ProfileUpdateView.as_view()), name='users-update'),
path('usersman/<int:pk>/perms', permission_required('users.users_usermanagement')(UsersPermUpdateView.as_view()), name='users-perm-update'),
path('usersman/<int:pk>/delete', permission_required('users.users_usermanagement')(ProfileDeleteView.as_view()), name='users-delete'),
path('agencyinfo/', views.agency, name='agencyinfo'),
path('agencyinfo/<int:pk>/', permission_required('users.agency_change')(AgencyUpdateView.as_view()), name='agency-manage'),
path('usersman/<int:pk>/prio', views.UsersPrio, name='users-prio'),
path('prioupdate/', views.UsersPrioUpdate, name="users-prioupdate"),
#path('prioupdate/', views.UsersPrioUpdate, name="users-prioupdate"),
path('areataskupdate/<int:pk>/', views.UsersAreaTaskUpdate, name="users-areataskupdate"),
path('globalsearch/', views.GlobalSearch, name="globalsearch"),
path('standardrout/', views.searchStandardRouter, name="standardrouter"),