diff --git a/components/Timetable.tsx b/components/Timetable.tsx index 57ff86c..e3024c6 100644 --- a/components/Timetable.tsx +++ b/components/Timetable.tsx @@ -29,7 +29,7 @@ const Timetable = ({ user }) => { if (input.checked) { alert("Error: Conflict select"); location.reload(); - return + return; } } for (const input of conflicts[target.name]) { @@ -149,7 +149,15 @@ const Timetable = ({ user }) => { } else { 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(() => {