From 8385864f1db6499666ee7bfef747b13ea585bb83 Mon Sep 17 00:00:00 2001 From: Alexandre Paice Date: Wed, 22 May 2024 12:27:42 +0200 Subject: [PATCH 1/3] studentpopup back on teacher subjectpage --- .../src/pages/subjectsPage/SubjectsPage.tsx | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/frontend/frontend/src/pages/subjectsPage/SubjectsPage.tsx b/frontend/frontend/src/pages/subjectsPage/SubjectsPage.tsx index 91a52e1d..9f25b75b 100644 --- a/frontend/frontend/src/pages/subjectsPage/SubjectsPage.tsx +++ b/frontend/frontend/src/pages/subjectsPage/SubjectsPage.tsx @@ -315,18 +315,25 @@ export function SubjectsPage() { )} - + + + + + + Date: Wed, 22 May 2024 12:47:58 +0200 Subject: [PATCH 2/3] begin student_choose switch --- frontend/frontend/src/pages/groupsPage/GroupsPage.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/frontend/src/pages/groupsPage/GroupsPage.tsx b/frontend/frontend/src/pages/groupsPage/GroupsPage.tsx index 7fefa1f6..059d328a 100644 --- a/frontend/frontend/src/pages/groupsPage/GroupsPage.tsx +++ b/frontend/frontend/src/pages/groupsPage/GroupsPage.tsx @@ -22,7 +22,7 @@ import { } from '@mui/material' import Switch from '@mui/material/Switch' import { t } from 'i18next' -import { FormEvent, useEffect, useState } from 'react' +import { FormEvent, useEffect, useState, ChangeEvent } from 'react' import { useNavigate, useParams } from 'react-router-dom' import instance from '../../axiosConfig.ts' import CancelIcon from '@mui/icons-material/Cancel' @@ -65,6 +65,7 @@ export function GroupsPage() { const [projectName, setProjectName] = useState('') const [user, setUser] = useState() const [max_group_size, setMaxGroupSize] = useState(0) + const [studentChoose, setStudentChoose] = useState(false) // confirmation dialog state const [confirmOpen, setConfirmOpen] = useState(false) @@ -176,13 +177,14 @@ export function GroupsPage() { console.error(error) }) - // Get the max group size and project name + // Get the max group size, project name and students can choose await instance .get('/projecten/' + assignmentId) .then((response) => { setProjectName(response.data.titel) setMaxGroupSize(response.data.max_groep_grootte) + setStudentChoose(response.data.student_groep) }) .catch((error) => { console.log(error) From 5e1d08d4490a2ef97af06cd1bbb40116ee06fb59 Mon Sep 17 00:00:00 2001 From: Ben De Meurichy Date: Wed, 22 May 2024 12:51:50 +0200 Subject: [PATCH 3/3] studenten kunnen kiezen switch fix --- .../src/pages/groupsPage/GroupsPage.tsx | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/frontend/frontend/src/pages/groupsPage/GroupsPage.tsx b/frontend/frontend/src/pages/groupsPage/GroupsPage.tsx index 7fefa1f6..e0491462 100644 --- a/frontend/frontend/src/pages/groupsPage/GroupsPage.tsx +++ b/frontend/frontend/src/pages/groupsPage/GroupsPage.tsx @@ -65,7 +65,7 @@ export function GroupsPage() { const [projectName, setProjectName] = useState('') const [user, setUser] = useState() const [max_group_size, setMaxGroupSize] = useState(0) - + const [studentsCanChoose, setStudentsCanChoose] = useState(false) // confirmation dialog state const [confirmOpen, setConfirmOpen] = useState(false) @@ -78,6 +78,10 @@ export function GroupsPage() { // handle confirmation dialog const confirmSave = async () => { + await instance.patch('/projecten/' + assignmentId + '/', { + student_groep: studentsCanChoose, + }) + if (newGroups[0].groep_id === undefined) { // delete the old groups and replace them with the new groups await instance @@ -181,6 +185,7 @@ export function GroupsPage() { .get('/projecten/' + assignmentId) .then((response) => { setProjectName(response.data.titel) + setStudentsCanChoose(response.data.student_groep) setMaxGroupSize(response.data.max_groep_grootte) }) @@ -470,7 +475,19 @@ export function GroupsPage() { }} /> ) : ( - + + setStudentsCanChoose( + !studentsCanChoose + ) + } + /> )}