Skip to content
Snippets Groups Projects
Commit 618dfd57 authored by lfr20's avatar lfr20
Browse files

Fixed function to aprove teacher

parent 983175bd
No related branches found
No related tags found
4 merge requests!57Merge of develop into master,!56Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...,!40merge admin into develop,!39Update admin system
...@@ -33,7 +33,7 @@ import MenuItem from "@material-ui/core/MenuItem"; ...@@ -33,7 +33,7 @@ import MenuItem from "@material-ui/core/MenuItem";
import TableRow from "@material-ui/core/TableRow"; import TableRow from "@material-ui/core/TableRow";
import TextField from "@material-ui/core/TextField"; import TextField from "@material-ui/core/TextField";
import IconButton from "@material-ui/core/IconButton"; import IconButton from "@material-ui/core/IconButton";
import { Button, Typography, Paper, Grid } from "@material-ui/core"; import { Button, Typography, Paper, Grid, Zoom } from "@material-ui/core";
import CircularProgress from "@material-ui/core/CircularProgress"; import CircularProgress from "@material-ui/core/CircularProgress";
import AddRoundedIcon from "@material-ui/icons/AddRounded"; import AddRoundedIcon from "@material-ui/icons/AddRounded";
import UpdateRoundedIcon from "@material-ui/icons/UpdateRounded"; import UpdateRoundedIcon from "@material-ui/icons/UpdateRounded";
...@@ -331,13 +331,22 @@ const AproveTeacher = () => { ...@@ -331,13 +331,22 @@ const AproveTeacher = () => {
const handleAprove = (userId, userName) => { const handleAprove = (userId, userName) => {
const url = `/users/${userId}/add_teacher` const url = `/users/${userId}/add_teacher`
const body = { const body = {
"approves" : true "approves": true
} }
postRequest( postRequest(
url, url,
body, body,
(data) => { (data) => {
HandleSnack(`${userName} aceito como professor!`, true, "success", "#228B22"); HandleSnack(`${userName} aceito como professor!`, true, "success", "#228B22");
currPage = 0;
UpdateHandler(
Url(
"users",
`"submitter_request":"${currContentState}","name":"${currContentName}","email":"${currContentEmail}"`,
`${currPage}`,
"DESC"
),
);
}, },
(error) => { (error) => {
HandleSnack("Erro!", true, "warning", "#FA8072"); HandleSnack("Erro!", true, "warning", "#FA8072");
...@@ -348,15 +357,22 @@ const AproveTeacher = () => { ...@@ -348,15 +357,22 @@ const AproveTeacher = () => {
const handleReject = (userId, userName) => { const handleReject = (userId, userName) => {
const url = `/users/${userId}/add_teacher` const url = `/users/${userId}/add_teacher`
const body = { const body = {
"user" : { "approves": false
"approves" : false
}
} }
postRequest( postRequest(
url, url,
body, body,
(data) => { (data) => {
HandleSnack(`${userName} rejeitado como professor!`, true, "success", "#228B22"); HandleSnack(`${userName} rejeitado como professor!`, true, "success", "#228B22");
currPage = 0;
UpdateHandler(
Url(
"users",
`"submitter_request":"${currContentState}","name":"${currContentName}","email":"${currContentEmail}"`,
`${currPage}`,
"DESC"
),
);
}, },
(error) => { (error) => {
HandleSnack("Erro!", true, "warning", "#FA8072"); HandleSnack("Erro!", true, "warning", "#FA8072");
...@@ -498,10 +514,10 @@ const AproveTeacher = () => { ...@@ -498,10 +514,10 @@ const AproveTeacher = () => {
</TextField> </TextField>
</Grid> </Grid>
<Grid item> <Grid item>
<TextField label="Nome" onBlur={NameHandler} value={name} onChange={(e) => {setName(e.target.value)}} /> <TextField label="Nome" onBlur={NameHandler} value={name} onChange={(e) => { setName(e.target.value) }} />
</Grid> </Grid>
<Grid item> <Grid item>
<TextField label="Email" onBlur={EmailHandler} value={email} onChange={(e) => {setEmail(e.target.value)}} /> <TextField label="Email" onBlur={EmailHandler} value={email} onChange={(e) => { setEmail(e.target.value) }} />
</Grid> </Grid>
</Grid> </Grid>
) : null} ) : null}
...@@ -579,7 +595,7 @@ const AproveTeacher = () => { ...@@ -579,7 +595,7 @@ const AproveTeacher = () => {
startIcon={ startIcon={
<CloseRoundedIcon style={{ fill: "#FFFAFA" }} /> <CloseRoundedIcon style={{ fill: "#FFFAFA" }} />
} }
onClick={() => {handleReject(row.id, row.name)}} onClick={() => { handleReject(row.id, row.name) }}
> >
Recusar Recusar
</Button> </Button>
...@@ -594,7 +610,7 @@ const AproveTeacher = () => { ...@@ -594,7 +610,7 @@ const AproveTeacher = () => {
startIcon={ startIcon={
<CheckRoundedIcon style={{ fill: "#FFFAFA" }} /> <CheckRoundedIcon style={{ fill: "#FFFAFA" }} />
} }
onClick={() => {handleAprove(row.id, row.name)}} onClick={() => { handleAprove(row.id, row.name) }}
> >
Aceitar Aceitar
</Button> </Button>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment