digitaleagenturnc/standards/templates/standards/standards_management.html

329 lines
15 KiB
HTML

{% extends "users/base.html" %}
{% load counter_tag %}
{% block content %}
<div class="content-section col-12">
<h3>Standards{% if request.user.profile.showtooltips %}&nbsp;<small><i data-toggle="tooltip" data-placement="top" title="Standards dokumentieren und erläutern verschiedenen Verfahren, strukturiert nach Bereichen und Tätigkeiten." class="far fa-question-circle"></i></small>{% endif %}
<a class="btn btn-primary" href="{% url 'standard-add' %}" style="float: right;"><i class="fas fa-plus"></i>&nbsp;Standard</a>
</h3>
<small>Sichtbar sind alle veröffentlichten und von {{ user.first_name }} {{ user.last_name}} erstellten Standards.</small>
<hr>
<div class="row">
<div class="col-12">
<ul class="nav nav-tabs" id="area_tabs" role="tablist" >
{% for area in areas %}
<li class="nav-item " >
<!--<a class="nav-link " id="{{area.id}}" style="opacity:0.8;background-color: {{area.color}}; color: #FFFFFF" data-toggle="tab" href="#t_{{area.id}}" role="tab" aria-controls="t_{{area.id}}" aria-selected="false">{{area.name}}</a>-->
<a class="nav-link " id="{{area.id}}" style="" data-toggle="tab" href="#t_{{area.id}}" role="tab" aria-controls="t_{{area.id}}" aria-selected="false">{{area.name}}</a>
</li>
{% endfor %}
<li class="nav-item ml-auto" >
<a class="nav-link" id="agencynetwork" data-toggle="tab" href="#t_agencynetwork" role="tab" aria-controls="t_agencynetwork" aria-selected="false">Agenturverbund</a>
</li>
<li class="nav-item" >
<a class="nav-link" id="userown" data-toggle="tab" href="#t_userown" role="tab" aria-controls="t_userown" aria-selected="false">Eigene Standards</a>
</li>
{% if perms.users.standardmanager %}
<li class="nav-item" style="float: right !important;">
<a class="nav-link" id="agencys" data-toggle="tab" href="#t_agencys" role="tab" aria-controls="t_agencys" aria-selected="false">
{% if unpubstandards_of_user|length > 0 %}
<span class="badge badge-primary badge-counter" style="float: right; margin-left: 5px; margin-top: 0px">{{unpubstandards_of_user|length}} </span>&nbsp;
{%endif%}
Unveröffentlichte Standards
</a>
</li>
{% endif %}
</div>
<div class="col">
<div class="tab-content" id="area_contents">
{% for area in areas %}
<div class="tab-pane fade" id="t_{{area.id}}" role="tabpanel" aria-labelledby="{{area.id}}">
<h5 class="mt-3"><a href="{% url 'standard-area' area.id %}" style="color: #000000;">Standards aus dem Bereich {{area.name}}</a></h5>
<hr>
{% for ele in standardcontent %}
{% if ele.area == area %}
{% for task in ele.tasks %}
<div class="card text-center mt-1 mr-3 mb-3" style="width: 18rem; height: 12rem; float: left">
<div class="card-body">
<h5 class="card-title">
<a href="{% url 'standard-task' task.task.pk %}" style="color: #000000;">{{task.task.name}}</a>&nbsp;<small>({{task.standards.count}})</small>
</h5>
<!-- STANDARS -->
{% for s in task.standards %}
<!-- VISIBLE GROUPCHECK -->
{% setbool False %}
{% for ag in s.visibleby.all %}
{% if request.user|has_group:ag.group.name %}
{% setbool True %}
{% endif %}
{% endfor %}
{% if s.visibleby.all|length == 0 %}
{% setbool True %}
{% endif %}
{% getbool as groupchecker %}
{% if forloop.counter0 < 3 %}
{% if groupchecker %}
<p class="card-text"><a href="{% url 'standard-single' s.pk %}">{{s.name|truncatechars:28}}</a></p>
{% else %}
<p class="card-text text-secondary" data-toggle="popover" data-placement="top" data-trigger="hover" title="Zugriffsbeschränkung" data-content="Zugriff beschränkt auf {% for sgroup in s.visibleby.all %}{{sgroup.agencygroupname}}{% if forloop.counter < s.visibleby.all|length %},{%endif%}{% endfor %}"><i class="fas fa-lock"></i>&nbsp;{{s.name|truncatechars:28}}</p>
{% endif %}
{% endif %}
{% endfor %}
</div>
</div>
{% endfor %}
{% endif %}
{% endfor %}
</div>
{% endfor %}
<div class="tab-pane fade" id="t_agencynetwork" role="tabpanel" aria-labelledby="agencynetwork">
<h4 class="mt-4 mb-4">Agenturverbünde
<!--<a style="float: right;" class="btn btn-sm btn-secondary" href="{% url 'dasettings' %}"><i class="fas fa-cog"></i></a>-->
</h4>
{% block agnet %}
{% include "standards/agencynetwork_content.html" %}
{% endblock %}
</div>
<div class="tab-pane fade" id="t_userown" role="tabpanel" aria-labelledby="userown">
<h4 class="mt-4 mb-4">Eigene Standards</h4>
<div class="table-responsive">
<table class="table hover" id="userownstandards">
<thead>
<tr>
<th scope="col">Titel</th>
<th scope="col">Erstellt am</th>
<th scope="col">Geändert von</th>
<th scope="col">Geändert am</th>
<th scope="col">Öffentlichkeitsstatus</th>
<th scope="col">&nbsp;</th>
</tr>
</thead>
<tbody id="tableresults">
{% for standard in standards_of_user %}
<tr>
<td>
{% if standard.area != None and standard.task != None %}
<a href="{% url 'standard-single' standard.pk %}">{{standard.name}}</a>
{% else %}
{% if standard.created_standard_by == request.user or perms.users.standardmanager %}
<a href="{% url 'standard-add' standard.pk %}">{{standard.name}}</a>&nbsp;<i class="fas fa-exclamation-circle"data-toggle="tooltip" data-placement="top" title="Es wurden nicht alle Pflichtfelder ausgefüllt."></i>
{% else %}
{{standard.name}}&nbsp;<i class="fas fa-exclamation-circle"data-toggle="tooltip" data-placement="top" title="Es wurden nicht alle Pflichtfelder ausgefüllt."></i>
{% endif %}
{% endif %}
</td>
<td>{{standard.created_standard_date|date:"d.m.Y, H:i"}}</td>
<td>{{standard.last_modified_by.first_name}} {{standard.last_modified_by.last_name}}</td>
<td>{{standard.last_modified_on|date:"d.m.Y, H:i"}}</td>
<td>{{standard.public|yesno:"Öffentlich,Nicht öffentlich"}}</td>
<td>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
{% if perms.users.standardmanager %}
{% if standard.public %}
<a class="dropdown-item" href="{% url 'standard-status' standard.pk %}">Veröffentlichung aufheben</a>
{% else %}
{% if standard.area != None and standard.task != None %}
<a class="dropdown-item" href="{% url 'standard-status' standard.pk %}">Veröffentlichen</a>
{% endif %}
{% endif %}
{% endif %}
{% if standard.created_standard_by == request.user or perms.users.standardmanager %}
<a class="dropdown-item" href="{% url 'standard-add' standard.pk %}">Bearbeiten</a>
{% endif %}
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="{% url 'standard-delete' standard.pk %}" >Löschen</a>
</div>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="tab-pane fade" id="t_agencys" role="tabpanel" aria-labelledby="userown">
<h4 class="mt-4 mb-4">Unveröffentlichte Standards</h4>
<div class="table-responsive">
<table class="table hover" id="unpubstandardsofuser">
<thead>
<tr>
<th scope="col">Titel</th>
<th scope="col">Erstellt am</th>
<th scope="col">Geändert von</th>
<th scope="col">Geändert am</th>
<th scope="col">Öffentlichkeitsstatus</th>
<th scope="col">&nbsp;</th>
</tr>
</thead>
<tbody id="tableresults_s">
{% for standard in unpubstandards_of_user %}
<tr>
<td>
{% if standard.area != None and standard.task != None %}
<a href="{% url 'standard-single' standard.pk %}">{{standard.name}}</a>
{% else %}
{% if standard.created_standard_by == request.user or perms.users.standardmanager %}
<a href="{% url 'standard-update' standard.pk %}">{{standard.name}}</a>&nbsp;<i class="fas fa-exclamation-circle"data-toggle="tooltip" data-placement="top" title="Es wurden nicht alle Pflichtfelder ausgefüllt."></i>
{% else %}
{{standard.name}}&nbsp;<i class="fas fa-exclamation-circle"data-toggle="tooltip" data-placement="top" title="Es wurden nicht alle Pflichtfelder ausgefüllt."></i>
{% endif %}
{% endif %}
</td>
<td>{{standard.created_standard_date|date:"d.m.Y, H:i"}}</td>
<td>{{standard.last_modified_by.first_name}} {{standard.last_modified_by.last_name}}</td>
<td>{{standard.last_modified_on|date:"d.m.Y, H:i"}}</td>
<td>{{standard.public|yesno:"Öffentlich,Nicht öffentlich"}}</td>
<td>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
{% if perms.users.standardmanager %}
{% if standard.public %}
<a class="dropdown-item" href="{% url 'standard-status' standard.pk %}">Veröffentlichung aufheben</a>
{% else %}
{% if standard.area != None and standard.task != None %}
<a class="dropdown-item" href="{% url 'standard-status' standard.pk %}">Veröffentlichen</a>
{% endif %}
{% endif %}
{% endif %}
{% if standard.created_standard_by == request.user or perms.users.standardmanager %}
<a class="dropdown-item" href="{% url 'standard-add' standard.pk %}">Bearbeiten</a>
{% endif %}
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="{% url 'standard-delete' standard.pk %}" >Löschen</a>
</div>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<style type="text/css">
/*.nav-link.active {
border: 15px solid green;
}*/
</style>
<script type="text/javascript">
$('#area_tabs a').on('click', function (e) {
e.preventDefault();
$(this).tab('show');
lastview_name = $(this)[0]['hash'].substring(1);
localStorage.setItem('activeTab', lastview_name);
});
$(document).ready(function(){
var activeTab = localStorage.getItem('activeTab');
if(activeTab){
if($('#' + activeTab).find().prevObject.length != 0){
$('#' + activeTab).tab('show');
$(".nav-link").removeClass("active");
areaid = activeTab.split("_")[1];
$("#" + areaid).addClass("active");
}
else{
$('#area_tabs li:first-child a').tab('show');
}
}
else{
$('#area_tabs li:first-child a').tab('show');
}
$('[data-toggle="popover"]').popover();
$('#userownstandards').DataTable({
responsive: true,
"language": {
"search" : "Suche",
"zeroRecords": "Nichts gefunden",
"infoEmpty": "Keine Einträge",
"info": "Zeige _START_ bis _END_ von _TOTAL_ Einträgen",
"lengthMenu": "Zeige _MENU_ Einträge",
"paginate": {
"first": "Erste",
"last": "Letzte",
"next": "Nächste",
"previous": "Zurück"
},
},
"buttons" : {
"className" : "btn-danger"
}
});
$('#unpubstandardsofuser').DataTable({
responsive: true,
"language": {
"search" : "Suche",
"zeroRecords": "Nichts gefunden",
"infoEmpty": "Keine Einträge",
"info": "Zeige _START_ bis _END_ von _TOTAL_ Einträgen",
"lengthMenu": "Zeige _MENU_ Einträge",
"paginate": {
"first": "Erste",
"last": "Letzte",
"next": "Nächste",
"previous": "Zurück"
},
},
"buttons" : {
"className" : "btn-danger"
}
});
})
$('#area_tabs a').on('click', function (e) {
e.preventDefault()
$(this).tab('show')
});
</script>
<style>
/* DATATABLES */
.paginate_button {
padding: 0px !important;
border: 0px !important;
}
</style>
{% endblock content %}