talk details

zmiguel
henrydays 3 years ago
parent c476e7bbf5
commit 71b9ce7a51
  1. 4
      App/app/Router.js
  2. BIN
      App/app/assets/img/campus.png
  3. 160
      App/app/screens/Home.js
  4. 824
      App/app/screens/calendarDetail.js
  5. 166
      App/app/store/actions/api.js
  6. 11
      App/app/store/reducers/api.js

@ -105,7 +105,7 @@ const AppStack = createBottomTabNavigator(
},
{
initialRouteName: 'Eventos',
initialRouteName: 'Home',
tabBarOptions: {
showLabel: true, // hide labels
@ -132,7 +132,7 @@ const Stack = createStackNavigator({
<TouchableOpacity style={{marginRight: 20, flex: 1, flexDirection: 'row'}}
onPress={() => navigation.navigate('Profile')}>
<Text>editar</Text>
<Text>Editar dados</Text>
<IconFA name="user-edit" size={22}/>
</TouchableOpacity>

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 KiB

@ -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 {
</ImageBackground>
<View style={styles.userStats}>
<View style={{backgroundColor:'orange'}}>
<Text style={styles.userStatsTitle}>Informações Importantes</Text>
<View style={{ backgroundColor: "orange" }}>
<Text style={styles.userStatsTitle}>
O que inclui o meu bilhete?
</Text>
</View>
<View style={styles.userStatsBox}>
<Text style={{margin:10}}>Grupo de ....</Text>
<Text style={{margin:10}}>Alojamento</Text>
<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>}
/>
</View>
<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>
</View>
<View>
@ -162,32 +196,44 @@ class Home extends Component {
borderRadius: 3
}}
>
<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
<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
style={{
color: "white",
marginLeft: 10,
marginBottom: 5
alignItems: "center",
alignContent: "center",
alignSelf: "center"
}}
>
5/6 elementos
</Text>
</View>
<View style={{alignItems:'center', alignContent:'center',alignSelf:'center'}}>
<IconFA name="plus" color={'white'} size={30} />
<Text style={{color:'white'}}>Adicionar</Text>
<IconFA name="plus" color={"white"} size={30} />
<Text style={{ color: "white" }}>Adicionar</Text>
</View>
</View>
@ -203,8 +249,7 @@ class Home extends Component {
</View>
<TouchableOpacity style={styles.userRemove}>
<Text style={{fontWeight:'bold'}}>rm equipa</Text>
<Text style={{ fontWeight: "bold" }}>rm equipa</Text>
</TouchableOpacity>
</View>
<Divider style={{ backgroundColor: "black" }} />
@ -267,8 +312,6 @@ class Home extends Component {
<Text>remover</Text>
</TouchableOpacity>
</View>
</View>
</View>
</View>
@ -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
};
}

@ -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';
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'
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 * 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 MapView, {PROVIDER_GOOGLE} from 'react-native-maps';
const formatObj = (obj) => {
import FitImage from "react-native-fit-image";
let a = {};
import MapView, { PROVIDER_GOOGLE } from "react-native-maps";
a.push({})
const formatObj = obj => {
let a = {};
return a
a.push({});
return a;
};
class calendarDetail extends React.Component {
static navigationOptions = ({navigation}) => ({
header: (
<NavAbsolute
navigation={navigation}
// title={navigation.state.params.info.name}
static navigationOptions = ({ navigation }) => ({
header: (
<NavAbsolute
navigation={navigation}
// title={navigation.state.params.info.name}
/>
)
});
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 (
<View style={styles.headerContainer}>
<View style={styles.coverContainer}>
<ImageBackground
source={{
uri: info.imageUrl
}}
style={styles.coverImage}
/>
</View>
</View>
);
};
renderDescription = info => {
return (
<View>
<View style={styles.header}>
<View
style={{
flexDirection: "row",
alignItems: "center",
alignSelf: "center"
}}
>
<View style={styles.timeText}>
<Text style={{ color: "#CC1A17", fontSize: 15 }}>
{info.time === info.timeEnd
? info.time
: `${info.time}H - ${info.timeEnd}H`}
</Text>
</View>
</View>
<View>
<Text
style={{
margin: 10,
marginBottom: 0,
marginTop: 0,
fontSize: 20,
color: "#CC1A17"
}}
>
{info.name}
</Text>
<Text style={{ marginLeft: 10 }}>Workshop</Text>
</View>
<View style={{ margin: 10 }}>
<Progress.Bar
color={"#000000"}
progress={info.Enrolled / info.MaxAttendees}
height={10}
unfilledColor={"white"}
width={210}
/>
),
});
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 (
<View style={styles.headerContainer}>
<View style={styles.coverContainer}>
<ImageBackground
source={{
uri: info.imageUrl,
}}
style={styles.coverImage}
>
</ImageBackground>
</View>
<Text>
{info.Enrolled} / {info.MaxAttendees}
</Text>
</View>
<Divider style={{ backgroundColor: "#eeeeee" }} />
<View style={{ flex: 1, flexDirection: "row", marginTop: 10 }}>
<View style={{ width: 100, height: 100, padding: 5 }}>
<FitImage
source={{
uri:
"http://enei2019.uingress.com/adminpoint/Content/Images/Uploads/Speakers/ffb043cb-3073-421c-a070-5d273b50fc23.jpeg"
}}
style={{ padding: 5 }}
/>
</View>
)
};
renderDescription = (info) => {
return (
<View>
<View style={styles.header}>
<View style={{flexDirection: "row", alignItems: 'center', alignSelf:'center'}}>
<View style={styles.timeText}>
<Text style={{color: "#CC1A17", fontSize: 15}}>
{info.time === info.timeEnd ? info.time : `${info.time} - ${info.timeEnd}`}
</Text>
</View>
</View>
<View><Text style={{margin:10,marginTop:0, fontSize:20, color:'#CC1A17'}}>{info.name}</Text></View>
<View style={{margin:10}}>
<Progress.Bar color={'#000000'} progress={info.Enrolled / info.MaxAttendees} height={10}
unfilledColor={'white'} width={210}/>
<Text >{info.Enrolled} / {info.MaxAttendees}</Text>
</View>
<Divider style={{backgroundColor: '#000'}}/>
<View>
<Text style={{fontSize:15, color:'#CC1A17', padding:10}}>Descrição</Text>
<Text style={{paddingLeft:10, paddingRigh:10}}></Text>
</View>
</View>
<View style={styles.block}>
<Text style={{fontSize: 20, color: "#CC1A17"}}>Descrição</Text>
<Divider style={{backgroundColor: '#000'}}/>
<View style={{marginTop: 10}}>
<Text>
{info.description}
</Text>
</View>
</View>
<Text style={{ fontWeight: "bold", fontSize: 20, margin: 10 }}>
André Duarte
</Text>
<Text style={{ marginLeft: 10 }}>
Project manager at ubiwhere
</Text>
<TouchableOpacity>
<Text style={{ color: "#CC1A17", marginLeft: 10 }}>
website
</Text>
</TouchableOpacity>
</View>
)
};
/*
</View>
<View>
<Text
style={{
fontWeight: "bold",
color: "#CC1A17",
margin: 10,
marginBottom: 0,
fontSize: 15
}}
>
Descrição do orador:
</Text>
<Text style={{ margin: 10 }}>
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.{" "}
</Text>
</View>
</View>
<View style={styles.block}>
<Text style={{ fontSize: 15, color: "#CC1A17", fontWeight:'bold' }}>Descrição da palestra/workshop</Text>
<Divider style={{ backgroundColor: "#000" }} />
<View style={{ marginTop: 10 }}>
<Text>{info.description}</Text>
</View>
</View>
</View>
);
};
/*
renderMap = () => {
return (
@ -168,284 +215,281 @@ class calendarDetail extends React.Component {
)
};
*/
renderAttendee = () => {
return (
<View style={{backgroundColor: '#fff', height: SCREEN_HEIGHT * 0.1}}>
<View style={styles.AttendeeContainer}>
<View style={styles.leftRow}>
<Avatar
rounded
size="medium"
source={{
uri: "https://cdn3.iconfinder.com/data/icons/vector-icons-6/96/256-512.png",
}}
/>
</View>
<View style={styles.centerRow}>
<Text style={styles.titleText} numberOfLines={1}>
Nome do gajo
</Text>
</View>
<View style={styles.rightRow}>
<Icon
size={24}
name="visibility"
type="material-icon"
onPress={() => navigation.goBack(null)}
color='#000'
iconStyle={styles.icon}
underlayColor="transparent"
underlineColorAndroid="transparent"
containerStyle={styles.iconContainer}
hitSlop={{top: 15, bottom: 15, left: 15, right: 15}}
/>
</View>
</View>
</View>
);
};
render() {
const {navigation} = this.props;
const info = navigation.getParam('info', 'error');
return (
<View style={styles.mainViewStyle}>
<ScrollView style={styles.scroll}>
<View style={styles.container}>
<View style={styles.headerContainer}>
{this.renderHeader(info)}
</View>
{this.renderDescription(info)}
</View>
<View style={styles.block}>
<Text style={{fontSize: 20, color: "#CC1A17"}}>Localização</Text>
<Divider style={{backgroundColor: '#000', marginBottom: 10}}/>
</View>
</ScrollView>
<Divider style={{backgroundColor: 'black'}}/>
renderAttendee = () => {
return (
<View style={{ backgroundColor: "#fff", height: SCREEN_HEIGHT * 0.1 }}>
<View style={styles.AttendeeContainer}>
<View style={styles.leftRow}>
<Avatar
rounded
size="medium"
source={{
uri:
"https://cdn3.iconfinder.com/data/icons/vector-icons-6/96/256-512.png"
}}
/>
</View>
<View style={styles.centerRow}>
<Text style={styles.titleText} numberOfLines={1}>
Nome do gajo
</Text>
</View>
<View style={styles.rightRow}>
<Icon
size={24}
name="visibility"
type="material-icon"
onPress={() => navigation.goBack(null)}
color="#000"
iconStyle={styles.icon}
underlayColor="transparent"
underlineColorAndroid="transparent"
containerStyle={styles.iconContainer}
hitSlop={{ top: 15, bottom: 15, left: 15, right: 15 }}
/>
</View>
</View>
</View>
);
};
render() {
const { navigation } = this.props;
const info = navigation.getParam("info", "error");
return (
<View style={styles.mainViewStyle}>
<ScrollView style={styles.scroll}>
<View style={styles.container}>
<View style={styles.headerContainer}>
{this.renderHeader(info)}
</View>
)
}
{this.renderDescription(info)}
</View>
<View style={styles.block}>
<Text style={{ fontSize: 15, color: "#CC1A17",fontWeight:'bold' }}>Localização</Text>
<Divider style={{ backgroundColor: "#000", marginBottom: 10 }} />
<Image source={require('../assets/img/campus.png')} style={{width:SCREEN_WIDTH*0.9}}></Image>
</View>
</ScrollView>
<Divider style={{ backgroundColor: "black" }} />
</View>
);
}
}
const styles = StyleSheet.create({
block:{
marginTop:15,
backgroundColor:'white',
padding:20
block: {
marginTop: 15,
backgroundColor: "white",
padding: 20,
shadowOffset: {
width: 0,
height: 2
},
AttendeeContainer: {
flexDirection: 'row',
height: 55,
justifyContent: 'center',
marginLeft: 10,
marginRight: 10,
shadowOpacity: 0.25,
shadowRadius: 3.84,
elevation: 3
},
AttendeeContainer: {
flexDirection: "row",
height: 55,
justifyContent: "center",
marginLeft: 10,
marginRight: 10
},
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"
},
icon: {
justifyContent: "flex-start",
marginTop: 2.8
},
nameAttendee: {
alignSelf: "center",
fontSize: 20,
fontWeight: "400",
color: "#000",
marginBottom: 10
},
details: {
marginTop: 20,
flex: 1,
alignSelf: "center"
},
infoRow: {
margin: 25
},
ramoText: {
alignSelf: "flex-start",
marginBottom: 5,
color: "white",
fontSize: 17,
fontWeight: "400"
},
timeText: {
alignItems: "flex-end",
flex: 2,
lineHeight: 10,
marginRight: 20
},
mainViewStyle: {
flex: 1,
flexGrow: 1,
flexDirection: "column"
},
scroll: {
backgroundColor: "#eee",
flex: 1
//marginBottom: 55,
},
header: {
flex: 1,
padding: 10,
backgroundColor: "white",
borderRadius: 0,
shadowColor: "#000",
shadowOffset: {
width: 0,
height: 2
},
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'
},
icon: {
justifyContent: 'flex-start',
marginTop: 2.8,
},
nameAttendee: {
alignSelf: 'center',
fontSize: 20,
fontWeight: '400',
color: '#000',
marginBottom: 10,
},
details: {
marginTop: 20,
flex: 1,
alignSelf: 'center',
},
infoRow: {
margin: 25,
},
ramoText: {
alignSelf: 'flex-start',
marginBottom: 5,
color: 'white',
fontSize: 17,
fontWeight: '400',
},
timeText: {
alignItems: 'flex-end',
flex: 2,
lineHeight: 10,
marginRight: 4,
},
mainViewStyle: {
flex: 1,
flexGrow: 1,
flexDirection: 'column',
},
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,
},
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: {
shadowOpacity: 0.25,
shadowRadius: 3.84,
elevation: 3
},
cardContainer: {
flex: 1,
padding: 10,
// margin: 20,
backgroundColor: "white",
borderRadius: 5
},
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,
// 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',
}
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"
}
});
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);
export default connect(
mapStateToProps,
mapDispatchToProps
)(calendarDetail);

@ -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]);
}
const result = flow(groupBy("day"))(events);
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
});
};
}