3 options Yes, No, Blank

This commit is contained in:
Greg 2025-05-10 17:51:54 +02:00
parent c80ce1acb8
commit 9987faba08
2 changed files with 13 additions and 4 deletions

View File

@ -80,17 +80,25 @@ function renderTable() {
const td = document.createElement('td');
td.className = 'clickable name-col';
const key = `${date}|${colIdx}`;
if (data.attendance[key]) {
if (data.attendance[key] === true) {
td.innerText = 'Yes';
td.classList.add('yes');
td.classList.remove('no');
} else if (data.attendance[key] === 'no') {
td.innerText = 'No';
td.classList.add('no');
td.classList.remove('yes');
} else {
td.innerText = '';
td.classList.remove('yes', 'no');
}
td.onclick = () => {
if (data.attendance[key]) {
delete data.attendance[key];
} else {
if (!data.attendance[key]) {
data.attendance[key] = true;
} else if (data.attendance[key] === true) {
data.attendance[key] = 'no';
} else if (data.attendance[key] === 'no') {
delete data.attendance[key];
}
saveData();
renderTable();

View File

@ -21,6 +21,7 @@
box-shadow: 0 0 0 2px #94897966;
}
.yes { background: #948979; font-weight: bold; color: #222831; }
.no { background: #393E46; color: #948979; font-weight: bold; }
input[type="text"] {
width: 90%;
padding: 0.2em;