2019-03-13 20:42:20 +00:00
|
|
|
import React, { Component } from "react";
|
2019-02-03 20:54:27 +00:00
|
|
|
|
2019-02-16 22:16:41 +00:00
|
|
|
import {
|
2019-03-13 20:42:20 +00:00
|
|
|
Button,
|
|
|
|
View,
|
|
|
|
Text,
|
|
|
|
TouchableOpacity,
|
|
|
|
FlatList,
|
|
|
|
ActivityIndicator,
|
|
|
|
Dimensions,
|
|
|
|
StyleSheet,
|
|
|
|
Image,
|
|
|
|
ImageBackground,
|
|
|
|
NetInfo,
|
|
|
|
AppState
|
|
|
|
} from "react-native";
|
|
|
|
|
|
|
|
import { Shadow } from "react-native-shadow";
|
|
|
|
import Icon from "react-native-vector-icons/Ionicons";
|
|
|
|
import { RkButton, RkTheme } from "react-native-ui-kitten";
|
|
|
|
|
|
|
|
import { connect } from "react-redux";
|
|
|
|
|
|
|
|
import { bindActionCreators } from "redux";
|
|
|
|
|
|
|
|
import * as Actions from "../store/actions"; //Import your actionss
|
2019-02-16 22:16:41 +00:00
|
|
|
import ImageOverlay from "react-native-image-overlay";
|
2019-02-03 20:54:27 +00:00
|
|
|
|
2019-03-13 20:42:20 +00:00
|
|
|
import { createStore } from "redux";
|
|
|
|
import PTRView from "react-native-pull-to-refresh";
|
|
|
|
import { Provider } from "react-redux";
|
|
|
|
import { ScrollView } from "react-native-gesture-handler";
|
2019-02-16 22:16:41 +00:00
|
|
|
const SCREEN_HEIGHT = Dimensions.get("window").height;
|
|
|
|
const SCREEN_WIDTH = Dimensions.get("window").width;
|
2019-03-13 20:42:20 +00:00
|
|
|
import { Card, Divider } from "react-native-elements";
|
2019-02-28 23:52:58 +00:00
|
|
|
|
2019-03-13 20:42:20 +00:00
|
|
|
import RNMaterialShadows from "react-native-material-shadows";
|
2019-02-28 23:52:58 +00:00
|
|
|
|
2019-03-13 20:42:20 +00:00
|
|
|
import IconFA from "react-native-vector-icons/FontAwesome5";
|
2019-01-30 14:32:25 +00:00
|
|
|
|
2019-01-31 00:46:49 +00:00
|
|
|
class Home extends Component {
|
2019-03-13 20:42:20 +00:00
|
|
|
_handleConnectionChange = isConnected => {
|
|
|
|
// this.props.dispatch(connectionState({ status: isConnected }));
|
|
|
|
console.log("fck that");
|
|
|
|
};
|
|
|
|
_refresh() {
|
|
|
|
return new Promise(resolve => {
|
|
|
|
setTimeout(() => {
|
|
|
|
resolve();
|
|
|
|
}, 2000);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
_callApi() {
|
|
|
|
this.props.getUserInfo(this.props.token);
|
|
|
|
}
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
token: { valid: false },
|
|
|
|
logged: true,
|
|
|
|
onHold: true,
|
|
|
|
user: { Name: "" },
|
|
|
|
userDetails: {},
|
|
|
|
appState: AppState.currentState
|
|
|
|
};
|
|
|
|
}
|
|
|
|
handleConnectivityChange = () => {
|
|
|
|
console.log("asdasdasdasdasd");
|
|
|
|
};
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
// NetInfo.isConnected.addEventListener('connectionChange', this.handleConnectivityChange);
|
|
|
|
|
|
|
|
// this.props.hold();
|
|
|
|
console.log("hold" + this.props.onHold);
|
|
|
|
//this.props.logoutUser();
|
|
|
|
|
|
|
|
//console.log(this.props.token);
|
2019-02-08 18:56:38 +00:00
|
|
|
|
2019-03-15 22:07:22 +00:00
|
|
|
this.props.getUserInfo(this.props.token);
|
2019-01-08 19:09:50 +00:00
|
|
|
|
2019-03-13 20:42:20 +00:00
|
|
|
//console.log('logged:'+this.props.logged);
|
2019-02-08 14:23:56 +00:00
|
|
|
|
2019-03-16 01:17:43 +00:00
|
|
|
//console.log(th2is.props
|
|
|
|
this.props.getEvents(this.props.user);
|
2019-03-13 20:42:20 +00:00
|
|
|
}
|
|
|
|
componentWillUnmount() {}
|
2019-01-23 16:22:11 +00:00
|
|
|
|
2019-03-13 20:42:20 +00:00
|
|
|
bClick() {
|
|
|
|
//this.props.logoutUser();
|
2019-02-08 18:56:38 +00:00
|
|
|
|
2019-03-13 20:42:20 +00:00
|
|
|
let a = {};
|
|
|
|
// this.setState({ user: this.props.user });
|
|
|
|
// console.log(this.props.user)
|
|
|
|
//
|
2019-02-06 23:24:00 +00:00
|
|
|
|
2019-03-13 20:42:20 +00:00
|
|
|
//var navigate = this.props.navigation.navigate
|
|
|
|
}
|
|
|
|
_update = () => {
|
2019-03-15 22:07:22 +00:00
|
|
|
this.props.getUserInfo(this.props.token);
|
2019-03-16 01:17:43 +00:00
|
|
|
this.props.getEvents(this.props.user);
|
2019-03-13 20:42:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { navigate } = this.props.navigation;
|
|
|
|
|
|
|
|
if (this.props.onHold) {
|
|
|
|
return (
|
|
|
|
<View>
|
|
|
|
<Text>lollsss {this.props.onHold}</Text>
|
|
|
|
<ActivityIndicator size="large" color="#0000ff" />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (this.props.logged) {
|
|
|
|
return (
|
|
|
|
<PTRView onRefresh={this._update}>
|
|
|
|
<ScrollView style={{ backgroundColor: "#eeeeee" }}>
|
|
|
|
<View>
|
|
|
|
<ImageBackground
|
|
|
|
opacity={0.9}
|
|
|
|
source={require("../assets/img/bg_3.jpg")}
|
|
|
|
style={{
|
|
|
|
width: "100%",
|
|
|
|
|
|
|
|
// marginTop:150,
|
|
|
|
backgroundColor: "rgba(255,255,255,1)"
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<View style={styles.homeHeader}>
|
|
|
|
<View style={styles.userImageContainer}>
|
|
|
|
<Image
|
|
|
|
style={styles.userImage}
|
|
|
|
source={{ uri: "https://i.imgur.com/XXJ7LxV.jpg" }}
|
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
{this.props.user != undefined && (
|
|
|
|
<Text style={styles.userText}>{this.props.user.Name}</Text>
|
|
|
|
)}
|
|
|
|
<Text style={styles.userTextSub}>
|
|
|
|
{this.props.user.Company}
|
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
</ImageBackground>
|
2019-01-31 00:46:49 +00:00
|
|
|
|
2019-03-13 20:42:20 +00:00
|
|
|
<View style={styles.userStats}>
|
2019-03-16 01:17:43 +00:00
|
|
|
<View style={{ backgroundColor: "orange" }}>
|
|
|
|
<Text style={styles.userStatsTitle}>
|
|
|
|
O que inclui o meu bilhete?
|
|
|
|
</Text>
|
2019-02-03 20:54:27 +00:00
|
|
|
</View>
|
2019-03-16 01:17:43 +00:00
|
|
|
<View style={{ flex: 1, flexDirection: 'row', flexWrap: 'wrap' }}>
|
|
|
|
<View style={styles.colBilhete}>
|
|
|
|
<Text style={styles.titleBilhete}>Acesso </Text>
|
|
|
|
<FlatList
|
|
|
|
data={this.props.acesso}
|
|
|
|
renderItem={({item}) =>
|
|
|
|
<View style={styles.boxStyle}>
|
|
|
|
<Text><IconFA name="check" size={18} color={'#CC1A17'}/> {item}</Text>
|
|
|
|
</View>}
|
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
<View style={styles.colBilhete}>
|
|
|
|
<Text style={styles.titleBilhete}>Alojamento</Text>
|
|
|
|
<FlatList
|
|
|
|
data={this.props.alojamento}
|
|
|
|
renderItem={({item}) =>
|
|
|
|
<View style={styles.boxStyle}>
|
|
|
|
<Text><IconFA name="check" size={18} color={'#CC1A17'}/> {item}</Text>
|
|
|
|
</View>}
|
|
|
|
/>
|
2019-03-13 20:42:20 +00:00
|
|
|
</View>
|
2019-03-16 01:17:43 +00:00
|
|
|
<View style={styles.colBilhete}>
|
|
|
|
<Text style={styles.titleBilhete}>Alimentação</Text>
|
|
|
|
<FlatList
|
|
|
|
|
|
|
|
data={this.props.alimentacao}
|
|
|
|
renderItem={({item}) =>
|
|
|
|
<View style={styles.boxStyle}>
|
|
|
|
<Text><IconFA name="check" size={18} color={'#CC1A17'}/> {item}</Text>
|
|
|
|
</View>}
|
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
|
|
</View>
|
2019-03-13 20:42:20 +00:00
|
|
|
</View>
|
|
|
|
|
|
|
|
<View>
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
margin: 10,
|
|
|
|
marginTop: 20,
|
|
|
|
backgroundColor: "white",
|
|
|
|
borderRadius: 3
|
|
|
|
}}
|
|
|
|
>
|
2019-03-16 01:17:43 +00:00
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
backgroundColor: "#CC1A17",
|
|
|
|
flex: 1,
|
|
|
|
flexDirection: "row"
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<View style={{ width: "79%" }}>
|
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
fontSize: 25,
|
|
|
|
color: "white",
|
|
|
|
margin: 10,
|
|
|
|
fontWeight: "bold",
|
|
|
|
marginBottom: 0
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
Os tones
|
|
|
|
</Text>
|
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
color: "white",
|
|
|
|
marginLeft: 10,
|
|
|
|
marginBottom: 5
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
5/6 elementos
|
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
<View
|
2019-03-13 20:42:20 +00:00
|
|
|
style={{
|
2019-03-16 01:17:43 +00:00
|
|
|
alignItems: "center",
|
|
|
|
alignContent: "center",
|
|
|
|
alignSelf: "center"
|
2019-03-13 20:42:20 +00:00
|
|
|
}}
|
|
|
|
>
|
2019-03-16 01:17:43 +00:00
|
|
|
<IconFA name="plus" color={"white"} size={30} />
|
|
|
|
<Text style={{ color: "white" }}>Adicionar</Text>
|
2019-02-16 22:16:41 +00:00
|
|
|
</View>
|
2019-03-13 20:42:20 +00:00
|
|
|
</View>
|
|
|
|
|
|
|
|
<View>
|
|
|
|
<View style={{ flex: 1 }}>
|
|
|
|
<View style={styles.user}>
|
|
|
|
<View style={styles.userLogo}>
|
|
|
|
<IconFA name="user" size={40} />
|
|
|
|
</View>
|
|
|
|
<View style={styles.userT}>
|
|
|
|
<Text style={styles.userName}>Henrique Dias</Text>
|
|
|
|
<Text>AFFJASDXZ</Text>
|
|
|
|
</View>
|
|
|
|
|
|
|
|
<TouchableOpacity style={styles.userRemove}>
|
2019-03-16 01:17:43 +00:00
|
|
|
<Text style={{ fontWeight: "bold" }}>rm equipa</Text>
|
2019-03-13 20:42:20 +00:00
|
|
|
</TouchableOpacity>
|
|
|
|
</View>
|
|
|
|
<Divider style={{ backgroundColor: "black" }} />
|
|
|
|
<View style={styles.user}>
|
|
|
|
<View style={styles.userLogo}>
|
|
|
|
<IconFA name="user" size={40} />
|
|
|
|
</View>
|
|
|
|
<View style={styles.userT}>
|
|
|
|
<Text style={styles.userName}>Henrique Dias</Text>
|
|
|
|
<Text>AFFJASDXZ</Text>
|
|
|
|
</View>
|
|
|
|
|
|
|
|
<TouchableOpacity style={styles.userRemove}>
|
|
|
|
<IconFA name="times" color={"#CC1A17"} size={30} />
|
|
|
|
<Text>remover</Text>
|
|
|
|
</TouchableOpacity>
|
|
|
|
</View>
|
|
|
|
<Divider style={{ backgroundColor: "black" }} />
|
|
|
|
<View style={styles.user}>
|
|
|
|
<View style={styles.userLogo}>
|
|
|
|
<IconFA name="user" size={40} />
|
|
|
|
</View>
|
|
|
|
<View style={styles.userT}>
|
|
|
|
<Text style={styles.userName}>Henrique Dias</Text>
|
|
|
|
<Text>AFFJASDXZ</Text>
|
|
|
|
</View>
|
|
|
|
|
|
|
|
<TouchableOpacity style={styles.userRemove}>
|
|
|
|
<IconFA name="times" color={"#CC1A17"} size={30} />
|
|
|
|
<Text>remover</Text>
|
|
|
|
</TouchableOpacity>
|
|
|
|
</View>
|
|
|
|
<Divider style={{ backgroundColor: "black" }} />
|
|
|
|
<View style={styles.user}>
|
|
|
|
<View style={styles.userLogo}>
|
|
|
|
<IconFA name="user" size={40} />
|
|
|
|
</View>
|
|
|
|
<View style={styles.userT}>
|
|
|
|
<Text style={styles.userName}>Henrique Dias</Text>
|
|
|
|
<Text>AFFJASDXZ</Text>
|
|
|
|
</View>
|
|
|
|
|
|
|
|
<TouchableOpacity style={styles.userRemove}>
|
|
|
|
<IconFA name="times" color={"#CC1A17"} size={30} />
|
|
|
|
<Text>remover</Text>
|
|
|
|
</TouchableOpacity>
|
|
|
|
</View>
|
|
|
|
<Divider style={{ backgroundColor: "black" }} />
|
|
|
|
<View style={styles.user}>
|
|
|
|
<View style={styles.userLogo}>
|
|
|
|
<IconFA name="user" size={40} />
|
|
|
|
</View>
|
|
|
|
<View style={styles.userT}>
|
|
|
|
<Text style={styles.userName}>Henrique Dias</Text>
|
|
|
|
<Text>AFFJASDXZ</Text>
|
|
|
|
</View>
|
|
|
|
|
|
|
|
<TouchableOpacity style={styles.userRemove}>
|
|
|
|
<IconFA name="times" color={"#CC1A17"} size={30} />
|
|
|
|
<Text>remover</Text>
|
|
|
|
</TouchableOpacity>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
</View>
|
2019-01-31 00:46:49 +00:00
|
|
|
</View>
|
2019-03-13 20:42:20 +00:00
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
</ScrollView>
|
|
|
|
</PTRView>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<View>
|
|
|
|
<Text>sem permissões para aceder aqui</Text>
|
|
|
|
</View>
|
|
|
|
);
|
2019-01-31 00:46:49 +00:00
|
|
|
}
|
2019-03-13 20:42:20 +00:00
|
|
|
}
|
2019-02-16 22:16:41 +00:00
|
|
|
}
|
2019-01-30 20:12:43 +00:00
|
|
|
|
2019-02-16 22:16:41 +00:00
|
|
|
const styles = StyleSheet.create({
|
2019-03-16 01:17:43 +00:00
|
|
|
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"
|
|
|
|
},
|
2019-03-13 20:42:20 +00:00
|
|
|
userRemove: {
|
|
|
|
alignContent: "center",
|
|
|
|
alignItems: "center",
|
2019-03-16 01:17:43 +00:00
|
|
|
|
|
|
|
alignSelf: "center"
|
2019-02-17 00:46:36 +00:00
|
|
|
},
|
2019-03-13 20:42:20 +00:00
|
|
|
userT: {
|
|
|
|
margin: 10,
|
2019-02-16 22:16:41 +00:00
|
|
|
|
2019-03-16 01:17:43 +00:00
|
|
|
width: "55%"
|
|
|
|
// backgroundColor: "red"
|
2019-03-13 20:42:20 +00:00
|
|
|
},
|
|
|
|
userLogo: {
|
|
|
|
paddingLeft: 10,
|
2019-01-31 00:46:49 +00:00
|
|
|
|
2019-03-13 20:42:20 +00:00
|
|
|
margin: 10
|
|
|
|
},
|
|
|
|
user: {
|
|
|
|
alignSelf: "center",
|
|
|
|
flex: 1,
|
|
|
|
flexDirection: "row",
|
2019-01-31 00:46:49 +00:00
|
|
|
|
2019-03-13 20:42:20 +00:00
|
|
|
margin: 10,
|
2019-01-31 00:46:49 +00:00
|
|
|
|
2019-03-13 20:42:20 +00:00
|
|
|
marginTop: 5,
|
|
|
|
width: "100%"
|
|
|
|
},
|
|
|
|
userBoxText: {
|
|
|
|
color: "white",
|
|
|
|
fontWeight: "bold"
|
|
|
|
},
|
|
|
|
userStatsBoxIcon: {
|
|
|
|
color: "white"
|
|
|
|
},
|
|
|
|
userStatsBox: {
|
|
|
|
flex: 1,
|
2019-03-16 01:17:43 +00:00
|
|
|
backgroundColor: "white",
|
2019-03-13 20:42:20 +00:00
|
|
|
flexDirection: "row"
|
|
|
|
},
|
|
|
|
userBox: {
|
|
|
|
alignItems: "center",
|
|
|
|
justifyContent: "center",
|
|
|
|
width: "33%"
|
|
|
|
},
|
|
|
|
userCurriculum: {
|
|
|
|
paddingTop: 5,
|
|
|
|
color: "red",
|
|
|
|
fontWeight: "bold",
|
|
|
|
fontSize: 15
|
|
|
|
},
|
|
|
|
userBioRow: {
|
|
|
|
flex: 1,
|
|
|
|
flexDirection: "row",
|
|
|
|
padding: 10
|
|
|
|
},
|
|
|
|
userBioText: {},
|
|
|
|
userBioLogo: {
|
|
|
|
marginLeft: SCREEN_WIDTH * 0.05,
|
|
|
|
width: SCREEN_WIDTH * 0.15
|
|
|
|
},
|
2019-02-08 14:23:56 +00:00
|
|
|
|
2019-03-13 20:42:20 +00:00
|
|
|
userTextSub: {
|
|
|
|
backgroundColor: "rgba(0,0,0,0.7)",
|
|
|
|
color: "white"
|
|
|
|
},
|
|
|
|
userText: {
|
|
|
|
backgroundColor: "rgba(0,0,0,0.7)",
|
|
|
|
color: "white",
|
|
|
|
fontWeight: "bold",
|
|
|
|
fontSize: 20
|
|
|
|
},
|
|
|
|
homeHeader: {
|
|
|
|
flex: 1,
|
2019-01-31 00:46:49 +00:00
|
|
|
|
2019-03-13 20:42:20 +00:00
|
|
|
height: SCREEN_HEIGHT * 0.3,
|
|
|
|
justifyContent: "center",
|
|
|
|
alignItems: "center"
|
|
|
|
},
|
|
|
|
userImage: {
|
|
|
|
width: 110,
|
|
|
|
height: 110,
|
|
|
|
borderWidth: 1,
|
|
|
|
borderRadius: 5,
|
|
|
|
borderWidth: 2,
|
|
|
|
borderColor: "white"
|
|
|
|
},
|
|
|
|
userBio: {
|
|
|
|
flex: 1,
|
|
|
|
padding: 10,
|
|
|
|
margin: 9,
|
|
|
|
backgroundColor: "white",
|
|
|
|
// height: SCREEN_HEIGHT*0.20,
|
|
|
|
color: "black",
|
|
|
|
borderRadius: 5
|
|
|
|
},
|
|
|
|
userStats: {
|
|
|
|
backgroundColor: "white",
|
2019-03-16 01:17:43 +00:00
|
|
|
//height: SCREEN_HEIGHT * 0.2,
|
|
|
|
// padding: 10,
|
2019-03-13 20:42:20 +00:00
|
|
|
margin: 10,
|
|
|
|
borderRadius: 5,
|
|
|
|
marginTop: 10,
|
|
|
|
marginBottom: 0
|
|
|
|
},
|
|
|
|
userStatsTitle: {
|
2019-03-16 01:17:43 +00:00
|
|
|
margin: 10,
|
2019-03-13 20:42:20 +00:00
|
|
|
color: "white",
|
|
|
|
fontSize: 17,
|
|
|
|
fontWeight: "bold",
|
|
|
|
padding: 1
|
|
|
|
},
|
|
|
|
userImageContainer: {
|
|
|
|
alignSelf: "center"
|
2019-02-08 14:23:56 +00:00
|
|
|
|
2019-03-13 20:42:20 +00:00
|
|
|
// transform: [{ rotate: '-15deg'}],
|
|
|
|
}
|
|
|
|
});
|
|
|
|
function mapStateToProps(state, props) {
|
|
|
|
return {
|
|
|
|
token: state.apiReducer.token,
|
|
|
|
user: state.apiReducer.user,
|
|
|
|
logged: state.apiReducer.logged,
|
|
|
|
userDetails: state.apiReducer.userDetails,
|
2019-03-16 01:17:43 +00:00
|
|
|
onHold: state.apiReducer.onHold,
|
|
|
|
bilhete: state.apiReducer.bilhete,
|
|
|
|
alimentacao: state.apiReducer.alimentacao,
|
|
|
|
alojamento: state.apiReducer.alojamento,
|
|
|
|
acesso: state.apiReducer.acesso
|
2019-03-13 20:42:20 +00:00
|
|
|
};
|
2019-01-31 00:46:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function mapDispatchToProps(dispatch) {
|
2019-03-13 20:42:20 +00:00
|
|
|
return bindActionCreators(Actions, dispatch);
|
2019-01-31 00:46:49 +00:00
|
|
|
}
|
|
|
|
|
2019-03-13 20:42:20 +00:00
|
|
|
export default connect(
|
|
|
|
mapStateToProps,
|
|
|
|
mapDispatchToProps
|
|
|
|
)(Home);
|