89 lines
4.9 KiB
JavaScript
89 lines
4.9 KiB
JavaScript
$(document).ready(function() {
|
|
|
|
$('.new_password').click(function(e) {
|
|
e.preventDefault();
|
|
if ($('input[name="form_data[email]"]').val() == '' || $('input[name="form_data[email]"]').attr('data-default') == '') {
|
|
alert("Sie müssen dem Kunden erst eine E-Mail Adresse zuweisen und abspeichern!");
|
|
} else if (!$(this).hasClass('inactive')) {
|
|
var tthis = $(this);
|
|
bend.dialogs.confirmationDialog({
|
|
confirmation: 'Passwort senden',
|
|
denial: 'Abbrechen',
|
|
confirmationFunction: function() {
|
|
// delete object
|
|
var jqxhr;
|
|
object_id = selected_ids.shift();
|
|
jqxhr = $.ajax({
|
|
url: './index.php?admin_modul=admin_object_edit&object=' + object_class_name + '&action=new_password&object_id=' + object_id
|
|
});
|
|
jqxhr.success(function(data) {
|
|
try {
|
|
var mydata = $.parseJSON(data);
|
|
if (mydata.status != 'success') {
|
|
alert('ERROR: ' + mydata.message);
|
|
}
|
|
else {
|
|
// success action
|
|
//alert('Neues Passwort vergeben.');
|
|
tthis.addClass('inactive');
|
|
}
|
|
} catch (e) {
|
|
alert('ERROR: return data is wrong');
|
|
}
|
|
});
|
|
|
|
jqxhr.error(function() {
|
|
alert("ERROR: can't load url");
|
|
});
|
|
},
|
|
heading: 'Neues Kundenpasswort',
|
|
message: 'Wollen Sie dem Kunden ein neues Passwort per E-Mail zusenden?'
|
|
});
|
|
}
|
|
});
|
|
|
|
$('.first_activation').click(function(e) {
|
|
e.preventDefault();
|
|
if (!$(this).hasClass('inactive')) {
|
|
var tthis = $(this);
|
|
bend.dialogs.confirmationDialog({
|
|
confirmation: 'Kundenbenachrichtigung senden',
|
|
denial: 'Abbrechen',
|
|
confirmationFunction: function() {
|
|
// delete object
|
|
var jqxhr;
|
|
object_id = selected_ids.shift();
|
|
jqxhr = $.ajax({
|
|
url: './index.php?admin_modul=admin_object_edit&object=' + object_class_name + '&action=first_activation&object_id=' + object_id
|
|
});
|
|
jqxhr.success(function(data) {
|
|
try {
|
|
var mydata = $.parseJSON(data);
|
|
if (mydata.status != 'success') {
|
|
alert('ERROR: ' + mydata.message);
|
|
}
|
|
else {
|
|
// success action
|
|
//alert('E-Mail gesendet!');
|
|
tthis.addClass('inactive');
|
|
}
|
|
} catch (e) {
|
|
alert('ERROR: return data is wrong');
|
|
}
|
|
});
|
|
|
|
jqxhr.error(function() {
|
|
alert("ERROR: can't load url");
|
|
});
|
|
},
|
|
heading: 'Kundenbenachrichtigung',
|
|
message: 'Wollen Sie dem Kunden eine Freischalt E-Mail zusenden?'
|
|
});
|
|
}
|
|
});
|
|
|
|
if (!object_id) {
|
|
$('.first_activation, .new_password').addClass('inactive');
|
|
}
|
|
|
|
}); |