diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 208c869..df90597 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -27,6 +27,7 @@ import AvailabilitySchedule from './views/coordinator/AvailabilitySchedule' import GradeCard from './views/GradeCard' import Group from './views/coordinator/Group' import dayjs from 'dayjs' +import WorkloadStatistics from './views/coordinator/WorkloadStatistics' require('dayjs/locale/pl') dayjs.locale('pl') @@ -65,6 +66,10 @@ function App() { path="supervisors_availability/:id" element={} /> + } + /> }> } /> diff --git a/frontend/src/api/schedule.ts b/frontend/src/api/schedule.ts index e376d8d..090cedf 100644 --- a/frontend/src/api/schedule.ts +++ b/frontend/src/api/schedule.ts @@ -8,8 +8,9 @@ interface TermOfDefences { end_date: string title: string members_of_committee: { - members: { first_name: string; last_name: string }[] - } + first_name: string + last_name: string + }[] group: { name: string; students: Student[] } } @@ -191,3 +192,13 @@ export const setDateOfExaminationSchedule = ( export const generateTermsOfDefence = (scheduleId: number) => { return axiosInstance.post(`coordinator/enrollments/${scheduleId}/generate`) } + +export const geWorkloadStatistics = (scheduleId: number) => { + return axiosInstance.get<{ + workloads: { + assigned_to_committee: number + full_name: string + groups_assigned_to_his_committee: number + }[] + }>(`coordinator/examination_schedule/${scheduleId}/workloads/`) +} diff --git a/frontend/src/views/coordinator/Schedule.tsx b/frontend/src/views/coordinator/Schedule.tsx index cd8d012..6797db0 100644 --- a/frontend/src/views/coordinator/Schedule.tsx +++ b/frontend/src/views/coordinator/Schedule.tsx @@ -8,7 +8,7 @@ import { getTermsOfDefencesWithGroups, setDateOfExaminationSchedule, } from '../../api/schedule' -import { useParams } from 'react-router-dom' +import { Link, useParams } from 'react-router-dom' import Modal from 'react-modal' import { Controller, NestedValue, useForm } from 'react-hook-form' import EditSchedule from './EditSchedule' @@ -307,13 +307,20 @@ const Schedule = () => { ZAPISZ - - +
+ + Statystyki + + +
{ + const { id } = useParams<{ id: string }>() + + const { data: workloads } = useQuery(['workload'], () => + geWorkloadStatistics(Number(id)), + ) + return ( +
+ + + + + + + + + {workloads?.data?.workloads.map( + ({ full_name, assigned_to_committee }) => ( + + + + + ), + )} + +
Imię i nazwiskoIlość przypisanych komisji
{full_name}{assigned_to_committee}
+
+ ) +} + +export default WorkloadStatistics