Commit b9f4f1ad authored by Rafael S Castilho's avatar Rafael S Castilho

Merge branch 'set_page' into 'develop'

Set page

See merge request !32
parents a4623297 ad894fa2
Pipeline #22854 failed with stages
in 30 seconds
......@@ -91,7 +91,7 @@ export function Wizard(props) {
const steps = getSteps();
function handleNext() {
if (activeStep == steps.length -1)
if (activeStep === steps.length -1)
props.handleClose()
else
setActiveStep(prevActiveStep => prevActiveStep + 1);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import React, {useState, useEffect,useContext} from 'react';
import {set_query_cache,get_query_cache} from "../services/query";
import {SelectField} from '../components/select/Select'
import api from '../api'
import {getUserId} from '../services/auth'
import {CustTable} from '../components/table/Table';
import {Toast} from '../components/toast/Toast';
import Typography from '@material-ui/core/Typography';
import Grid from '@material-ui/core/Grid';
import { makeStyles } from '@material-ui/core/styles';
import MaterialTable from 'material-table'
const DisciplinaSelect = React.createContext({ "disciplina":"", "curso":"", "periodo":"", "vagas":0, });
const Disciplinas = React.createContext({});
const useStyles = makeStyles(theme => ({
......@@ -82,12 +81,11 @@ function compareCode(a,b){
export function ListDisciplina(props) {
const disciplinas = props.disciplinas
const {disciplina_select,setDisciplinaSelected} = useContext(DisciplinaSelect);
const [data, setData] = useState([]);
const [ver,setVer] = useState(false)
const header_list = [
{ field: 'Id', title: "Id", filtering: false, hidden: true},
{field: 'departamentoCod', title: 'dpto', filtering: false, hidden: true},
{ field: 'departamentoCod', title: 'dpto', filtering: false, hidden: true},
{ field: 'codigo', title: "Código"},
{ field: 'nome', title: "Nome"},
{ field: 'tipodesalaId', title: "tipo de sala",filtering: false,lookup:{Anfiteatro:'Anfiteatro',Bancadas:'Bancadas','Carteira com Braço':'Carteira com Braço','Gabinete de Professor':'Gabinete de Professor',"Laboratório":'Laboratório','Laboratorio de Anatomia':'Laboratório de Anatomia','Laboratório de Elétrica':'Laboratório de Elétrica','Laboratorio de Fisioterapia':'Laboratório de Fisioterapia','Laboratorio de Informática':'Laboratório de Informática','Laboratório de Microscópios':'Laboratório de Microscópios','Laboratório de Pesquisa':'Laboratório de Pesquisa','Laboratório de Quimica':'Laboratório de Quimica','Laboratório de Tribologia':'Laboratório de Tribologia','Mesa de reunião e cadeiras':'Mesa de reunião e cadeiras','Mesa e Carteira':'Mesa e Carteira','Mesa estilo Prancheta':'Mesa estilo Prancheta'}},
......@@ -156,33 +154,27 @@ export function ListDisciplina(props) {
onRowAdd: newData =>
new Promise((resolve,reject) => {
setTimeout(() => {
{
if(!newData.departamentoCod){
newData.departamentoCod = props.departamento
}
const result = api.post("disciplinas",newData);
api.post("disciplinas",newData);
setData(data => [...data,newData]);
}
resolve();
},1000);
}),
onRowUpdate: (newData,oldData) =>
new Promise ((resolve,reject) => {
setTimeout(() => {
{
const result = api.put("disciplinas",newData);
api.put("disciplinas",newData);
setData(data => [...data.filter(item => item._id !== oldData._id),newData])
}
resolve();
},1000)
}),
onRowDelete: oldData =>
new Promise ((resolve,reject) => {
setTimeout(() => {
{
const result = api.delete("disciplinas/"+oldData.codigo);
api.delete("disciplinas/"+oldData.codigo);
setData(data => [...data.filter(item => item._id !== oldData._id),{}])
}
resolve();
},1000)
})
......@@ -195,7 +187,6 @@ export function ListDisciplina(props) {
export function Disciplina(props) {
var departamento = props.departamento
const {disciplinas, setDisciplinas} = useContext(Disciplinas)
const {disciplina_select,setDisciplinaSelected} = useContext(DisciplinaSelect);
const [dpt_code, setDptCodigo] = useState(props.departamento.codigo);
if(dpt_code !== props.departamento.codigo){
setDptCodigo(props.departamento.codigo)
......@@ -207,8 +198,6 @@ export function Disciplina(props) {
for(var i=0; i< result.data.length; i++) {
var _disciplina = result.data[i]
_disciplinas[_disciplina.codigo] = _disciplina
// var equivalencias = await api.get(`disciplinas/${_disciplina.codigo}/equivalencias`);
// _disciplinas[_disciplina.codigo]["equivalencias"] = equivalencias.data;
}
setDisciplinas(_disciplinas);
};
......@@ -238,15 +227,15 @@ export function GerenciarDisciplina (props) {
const fetchData = async () => {
const _user = await getUserId()
var user = null
console.log("id: ",user)
// console.log("id: ",user)
if(_user) {
const user_result = await api.get(`usuarios/${_user}?filter[include][secretario]`)
const role_result = await api.get(`usuarios/${_user}/role`)
user = user_result.data
console.log( user)
// console.log( user)
const role = role_result.data
if(role.role === "secretario_dpto" && user.secretario && user.secretario.valor_vinculo) {
console.log("[where][codigo]="+user.secretario.valor_vinculo)
// console.log("[where][codigo]="+user.secretario.valor_vinculo)
setSec(true)
set_query_cache("departamento_disciplina",user.secretario.valor_vinculo);
setQuery("[where][codigo]="+user.secretario.valor_vinculo)
......@@ -262,14 +251,14 @@ export function GerenciarDisciplina (props) {
const fetchData = async () => {
const _user = await getUserId()
var user = null
console.log("id: ",user)
// console.log("id: ",user)
if(_user) {
const user_result = await api.get(`usuarios/${_user}?filter[include][secretario]`)
const role_result = await api.get(`usuarios/${_user}/role`)
user = user_result.data
const role = role_result.data
if(role.role === "secretario_dpto" && user.secretario && user.secretario.valor_vinculo) {
console.log("[where][codigo]="+user.secretario.valor_vinculo)
// console.log("[where][codigo]="+user.secretario.valor_vinculo)
setSec(true)
set_query_cache("departamento_disciplina",user.secretario.valor_vinculo);
setQuery("[where][codigo]="+user.secretario.valor_vinculo)
......@@ -292,7 +281,6 @@ export function GerenciarDisciplina (props) {
function change_query(value) {
setQuery("[where][codigo]="+value);
set_query_cache("departamento_disciplina",value);
//sticks
}
function setDisciplinaSelected(disciplina){
setDisciplinaSelect(disciplina);
......@@ -331,9 +319,6 @@ export function GerenciarDisciplina (props) {
</Grid>
</Grid>
{/* <Grid item xs={4} md={4} sm={4} lg={3}> menu */}
{/* <Menu dpts={dpts} setDisciplinaSelect={setDisciplinaSelect} codigo_disciplina={disciplina_select.codigo}></Menu> */}
{/* </Grid> */}
</Grid>
</div>
</Disciplinas.Provider>
......
import React, {useState, useEffect,useContext} from 'react';
import MaterialTable from 'material-table'
import AlertDialog from '../components/dialog/dialog';
import CallMergeIcon from '@material-ui/icons/CallMerge';
// import CallMergeIcon from '@material-ui/icons/CallMerge';
import {Messages,MessageActive} from "../messagesystem"
import TextField from '@material-ui/core/TextField';
import Divider from '@material-ui/core/Divider';
import AccessTimeIcon from '@material-ui/icons/AccessTime';
import Add from '@material-ui/icons/Add';
import AddCircleOutlineIcon from '@material-ui/icons/AddCircleOutline';
// import TextField from '@material-ui/core/TextField';
// import Divider from '@material-ui/core/Divider';
// import AccessTimeIcon from '@material-ui/icons/AccessTime';
// import Add from '@material-ui/icons/Add';
// import AddCircleOutlineIcon from '@material-ui/icons/AddCircleOutline';
import DeleteOutline from '@material-ui/icons/DeleteOutline'
import api from '../api'
import {CustTable} from '../components/table/Table';
import {Toast} from '../components/toast/Toast';
import CheckIcon from '@material-ui/icons/Check';
import CloseIcon from '@material-ui/icons/Close';
// import {CustTable} from '../components/table/Table';
// import {Toast} from '../components/toast/Toast';
// import CheckIcon from '@material-ui/icons/Check';
// import CloseIcon from '@material-ui/icons/Close';
import Typography from '@material-ui/core/Typography';
import Grid from '@material-ui/core/Grid';
import { makeStyles } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper';
import Button from '@material-ui/core/Button';
// import Button from '@material-ui/core/Button';
const EnsalamentoSelect = React.createContext({ "ensalamento":"", "curso":"", "periodo":"", "vagas":0, });
const Change = React.createContext(false);
const useStyles = makeStyles(theme => ({
......@@ -98,11 +97,11 @@ export function HeaderEnsalamento(props) {
textAlign: "left",
color: "#676767"
};
const style_option = {
fontSize: "12px",
textAlign: "left",
color: "#676767"
};
// const style_option = {
// fontSize: "12px",
// textAlign: "left",
// color: "#676767"
// };
const {ensalamento_select, setEnsalamentoSelected} = useContext(EnsalamentoSelect);
function addEnsalamento() {
setEnsalamentoSelected(emptyEnsalamento);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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