Student
+ {#each $lessons as lesson, index} ++ {getLectureNo(index + 1)} +
+ {/each} +{student.profile.fullname}
+{`#${student.assigned_student_id}` || '-'}
++ { + const attendanceItem = $attendance[student.id] + ? $attendance[student.id][lesson.id] || {} + : {}; + const data = { + id: attendanceItem.id, + student_id: student.id, + is_present: e.target.checked, + lesson_id: lesson.id, + course_id: courseId, + }; + + takeAttendance(data).then((res) => { + if (res.error) { + console.error(`res.error`, res.error); + $snackbarStore.open = true; + $snackbarStore.severity = SNACKBAR_SEVERITY.ERROR; + $snackbarStore.message = "Something isn't right."; + } else { + console.log('res', res); + const { id, is_present } = res.data[0]; + $attendance[student.id][lesson.id] = { + id, + is_present, + }; + } + }); + }} + /> +
+ {/each} +