Merge branch 'spidev' into 'master'
Kalenderupdate See merge request fronk/thetool!1813
This commit is contained in:
@@ -29,21 +29,129 @@ const fileTypeClasses = {
|
||||
let calendar;
|
||||
let calendarEl = document.getElementById('calendar');
|
||||
calendarRights = JSON.parse(calendarRights);
|
||||
/*function reinitializeAttendeesSelect() {
|
||||
var selectedCalendarId = $('#calendar-users').val();
|
||||
var selectedOption = $('#calendar-users option:selected');
|
||||
var hasMicrosoftId = selectedOption.data('has-microsoft-id');
|
||||
if ($('#calendar-attendees').hasClass('select2-hidden-accessible')) {
|
||||
$('#calendar-attendees').select2('destroy');
|
||||
}
|
||||
if (hasMicrosoftId == '1') {
|
||||
$('#calendar-attendees').select2({
|
||||
tags: true,
|
||||
tokenSeparators: [',', ' '],
|
||||
dropdownParent: jQuery('#relContainer'),
|
||||
placeholder: "Teilnehmer auswählen oder eingeben",
|
||||
templateResult: function(data) {
|
||||
if (!data.id) return data.text;
|
||||
var $option = $(data.element);
|
||||
var hasMs = $option.data('has-microsoft-id');
|
||||
|
||||
if (hasMs == '0') {
|
||||
return $('<span style="color: #dc3545; font-weight: bold;">' + data.text + '</span>');
|
||||
}
|
||||
return data.text;
|
||||
},
|
||||
templateSelection: function(data) {
|
||||
if (!data.id) return data.text;
|
||||
var $option = $(data.element);
|
||||
var hasMs = $option.data('has-microsoft-id');
|
||||
|
||||
if (hasMs == '0') {
|
||||
return $('<span style="color: #dc3545; font-weight: bold;">' + data.text + '</span>');
|
||||
}
|
||||
return data.text;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('#calendar-attendees').select2({
|
||||
dropdownParent: jQuery('#relContainer'),
|
||||
placeholder: "Teilnehmer auswählen (Freitext nicht verfügbar)",
|
||||
closeOnSelect: false,
|
||||
templateResult: function(data) {
|
||||
if (!data.id) return data.text;
|
||||
var $option = $(data.element);
|
||||
var hasMs = $option.data('has-microsoft-id');
|
||||
|
||||
if (hasMs == '0') {
|
||||
return $('<span style="color: #dc3545; font-weight: bold;">' + data.text + '</span>');
|
||||
}
|
||||
return data.text;
|
||||
},
|
||||
templateSelection: function(data) {
|
||||
if (!data.id) return data.text;
|
||||
var $option = $(data.element);
|
||||
var hasMs = $option.data('has-microsoft-id');
|
||||
|
||||
if (hasMs == '0') {
|
||||
return $('<span style="color: #dc3545; font-weight: bold;">' + data.text + '</span>');
|
||||
}
|
||||
return data.text;
|
||||
}
|
||||
});
|
||||
}
|
||||
}*/
|
||||
function reinitializeAttendeesSelect() {
|
||||
var selectedCalendarId = $('#calendar-users').val();
|
||||
var selectedOption = $('#calendar-users option:selected');
|
||||
var hasMicrosoftId = selectedOption.data('has-microsoft-id');
|
||||
|
||||
// ÄNDERUNG: Verstecke/Deaktiviere Teilnehmer-Zeile wenn keine Microsoft-ID
|
||||
if (hasMicrosoftId == '0' || hasMicrosoftId === 0 || !hasMicrosoftId) {
|
||||
// Verstecke die gesamte Teilnehmer-Zeile
|
||||
$('#calendar-attendees').closest('.row').hide();
|
||||
// Optional: Leere auch die Auswahl
|
||||
$('#calendar-attendees').val(null).trigger('change');
|
||||
return; // Beende Funktion früh
|
||||
} else {
|
||||
// Zeige die Teilnehmer-Zeile wieder an
|
||||
$('#calendar-attendees').closest('.row').show();
|
||||
}
|
||||
// Zerstöre bestehende Select2 Instanz
|
||||
if ($('#calendar-attendees').hasClass('select2-hidden-accessible')) {
|
||||
$('#calendar-attendees').select2('destroy');
|
||||
}
|
||||
|
||||
|
||||
// ÄNDERUNG: Initialisiere mit tags (Freitext erlaubt)
|
||||
$('#calendar-attendees').select2({
|
||||
tags: true,
|
||||
tokenSeparators: [',', ' '],
|
||||
dropdownParent: jQuery('#relContainer'),
|
||||
placeholder: "Teilnehmer auswählen oder eingeben",
|
||||
templateResult: function(data) {
|
||||
if (!data.id) return data.text;
|
||||
var $option = $(data.element);
|
||||
var hasMs = $option.data('has-microsoft-id');
|
||||
|
||||
if (hasMs == '0') {
|
||||
return $('<span style="">' + data.text + '</span>');
|
||||
}
|
||||
return data.text;
|
||||
},
|
||||
templateSelection: function(data) {
|
||||
if (!data.id) return data.text;
|
||||
var $option = $(data.element);
|
||||
var hasMs = $option.data('has-microsoft-id');
|
||||
|
||||
if (hasMs == '0') {
|
||||
return $('<span style="">' + data.text + '</span>');
|
||||
}
|
||||
return data.text;
|
||||
}
|
||||
});
|
||||
}
|
||||
function formatFileSize(bytes) {
|
||||
// Wenn die Dateigröße größer als 1 MB ist
|
||||
if (bytes >= 1024 * 1024) {
|
||||
const megabytes = bytes / (1024 * 1024);
|
||||
return megabytes.toFixed(2) + ' MB';
|
||||
}
|
||||
// Wenn die Dateigröße größer als 1 KB ist
|
||||
else if (bytes >= 1024) {
|
||||
const kilobytes = bytes / 1024;
|
||||
return kilobytes.toFixed(2) + ' KB';
|
||||
}
|
||||
// Wenn die Dateigröße kleiner als 1 KB ist (also in Bytes)
|
||||
else {
|
||||
return Math.round(bytes) + ' Bytes'; // Keine Nachkommastellen
|
||||
return Math.round(bytes) + ' Bytes';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +178,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
});
|
||||
|
||||
|
||||
$.post(requestUrl, {visibleCalendars: visibleCalendars, visibleCancellation: 1}, function (data) {
|
||||
$.post(requestUrl, {visibleCalendars: visibleCalendars, visibleCancellation: 0}, function (data) {
|
||||
|
||||
}, 'json').done(function (json) {
|
||||
if (json.success == true) {
|
||||
@@ -2594,15 +2702,6 @@ $(document).ready(function () {
|
||||
}
|
||||
);
|
||||
|
||||
$('.select2-multiple-tag').select2(
|
||||
{
|
||||
tags: true,
|
||||
tokenSeparators: [',', ' '],
|
||||
dropdownParent: jQuery('#relContainer')
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// $(document).on("select2:opening", (e) => {
|
||||
// $('.modal-body').css('overflow', 'visible');
|
||||
// });
|
||||
@@ -2637,7 +2736,6 @@ $(document).ready(function () {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$.post(requestUrl, {
|
||||
visibleCalendars: visibleCalendars,
|
||||
visibleCalendarTypes: visibleCalendarTypes,
|
||||
@@ -2902,5 +3000,8 @@ $(document).ready(function () {
|
||||
localsorageEvent = JSON.parse(create_event);
|
||||
$('#EventModal').modal('show');
|
||||
}
|
||||
|
||||
$('body').on('change', '#calendar-users', function() {
|
||||
reinitializeAttendeesSelect();
|
||||
});
|
||||
reinitializeAttendeesSelect();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user