Events erstellen
This commit is contained in:
87
public/js/events/events.js
Normal file
87
public/js/events/events.js
Normal file
@@ -0,0 +1,87 @@
|
||||
function addEvent(){
|
||||
let data = {};
|
||||
data.name = $("#name").val();
|
||||
data.shortname = $("#shortname").val();
|
||||
data.from_date_internal = $("#from_date_internal").val();
|
||||
data.to_date_internal = $("#to_date_internal").val();
|
||||
data.from_date_visible = $("#from_date_visible").val();
|
||||
data.to_date_visible = $("#to_date_visible").val();
|
||||
data.active = $("#active").is(":checked") ? "1" : "0";
|
||||
|
||||
if(window.confirm(i18n.blog.confirm_save)) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/intern/events/hinzufuegen',
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
success: function (r) {
|
||||
if (r.messageStatus === "success") {
|
||||
$('#name').val("");
|
||||
$('#shortname').val("");
|
||||
$('#from_date_internal').val("");
|
||||
$('#to_date_internal').val("");
|
||||
$('#from_date_visible').val("");
|
||||
$('#to_date_visible').val("");
|
||||
$('#active').prop('checked', false);
|
||||
location.reload();
|
||||
} else {
|
||||
alert(r.errorMessage);
|
||||
}
|
||||
},
|
||||
error: function (r, a, e) {
|
||||
alert(i18n.common.error_occurred + e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function setActivity(id) {
|
||||
let data = {};
|
||||
data.id = id;
|
||||
data.active = $("#active_" + id).is(":checked") ? "1" : "0";
|
||||
|
||||
if(window.confirm(i18n.blog.confirm_save)) {
|
||||
$.ajax({
|
||||
type: 'PATCH',
|
||||
url: '/intern/events/setActivity',
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
success: function (r) {
|
||||
if (r.messageStatus === "success") {
|
||||
location.reload();
|
||||
} else {
|
||||
alert(r.errorMessage);
|
||||
}
|
||||
},
|
||||
error: function (r, a, e) {
|
||||
alert(i18n.common.error_occurred + e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function deleteEvent(id) {
|
||||
let data = {};
|
||||
data.id = id;
|
||||
|
||||
if(window.confirm(i18n.blog.confirm_delete)) {
|
||||
$.ajax({
|
||||
type: 'DELETE',
|
||||
url: '/intern/events/loeschen',
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
success: function (r) {
|
||||
if (r.messageStatus === "success") {
|
||||
$('#delete_' + id).closest('#eingabemaske_' + id).fadeOut(300, function () {
|
||||
$(this).remove();
|
||||
});
|
||||
} else {
|
||||
alert(r.errorMessage);
|
||||
}
|
||||
},
|
||||
error: function (r, a, e) {
|
||||
alert(i18n.common.error_occurred + e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user