Merge branch 'development' of https://git.wmi.amu.edu.pl/s459309/system-pri into development

This commit is contained in:
patrol16d 2022-12-16 03:35:18 +01:00
commit 14a2fbc755

View File

@ -1,7 +1,7 @@
import classNames from 'classnames' import classNames from 'classnames'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { useMutation, useQuery } from 'react-query' import { useMutation, useQuery } from 'react-query'
import { useNavigate } from 'react-router-dom' import { useLocation, useNavigate } from 'react-router-dom'
import useLocalStorageState from 'use-local-storage-state' import useLocalStorageState from 'use-local-storage-state'
import { deleteGroup, getGroups } from '../../api/groups' import { deleteGroup, getGroups } from '../../api/groups'
import { ReactComponent as IconRemove } from '../../assets/svg/icon-remove.svg' import { ReactComponent as IconRemove } from '../../assets/svg/icon-remove.svg'
@ -9,6 +9,8 @@ import { Link } from 'react-router-dom'
const SupervisorGroups = () => { const SupervisorGroups = () => {
let navigate = useNavigate() let navigate = useNavigate()
const location = useLocation()
const [page, setPage] = useState(1) const [page, setPage] = useState(1)
const [perPage, setPerPage] = useState(10) const [perPage, setPerPage] = useState(10)
const [yearGroupId] = useLocalStorageState('yearGroupId') const [yearGroupId] = useLocalStorageState('yearGroupId')
@ -60,7 +62,15 @@ const SupervisorGroups = () => {
<div className="flex items-center justify-between flex-col gap-3 md:flex-row md:gap-0"> <div className="flex items-center justify-between flex-col gap-3 md:flex-row md:gap-0">
<button <button
className="btn btn-success" className="btn btn-success"
onClick={() => navigate('/coordinator/add-group')} onClick={() =>
navigate(
`/${
location.pathname.includes('coordinator')
? 'coordinator'
: 'supervisor'
}/add-group`,
)
}
> >
Dodaj nową grupę Dodaj nową grupę
</button> </button>
@ -97,7 +107,11 @@ const SupervisorGroups = () => {
<tr key={id}> <tr key={id}>
<td> <td>
<Link <Link
to={`/coordinator/groups/${id}`} to={`/${
location.pathname.includes('coordinator')
? 'coordinator'
: 'supervisor'
}/groups/${id}`}
className="underline font-bold" className="underline font-bold"
> >
{name} {name}