3 options Yes, No, Blank
This commit is contained in:
parent
c80ce1acb8
commit
9987faba08
@ -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();
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user