survey/js/components/admin_notenbuch.js
2023-04-05 08:51:21 +02:00

194 lines
6.1 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 = "?";
}, 1000);
}
$('#msg').show().delay(1000).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");
});
}, 1000);
}
$('#msg').show().delay(1000).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(1000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function erfNotenUser(csid, zsid) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'erfNotenUser',
'csid': csid,
'zsid': zsid
},
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('notenuserzuordnung.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 delNotenUser(csid, zsid) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'delNotenUser',
'csid': csid,
'zsid': zsid
},
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('notenuserzuordnung.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 delZusammenstellung(zsid) {
r = confirm('Zusammenstellung löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'delZusammenstellung',
'zsid': zsid
},
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);
}
});
}
}