refactor(helpdesk): reuse segment-control pattern for team period selector

Replace custom button-based period selector with the existing
helpdesk-segment-control radio+label pattern used in the controlling
dashboard. Removes duplicate CSS and ensures visual consistency.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-05 18:49:16 +02:00
parent cae66e5361
commit 0bbc448bcd
3 changed files with 10 additions and 39 deletions

View File

@@ -13,7 +13,7 @@ if (container) {
const elContent = document.getElementById('team-content');
const elBody = document.getElementById('team-table-body');
const elRefresh = container.querySelector('button[name="team-refresh"]');
const periodButtons = container.querySelectorAll('.helpdesk-team-period-button');
const periodSelector = document.getElementById('team-period-selector');
let currentPeriod = 90;
@@ -97,17 +97,13 @@ if (container) {
}
}
for (const button of periodButtons) {
button.addEventListener('click', () => {
const period = parseInt(button.dataset.period, 10);
if (period === currentPeriod) return;
if (periodSelector) {
periodSelector.addEventListener('change', (e) => {
const radio = e.target.closest('input[name="team-period"]');
if (!radio) return;
const period = parseInt(radio.value, 10);
if (!period || period === currentPeriod) return;
currentPeriod = period;
for (const b of periodButtons) {
b.classList.toggle('active', b === button);
b.setAttribute('aria-pressed', b === button ? 'true' : 'false');
}
fetchData();
});
}