From f51b02a783b0118a025dae73a4f2daf84f91627a Mon Sep 17 00:00:00 2001
From: Luis Felipe Risch <lfr20@inf.ufpr.br>
Date: Fri, 9 Apr 2021 09:55:49 -0300
Subject: [PATCH] Fixed bugs

---
 .../Pages/Pages/SubPages/Institutions.js      | 35 ++++++++++---------
 src/Admin/Pages/Pages/SubPages/Languages.js   | 19 +++++++++-
 src/Admin/Pages/Pages/SubPages/Permissions.js | 19 +++++++++-
 src/Admin/Pages/Pages/SubPages/Questions.js   | 21 +++++++++--
 src/Admin/Pages/Pages/SubPages/Rating.js      | 19 +++++++++-
 src/Admin/Pages/Pages/SubPages/Users.js       | 17 ++++++++-
 6 files changed, 106 insertions(+), 24 deletions(-)

diff --git a/src/Admin/Pages/Pages/SubPages/Institutions.js b/src/Admin/Pages/Pages/SubPages/Institutions.js
index 874292c1..d8d2856a 100644
--- a/src/Admin/Pages/Pages/SubPages/Institutions.js
+++ b/src/Admin/Pages/Pages/SubPages/Institutions.js
@@ -47,7 +47,7 @@ import { getRequest, deleteRequest } from '../../../../Components/HelperFunction
 //Filters
 import { Url, DeleteFilter } from "../../../Filters";
 //router 
-import { Link } from 'react-router-dom';
+import { Link, useHistory } from 'react-router-dom';
 import styled from "styled-components"
 import AccountBalanceRoundedIcon from "@material-ui/icons/AccountBalanceRounded";
 
@@ -69,24 +69,9 @@ const StyledTableRow = withStyles((theme) => ({
   },
 }))(TableRow);
 
-const useStyles = makeStyles((theme) => ({
-  root: {
-    flexGrow: 1,
-  },
-  paper: {
-    padding: theme.spacing(1),
-    textAlign: "start",
-  },
-  button: {
-    margin: theme.spacing(1),
-    alignSelf: "flex-end",
-  },
-}));
-
 const Institutions = () => {
-  const classes = useStyles();
   const WINDOW_WIDTH = window.innerWidth
-
+  const router = useHistory()
   const ADD_ONE_LENGHT = [""];
 
   const [error, setError] = useState(null); //Necessary to consult the API, catch errors
@@ -344,6 +329,14 @@ const Institutions = () => {
                   setShowFilter(!showFilter);
                 },
                 icon: <FilterListRoundedIcon />
+              },
+              {
+                name: "Novo",
+                isLoading: false,
+                func: () => {
+                  router.push('/admin/InstitutionCreate')
+                },
+                icon: <AddRoundedIcon />
               }
             ]}
           >
@@ -486,6 +479,14 @@ const Institutions = () => {
                   setShowFilter(!showFilter);
                 },
                 icon: <FilterListRoundedIcon />
+              },
+              {
+                name: "Novo",
+                isLoading: false,
+                func: () => {
+                  router.push('/admin/InstitutionCreate')
+                },
+                icon: <AddRoundedIcon />
               }
             ]}
           >
diff --git a/src/Admin/Pages/Pages/SubPages/Languages.js b/src/Admin/Pages/Pages/SubPages/Languages.js
index 6eee28f6..f985fdc8 100644
--- a/src/Admin/Pages/Pages/SubPages/Languages.js
+++ b/src/Admin/Pages/Pages/SubPages/Languages.js
@@ -41,7 +41,7 @@ import UpdateRoundedIcon from '@material-ui/icons/UpdateRounded';
 import EditRoundedIcon from '@material-ui/icons/EditRounded';
 import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded';
 //router
-import { Link } from 'react-router-dom';
+import { Link, useHistory } from 'react-router-dom';
 import styled from "styled-components"
 import LanguageRoundedIcon from "@material-ui/icons/LanguageRounded";
 
@@ -67,6 +67,7 @@ const Languages = () => {
   const ADD_ONE_LENGHT = [""];
   const TOP_LABELS = ['ID', 'NOME', 'CODE', 'EDITAR', 'DELETAR'] //Labels from Table  
   const WINDOW_WIDTH = window.innerWidth
+  const router = useHistory()
 
   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
@@ -226,6 +227,14 @@ const Languages = () => {
                 },
                 icon: <UpdateRoundedIcon />
               },
+              {
+                name: "Novo",
+                isLoading: false,
+                func: () => {
+                  router.push('/admin/languageCreate')
+                },
+                icon: <AddRoundedIcon />
+              }
             ]}
           >
           </MobilePageHeader>
@@ -323,6 +332,14 @@ const Languages = () => {
                 },
                 icon: <UpdateRoundedIcon />
               },
+              {
+                name: "Novo",
+                isLoading: false,
+                func: () => {
+                  router.push('/admin/languageCreate')
+                },
+                icon: <AddRoundedIcon />
+              }
             ]}
           >
           </PageHeader>
diff --git a/src/Admin/Pages/Pages/SubPages/Permissions.js b/src/Admin/Pages/Pages/SubPages/Permissions.js
index b5a32783..699e1836 100644
--- a/src/Admin/Pages/Pages/SubPages/Permissions.js
+++ b/src/Admin/Pages/Pages/SubPages/Permissions.js
@@ -40,7 +40,7 @@ import UpdateRoundedIcon from '@material-ui/icons/UpdateRounded';
 import EditRoundedIcon from '@material-ui/icons/EditRounded';
 import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded';
 //router
-import { Link } from 'react-router-dom';
+import { Link, useHistory } from 'react-router-dom';
 import styled from "styled-components"
 import AccountCircleRoundedIcon from "@material-ui/icons/AccountCircleRounded"
 
@@ -66,6 +66,7 @@ const UserPermissions = () => {
   const ADD_ONE_LENGHT = [""];
   const TOP_LABELS = ['ID', 'NOME', 'DESCRIÇÃO', 'AÇÕES'] //Labels from Table 
   const WINDOW_WIDTH = window.innerWidth
+  const router = useHistory()
 
   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
@@ -223,6 +224,14 @@ const UserPermissions = () => {
                 },
                 icon: <UpdateRoundedIcon />
               },
+              {
+                name: "Novo",
+                isLoading: false,
+                func: () => {
+                  router.push('/admin/CreateRole')
+                },
+                icon: <AddRoundedIcon />
+              }
             ]}
           >
           </MobilePageHeader>
@@ -318,6 +327,14 @@ const UserPermissions = () => {
                 },
                 icon: <UpdateRoundedIcon />
               },
+              {
+                name: "Novo",
+                isLoading: false,
+                func: () => {
+                  router.push('/admin/CreateRole')
+                },
+                icon: <AddRoundedIcon />
+              }
             ]}
           >
           </PageHeader>
diff --git a/src/Admin/Pages/Pages/SubPages/Questions.js b/src/Admin/Pages/Pages/SubPages/Questions.js
index affb59e8..1d34bd10 100644
--- a/src/Admin/Pages/Pages/SubPages/Questions.js
+++ b/src/Admin/Pages/Pages/SubPages/Questions.js
@@ -40,7 +40,7 @@ import AddRoundedIcon from '@material-ui/icons/AddRounded';
 import UpdateRoundedIcon from '@material-ui/icons/UpdateRounded';
 import Switch from '@material-ui/core/Switch';
 //router
-import { Link } from 'react-router-dom';
+import { Link, useHistory } from 'react-router-dom';
 import styled from "styled-components"
 import HelpRoundedIcon from "@material-ui/icons/HelpRounded";
 
