Verteilerlisten, Mailsystem

This commit is contained in:
aschwarz
2023-04-28 09:41:23 +02:00
parent 3d58070a69
commit c69b2b8b5e
16 changed files with 817 additions and 65 deletions

View File

@ -1,7 +1,7 @@
$(document).ready(function (e){
$("#frmEnquiry").on('submit',(function(e){
e.preventDefault();
$('#loader-icon').show();
//$('#loader-icon').show();
var valid;
valid = validateContact();
if(valid) {
@ -12,10 +12,21 @@
contentType: false,
cache: false,
processData:false,
success: function(data){
//alert(data);
$("#mail-status").html(data);
$('#loader-icon').hide();
success: function(result){
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
//https://developer.snapappointments.com/bootstrap-select/methods/#selectpickertoggle
$('.selectpicker').selectpicker('deselectAll');
document.getElementById("subject").value ="";
tinyMCE.get(0).setContent("");
}
$('#msg').show().delay(5000).fadeOut(500);
$('#msg').html(a[0]);
}
//alert(data);
//$("#mail-status").html(data);
//$('#loader-icon').hide();
},
error: function(){}
@ -29,7 +40,11 @@
$(".info").html('');
// $("#userName").removeClass("invalid");
// $("#userEmail").removeClass("invalid");
$("#empfaenger").removeClass("invalid");
// $('.selectpicker').removeClass('invalid').selectpicker('setStyle');
//https://github.com/snapappointments/bootstrap-select/issues/1891
$('.selectpicker').removeClass('invalid').selectpicker('setStyle').parent().removeClass('invalid ');
$("#subject").removeClass("invalid");
$("#content").removeClass("invalid");
// Bei TinyMCE geht das anders
@ -38,8 +53,7 @@
t.getBody().style.backgroundColor = color;
if($("#empfaenger").val()=='') {
$("#empfaenger").addClass("invalid");
$("#empfaenger").attr("title","Required");
$('.selectpicker').addClass('invalid').selectpicker('setStyle');
valid = false;
}
/*
@ -55,7 +69,6 @@
}
*/
if(!$("#subject").val()) {
$("#subject").addClass("invalid");
$("#subject").attr("title","Required");
valid = false;

View File

@ -14,10 +14,10 @@ function rollesave(){
if(a[1]=="success"){
document.getElementById("rollenname").value ="";
$(document).ajaxStop(function(){
window.location = "?";
setTimeout(() => { window.location = "?"; }, 2000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').show().delay(2000).fadeOut(500);
$('#msg').html(a[0]);
}
},
@ -192,10 +192,10 @@ function delRole(rid) {
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
window.location = "?";
setTimeout(() => { window.location = "?"; }, 2000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').show().delay(2000).fadeOut(500);
$('#msg').html(a[0]);
}
},

View File

@ -0,0 +1,130 @@
function verteilersave(){
var verteilername = document.getElementById("verteilername").value;
$.ajax({
type: 'POST',
url: '../controller/admin_verteilerlisten.php',
data: {
'function': 'verteilersave',
'verteilername': verteilername
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("verteilername").value ="";
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "?"; }, 2000);
});
}
$('#msg').show().delay(2000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function erfuser(mveid, mvid) {
$.ajax({
type: 'POST',
url: '../controller/admin_verteilerlisten.php',
data: {
'function': 'erfuser',
'mveid': mveid,
'mvid': mvid
},
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('verteileruserzuordnung.php?edit='+value, function() {
$("#ZuordnungModal").modal("show");
});
});
}
$('#msg').show().delay(1000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function deluser(mveid, mvid) {
$.ajax({
type: 'POST',
url: '../controller/admin_verteilerlisten.php',
data: {
'function': 'deluser',
'mveid': mveid,
'mvid': mvid
},
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('verteileruserzuordnung.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 delVerteiler(mvid) {
r = confirm('Verteiler wirklich löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_verteilerlisten.php',
data: {
'function': 'delVerteiler',
'mvid': mvid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "?"; }, 2000);
});
}
$('#msg').show().delay(2000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
}