diff --git a/client/src/entities/teacher-reported-today.jsx b/client/src/entities/teacher-reported-today.jsx index 13224eca..0b11b0bf 100644 --- a/client/src/entities/teacher-reported-today.jsx +++ b/client/src/entities/teacher-reported-today.jsx @@ -62,16 +62,24 @@ function groupByKlass(groups) { }); } +// Total missing girls for the whole card: sum across its lessons, or the card's own +// count when it has no per-lesson breakdown (the "ללא שיוך שיעור" case). +function getTotalMissingGirls(group) { + return group.lessonRows.length > 0 + ? group.lessonRows.reduce((sum, row) => sum + (row.missingGirlsCount || 0), 0) + : group.missingGirlsCount || 0; +} + const TeacherReportCards = ({ isAdmin }) => { const { data } = useListContext(); const groups = groupByTeacherAndDate(data || []); const columns = groupByKlass(groups); return ( - + {columns.map((column) => ( - - + + {column.klassReferenceId ? ( @@ -80,42 +88,50 @@ const TeacherReportCards = ({ isAdmin }) => { ) : 'ללא כיתה'} - - {column.groups.map((group) => ( - - - - - - - - - - + + {column.groups.map((group) => { + const totalMissingGirls = getTotalMissingGirls(group); + return ( + + + + + + + + + + {totalMissingGirls > 0 && ( + + חסרו {totalMissingGirls} + + )} + + {isAdmin && } - {formatDate(group.reportDate)} - {formatHour(group.reportHour)} + {formatDate(group.reportDate)} + {formatHour(group.reportHour)} - - - {group.lessonRows.length > 0 ? ( - group.lessonRows.map((row) => ( - - - - - - - - )) - ) : ( - ללא שיוך שיעור - )} - - - - - ))} + + {group.lessonRows.length > 0 ? ( + group.lessonRows.map((row) => ( + + + + + + + + )) + ) : ( + ללא שיוך שיעור + )} + + + + + ); + })} ))}