️ This Gitlab will be shut down at 2021-12-31 23:59:59.
Students and staff can migrate to gitlab.utwente.nl.
SNT members can migrate to gitlab.snt.utwente.nl.
Contact bestuur@snt.utwente.nl for more information.

Migrate your projects today!
Export your project using the webinterface or use a script.

Commit 0ae9c37f authored by TJHeeringa's avatar TJHeeringa

Allowed editing of groupmembership through popup

parent df809977
......@@ -131,15 +131,13 @@ export const GroupDetail = ({ association, groups, initialFormType, url, onUpdat
<Avatar src={groupmembership.photo}/>
</ListItemAvatar>
<ListItemText
primary={groupmembership.duty+": "}
secondary={groupmembership.profile.given_name+" "+groupmembership.profile.surname}
secondary={groupmembership.duty}
primary={groupmembership.profile.given_name+" "+groupmembership.profile.surname}
/>
</ListItem>
)) }
</List>
</Block>
{/*</Grid>*/}
{/*</Grid>*/}
</Container>
</div>
);
......
......@@ -12,7 +12,7 @@ import ToggleGroup from "../../../Components/Toggle/ToggleGroup";
import {useAlertHandler} from "../../../Contexts/AlertHandler";
import {useAPI} from "../../../Contexts/API";
import GroupMemberManagementAssociationMemberList from "./GroupMemberManagementAssociationMemberList";
import { GroupMemberManagementGroupMemberList } from "./GroupMemberManagementGroupMemberList";
import GroupMemberManagementGroupMemberList from "./GroupMemberManagementGroupMemberList";
const GroupMemberManagement = ({ association }) => {
......
import "react-table/react-table.css";
import {MenuItem} from "@material-ui/core";
import Button from "@material-ui/core/Button";
import Dialog from "@material-ui/core/Dialog";
import DialogActions from "@material-ui/core/DialogActions";
import DialogContent from "@material-ui/core/DialogContent";
import DialogTitle from "@material-ui/core/DialogTitle";
import React, {useEffect, useMemo, useState} from "react";
import {ValidatorForm} from "react-material-ui-form-validator";
import DateField from "../../../Components/Fields/DateField";
import NumberField from "../../../Components/Fields/NumberField";
import SelectField from "../../../Components/Fields/SelectField";
import TextField from "../../../Components/Fields/TextField";
import Wrapper from "../../../Components/Fields/Wrapper";
import ExtremeTable from "../../../Components/Tables/ExtremeTable";
import {useAlertHandler} from "../../../Contexts/AlertHandler";
import {useAPI} from "../../../Contexts/API";
import {useMembers} from "../../../Contexts/Members";
const getRowId = (row) => row.slug;
export const GroupMemberManagementGroupMemberList = ({ memberships, board_group, updateRows, removeRow}) => {
/* eslint-disable no-shadow */
const Popup = ({ row, onChange, onApplyChanges, onCancelChanges, open }) => {
return (
<Dialog open={open} onClose={onCancelChanges} aria-labelledby={"form-dialog-title"} fullWidth={true}>
<ValidatorForm
onSubmit={onApplyChanges}
onError={errors => console.log(errors)}
>
<DialogTitle id={"form-dialog-title"}>Group membership details</DialogTitle>
<DialogContent>
<Wrapper>
<TextField
name={"Duty"}
label={"Duty"}
value={row.duty || ""}
onChange={onChange}
required
/>
</Wrapper>
<Wrapper>
<DateField
name={"date_joined"}
label={"Date joined"}
value={row.date_joined || ""}
onChange={onChange}
required
/>
</Wrapper>
<Wrapper>
<DateField
name={"date_left"}
label={"Date left"}
value={row.date_left || null}
onChange={onChange}
/>
</Wrapper>
<Wrapper>
<TextField
name={"email"}
label={"Email"}
value={row.email || ""}
onChange={onChange}
/>
</Wrapper>
<Wrapper>
<NumberField
name={"order"}
value={row.order || ""}
onChange={onChange}
InputProps={{
inputProps: {
step: 1, min: 1
}
}}
required
/>
</Wrapper>
<Wrapper>
<TextField
name={"description"}
label={"Board text"}
value={row.description || ""}
onChange={onChange}
multiline
required
/>
</Wrapper>
</DialogContent>
<DialogActions>
<Button onClick={onCancelChanges} variant={"contained"}>
Cancel
</Button>
<Button type={"submit"} color={"primary"} variant={"contained"}>
Save
</Button>
</DialogActions>
</ValidatorForm>
</Dialog>
);
};
const GroupMemberManagementGroupMemberList = ({ memberships, board_group, updateRows, removeRow}) => {
const API = useAPI();
const alerthandler = useAlertHandler();
......@@ -68,8 +162,6 @@ export const GroupMemberManagementGroupMemberList = ({ memberships, board_group,
});
};
const onDelete = (deletedRow) => {
console.log(memberships);
console.log(deletedRow);
let membership = memberships.find(membership=>membership["slug"] === deletedRow[0]);
API.callv4({
url: membership.url,
......@@ -98,6 +190,8 @@ export const GroupMemberManagementGroupMemberList = ({ memberships, board_group,
editingStateColumnExtensions={editingStateColumnExtensions}
onEdit={onChange}
onDelete={onDelete}
editThroughPopup={true}
Popup={Popup}
/>
);
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment