diff --git a/App/app/Router.js b/App/app/Router.js index 57660b20..c557ba5d 100755 --- a/App/app/Router.js +++ b/App/app/Router.js @@ -105,7 +105,7 @@ const AppStack = createBottomTabNavigator( }, { - initialRouteName: 'Eventos', + initialRouteName: 'Home', tabBarOptions: { showLabel: true, // hide labels @@ -132,7 +132,7 @@ const Stack = createStackNavigator({ navigation.navigate('Profile')}> - editar + Editar dados diff --git a/App/app/assets/img/campus.png b/App/app/assets/img/campus.png new file mode 100644 index 00000000..2a4e30e6 Binary files /dev/null and b/App/app/assets/img/campus.png differ diff --git a/App/app/screens/Home.js b/App/app/screens/Home.js index 27bc234c..2fba4441 100755 --- a/App/app/screens/Home.js +++ b/App/app/screens/Home.js @@ -82,7 +82,8 @@ class Home extends Component { //console.log('logged:'+this.props.logged); - //console.log(th2is.props) + //console.log(th2is.props + this.props.getEvents(this.props.user); } componentWillUnmount() {} @@ -98,6 +99,7 @@ class Home extends Component { } _update = () => { this.props.getUserInfo(this.props.token); + this.props.getEvents(this.props.user); }; render() { @@ -143,14 +145,46 @@ class Home extends Component { - - Informações Importantes + + + O que inclui o meu bilhete? + + + + + Acesso + + + {item} + } + /> + + + Alojamento + + + {item} + } + /> + + + Alimentação + + + {item} + } + /> - - Grupo de .... - Alojamento - + + @@ -162,32 +196,44 @@ class Home extends Component { borderRadius: 3 }} > - - - - Os tones - - - 5/6 elementos - + + + + Os tones + + + 5/6 elementos + - - - Adicionar + + + Adicionar @@ -203,8 +249,7 @@ class Home extends Component { - - rm equipa + rm equipa @@ -267,8 +312,6 @@ class Home extends Component { remover - - @@ -288,21 +331,40 @@ class Home extends Component { } const styles = StyleSheet.create({ - userName:{ - fontSize:16, - fontWeight:'bold' - }, + titleBilhete:{ + textAlign:'center', + fontSize:15, + fontWeight:'bold', + marginBottom:10 + }, + colBilhete:{ + width:'33%', + padding:10 + }, + boxStyle: { + + + padding:10, + borderWidth: 1, + marginBottom: 5, + borderColor:'#CC1A17' + + }, + userName: { + fontSize: 16, + fontWeight: "bold" + }, userRemove: { alignContent: "center", alignItems: "center", - - alignSelf:'center' + + alignSelf: "center" }, userT: { margin: 10, - width: "55%", - // backgroundColor: "red" + width: "55%" + // backgroundColor: "red" }, userLogo: { paddingLeft: 10, @@ -328,7 +390,7 @@ const styles = StyleSheet.create({ }, userStatsBox: { flex: 1, - backgroundColor:'white', + backgroundColor: "white", flexDirection: "row" }, userBox: { @@ -389,15 +451,15 @@ const styles = StyleSheet.create({ }, userStats: { backgroundColor: "white", - height: SCREEN_HEIGHT * 0.2, - // padding: 10, + //height: SCREEN_HEIGHT * 0.2, + // padding: 10, margin: 10, borderRadius: 5, marginTop: 10, marginBottom: 0 }, userStatsTitle: { - margin:10, + margin: 10, color: "white", fontSize: 17, fontWeight: "bold", @@ -415,7 +477,11 @@ function mapStateToProps(state, props) { user: state.apiReducer.user, logged: state.apiReducer.logged, userDetails: state.apiReducer.userDetails, - onHold: state.apiReducer.onHold + onHold: state.apiReducer.onHold, + bilhete: state.apiReducer.bilhete, + alimentacao: state.apiReducer.alimentacao, + alojamento: state.apiReducer.alojamento, + acesso: state.apiReducer.acesso }; } diff --git a/App/app/screens/calendarDetail.js b/App/app/screens/calendarDetail.js index 52b2c270..7bcfb2c6 100644 --- a/App/app/screens/calendarDetail.js +++ b/App/app/screens/calendarDetail.js @@ -1,151 +1,198 @@ -import * as React from 'react'; +import * as React from "react"; import { - View, - StyleSheet, - Dimensions, - Image, - ScrollView, - Text, - Button, - TouchableOpacity, - ImageBackground -} from 'react-native'; + View, + StyleSheet, + Dimensions, + Image, + ScrollView, + Text, + Button, + TouchableOpacity, + ImageBackground +} from "react-native"; -import {Divider, Icon, Avatar} from 'react-native-elements' -import {TabView, TabBar, SceneMap} from 'react-native-tab-view'; -import { - RkButton, RkCard, RkText, - RkTheme -} from 'react-native-ui-kitten'; -import Timeline from 'react-native-timeline-feed' +import { Divider, Icon, Avatar } from "react-native-elements"; +import { TabView, TabBar, SceneMap } from "react-native-tab-view"; +import { RkButton, RkCard, RkText, RkTheme } from "react-native-ui-kitten"; +import Timeline from "react-native-timeline-feed"; -import * as Progress from 'react-native-progress'; +import * as Progress from "react-native-progress"; -import NavAbsolute from '../components/Nav'; +import NavAbsolute from "../components/Nav"; -import {connect} from 'react-redux'; +import { connect } from "react-redux"; -import {bindActionCreators} from 'redux'; +import { bindActionCreators } from "redux"; -import * as Actions from '../store/actions'; //Import your actionss -import Swiper from 'react-native-swiper'; +import * as Actions from "../store/actions"; //Import your actionss +import Swiper from "react-native-swiper"; const SCREEN_HEIGHT = Dimensions.get("window").height; const SCREEN_WIDTH = Dimensions.get("window").width; -import FitImage from 'react-native-fit-image'; +import FitImage from "react-native-fit-image"; -import MapView, {PROVIDER_GOOGLE} from 'react-native-maps'; +import MapView, { PROVIDER_GOOGLE } from "react-native-maps"; -const formatObj = (obj) => { +const formatObj = obj => { + let a = {}; - let a = {}; - - a.push({}) - - return a + a.push({}); + return a; }; - class calendarDetail extends React.Component { + static navigationOptions = ({ navigation }) => ({ + header: ( + + ) + }); - - static navigationOptions = ({navigation}) => ({ - header: ( - { + this.setState({ user: this.props.user }); + console.log(this.props.events); + }; + + constructor(props) { + super(props); + + this.data = []; + } + + renderHeader = info => { + return ( + + + + + + ); + }; + + renderDescription = info => { + return ( + + + + + + {info.time === info.timeEnd + ? info.time + : `${info.time}H - ${info.timeEnd}H`} + + + + + + {info.name} + + Workshop + + + + - ), - }); - - - state = {}; - - componentDidMount() { - - this.props.getEvents(this.props.user); - console.log('didMount'); - console.log(this.props.events); - const {navigation} = this.props; - const info = navigation.getParam('info', 'error'); - console.log("putas") - console.log(info) - - } - - - _update = () => { - this.setState({user: this.props.user}); - console.log(this.props.events); - }; - - - constructor(props) { - - super(props) - - - this.data = [] - } - - renderHeader = (info) => { - return ( - - - - - + + {info.Enrolled} / {info.MaxAttendees} + + + + + + - ) - }; - - renderDescription = (info) => { - return ( - - - - - - {info.time === info.timeEnd ? info.time : `${info.time} - ${info.timeEnd}`} - - - - {info.name} - - - - - {info.Enrolled} / {info.MaxAttendees} - - - - Descrição - - - - - - Descrição - - - - {info.description} - - - + + André Duarte + + + Project manager at ubiwhere + + + + website + + - ) - }; -/* + + + + Descrição do orador: + + + Existem muitas variações das passagens do Lorem Ipsum disponíveis, + mas a maior parte sofreu alterações de alguma forma, pela injecção + de humor, ou de palavras aleatórias que nem sequer parecem + suficientemente credíveis.{" "} + + + + + + Descrição da palestra/workshop + + + {info.description} + + + + ); + }; + /* renderMap = () => { return ( @@ -168,284 +215,281 @@ class calendarDetail extends React.Component { ) }; */ - renderAttendee = () => { - return ( - - - - - - - - Nome do gajo - - - - navigation.goBack(null)} - color='#000' - iconStyle={styles.icon} - underlayColor="transparent" - underlineColorAndroid="transparent" - containerStyle={styles.iconContainer} - hitSlop={{top: 15, bottom: 15, left: 15, right: 15}} - /> - - + renderAttendee = () => { + return ( + + + + + + + + Nome do gajo + + + + navigation.goBack(null)} + color="#000" + iconStyle={styles.icon} + underlayColor="transparent" + underlineColorAndroid="transparent" + containerStyle={styles.iconContainer} + hitSlop={{ top: 15, bottom: 15, left: 15, right: 15 }} + /> + + + + ); + }; + + render() { + const { navigation } = this.props; + const info = navigation.getParam("info", "error"); + + return ( + + + + + {this.renderHeader(info)} - ); - }; - - - render() { - const {navigation} = this.props; - const info = navigation.getParam('info', 'error'); - - - return ( - - - - - - {this.renderHeader(info)} - - {this.renderDescription(info)} - - - - Localização - - - - - - - - - ) - } - + {this.renderDescription(info)} + + + Localização + + + + + + + ); + } } const styles = StyleSheet.create({ + block: { + marginTop: 15, - block:{ - marginTop:15, + backgroundColor: "white", + padding: 20, + shadowOffset: { + width: 0, + height: 2 + }, + shadowOpacity: 0.25, + shadowRadius: 3.84, - backgroundColor:'white', - padding:20 - }, - AttendeeContainer: { - flexDirection: 'row', - height: 55, - justifyContent: 'center', - marginLeft: 10, - marginRight: 10, - }, + elevation: 3 + }, + AttendeeContainer: { + flexDirection: "row", + height: 55, + justifyContent: "center", + marginLeft: 10, + marginRight: 10 + }, - centerRow: { - alignItems: 'center', - backgroundColor: 'transparent', - flex: 3, - flexDirection: 'column', - justifyContent: 'center', - }, + centerRow: { + alignItems: "center", + backgroundColor: "transparent", + flex: 3, + flexDirection: "column", + justifyContent: "center" + }, - leftRow: { - backgroundColor: 'transparent', - flex: 1, - flexDirection: 'row', - justifyContent: 'flex-start', - alignSelf: 'center', - }, - rightRow: { - alignItems: 'flex-end', - backgroundColor: 'transparent', - flex: 2, - flexDirection: 'row', - justifyContent: 'flex-end', - marginRight: 4, - alignSelf: 'center' - }, + leftRow: { + backgroundColor: "transparent", + flex: 1, + flexDirection: "row", + justifyContent: "flex-start", + alignSelf: "center" + }, + rightRow: { + alignItems: "flex-end", + backgroundColor: "transparent", + flex: 2, + flexDirection: "row", + justifyContent: "flex-end", + marginRight: 4, + alignSelf: "center" + }, - icon: { - justifyContent: 'flex-start', - marginTop: 2.8, - }, + icon: { + justifyContent: "flex-start", + marginTop: 2.8 + }, - nameAttendee: { - alignSelf: 'center', - fontSize: 20, - fontWeight: '400', - color: '#000', - marginBottom: 10, - }, + nameAttendee: { + alignSelf: "center", + fontSize: 20, + fontWeight: "400", + color: "#000", + marginBottom: 10 + }, - details: { - marginTop: 20, - flex: 1, - alignSelf: 'center', - }, + details: { + marginTop: 20, + flex: 1, + alignSelf: "center" + }, - infoRow: { - margin: 25, - }, + infoRow: { + margin: 25 + }, - ramoText: { - alignSelf: 'flex-start', - marginBottom: 5, - color: 'white', - fontSize: 17, - fontWeight: '400', - }, + ramoText: { + alignSelf: "flex-start", + marginBottom: 5, + color: "white", + fontSize: 17, + fontWeight: "400" + }, - timeText: { - alignItems: 'flex-end', - flex: 2, - lineHeight: 10, - marginRight: 4, - }, + timeText: { + alignItems: "flex-end", + flex: 2, + lineHeight: 10, + marginRight: 20 + }, - mainViewStyle: { - flex: 1, - flexGrow: 1, - flexDirection: 'column', - }, + mainViewStyle: { + flex: 1, + flexGrow: 1, + flexDirection: "column" + }, - scroll: { - backgroundColor: '#eee', - flex: 1, - //marginBottom: 55, - }, + scroll: { + backgroundColor: "#eee", + flex: 1 + //marginBottom: 55, + }, - header:{ - flex: 1, - padding: 10, - backgroundColor: 'white', - borderRadius: 0, - - }, - cardContainer: { - flex: 1, - padding: 10, - // margin: 20, - backgroundColor: 'white', - borderRadius: 5, + header: { + flex: 1, + padding: 10, + backgroundColor: "white", + borderRadius: 0, + shadowColor: "#000", + shadowOffset: { + width: 0, + height: 2 }, + shadowOpacity: 0.25, + shadowRadius: 3.84, - headerContainer: { - flex: 1, - }, + elevation: 3 + }, + cardContainer: { + flex: 1, + padding: 10, + // margin: 20, + backgroundColor: "white", + borderRadius: 5 + }, - container: { - flex: 1, - flexDirection: 'column', - }, - coverContainer: { - position: 'relative', - }, - coverImage: { - height: Dimensions.get('window').width * (2 / 4), - width: Dimensions.get('window').width, - }, - /*headerContainer: { + headerContainer: { + flex: 1 + }, + + container: { + flex: 1, + flexDirection: "column" + }, + coverContainer: { + position: "relative" + }, + coverImage: { + height: Dimensions.get("window").width * (2 / 4), + width: Dimensions.get("window").width + }, + /*headerContainer: { alignItems: 'center', backgroundColor: '#FFF', },*/ + carreerPathContainer: { + backgroundColor: "#CC1A17", + height: 50, + flex: 1, + alignItems: "center", + justifyContent: "center", + paddingTop: 15 + }, + carreerPathText: { + height: 50, + color: "white", + fontWeight: "bold", + fontSize: 20 + }, + companyHeader: { + backgroundColor: "#dddddd", + // height:150, + borderRadius: 5, + margin: 10, + padding: 10 + }, + companyTitle: { + paddingBottom: 5, + fontWeight: "bold", + color: "#777777", + fontSize: 17 - carreerPathContainer: { - backgroundColor: '#CC1A17', - height: 50, - flex: 1, - alignItems: 'center', - justifyContent: 'center', - paddingTop: 15, - }, - carreerPathText: { - - height: 50, - color: 'white', - fontWeight: 'bold', - fontSize: 20, - - }, - companyHeader: { - backgroundColor: '#dddddd', - // height:150, - borderRadius: 5, - margin: 10, - padding: 10 - - - }, - companyTitle: { - paddingBottom: 5, - fontWeight: 'bold', - color: '#777777', - fontSize: 17, - - // padding:20 - }, - companyLogo: { - borderRadius: 20, - - }, - - wrapper: {}, - company: { - flex: 1, - flexDirection: 'row', - // backgroundColor:'red', - color: 'black' - }, - - companyLogoContainer: { - flex: 1, - justifyContent: 'center', - width: '60%', - // backgroundColor:'white', - margin: 20, - - - }, - aboutCompany: { - width: SCREEN_WIDTH, - flex: 1, - justifyContent: 'center', - alignItems: 'center', - } + // padding:20 + }, + companyLogo: { + borderRadius: 20 + }, + wrapper: {}, + company: { + flex: 1, + flexDirection: "row", + // backgroundColor:'red', + color: "black" + }, + companyLogoContainer: { + flex: 1, + justifyContent: "center", + width: "60%", + // backgroundColor:'white', + margin: 20 + }, + aboutCompany: { + width: SCREEN_WIDTH, + flex: 1, + justifyContent: "center", + alignItems: "center" + } }); - function mapStateToProps(state, props) { - - return { - - token: state.apiReducer.token, - user: state.apiReducer.user, - logged: state.apiReducer.logged, - events: state.apiReducer.events, - careerPath: state.apiReducer.careerPath, - - } + return { + token: state.apiReducer.token, + user: state.apiReducer.user, + logged: state.apiReducer.logged, + events: state.apiReducer.events, + careerPath: state.apiReducer.careerPath + }; } function mapDispatchToProps(dispatch) { - - return bindActionCreators(Actions, dispatch); + return bindActionCreators(Actions, dispatch); } -export default connect(mapStateToProps, mapDispatchToProps)(calendarDetail); \ No newline at end of file +export default connect( + mapStateToProps, + mapDispatchToProps +)(calendarDetail); diff --git a/App/app/store/actions/api.js b/App/app/store/actions/api.js index ccc7967a..7e4c5e42 100644 --- a/App/app/store/actions/api.js +++ b/App/app/store/actions/api.js @@ -734,84 +734,151 @@ export function getAvailableSessions(token) { }; } + +//ESTA FUNÇÃO TEM MUITO CÓDIGO MAL FEITO... + function getE(user) { + var cenas = []; let events = []; + var alimentacao=[]; + var alojamento=[]; + var acesso=[] var i = 0; + console.log(user.Sessions) for (let key in user.Sessions) { + + //se forem sessões de bilhete, adiciona a outra lista + if( + user.Sessions[key].Id==1 || //dia 12 de abril + user.Sessions[key].Id==22 || //jantar 12 de abril + user.Sessions[key].Id==23 || //almoço e jantar 13 de abril + user.Sessions[key].Id==24 || //almoço e jantar 14 de abril + user.Sessions[key].Id==25 || //almoço 15 de abril + user.Sessions[key].Id==26 || //alojamento 12 de abril + user.Sessions[key].Id==29 || //alojamento 13 de abril + user.Sessions[key].Id==31 || //alojamento 14 de abril + user.Sessions[key].Id==32 || //dia 13 de abril + user.Sessions[key].Id==33 || //dia 14 de abril + user.Sessions[key].Id==34 || //dia 15 de abril + user.Sessions[key].Id==35 || //jantar dia 12 de abril + user.Sessions[key].Id==36 || //jantar dia 13 de abril + user.Sessions[key].Id==37 //jantar dia 14 de abril + ){ + // bilhete.push( user.Sessions[key]) + + if(user.Sessions[key].Id==1){ + + acesso.push("dia 12") + + } + + if(user.Sessions[key].Id==22) + alimentacao.push("dia 12") + + if(user.Sessions[key].Id==23) + alimentacao.push("dia 13") + + if(user.Sessions[key].Id==24) + alimentacao.push("dia 14") + + if(user.Sessions[key].Id==25) + alimentacao.push("dia 15") + + if(user.Sessions[key].Id==26) + alojamento.push("dia 12") + if(user.Sessions[key].Id==29) + alojamento.push("dia 13") + if(user.Sessions[key].Id==31) + alojamento.push("dia 14") + + if(user.Sessions[key].Id==32) + acesso.push("dia 13") + if(user.Sessions[key].Id==33) + acesso.push("dia 14") + if(user.Sessions[key].Id==34) + acesso.push("dia 15") + + + + }else{ + events.push({ key: i++, time: moment(user.Sessions[key].SessionStart).format("HH:mm"), timeEnd: moment(user.Sessions[key].SessionEnd).format("HH:mm"), //lineColor:'#009688', imageUrl: - "https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/Vjkyj2hBg/welcome-white-sign-with-falling-colorful-confetti-animation-on-white-background_sglmmh3qm__F0013.png", + "https://tickets.enei.pt/adminpoint/Content/Images/Uploads/Sessions/"+user.Sessions[key].Image, description: user.Sessions[key].Description, name: user.Sessions[key].Name, Enrolled: user.Sessions[key].Enrolled, MaxAttendees: user.Sessions[key].MaxAttendees, day: moment(user.Sessions[key].SessionStart).format("DD") }); - } + }} + + + + const result = flow(groupBy("day"))(events); - - for (let key in result) { - cenas.push(result[key]); - } - var a = [], - b = [], - c = [], - d = []; + b = [], + c = [], + d = []; - for (let key in cenas[0]) { + + + //MEU DEUS QUE É ISTO??? + + for (let key in result["12"]) { a.push({ - time: cenas[0][key].time, - timeEnd: cenas[0][key].timeEnd, - imageUrl: cenas[0][key].imageUrl, - description: cenas[0][key].description, - name: cenas[0][key].name, - Enrolled: cenas[0][key].Enrolled, - MaxAttendees: cenas[0][key].MaxAttendees, - day: cenas[0][key].day + time: result["12"][key].time, + timeEnd: result["12"][key].timeEnd, + imageUrl:result["12"][key].imageUrl, + description: result["12"][key].description, + name:result["12"][key].name, + Enrolled: result["12"][key].Enrolled, + MaxAttendees: result["12"][key].MaxAttendees, + day: result["12"][key].day }); } - for (let key in cenas[1]) { + for (let key in result["13"]) { b.push({ - time: cenas[1][key].time, - timeEnd: cenas[1][key].timeEnd, - imageUrl: cenas[1][key].imageUrl, - description: cenas[1][key].description, - name: cenas[1][key].name, - Enrolled: cenas[1][key].Enrolled, - MaxAttendees: cenas[1][key].MaxAttendees, - day: cenas[1][key].day + time: result["13"][key].time, + timeEnd: result["13"][key].timeEnd, + imageUrl: result["13"][key].imageUrl, + description:result["13"][key].description, + name: result["13"][key].name, + Enrolled:result["13"][key].Enrolled, + MaxAttendees: result["13"][key].MaxAttendees, + day: result["13"][key].day }); } - for (let key in cenas[2]) { + for (let key in result["14"]) { c.push({ - time: cenas[2][key].time, - timeEnd: cenas[2][key].timeEnd, - imageUrl: cenas[2][key].imageUrl, - description: cenas[2][key].description, - name: cenas[2][key].name, - Enrolled: cenas[2][key].Enrolled, - MaxAttendees: cenas[2][key].MaxAttendees, - day: cenas[2][key].day + time: result["14"][key].time, + timeEnd: result["14"][key].timeEnd, + imageUrl: result["14"][key].imageUrl, + description: result["14"][key].description, + name:result["14"][key].name, + Enrolled: result["14"][key].Enrolled, + MaxAttendees: result["14"][key].MaxAttendees, + day: result["14"][key].day }); } - for (let key in cenas[3]) { + for (let key in result["15"]) { d.push({ - time: cenas[3][key].time, - timeEnd: cenas[3][key].timeEnd, - imageUrl: cenas[3][key].imageUrl, - description: cenas[3][key].description, - name: cenas[3][key].name, - Enrolled: cenas[3][key].Enrolled, - MaxAttendees: cenas[3][key].MaxAttendees, - day: cenas[3][key].day + time: result["15"][key].time, + timeEnd: result["15"][key].timeEnd, + imageUrl:result["15"][key].imageUrl, + description: result["15"][key].description, + name: result["15"][key].name, + Enrolled: result["15"][key].Enrolled, + MaxAttendees: result["15"][key].MaxAttendees, + day: result["15"][key].day }); } a = _.sortBy(a, function(o) { @@ -827,11 +894,13 @@ function getE(user) { return o.time; }); - return { a, b, c, d }; + console.log(alimentacao) + return { a, b, c, d ,ab:alimentacao, acc: acesso, al:alojamento}; } export function getEvents(user) { var result = getE(user); + return dispatch => { dispatch({ type: GET_EVENTS, @@ -839,7 +908,10 @@ export function getEvents(user) { day1: result.a, day2: result.b, day3: result.c, - day4: result.d + day4: result.d, + alimentacao: result.ab, + acesso: result.acc, + alojamento: result.al }); }; } diff --git a/App/app/store/reducers/api.js b/App/app/store/reducers/api.js index 08140067..033527a4 100644 --- a/App/app/store/reducers/api.js +++ b/App/app/store/reducers/api.js @@ -50,7 +50,10 @@ let apiState = { b: {}, c: {}, d: {}, - loadingLogin: false + loadingLogin: false, + alimentacao:[], + acesso:[], + alojamento:[] }; const apiReducer = (state = apiState, action) => { @@ -180,7 +183,11 @@ const apiReducer = (state = apiState, action) => { a: action.day1, b: action.day2, c: action.day3, - d: action.day4 + d: action.day4, + alimentacao: action.alimentacao, + alojamento: action.alojamento, + acesso:action.acesso + }); return state;