survey/js/components/admin_notenbuch.js
2023-04-04 16:44:50 +02:00

202 lines
6.2 KiB
JavaScript

function notenbuchsave(){
var notenbuch = document.getElementById("notenbuchname").value;
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'notenbuchsave',
'notenbuch': notenbuch
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
setTimeout(function() {
document.getElementById("notenbuchname").value ="";
window.location = "?";
}, 2000);
}
$('#msg').show().delay(2000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function erfzuordnung(jndid, zsid) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'erfzuordnung',
'jndid': jndid,
'zsid': zsid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
setTimeout(function() {
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('notenbuchzuordnung.php?edit='+value, function() {
$("#ZuordnungModal").modal("show");
});
}, 2000);
}
$('#msg').show().delay(2000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function delzuordnung(jndid, zsid) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'delzuordnung',
'jndid': jndid,
'zsid': zsid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
setTimeout(function() {
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('notenbuchzuordnung.php?edit='+value, function() {
$("#ZuordnungModal").modal("show");
});
}, 2000);
}
$('#msg').show().delay(2000).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_notenbuch.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_notenbuch.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(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function delRole(rid) {
r = confirm('Rolle löschen? Benutzer sind dann unzugeordnet!');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'delRole',
'rid': rid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
window.location = "?";
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
}
*/