Vorbereitet für Standardspeichern
This commit is contained in:
parent
0df5c01fd2
commit
e41e96828d
|
|
@ -80,22 +80,22 @@
|
|||
<div id="st_linked_content" class="collapse" aria-labelledby="st_linked" data-parent="#additionalStandardInfos">
|
||||
<div class="card-body">
|
||||
<div class="input-group mb-3">
|
||||
<input class="form-control" list="poss_standards" id="searchfield_standards" type="text" onkeyup="javascript:updateLinkedElements('standards')" >
|
||||
<div class="input-group-append">
|
||||
<button type="button" onclick="javascript:clearSearchField('standards')" class="btn btn-secondary" ><i class="fas fa-times"></i></button>
|
||||
</div>
|
||||
<datalist id="poss_standards">
|
||||
{% if update == True %}
|
||||
{% for s in standard_possible %}
|
||||
<option id="standards_{{s.pk}}" value="{{s.name|truncatechars:30}}">{{s.name|truncatechars:30}}</option>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for s in standards %}
|
||||
<option id="standards_{{s.pk}}" value="{{s.name|truncatechars:30}}">{{s.name|truncatechars:30}}</option>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</datalist>
|
||||
</div>
|
||||
<input class="form-control" list="poss_standards" id="searchfield_standards" type="text" onkeyup="javascript:updateLinkedElements('standards')" >
|
||||
<div class="input-group-append">
|
||||
<button type="button" onclick="javascript:clearSearchField('standards')" class="btn btn-secondary" ><i class="fas fa-times"></i></button>
|
||||
</div>
|
||||
<datalist id="poss_standards">
|
||||
{% if update == True %}
|
||||
{% for s in standard_possible %}
|
||||
<option id="standards_{{s.pk}}" value="{{s.name|truncatechars:30}}">{{s.name|truncatechars:30}}</option>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for s in standards %}
|
||||
<option id="standards_{{s.pk}}" value="{{s.name|truncatechars:30}}">{{s.name|truncatechars:30}}</option>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</datalist>
|
||||
</div>
|
||||
Verlinkte Standards:
|
||||
<table id="linked_standards" class="table table-hover table-sm">
|
||||
{% if update == True %}
|
||||
|
|
|
|||
|
|
@ -574,10 +574,6 @@ $('#absencetabs a').on('click', function (e) {
|
|||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function prevMonth(){
|
||||
$.ajax(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,8 +18,116 @@
|
|||
<!-- Für das Speichern der Bilder enctype -->
|
||||
<form method="POST">
|
||||
{% csrf_token %}
|
||||
|
||||
<h4>In folgenden Standards ist {{object.get_full_name}} involviert:</h4>
|
||||
<small>Wählen Sie aus, wer anstelle von {{object.get_full_name}} eingesetzt werden soll.</small><br />
|
||||
|
||||
<button class="btn btn-primary" type="button" onclick="javascript:saveAll()">Alle Speichern</button>
|
||||
{% for s in standards_to_change %}
|
||||
<hr>
|
||||
<h5>
|
||||
<span><button class="btn btn-sm btn-secondary" type="button" onclick="javascript:showStandard({{s.pk}})"><i class="fas fa-eye"></i></button></span>
|
||||
Standard: {{s.name}}
|
||||
|
||||
</h5>
|
||||
<table style="width: 60%;">
|
||||
{% if s.created_standard_by == user_to_del %}
|
||||
<tr>
|
||||
<td style="padding-bottom: 15px;">
|
||||
<span>Ersteller ändern auf: </span></td>
|
||||
<td>
|
||||
<div class="input-group mb-3" >
|
||||
<input class="form-control" list="users_created_standard_{{s.pk}}" id="users_created_standard_{{s.pk}}_input" type="text" onkeyup="" >
|
||||
<div class="input-group-append">
|
||||
<button type="button" onclick="javascript:clearField('users_created_standard_{{s.pk}}_input')" class="btn btn-secondary" ><i class="fas fa-times"></i></button>
|
||||
</div>
|
||||
<datalist id="users_created_standard_{{s.pk}}">
|
||||
{% for us in usersofagency %}
|
||||
<option id="users_created_standard_{{s.pk}}_{{us.pk}}" value="{{us.get_full_name}}">{{us.get_full_name}}</option>
|
||||
{% endfor %}
|
||||
</datalist>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary savebutton" type="button" onclick="javascript:updateStandard('created', {{s.pk}})" id="btn_users_created_standard_{{s.pk}}_save">Speichern</button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
||||
{% if user_to_del in s.representative.all %}
|
||||
<tr>
|
||||
<td style="padding-bottom: 15px;">
|
||||
<span>Vertretung übertragen auf: </span></td>
|
||||
<td>
|
||||
<div class="input-group mb-3" >
|
||||
<input class="form-control" list="users_repr_standard_{{s.pk}}" id="users_repr_standard_{{s.pk}}_input" type="text" onkeyup="" >
|
||||
<div class="input-group-append">
|
||||
<button type="button" onclick="javascript:clearField('users_repr_standard_{{s.pk}}_input')" class="btn btn-secondary" ><i class="fas fa-times"></i></button>
|
||||
</div>
|
||||
<datalist id="users_repr_standard_{{s.pk}}">
|
||||
{% for us in usersofagency %}
|
||||
<option id="users_repr_standard_{{s.pk}}_{{us.pk}}" value="{{us.get_full_name}}">{{us.get_full_name}}</option>
|
||||
{% endfor %}
|
||||
</datalist>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary savebutton" type="button" onclick="javascript:updateStandard('repr', {{s.pk}})" id="btn_users_repr_standard_{{s.pk}}_save">Speichern</button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
||||
{% if user_to_del in s.executor.all %}
|
||||
<tr>
|
||||
<td style="padding-bottom: 15px;">
|
||||
<span>Ausführung übertragen auf: </span></td>
|
||||
<td>
|
||||
<div class="input-group mb-3" >
|
||||
<input class="form-control" list="users_ex_standard_{{s.pk}}" id="users_ex_standard_{{s.pk}}_input" type="text" onkeyup="" >
|
||||
<div class="input-group-append">
|
||||
<button type="button" onclick="javascript:clearField('users_ex_standard_{{s.pk}}_input')" class="btn btn-secondary" ><i class="fas fa-times"></i></button>
|
||||
</div>
|
||||
<datalist id="users_ex_standard_{{s.pk}}">
|
||||
{% for us in usersofagency %}
|
||||
<option id="users_ex_standard_{{s.pk}}_{{us.pk}}" value="{{us.get_full_name}}">{{us.get_full_name}}</option>
|
||||
{% endfor %}
|
||||
</datalist>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary savebutton" type="button" onclick="javascript:updateStandard('executor', {{s.pk}})" id="btn_users_ex_standard_{{s.pk}}_save">Speichern</button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
||||
{% if user_to_del in s.authority.all %}
|
||||
<tr>
|
||||
<td style="padding-bottom: 15px;">
|
||||
<span>Verantwortung übertragen auf: </span>
|
||||
</td>
|
||||
<td>
|
||||
<div class="input-group mb-3" >
|
||||
<input class="form-control" list="users_auth_standard_{{s.pk}}" id="users_auth_standard_{{s.pk}}_input" type="text" onkeyup="" >
|
||||
<div class="input-group-append">
|
||||
<button type="button" onclick="javascript:clearField('users_auth_standard_{{s.pk}}_input')" class="btn btn-secondary" ><i class="fas fa-times"></i></button>
|
||||
</div>
|
||||
<datalist id="users_auth_standard_{{s.pk}}">
|
||||
{% for us in usersofagency %}
|
||||
<option id="users_auth_standard_{{s.pk}}_{{us.pk}}" value="{{us.get_full_name}}">{{us.get_full_name}}</option>
|
||||
{% endfor %}
|
||||
</datalist>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary savebutton" type="button" onclick="javascript:updateStandard('auth', {{s.pk}})" id="btn_users_auth_standard_{{s.pk}}_save">Speichern</button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
{% endfor %}
|
||||
<hr >
|
||||
{% if orgaerror == True %}
|
||||
<p>Alle vom Benutzer erstellen Informationen (Standards, Dateien usw.) bleiben bestehen, jedoch werden die Verweise auf einen Nutzer entfernt. Alle Chat-Nachrichten werden unwiederruflich gelöscht! Soeben wurden alle Vertragsdaten (Abwesenheit und Zeiterfassung), wenn vorhanden, als CSV heruntergeladen. Diese können Sie archivieren und entsprechend Ihrer agenturinternen Gegebenheiten bzgl. Datenspeicherung aufbewahren.<br /></p>
|
||||
<p>Alle Chat-Nachrichten werden unwiederruflich gelöscht! Soeben wurden alle Vertragsdaten (Abwesenheit und Zeiterfassung), wenn vorhanden, als CSV heruntergeladen. Diese können Sie archivieren und entsprechend Ihrer agenturinternen Gegebenheiten bzgl. Datenspeicherung aufbewahren.<br /></p>
|
||||
<a href="{% url 'users-delete-getdata' user.pk %}" id="downloadFileAction" download>Daten erneut herunterladen</a>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
|
|
@ -38,8 +146,93 @@
|
|||
//Auto-Download the file
|
||||
{% if orgaerror == True %}
|
||||
$(document).ready(function(){
|
||||
location.href = "{% url 'users-delete-getdata' user.pk %}"
|
||||
//location.href = "{% url 'users-delete-getdata' user.pk %}"
|
||||
})
|
||||
{% endif %}
|
||||
|
||||
|
||||
function clearField(id){
|
||||
$("#" + id).val("");
|
||||
}
|
||||
|
||||
function showStandard(spk){
|
||||
$("#modal_" + spk).modal("toggle");
|
||||
}
|
||||
|
||||
//Update the Standard. Validation serverside
|
||||
function updateStandard(kind, pk){
|
||||
var id = "";
|
||||
|
||||
if(kind == "created"){
|
||||
var value = $("#users_created_standard_" + pk + "_input").val();
|
||||
if(value.length > 0){
|
||||
id = $('#users_created_standard_'+ pk).find('option[value="' + value + '"]').attr('id');
|
||||
buttonid = "btn_users_created_standard_" + pk + "_save";
|
||||
}
|
||||
}
|
||||
else if(kind == "executor"){
|
||||
var value = $("#users_ex_standard_" + pk + "_input").val();
|
||||
if(value.length > 0){
|
||||
id = $('#users_ex_standard_'+ pk).find('option[value="' + value + '"]').attr('id');
|
||||
buttonid = "btn_users_ex_standard_" + pk + "_save";
|
||||
}
|
||||
}
|
||||
else if(kind == "repr"){
|
||||
var value = $("#users_repr_standard_" + pk + "_input").val();
|
||||
if(value.length > 0){
|
||||
id = $('#users_repr_standard_'+ pk).find('option[value="' + value + '"]').attr('id');
|
||||
buttonid = "btn_users_repr_standard_" + pk + "_save";
|
||||
}
|
||||
}
|
||||
else if(kind == "auth"){
|
||||
var value = $("#users_auth_standard_" + pk + "_input").val();
|
||||
if(value.length > 0){
|
||||
id = $('#users_auth_standard_'+ pk).find('option[value="' + value + '"]').attr('id');
|
||||
buttonid = "btn_users_auth_standard_" + pk + "_save";
|
||||
}
|
||||
}
|
||||
//All data collected, to Ajaxrequest (buttonid for ending spinner!)
|
||||
if(id.length > 0){
|
||||
userid = id.split("_")[4];
|
||||
finalkind = id.split("_")[1];
|
||||
standard = id.split("_")[3];
|
||||
$("#" + buttonid).html('<div class="spinner-border spinner-border-sm" role="status" style="margin-bottom: 2px;"><span class="sr-only">Loading...</span></div>');
|
||||
}
|
||||
}
|
||||
|
||||
function saveAll(){
|
||||
buttons = $(".savebutton")
|
||||
|
||||
for(i = 0; i < buttons.length; i++){
|
||||
buttons[i].click();
|
||||
console.log(buttons[i]);
|
||||
console.log("CLICK " + i);
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- STANDARDSMODAL -->
|
||||
{% for s in standards_to_change %}
|
||||
<div class="modal fade " id="modal_{{s.pk}}" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLongTitle">{{s.name}}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h4>{{standard.name}}</h4>
|
||||
{{s.media}}
|
||||
{{s.content|safe}}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal">Schließen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock content %}
|
||||
|
|
@ -1065,8 +1065,23 @@ class ProfileDeleteView(LoginRequiredMixin, DeleteView):
|
|||
context.update({"response" : response})
|
||||
#print(response)
|
||||
'''
|
||||
# Prüft, ob der Nutzer ein Parent im Organigramm ist. Gibt True oder False zurück. Das Template verhindert dann das löschen und informiert den Nutzer.
|
||||
# Standards des Users laden, um diese dann neu zuzuordnen - finaler Löschbutton wird erst angezeigt, wenn alle Standards durchgeklickt wurden (passiert mit AJAX in der HTML)
|
||||
usersstandards = []
|
||||
agencystandards = Standards.objects.filter(agency=self.request.user.profile.agency)
|
||||
|
||||
user_to_del = User.objects.get(pk=self.get_object().pk)
|
||||
|
||||
for s in agencystandards:
|
||||
if s.created_standard_by == user_to_del or user_to_del in s.representative.all() or user_to_del in s.executor.all() or user_to_del in s.authority.all() :
|
||||
usersstandards.append(s)
|
||||
context.update({"standards_to_change" : usersstandards})
|
||||
|
||||
# Hier werden alle Nutzer der Agentur geladen und in ein Array gepackt, damit diese dann bei den Standards ausgewählt werden können.
|
||||
usersofagency = User.objects.filter(profile__agency=user_to_del.profile.agency).exclude(pk=user_to_del.pk)
|
||||
context.update({"usersofagency" : usersofagency})
|
||||
|
||||
context.update({"user_to_del" : user_to_del})
|
||||
# Prüft, ob der Nutzer ein Parent im Organigramm ist. Gibt True oder False zurück. Das Template verhindert dann das löschen und informiert den Nutzer.
|
||||
context.update({"orgaerror" : checkOrgaParent(kwargs["object"])})
|
||||
return context
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue