Commit fe0ec896 authored by Matheus Horstmann's avatar Matheus Horstmann 🐴

Merge branch 'fix-bugs' into 'develop'

fix bugs

See merge request !11
parents 503cd875 6755d1a9
Pipeline #22413 failed with stages
in 52 seconds
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import ListSubheader from '@material-ui/core/ListSubheader';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';
import Collapse from '@material-ui/core/Collapse';
import InboxIcon from '@material-ui/icons/MoveToInbox';
import DraftsIcon from '@material-ui/icons/Drafts';
import SendIcon from '@material-ui/icons/Send';
import ExpandLess from '@material-ui/icons/ExpandLess';
import ExpandMore from '@material-ui/icons/ExpandMore';
import StarBorder from '@material-ui/icons/StarBorder';
const useStyles = makeStyles(theme => ({
root: {
width: '100%',
backgroundColor: theme.palette.background.paper,
},
nested: {
paddingLeft: theme.spacing(4),
},
}));
export function NestedList(props) {
const classes = useStyles();
const [open, setOpen] = React.useState({});
const [_open, _setOpen] = React.useState(false);
const handleClick = (row) => {
open[row.codigo] = ( open[row.codigo])? false : true;
_setOpen(!_open)
console.log( open[row.codigo])
};
return (
<div>
<List
component="nav"
aria-labelledby="nested-list-subheader"
className={classes.root}
>
{ props.rows.map( (row)=> {
return (
<div>
<ListItem button onClick={ ( ) => {handleClick ( row)}}>
<ListItemText primary={row.nome} />
{open[row.codigo] ? <ExpandLess /> : <ExpandMore />}
</ListItem>
<Collapse in={open[row.codigo]} timeout="auto" >
<props.subcomponente row={row} />
</Collapse>
</div>
)
})
}
</List>
</div>
);
}
......@@ -58,7 +58,7 @@ export function SelectField(props) {
else
props.func({})
}}
getOptionLabel={option => option[props.index]? option[props.index] : ""}
getOptionLabel={option => ( option && option[props.index] )? option[props.index] : ""}
renderOption={option => (
<React.Fragment>
{/*<span>{option.value}</span> */}
......
import React, {useState, useEffect,useContext} from 'react';
import AlertDialog from '../components/dialog/dialog';
import CallMergeIcon from '@material-ui/icons/CallMerge';
import {Messages,MessageActive} from "../messagesystem"
......@@ -96,8 +97,7 @@ export function HeaderEnsalamento(props) {
const {message,setMessage} = React.useContext(Messages);
async function handleDelete() {
try {
const response_t = await api.delete(`semestres/${ensalamento_select.semestre}/turmas`);
const response = await api.delete(`semestres/${ensalamento_select.semestre}`);
const response_t = api.delete("/semestres/deletesemestre",{params: {"semestreId":ensalamento_select.semestre}});
setMessage("Ensalamento removido com sucesso")
setMessageActive(true)
......@@ -117,7 +117,12 @@ export function HeaderEnsalamento(props) {
<Grid item xs={6} md={6} align="right">
<Grid container justify="flex-end" direction={"row"} spacing={1}>
<Grid item align="left">
<Button onClick={handleDelete} style={{color:"#676767", fontSize:"12px"}} startIcon={<DeleteOutline style={{color:"#676767", fontSize:"12px"}}/>}>Excluir</Button>
<AlertDialog title={"Confirmação de remoção de semestre"}
initial_button_style={{color:"#676767", fontSize:"12px"}}
initial_icon={<DeleteOutline style={{color:"#676767", fontSize:"12px"}}/>}
initial_button_title={"Excluir"}
handle_accept={handleDelete}
description={"Você realmente deseja remover este semestre? não é possível desfazer está operação. " } />
</Grid>
</Grid>
</Grid>
......@@ -249,9 +254,9 @@ export function Ensalamento(props) {
const classes = useStyles();
var setor = props.setor
const [ensalamentos, setEnsalamentos] = useState([])
const [ensalamento_mont, setEnsalamentoMont] = useState([])
const {ensalamento_select,setEnsalamentoSelected} = useContext(EnsalamentoSelect);
const {change, setChange} = useContext(Change);
const [not_complete, setNotComplete] = useState(false)
useEffect(() => {
const fetchData = async () => {
const result = await api.get(`semestres`,);
......@@ -261,17 +266,16 @@ export function Ensalamento(props) {
// se existe ensalamento que está processando a planilha, então
// adiciona em uma lista, para ficar a cada 1 segundo fazendo
// requsição para ver o quanto já foi completado.
if (s.fileupload.completed != 100 && s.fileupload.status != "Sem arquivo")
ensalamento_mont.push(i)
_ensalamentos[i] = s;
console.log(_ensalamentos)
}
setEnsalamentos(_ensalamentos);
};
setInterval(()=> {
fetchData();
},2000);
return () => clearInterval(2000);
},4000);
return () => clearInterval(4000);
},[change])
return (
......
......@@ -71,6 +71,7 @@ const emptyUsuario = {
"nome": "",
"email": "",
"password":"",
"password_conf":"",
"username":"",
"vinculo":"",
"role":""
......@@ -179,7 +180,7 @@ export function MenuInfo(props) {
/>
</Grid>
<Grid container direction="row" spacing={4}>
<Grid item xs={6} >
<Grid item xs={12} >
<InputField
label="Usuário"
value={usuario_select.username}
......@@ -194,6 +195,14 @@ export function MenuInfo(props) {
func={handleChange('password')}
/>
</Grid>
<Grid item xs={6} >
<InputField
label="Confirmação de senha"
tipo="password"
value={usuario_select.password_conf}
func={handleChange('password_conf')}
/>
</Grid>
</Grid>
<Grid container direction="row" spacing={4}>
<Grid item xs={6} >
......@@ -296,6 +305,8 @@ export function Menu(props) {
async function salvahandle() {
usuario_select.roles = {"role":usuario_select.role}
var result;
if ( usuario_select.password && usuario_select.password_conf && usuario_select.password == usuario_select.password_conf) {
try {
if (!usuario_select.password) {
......@@ -314,8 +325,13 @@ export function Menu(props) {
setMessageActive(true);
/* handle error */
}
setChange(!change);
} else {
setMessage("Senhas não iguais")
setMessageActive(true);
}
}
return (
<Paper elevation={2} >
......
This diff is collapsed.
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