diff --git a/smppir-checkin-portal/src/App.js b/smppir-checkin-portal/src/App.js index cd5a59d97c0e58585fe326550202c5db59414e1c..6ac14aee2c6fefa25cd8461531c73db46d83ea0a 100644 --- a/smppir-checkin-portal/src/App.js +++ b/smppir-checkin-portal/src/App.js @@ -5,6 +5,7 @@ import MainPage from './Pages/MainPage' import Login from './Pages/Login' import Welcome from './Pages/Welcome' import Map from './Pages/Map' +import Category from './Pages/Category' class App extends Component { constructor(props) { @@ -23,6 +24,7 @@ class App extends Component { <Route exact={true} path="/" component={MainPage}/> <Route exact={true} path="/login" render={()=><Login saveCredentials={this.saveCredentials}/>}/> <Route exact={true} path="/welcome" render={()=><Welcome credentials={this.state.credentials}/>}/> + <Route exact={true} path="/category" render={()=><Category credentials={this.state.credentials}/>}/> <Route exact={true} path="/map" component={Map}/> </div> </Router> diff --git a/smppir-checkin-portal/src/Pages/Category.js b/smppir-checkin-portal/src/Pages/Category.js new file mode 100644 index 0000000000000000000000000000000000000000..c5145f64567b631cc9892eb8c124286e53ac5441 --- /dev/null +++ b/smppir-checkin-portal/src/Pages/Category.js @@ -0,0 +1,68 @@ +import React, { Component } from 'react'; +import './Styles/MainPage.css'; +import BarraBrasil from '../Components/BarraBrasil' +import { NavItem, Row, Col, Card } from 'react-materialize' +import AppFooter from '../Components/AppFooter' +import NavigationBar from '../Components/NavigationBar' +import { Redirect } from 'react-router-dom' +import { URL, ADMIN_FEATURES } from '../env' +import axios from 'axios' +import List from '../Components/List' + + +class Welcome extends Component { + constructor(props) { + console.log("DEBUG : ", props.credentials) + super(props); + this.state={ + 'credentials': {}, + 'currentUser': {} + } + } + + componentWillMount(){ + console.log("DEBUG CREDENTIALS -> : ", this.props) + if(this.props.credentials.id) { + axios.get(`${URL}end_users/${this.props.credentials.userId}?access_token=${this.props.credentials.id}`).then((resp) => { + console.log(resp) + this.setState({'credentials': this.props.credentials, 'currentUser': resp.data.result}) + }) + } + } + + + render() { + console.log("DEBUG 1: ", this.props.credentials.id); + console.log("DEBUG 2: ", this.state); + if(this.props.credentials.id){ + return ( + <div> + <BarraBrasil /> + <NavigationBar button={<NavItem id={'login-btn'} href='/login'>Login</NavItem>}/> + <Row> + <Col s={12} m={6} offset={'m3'}> + <Card> + <p>Bem-vindo <b>{this.state.currentUser.name}</b>, o que faremos agora?</p> + <Row> + <List items={ADMIN_FEATURES}/> + </Row> + </Card> + </Col> + </Row> + + <AppFooter/> + </div> + ); + } + else{ + return ( + <Redirect to='/login'/> + ); + } + + } + + +} + +export default Welcome; \ No newline at end of file diff --git a/smppir-checkin-portal/src/env.js b/smppir-checkin-portal/src/env.js index aabae849ab3a8be63cba15495ad3e245afb44f52..d1326922aa17fca2d6bdf6255a34c1c30f0e16fc 100644 --- a/smppir-checkin-portal/src/env.js +++ b/smppir-checkin-portal/src/env.js @@ -2,7 +2,7 @@ export const URL = "http://seppirhomologa.c3sl.ufpr.br/mobileAPI/api/" export const ADMIN_FEATURES = [ {'value':'Gerar Relatório', 'active': false}, {'value':'Gerenciar Usuários', 'active': false}, - {'value':'Gerenciar Categorias', 'active': false}, + {'value':'Gerenciar Categorias', 'active': false, 'href':'/category'}, {'value':'Gerenciar Localizações', 'active': false}, {'value':'Visualizar Mapa', 'active': false} ]