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

View File

@@ -391,12 +391,12 @@ endforeach;
<div class="col-1">
<label for="name" class="col-form-label fw-medium ">Betreff</label>
</div>
<div class="col-6">
<div class="col-6" id="name-col">
<div class="mb-2">
<input type="text" class="form-control is-require eventmodal-input" id="name">
</div>
</div>
<div class="col-3">
<div class="col-3 hide-cancelled">
<div class="input-group mb-2">
<span title="Erinnerung" class="input-group-text spanwidht">Typ</span>
<select class="form-control form-select select-2" aria-label="Default select" id="type">
@@ -410,21 +410,21 @@ endforeach;
</select>
</div>
</div>
<div class="col-1 text-center">
<div class="col-1 text-center hide-cancelled">
<i title="Normal" class="fa-duotone privacy-click fa-regular fa-unlock mt-1"></i>
</div>
</div>
<div class="row justify-content-center">
<div class="col-1">
<label for="location" class="col-form-label fw-medium ">Ort</label>
<label for="location" class="col-form-label fw-medium hide-cancelled ">Ort</label>
</div>
<div class="col-6">
<div class="mb-2">
<input type="text" class="form-control eventmodal-input" id="location">
<input type="text" class="form-control eventmodal-input hide-cancelled" id="location">
</div>
</div>
<div class="col-4">
<div class="col-4 hide-cancelled">
<div class="input-group mb-2">
<span title="Erinnerung" class="input-group-text spanwidht"><i
class="fa-regular fa-eye"></i></span>
@@ -437,7 +437,7 @@ endforeach;
</div>
</div>
<div class="row justify-content-center">
<div class="row justify-content-center hide-cancelled">
<div class="col-4">
<div class="input-group mb-2">
@@ -448,7 +448,7 @@ endforeach;
aria-describedby="Datum">
</div>
</div>
<div class="col-2">
<div class="col-2 ">
<input id="start-time" type="time" class="form-control is-require eventmodal-input"
placeholder="Uhrzeit"
aria-label="Uhrzeit"
@@ -475,7 +475,7 @@ endforeach;
</div>
</div>
</div>
<div class="row justify-content-center">
<div class="row justify-content-center hide-cancelled">
<div class="col-4">
<div class="input-group mb-2">
@@ -592,7 +592,7 @@ endforeach;
</div>
</div>
<div class="row justify-content-center mt-2">
<div class="row justify-content-center mt-2 hide-cancelled">
<div class="col-2">
<label for="name" class="col-form-label fw-medium ">Kalender</label>
</div>
@@ -613,7 +613,7 @@ endforeach;
</div>
</div>
</div>
<div style="display:none;" class="row justify-content-center mt-2 event-organizer-div">
<div style="display:none;" class="row justify-content-center mt-2 event-organizer-div hide-cancelled">
<div class="col-2">
<label for="name" class="col-form-label fw-medium ">Organisator</label>
</div>
@@ -630,7 +630,7 @@ endforeach;
</div>
</div>
<div class="row justify-content-center mt-2">
<div class="row justify-content-center mt-2 hide-cancelled">
<div class="col-2">
<label for="name" class="col-form-label fw-medium ">Teilnehmer <span
class="ml-1 calendar-users-all" style="display: none"><i
@@ -648,7 +648,7 @@ endforeach;
</div>
</div>
<div class="row mt-2 justify-content-center">
<div class="row mt-2 justify-content-center hide-cancelled">
<div class="col-10">
<label for="location" class="col-form-label fw-medium">Beschreibung</label>
<textarea class="form-control eventmodal-input" id="description" rows="2"></textarea>
@@ -660,12 +660,19 @@ endforeach;
<label for="location" class="col-form-label fw-medium">Kunde</label>
<div class="form-check ml-3" style="margin-top: 7px;display:inline-block">
<div class="d-inline-block">
<input class="form-check-input eventmodal-checkbox" type="checkbox" value=""
<input class="form-check-input eventmodal-checkbox hide-cancelled" type="checkbox" value=""
id="customer-info-check">
<label class="form-check-label fw-medium checkbox-label" for="customer-info-check">
<label class="form-check-label fw-medium checkbox-label hide-cancelled" for="customer-info-check">
Info senden
</label>
</div>
<div class="d-inline-block">
<input class="form-check-input eventmodal-checkbox show-cancelled" type="checkbox" value=""
id="customer-info-check-cancelled">
<label class="form-check-label fw-medium checkbox-label show-cancelled" for="customer-info-check-cancelled">
Absage senden
</label>
</div>
<div class="d-inline-block ml-2">
<div class="dropdown">
<button style="padding: 1px 8px;" id="preview-button"
@@ -678,9 +685,9 @@ endforeach;
</div>
</div>
<div class="d-inline-block ml-4">
<input class="form-check-input eventmodal-checkbox" type="checkbox" value=""
<input class="form-check-input eventmodal-checkbox hide-cancelled" type="checkbox" value=""
id="customer-info-reminder-check">
<label class="form-check-label fw-medium checkbox-label"
<label class="form-check-label fw-medium checkbox-label hide-cancelled"
for="customer-info-reminder-check">
1 Tages Reminder
</label>
@@ -712,7 +719,7 @@ endforeach;
</div>
</div>
</div>
<div class="ticket-div">
<div class="ticket-div hide-cancelled">
<div class="row mt-2 justify-content-center">
<div class="col-2">
@@ -725,8 +732,8 @@ endforeach;
</div>
</div>
</div>
<div id="documents" class="row mt-2 mb-2 justify-content-center">
<div class="col-10" id="attachments" data-newkey="">
<div id="documents" class="row mt-2 mb-2 justify-content-center ">
<div class="col-10 hide-cancelled" id="attachments" data-newkey="">
<label class="col-form-label fw-medium">Anlagen</label>
<div class="input-group mb-2">
@@ -745,24 +752,30 @@ endforeach;
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" id="add-event">Hinzufügen</button>
<button type="button" class="btn btn-success hide-cancelled" id="add-event">Hinzufügen</button>
<button style="display:none" type="button" data-event-action="accept"
class="btn btn-success show-attendee">
class="btn btn-success show-attendee hide-cancelled">
Zusagen
</button>
<button style="display:none" type="button" data-event-action="decline"
class="btn btn-danger show-attendee">
class="btn btn-danger show-attendee hide-cancelled">
Absagen
</button>
<button style="display:none" type="button" class="btn btn-success show-update" id="update-event">
<button style="display:none" type="button" class="btn btn-success show-update hide-cancelled" id="update-event">
Speichern
</button>
<button style="display:none" type="button" class="btn btn-danger show-update" id="delete-event">
<button style="display:none" type="button" class="btn btn-primary show-update hide-cancelled" id="cancel-event">
Termin Absage
</button>
<button style="display:none" type="button" class="btn btn-danger show-update hide-cancelled" id="delete-event">
Löschen
</button>
<button style="display:none" type="button" class="btn btn-danger show-cancelled" id="cancelled-event">
Absagen
</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
<button type="button" class="btn btn-primary show-cancelled" id="cancelled-abort">Zurück</button>
</div>
</div>
</div>
@@ -791,6 +804,7 @@ endforeach;
let requestUpdateStateUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'updateCalendarEventState']) ?>";
let requestUpdateColorUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'updateCalendarColor']) ?>";
let requestDeleteUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'deleteCalendarEvent']) ?>";
let requestCancelUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'cancelCalendarEvent']) ?>";
let requestUpdateEventsUrl = "<?= self::getUrl("api/v1/calendar")?>/calendarStream?user=<?= $encryptedUser ?>";
let requestgetpreviewtUrl = "<?= self::getUrl("CalendarTemplate", "api", ['do' => 'getPreview']) ?>";
let calendarRights = '<?php echo json_encode($rights); ?>';

