diff --git a/src/Components/ComponentAlterarAvatar.js b/src/Components/ComponentAlterarAvatar.js index f6ed1c11912221e8b2bb46ccf0294bc119e13b2f..5ce25f28809d22e7b70eb8be1f9a3a29d9a2d9b7 100644 --- a/src/Components/ComponentAlterarAvatar.js +++ b/src/Components/ComponentAlterarAvatar.js @@ -128,6 +128,7 @@ const AvatarCircleDiv = styled.div` height : 150px; width : 150px; position : relative; + overflow: hidden; ` const DivFlowHolder =styled.div` @@ -204,13 +205,15 @@ export default function ComponentAlterarAvatar (props) { <img src={this.props.userAvatar} alt={'user avatar'} style={{height:"inherit", width:"inherit", objectFit:"cover"}}/> ) } - <ChangeAvatarDiv> - <span>Alterar</span> - <input accept="image/*" id="icon-button-file" - type="file" - onChange={(e) => props.handleFile(e.target.files) } - style={{display:"none"}}/> - </ChangeAvatarDiv> + <input accept="image/*" id="icon-button-file" + type="file" + onChange={(e) => props.handleFile(e.target.files) } + style={{display:"none"}}/> + <label for="icon-button-file" style={{width:"inherit"}}> + <ChangeAvatarDiv > + <span>Alterar</span> + </ChangeAvatarDiv> + </label> </AvatarCircleDiv> </DivFlowHolder> </DivAlterarFoto> diff --git a/src/Components/PageProfessorComponents/PartOne.js b/src/Components/PageProfessorComponents/PartOne.js index 082ac22fff823f8dce487bb96528b2117dfa39b9..2628b2278f5296887f8bcc81f2eac40f80cf4143 100644 --- a/src/Components/PageProfessorComponents/PartOne.js +++ b/src/Components/PageProfessorComponents/PartOne.js @@ -11,6 +11,7 @@ import Divider from '@material-ui/core/Divider'; import {ButtonCancelar} from './PartTwo.js' import axios from 'axios' import FormInput from '../FormInput.js' +import {simcaqAPIurl} from '../../env' export function sortDict (dict) { const newDict = dict.sort((a, b) => (a.name) > (b.name) ? 1 : -1) @@ -64,8 +65,9 @@ export default function PartOne (props) { const validateINEP = () => { const code = codigoINEP.selected - axios.get(('https://www.simcaq.c3sl.ufpr.br/api/v1/portal_mec_inep?filter=school_cod:' + code) + axios.get((`${simcaqAPIurl}/portal_mec_inep?filter=school_cod:` + code) ).then( (response) => { + console.log('code ', code, ' is valid') handleSubmit() }, (error) => { setCodigoINEP({...codigoINEP, @@ -77,8 +79,8 @@ export default function PartOne (props) { } const handleSubmit = () => { - console.log('handle submit : ', uf.abbreviation, uf.selected, municipio.name, municipio.selected, codigoINEP.value) - props.handleBuscar(uf.abbreviation, uf.selected, municipio.name, municipio.selected, codigoINEP.value) + //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) } //on render component, call simcaq api and update ufList diff --git a/src/Components/PageProfessorComponents/PartThree.js b/src/Components/PageProfessorComponents/PartThree.js index 32aa206484e85a8bd595c00de60570cfc12f3cde..28a886127206b87522114b4b1b25f7fd7011192e 100644 --- a/src/Components/PageProfessorComponents/PartThree.js +++ b/src/Components/PageProfessorComponents/PartThree.js @@ -38,11 +38,12 @@ export default function PartThree (props) { return ( <> + {console.log(props)} <Content> <h4>Vamos localizar o seu cadastro:</h4> <Stepper items={props.stepper}/> <form style={{textAlign:"start"}}> - <span>CENTRO EDUC INF MEU PEDACINHO DE CHAO</span> + <span>{props.info.school_name}</span> <FormControl required style={{width:"100%"}}> <p>Inserir o telefone da escola:</p> <FormInput diff --git a/src/Components/PageProfessorComponents/PartTwo.js b/src/Components/PageProfessorComponents/PartTwo.js index 2a9237e7c25188c0af80d5da1e653207da96f7e1..185341d6642435834e8f8d885af1f02addefde65 100644 --- a/src/Components/PageProfessorComponents/PartTwo.js +++ b/src/Components/PageProfessorComponents/PartTwo.js @@ -17,31 +17,35 @@ export default function PartTwo (props) { const code = (props.info.inep_code || '') const uf = (props.info.school_uf.id || '') const municipio = (props.info.school_City.id || '') - console.log(code, uf, municipio) + //console.log(code, uf, municipio) + //if user searched by inep code if (code != '') { axios.get((`${simcaqAPIurl}/portal_mec_inep?filter=school_cod:` + code) ).then ((response) => { - console.log(response.data.result) + //console.log(response.data.result) - setSchoolList(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 != '') { - axios.get((`${simcaqAPIurl}/school?filter=state:"` + uf + '",city_name:"' + municipio + '"') + axios.get((`${simcaqAPIurl}/school?filter=state:"` + uf + '",city:"' + municipio + '",year:2017') ). then((response)=> { - console.log(response.data.result) + //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) )} }, []) + const onClickTable = (city_name, id, name, state_name) => { + props.handleBuscar(city_name, id, name, state_name) + } + return ( <> - {console.log(props)} <Content> <h4>Vamos localizar o seu cadastro:</h4> <Stepper items={props.stepper}/> @@ -50,9 +54,9 @@ export default function PartTwo (props) { <InputContainer> <p>Selecione a sua escola:</p> - <CustomizedTables onClick={props.onClickTable} + <CustomizedTables columns={['Codigo INEP', 'Escola', 'UF', 'Cidade']} - rows={schoolList} + rows={schoolList} onClickTable={onClickTable} /> </InputContainer> diff --git a/src/Components/Table.js b/src/Components/Table.js index bdf987cef629d58d1403632546fb5d59b85e6b9c..1230013ca4885f09f5c66f13f8a4e9fc4fe0c5cc 100644 --- a/src/Components/Table.js +++ b/src/Components/Table.js @@ -41,9 +41,13 @@ const useStyles = makeStyles({ export default function CustomizedTables(props) { const classes = useStyles(); + const onClick = (row) => { + const {city_name, id, name, state_name} = row + props.onClickTable(city_name, id, name, state_name) + } + return ( <> - {console.log(props)} <TableContainer component={Paper}> <Table className={classes.table} aria-label="customized table"> <TableHead> @@ -57,7 +61,9 @@ export default function CustomizedTables(props) { </TableHead> <TableBody> {props.rows.map(row => ( - <StyledTableRow onClick={props.onClick} key={row.id}> + <> + {console.log('console.log(row": ', row)} + <StyledTableRow onClick={() => onClick(row)} key={row.id}> <StyledTableCell component="th" scope="row"> {row.id} </StyledTableCell> @@ -65,6 +71,7 @@ export default function CustomizedTables(props) { <StyledTableCell align="left">{row.state_name}</StyledTableCell> <StyledTableCell align="left">{row.city_name}</StyledTableCell> </StyledTableRow> + </> ))} </TableBody> </Table> diff --git a/src/Pages/PageProfessor.js b/src/Pages/PageProfessor.js index 295818ce9e49bccd26dc9f8092cf434260e0be70..b8068873c4edbe9f6eb8b3217395534ce8ab6d66 100644 --- a/src/Pages/PageProfessor.js +++ b/src/Pages/PageProfessor.js @@ -43,8 +43,8 @@ export default function PageProfessor (props) { ) } - const handleBuscar = (ufAbbreviation, ufID, nomeMunicipio, idMunicipio, inep) => { - console.log(ufAbbreviation, ufID, nomeMunicipio, idMunicipio, inep) + const handleBuscarParteUM = (ufAbbreviation, ufID, nomeMunicipio, idMunicipio, inep) => { + //console.log('handleBuscarParteUM: ', ufAbbreviation, ufID, nomeMunicipio, idMunicipio, inep) setRegisterInformation({...registerInformation, school_uf : { id : (ufID ? ufID : ''), @@ -56,6 +56,30 @@ export default function PageProfessor (props) { }, inep_code : (inep ? inep : '') }) + toggleStepper(false, true, false) + } + + 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 + 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) + }, + school_name: (school_name ? school_name : ''), + inep_code : (inep ? inep : '') + }) toggleStepper(false, false, true) } @@ -78,19 +102,19 @@ 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={handleBuscar} + <PartOne stepper={stepper} handleBuscar={handleBuscarParteUM} handleCancelar={handleCancelar} /> } {stepper[1].selected && <PartTwo stepper={stepper} onClickTable={onClickTable} info={registerInformation} goBack={toggleStepper} - handleCancelar={handleCancelar} + handleCancelar={handleCancelar} handleBuscar={handleBuscarParteDois} /> } {stepper[2].selected && <PartThree stepper={stepper} goBack={toggleStepper} - handleCancelar={handleCancelar} + handleCancelar={handleCancelar} info={registerInformation} /> } </div> diff --git a/src/Pages/UserPage.js b/src/Pages/UserPage.js index f6650c98056333c453a00309353a9c0746bedb43..f4457ff84c9103662748498b3a7ddd17e2d4b365 100644 --- a/src/Pages/UserPage.js +++ b/src/Pages/UserPage.js @@ -160,7 +160,7 @@ export default function UserPage (props){ </label> </CoverContainer> <ProfileAvatarDiv onMouseEnter={handleHoverAlterarFoto} onMouseLeave={handleHoverAlterarFoto} onClick={modalControl}> - <img src={state.currentUser.userAvatar} alt = "user avatar" style={{border:"0", verticalAlign:"middle"}}/> + <img src={state.currentUser.userAvatar} alt = "user avatar" style={{height : "inherit", width : "inherit", border:"0", verticalAlign:"middle"}}/> <ChangeAvatarDiv style={ {display : hoverAlterarFoto ? 'flex' : 'none'}}> <span>Alterar Foto</span> </ChangeAvatarDiv> diff --git a/src/Store.js b/src/Store.js index d57a0cde937ebbd0457934f9f8964f1308e211b5..539aecb69d34a136c08d8ba1cd0a742ae3da3b42 100644 --- a/src/Store.js +++ b/src/Store.js @@ -22,7 +22,7 @@ export const Store = React.createContext() const initialState = { searchOpen: false, - userIsLoggedIn : false, + userIsLoggedIn : true, userAgreedToPublicationTerms: true, userAgreedToPublicationPermissions: false, modalColaborarPlataformaOpen : false, diff --git a/src/env.js b/src/env.js index 36b6bc8d02f338624c2ac33f3d97ce7864acd34c..1f221ee7772cbcd5478dcb68a32769645a7e862d 100644 --- a/src/env.js +++ b/src/env.js @@ -21,7 +21,7 @@ var apiDomain = 'https://api.portalmec.c3sl.ufpr.br', apiVersion = 'v1', apiUrl = apiDomain + '/' + apiVersion; -var simcaqAPIDomain = 'https://www.simcaq.c3sl.ufpr.br', +var simcaqAPIDomain = 'https://www.simcaq.c3sl.ufpr.br/api', apiVersion = 'v1', simcaqAPIurl = simcaqAPIDomain + '/' + apiVersion