feat(calendar): add 'Pro Tag' moderator-count selector
This commit is contained in:
1 parent
69e424519d
commit
3b84fce1e6
1 file changed
+19
-1
+19
-1
@@ -47,6 +47,18 @@ export function renderCalendar() {
|
||||
yearOpt.selected = true;
|
||||
yearSel.appendChild(yearOpt);
|
||||
|
||||
const slotsLabel = document.createElement('label');
|
||||
slotsLabel.textContent = 'Pro Tag:';
|
||||
|
||||
const slotsSel = document.createElement('select');
|
||||
for (let n = 1; n <= 5; n++) {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = String(n);
|
||||
opt.textContent = String(n);
|
||||
if (n === state.settings.moderatorsPerDay) opt.selected = true;
|
||||
slotsSel.appendChild(opt);
|
||||
}
|
||||
|
||||
const genBtn = document.createElement('button');
|
||||
genBtn.type = 'button';
|
||||
genBtn.className = 'primary';
|
||||
@@ -57,7 +69,7 @@ export function renderCalendar() {
|
||||
exportBtn.textContent = 'Als Excel exportieren';
|
||||
exportBtn.style.display = 'none';
|
||||
|
||||
controls.append(monthLabel, monthSel, yearLabel, yearSel, genBtn, exportBtn);
|
||||
controls.append(monthLabel, monthSel, yearLabel, yearSel, slotsLabel, slotsSel, genBtn, exportBtn);
|
||||
container.appendChild(controls);
|
||||
|
||||
// Legend
|
||||
@@ -89,6 +101,12 @@ export function renderCalendar() {
|
||||
renderGrid(wrapper, exportBtn);
|
||||
});
|
||||
|
||||
slotsSel.addEventListener('change', () => {
|
||||
state.settings.moderatorsPerDay = parseInt(slotsSel.value, 10);
|
||||
saveState();
|
||||
renderGrid(wrapper, exportBtn);
|
||||
});
|
||||
|
||||
genBtn.addEventListener('click', () => {
|
||||
if (state.employees.length === 0) {
|
||||
alert('Bitte zuerst Mitarbeiter hinzufügen.');
|
||||
|
||||
Reference in new issue
Block a user