@@ -68,6 +68,7 @@ const Questions = () => {
   const ADD_ONE_LENGHT = [""];
   const WINDOW_WIDTH = window.innerWidth
   const TOP_LABELS = ['ID', 'CRIAÇÃO EM', 'DESCRIÇÃO', 'STATUS', 'ATUALIZAÇÃO EM'] //Labels from Table  
+  const router = useHistory()
 
   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
@@ -230,7 +231,7 @@ const Questions = () => {
           />
 
           <MobilePageHeader
-            title="Questões da curadoria"
+            title="Perguntas da curadoria"
             actions={[
               {
                 name: "Atualizar",
@@ -240,6 +241,13 @@ const Questions = () => {
                 },
                 icon: <UpdateRoundedIcon />
               },
+              {
+                name: "Novo",
+                isLoading: false,
+                func: () => {
+                  router.push('/admin/CreateQuestion')
+                },
+              }
             ]}
           >
           </MobilePageHeader>
@@ -334,7 +342,7 @@ const Questions = () => {
           />
 
           <PageHeader
-            title="Questões da curadoria"
+            title="Perguntas da curadoria"
             actions={[
               {
                 name: "Atualizar",
@@ -344,6 +352,13 @@ const Questions = () => {
                 },
                 icon: <UpdateRoundedIcon />
               },
+              {
+                name: "Novo",
+                isLoading: false,
+                func: () => {
+                  router.push('/admin/CreateQuestion')
+                },
+              }
             ]}
           >
           </PageHeader>
diff --git a/src/Admin/Pages/Pages/SubPages/Rating.js b/src/Admin/Pages/Pages/SubPages/Rating.js
index 80feabfa..8fe70d9b 100644
--- a/src/Admin/Pages/Pages/SubPages/Rating.js
+++ b/src/Admin/Pages/Pages/SubPages/Rating.js
@@ -44,7 +44,7 @@ import { Url } from '../../../Filters';
 import { DeleteFilter } from '../../../Filters';
 import { getRequest, deleteRequest } from '../../../../Components/HelperFunctions/getAxiosConfig'
 //routers
-import { Link } from 'react-router-dom';
+import { Link, useHistory } from 'react-router-dom';
 import StarRoundedIcon from "@material-ui/icons/StarRounded";
 import styled from "styled-components"
 
@@ -69,6 +69,7 @@ const StyledTableRow = withStyles((theme) => ({
 const Ratings = () => {
   const WINDOW_WIDTH = window.innerWidth
   const ADD_ONE_LENGHT = [""];
+  const router = useHistory()
 
   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 
@@ -229,6 +230,14 @@ const Ratings = () => {
                 },
                 icon: <UpdateRoundedIcon />
               },
+              {
+                name: "Novo",
+                isLoading: false,
+                func: () => {
+                  router.push('/admin/CreateRating')
+                },
+                icon: <AddRoundedIcon />
+              }
             ]}
           >
           </MobilePageHeader>
@@ -325,6 +334,14 @@ const Ratings = () => {
                 },
                 icon: <UpdateRoundedIcon />
               },
+              {
+                name: "Novo",
+                isLoading: false,
+                func: () => {
+                  router.push('/admin/CreateRating')
+                },
+                icon: <AddRoundedIcon />
+              }
             ]}
           >
           </PageHeader>
diff --git a/src/Admin/Pages/Pages/SubPages/Users.js b/src/Admin/Pages/Pages/SubPages/Users.js
index 75c75440..7e606d71 100644
--- a/src/Admin/Pages/Pages/SubPages/Users.js
+++ b/src/Admin/Pages/Pages/SubPages/Users.js
@@ -42,7 +42,7 @@ import PageHeader from "../../../Components/Components/PageHeader"
 import { getRequest, putRequest } from '../../../../Components/HelperFunctions/getAxiosConfig'
 import { Url } from '../../../Filters';
 //routers
-import { Link } from 'react-router-dom';
+import { Link, useHistory } from 'react-router-dom';
 import moment from 'moment';
 import styled from 'styled-components'
 import EmailRoundedIcon from '@material-ui/icons/EmailRounded';
@@ -69,6 +69,7 @@ const StyledTableRow = withStyles((theme) => ({
 
 const Users = () => {
   const ADD_ONE_LENGHT = [''];
+  const router = useHistory()
   const WINDOW_WIDTH = window.innerWidth
   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 
@@ -265,6 +266,13 @@ const Users = () => {
                   setShowFilter(!showFilter);
                 },
                 icon: <FilterListRoundedIcon />
+              },
+              {
+                name: "Novo",
+                isLoading: false,
+                func: () => {
+                  router.push('/admin/EditUser/-1')
+                },
               }
             ]}
           >
@@ -426,6 +434,13 @@ const Users = () => {
                   setShowFilter(!showFilter);
                 },
                 icon: <FilterListRoundedIcon />
+              },
+              {
+                name: "Novo",
+                isLoading: false,
+                func: () => {
+                  router.push('/admin/EditUser/-1')
+                },
               }
             ]}
           >
-- 
GitLab