Add daily standup toggle slider and clear-all-tasks button to dashboard

This commit is contained in:
eric 2026-02-22 09:56:12 +00:00
parent c82ecdd5f1
commit 86dc556c4e
2 changed files with 127 additions and 4 deletions

View file

@ -76,6 +76,34 @@
{% endfor %}
</div>
<!-- System-Steuerung -->
<div class="card mb-4">
<div class="card-body">
<h5 style="margin-bottom:1rem;font-weight:600;">System-Steuerung</h5>
<div class="d-flex align-items-center justify-content-between flex-wrap gap-3">
<!-- Daily Standup Toggle -->
<div class="d-flex align-items-center gap-3">
<div>
<div style="font-weight:500;font-size:.9rem;">Daily Standup</div>
<div style="font-size:.78rem;color:var(--text-muted);">Täglich 09:00 automatische Statusabfrage</div>
</div>
<div class="form-check form-switch mb-0">
<input class="form-check-input" type="checkbox" role="switch" id="standupToggle"
{% if standup_enabled %}checked{% endif %}
style="width:2.5em;height:1.4em;cursor:pointer;">
</div>
<span id="standupLabel" class="badge {% if standup_enabled %}bg-success{% else %}bg-secondary{% endif %}">
{% if standup_enabled %}Aktiv{% else %}Inaktiv{% endif %}
</span>
</div>
<!-- Tasks leeren -->
<button id="clearTasksBtn" class="btn btn-outline-danger btn-sm" onclick="clearAllTasks()">
Alle Tasks leeren
</button>
</div>
</div>
</div>
<!-- Recent Tasks -->
{% if recent_tasks %}
<div class="d-flex align-items-center justify-content-between mb-3">
@ -123,4 +151,67 @@
</div>
</div>
{% endif %}
<script>
// Daily Standup Toggle
document.getElementById('standupToggle').addEventListener('change', function() {
const enabled = this.checked;
const label = document.getElementById('standupLabel');
fetch('/api/standup/toggle', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({enabled: enabled})
})
.then(r => r.json())
.then(data => {
if (data.success) {
label.textContent = enabled ? 'Aktiv' : 'Inaktiv';
label.className = 'badge ' + (enabled ? 'bg-success' : 'bg-secondary');
} else {
// Revert on error
this.checked = !enabled;
alert('Fehler: ' + data.message);
}
})
.catch(() => {
this.checked = !enabled;
alert('Netzwerkfehler beim Speichern.');
});
});
// Alle Tasks leeren
function clearAllTasks() {
if (!confirm('Alle Tasks wirklich löschen? Dies kann nicht rückgängig gemacht werden.')) return;
const btn = document.getElementById('clearTasksBtn');
btn.disabled = true;
btn.textContent = 'Löschen...';
fetch('/api/tasks/clear', {method: 'POST'})
.then(r => r.json())
.then(data => {
if (data.success) {
// Task-Tabelle aus DOM entfernen falls vorhanden
const taskSection = document.querySelector('.table-responsive');
if (taskSection) taskSection.closest('.card').remove();
const taskHeader = document.querySelectorAll('h3');
taskHeader.forEach(h => { if (h.textContent.includes('Letzte Tasks')) h.closest('.d-flex').remove(); });
btn.textContent = 'Geleert';
btn.className = 'btn btn-success btn-sm';
setTimeout(() => {
btn.textContent = 'Alle Tasks leeren';
btn.className = 'btn btn-outline-danger btn-sm';
btn.disabled = false;
}, 2000);
} else {
alert('Fehler: ' + data.message);
btn.disabled = false;
btn.textContent = 'Alle Tasks leeren';
}
})
.catch(() => {
alert('Netzwerkfehler.');
btn.disabled = false;
btn.textContent = 'Alle Tasks leeren';
});
}
</script>
{% endblock %}