survey/js/components/admin_rollen.js
2023-03-28 13:06:08 +02:00

229 lines
7.0 KiB
JavaScript

function rollesave(){
var rollenname = document.getElementById("rollenname").value;
$.ajax({
type: 'POST',
url: '../controller/admin_rollen.php',
data: {
'function': 'rollesave',
'rollenname': rollenname
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("rollenname").value ="";
$(document).ajaxStop(function(){
window.location = "?";
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function erfzuordnung(val) {
var param = val.split('|');
var meid = param[0];
var rid = param[1];
$.ajax({
type: 'POST',
url: '../controller/admin_rollen.php',
data: {
'function': 'erfzuordnung',
'meid': meid,
'rid': rid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('rollenzuordnung.php?edit='+value, function() {
$("#ZuordnungModal").modal("show");
});
});
}
$('#msg').show().delay(5000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function delzuordnung(val) {
var param = val.split('|');
var meid = param[0];
var rid = param[1];
$.ajax({
type: 'POST',
url: '../controller/admin_rollen.php',
data: {
'function': 'delzuordnung',
'meid': meid,
'rid': rid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('rollenzuordnung.php?edit='+value, function() {
$("#ZuordnungModal").modal("show");
});
});
}
$('#msg').show().delay(20000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function erfuser(val) {
var param = val.split('|');
var uid = param[0];
var rid = param[1];
$.ajax({
type: 'POST',
url: '../controller/admin_rollen.php',
data: {
'function': 'erfuser',
'uid': uid,
'rid': rid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('userzuordnung.php?edit='+value, function() {
$("#ZuordnungModal").modal("show");
});
});
}
$('#msg').show().delay(5000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function deluser(val) {
var param = val.split('|');
var uid = param[0];
var rid = param[1];
$.ajax({
type: 'POST',
url: '../controller/admin_rollen.php',
data: {
'function': 'deluser',
'uid': uid,
'rid': rid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('userzuordnung.php?edit='+value, function() {
$("#ZuordnungModal").modal("show");
});
});
}
$('#msg').show().delay(20000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
/*
function onClickDelete(id) {
document.getElementById("antwort").value = "";
r = confirm('Antwort löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_erfassen.php',
data: {
'function': 'delete',
'tabelle': 'jumi_umfragen_antworten',
'spalte': 'uaid',
'id': id
},
success: function(result) { //we got the response
$(document).ajaxStop(function(){
window.location = "?action=fragen&erfassen=1";
});
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
}
function onClickDeleteQuestion(id2) {
document.getElementById("frage").value = "";
document.getElementById("antwort").value = "";
r = confirm('Gesamte Frage löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_erfassen.php',
data: {
'function': 'deleteQuestion',
'id2': id2
},
success: function(result) {
// document.getElementById("del").innerHTML = "<strong>entfernt</strong>";
//Text einblenden geht nicht, da ein Refresh gemacht wird. Dann sieht man den Text nicht
$(document).ajaxStop(function(){
window.location = "?action=fragen&erfassen=1";
});
}
});
}
}
*/