Temp fix for showing supervisor groups

This commit is contained in:
adam-skowronek 2023-01-06 19:41:42 +01:00
parent dd76f23a8c
commit df107cfc7d

View File

@ -14,6 +14,7 @@ const SupervisorGroups = () => {
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')
const [userId] = useLocalStorageState('userId')
const perPageOptions = [ const perPageOptions = [
{ {
@ -96,40 +97,44 @@ const SupervisorGroups = () => {
</tr> </tr>
</thead> </thead>
<tbody className="divide-y divide-gray-100"> <tbody className="divide-y divide-gray-100">
{groups?.data?.groups?.map( {groups?.data?.groups
({ ?.filter(
id, ({ project_supervisor }) => project_supervisor.id === userId,
name, )
project_supervisor, .map(
points_for_first_term, ({
points_for_second_term, id,
}) => ( name,
<tr key={id}> project_supervisor,
<td> points_for_first_term,
<Link points_for_second_term,
to={`/${ }) => (
location.pathname.includes('coordinator') <tr key={id}>
? 'coordinator' <td>
: 'supervisor' <Link
}/groups/${id}`} to={`/${
className="underline font-bold" location.pathname.includes('coordinator')
> ? 'coordinator'
{name} : 'supervisor'
</Link> }/groups/${id}`}
</td> className="underline font-bold"
<td> >
{`${project_supervisor.first_name} ${project_supervisor.last_name}`} {name}
</td> </Link>
<td>{points_for_first_term}</td> </td>
<td>{points_for_second_term}</td> <td>
<td> {`${project_supervisor.first_name} ${project_supervisor.last_name}`}
<button onClick={() => mutateDelete(id)}> </td>
<IconRemove /> <td>{points_for_first_term}</td>
</button> <td>{points_for_second_term}</td>
</td> <td>
</tr> <button onClick={() => mutateDelete(id)}>
), <IconRemove />
)} </button>
</td>
</tr>
),
)}
</tbody> </tbody>
</table> </table>
</div> </div>