diff --git a/client/src/entities/teacher-reported-today.jsx b/client/src/entities/teacher-reported-today.jsx index 1e9d78fb..1d050d47 100644 --- a/client/src/entities/teacher-reported-today.jsx +++ b/client/src/entities/teacher-reported-today.jsx @@ -1,11 +1,13 @@ -import { DateInput, ReferenceField, RecordContextProvider, TextField, useListContext, usePermissions } from 'react-admin'; -import { Box, Card, Typography } from '@mui/material'; +import { useState } from 'react'; +import { DateInput, ReferenceField, RecordContextProvider, TextField, useGetList, useListContext, usePermissions } from 'react-admin'; +import { Box, ButtonBase, Card, CircularProgress, Popover, Typography } from '@mui/material'; import { getResourceComponents } from '@shared/components/crudContainers/CommonEntity'; import { CommonList } from '@shared/components/crudContainers/CommonList'; import { EmptyPage } from '@shared/components/crudContainers/EmptyPage'; import { adminUserFilter } from '@shared/components/fields/PermissionFilter'; import { filterArrayByParams } from '@shared/utils/filtersUtil'; import { useIsAdmin } from '@shared/utils/permissionsUtil'; +import { MAX_PAGE_SIZE } from '@shared/config/settings'; // This is a card view, not a table, so cap high rather than paginate at 10 rows. const LIST_PAGE_SIZE = 1000; @@ -67,6 +69,70 @@ function groupByKlass(rows) { }); } +// The same subject taught twice in a day shows as two rows; a row's reports end where the next one's begin. +const nextLessonStart = (row, lessons) => lessons.find((other) => + other.teacherReferenceId === row.teacherReferenceId + && other.lessonReferenceId === row.lessonReferenceId + && other.reportDate === row.reportDate + && other.reportHour > row.reportHour +)?.reportHour; + +const MissingGirlsList = ({ row, until }) => { + const filter = { + teacherReferenceId: row.teacherReferenceId, + klassReferenceId: row.klassReferenceId, + lessonReferenceId: row.lessonReferenceId, + 'reportDate:$eq': row.reportDate, + 'absCount:$gt': 0, + 'createdAt:$gte': row.reportHour, + ...(until && { 'createdAt:$lt': until }), + }; + const { data, isPending } = useGetList('att_report', { filter, pagination: { page: 1, perPage: MAX_PAGE_SIZE }, sort: { field: 'id', order: 'ASC' } }); + if (isPending) { + return ; + } + const studentIds = [...new Set((data || []).map((report) => report.studentReferenceId))]; + return ( + + {studentIds.map((studentReferenceId) => ( + + + + + + + + ))} + + ); +}; + +// Names are fetched only when the count is clicked, so opening the report stays one query. +const MissingGirls = ({ row, until }) => { + const [anchorEl, setAnchorEl] = useState(null); + const count = missingCount(row); + if (count === 0) { + return –; + } + return ( + <> + setAnchorEl(event.currentTarget)} sx={{ ...missingPillSx(count), cursor: 'pointer' }} title="הצגת שמות הבנות שחסרו"> + {count} + + setAnchorEl(null)} + anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }} + transformOrigin={{ vertical: 'top', horizontal: 'left' }} + > + בנות שחסרו + + + + ); +}; + const sumMissing = (rows) => rows.reduce((sum, row) => sum + missingCount(row), 0); const SummaryTiles = ({ rows, klassCount }) => { @@ -88,8 +154,7 @@ const SummaryTiles = ({ rows, klassCount }) => { ); }; -const LessonRow = ({ row, showDate }) => { - const count = missingCount(row); +const LessonRow = ({ row, showDate, until }) => { return ( @@ -108,9 +173,7 @@ const LessonRow = ({ row, showDate }) => { - - {count === 0 ? '–' : count} - + ); @@ -158,7 +221,7 @@ const TeacherReportCards = ({ isAdmin }) => { )} {klass.lessons.map((row) => ( - + ))} ); diff --git a/client/src/roadmapFeatures.js b/client/src/roadmapFeatures.js index 251a8a8e..3d8390f7 100644 --- a/client/src/roadmapFeatures.js +++ b/client/src/roadmapFeatures.js @@ -31,6 +31,7 @@ export default [ { html: 'תשתית משימות רקע: ייצוא נתונים אסינכרוני, תזמונים קבועים וניטור משימות', status: 'בוצע', statusColor: 'success' }, { html: 'ניקוי אוטומטי של נוכחות שיעור נבחר, לפי כיתה/מסלול לשמירה, בכל מוצאי שבת', status: 'בוצע', statusColor: 'success' }, { html: 'עיצוב חדש לדוח המורות שדיווחו: כרטיס לכל כיתה עם שורה לכל שיעור, צביעת מספר החסרות וריבועי סיכום', status: 'בוצע', statusColor: 'success' }, + { html: 'דוח המורות שדיווחו: לחיצה על מספר החסרות מציגה את שמות הבנות שחסרו', status: 'בוצע', statusColor: 'success' }, // { html: 'הגדרת תקופת זמן לפי תאריכים', status: 'בקרוב', statusColor: 'warning' }, // { html: 'הגדרת תקופת זמן לפי יום בשבוע', status: 'בוצע', statusColor: 'success' },