View File

@@ -168,6 +168,44 @@ class CalendarController extends mfBaseController
$id = ($r->id);
CalendarModel::deleteCalendarEvent($r);
die();
case "cancelCalendarEvent":
$r = $this->request;
$id = ($r->id);
if ($r->customer_info_check) {
if ($r->customer_info_type == 1) {
$body = $r->customer_info_text;
$email = new Emailnotification();
$email->setSubject('Technikertermin Xinon Absage');
$email->setBody($body);
$email->setFrom('termin@xinon.at', 'Terminbestätigung');
$email->setTo($r->customer_info_type_text);
$email->send();
} else if ($r->customer_info_type == 2) {
$sms = new SmsNotification();
$customerText = trim($r->customer_info_text);
$body = "Xinon Terminabsage:" . PHP_EOL . $customerText;
$sms->setBody($body);
$customerNumber = trim($r->customer_info_type_text);
$customerNumber = str_replace(" ", "", $customerNumber);
$customerNumber = str_replace("(", "", $customerNumber);
$customerNumber = str_replace(")", "", $customerNumber);
$customerNumber = str_replace("-", "", $customerNumber);
$customerNumber = str_replace("/", "", $customerNumber);
$customerNumber = str_replace(".", "", $customerNumber);
$customerNumber = str_replace(",", "", $customerNumber);
$customerNumber = str_replace(";", "", $customerNumber);
$customerNumber = str_replace(":", "", $customerNumber);
if (preg_match('/^0/', $customerNumber)) {
$customerNumber = "+43" . substr($customerNumber, 1);
}
$sms->setRecipient($customerNumber);
if (!empty($customerNumber) && !empty($customerText)) {
$sms->send();
}
}
}
CalendarModel::cancelCalendarEvent($r,$this->me);
die();
case "updateCalendarColor":
$r = $this->request;
$calendar_id = ($r->calendar_id);

