Add latest changes
Dieser Commit ist enthalten in:
@@ -174,6 +174,19 @@
|
||||
Jede generierte Lizenz kann auf maximal dieser Anzahl von Geräten gleichzeitig aktiviert werden.
|
||||
</small>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="concurrentSessions" class="form-label">
|
||||
Max. gleichzeitige Sessions pro Lizenz
|
||||
</label>
|
||||
<select class="form-select" id="concurrentSessions" name="max_concurrent_sessions" required>
|
||||
{% for i in range(1, 11) %}
|
||||
<option value="{{ i }}" {% if i == 1 %}selected{% endif %}>{{ i }} {% if i == 1 %}Session{% else %}Sessions{% endif %}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<small class="form-text text-muted">
|
||||
Wie viele Geräte können gleichzeitig online sein. Muss kleiner oder gleich dem Gerätelimit sein.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -246,6 +259,30 @@ document.getElementById('validFrom').addEventListener('change', calculateValidUn
|
||||
document.getElementById('duration').addEventListener('input', calculateValidUntil);
|
||||
document.getElementById('durationType').addEventListener('change', calculateValidUntil);
|
||||
|
||||
// Funktion zur Anpassung der max_concurrent_sessions Optionen
|
||||
function updateConcurrentSessionsOptions() {
|
||||
const deviceLimit = parseInt(document.getElementById('deviceLimit').value);
|
||||
const concurrentSelect = document.getElementById('concurrentSessions');
|
||||
const currentValue = parseInt(concurrentSelect.value);
|
||||
|
||||
// Clear current options
|
||||
concurrentSelect.innerHTML = '';
|
||||
|
||||
// Add new options up to device limit
|
||||
for (let i = 1; i <= Math.min(deviceLimit, 10); i++) {
|
||||
const option = document.createElement('option');
|
||||
option.value = i;
|
||||
option.text = i + (i === 1 ? ' Session' : ' Sessions');
|
||||
if (i === Math.min(currentValue, deviceLimit)) {
|
||||
option.selected = true;
|
||||
}
|
||||
concurrentSelect.appendChild(option);
|
||||
}
|
||||
}
|
||||
|
||||
// Event Listener für Device Limit Änderungen
|
||||
document.getElementById('deviceLimit').addEventListener('change', updateConcurrentSessionsOptions);
|
||||
|
||||
// Setze heutiges Datum als Standard
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
@@ -510,5 +547,51 @@ function showCustomerTypeIndicator(type) {
|
||||
function hideCustomerTypeIndicator() {
|
||||
document.getElementById('customerTypeIndicator').classList.add('d-none');
|
||||
}
|
||||
|
||||
// Validation for concurrent sessions vs device limit
|
||||
document.getElementById('deviceLimit').addEventListener('change', validateSessionLimit);
|
||||
document.getElementById('concurrentSessions').addEventListener('change', validateSessionLimit);
|
||||
|
||||
function validateSessionLimit() {
|
||||
const deviceLimit = parseInt(document.getElementById('deviceLimit').value);
|
||||
const concurrentSessions = parseInt(document.getElementById('concurrentSessions').value);
|
||||
const sessionsSelect = document.getElementById('concurrentSessions');
|
||||
|
||||
// Update options to not exceed device limit
|
||||
sessionsSelect.innerHTML = '';
|
||||
for (let i = 1; i <= Math.min(10, deviceLimit); i++) {
|
||||
const option = document.createElement('option');
|
||||
option.value = i;
|
||||
option.textContent = i + (i === 1 ? ' Session' : ' Sessions');
|
||||
if (i === Math.min(concurrentSessions, deviceLimit)) {
|
||||
option.selected = true;
|
||||
}
|
||||
sessionsSelect.appendChild(option);
|
||||
}
|
||||
|
||||
// Show warning if adjusted
|
||||
if (concurrentSessions > deviceLimit) {
|
||||
const toast = document.createElement('div');
|
||||
toast.className = 'toast align-items-center text-white bg-warning border-0 position-fixed bottom-0 end-0 m-3';
|
||||
toast.setAttribute('role', 'alert');
|
||||
toast.innerHTML = `
|
||||
<div class="d-flex">
|
||||
<div class="toast-body">
|
||||
Gleichzeitige Sessions wurden auf ${deviceLimit} angepasst (Max. Gerätelimit).
|
||||
</div>
|
||||
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast"></button>
|
||||
</div>
|
||||
`;
|
||||
document.body.appendChild(toast);
|
||||
const bsToast = new bootstrap.Toast(toast);
|
||||
bsToast.show();
|
||||
setTimeout(() => toast.remove(), 5000);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize validation on page load
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
validateSessionLimit();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren