fix refresh conflict

This commit is contained in:
2023-02-03 21:51:54 +08:00
parent 27f2bbdb47
commit 5e016dccef

View File

@@ -29,7 +29,7 @@ const Timetable = ({ user }) => {
if (input.checked) { if (input.checked) {
alert("Error: Conflict select"); alert("Error: Conflict select");
location.reload(); location.reload();
return return;
} }
} }
for (const input of conflicts[target.name]) { for (const input of conflicts[target.name]) {
@@ -149,7 +149,15 @@ const Timetable = ({ user }) => {
} else { } else {
indexToElement[index].style.display = ""; indexToElement[index].style.display = "";
} }
indexToElement[index].checked = myselect.includes(index); const includes = myselect.includes(index);
indexToElement[index].checked = includes;
// after checked, find conflicts input
if (includes) {
for (const input of conflicts[index]) {
console.log("conflict", input);
input.setAttribute("disabled", "true");
}
}
} }
}; };
React.useEffect(() => { React.useEffect(() => {