View File

@@ -461,7 +461,7 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
}
$Allcalendar['Daniel Whoknows'] = 2;
$Allcalendar['Stefan Plaschg'] = 26;
$res = $dbcal->select("cal_events", "id, uuid, calendar_id, user_id, start_time, end_time, timezone, all_day_event, name, description, location, repeat_end_time, reminder, ctime, mtime, muser_id, busy, status, resource_event_id, private, rrule, background, files_folder_id, read_only, category_id, exception_for_event_id, recurrence_id, recurrence, is_organizer,event_type,customer,customer_info,customer_info_send,customer_info_reminder,busy,attendees,organizer,is_organizer,accepted", "1=1 AND id='" . $id . "' ORDER BY id");
$res = $dbcal->select("cal_events", "id, uuid, calendar_id, user_id, start_time, end_time, timezone, all_day_event, name, description, location, repeat_end_time, reminder, ctime, mtime, muser_id, busy, status, resource_event_id, private, rrule, background, files_folder_id, read_only, category_id, exception_for_event_id, recurrence_id, recurrence, is_organizer,event_type,customer,customer_info,customer_info_send,customer_info_reminder,busy,attendees,organizer,is_organizer,accepted,canceld", "1=1 AND id='" . $id . "' ORDER BY id");
if ($dbcal->num_rows($res)) {
$data = $dbcal->fetch_array($res);
if ($data['recurrence']) {
@@ -559,6 +559,7 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
'customer_info_reminder' => array('customer_info_reminder' => $data['customer_info_reminder']),
'privateflag' => array('privateflag' => $data['private'], 'order' => $data['private']),
'isorganizer' => array('isorganizer' => $data['is_organizer']),
'canceld' => array('canceld' => $data['canceld']),
'attendees' => array('attendees' => json_encode($AttendeeArray)),
'organizer' => array('organizer' => self::replace_unicode_sequences($data['organizer'])),
'accepted' => array('accepted' => $data['accepted']),
@@ -997,6 +998,103 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
die();
}
public static function cancelCalendarEvent($r,$me)
{
$id = $r->id;
$users = $r->users;
foreach ($users as $key => $value) {
$user_id = $value;
}
date_default_timezone_set('Europe/Berlin');
header('Content-Type: application/json');
$db = self::dbKalender();
$res = $db->select("cal_calendars", "id,ms_user_id", "id = '" . $user_id . "' LIMIT 1");
if ($db->num_rows($res)) {
$result = $db->fetch_object($res);
$microsoft_user_id = $result->ms_user_id;
}
$updateArray = [];
$res = $db->select("cal_events", 'id,microsoft_id,name,microsoft_ical_uid,start_time,end_time', "id = '" . $id . "' LIMIT 1");
if ($db->num_rows($res)) {
$result = $db->fetch_object($res);
if (($r->customer_info_type)) {
$customer_info_type = $r->customer_info_type;
}
if (($r->customer_info_text)) {
$customer_info_text = $r->customer_info_text;
}
if (($r->customer_info_type_text)) {
$customer_info_type_text = $r->customer_info_type_text;
}
$customerJson = array('customer_info_type' => $customer_info_type, 'customer_info_text' => $customer_info_text, 'customer_info_type_text' => $customer_info_type_text);
$updateArray['customer_info'] = json_encode($customerJson);
if ($r->customer_info_check) {
$customerJson['sendby'] = $me->name;
$customerJson['sendtime'] = time();
$updateArray['customer_info_send'] = json_encode($customerJson);
}
$newname = "Absage: " . $result->name;
$microsoft_id = $result->microsoft_id;
$updateArray['name'] = $newname;
$updateArray['busy'] = '0';
$updateArray['start_time'] = $result->start_time;
$updateArray['end_time'] = $result->end_time;
$updateArray['customer_info_reminder'] = 0;
$updateArray['canceld'] = 1;
$db->update("cal_events", $updateArray, "id = '" . $id . "'");
$json_data = json_encode($updateArray);
$data = [];
$data['ms_user_id'] = $microsoft_user_id;
$data['ms_event_id'] = $microsoft_id;
$data['data'] = $json_data;
$data['type'] = 'u';
$data['status'] = 'p';
$data['edit'] = time();
$data['create'] = time();
$data['edit_by'] = 89;
$data['create_by'] = 89;
$db->insert("TheTool_CalendarQueue", $data);
$res = $db->select("cal_events", 'id,microsoft_id,name,microsoft_ical_uid,start_time,end_time,calendar_id', "id != '" . $id . "' AND microsoft_ical_uid = '" . $result->microsoft_ical_uid . "' ");
while ($row = $db->fetch_object($res)) {
$updateArray = [];
$updateArray['name'] = $newname;
$updateArray['busy'] = '0';
$updateArray['start_time'] = $row->start_time;
$updateArray['end_time'] = $row->end_time;
$updateArray['customer_info_reminder'] = 0;
$updateArray['canceld'] = 1;
$updateArray['customer_info'] = json_encode($customerJson);
if ($r->customer_info_check) {
$customerJson['sendby'] = $me->name;
$customerJson['sendtime'] = time();
$updateArray['customer_info_send'] = json_encode($customerJson);
}
$db->update("cal_events", $updateArray, "id = '" . $row->id . "'");
$json_data = json_encode($updateArray);
$rescal = $db->select("cal_calendars", "id,ms_user_id", "id = '" . $row->calendar_id . "' LIMIT 1");
$resultcal = $db->fetch_object($rescal);
$data = [];
$data['ms_user_id'] = $resultcal->ms_user_id;
$data['ms_event_id'] = $row->microsoft_id;
$data['data'] = $json_data;
$data['type'] = 'u';
$data['status'] = 'p';
$data['edit'] = time();
$data['create'] = time();
$data['edit_by'] = 89;
$data['create_by'] = 89;
$db->insert("TheTool_CalendarQueue", $data);
}
}
die();
}
public static function generateDataRecurrence($graph)
{
$data = [];

View File

@@ -425,13 +425,20 @@ thead .fc-day-today .fc-scrollgrid-sync-inner .fc-col-header-cell-cushion {
}
.fa-calendar-lines-pen:before {
color: #ff0000;
color: #ff6200;
}
.fa-calendar-circle-plus:before {
color: #0d9f00;
}
.fa-calendar-circle-exclamation
{
color: #ff0000;
}
.fa-del-attachment {
color: #ff0000;
cursor: pointer;

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');
}
}