From 767172a9db2051652aaedec32a6a958c60e82597 Mon Sep 17 00:00:00 2001 From: yael-miller Date: Thu, 16 Apr 2026 17:35:40 +0000 Subject: [PATCH] few changes --- .../StudentView/student-event-report.jsx | 95 ++++++++++--------- server/src/yemot-handler.service.ts | 4 +- 2 files changed, 54 insertions(+), 45 deletions(-) diff --git a/client/src/components/StudentView/student-event-report.jsx b/client/src/components/StudentView/student-event-report.jsx index 465a0c6e..3ed978b2 100644 --- a/client/src/components/StudentView/student-event-report.jsx +++ b/client/src/components/StudentView/student-event-report.jsx @@ -50,14 +50,16 @@ const extractBasePayload = (rootValues, reportValues, userId, studentId, absence .map(key => `${key.replace('dynamic_', '')}: ${rootValues[key]}`) .join(' | '); + const finalReason = extraInfo ? "דיווח תלמידה: " + extraInfo : ""; return { userId: userId, studentReferenceId: studentId, year: defaultYearFilter.year, reportDate: reportValues.reportDate, isApproved: true, - reason: extraInfo || "", - absenceTypeId: rootValues.absenceTypeId + reason: finalReason, + absenceTypeId: rootValues.absenceTypeId, + absnceCode: rootValues.absnceCode }; }; @@ -73,6 +75,17 @@ const StudentEventReport = (props) => { { id: selectedAbsenceTypeId }, { enabled: !!selectedAbsenceTypeId } ); + const { data: studentKlasses } = useGetList( + 'student_klass', + { + pagination: { page: 1, perPage: 20 }, + filter: { + studentReferenceId: student?.id, + year: defaultYearFilter.year + } + }, + { enabled: !!student?.id } + ); const { data: existingAbsences } = useGetList( 'known_absence', @@ -109,7 +122,7 @@ const StudentEventReport = (props) => { if (quota) { const newDates = new Set(uniqueDates); reports.forEach(report => { - newDates.add(new Date(report.reportDate).toISOString().split('T')[0]); + newDates.add(new Date(report.reportDate).toISOString().split('T')[0]); }); if (newDates.size > quota) { @@ -123,23 +136,21 @@ const StudentEventReport = (props) => { let payloadsToCreate = []; - const addPayloadIfValid = (base, klassId, count) => { - const parsedCount = parseFloat(count); - if (klassId && parsedCount > 0) { - payloadsToCreate.push({ - ...base, - klassReferenceId: klassId, - absnceCount: parsedCount - }); - } - }; - reports.forEach(report => { const basePayload = extractBasePayload(values, report, student.userId, student.id, absenceType); - addPayloadIfValid(basePayload, report.homeroomKlassId, report.homeroomAbsnceCount); - addPayloadIfValid(basePayload, report.specializationKlassId, report.specializationAbsnceCount); - addPayloadIfValid(basePayload, report.extraKlassId, report.extraAbsnceCount); + if (report.klassAbsences) { + Object.entries(report.klassAbsences).forEach(([klassId, count]) => { + const parsedCount = parseFloat(count); + if (parsedCount > 0) { + payloadsToCreate.push({ + ...basePayload, + klassReferenceId: klassId, + absnceCount: parsedCount + }); + } + }); + } }); if (payloadsToCreate.length === 0) { @@ -171,35 +182,33 @@ const StudentEventReport = (props) => { -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
+
+

מספר שיעורי חיסור בכל כיתה:

+ {studentKlasses?.map(sk => ( +
+
+ +
+
+ +
+
+ ))}
- + diff --git a/server/src/yemot-handler.service.ts b/server/src/yemot-handler.service.ts index ddc3e267..b4ec3b5a 100644 --- a/server/src/yemot-handler.service.ts +++ b/server/src/yemot-handler.service.ts @@ -41,13 +41,13 @@ export class YemotHandlerService extends BaseYemotHandlerService { student = await this.getStudentByTz(); if (!student) { - await this.sendMessage('מספר תז לא תקין נסי שוב'); + await this.sendMessage('מספר תעודת הזהות לא תקין נסי שוב'); } } return student; } private async getStudentByTz(): Promise { - const tz = await this.askForInput('הקישי מספר תז'); + const tz = await this.askForInput('הקישי מספר תעודת זהות'); const student = await this.dataSource.getRepository(Student).findOneBy({ userId: this.user.id, tz: tz,