Kalender Update Feature Erweiterung

* Absage von Kundenterminen

Behobene Bugfixes:
* Beschreibungsfeld kann nun immer Leer gesetzt werden.
* SPIN wird nun nur 1mal ins Beschreibungsfeld eingesetzt.
This commit is contained in:
Daniel Spitzer
2025-04-30 12:58:36 +02:00
parent 597742d771
commit 4ec4e15e05
5 changed files with 302 additions and 40 deletions
+117 -12
View File
@@ -475,9 +475,7 @@ document.addEventListener('DOMContentLoaded', function () {
html: true
});
}
}
else if (data.data.type.type == "7")
{
} else if (data.data.type.type == "7") {
$('.ticket-div').hide();
$('.customer-div').show();
if (data.data.customer.customer) {
@@ -554,8 +552,7 @@ document.addEventListener('DOMContentLoaded', function () {
html: true
});
}
}
else if (data.data.type.type == "5") {
} else if (data.data.type.type == "5") {
$('.ticket-div').show();
$('.customer-div').hide();
if (data.data.customer.customer) {
@@ -586,6 +583,11 @@ document.addEventListener('DOMContentLoaded', function () {
$('.event-organizer-div').hide();
$('.show-update').show();
$('.show-attendee').hide();
if (data.data.type.type == 2 || data.data.type.type == 3 || data.data.type.type == 4 || data.data.type.type == 7) {
$('#cancel-event').show();
} else {
$('#cancel-event').hide();
}
} else {
const organizer = JSON.parse(data.data.organizer.organizer);
$('.event-organizer-div').show();
@@ -612,6 +614,7 @@ document.addEventListener('DOMContentLoaded', function () {
}
$('.show-update').hide();
$('.show-attendee').show();
$('#cancel-event').hide();
$('.show-attendee').data('id', info.event.id);
}
@@ -632,6 +635,7 @@ document.addEventListener('DOMContentLoaded', function () {
}
if (info.event.extendedProps.rruleflag == true) {
$('#delete-event').hide();
$('#cancel-event').hide();
$('#update-event').hide();
$('.show-attendee').hide();
$('#recurringCheck').prop('checked', true);
@@ -648,6 +652,12 @@ document.addEventListener('DOMContentLoaded', function () {
}
}
if (data.data.canceld.canceld == 1) {
$('#delete-event').hide();
$('#cancel-event').hide();
$('#update-event').hide();
$('.show-attendee').hide();
}
});
if (info.event.extendedProps.clickable) {
@@ -713,9 +723,13 @@ document.addEventListener('DOMContentLoaded', function () {
// $('#description').val(info.event.extendedProps.description);
$('#delete-event').data('id', info.event.id);
$('#update-event').data('id', info.event.id);
$('#cancel-event').data('id', info.event.id);
$('#cancelled-event').data('id', info.event.id);
$('#cancelled-abort').data('id', info.event.id);
$('#EventModalLabel').data('id', info.event.id);
$('#EventModalLabel span').text('Termin bearbeiten');
$('#EventModalLabel .fa-calendar-symbol').removeClass('fa-calendar-circle-plus');
$('#EventModalLabel .fa-calendar-symbol').removeClass('fa-calendar-circle-exclamation');
$('#EventModalLabel .fa-calendar-symbol').addClass('fa-calendar-lines-pen');
$('#add-event').hide();
// $('#calendar-users').select2('destroy');
@@ -1266,9 +1280,13 @@ $(document).ready(function () {
$('#EventModal').on('show.bs.modal', function (event) {
$(document).off('focusin.modal');
$('.hide-cancelled').show();
$('.show-cancelled').hide();
$('#name-col').removeClass('col-9').addClass('col-6');
$('.attachment-div').empty();
$('#reminder').val('NULL');
$('#type').val('1');
$('.privacy-click').removeClass('fa-lock');
$('.privacy-click').removeClass('fa-unlock');
$('.privacy-click').addClass('fa-unlock');
@@ -1284,6 +1302,7 @@ $(document).ready(function () {
$('#EventModalLabel span').text('Termin erstellen');
$('#EventModalLabel .fa-calendar-symbol').addClass('fa-calendar-circle-plus');
$('#EventModalLabel .fa-calendar-symbol').removeClass('fa-calendar-lines-pen');
$('#EventModalLabel .fa-calendar-symbol').removeClass('fa-calendar-circle-exclamation');
$('#EventModalLabel').data('id', '');
$('.show-attendee').data('id', '');
$('.eventmodal-input').val('');
@@ -1459,6 +1478,86 @@ $(document).ready(function () {
$('#EventModal').modal('hide');
});
$('body').on('click', '#cancelled-event', function () {
let id = $(this).data('id');
let title = $('#name').val();
let users = [];
let customer_info_text;
let customer_info_type;
let customer_info_type_text;
let customer_info_check = 0;
$('#calendar-users > option:selected').each(function () {
users.push($(this).val());
});
customer_info_text = $('#customer-info-text').val();
customer_info_type = $('#customer-info-type').val();
customer_info_type_text = $('#customer-info-type-text').val();
if ($('#customer-info-check-cancelled').is(':checked')) {
customer_info_check = 1;
}
if (confirm('Termin wirklich absagen?')) {
$.post(requestCancelUrl, {
id: id,
users: users,
customer_info_text: customer_info_text,
customer_info_type: customer_info_type,
customer_info_type_text: customer_info_type_text,
customer_info_check:customer_info_check,
title: title
}, function (data) {
}).done(function (data) {
});
$('#EventModal').modal('hide');
}
});
$('body').on('click', '#cancel-event', function () {
let id = $(this).data('id');
let users = [];
$('.hide-cancelled').hide();
$('.show-cancelled').show();
$('#name').val("Absage: " + $('#name').val());
$('#name-col').removeClass('col-6').addClass('col-9');
//<i class="fa-duotone fa-solid fa-calendar-xmark"></i>
//<i class="fa-duotone fa-solid fa-calendar-circle-exclamation"></i>
$('#EventModalLabel .fa-calendar-symbol').removeClass('fa-calendar-circle-plus');
$('#EventModalLabel .fa-calendar-symbol').removeClass('fa-calendar-lines-pen');
$('#EventModalLabel .fa-calendar-symbol').addClass('fa-calendar-circle-exclamation');
$('#EventModalLabel span').text('Termin absagen');
// $('#calendar-users > option:selected').each(function () {
// users.push($(this).val());
// });
//
//
// if (confirm('Termin wirklich absagen?')) {
// $.post(requestCancelUrl, {
// id: id,
// users: users
// }, function (data) {
//
// }).done(function (data) {
// });
// $('#EventModal').modal('hide');
// }
});
$('body').on('click', '#cancelled-abort', function () {
const id = $(this).data('id');
const eventEl = document.querySelector('.cal-class-id-' + id);
if (!eventEl) return console.warn('Event-Element nicht gefunden:', id);
$('#EventModal').one('hidden.bs.modal', function () {
eventEl.dispatchEvent(new MouseEvent('click', {
bubbles: true,
cancelable: true
}));
});
$('#EventModal').modal('hide');
});
$('body').on('click', '#update-event', function () {
let valid = true;
@@ -1487,6 +1586,9 @@ $(document).ready(function () {
let title = $('#name').val();
let location = $('#location').val();
let description = tinymce.activeEditor.getContent();
if (description == "") {
description = '&nbsp;';
}
let newkey = $('#attachments').data('newkey');
let allday = 0;
let reminder = $('#reminder').val();
@@ -1512,7 +1614,7 @@ $(document).ready(function () {
if ($('#customer-info-check').is(':checked')) {
customer_info_check = 1;
}
if (type == '2' || type == '3' || type == '4' || type=='7') {
if (type == '2' || type == '3' || type == '4' || type == '7') {
customer_info_text = $('#customer-info-text').val();
customer_info_type = $('#customer-info-type').val();
customer_info_type_text = $('#customer-info-type-text').val();
@@ -1906,7 +2008,7 @@ $(document).ready(function () {
}
}
});
}else if ($(this).val() == "6") {
} else if ($(this).val() == "6") {
$('.customer-div').show();
$('.ticket-div').hide();
$('#customer').select2({
@@ -2052,11 +2154,14 @@ $(document).ready(function () {
$('#customer-info-type-text').val(data.mobilenumber);
}
}
if ($("#customer").select2('data')[0].spin) {// ID deines Editors
var currentContent = tinymce.activeEditor.getContent();
tinymce.activeEditor.setContent(currentContent + '<p style="margin-bottom: 0"><b>Service Pin: </b>' + $("#customer").select2('data')[0].spin + '</p>');
//
// $('#description').val('Service Pin: ' + $("#customer").select2('data')[0].spin + '\n');
if ($(this).attr('id') == 'customer') {
if ($("#customer").select2('data')[0].spin) {// ID deines Editors
var currentContent = tinymce.activeEditor.getContent();
tinymce.activeEditor.setContent(currentContent + '<p style="margin-bottom: 0"><b>Service Pin: </b>' + $("#customer").select2('data')[0].spin + '</p>');
//
// $('#description').val('Service Pin: ' + $("#customer").select2('data')[0].spin + '\n');
}
}