Skip to content
Snippets Groups Projects
Commit 2fe64160 authored by Lucas Eduardo Schoenfelder's avatar Lucas Eduardo Schoenfelder
Browse files

tela requisicao para ser professor pronta

parent 4ab77487
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...,!18Branch do lucas,!17Branch do lucas
......@@ -2338,9 +2338,9 @@
"integrity": "sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA=="
},
"@hapi/hoek": {
"version": "8.5.0",
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.0.tgz",
"integrity": "sha512-7XYT10CZfPsH7j9F1Jmg1+d0ezOux2oM2GfArAzLwWe4mE2Dr3hVjsAL6+TFY49RRJlCdJDMw3nJsLFroTc8Kw=="
"version": "8.5.1",
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.1.tgz",
"integrity": "sha512-yN7kbciD87WzLGc5539Tn0sApjyiGHAJgKvG9W8C7O+6c7qmoQMfVs0W4bX17eqz6C78QJqqFrtgdK5EWf6Qow=="
},
"@hapi/joi": {
"version": "15.1.1",
......@@ -12977,6 +12977,15 @@
"camelcase": "^5.0.0"
}
},
"react-input-mask": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/react-input-mask/-/react-input-mask-2.0.4.tgz",
"integrity": "sha512-1hwzMr/aO9tXfiroiVCx5EtKohKwLk/NT8QlJXHQ4N+yJJFyUuMT+zfTpLBwX/lK3PkuMlievIffncpMZ3HGRQ==",
"requires": {
"invariant": "^2.2.4",
"warning": "^4.0.2"
}
},
"react-is": {
"version": "16.8.6",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.6.tgz",
......@@ -15273,6 +15282,14 @@
"makeerror": "1.0.x"
}
},
"warning": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz",
"integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==",
"requires": {
"loose-envify": "^1.0.0"
}
},
"watchpack": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz",
......
/*Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre
Departamento de Informatica - Universidade Federal do Parana
This file is part of Plataforma Integrada MEC.
Plataforma Integrada MEC is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Plataforma Integrada MEC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
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/>.*/
import React, {useContext, useState} from 'react';
import { Button } from '@material-ui/core';
import Modal from '@material-ui/core/Modal';
import Backdrop from '@material-ui/core/Backdrop';
import Fade from '@material-ui/core/Fade';
import styled from 'styled-components'
import {Store} from '../Store.js'
import axios from 'axios'
import {apiUrl} from '../env';
import CloseIcon from '@material-ui/icons/Close';
const StyledModal = styled(Modal)`
display : flex;
align-items: center;
justify-content : center;
text-align : center;
padding : 10px !important;
`
export default function ModalConfirmarProfessor (props){
const {state, dispatch} = useContext(Store)
return (
<StyledModal
aria-labelledby="transition-modal-title"
aria-describedby="transition-modal-description"
open={props.open}
animation={true}
centered={true}
onClose={props.handleClose}
closeAfterTransition
BackdropComponent={Backdrop}
BackdropProps={{
timeout: 500,
}}
>
<Fade in={props.open} style={{ transitionDelay :"0.4ms"}}>
<>
<ConfirmarProfessorComponent>
<HeaderDiv>
<span style={{width:"32px"}}/>
<h2>Confirme os Dados</h2>
<Button style={{marginRight:"-8px", color:"000"}} onClick={props.handleClose}>
<CloseIcon style={{color:"#666", cursor:"pointer", verticalAlign:"middle"}}/>
</Button>
</HeaderDiv>
<DialogContentDiv>
<ContainerCentralized>
<p><strong>Município - UF:</strong> {props.info.school_uf.abbreviation} - {props.info.school_City.name} </p>
<p><strong>Escola:</strong> {props.info.school_name}</p>
<p><strong>Telefone da Escola:</strong> {props.info.school_phone}</p>
<p><strong>Seu CPF:</strong> {props.info.teacher_cpf}</p>
<ButtonsDiv>
<ConfirmButton onClick ={props.confirmar}>CONFIRMAR</ConfirmButton>
<CancelButton onClick = {props.cancelar}>CANCELAR</CancelButton>
</ButtonsDiv>
</ContainerCentralized>
</DialogContentDiv>
</ConfirmarProfessorComponent>
</>
</Fade>
</StyledModal>
)
}
const CancelButton = styled(Button)`
width : 140px !important;
color :#666 !important;
font-family : Roboto,sans-serif !important;
font-size : 14px !important;
font-weight : 500 !important;
height : 36px !important;
border-radius : 3px !important;
padding-left : 16px !important;
padding-right : 16px !important;
outline : none !important;
margin : 6px 8px !important;
display : inline-block !important;
`
const ConfirmButton = styled(Button)`
width : 140px !important;
background-color : #00bcd4 !important;
color : #fff !important;
font-family : Roboto,sans-serif !important;
font-size : 14px !important;
font-weight : 500 !important;
height : 36px !important;
border-radius : 3px !important;
padding-left : 32px !important;
padding-right : 32px !important;
outline : none !important;
margin : 6px 8px !important;
display : inline-block !important;
`
const ButtonsDiv = styled.div`
margin-top : 10px;
display : flex;
justify-content : center;
`
const ContainerCentralized = styled.div`
margin-top : 0;
padding-left : 20px;
padding-right : 30px;
p {
font-size : 15px;
margin : 0 0 10px;
}
`
const DialogContentDiv = styled.div`
padding : 20px 30px;
overflow : visible !important;
`
const HeaderDiv = styled.div`
text-align : center;
display : flex;
justify-content : space-between;
padding : 10px 26px 0 26px;
h2 {
font-size : 26px;
font-weight : lighter;
}
`
const ConfirmarProfessorComponent = styled.div`
min-width : 600px;
border-radius : 4px;
background-color : #fff;
color : #666;
`
......@@ -80,7 +80,7 @@ export default function PartOne (props) {
const handleSubmit = () => {
//console.log('handle submit : ', uf.abbreviation, uf.selected, municipio.name, municipio.selected, codigoINEP.selected)
props.handleBuscar(uf.abbreviation, uf.selected, municipio.name, municipio.selected, codigoINEP.selected)
props.handleBuscar(uf.name, uf.selected, municipio.name, municipio.selected, codigoINEP.selected)
}
//on render component, call simcaq api and update ufList
......@@ -88,6 +88,7 @@ export default function PartOne (props) {
axios.get(('https://simcaq.c3sl.ufpr.br/api/v1/state')
).then( (response) => {
handleSetStates(sortDict(response.data.result))
console.log(response.data.result)
},
(error) => console.log('erro acessando api do simcaq (estados)'))
}, [])
......
......@@ -18,7 +18,7 @@ export default function PartThree (props) {
const handleChangePhoneNumber = (event) => {
const input = event.target.value.replace(/\D/,'')
setPhoneNumber({...phoneNumber,
flagInvalid : (input.length > 9 ? true : false),
flagInvalid : (input.length < 9 ? true : false),
number : (input.length > 9 ? phoneNumber.number : input),
})
}
......@@ -30,20 +30,25 @@ export default function PartThree (props) {
const handleChangeCpf = (event) => {
const input = event.target.value.replace(/\D/,'')
setCpf({...cpf,
flagInvalid : (input.length > 11 ? true : false),
flagInvalid : (input.length < 11 ? true : false),
number : (input.length > 11 ? cpf.number : input),
})
}
const handleSubmit = () => {
const submit_phone = phoneNumber.number
const submit_cpf = cpf.number
props.handleSubmit(submit_phone, submit_cpf)
}
return (
<>
{console.log(props)}
<Content>
<h4>Vamos localizar o seu cadastro:</h4>
<Stepper items={props.stepper}/>
<form style={{textAlign:"start"}}>
<span>{props.info.school_name}</span>
<span>CENTRO EDUC INF MEU PEDACINHO DE CHAO</span>
<FormControl required style={{width:"100%"}}>
<p>Inserir o telefone da escola:</p>
<FormInput
......@@ -66,12 +71,13 @@ export default function PartThree (props) {
value={cpf.number}
handleChange={handleChangeCpf}
mask={'999.999.999-99'}
error={cpf.flagInvalid}
>
</FormInput>
</FormControl>
<div style={{display:"flex", justifyContent:"space-evenly",paddingTop:"10px", paddingBottom:"10px"}}>
<div style={{display:"flex", justifyContent:"center"}}>
<ButtonConfirmar onClick={props.handleBuscar}>BUSCAR</ButtonConfirmar>
<ButtonConfirmar onClick={( (cpf.flagInvalid || phoneNumber.flagInvalid) ? () => {console.log('cpf.flagInvalid: ', cpf.flagInvalid, 'phoneNumber.flagInvalid: ', phoneNumber.flagInvalid)} : handleSubmit)}>BUSCAR</ButtonConfirmar>
</div>
<div style={{display:"flex", justifyContent:"center"}}>
<ButtonGrey onClick={() => props.goBack(false, true, false)}>VOLTAR</ButtonGrey>
......
......@@ -10,7 +10,6 @@ import {simcaqAPIurl} from '../../env'
import {sortDict} from './PartOne.js'
export default function PartTwo (props) {
const [htttpRequestDone, setDone] = useState(false)
const [schoolList, setSchoolList] = useState([])
useEffect ( () => {
......@@ -20,22 +19,17 @@ export default function PartTwo (props) {
//console.log(code, uf, municipio)
//if user searched by inep code
if (code != '') {
if (code !== '') {
axios.get((`${simcaqAPIurl}/portal_mec_inep?filter=school_cod:` + code)
).then ((response) => {
//console.log(response.data.result)
setSchoolList(sortDict(response.data.result))
setDone(true)
}, (error) => console.log('erro ao dar get na escola por inep code')
)}
else if (uf != '' && municipio != '') {
else if (uf !== '' && municipio !== '') {
axios.get((`${simcaqAPIurl}/school?filter=state:"` + uf + '",city:"' + municipio + '",year:2017')
).then((response)=> {
//console.log(response.data.result)
setSchoolList(sortDict(response.data.result))
setDone(true)
}, (error) => console.log('erro ao dar get na escola por uf e municipio', code, uf, municipio)
)}
}, [])
......
......@@ -62,7 +62,6 @@ export default function CustomizedTables(props) {
<TableBody>
{props.rows.map(row => (
<>
{console.log('console.log(row": ', row)}
<StyledTableRow onClick={() => onClick(row)} key={row.id}>
<StyledTableCell component="th" scope="row">
{row.id}
......
......@@ -5,9 +5,17 @@ import Paper from '@material-ui/core/Paper';
import PartOne from '../Components/PageProfessorComponents/PartOne.js'
import PartTwo from '../Components/PageProfessorComponents/PartTwo.js'
import PartThree from '../Components/PageProfessorComponents/PartThree.js'
import ModalConfirmarProfessor from '../Components/ModalConfirmarProfessor.js'
import axios from 'axios'
import {apiUrl} from '../env';
export default function PageProfessor (props) {
const {state, dispatch} = useContext(Store)
const [modalOpen, toggleModal] = useState(false)
const handleModal = () => {
toggleModal(!modalOpen) ;
}
const redirect = () => {
props.history.push('/termos-publicar-recurso')
......@@ -60,9 +68,6 @@ export default function PageProfessor (props) {
}
const handleBuscarParteDois = (city_name, inep, school_name, state_name) => {
console.log(city_name, inep, school_name, state_name)
console.log((state_name ? state_name : ''))
const uf_id = registerInformation.school_uf.id
const school_city_id = registerInformation.school_City.id
const prev_state_name = registerInformation.school_uf.abbreviation
......@@ -83,13 +88,32 @@ export default function PageProfessor (props) {
toggleStepper(false, false, true)
}
const handleSubmit = (phone, cpf) => {
setRegisterInformation({...registerInformation,
teacher_cpf: (phone ? phone : ''),
school_phone: (cpf ? cpf : ''),
})
handleModal();
}
const handleCancelar = () => {
props.history.push('/perfil/atualizacoes')
}
const onClickTable = () => {
toggleStepper(false, false, true)
}
const handleFinalSubmit = () => {
//adicionar headers de accessToken
axios.post( (`${apiUrl}/users/teacher_request`), {
'city' : registerInformation.school_City.name,
'cpf' : registerInformation.teacher_cpf,
'inep_id' : registerInformation.inep_code,
'phone' : registerInformation.school_phone,
'school' : registerInformation.school_name,
'uf' : registerInformation.school_uf.abbreviation
})
.then( (response) => {
console.log(response.data)
}, (error) => console.log('deu erro')
)}
return (
<>
......@@ -97,6 +121,11 @@ export default function PageProfessor (props) {
state.userAgreedToPublicationTerms?
(
[
<>
<ModalConfirmarProfessor open={modalOpen} handleClose={handleModal}
info={registerInformation} confirmar = {() => {handleFinalSubmit()}}
cancelar = {() => {toggleModal()}}
/>
<div style={{backgroundColor:"#f4f4f4", color:"#666"}}>
<div style={{display: "flex", justifyContent:"center", paddingTop:"5vh", paddingBottom:"5vh"}}>
<Paper elevation={3} style= {{width:"max-content"}}>
......@@ -107,7 +136,7 @@ export default function PageProfessor (props) {
/>
}
{stepper[1].selected &&
<PartTwo stepper={stepper} onClickTable={onClickTable}
<PartTwo stepper={stepper}
info={registerInformation} goBack={toggleStepper}
handleCancelar={handleCancelar} handleBuscar={handleBuscarParteDois}
/>
......@@ -115,12 +144,14 @@ export default function PageProfessor (props) {
{stepper[2].selected &&
<PartThree stepper={stepper} goBack={toggleStepper}
handleCancelar={handleCancelar} info={registerInformation}
handleSubmit={handleSubmit}
/>
}
</div>
</Paper>
</div>
</div>
</>
]
)
:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment