diff --git a/client/src/App.jsx b/client/src/App.jsx index 789a4fb4..7322b810 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -24,7 +24,7 @@ import { TeacherGuard } from './components/TeacherView/TeacherAccess'; import { resourceEntityGuesser } from '@shared/components/crudContainers/EntityGuesser'; import attReport from "src/entities/att-report"; import attReportWithReportMonth from './entities/att-report-with-report-month'; -import teacherAttReportList from 'src/components/TeacherView/taecher-att-report-list'; +import teacherAttReport from 'src/components/TeacherView/taecher-att-report-list'; import TeacherPercentReportWithDatesList from 'src/components/TeacherView/percent-report-with-dates-list'; import TeacherStudentAttendanceList from 'src/components/TeacherView/student-attendance-list'; import grade from "src/entities/grade"; @@ -134,7 +134,7 @@ const App = () => ( <> - + } /> } /> diff --git a/client/src/GeneralLayout.jsx b/client/src/GeneralLayout.jsx index 3a1330bf..05bf40bc 100644 --- a/client/src/GeneralLayout.jsx +++ b/client/src/GeneralLayout.jsx @@ -45,10 +45,11 @@ const menuGroups = [ } /> ] }), - ({ permissions }) => !isOnlyInLessonReport(permissions) && ({ - name: 'report', icon: , routes: [ - } />, - } />, + ({ permissions }) => !isOnlyInLessonReport(permissions) && ({ + name: 'report', icon: , routes: [ + ...(!isTeacherView(permissions) ? [ + } />] : []), + } /> ] }), { name: 'settings', icon: }, diff --git a/client/src/components/TeacherView/taecher-att-report-list.jsx b/client/src/components/TeacherView/taecher-att-report-list.jsx index 08cbd3ae..70b32d09 100644 --- a/client/src/components/TeacherView/taecher-att-report-list.jsx +++ b/client/src/components/TeacherView/taecher-att-report-list.jsx @@ -3,6 +3,7 @@ import { TeacherGuard } from "src/components/TeacherView/TeacherAccess.jsx"; import { useObjectStore } from "src/utils/storeUtil"; const BaseList = attReport.list; +const BaseEdit = attReport.edit; const teacherAttReportList = (props) => { const { value: teacher } = useObjectStore("teacher"); @@ -16,4 +17,15 @@ const teacherAttReportList = (props) => { ); }; -export default { list: teacherAttReportList }; + +const teacherAttReportEdit = (props) => { + return ( + + + + ); +}; +export default { + list: teacherAttReportList, + edit: teacherAttReportEdit, +}; diff --git a/client/src/entities/att-report.jsx b/client/src/entities/att-report.jsx index c3ed3d0b..d2683223 100644 --- a/client/src/entities/att-report.jsx +++ b/client/src/entities/att-report.jsx @@ -1,5 +1,5 @@ import { DateField, DateInput, DateTimeInput, NumberField, NumberInput, TextField, TextInput, ReferenceField, required, minValue, maxLength, SelectField } from 'react-admin'; -import { useIsLessonSignature } from 'src/utils/appPermissions'; +import { useIsLessonSignature, useIsTeacherView } from 'src/utils/appPermissions'; import { CommonDatagrid } from '@shared/components/crudContainers/CommonList'; import { MultiReferenceField } from '@shared/components/fields/CommonReferenceField'; import { getResourceComponents } from '@shared/components/crudContainers/CommonEntity'; @@ -62,11 +62,13 @@ export const Datagrid = ({ isAdmin, children, ...props }) => { } export const Inputs = ({ isCreate, isAdmin }) => { + const isTeacher = useIsTeacherView(); + return <> {!isCreate && isAdmin && } {isAdmin && } - + {!isTeacher && }