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

pagina de requisicao professor quase pronta

parent 42bbc173
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
......@@ -65,7 +65,7 @@ export default function ModalConfirmarProfessor (props){
<DialogContentDiv>
<ContainerCentralized>
<p><strong>Município - UF:</strong> {props.info.school_uf.abbreviation} - {props.info.school_city.name} </p>
<p><strong>Município - UF:</strong> {props.info.school_uf.name} - {props.info.school_city} </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>
......
......@@ -44,6 +44,7 @@ export default function PartThree (props) {
return (
<>
{console.log(props)}
<Content>
<h4>Vamos localizar o seu cadastro:</h4>
<Stepper items={props.stepper}/>
......
......@@ -14,8 +14,8 @@ export default function PartTwo (props) {
useEffect ( () => {
const code = (props.info.inep_code || '')
const uf = (props.info.school_uf.id || '')
const municipio = (props.info.school_City.id || '')
const uf = (props.info.school_uf.abbreviation || '')
const municipio = (props.info.school_city || '')
//console.log(code, uf, municipio)
//if user searched by inep code
......@@ -26,7 +26,7 @@ export default function PartTwo (props) {
}, (error) => console.log('erro ao dar get na escola por inep code')
)}
else if (uf !== '' && municipio !== '') {
axios.get((`${simcaqAPIurl}/school?filter=state:"` + uf + '",city:"' + municipio + '",year:2017')
axios.get((`${simcaqAPIurl}/school?search=state_name:"` + uf + '",city_name:"' + municipio + '"&filter=year:2017')
).then((response)=> {
//console.log(response.data.result)
setSchoolList(sortDict(response.data.result))
......
......@@ -48,8 +48,8 @@ export default function PageProfessor (props) {
)
}
const handleBuscarParteUM = (ufAbbreviation, ufName, nomeMunicipio, inep) => {
console.log('handleBuscarParteUM: ', ufAbbreviation, ufName, nomeMunicipio, inep)
const handleBuscarParteUm = (ufAbbreviation, ufName, nomeMunicipio, inep) => {
console.log('handleBuscarParteUm: ', ufAbbreviation, ufName, nomeMunicipio, inep)
setRegisterInformation({...registerInformation,
school_uf : {
abbreviation: (ufAbbreviation ? ufAbbreviation : ''),
......@@ -62,27 +62,23 @@ export default function PageProfessor (props) {
}
const handleBuscarParteDois = (city_name, inep, school_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
const uf_abbreviation = registerInformation.school_uf.abbreviation
const prev_state_name = registerInformation.school_uf.name
const prev_city_name = registerInformation.school_city.name
setRegisterInformation({...registerInformation,
school_uf : {
id : uf_id,
abbreviation: (state_name ? state_name : prev_state_name)
},
school_city : {
id : school_city_id,
name : (city_name ? city_name : prev_city_name)
abbreviation : uf_abbreviation,
name: (state_name ? state_name : prev_state_name)
},
school_city :(city_name ? city_name : prev_city_name),
school_name: (school_name ? school_name : ''),
inep_code : (inep ? inep : '')
})
toggleStepper(false, false, true)
}
const handleSubmit = (phone, cpf) => {
const handleParteTres = (phone, cpf) => {
setRegisterInformation({...registerInformation,
teacher_cpf: (phone ? phone : ''),
school_phone: (cpf ? cpf : ''),
......@@ -96,14 +92,20 @@ export default function PageProfessor (props) {
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
})
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.name
},
{ headers : {
'Access-Token': sessionStorage.getItem('@portalmec/accessToken'),
'Client': sessionStorage.getItem('@portalmec/clientToken'),
'Uid': sessionStorage.getItem('@portalmec/uid')
}}
)
.then( (response) => {
console.log(response.data)
}, (error) => console.log('deu erro')
......@@ -125,7 +127,7 @@ export default function PageProfessor (props) {
<Paper elevation={3} style= {{width:"max-content"}}>
<div style={{paddingRight:"15px", paddingLeft:"15px"}}>
{stepper[0].selected &&
<PartOne stepper={stepper} handleBuscar={handleBuscarParteUM}
<PartOne stepper={stepper} handleBuscar={handleBuscarParteUm}
handleCancelar={handleCancelar}
/>
}
......@@ -138,7 +140,7 @@ export default function PageProfessor (props) {
{stepper[2].selected &&
<PartThree stepper={stepper} goBack={toggleStepper}
handleCancelar={handleCancelar} info={registerInformation}
handleSubmit={handleSubmit}
handleSubmit={handleParteTres}
/>
}
</div>
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment