From 37c890afc9c1e9f35e93e0c99644702ba935cfa4 Mon Sep 17 00:00:00 2001 From: Luis Felipe Risch <lfr20@inf.ufpr.br> Date: Tue, 18 May 2021 10:48:05 -0300 Subject: [PATCH] Fixed last bugs of admin --- .../Components/DataCards/ComplaintsCard.js | 2 +- .../Components/Inputs/CreateInstitution.js | 23 +- .../Components/Inputs/CreateLanguage.js | 43 ++-- .../Components/Inputs/CreateRole.js | 23 +- .../Components/Components/Inputs/EditRoles.js | 21 +- .../Components/Inputs/EmailInputs.js | 239 +++++++++++------- .../Components/Inputs/IntitutionsInputs.js | 28 +- .../Components/Inputs/NoteVarInputs.js | 43 ++-- src/Admin/Pages/AdminLabelTabs/LabelTabs.js | 2 +- src/Admin/Pages/Pages/SubPages/Activity.js | 2 +- .../Pages/Pages/SubPages/AproveTeacher.js | 2 +- .../Pages/Pages/SubPages/BlockedUsers.js | 2 +- src/Admin/Pages/Pages/SubPages/Collections.js | 2 +- .../Pages/SubPages/CommunityQuestions.js | 2 +- src/Admin/Pages/Pages/SubPages/Complaints.js | 2 +- .../Pages/SubPages/EducationalObjects.js | 4 +- .../Pages/Pages/SubPages/Institutions.js | 2 +- src/Admin/Pages/Pages/SubPages/Languages.js | 2 +- .../Pages/Pages/SubPages/NoteVariables.js | 2 +- src/Admin/Pages/Pages/SubPages/Permissions.js | 2 +- src/Admin/Pages/Pages/SubPages/Questions.js | 2 +- src/Admin/Pages/Pages/SubPages/Rating.js | 2 +- src/Admin/Pages/Pages/SubPages/Users.js | 2 +- src/env.js | 2 +- 24 files changed, 267 insertions(+), 189 deletions(-) diff --git a/src/Admin/Components/Components/DataCards/ComplaintsCard.js b/src/Admin/Components/Components/DataCards/ComplaintsCard.js index 4ac22b4e..4c3fc133 100644 --- a/src/Admin/Components/Components/DataCards/ComplaintsCard.js +++ b/src/Admin/Components/Components/DataCards/ComplaintsCard.js @@ -359,7 +359,7 @@ const CollectionCard = () => { case "User": return ( <CardActions> - <Link to={`/admin/user/${item.complainable_id}`}> + <Link to={`/admin/user?id=${item.complainable_id}`}> <Button variant="contained" color="primary" diff --git a/src/Admin/Components/Components/Inputs/CreateInstitution.js b/src/Admin/Components/Components/Inputs/CreateInstitution.js index 95208457..b4f001f0 100644 --- a/src/Admin/Components/Components/Inputs/CreateInstitution.js +++ b/src/Admin/Components/Components/Inputs/CreateInstitution.js @@ -138,18 +138,21 @@ const CreateInstitution = (props) => { if (data.id) HandleSnack('A instituição foi criada com sucesso', true, 'success', '#228B22') else { - if(data.errors){ + if (data.errors) { HandleSnack(`${data.errors[0]}`, true, 'warning', '#FA8072') } - if (data.name) { - let nameError = ""; - data.name.map((msg) => ( - nameError = nameError + msg + " e " - )) - setErrorInName({ - error: true, - message: nameError - }) + else { + if (data.name) { + let nameError = ""; + data.name.map((msg) => ( + nameError = nameError + msg + " e " + )) + setErrorInName({ + error: true, + message: nameError + }) + } + HandleSnack('Você precisa preencher algumas informações obrigatórias', true, 'warning', '#FFC125') } } setIsLoading(false) diff --git a/src/Admin/Components/Components/Inputs/CreateLanguage.js b/src/Admin/Components/Components/Inputs/CreateLanguage.js index 4e40599b..c9a65901 100644 --- a/src/Admin/Components/Components/Inputs/CreateLanguage.js +++ b/src/Admin/Components/Components/Inputs/CreateLanguage.js @@ -123,28 +123,31 @@ const CreateLanguage = (props) => { if (data.id) HandleSnack('A linguagem foi criada com sucesso', true, 'success', '#228B22') else { - if(data.errors){ + if (data.errors) { HandleSnack(`${data.errors[0]}`, true, 'warning', '#FA8072') } - if (data.name) { - let nameError = ""; - data.name.map((msg) => ( - nameError = nameError + msg + " e " - )) - setErrorInName({ - error: true, - message: nameError - }) - } - if (data.code) { - let codeError = ""; - data.code.map((msg) => ( - codeError = codeError + msg + " e " - )) - setErrorInCode({ - error: true, - message: codeError - }) + else { + if (data.name) { + let nameError = ""; + data.name.map((msg) => ( + nameError = nameError + msg + " e " + )) + setErrorInName({ + error: true, + message: nameError + }) + } + if (data.code) { + let codeError = ""; + data.code.map((msg) => ( + codeError = codeError + msg + " e " + )) + setErrorInCode({ + error: true, + message: codeError + }) + } + HandleSnack('Você precisa preencher algumas informações obrigatórias', true, 'warning', '#FFC125') } } setIsLoading(false) diff --git a/src/Admin/Components/Components/Inputs/CreateRole.js b/src/Admin/Components/Components/Inputs/CreateRole.js index 042616ca..94afb024 100644 --- a/src/Admin/Components/Components/Inputs/CreateRole.js +++ b/src/Admin/Components/Components/Inputs/CreateRole.js @@ -124,18 +124,21 @@ const CreateRole = (props) => { if (data.id) HandleSnack('A role foi criada com sucesso!', true, 'success', '#228B22') else { - if(data.errors){ + if (data.errors) { HandleSnack(`${data.errors[0]}`, true, 'warning', '#FA8072') } - if (data.name) { - let errorName = ""; - data.name.map((err) => ( - errorName = errorName + err + " e " - )) - setErrorInName({ - error: true, - message: errorName - }) + else { + if (data.name) { + let errorName = ""; + data.name.map((err) => ( + errorName = errorName + err + " e " + )) + setErrorInName({ + error: true, + message: errorName + }) + } + HandleSnack('Você precisa preencher algumas informações obrigatórias', true, 'warning', '#FFC125') } } setIsLoading(false) diff --git a/src/Admin/Components/Components/Inputs/EditRoles.js b/src/Admin/Components/Components/Inputs/EditRoles.js index d08e14b2..4b3aa488 100644 --- a/src/Admin/Components/Components/Inputs/EditRoles.js +++ b/src/Admin/Components/Components/Inputs/EditRoles.js @@ -161,15 +161,18 @@ const EditLanguage = () => { if (data.errors) { HandleSnack(`${data.errors[0]}`, true, 'warning', '#FA8072') } - if (data.name) { - let errorName = ""; - data.name.map((err) => ( - errorName = errorName + err + " e " - )) - setErrorInName({ - error: true, - message: errorName - }) + else { + HandleSnack('Você precisa preencher algumas informações obrigatórias', true, 'warning', '#FFC125') + if (data.name) { + let errorName = ""; + data.name.map((err) => ( + errorName = errorName + err + " e " + )) + setErrorInName({ + error: true, + message: errorName + }) + } } } setIsLoading(false) diff --git a/src/Admin/Components/Components/Inputs/EmailInputs.js b/src/Admin/Components/Components/Inputs/EmailInputs.js index 438b27cb..f75e8b48 100644 --- a/src/Admin/Components/Components/Inputs/EmailInputs.js +++ b/src/Admin/Components/Components/Inputs/EmailInputs.js @@ -34,8 +34,6 @@ import { postRequest } from '../../../../Components/HelperFunctions/getAxiosConf import ClassicEditor from "@ckeditor/ckeditor5-build-classic" import { CKEditor } from '@ckeditor/ckeditor5-react'; -let sendToAll = false; - const useStyles = makeStyles((theme) => ({ root: { display: 'flex', @@ -52,11 +50,13 @@ const useStyles = makeStyles((theme) => ({ const EmailInputs = (props) => { const classes = useStyles(); - const [option, setOption] = useState("Todos os usuários"); //labels of the text field 'to' - const [index, setIndex] = useState(0); //Used to display something above the text field 'to' depending on what the user clicks + const [option, setOption] = useState(props.email ? "Emails" : "All"); //labels of the text field 'to' + const [isToEmails, setIsToEmails] = useState(props.email ? true : false) + const [isToAll, setIsToAll] = useState(props.email ? false : true) + const [isToRoles, setIsToRoles] = useState(false) // Capture th text insert by the user in the fields - const [emails, setEmails] = useState(props.email === "none" ? "" : props.email); + const [emails, setEmails] = useState(props.email ? props.email : ""); const [emailsAdress, setEmailsAdress] = useState([]); const [subject, setSubject] = useState(""); const [message, setMessage] = useState(""); @@ -153,12 +153,22 @@ const EmailInputs = (props) => { const handleChange = (e) => { const value = e.target.value; - if (value === "All") { - sendToAll = true; - } else { - sendToAll = false; + if (value === 'All') { + setIsToAll(true) + setIsToEmails(false) + setIsToRoles(false) + } + if (value === 'Emails') { + setIsToEmails(true) + setIsToRoles(false) + setIsToAll(false) + } + if (value === 'Roles') { + setIsToRoles(true) + setIsToAll(false) + setIsToEmails(false) } - setOption(value); + setOption(value) }; const handleChangeCheckBox = (i) => { @@ -188,7 +198,7 @@ const EmailInputs = (props) => { const OnKeyPressHandler = (key) => { if (key === 13) { - if (!isEmpty(emails)) { + if (!itsEmpty(emails)) { if (emails.includes("@")) { const arr = [...emailsAdress]; arr.push(emails); @@ -218,10 +228,6 @@ const EmailInputs = (props) => { setEmailsAdress(copyEmail); }; - const isEmpty = (text) => { - return text.length === 0 ? true : false; - }; - // Handle snack infos const HandleSnack = (message, state, icon, color) => { setSnackInfo({ @@ -238,44 +244,100 @@ const EmailInputs = (props) => { setEmailsAdress([]); }; + const itsEmpty = (obj) => { + return obj.length === 0 + } + const submitRequest = async () => { - // setIsSending(true); - const rolesArr = []; - for (let index = 0; index < roles.length; index++) { - const role = roles[index] - if (role.isChecked) - rolesArr.push(role.value) - } + setIsSending(true); + const rolesArr = []; const api = `/email`; const body = { "email": { - "all_users": sendToAll, + "all_users": isToAll, "subject": subject, "body": message, - "emails": emailsAdress, - "roles": rolesArr, + "emails": isToEmails ? emailsAdress : [], + "roles": isToRoles ? rolesArr : [], }, }; - postRequest( - api, - body, - (data, header) => { - HandleSnack( - "O email foi enviado com sucesso", - true, - "success", - "#228B22" - ); - setIsSending(false); - CleanFields(); - }, - (error) => { - HandleSnack("Ocorreu algum erro", true, "warning", "#FA8072"); - setIsSending(false); - CleanFields(); - } - ) + + for (let index = 0; index < roles.length; index++) { + const role = roles[index] + if (role.isChecked) + rolesArr.push(role.value) + } + + if (isToRoles && !itsEmpty(rolesArr) && !itsEmpty(subject) && !itsEmpty(body)) + postRequest( + api, + body, + (data, header) => { + HandleSnack( + "O email foi enviado com sucesso", + true, + "success", + "#228B22" + ); + setIsSending(false); + CleanFields(); + }, + (error) => { + HandleSnack("Ocorreu algum erro", true, "warning", "#FA8072"); + setIsSending(false); + CleanFields(); + } + ) + else if (isToEmails && !itsEmpty(emailsAdress) && !itsEmpty(subject) && !itsEmpty(body)) + postRequest( + api, + body, + (data, header) => { + HandleSnack( + "O email foi enviado com sucesso", + true, + "success", + "#228B22" + ); + setIsSending(false); + CleanFields(); + }, + (error) => { + HandleSnack("Ocorreu algum erro", true, "warning", "#FA8072"); + setIsSending(false); + CleanFields(); + } + ) + else if (isToAll && !itsEmpty(emailsAdress) && !itsEmpty(subject) && !itsEmpty(body)) + postRequest( + api, + body, + (data, header) => { + HandleSnack( + "O email foi enviado com sucesso", + true, + "success", + "#228B22" + ); + setIsSending(false); + CleanFields(); + }, + (error) => { + HandleSnack("Ocorreu algum erro", true, "warning", "#FA8072"); + setIsSending(false); + CleanFields(); + } + ) + else { + HandleSnack( + "Você precisa preencher todos os campos!", + true, + "warning", + "#FFC125" + ); + setIsSending(false); + } }; return ( @@ -327,7 +389,6 @@ const EmailInputs = (props) => { > {options.map((option, index) => ( <MenuItem - onClick={() => setIndex(index)} key={option.value} value={option.value} > @@ -336,8 +397,8 @@ const EmailInputs = (props) => { ))} </TextField> <div style={{ height: "1em" }} /> - - {index === 0 ? null : index === 1 ? ( + { + isToRoles && <FormGroup style={{ marginBottom: "1em" }}> {roles.map((role, index) => ( <FormControlLabel @@ -354,45 +415,45 @@ const EmailInputs = (props) => { /> ))} </FormGroup> - ) : ( - <> - <div - style={{ - display: "flex", - flexDirection: "row", - flexWrap: "wrap", - justifyContent: "Space-between", - marginBottom: "1em" - }} - > - {emailsAdress.map((email, index) => ( - <li key={index} style={{ listStyleType: "none", marginBottom: "0.5em" }}> - <Chip - label={email} - onDelete={() => HandleDelete(index)} - classes={classes.chip} - /> - </li> - ))} - </div> - - <TextField - id="outlined-input" - label="Emails" - rows={1} - error={errorInEmails.error} - helperText={errorInEmails.message} - value={emails} - onKeyPress={(key) => OnKeyPressHandler(key.which)} - onChange={EmailsHandler} - // onBlur={ShowEmails} - placeholder="Digite um email por vez e pressione Enter" - variant="outlined" - style={{ marginBottom: "1em" }} - /> - </> - )} - + } + { + isToEmails && + <> + <div + style={{ + display: "flex", + flexDirection: "row", + flexWrap: "wrap", + justifyContent: "Space-between", + marginBottom: "1em" + }} + > + {emailsAdress.map((email, index) => ( + <li key={index} style={{ listStyleType: "none", marginBottom: "0.5em" }}> + <Chip + label={email} + onDelete={() => HandleDelete(index)} + classes={classes.chip} + /> + </li> + ))} + </div> + <TextField + id="outlined-input" + label="Emails" + rows={1} + error={errorInEmails.error} + helperText={errorInEmails.message} + value={emails} + onKeyPress={(key) => OnKeyPressHandler(key.which)} + onChange={EmailsHandler} + // onBlur={ShowEmails} + placeholder="Digite um email por vez e pressione Enter" + variant="outlined" + style={{ marginBottom: "1em" }} + /> + </> + } <TextField id="outlined-input" label="Assunto" @@ -403,7 +464,7 @@ const EmailInputs = (props) => { onChange={SubjectHandler} variant="outlined" /> - </form> + </form > <div style={{ height: "1em" }} /> @@ -432,10 +493,10 @@ const EmailInputs = (props) => { color="primary" startIcon={<SendRoundedIcon />} > - {isSending ? <CircularProgress /> : "Enviar"} + {isSending ? <CircularProgress size={24} /> : "Enviar"} </Button> </div> - </div> + </div > ); }; diff --git a/src/Admin/Components/Components/Inputs/IntitutionsInputs.js b/src/Admin/Components/Components/Inputs/IntitutionsInputs.js index 47031b7b..148f006f 100644 --- a/src/Admin/Components/Components/Inputs/IntitutionsInputs.js +++ b/src/Admin/Components/Components/Inputs/IntitutionsInputs.js @@ -37,10 +37,10 @@ import { EditFilter, GetAData } from '../../../Filters'; //Routers import { Link } from 'react-router-dom'; -let id; - const EditInstitution = () => { const { state } = useContext(Store); + const urlParams = new URLSearchParams(window.location.search); + const id = urlParams.get("institution"); const [error, setError] = useState(null); //Necessary to consult the API, catch errors const [isLoaded, setIsLoaded] = useState(false); //Necessary to consult the API, wait until complete @@ -148,15 +148,18 @@ const EditInstitution = () => { if (data.errors) { HandleSnack(`${data.errors[0]}`, true, 'warning', '#FA8072') } - if (data.name) { - let errorName = ""; - data.name.map((err) => ( - errorName = errorName + err + " e " - )) - setErrorInName({ - error: true, - message: errorName - }) + else { + HandleSnack('Você precisa preencher algumas informações obrigatórias', true, 'warning', '#FFC125') + if (data.name) { + let errorName = ""; + data.name.map((err) => ( + errorName = errorName + err + " e " + )) + setErrorInName({ + error: true, + message: errorName + }) + } } } setIsLoading(false) @@ -209,8 +212,7 @@ const EditInstitution = () => { ] useEffect(() => { - const urlParams = new URLSearchParams(window.location.search); - const id = urlParams.get("institution"); + getRequest( GetAData("institutions", id), (data, header) => { diff --git a/src/Admin/Components/Components/Inputs/NoteVarInputs.js b/src/Admin/Components/Components/Inputs/NoteVarInputs.js index 3cc63a70..3c1542ec 100644 --- a/src/Admin/Components/Components/Inputs/NoteVarInputs.js +++ b/src/Admin/Components/Components/Inputs/NoteVarInputs.js @@ -166,28 +166,31 @@ const NoteVarInputs = () => { if (data.id) HandleSnack('A variável de nota foi atualizada com sucesso!', true, 'success', '#228B22') else { - if(data.errors){ + if (data.errors) { HandleSnack(`${data.errors[0]}`, true, 'warning', '#FA8072') } - if (data.name) { - let errorName = ""; - data.name.map((err) => ( - errorName = errorName + err + " e " - )) - setErrorInName({ - error: true, - message: errorName - }) - } - if(data.weight){ - let weightError = ""; - data.weight.map((err) => ( - weightError = weightError + err + " e " - )) - setErrorInWeight({ - error: true, - message : weightError - }) + else { + HandleSnack('Você precisa preencher algumas informações obrigatórias', true, 'warning', '#FFC125') + if (data.name) { + let errorName = ""; + data.name.map((err) => ( + errorName = errorName + err + " e " + )) + setErrorInName({ + error: true, + message: errorName + }) + } + if (data.weight) { + let weightError = ""; + data.weight.map((err) => ( + weightError = weightError + err + " e " + )) + setErrorInWeight({ + error: true, + message: weightError + }) + } } } setIsLoading(false) diff --git a/src/Admin/Pages/AdminLabelTabs/LabelTabs.js b/src/Admin/Pages/AdminLabelTabs/LabelTabs.js index 9b2894cd..54b2a0fd 100644 --- a/src/Admin/Pages/AdminLabelTabs/LabelTabs.js +++ b/src/Admin/Pages/AdminLabelTabs/LabelTabs.js @@ -119,7 +119,7 @@ const TabsItens = [ }, { label: "Enviar email", - href: '/admin/sendEmail?email=none', + href: '/admin/sendEmail', icon: <EmailRoundedIcon style={{ fill: blue }} />, }, ]; diff --git a/src/Admin/Pages/Pages/SubPages/Activity.js b/src/Admin/Pages/Pages/SubPages/Activity.js index 54d37dc4..c87c1b25 100644 --- a/src/Admin/Pages/Pages/SubPages/Activity.js +++ b/src/Admin/Pages/Pages/SubPages/Activity.js @@ -393,7 +393,7 @@ const Activity = () => { </StyledTableCell> </StyledTableRow> ) : ( - <StyledTableRow key={new Date().toISOString() + row.created_at}> + <StyledTableRow key={new Date().toISOString() + index}> <StyledTableCell component="th" scope="row"> {DisplayDate(row.created_at)} </StyledTableCell> diff --git a/src/Admin/Pages/Pages/SubPages/AproveTeacher.js b/src/Admin/Pages/Pages/SubPages/AproveTeacher.js index 8fae644f..b8f7203a 100644 --- a/src/Admin/Pages/Pages/SubPages/AproveTeacher.js +++ b/src/Admin/Pages/Pages/SubPages/AproveTeacher.js @@ -691,7 +691,7 @@ const AproveTeacher = () => { </StyledTableRow> ) : ( <StyledTableRow - key={new Date().toISOString() + row.created_at} + key={new Date().toISOString() + index} style={{ flex: 1, width: "100%" }} > <StyledTableCell component="th" scope="row"> diff --git a/src/Admin/Pages/Pages/SubPages/BlockedUsers.js b/src/Admin/Pages/Pages/SubPages/BlockedUsers.js index e6083f39..84a4419b 100644 --- a/src/Admin/Pages/Pages/SubPages/BlockedUsers.js +++ b/src/Admin/Pages/Pages/SubPages/BlockedUsers.js @@ -459,7 +459,7 @@ const BlockedUsers = () => { : - <StyledTableRow key={new Date().toISOString() + row.created_at}> + <StyledTableRow key={new Date().toISOString() + index}> <StyledTableCell component="th" scope="row">{row.id}</StyledTableCell> <StyledTableCell align="right"> {BlockStatus(row.state)} diff --git a/src/Admin/Pages/Pages/SubPages/Collections.js b/src/Admin/Pages/Pages/SubPages/Collections.js index b312aa53..dd15cbae 100644 --- a/src/Admin/Pages/Pages/SubPages/Collections.js +++ b/src/Admin/Pages/Pages/SubPages/Collections.js @@ -538,7 +538,7 @@ const Collections = () => { </StyledTableCell> </StyledTableRow> ) : ( - <StyledTableRow key={new Date().toISOString() + row.created_at}> + <StyledTableRow key={new Date().toISOString() + index}> <StyledTableCell component="th" scope="row"> {row.name} </StyledTableCell> diff --git a/src/Admin/Pages/Pages/SubPages/CommunityQuestions.js b/src/Admin/Pages/Pages/SubPages/CommunityQuestions.js index 029c566a..4c93b941 100644 --- a/src/Admin/Pages/Pages/SubPages/CommunityQuestions.js +++ b/src/Admin/Pages/Pages/SubPages/CommunityQuestions.js @@ -478,7 +478,7 @@ const CommunityQuestion = () => { </StyledTableCell> </StyledTableRow> ) : ( - <StyledTableRow key={index}> + <StyledTableRow key={new Date().toISOString() + index}> <StyledTableCell component="th" scope="row"> {row.id} </StyledTableCell> diff --git a/src/Admin/Pages/Pages/SubPages/Complaints.js b/src/Admin/Pages/Pages/SubPages/Complaints.js index 2c8dff2e..d03514dc 100644 --- a/src/Admin/Pages/Pages/SubPages/Complaints.js +++ b/src/Admin/Pages/Pages/SubPages/Complaints.js @@ -574,7 +574,7 @@ const Complaints = () => { </StyledTableRow> ) : ( <StyledTableRow - key={new Date().toISOString() + row.created_at} + key={new Date().toISOString() + index} style={{ flex: 1, width: "100%" }} > <StyledTableCell component="th" scope="row"> diff --git a/src/Admin/Pages/Pages/SubPages/EducationalObjects.js b/src/Admin/Pages/Pages/SubPages/EducationalObjects.js index 612272ca..69d0dfc3 100644 --- a/src/Admin/Pages/Pages/SubPages/EducationalObjects.js +++ b/src/Admin/Pages/Pages/SubPages/EducationalObjects.js @@ -144,7 +144,7 @@ const EducationalObjects = () => { HandleSnack("Ocorreu algum erro", true, "warning", "#FA8072"); else { HandleSnack( - "A instituição foi deletada com sucesso", + "O objeto educacional foi deletada com sucesso", true, "success", "#228B22" @@ -534,7 +534,7 @@ const EducationalObjects = () => { </StyledTableCell> </StyledTableRow> ) : ( - <StyledTableRow key={new Date().toISOString() + row.created_at}> + <StyledTableRow key={new Date().toISOString() + index}> <StyledTableCell component="th" scope="row"> {DisplayDate(row.created_at)} </StyledTableCell> diff --git a/src/Admin/Pages/Pages/SubPages/Institutions.js b/src/Admin/Pages/Pages/SubPages/Institutions.js index 93d0af1a..7f713b9e 100644 --- a/src/Admin/Pages/Pages/SubPages/Institutions.js +++ b/src/Admin/Pages/Pages/SubPages/Institutions.js @@ -548,7 +548,7 @@ const Institutions = () => { </StyledTableCell> </StyledTableRow> ) : ( - <StyledTableRow key={new Date().toISOString() + row.created_at}> + <StyledTableRow key={new Date().toISOString() + index}> <StyledTableCell component="th" scope="row"> {row.id} </StyledTableCell> diff --git a/src/Admin/Pages/Pages/SubPages/Languages.js b/src/Admin/Pages/Pages/SubPages/Languages.js index 3f68cbf4..c38ac1e1 100644 --- a/src/Admin/Pages/Pages/SubPages/Languages.js +++ b/src/Admin/Pages/Pages/SubPages/Languages.js @@ -381,7 +381,7 @@ const Languages = () => { : - <StyledTableRow key={new Date().toISOString() + row.created_at}> + <StyledTableRow key={new Date().toISOString() + index}> <StyledTableCell component="th" scope="row">{row.id}</StyledTableCell> <StyledTableCell align="right">{row.name}</StyledTableCell> <StyledTableCell align="right">{row.code}</StyledTableCell> diff --git a/src/Admin/Pages/Pages/SubPages/NoteVariables.js b/src/Admin/Pages/Pages/SubPages/NoteVariables.js index 71b6abc8..1ad35f99 100644 --- a/src/Admin/Pages/Pages/SubPages/NoteVariables.js +++ b/src/Admin/Pages/Pages/SubPages/NoteVariables.js @@ -297,7 +297,7 @@ const NoteVariables = () => { : - <StyledTableRow key={new Date().toISOString() + row.created_at}> + <StyledTableRow key={new Date().toISOString() + index}> <StyledTableCell component="th" scope="row">{row.id}</StyledTableCell> <StyledTableCell align="right">{row.name}</StyledTableCell> <StyledTableCell align="right">{row.code}</StyledTableCell> diff --git a/src/Admin/Pages/Pages/SubPages/Permissions.js b/src/Admin/Pages/Pages/SubPages/Permissions.js index d8484ac1..787ac0de 100644 --- a/src/Admin/Pages/Pages/SubPages/Permissions.js +++ b/src/Admin/Pages/Pages/SubPages/Permissions.js @@ -384,7 +384,7 @@ const UserPermissions = () => { : - <StyledTableRow key={new Date().toISOString() + row.created_at}> + <StyledTableRow key={new Date().toISOString() + index}> <StyledTableCell component="th" scope="row">{row.id}</StyledTableCell> <StyledTableCell align="right">{row.name}</StyledTableCell> <StyledTableCell align="right">{row.description}</StyledTableCell> diff --git a/src/Admin/Pages/Pages/SubPages/Questions.js b/src/Admin/Pages/Pages/SubPages/Questions.js index 296c62d7..ca32e0cd 100644 --- a/src/Admin/Pages/Pages/SubPages/Questions.js +++ b/src/Admin/Pages/Pages/SubPages/Questions.js @@ -391,7 +391,7 @@ const Questions = () => { : - <StyledTableRow key={new Date().toISOString() + row.created_at}> + <StyledTableRow key={new Date().toISOString() + index}> <StyledTableCell component="th" scope="row">{row.id}</StyledTableCell> <StyledTableCell align="right">{DisplayDate(row.created_at)}</StyledTableCell> <StyledTableCell align="right">{row.description}</StyledTableCell> diff --git a/src/Admin/Pages/Pages/SubPages/Rating.js b/src/Admin/Pages/Pages/SubPages/Rating.js index 71f648dd..22d57d40 100644 --- a/src/Admin/Pages/Pages/SubPages/Rating.js +++ b/src/Admin/Pages/Pages/SubPages/Rating.js @@ -380,7 +380,7 @@ const Ratings = () => { : - <StyledTableRow key={new Date().toISOString() + row.created_at}> + <StyledTableRow key={new Date().toISOString() + index}> <StyledTableCell component="th" scope="row">{row.id}</StyledTableCell> <StyledTableCell align="right">{row.name}</StyledTableCell> <StyledTableCell align="right">{row.description}</StyledTableCell> diff --git a/src/Admin/Pages/Pages/SubPages/Users.js b/src/Admin/Pages/Pages/SubPages/Users.js index 95e8d38f..cb31af1e 100644 --- a/src/Admin/Pages/Pages/SubPages/Users.js +++ b/src/Admin/Pages/Pages/SubPages/Users.js @@ -516,7 +516,7 @@ const Users = () => { : - <StyledTableRow key={new Date().toISOString() + row.created_at}> + <StyledTableRow key={new Date().toISOString() + index}> <StyledTableCell component="th" scope="row">{row.id}</StyledTableCell> <StyledTableCell align="right">{row.name}</StyledTableCell> <StyledTableCell align="right">{row.email ? row.email : ""}</StyledTableCell> diff --git a/src/env.js b/src/env.js index b7359157..82bf229b 100644 --- a/src/env.js +++ b/src/env.js @@ -17,7 +17,7 @@ You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ -var apiDomain = 'https://api.portalmec.c3sl.ufpr.br', +var apiDomain = 'https://api.portalmectest.c3sl.ufpr.br', apiVersion = 'v1', apiUrl = apiDomain + '/' + apiVersion; -- GitLab