Skip to content

add Student Event Report create form with dynamic fields - #81

Merged
buzz-code merged 6 commits into
buzz-code:mainfrom
yael-miller:main
Feb 22, 2026
Merged

buzz-code merged 6 commits into
buzz-code:mainfrom
yael-miller:main

Conversation

@yael-miller

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread client/src/App.jsx Outdated
<Resource name="grade" {...grade} options={{ menuGroup: 'data' }} icon={GradingIcon} />
<Resource name="known_absence" {...knownAbsence} options={{ menuGroup: 'data' }} icon={PlaylistRemoveIcon} />

{(isStudentView(permissions) || isAdmin(permissions)) && <Resource name="student_event_report" {...studentEventReport} options={{ menuGroup: 'data' }} icon={EventNoteIcon} />}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not a resource, but a regular page, like in-lesson-report, for example

@buzz-code buzz-code left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great great work! several small comments

Comment thread client/src/domainTranslations.js Outdated
Comment on lines +147 to +159
student_event_report: {
name: 'דיווח אירוע לתלמידה',
fields: {
...generalResourceFieldsTranslation,
studentReferenceId: 'תלמידה',
klassReferenceId: 'כיתה',
absenceTypeId: 'סוג אירוע',
reportDate: 'תאריך',
absnceCount: 'כמות',
senderName: 'שם שולח',
reason: 'סיבה',
year: 'שנה',
isApproved: 'מאושר'

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think this is needed now

Comment thread client/src/App.jsx
return(
<> </>
);
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont you need to have StudentEventReport here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

לא כי אני לא רוצה שיהיה ניתוב בדף הבית של תלמידה לדף דיווח.

Comment thread client/src/GeneralLayout.jsx Outdated
const isStandardView = (permissions) => !isOnlyInLessonReport(permissions) && !isTeacherView(permissions);
const shouldShowLessonReports = (permissions) => isInLessonReport(permissions) || isTeacherView(permissions);
const isStandardView = (permissions) => !isOnlyInLessonReport(permissions) && !isTeacherView(permissions) && !isStudentView(permissions);
const shouldShowLessonReports = (permissions) => (isInLessonReport(permissions) || isTeacherView(permissions)) && !isStudentView(permissions);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think this is needed, student view user will not have teacher view or in lesson report permissions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

אני רואה שזה כן הכרחי אחרת התפריט מוצג

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

את צריכה להסביר את זה
משתמש שאין לו הרשאה של isInLessonReport ואין לו הרשאה של isTeacherView ויש לו רק isStudentView ורואה את הניתובים האלו?
זה לא נשמע הגיוני

Comment thread client/src/GeneralLayout.jsx Outdated
Comment on lines +39 to +41
({ permissions }) => (isStandardView(permissions) && (!isStudentView(permissions))) && <MenuItemLink key="roadmap" to="/roadmap" primaryText="פיתוחים עתידיים" leftIcon={<MapIcon />} />,
({ permissions }) => (isStandardView(permissions) && (!isStudentView(permissions))) && <MenuItemLink key="michlol-file-helper" to="/michlol-file-helper" primaryText="עדכון קבצי מכלול" leftIcon={<ContentPasteSearchIcon />} />,
({ permissions }) => (isStandardView(permissions) && (!isStudentView(permissions))) && <MenuItemLink key="settings" to="/settings" primaryText="הגדרות משתמש" leftIcon={<SettingsIcon />} />,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate, since isStandardView already checks student view permission

Comment thread client/src/utils/appPermissions.js Outdated
export const useIsisAbsenceType = () => useHasPermission(appPermissions.absenceType);

export const isStudentView = (permissions) => hasPermissionLogic(permissions, appPermissions.studentView);
export const useIsisStudentView = () => useHasPermission(appPermissions.studentView);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the double is?

...cleanValues,
userId: userId,
year: parseInt(cleanValues.year),
reportDate: cleanValues.reportDate ? new Date(cleanValues.reportDate).toISOString() : new Date().toISOString(),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will new Date(cleanValues.reportDate).toISOString() work even when report date is empty?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

אין אפשרות לא לבחור תאריך אוטומטי זה על התאריך של היום ונין אם רוצים לשנות אבל אי אפשר למחוק לגמרי

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

אם אי אפשר למחוק, אז לא צריך לבדוק אם זה קיים בכלל
לדעתי את יכולה פשוט לכתוב
reportDate: cleanValues.reportDate

Comment on lines +85 to +87
const { data: absenceType } = await dataProvider.getOne('absence_type', {
id: values.absenceTypeId
});

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you fetch this twice - once here and once in dynamic fields, can you make it one check only?


const quota = absenceType?.quota;

if (quota !== undefined && quota !== null) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simpler - if quota

Comment on lines +114 to +117
const formattedData = {
...formatPayload(values, student.userId),
studentReferenceId: student.id
};

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can put studentReferenceId in formatPayload method too, to make the code simpler

<NumberInput source="absnceCount" defaultValue={1} min={0} step={0.5} />
<TextInput source="senderName" />
<TextInput source="reason" multiline fullWidth />
<CommonAutocompleteInput source="year" choices={yearChoices} defaultValue={defaultYearFilter.year} />

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think year should be disabled too

...cleanValues,
userId: userId,
year: parseInt(cleanValues.year),
reportDate: cleanValues.reportDate ? new Date(cleanValues.reportDate).toISOString() : new Date().toISOString(),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

אם אי אפשר למחוק, אז לא צריך לבדוק אם זה קיים בכלל
לדעתי את יכולה פשוט לכתוב
reportDate: cleanValues.reportDate

Comment thread client/src/GeneralLayout.jsx Outdated
const isStandardView = (permissions) => !isOnlyInLessonReport(permissions) && !isTeacherView(permissions);
const shouldShowLessonReports = (permissions) => isInLessonReport(permissions) || isTeacherView(permissions);
const isStandardView = (permissions) => !isOnlyInLessonReport(permissions) && !isTeacherView(permissions) && !isStudentView(permissions);
const shouldShowLessonReports = (permissions) => (isInLessonReport(permissions) || isTeacherView(permissions)) && !isStudentView(permissions);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

את צריכה להסביר את זה
משתמש שאין לו הרשאה של isInLessonReport ואין לו הרשאה של isTeacherView ויש לו רק isStudentView ורואה את הניתובים האלו?
זה לא נשמע הגיוני

<CommonReferenceInput source="klassReferenceId" reference="klass" validate={required()} dynamicFilter={filterByUserIdAndYear} />
<CommonReferenceInput source="absenceTypeId" reference="absence_type" dynamicFilter={filterByUserIdAndYear} validate={required()} />
<CommonReferenceInput source="absenceTypeId" reference="absence_type" dynamicFilter={filterByUserIdAndYear} validate={required()}
onChange={(e) => { const value = e?.target ? e.target.value : e; setSelectedAbsenceTypeId(value); }} />

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setSelectedAbsenceTypeId(e?.target?.value ?? e)

@buzz-code
buzz-code merged commit dcfa35a into buzz-code:main Feb 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants