Merge branch 'Borges_march' of https://github.com/henrydays/ENEI2019 into Borges_march

This commit is contained in:
João Borges 2019-03-11 16:38:50 +00:00
commit 81e2e63c1e
59 changed files with 4050 additions and 2625 deletions

3
.gitignore vendored
View File

@ -84,4 +84,5 @@ typings/
bin/ bin/
obj/ obj/
.vscode/ .vscode/
*.cache

View File

@ -1,551 +1,505 @@
import React, {Component} from 'react'; import React, { Component } from "react";
import { import {
Platform, Platform,
StyleSheet, StyleSheet,
Text, Text,
View, View,
StatusBar, StatusBar,
Dimensions, Dimensions,
Image, Image,
ActivityIndicator, ActivityIndicator,
Button, Button,
TouchableHighlight, TouchableHighlight,
Keyboard, Keyboard,
ImageBackground, ImageBackground,
LinearGradient, LinearGradient,
TouchableOpacity, TouchableOpacity,
TextInput, TextInput,
NetInfo, NetInfo,
Animated Animated
} from "react-native";
} from 'react-native'; import { bindActionCreators } from "redux";
import { connect } from "react-redux";
import {bindActionCreators} from 'redux'; import QRCodeScanner from "react-native-qrcode-scanner";
import {connect} from 'react-redux'; import { UtilStyles } from "./assets/styles";
import QRCodeScanner from 'react-native-qrcode-scanner'; import * as Actions from "./store/actions";
import {UtilStyles} from './assets/styles'
import * as Actions from './store/actions'; import { RkButton, RkTheme, RkText, RkTextInput } from "react-native-ui-kitten";
import {RkButton, RkTheme, RkText, RkTextInput} from 'react-native-ui-kitten';
import Modal from "react-native-modal"; import Modal from "react-native-modal";
import Router from './Router' import Router from "./Router";
import Icon from "react-native-vector-icons/Ionicons" import Icon from "react-native-vector-icons/Ionicons";
const SCREEN_HEIGHT = Dimensions.get("window").height; const SCREEN_HEIGHT = Dimensions.get("window").height;
const SCREEN_WIDTH = Dimensions.get("window").width; const SCREEN_WIDTH = Dimensions.get("window").width;
import Swiper from 'react-native-swiper'; import Swiper from "react-native-swiper";
var TimerMixin = require("react-timer-mixin");
var TimerMixin = require('react-timer-mixin');
function handleConnectivityChange() { function handleConnectivityChange() {
console.log("asdasd"); console.log("asdasd");
} }
class App extends Component { class App extends Component {
handleConnectivityChange = isConnected => { handleConnectivityChange = isConnected => {
this.setState({isConnected}); this.setState({ isConnected });
} };
_activate = () => { _activate = () => {
this.setState({ isModalVisible: !this.state.isModalVisible });
this.scanner.reactivate();
};
_scanQr = () => {
this.props.openScannerLogin();
console.log(this.props.UI_loginScannerActive);
};
_tryLogin = () => {
this.props.waitLogin();
//console.log(this.state.text)
//this.scanner.reactivate();
this.props.login(this.state.username, this.state.text);
};
this.setState({isModalVisible: !this.state.isModalVisible}); _toggleModal = () =>
this.scanner.reactivate(); this.setState({ isModalVisible: !this.state.isModalVisible });
} constructor(props) {
_scanQr = () => { super(props);
this.props.openScannerLogin()
console.log(this.props.UI_loginScannerActive)
}
_tryLogin = () => {
//console.log(this.state.text) this.state = {
//this.scanner.reactivate(); token: { valid: false },
this.props.login(this.state.username, this.state.text); tokenData: "",
onHold: true,
logged: false,
} isModalVisible: false,
state: { text: "" },
_toggleModal = () => username: "QR code",
this.setState({isModalVisible: !this.state.isModalVisible}); failedAttempt: false,
push: 4,
constructor(props) { UI_loginScannerActive: false,
userDetails: { username: "", password: "" },
super(props); isConnected: true,
modalOpen: false
this.state = {
token: {valid: false},
tokenData: '',
onHold: true,
logged: false,
isModalVisible: false,
state: {text: ''},
username: 'QR code',
failedAttempt: false,
push: 4,
UI_loginScannerActive: false,
userDetails: {username: '', password: ''},
isConnected: true
};
}
_print = () => {
console.log("hello")
this.setState({push: 0})
}; };
}
_print = () => {
console.log("hello");
this.setState({ push: 0 });
};
checkValue = e => {
console.log("check" + e);
};
_handleConnectionChange = isConnected => {
this.props.connectionState(true);
};
checkValue = (e) => { componentDidMount() {
console.log("check" + e) //this.props.hold();
}; this.props.loginInternal();
NetInfo.isConnected.addEventListener(
"connectionChange",
this.handleConnectivityChange
);
_handleConnectionChange = (isConnected) => { this.setState({ isModalVisible: false });
this.props.connectionState(true); //verifica se o utilizador tem token guardado
}; this.props.checkUser(this.props.userDetails);
this.keyboardDidShowListener = Keyboard.addListener(
"keyboardDidShow",
this._keyboardDidShow
);
this.keyboardDidHideListener = Keyboard.addListener(
"keyboardDidHide",
this._keyboardDidHide
);
}
componentWillUnmount() {
NetInfo.isConnected.removeEventListener(
"connectionChange",
this.handleConnectivityChange
);
}
_keyboardDidShow() {
//alert('Keyboard Shown');
// this.setState({push:0})
}
componentDidMount() { _keyboardDidHide() {
this.props.hold(); //this.setState({push:4})
NetInfo.isConnected.addEventListener('connectionChange', this.handleConnectivityChange); }
onSuccess = e => {
// this.setState({ isModalVisible: !this.state.isModalVisible });
// this.props.login(e.data, 'f8908cc0');
this.props.closeLoginQRScan();
this.setState({ username: e.data });
this.setState({isModalVisible: false}) console.log("QR code lido");
//verifica se o utilizador tem token guardado };
this.props.checkUser(this.props.userDetails);
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow);
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);
render() {
if (!this.props.logged && this.props.onHold) {
return (
<View style={UtilStyles.containerLoading}>
<ActivityIndicator size="large" color="red" />
</View>
);
} else {
// console.log('token... '+ this.props.logged)
} //se existir token
componentWillUnmount() { if (this.props.logged) {
NetInfo.isConnected.removeEventListener('connectionChange', this.handleConnectivityChange); return <Router />;
} }
return (
<View style={styles.slide2}>
<Modal isVisible={this.props.UI_loginScannerActive}>
<View style={{ flex: 1, backgroundColor: "white" }}>
<Button
onPress={this.props.closeLoginQRScan}
title={"Fechar scanner"}
>
{" "}
</Button>
_keyboardDidShow() { <QRCodeScanner
//alert('Keyboard Shown'); onRead={this.onSuccess}
// this.setState({push:0}) cameraStyle={styles.cameraContainer}
/>
</View>
</Modal>
<View
style={{
width: "100%",
} justifyContent: "center",
alignItems: "center"
_keyboardDidHide() { }}
>
//this.setState({push:4}) <Image
style={styles.logo2}
} source={require("./assets/img/logo2.png")}
/>
onSuccess = (e) => { </View>
<View styles={styles.loginContainer}>
// this.setState({ isModalVisible: !this.state.isModalVisible }); <View style={styles.inputSection}>
// this.props.login(e.data, 'f8908cc0'); <TextInput
this.props.closeLoginQRScan(); style={styles.input}
this.setState({username: e.data}) placeholder={this.state.username}
onChangeText={searchString => {
console.log("QR code lido"); this.setState({ searchString });
}}
maxLength={15}
}; underlineColorAndroid="transparent"
/>
render() { <TouchableOpacity onPress={this._scanQr}>
if (!this.state.isConnected) { <View style={styles.scanQR}>
return ( <Icon
<View> style={styles.searchIcon}
<Text>cenas da vida</Text> name="ios-qr-scanner"
size={30}
color="#000"
/>
<Text>Scan QR</Text>
</View> </View>
); </TouchableOpacity>
} </View>
if (!this.props.logged && this.props.onHold) {
<TextInput
return ( style={styles.passwordInput}
<View style={UtilStyles.containerLoading}> onFocus={this._print}
maxLength={10}
<ActivityIndicator size="large" color="red"/> blurOnSubmit={true}
</View> secureTextEntry={true}
) onChangeText={text => this.setState({ text })}
clearButtonMode="always"
} value={this.state.text}
else { clearTextOnFocus={true}
onSubmitEditing={Keyboard.dismiss}
// console.log('token... '+ this.props.logged) placeholder="Password"
/>
//se existir token { !this.props.loadingLogin &&
<RkButton
if (this.props.logged) { rkType="dark"
style={styles.loginBtn}
return ( onPress={this._tryLogin}
>
<Router></Router> Entrar
) </RkButton>
} }
return ( {this.props.alignItems &&
<ActivityIndicator size="large" color="#0000ff" />
}
</View>
<View style={styles.buttons}>
<View style={styles.slide2}> <TouchableOpacity style={styles.button}>
<Modal isVisible={this.props.UI_loginScannerActive}> <Icon name="logo-facebook" size={40} />
<View style={{flex: 1, backgroundColor: 'white'}}> </TouchableOpacity>
<Button onPress={this.props.closeLoginQRScan} title={"Fechar scanner"}> </Button> <TouchableOpacity style={styles.button}>
<Icon name="logo-instagram" size={40} />
<QRCodeScanner </TouchableOpacity>
cameraProps={{captureAudio: false}} <TouchableOpacity style={styles.button}>
onRead={this.onSuccess} <Icon name="md-heart" size={40} />
cameraStyle={styles.cameraContainer} </TouchableOpacity>
/> </View>
</View> <View style={styles.footer}>
<View style={styles.textRow}>
</Modal> <RkText rkType="primary3">Não sabes a password?</RkText>
<View style={{ <RkButton rkType="clear" onPress={this.onSignUpButtonPressed}>
width: '100%', <TouchableOpacity>
<RkText style={{ color: "red" }} kType="header6">
justifyContent: 'center', Recuperar Password
alignItems: 'center', </RkText>
}}> </TouchableOpacity>
<Image style={styles.logo2} source={require('./assets/img/logo2.png')}/> </RkButton>
</View>
</View> </View>
<View styles={styles.loginContainer}> </View>
);
<View style={styles.inputSection}>
<TextInput
style={styles.input}
placeholder={this.state.username}
onChangeText={(searchString) => {
this.setState({searchString})
}}
maxLength={15}
underlineColorAndroid="transparent"
/>
<TouchableOpacity onPress={this._scanQr}>
<View style={styles.scanQR}>
<Icon style={styles.searchIcon} name="ios-qr-scanner" size={30} color="#000"/>
<Text>Scan QR</Text>
</View>
</TouchableOpacity>
</View>
<TextInput style={styles.passwordInput}
onFocus={this._print}
maxLength={10}
blurOnSubmit={true}
secureTextEntry={true}
onChangeText={(text) => this.setState({text})}
clearButtonMode='always'
value={this.state.text}
clearTextOnFocus={true}
onSubmitEditing={Keyboard.dismiss}
placeholder='Password'/>
<RkButton rkType='dark' style={styles.loginBtn} onPress={this._tryLogin}>Entrar</RkButton>
</View>
<View style={styles.buttons}>
<TouchableOpacity
style={styles.button}>
<Icon name="logo-facebook" size={40}/>
</TouchableOpacity>
<TouchableOpacity
style={styles.button}>
<Icon name="logo-instagram" size={40}/>
</TouchableOpacity>
<TouchableOpacity
style={styles.button}>
<Icon name="md-heart" size={40}/>
</TouchableOpacity>
</View>
<View style={styles.footer}>
<View style={styles.textRow}>
<RkText rkType='primary3'>Não sabes a password?</RkText>
<RkButton rkType='clear' onPress={this.onSignUpButtonPressed}>
<TouchableOpacity>
<RkText style={{color: 'red'}} kType='header6'>Recuperar Password</RkText>
</TouchableOpacity>
</RkButton>
</View>
</View>
</View>
);
}
} }
}
} }
RkTheme.setType("RkButton", "dark", {
container: {
paddingTop: 10,
backgroundColor: "gray",
RkTheme.setType('RkButton', 'dark', { borderRadius: 90
container: { }
paddingTop: 10,
backgroundColor: 'gray',
borderRadius: 90,
}
}); });
const rectDimensions = SCREEN_WIDTH * 0.85; // this is equivalent to 255 from a 393 device width const rectDimensions = SCREEN_WIDTH * 0.85; // this is equivalent to 255 from a 393 device width
const overlayColor = 'rgba(0,0,0,0.30)'; const overlayColor = "rgba(0,0,0,0.30)";
const styles = { const styles = {
cameraContainer: { cameraContainer: {
// height: Dimensions.get('window').height , // height: Dimensions.get('window').height ,
}, },
passwordInput: { passwordInput: {
borderRadius: 90, borderRadius: 90,
borderColor: '#bfbdbd', borderColor: "#bfbdbd",
borderWidth: 1, borderWidth: 1,
marginTop: 20, marginTop: 20,
marginBottom: 20, marginBottom: 20,
width: SCREEN_WIDTH * 0.8, width: SCREEN_WIDTH * 0.8,
backgroundColor: 'white', backgroundColor: "white",
borderRadius: 90, borderRadius: 90,
height: SCREEN_HEIGHT * 0.08, height: SCREEN_HEIGHT * 0.08,
borderColor: '#bfbdbd', borderColor: "#bfbdbd",
borderWidth: 1, borderWidth: 1,
paddingLeft: SCREEN_WIDTH * 0.05, paddingLeft: SCREEN_WIDTH * 0.05
},
scanQRText: {
paddingTop: 50
// paddingTop:20,
},
scanQR: {
//flexDirection: 'row',
paddingTop: 5,
backgroundColor: 10,
}, width: 80,
scanQRText: { paddingLeft: 10,
backgroundColor: "#f24b4b",
borderBottomRightRadius: 90,
borderTopRightRadius: 90,
height: "100%"
},
inputSection: {
flexDirection: "row",
backgroundColor: "#fff",
paddingTop: 50 backgroundColor: "white",
// paddingTop:20,
borderRadius: 90,
height: SCREEN_HEIGHT * 0.08,
borderColor: "#bfbdbd",
borderWidth: 1
},
searchIcon: {
paddingLeft: 10
},
}, input: {
scanQR: { flex: 1,
paddingRight: 10,
//flexDirection: 'row', paddingLeft: 0,
paddingTop: 5, paddingLeft: SCREEN_WIDTH * 0.05,
backgroundColor: 10, color: "#424242"
},
textRow: {
marginBottom: 40
},
loginContainer: {
width: "100%",
height: "30%",
justifyContent: "center",
alignItems: "center"
},
loginBtn: {
marginTop: 10,
marginBottom: 20,
marginLeft: "25%"
},
width: 80, button: {
paddingLeft: 10, borderWidth: 1,
backgroundColor: '#f24b4b', borderColor: "rgba(0,0,0,0.2)",
borderBottomRightRadius: 90, alignItems: "center",
borderTopRightRadius: 90, justifyContent: "center",
height: '100%', width: 60,
height: 60,
backgroundColor: "#fff",
borderRadius: 100,
marginRight: 10,
marginLeft: 10
},
footer: {},
}, buttons: {
inputSection: { flexDirection: "row",
marginBottom: 24,
marginHorizontal: 24,
marginTop: 24,
justifyContent: "space-around"
},
flexDirection: 'row', logoContainer: {
backgroundColor: '#fff', width: "100%",
backgroundColor: 'white', justifyContent: "center",
alignItems: "center",
marginTop: 200
},
borderRadius: 90, logo2: {
height: SCREEN_HEIGHT * 0.08, // flex: 1,
borderColor: '#bfbdbd', // resizeMode: 'contain',
borderWidth: 1, width: 200,
height: 200
},
wrapper: {},
slide1: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "white"
},
slide2: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "white"
},
slide3: {
flex: 1,
justifyContent: "center",
alignItems: "center",
color: "black",
backgroundColor: "white"
},
text: {
color: "#fff",
fontSize: 30,
fontWeight: "bold"
},
recover: {
paddingTop: 10,
color: "red",
paddingBottom: 10
},
manual: {},
logo: {
height: SCREEN_HEIGHT * 0.35,
width: SCREEN_WIDTH,
backgroundColor: overlayColor
},
rectangleContainer: {
flex: 1,
alignItems: "center",
justifyContent: "center",
backgroundColor: "transparent"
},
}, rectangle: {
searchIcon: { height: rectDimensions,
paddingLeft: 10 width: rectDimensions,
}, alignItems: "center",
justifyContent: "center",
backgroundColor: "transparent"
},
input: { topOverlay: {
flex: 1,
backgroundColor: overlayColor,
justifyContent: "center",
alignItems: "center"
},
bottomOverlay: {
flex: 1,
height: SCREEN_HEIGHT,
width: SCREEN_WIDTH,
backgroundColor: overlayColor,
paddingBottom: SCREEN_WIDTH * 0.2
},
flex: 1, leftAndRightOverlay: {
paddingRight: 10, height: rectDimensions,
width: SCREEN_WIDTH,
backgroundColor: overlayColor
paddingLeft: 0, }
paddingLeft: SCREEN_WIDTH * 0.05,
color: '#424242',
},
textRow: {
marginBottom: 40
},
loginContainer: {
width: '100%',
height: '30%',
justifyContent: 'center',
alignItems: 'center'
},
loginBtn: {
marginTop: 10,
marginBottom: 20,
marginLeft: '25%',
},
button: {
borderWidth: 1,
borderColor: 'rgba(0,0,0,0.2)',
alignItems: 'center',
justifyContent: 'center',
width: 60,
height: 60,
backgroundColor: '#fff',
borderRadius: 100,
marginRight: 10,
marginLeft: 10
},
footer: {},
buttons: {
flexDirection: 'row',
marginBottom: 24,
marginHorizontal: 24,
marginTop: 24,
justifyContent: 'space-around',
},
logoContainer: {
width: '100%',
justifyContent: 'center',
alignItems: 'center',
marginTop: 200
},
logo2: {
// flex: 1,
// resizeMode: 'contain',
width: 200, height: 200,
},
wrapper: {},
slide1: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white',
},
slide2: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white',
},
slide3: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
color: 'black',
backgroundColor: 'white',
},
text: {
color: '#fff',
fontSize: 30,
fontWeight: 'bold',
},
recover: {
paddingTop: 10,
color: "red",
paddingBottom: 10
},
manual: {},
logo: {
height: SCREEN_HEIGHT * 0.35,
width: SCREEN_WIDTH,
backgroundColor: overlayColor,
},
rectangleContainer: {
flex: 1,
alignItems: "center",
justifyContent: "center",
backgroundColor: "transparent",
},
rectangle: {
height: rectDimensions,
width: rectDimensions,
alignItems: "center",
justifyContent: "center",
backgroundColor: "transparent"
},
topOverlay: {
flex: 1,
backgroundColor: overlayColor,
justifyContent: "center",
alignItems: "center"
},
bottomOverlay: {
flex: 1,
height: SCREEN_HEIGHT,
width: SCREEN_WIDTH,
backgroundColor: overlayColor,
paddingBottom: SCREEN_WIDTH * 0.2
},
leftAndRightOverlay: {
height: rectDimensions,
width: SCREEN_WIDTH,
backgroundColor: overlayColor
},
}; };
RkTheme.setType('RkTextInput', 'frame', { RkTheme.setType("RkTextInput", "frame", {
input: { input: {
backgroundColor: 'white', backgroundColor: "white",
marginLeft: 0, marginLeft: 0,
marginHorizontal: 0, marginHorizontal: 0,
borderRadius: 5 borderRadius: 5
}, },
color: 'gray', color: "gray",
backgroundColor: 'gray', backgroundColor: "gray",
borderRadius: 10, borderRadius: 10,
container: { container: {
paddingHorizontal: 20 paddingHorizontal: 20
} }
}); });
mapStateToProps = (state, props) => { mapStateToProps = (state, props) => {
return {
return { token: state.apiReducer.token,
token: state.apiReducer.token, loggedIn: state.apiReducer.loggedIn,
loggedIn: state.apiReducer.loggedIn, onHold: state.apiReducer.onHold,
onHold: state.apiReducer.onHold, logged: state.apiReducer.logged,
logged: state.apiReducer.logged, failedAttempt: state.apiReducer.failedAttempt,
failedAttempt: state.apiReducer.failedAttempt, UI_loginScannerActive: state.uiReducer.UI_loginScannerActive,
UI_loginScannerActive: state.uiReducer.UI_loginScannerActive, userDetails: state.apiReducer.userDetails,
userDetails: state.apiReducer.userDetails, modalOpen: state.apiReducer.modalOpen,
} modalInfo: state.apiReducer.modalInfo,
type: state.apiReducer.type,
loadingLogin:state.apiReducer.loadingLogin
};
}; };
mapDispatchToProps = (dispatch) => { mapDispatchToProps = dispatch => {
return bindActionCreators(Actions, dispatch);
return bindActionCreators(Actions, dispatch);
}; };
export default connect(
export default connect(mapStateToProps, mapDispatchToProps)(App); mapStateToProps,
mapDispatchToProps
)(App);

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 KiB

BIN
App/app/assets/altice.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@ -1,397 +1,415 @@
import * as React from 'react'; import * as React from "react";
import {View, StyleSheet, Dimensions, Image, ScrollView, Text, Button, TouchableOpacity, Animated} from 'react-native';
import {TabView, TabBar, SceneMap} from 'react-native-tab-view';
import { import {
RkButton, RkCard, RkText, View,
RkTheme StyleSheet,
} from 'react-native-ui-kitten'; Dimensions,
import Timeline from 'react-native-timeline-feed' Image,
ScrollView,
Text,
Button,
TouchableOpacity,
Animated
} from "react-native";
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 { 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 * as Actions from '../store/actions'; //Import your actionss const formatObj = obj => {
let a = {};
a.push({});
const formatObj = (obj) => { return a;
let a = {};
a.push({});
return a
}; };
const ThirdRoute = () => (
<View style={[styles.scene, {backgroundColor: '#efc44a'}]}/>
);
const FourthRoute = () => (
<View style={[styles.scene, {backgroundColor: '#49ef97'}]}/>
);
class Calendar extends React.Component { class Calendar extends React.Component {
state = {
state = { index: 0,
index: 0, routes: [
routes: [ { key: "first", weekDay: "sex", day: 12 },
{key: 'first', weekDay: 'sex', day:12}, { key: "second", weekDay: "sab", day: 13 },
{key: 'second', weekDay: 'sab', day:13}, { key: "third", weekDay: "dom", day: 14 },
{key: 'third', weekDay: 'dom', day:14}, { key: "fourth", weekDay: "seg", day: 15 }
{key: 'fourth', weekDay: 'seg', day:15}, ],
CP: "SEM",
cpColor: "white",
careerPath: { name: "", color: "" }
};
], componentDidMount() {
}; this.props.getEvents(this.props.user);
componentDidMount() { this.props.getSessions(this.props.userDetails.token);
}
this.props.getEvents(this.props.user); _openDetails = () => {
console.log('didMount'); console.log("los");
console.log(this.props.events); };
}
_openDetails=()=>{ renderDetail = ({ item, index }) => {
const { navigate } = this.props.navigation;
console.log("los"); // <Image source={{ uri:item.imageUrl, width:'100%' , height:100 }} style={{borderRadius:0}}/>
} return (
<TouchableOpacity
renderDetail = ({item, index}) => { onPress={() => navigate("calendarDetail", { info: item })}
const {navigate} = this.props.navigation; >
// <Image source={{ uri:item.imageUrl, width:'100%' , height:100 }} style={{borderRadius:0}}/> <View style={styles.event}>
return ( <View style={styles.titleContainer}>
<TouchableOpacity onPress={() => navigate('calendarDetail', { info: item })} > <Text style={[styles.title]}>{item.name}</Text>
<Text style={{ color: "black" }}>Local: 1</Text>
<View style={styles.event}>
<View style={styles.titleContainer}>
<Text style={[styles.title]}>{item.name}</Text>
<Text style={{color:'black'}}>Local: 1</Text>
</View>
<View>
<Text style={styles.description}>{item.description}</Text>
<View style={styles.details}>
<Progress.Bar color={'#000000'} progress={item.Enrolled/item.MaxAttendees} unfilledColor={'white'} width={210}/>
<Text>{item.Enrolled} / {item.MaxAttendees}</Text>
</View>
</View>
</View>
</TouchableOpacity>
);
}
_update = () => {
this.setState({user: this.props.user});
console.log(this.props.events);
}
_renderTabBar = props => {
const inputRange = props.navigationState.routes.map((x, i) => i);
return (
<View style={styles.tabBar}>
{props.navigationState.routes.map((route, i) => {
const bgcolor = props.position.interpolate({
inputRange,
outputRange: inputRange.map(
inputIndex => (inputIndex === i ? '#CC1A17' : 'rgba(0,0,0,0)')
),
});
const color = props.position.interpolate({
inputRange,
outputRange: inputRange.map(
inputIndex => (inputIndex === i ? 'white' : 'black')
),
});
return (
<TouchableOpacity
style={styles.tabItem}
onPress={() => this.setState({ index: i })}>
<Animated.Text style={{ color :'#7A7B7B' }}>{route.weekDay}</Animated.Text>
<Animated.Text style={{ backgroundColor: bgcolor, borderRadius:90 , padding:10, marginTop:5, color:color, fontSize:15}}>{route.day}</Animated.Text>
</TouchableOpacity>
);
})}
</View> </View>
);
};
<View>
constructor() { <Text style={styles.description}>{item.description}</Text>
<View style={styles.details}>
super(); <Progress.Bar
color={"#000000"}
const archeryImgSource = require('../assets/img/archery.png'); progress={item.Enrolled / item.MaxAttendees}
const badmintonImgSource = require('../assets/img/badminton.png'); unfilledColor={"white"}
const lunchImgSource = require('../assets/img/lunch.png'); width={210}
const soccerImgSource = require('../assets/img/soccer.png'); />
const dumbbellImgSource = require('../assets/img/dumbbell.png'); <Text>
{item.Enrolled} / {item.MaxAttendees}
const ArcheryImage = (props) => <Image source={archeryImgSource} {...props} />; </Text>
const BadmintonImage = (props) => <Image source={badmintonImgSource} {...props} />;
const LunchImage = (props) => <Image source={lunchImgSource} {...props} />;
const SoccerImage = (props) => <Image source={soccerImgSource} {...props} />;
const DumbbellImage = (props) => <Image source={dumbbellImgSource} {...props} />;
const VectorIconImage = (props) => <Image source={vectorIconImgSource} {...props} />;
this.data = [
]
}
render() {
const FirstRoute = () => (
<ScrollView contentContainerStyle={styles.contentContainer}>
<Timeline
data={this.props.events}
timeContainerStyle={{ marginTop: 0}}
timeStyle={{
textAlign: 'center',
// backgroundColor: 'red',
height:100,
color:"#CC1A17",
padding: 5,
//marginTop:10,
// fontWeight:'bold',
fontSize:23,
//borderRadius: 13
}}
descriptionStyle={{color: 'red'}}
renderDetail={this.renderDetail}
lineColor='rgba(0,0,0,0)'
lineWidth={1}
separator={false}
flatListProps={{
style: {
margin: 15
}
}}
keyExtractor={(item, index) => index.toString()}
/>
</ScrollView>
);
const SecondRoute = () => (
<ScrollView contentContainerStyle={styles.contentContainer}>
<Timeline
data={this.props.events}
timeContainerStyle={{ marginTop: 0}}
timeStyle={{
textAlign: 'center',
// backgroundColor: 'red',
height:100,
color:"#CC1A17",
padding: 5,
//marginTop:10,
// fontWeight:'bold',
fontSize:23,
//borderRadius: 13
}}
descriptionStyle={{color: 'red'}}
renderDetail={this.renderDetail}
lineColor='rgba(0,0,0,0)'
lineWidth={1}
separator={false}
flatListProps={{
style: {
margin: 15
}
}}
keyExtractor={(item, index) => index.toString()}
/>
</ScrollView>
)
return (
<View style={{flex:1}}>
<View>
<Text style={{
backgroundColor:"#CC1A17",
color:'white',
fontWeight:'bold',
fontSize:15,
textAlign:'center',
}}>
WEB DEVELOPMENT
</Text>
</View>
<TabView
navigationState={this.state}
renderScene={SceneMap({
first: FirstRoute,
second: SecondRoute,
third: ThirdRoute,
fourth: FourthRoute
})}
renderTabBar={this._renderTabBar}
useNativeDriver={true}
onIndexChange={index => this.setState({index})}
initialLayout={{width: Dimensions.get('window').width, height: Dimensions.get('window').height}}
style={{backgroundColor:"#F2F2F2"}}
indicatorStyle={{ backgroundColor: 'pink' }}
/>
</View> </View>
); </View>
} </View>
</TouchableOpacity>
);
};
_update = () => {
this.setState({ user: this.props.user });
console.log(this.props.events);
};
_renderTabBar = props => {
const inputRange = props.navigationState.routes.map((x, i) => i);
return (
<View style={styles.tabBar}>
{props.navigationState.routes.map((route, i) => {
const bgcolor = props.position.interpolate({
inputRange,
outputRange: inputRange.map(inputIndex =>
inputIndex === i ? "#CC1A17" : "rgba(0,0,0,0)"
)
});
const color = props.position.interpolate({
inputRange,
outputRange: inputRange.map(inputIndex =>
inputIndex === i ? "white" : "black"
)
});
return (
<TouchableOpacity
style={styles.tabItem}
onPress={() => this.setState({ index: i })}
>
<Text style={{ color: "#7A7B7B" }}>
{route.weekDay}
</Text>
<Animated.Text
style={{
backgroundColor: bgcolor,
borderRadius: 0,
padding: 10,
marginTop: 5,
color: color,
fontSize: 15
}}
>
{route.day}
</Animated.Text>
</TouchableOpacity>
);
})}
</View>
);
};
constructor() {
super();
}
render() {
const ThirdRoute = () => (
<ScrollView contentContainerStyle={styles.contentContainer}>
{this.props.events != undefined && (
<Timeline
data={this.props.c}
timeContainerStyle={{ marginTop: 0 }}
timeStyle={{
textAlign: "center",
height: 100,
color: "#CC1A17",
padding: 5,
fontSize: 23
}}
descriptionStyle={{ color: "red" }}
renderDetail={this.renderDetail}
lineColor="rgba(0,0,0,0)"
lineWidth={1}
separator={false}
flatListProps={{
style: {
margin: 15
}
}}
circleSize={0}
dotColor={"#CC1A17"}
keyExtractor={(item, index) => index.toString()}
/>
)}
</ScrollView>
);
const FourthRoute = () => (
<ScrollView contentContainerStyle={styles.contentContainer}>
{this.props.events != undefined && (
<Timeline
data={this.props.d}
timeContainerStyle={{ marginTop: 0 }}
timeStyle={{
textAlign: "center",
// backgroundColor: 'red',
height: 100,
color: "#CC1A17",
padding: 5,
//marginTop:10,
// fontWeight:'bold',
fontSize: 23
//borderRadius: 13
}}
descriptionStyle={{ color: "red" }}
renderDetail={this.renderDetail}
lineColor="rgba(0,0,0,0)"
lineWidth={1}
separator={false}
flatListProps={{
style: {
margin: 15
}
}}
circleSize={0}
dotColor={"#CC1A17"}
keyExtractor={(item, index) => index.toString()}
/>
)}
</ScrollView>
);
const FirstRoute = () => (
<ScrollView contentContainerStyle={styles.contentContainer}>
{this.props.events != undefined && (
<Timeline
data={this.props.a}
timeContainerStyle={{ marginTop: 0 }}
timeStyle={{
textAlign: "center",
height: 100,
color: "#CC1A17",
padding: 5,
fontSize: 23
}}
descriptionStyle={{ color: "red" }}
renderDetail={this.renderDetail}
lineColor="rgba(0,0,0,0)"
lineWidth={1}
separator={false}
flatListProps={{
style: {
margin: 15
}
}}
circleSize={0}
dotColor={"#CC1A17"}
keyExtractor={(item, index) => index.toString()}
/>
)}
</ScrollView>
);
const SecondRoute = () => (
<ScrollView contentContainerStyle={styles.contentContainer}>
{this.props.events != undefined && (
<Timeline
data={this.props.b}
timeContainerStyle={{ marginTop: 0 }}
timeStyle={{
textAlign: "center",
height: 100,
color: "#CC1A17",
padding: 5,
fontSize: 23
//borderRadius: 13
}}
descriptionStyle={{ color: "red" }}
renderDetail={this.renderDetail}
lineColor="rgba(0,0,0,0)"
lineWidth={1}
separator={false}
flatListProps={{
style: {
margin: 15
}
}}
circleSize={0}
dotColor={"#CC1A17"}
keyExtractor={(item, index) => index.toString()}
/>
)}
</ScrollView>
);
return (
<View style={{ flex: 1 }}>
<View>
{this.props.careerPath != undefined && (
<Text
style={{
backgroundColor: this.props.careerPath.color,
color: "white",
fontWeight: "bold",
fontSize: 15,
textAlign: "center",
padding:15
}}
>
{this.props.careerPath.name}
</Text>
)}
</View>
<TabView
navigationState={this.state}
renderScene={SceneMap({
first: FirstRoute,
second: SecondRoute,
third: ThirdRoute,
fourth: FourthRoute
})}
renderTabBar={this._renderTabBar}
useNativeDriver={false}
onIndexChange={index => this.setState({ index })}
initialLayout={{
width: Dimensions.get("window").width,
height: Dimensions.get("window").height
}}
style={{ backgroundColor: "#F2F2F2" }}
indicatorStyle={{ backgroundColor: "pink" }}
/>
</View>
);
}
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
tabBar: { tabBar: {
flexDirection: 'row', flexDirection: "row",
paddingTop:0, paddingTop: 0,
marginTop:0, marginTop: 0,
backgroundColor:'white', backgroundColor: "white",
borderWidth: 1, borderWidth: 1,
borderRadius: 2, borderRadius: 2,
borderColor: '#ddd', borderColor: "#ddd",
borderBottomWidth: 0, borderBottomWidth: 0,
shadowColor: '#000', shadowColor: "#000",
shadowOffset: { width: 0, height: 2 }, shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.8, shadowOpacity: 0.8,
shadowRadius: 2, shadowRadius: 2,
elevation: 2, elevation: 2
},
tabItem: {
}, flex: 1,
tabItem: { alignItems: "center",
flex: 1, padding: 10
alignItems: 'center', },
padding: 10, details: {
}, backgroundColor: "#FFFFFF",
details: { borderBottomRightRadius: 10,
backgroundColor: "#FFFFFF", borderBottomLeftRadius: 10,
borderBottomRightRadius: 10, padding: 10,
borderBottomLeftRadius: 10, paddingTop: 0
padding: 10, },
paddingTop:0 description: {
padding: 10,
}, paddingLeft: 0,
description: { paddingTop: 0
padding: 10, },
paddingLeft:0, title: {
paddingTop:0 color: "#212121",
fontWeight: "bold",
}, fontSize: 15
title: { },
color: '#212121', titleContainer: {
fontWeight: 'bold', padding: 10
fontSize: 15, },
event: {
}, borderRadius: 5,
titleContainer:{ backgroundColor: "#FFFFFF",
padding: 10 marginLeft: -25,
},
event: {
borderRadius: 5,
backgroundColor: "#FFFFFF",
marginLeft:-25,
shadowColor: "#000", shadowColor: "#000",
shadowOffset: { width: 0, height: 2,}, shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.25, shadowOpacity: 0.25,
shadowRadius: 1, shadowRadius: 1,
elevation: 2, elevation: 2,
marginRight:2 marginRight: 2
},
scene: {
}, flex: 1
scene: { },
flex: 1, contentContainer: {
}, //paddingVertical: 20,
contentContainer: { backgroundColor: "#F2F2F2"
//paddingVertical: 20, }
backgroundColor:'#F2F2F2'
}
}); });
RkTheme.setType('RkCard', 'story', { RkTheme.setType("RkCard", "story", {
img: { img: {
height: 100, height: 100,
opacity: 0.7 opacity: 0.7
}, },
header: { header: {
alignSelf: 'center' alignSelf: "center"
}, },
content: { content: {
alignSelf: 'center' alignSelf: "center"
} }
}); });
function mapStateToProps(state, props) { function mapStateToProps(state, props) {
return {
return { token: state.apiReducer.token,
user: state.apiReducer.user,
token: state.apiReducer.token, logged: state.apiReducer.logged,
user: state.apiReducer.user, events: state.apiReducer.events,
logged: state.apiReducer.logged, userDetails: state.apiReducer.userDetails,
events: state.apiReducer.events sessions: state.apiReducer.sessions,
careerPath: state.apiReducer.careerPath,
} a: state.apiReducer.a,
b: state.apiReducer.b,
c: state.apiReducer.c,
d: state.apiReducer.d
};
} }
function mapDispatchToProps(dispatch) { function mapDispatchToProps(dispatch) {
return bindActionCreators(Actions, dispatch);
return bindActionCreators(Actions, dispatch);
} }
export default connect(mapStateToProps, mapDispatchToProps)(Calendar); export default connect(
mapStateToProps,
mapDispatchToProps
)(Calendar);

View File

@ -1,57 +1,47 @@
import * as React from 'react'; import * as React from "react";
import { import { View, StyleSheet, Dimensions, Text, Button } from "react-native";
View, import { TabView, TabBar, SceneMap } from "react-native-tab-view";
StyleSheet,
Dimensions,
Text
} from 'react-native';
import { TabView, TabBar, SceneMap } from 'react-native-tab-view';
const FirstRoute = () => ( const FirstRoute = () => (
<View style={[styles.scene, { backgroundColor: '#ff4081' }]} /> <View style={[styles.scene, { backgroundColor: "#ff4081" }]} />
); );
const SecondRoute = () => ( const SecondRoute = () => (
<View style={[styles.scene, { backgroundColor: '#673ab7' }]} /> <View style={[styles.scene, { backgroundColor: "#673ab7" }]} />
); );
const ThirdRoute = () => ( const ThirdRoute = () => (
<View style={[styles.scene, { backgroundColor: '#673ab7' }]} /> <View style={[styles.scene, { backgroundColor: "#673ab7" }]} />
); );
const FourthRoute = () => ( const FourthRoute = () => (
<View style={[styles.scene, { backgroundColor: '#673ab7' }]} /> <View style={[styles.scene, { backgroundColor: "#673ab7" }]} />
); );
export default class Eventos extends React.Component {
export default class Eventos extends React.Component {
state = { state = {
index: 0, index: 0,
routes: [ routes: [
{ key: 'first', title: 'Festarola' }, { key: "first", title: "Festarola" },
{ key: 'second', title: 'Febrada' }, { key: "second", title: "Febrada" },
{ key: 'third', title: 'Rally' }, { key: "third", title: "Rally" },
{ key: 'fourth', title: 'Peddy' }, { key: "fourth", title: "Peddy" }
]
};
], render() {
}; return (
<View>
render() { <Button
return ( title="Febrada"
<View> onPress={() => this.props.navigation.navigate("febrada")}
<Text>asd</Text> />
</View> </View>
); );
} }
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
scene: { scene: {
flex: 1, flex: 1
}, }
}); });

View File

@ -85,7 +85,7 @@ class Home extends Component {
//console.log(this.props.token); //console.log(this.props.token);
// this.props.getUserInfo(this.props.userDetails.token); this.props.getUserInfo(this.props.userDetails.token);
//console.log('logged:'+this.props.logged); //console.log('logged:'+this.props.logged);
@ -184,36 +184,6 @@ _update=()=>{
<View style={styles.userBio}>
<View style={styles.userBioRow}>
<Icon name="ios-laptop" style={styles.userBioLogo} size={25}/>
<Text style={styles.userBioText}>{this.props.user.Job}</Text>
</View>
<Divider style={{ backgroundColor: 'black' }} />
<View style={styles.userBioRow}>
<Icon name="ios-mail" style={styles.userBioLogo} size={25}/>
<Text style={styles.userBioText}>{this.props.user.Email}</Text>
</View>
<Divider style={{ backgroundColor: 'black' }} />
<View style={styles.userBioRow}>
<Icon name="ios-phone-portrait" style={styles.userBioLogo} size={25}/>
<Text style={styles.userBioText}>{this.props.user.Mobile}</Text>
</View>
<Divider style={{ backgroundColor: 'black' }} />
<View style={styles.userBioRow}>
<Icon name="ios-map" style={styles.userBioLogo} size={25}/>
<Text style={styles.userBioText}>{this.props.user.Address}, {this.props.user.City}</Text>
</View>
<Divider style={{ backgroundColor: 'black' }} />
<View style={styles.userBioRow}>
<Icon name="ios-person" style={styles.userBioLogo} size={25}/>
<TouchableOpacity><Text style={styles.userCurriculum}>O meu Curriculo</Text></TouchableOpacity>
</View>
</View>

File diff suppressed because it is too large Load Diff

View File

@ -45,6 +45,8 @@ class Profile extends Component {
super(props); super(props);
this.state = { this.state = {
name:this.props.user.Name,
userDetails:{},
token: false, token: false,
tokenData: '', tokenData: '',
loggedIn: false, loggedIn: false,
@ -56,7 +58,7 @@ class Profile extends Component {
formValid: true, formValid: true,
jobs: this.props.user.Job, jobs: this.props.user.Company,
jobsError: false, jobsError: false,
jobsErrorMessage: '', jobsErrorMessage: '',
@ -68,7 +70,7 @@ class Profile extends Component {
phoneError: false, phoneError: false,
phoneErrorMessage: '', phoneErrorMessage: '',
address: this.props.user.Adress, address: this.props.user.Address,
addressError: false, addressError: false,
addressErrorMessage: '', addressErrorMessage: '',
@ -85,9 +87,12 @@ class Profile extends Component {
}; };
_validateData = (jobs, email, phone, address, city) => { _validateData = (name,jobs, email, phone, address, city) => {
let valid = null; let valid = null;
v = Validate('name',name );
let v = Validate('email', email); let v = Validate('email', email);
this.setState({emailError: v[0], emailErrorMessage: v[1]}); this.setState({emailError: v[0], emailErrorMessage: v[1]});
@ -133,14 +138,31 @@ class Profile extends Component {
saveData() { saveData() {
const {jobs, email, phone, address, city, formValid} = this.state; const {name,jobs, email, phone, address, city, formValid} = this.state;
this._validateData(jobs, email, phone, address, city); this._validateData(name,jobs, email, phone, address, city);
console.log(formValid); console.log(formValid);
if (formValid) if (formValid){
console.log("data valid"); console.log("data valid");
this.props.updateUser(this.props.userDetails.token,{
Name: this.state.name,
// LastName: "Último",
Company: jobs,
// Job: jobs,
Address: address,
City: city,
// PostalCode: "3000-010",
Mobile: phone,
Avatar: "base64"
} ); this.props.getUserInfo(this.props.userDetails.token);
}
else else
console.log("data not valid"); console.log("data not valid");
@ -158,11 +180,21 @@ class Profile extends Component {
</View> </View>
<View> <View>
<TouchableOpacity onPress={() => this.saveData()}> <TouchableOpacity onPress={() => this.saveData()}>
<Icon name="ios-save" size={30}/> <Icon name="ios-save" size={30}/><Text>Save</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
</View> </View>
<View style={styles.userBio}> <View style={styles.userBio}>
<View style={styles.userBioRow}>
<Icon name="ios-person" style={styles.userBioLogo} size={25}/>
<TextInput style={styles.userBioText}
onChangeText={(n) => {
this.setState({name:n })
}}
value={this.state.name}/>
</View>
<Divider style={{backgroundColor: 'black'}}/>
<View style={styles.userBioRow}> <View style={styles.userBioRow}>
<Icon name="ios-laptop" style={styles.userBioLogo} size={25}/> <Icon name="ios-laptop" style={styles.userBioLogo} size={25}/>
@ -174,17 +206,7 @@ class Profile extends Component {
</View> </View>
<Divider style={{backgroundColor: 'black'}}/> <Divider style={{backgroundColor: 'black'}}/>
<View style={styles.userBioRow}>
<Icon name="ios-mail" style={styles.userBioLogo} size={25}/>
<TextInput style={styles.userBioText}
onChangeText={(email) => {
this.setState({email: email})
}}
value={this.state.email}/>
</View>
<Divider style={{backgroundColor: 'black'}}/>
<View style={styles.userBioRow}> <View style={styles.userBioRow}>
<Icon name="ios-phone-portrait" style={styles.userBioLogo} size={25}/> <Icon name="ios-phone-portrait" style={styles.userBioLogo} size={25}/>
@ -339,7 +361,8 @@ mapStateToProps = (state, props) => {
return { return {
token: state.apiReducer.token, token: state.apiReducer.token,
user: state.apiReducer.user user: state.apiReducer.user,
userDetails: state.apiReducer.userDetails,
} }
}; };

View File

@ -1,377 +1,508 @@
import * as React from 'react'; import * as React from "react";
import { import {
View, View,
StyleSheet, StyleSheet,
Dimensions, Dimensions,
Image, ScrollView,
ScrollView, Text,
Text, Button,
Button, TouchableOpacity,
TouchableOpacity, Picker,
Picker, ActivityIndicator,
CheckBox,
ActivityIndicator, FlatList
SectionList, } from "react-native";
FlatList import moment from "moment";
} from 'react-native';
import {TabView, TabBar, SceneMap} from 'react-native-tab-view'; import Modal from "react-native-modal";
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 {connect} from 'react-redux'; import * as Progress from "react-native-progress";
import {bindActionCreators} from 'redux'; import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import * as Actions from "../store/actions"; //Import your actionss
import AwesomeAlert from 'react-native-awesome-alerts';
import * as Actions from '../store/actions'; //Import your actionss
import Swiper from 'react-native-swiper';
const SCREEN_HEIGHT = Dimensions.get("window").height; const SCREEN_HEIGHT = Dimensions.get("window").height;
const SCREEN_WIDTH = Dimensions.get("window").width; const SCREEN_WIDTH = Dimensions.get("window").width;
import FitImage from 'react-native-fit-image';
import { Dropdown } from 'react-native-material-dropdown'; import FitImage from "react-native-fit-image";
import {Card, Divider} from 'react-native-elements'
import IconF from "react-native-vector-icons/Foundation"
import { Divider } from "react-native-elements";
const formatObj = (obj) => {
let a = {};
a.push({})
return a
};
import LinearGradient from "react-native-linear-gradient";
import IconFA from "react-native-vector-icons/FontAwesome5";
class choosePath extends React.Component { class choosePath extends React.Component {
_verifySession = Id => {
var sessions = this.props.user.Sessions;
for (let key in sessions) {
if (sessions[key].Id == Id) return true;
// cenas.push(result[key]);
console.log();
}
};
static navigationOptions = ({ navigation }) => ({
headerTitleStyle: { textAlign: "center", alignSelf: "center" },
headerStyle: {
backgroundColor: "rgba(0,0,0,0)",
shadowRadius: 0,
elevation: 0
}
});
static navigationOptions = ({ navigation }) => ({ state = {
calendar: {},
headerTitleStyle : {textAlign: 'center',alignSelf:'center'}, guest: "9"
headerStyle:{ };
backgroundColor:'rgba(0,0,0,0)',
shadowRadius:0,
elevation:0
},
});
state = { _mount = () => {
calendar:{} var sessions = this.props.sessions;
for (let key in sessions) {
if (sessions[key].Name == "IA") {
this.setState({ guest: "9" });
}
//...
}
};
componentDidMount() {
// this.props.getEvents(this.props.user);
this.props.getAvailableGuestlists(this.props.userDetails.token);
this.props.getSessions(this.props.userDetails.token);
this._mount();
//console.log('didMount');
// console.log(this.props.events);
}
_update = () => {
this.setState({ user: this.props.user });
console.log(this.props.events);
};
_findPath = id => {
var sessions = this.props.sessions;
for (let key in sessions) {
if (sessions[key].Name == id) {
return true;
}
}
return false;
};
constructor() {
super();
this.state = {
showAlert:true,
Blocks: [],
onHoldBlocks: true,
checked: true,
modalVisible: false,
isModalVisible: false,
}; };
componentDidMount() { this.data = [];
}
onPress = () => {
};
// this.props.getEvents(this.props.user); _s() {
this.props.getAvailableGuestlists(this.props.userDetails.token)
console.log('didMount'); this.props.signSession(this.props.userDetails.token, item[index].Id);
console.log(this.props.events); }
} getCareerPaths = () => {
this.props.getAvailableGuestlists(this.props.userDetails.token);
console.log(this.props.calendar);
};
_keyExtractor = (item, index) => item.id;
_renderItem = ({ item }) => (
<MyListItem
id={item.id}
onPressItem={this._onPressItem}
selected={!!this.state.selected.get(item.id)}
title={item.title}
/>
);
_toggleModal = () =>
this.setState({ isModalVisible: !this.state.isModalVisible });
_update = () => {
this.setState({user: this.props.user}); _onPressItem = id => {
console.log(this.props.events); // updater functions are preferred for transactional updates
} this.setState(state => {
// copy the map rather than modifying state.
const selected = new Map(state.selected);
selected.set(id, !selected.get(id)); // toggle
return { selected };
});
};
_render = ({ item }) => {
<Text>Cenas: {item.Name}</Text>;
};
constructor() { render() {
return (
<View>
<ScrollView style={styles.page}>
super() {this._findPath("IA") && (
<LinearGradient
colors={["#D95856", "#CC1A17"]}
style={styles.linearGradient}
this.data = [ >
<Text
style={{
margin: 15,
] marginBottom: 0,
} fontWeight: "bold",
getCareerPaths=()=>{ color: "white"
}}
this.props.getAvailableGuestlists(this.props.userDetails.token) >
console.log(this.props.calendar) {" "}
} Empresa responsável:{" "}
_keyExtractor = (item, index) => item.id; </Text>
<View style={styles.companyContainer}>
_renderItem = ({item}) => ( <View style={styles.companyDescription}>
<MyListItem <Text
id={item.id} style={{
onPressItem={this._onPressItem} fontSize: 16,
selected={!!this.state.selected.get(item.id)} fontWeight: "bold",
title={item.title} margin: 6,
/> color: "white"
); }}
_onPressItem = (id) => { >
// updater functions are preferred for transactional updates Critical Software
this.setState((state) => { </Text>
// copy the map rather than modifying state. <Text style={{ margin: 6, marginTop: 0, color: "white" }}>
const selected = new Map(state.selected); A CRITICAL Software fornece sistemas e serviços de software
selected.set(id, !selected.get(id)); // toggle para segurança e aplicações essenciais aos negócios.
return {selected}; </Text>
}); </View>
}; <View style={styles.companyLogo}>
<FitImage
render() { source={{
uri:
"https://upload.wikimedia.org/wikipedia/commons/8/8a/CSW_Gradiente_rgb.png"
return ( }}
<ScrollView style={styles.page}> style={styles.fitImage}
/>
<View style={styles.companyContainer}> </View>
</View>
</View> </LinearGradient>
)}
<View style={{flex:1,width:SCREEN_WIDTH*0.7, alignContent:'center'}}> {this._findPath("NET") && (
<LinearGradient
colors={["#5887FF", "#715AFF"]}
<View style={styles.pickerCareer}> style={styles.linearGradient}
<Picker >
selectedValue={this.state.guest} <Text
style={{width:'100%'}} style={{
onValueChange={(itemValue, itemIndex) =>{ margin: 15,
this.setState({guest: itemValue}) marginBottom: 0,
this.props.waitChangeGuest(); fontWeight: "bold",
this.props.changeGuestList(this.props.userDetails.token,itemValue) color: "white"
this.props.waitChangeGuest(); }}
this.props.getAvailableSessions(this.props.userDetails.token); >
{" "}
Empresa responsável:{" "}
} </Text>
<View style={styles.companyContainer}>
}> <View style={styles.companyDescription}>
<Picker.Item label="Inteligência Artificial" value="9" /> <Text
<Picker.Item label="Redes e Segurança" value="10" /> style={{
<Picker.Item label="Data Science" value="15" /> fontSize: 16,
<Picker.Item label="Desenvolvimento Web" value="14" /> fontWeight: "bold",
<Picker.Item label="Internet das Coisas" value="12" /> margin: 6,
<Picker.Item label="Desenvolvimento Mobile" value="11" /> color: "white"
}}
</Picker> >
</View> Altice
<FlatList </Text>
data={this.state.data} <Text style={{ margin: 6, marginTop: 0, color: "white" }}>
renderItem={({ item }) => ( Altice é uma multinacional neerlandesa de telecomunicações,
<ListItem conteúdos, media, entretenimento e publicidade.
</Text>
title={`${item.name.first} ${item.name.last}`} </View>
subtitle={item.email} <View style={styles.companyLogo}>
avatar={{ uri: item.picture.thumbnail }} <FitImage
containerStyle={{ borderBottomWidth: 0 }} source={{
/> uri:
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTuIfl0Km4mTbCGdJSr4bWn_ApFHnOrjYsmJ4VlBL1OkaIlb93t"
}}
style={styles.fitImage}
/>
</View>
</View>
</LinearGradient>
)} )}
keyExtractor={item => item.email}
/>
</View > <View
{ !this.props.changingGuest && style={{ flex: 1, width: SCREEN_WIDTH * 0.7, alignContent: "center" }}
>
<View style={styles.block}> <View style={styles.pickerCareer}>
<Picker
<View style={styles.time}> selectedValue={this.state.guest}
<Text style={ style={{ width: "100%" }}
{ onValueChange={(itemValue, itemIndex) => {
margin:10, this.setState({ guest: itemValue });
fontSize:25, this.props.timerChangeGuest();
color:'#CC1A17', this.props.waitChangeGuest();
marginBottom:0
}
}>
9:00</Text>
<Text style={{marginLeft:20}}>até</Text>
<Text style={
{
margin:10,
fontSize:25,
color:'#CC1A17',
marginTop:5
}
}>
9:30</Text>
</View>
<View style={styles.sessions}>
this.props.changeGuestList(
this.props.userDetails.token,
itemValue
);
// this.props.waitChangeGuest();
// this.props.getAvailableSessions(this.props.userDetails.token);
// this.props.waitChangeGuest();
// this.props.getSessionBlocks(this.props.sessions)
}}
>
<Picker.Item label="Escolhe o teu career path!" value="0" />
<Picker.Item label="Inteligência Artificial" value="9" />
<Picker.Item label="Redes e Segurança" value="10" />
<Picker.Item label="Data Science" value="15" />
<Picker.Item label="Desenvolvimento Web" value="14" />
<Picker.Item label="Internet das Coisas" value="12" />
<Picker.Item label="Desenvolvimento Mobile" value="11" />
</Picker>
</View>
<View style={{ width: SCREEN_WIDTH }}>
{!this.props.changingGuest && (
<FlatList
data={this.props.Blocks}
renderItem={({ item, index }) => (
<View style={styles.block}>
<View style={styles.time}>
<Text
style={{
margin: 10,
fontSize: 25,
color: "#CC1A17",
marginBottom: 0
}}
>
{moment(item[0].SessionStart).format("HH:mm")}
</Text>
<Text style={{ marginLeft: 20 }}>às</Text>
<Text
style={{
margin: 10,
fontSize: 25,
color: "#CC1A17",
marginTop: 5
}}
>
{moment(item[0].SessionEnd).format("HH:mm")}
</Text>
</View>
<View style={styles.sessions}>
<FlatList
data={item}
renderItem={({ data, index }) => (
<View>
<View style={styles.session}> <View style={styles.session}>
{this._verifySession(item[index].Id) && (
<TouchableOpacity
onPress={() => {}}
style={{ flex: 1, alignSelf: "center" }}
>
<View>
<IconFA
name="check-square"
color={"#CC1A17"}
size={35}
/>
</View>
</TouchableOpacity>
)}
{!this._verifySession(item[index].Id) && (
<TouchableOpacity
onPress={() => {
this.props.waitChangeGuest()
this.props.signSession(
this.props.userDetails.token,
item[index].Id
);
}}
style={{ flex: 1, alignSelf: "center" }}
>
<View>
<IconFA name="square" size={35} />
</View>
</TouchableOpacity>
)}
<CheckBox <TouchableOpacity
style={{margin:10}} onPress={() =>
value={this.state.checkbox1} this.props.navigation.navigate("febrada")
onChange={() => this.setState({ checkbox1: !this.state.checkbox1 })} }
/> >
<TouchableOpacity><View style={styles.sessionInfo}> <View style={styles.sessionInfo}>
<Text style={styles.sessionTitle}>Nome da palestra</Text> <Text style={styles.sessionTitle}>
<Text style={{marginTop:10, marginBottom:5}}>12 Lugares disponíveis</Text> {item[index].Name}
<Progress.Bar color={'#000000'} progress={0.3} unfilledColor={'white'} width={150}/> </Text>
</View></TouchableOpacity> <Text
style={{ marginTop: 10, marginBottom: 5 }}
>
{item[index].MaxAttendees -
item[index].Enrolled}{" "}
Lugares disponíveis
</Text>
<Progress.Bar
color={"#000000"}
progress={
item[index].Enrolled /
item[index].MaxAttendees
}
unfilledColor={"white"}
width={170}
/>
</View>
</TouchableOpacity>
</View> </View>
<Divider style={{ backgroundColor: '#eeeeee' }} /> <Divider style={{ backgroundColor: "#eeeeee" }} />
</View>
<View style={styles.session}> )}
/>
<CheckBox
style={{margin:10}}
value={this.state.checkbox1}
onChange={() => this.setState({ checkbox1: !this.state.checkbox1 })}
/>
<TouchableOpacity><View style={styles.sessionInfo}>
<Text style={styles.sessionTitle}>Nome da palestra</Text>
<Text style={{marginTop:10, marginBottom:5}}>12 Lugares disponíveis</Text>
<Progress.Bar color={'#000000'} progress={0.3} unfilledColor={'white'} width={150}/>
</View></TouchableOpacity>
</View>
<Divider style={{ backgroundColor: '#eeeeee' }} />
<View style={styles.session}>
<CheckBox
style={{margin:10}}
value={this.state.checkbox1}
onChange={() => this.setState({ checkbox1: !this.state.checkbox1 })}
/>
<TouchableOpacity><View style={styles.sessionInfo}>
<Text style={styles.sessionTitle}>Nome da palestra</Text>
<Text style={{marginTop:10, marginBottom:5}}>12 Lugares disponíveis</Text>
<Progress.Bar color={'#000000'} progress={0.3} unfilledColor={'white'} width={150}/>
</View></TouchableOpacity>
</View>
<Divider style={{ backgroundColor: '#eeeeee' }} />
</View>
</View> </View>
} </View>
{this.props.changingGuest && )}
/>
)}
</View>
</View>
<ActivityIndicator size="large" color="red"/> {(this.props.changingGuest || this.props.Blocks == true) && (
} <ActivityIndicator
size="large"
color="red"
style={{ flex: 1, alignContent: "center" }}
</ScrollView> />
); )}
} </ScrollView>
</View>
);
}
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
sessionInfo:{ companyLogo: {
margin:5 backgroundColor: "white",
}, margin: 20,
sessionTitle:{ width: SCREEN_WIDTH * 0.35,
fontSize:15, borderRadius: 3,
fontWeight:'bold' padding: 5
}, },
day:{ companyDescription: {
margin:10 // backgroundColor:'white',
}, margin: 20,
dayText:{ marginRight: 0,
fontSize:20, width: SCREEN_WIDTH * 0.5,
color: '#CC1A17', borderRadius: 3
textAlign: 'center', },
sessionInfo: {
}, margin: 5
time:{ },
alignContent:'center', sessionTitle: {
width:SCREEN_WIDTH*0.20, fontSize: 15,
backgroundColor:'white' fontWeight: "bold"
}, },
day: {
block:{ margin: 10
},
flex:1, dayText: {
flexDirection:'row', fontSize: 20,
backgroundColor:'red', color: "#CC1A17",
margin:10, textAlign: "center"
borderRadius:5 },
time: {
}, alignContent: "center",
width: SCREEN_WIDTH * 0.23,
companyContainer:{ backgroundColor: "white"
flex:1,
backgroundColor:'blue',
height:SCREEN_HEIGHT*0.25,
}, },
block: {
sessions:{ flex: 1,
flex:1, flexDirection: "row",
flexDirection:'column', backgroundColor: "red",
margin: 10,
backgroundColor:'white', borderRadius: 5
}, },
page:{ companyContainer: {
backgroundColor:'#eeeeee', flex: 1,
// backgroundColor:'blue',
},
pickerCareer:{
paddingLeft:30,
paddingRight:30,
backgroundColor:'white',
width:SCREEN_WIDTH,
flexDirection: "row",
marginTop: 0
}, },
session:{
margin:10, sessions: {
flex:1, flex: 1,
flexDirection:'row', flexDirection: "column",
backgroundColor: "white"
},
page: {
backgroundColor: "#eeeeee"
},
pickerCareer: {
paddingLeft: 30,
paddingRight: 30,
backgroundColor: "white",
width: SCREEN_WIDTH
},
session: {
margin: 10,
flex: 1,
flexDirection: "row"
} }
}); });
function mapStateToProps(state, props) { function mapStateToProps(state, props) {
return {
return { // token: state.apiReducer.token,
showAlert: state.apiReducer.showAlert,
// token: state.apiReducer.token, user: state.apiReducer.user,
user: state.apiReducer.user, logged: state.apiReducer.logged,
logged: state.apiReducer.logged, events: state.apiReducer.events,
events: state.apiReducer.events, userDetails: state.apiReducer.userDetails,
userDetails: state.apiReducer.userDetails, calendar: state.apiReducer.calendar,
calendar : state.apiReducer.calendar, changingGuest: state.apiReducer.changingGuest,
changingGuest : state.apiReducer.changingGuest, sessions: state.apiReducer.sessions,
sessions:state.apiReducer.sessions, Blocks: state.apiReducer.Blocks,
showAlert: state.apiReducer.showAlert
};
}
} }
function mapDispatchToProps(dispatch) { function mapDispatchToProps(dispatch) {
return bindActionCreators(Actions, dispatch);
return bindActionCreators(Actions, dispatch);
} }
export default connect(mapStateToProps, mapDispatchToProps)(choosePath); export default connect(
mapStateToProps,
mapDispatchToProps
)(choosePath);

View File

@ -31,4 +31,7 @@ export const UI_LOGIN_NOINTERNET='UI_LOGIN_NOINTERNET'
export const UI_LOGIN_OPEN_SCANNER='UI_LOIN_OPEN_SCANNER' export const UI_LOGIN_OPEN_SCANNER='UI_LOIN_OPEN_SCANNER'
//HOME
export const OPEN_MODAL='OPEN_MODAL'
export const CLOSE_MODAL='CLOSE_MODAL'

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,20 @@
export {checkUser, export {checkUser,
login,getEvents, login,
hold, getUserInfo, getEvents,
hold,
getUserInfo,
logoutUser, logoutUser,
getAvailableGuestlists, getAvailableGuestlists,
changeGuestList, changeGuestList,
waitChangeGuest, waitChangeGuest,
getAvailableSessions getAvailableSessions,
updateUser,
getSessionBlocks,
timerChangeGuest,
getSessions,
signSession,
openModal,
closeModal
} from "./api" } from "./api"
export { export {

View File

@ -1,182 +1,228 @@
import { DATA_AVAILABLE, API_LOGIN, CHECK_USER, LOGOUT_USER, USER_INFO, HOLD, GET_EVENTS, GET_CAREERS, CHANGE_GUEST, WAIT_CHANGE, GET_SESSIONS } from "../actions/actionTypes" //Import the actions types constant we defined in our actions import {
import { REHYDRATE } from 'redux-persist'; DATA_AVAILABLE,
API_LOGIN,
CHECK_USER,
LOGOUT_USER,
USER_INFO,
HOLD,
GET_EVENTS,
GET_CAREERS,
CHANGE_GUEST,
WAIT_CHANGE,
GET_SESSIONS,
SESSION_BLOCKS,
TIMERWAIT_CHANGE,
SIGN_SESSION,
OPEN_MODAL,
CLOSE_MODAL,
LOADINGLOGIN
} from "../actions/actionTypes"; //Import the actions types constant we defined in our actions
import { REHYDRATE } from "redux-persist";
let apiState = {
isConnected: false,
logged: false,
onHold: true,
user: {},
events: [],
showAlert: true,
failedAttempt: false,
userDetails: {
username: "",
password: "",
token: {
expirationDateToken: 0,
access_token: ""
}
},
calendar: {},
changingGuest: false,
sessions: {},
Blocks: {},
onHoldBlocks: true,
careerPath:{name:'Sem Career Path', color:'#eeeeee'},
a:{},
b:{},
c:{},
d:{},
loadingLogin:false,
let apiState= {
isConnected:false,
logged:false,
onHold:true,user:{},
events:[],
failedAttempt:false,
userDetails:{
username:'',
password:'',
token:{
expirationDateToken:0,
access_token:''
}
},
calendar:{
},
changingGuest:false,
sessions:{}
}; };
const apiReducer = (state = apiState, action) => { const apiReducer = (state = apiState, action) => {
switch (action.type) {
switch(action.type){ case REHYDRATE:
console.log(action);
if (action.payload != undefined) {
console.log(action.payload);
case REHYDRATE: var expirationDateTokenA = 0;
console.log(action) var access_tokenA = "";
if(action.payload!=undefined){
console.log( action.payload)
var expirationDateTokenA=0; if (action.payload.apiReducer.userDetails.token != undefined) {
var access_tokenA=''; if (
action.payload.apiReducer.userDetails.token.expirationDateToken !=
undefined
) {
expirationDateTokenA =
action.payload.apiReducer.userDetails.token.expirationDateToken;
}
if(action.payload.apiReducer.userDetails.token!=undefined){ if (
action.payload.apiReducer.userDetails.token.access_token !=
if(action.payload.apiReducer.userDetails.token.expirationDateToken!= undefined){ undefined
) {
expirationDateTokenA= action.payload.apiReducer.userDetails.token.expirationDateToken; access_tokenA =
} action.payload.apiReducer.userDetails.token.access_token;
}
if((action.payload.apiReducer.userDetails.token.access_token!= undefined)){ }
access_tokenA= action.payload.apiReducer.userDetails.token.access_token; return {
sessions: action.payload.apiReducer.sessions,
// token: action.payload.apiReducer.token,
user: action.payload.apiReducer.user,
onHoldBlocks: true,
userDetails: {
token: {
expirationDateToken: expirationDateTokenA,
access_token: access_tokenA
},
username: action.payload.apiReducer.userDetails.username,
password: action.payload.apiReducer.userDetails.password
}
};
}
} case "CHANGE_CONNECTION_STATUS":
return Object.assign({}, state, {
} isConnected: action.isConnected
});
return {
// token: action.payload.apiReducer.token,
user: action.payload.apiReducer.user,
userDetails:{
token:{
expirationDateToken: expirationDateTokenA,
access_token:access_tokenA,
},
username:action.payload.apiReducer.userDetails.username,
password:action.payload.apiReducer.userDetails.password
}
};
}
case 'CHANGE_CONNECTION_STATUS': case LOADINGLOGIN:
return Object.assign({}, state, { state= Object.assign({}, state, {loadingLogin:true});
isConnected: action.isConnected,
});
case HOLD:
state=Object.assign({},state, { onHold:true }); case HOLD:
return state; state = Object.assign({}, state, { onHold: true });
return state;
case API_LOGIN: case API_LOGIN:
state = Object.assign({}, state, {
logged: action.logged,
state=Object.assign({},state, { //token:action.token,
logged:action.logged, failedAttempt: action.failedAttempt,
//token:action.token, user: action.user,
failedAttempt: action.failedAttempt, userDetails: {
user:action.user, token: action.token,
userDetails: {token:action.token, username:action.userDetails.username, password:action.userDetails.password}, username: action.userDetails.username,
password: action.userDetails.password
},
}); loadingLogin:false,
onHold: action.onHold
});
return state; return state;
case CHECK_USER: case CHECK_USER:
var u = action.userDetails;
if (action.token != undefined) u.token = action.token;
var u= action.userDetails; state = Object.assign({}, state, {
if(action.token != undefined) logged: action.logged,
u.token= action.token; onHold: action.onHold,
userDetails: u
});
state=Object.assign({},state, {logged:action.logged, onHold:action.onHold, userDetails:u }); return state;
return state; case LOGOUT_USER:
state = Object.assign({}, state, { user:{}, userDetails:{}, logged:false});
case LOGOUT_USER: return state;
state=Object.assign({},state, { logged:false}); case USER_INFO:
state = Object.assign({}, state, {
user: action.user,
loggedIn: action.loggedIn,
onHold: action.onHold
});
return state; return state;
case USER_INFO: case GET_EVENTS:
state = Object.assign({}, state, { events: action.events , a:action.day1, b:action.day2, c:action.day3, d:action.day4});
state=Object.assign({},state, { user: action.user , loggedIn:action.loggedIn, onHold:action.onHold}); return state;
return state;
case GET_EVENTS:
state=Object.assign({},state, { events: action.events}); case OPEN_MODAL:
console.log("open modal")
return state; state = Object.assign({}, state, {
modalOpen: true,
modalInfo: action.modalInfo,
modalType: action.type
});
return state;
case GET_CAREERS:
var c= {
guests:action.guests
}
state=Object.assign({},state, { calendar:c });
return state; case CLOSE_MODAL:
state = Object.assign({}, state, {
case CHANGE_GUEST: modalOpen: false,
state=Object.assign({},state, { changingGuest:false}); modalInfo: "",
return state; type: ""
});
return state;
case WAIT_CHANGE: case SIGN_SESSION:
state=Object.assign({},state, { changingGuest:true}); state = Object.assign({}, state, {
return state; sessions: action.sessions,
Blocks: action.Blocks,
careerPath: action.careerPath,
changingGuest: action.changingGuest,
user:action.user
});
return state;
case GET_SESSIONS: case SESSION_BLOCKS:
state=Object.assign({},state, { changingGuest:false, sessions:action.sessions}); state = Object.assign({}, state, {
return state; Blocks: action.Blocks,
default: onHoldBlocks: false,
return state; changingGuest: false
} });
} return state;
export default apiReducer;
case GET_CAREERS:
var c = {
guests: action.guests
};
state = Object.assign({}, state, { calendar: c });
return state;
case CHANGE_GUEST:
state = Object.assign({}, state, {
changingGuest: false,
sessions: action.sessions,
Blocks: action.Blocks,
careerPath: action.careerPath
});
return state;
case WAIT_CHANGE:
state = Object.assign({}, state, { changingGuest: true });
return state;
case TIMERWAIT_CHANGE:
state = Object.assign({}, state, { Blocks: true });
return state;
case GET_SESSIONS:
state = Object.assign({}, state, {
sessions: action.sessions,
Blocks: action.Blocks,
careerPath: action.careerPath
});
return state;
default:
return state;
}
};
export default apiReducer;

8
App/package-lock.json generated
View File

@ -7844,6 +7844,14 @@
"resolved": "https://registry.npmjs.org/react-native-app-intro-slider/-/react-native-app-intro-slider-1.0.1.tgz", "resolved": "https://registry.npmjs.org/react-native-app-intro-slider/-/react-native-app-intro-slider-1.0.1.tgz",
"integrity": "sha512-5Gzg5FG2uP/RHkSDFB5+2df4vQ2FpyUJ5PGYd23lLEISsEOJe0Zredh1hHMJj+fB5D9B7ZoL0IlR+SNn8iFxHg==" "integrity": "sha512-5Gzg5FG2uP/RHkSDFB5+2df4vQ2FpyUJ5PGYd23lLEISsEOJe0Zredh1hHMJj+fB5D9B7ZoL0IlR+SNn8iFxHg=="
}, },
"react-native-awesome-alerts": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/react-native-awesome-alerts/-/react-native-awesome-alerts-1.2.0.tgz",
"integrity": "sha512-ouxDGJ/porNkuaeqpgxIJA4jAPqHC9bJIsxLA21NA6eZhnEhbqWOprjsNqwI0/7bJxXm9baTzXESCMzwAy3eZw==",
"requires": {
"prop-types": "^15.5.10"
}
},
"react-native-branch": { "react-native-branch": {
"version": "2.2.5", "version": "2.2.5",
"resolved": "https://registry.npmjs.org/react-native-branch/-/react-native-branch-2.2.5.tgz", "resolved": "https://registry.npmjs.org/react-native-branch/-/react-native-branch-2.2.5.tgz",

View File

@ -17,6 +17,7 @@
"react-native": "0.57.8", "react-native": "0.57.8",
"react-native-action-button": "^2.8.5", "react-native-action-button": "^2.8.5",
"react-native-app-intro-slider": "^1.0.1", "react-native-app-intro-slider": "^1.0.1",
"react-native-awesome-alerts": "^1.2.0",
"react-native-camera": "^1.9.2", "react-native-camera": "^1.9.2",
"react-native-check-box": "^2.1.7", "react-native-check-box": "^2.1.7",
"react-native-cli": "^2.0.1", "react-native-cli": "^2.0.1",

View File

@ -28,7 +28,6 @@ namespace api.Controllers
public UserManager<User> _userManager { get; } public UserManager<User> _userManager { get; }
public SignInManager<User> _signInManager { get; } public SignInManager<User> _signInManager { get; }
public IUsersRepository _repo { get; } public IUsersRepository _repo { get; }
private readonly IMapper _mapper; private readonly IMapper _mapper;
private readonly RoleManager<Role> _roleManager; private readonly RoleManager<Role> _roleManager;

View File

@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using api.Data;
using api.Dtos;
using api.Models;
using AutoMapper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace api.Controllers
{
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class EventLocsController : ControllerBase
{
private readonly DataContext context;
private readonly IEventLocsRepository _repo;
private readonly IMapper _mapper;
private readonly RoleManager<Role> _roleManager;
private readonly UserManager<User> _userManager;
public EventLocsController(DataContext context,IEventLocsRepository repo, IMapper mapper,RoleManager<Role> roleManager,UserManager<User> UserManager)
{
this.context = context;
_mapper = mapper;
_roleManager = roleManager;
_userManager = UserManager;
_repo = repo;
}
// GET api/EventLocs
// GET all EventLocs
[HttpGet]
public async Task<IActionResult> GetEventLocs()
{
var Teams = await _repo.GetEventLocs();
return Ok(Teams);
}
// GET api/EventLocs/[id]
[HttpGet("{id}")]
public async Task<IActionResult> GetEventLoc(int id)
{
var Teams = await _repo.GetEventLoc(id);
return Ok(Teams);
}
// GET api/EventLocs/[id]
[HttpGet("e/{id}")]
public async Task<IActionResult> GetEventLocEvent(int id)
{
var Teams = await _repo.GetEventLocEvent(id);
return Ok(Teams);
}
// POST api/eventLocs/add
// add new event
[HttpPost("add")]
public async Task<IActionResult> AddEventLoc(EventLocAdd EventLocData)
{
EventLoc EAdd = new EventLoc{EventId = EventLocData.EventId, Lat = EventLocData.Lat, Long = EventLocData.Long, Nome = EventLocData.Nome, Desc = EventLocData.Desc, Img = EventLocData.Img};
await context.EventLocs.AddAsync(EAdd);
var result = context.SaveChanges();
if (result == 1)
{
return StatusCode(201);
}
return BadRequest();
}
}
}

View File

@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using api.Data;
using api.Dtos;
using api.Models;
using AutoMapper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace api.Controllers
{
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class EventLocsVisitedController : ControllerBase
{
private readonly DataContext context;
private readonly IEventLocsVisitedRepository _repo;
private readonly IMapper _mapper;
private readonly RoleManager<Role> _roleManager;
private readonly UserManager<User> _userManager;
public EventLocsVisitedController(DataContext context,IEventLocsVisitedRepository repo, IMapper mapper,RoleManager<Role> roleManager,UserManager<User> UserManager)
{
this.context = context;
_mapper = mapper;
_roleManager = roleManager;
_userManager = UserManager;
_repo = repo;
}
// GET api/EventLocsVisited
// GET all EventLocsVisited
[HttpGet]
public async Task<IActionResult> GetEventLocsVisited()
{
var Locs = await _repo.GetEventLocsVisited();
return Ok(Locs);
}
// GET api/EventLocsVisited/t/[id]
//All locs visited by team id
[HttpGet("t/{id}")]
public async Task<IActionResult> GetEventLocsVisitedTeam(int id)
{
var Locs = await _repo.GetEventLocsVisitedTeam(id);
return Ok(Locs);
}
// GET api/EventLocsVisited/e/[id]
//All locs visited by event id
[HttpGet("e/{id}")]
public async Task<IActionResult> GetEventLocsVisitedEvent(int id)
{
var Locs = await _repo.GetEventLocsVisitedEvent(id);
return Ok(Locs);
}
// POST api/eventLocsVisited/add
// add new event
[HttpPost("add")]
public async Task<IActionResult> AddEventLoc(EventLocVisitedAdd EventLocVisitedData)
{
EventLoc Loc = await context.EventLocs.FirstOrDefaultAsync(a=>a.Id == EventLocVisitedData.EventLocID);
var userT = await context.Users.FirstOrDefaultAsync(u=>u.QRcode==EventLocVisitedData.USerQR);
if(userT.team == null){
return StatusCode(403);
}
Team TeamToEdit = userT.team;
TeamToEdit.Pontos += EventLocVisitedData.pontos;
EventLocVisited toAdd = new EventLocVisited{Team = TeamToEdit,Location = Loc, timestamp = DateTime.Now};
await context.EventLocsVisited.AddAsync(toAdd);
context.Teams.Update(TeamToEdit);
var result = context.SaveChanges();
if (result >= 1)
{
return StatusCode(201);
}
return BadRequest();
}
}
}

View File

@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using api.Data;
using api.Dtos;
using api.Models;
using AutoMapper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace api.Controllers
{
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class EventsController : ControllerBase
{
private readonly DataContext context;
private readonly IEventsRepository _repo;
private readonly IMapper _mapper;
public EventsController(DataContext context,IEventsRepository repo, IMapper mapper)
{
this.context = context;
_mapper = mapper;
_repo = repo;
}
// GET api/events
// GET all events
[HttpGet]
public async Task<IActionResult> GetEvents()
{
var Events = await _repo.GetEvents();
return Ok(Events);
}
// GET api/events/[id]
// GET events id x
[HttpGet("{id}")]
public async Task<IActionResult> GetEvent(int id)
{
var Event = await _repo.GetEvent(id);
return Ok(Event);
}
// POST api/events/add
// add new event
[HttpPost("add")]
public async Task<IActionResult> AddEvent(EventForAdd EventData)
{
Event EAdd = new Event{Nome = EventData.Nome,Desc = EventData.Desc};
await context.Events.AddAsync(EAdd);
var result = context.SaveChanges();
if (result == 1)
{
return StatusCode(201);
}
return BadRequest();
}
}
}

View File

@ -0,0 +1,192 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using api.Data;
using api.Dtos;
using api.Models;
using AutoMapper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace api.Controllers
{
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class TeamsController : ControllerBase
{
private readonly DataContext context;
private readonly ITeamsRepository _repo;
private readonly IMapper _mapper;
private readonly RoleManager<Role> _roleManager;
private readonly UserManager<User> _userManager;
public TeamsController(DataContext context,ITeamsRepository repo, IMapper mapper,RoleManager<Role> roleManager,UserManager<User> UserManager)
{
this.context = context;
_mapper = mapper;
_roleManager = roleManager;
_userManager = UserManager;
_repo = repo;
}
// GET api/teams
// GET all teams
[HttpGet]
public async Task<IActionResult> GetTeams()
{
var Teams = await _repo.GetTeams();
return Ok(Teams);
}
// GET api/teams/e/[id]
// GET all teams for event id
[HttpGet("e/{id}")]
public async Task<IActionResult> GetTeamsEvent(int id)
{
var Teams = await _repo.GetEventTeam(id);
return Ok(Teams);
}
// GET api/teams/e/[id]
// GET all teams for event id
[HttpGet("u/{QR}")]
public async Task<IActionResult> GetTeamsUser(String QR)
{
var Teams = await _repo.GetUserTeam(QR);
return Ok(Teams);
}
// POST api/teams/add
// create team
[HttpPost("add")]
public async Task<IActionResult> CreateTeam(TeamForAdd TeamAddDetails)
{
User tCap = await context.Users.FirstOrDefaultAsync(u=>u.QRcode == TeamAddDetails.capQR);
if(tCap.team == null){
Team tAdd = new Team{EventId = TeamAddDetails.EventId, Nome = TeamAddDetails.Nome, Cap = tCap, NMembros = 1, Pontos = 0};
tCap.team = tAdd;
await context.Teams.AddAsync(tAdd);
context.Users.Update(tCap);
var result = context.SaveChanges();
if (result >= 1)
{
return StatusCode(201);
}
return BadRequest();
}else{
return BadRequest();
}
}
// POST api/teams/add/member
// create team
[HttpPost("add/member")]
public async Task<IActionResult> AddTeamMember(TeamAddMember MemberToAdd)
{
User newMember = await context.Users.FirstOrDefaultAsync(u=>u.QRcode == MemberToAdd.newQR);
Team tEdit = await context.Teams.FirstOrDefaultAsync(t=>t.Id == MemberToAdd.id);
if(newMember.team == null){
tEdit.NMembros++;
newMember.team = tEdit;
context.Teams.Update(tEdit);
context.Users.Update(newMember);
var result = context.SaveChanges();
return StatusCode(201);
}else{
return StatusCode(403);
}
}
// POST api/teams/ChangeName
// create team
[HttpPost("changename")]
public async Task<IActionResult> ChangeName(TeamChangeName NameChange)
{
Team tEdit = await context.Teams.Include(t=>t.Cap).FirstOrDefaultAsync(t=>t.Id == NameChange.TeamID);
User cap = await context.Users.FirstOrDefaultAsync(u=>u.QRcode == NameChange.UserQR);
if(cap == tEdit.Cap){
tEdit.Nome = NameChange.nome;
}
context.Teams.Update(tEdit);
var result = context.SaveChanges();
return StatusCode(201);
}
// POST api/teams/delete
// create team
[HttpPost("delete")]
public async Task<IActionResult> DeleteTeam(TeamDelete DeleteData)
{
Team tEdit = await context.Teams.Include(t=>t.Cap).FirstOrDefaultAsync(t=>t.Id == DeleteData.TeamID);
User cap = await context.Users.FirstOrDefaultAsync(u=>u.QRcode == DeleteData.UserQR);
if(cap == tEdit.Cap){
context.Teams.Remove(tEdit);
cap.team = null;
context.Users.Update(cap);
var result = context.SaveChanges();
return StatusCode(201);
}else{
return StatusCode(403);
}
}
// POST api/teams/remove/member
// remove member
[HttpPost("remove/member")]
public async Task<IActionResult> RemoveTeamMember(TeamRemoveMEmber MemberToRemove)
{
User rmMember = await context.Users.FirstOrDefaultAsync(u=>u.QRcode == MemberToRemove.UserToRemoveQR);
Team tEdit = await context.Teams.Include(t=>t.Cap).FirstOrDefaultAsync(t=>t.Id == MemberToRemove.TeamID);
if(rmMember == tEdit.Cap){
return StatusCode(403);
}
if(rmMember.team == tEdit){
tEdit.NMembros--;
rmMember.team = null;
context.Teams.Update(tEdit);
context.Users.Update(rmMember);
var result = context.SaveChanges();
return StatusCode(201);
}else{
return StatusCode(403);
}
}
}
}

View File

@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore;
namespace api.Data namespace api.Data
{ {
public class DataContext : IdentityDbContext<User,Role,int,IdentityUserClaim<int>, public class DataContext : IdentityDbContext<User,Role,int,IdentityUserClaim<int>,UserRole,IdentityUserLogin<int>,
UserRole,IdentityUserLogin<int>,IdentityRoleClaim<int>,IdentityUserToken<int>> IdentityRoleClaim<int>,IdentityUserToken<int>>
{ {
public DataContext(DbContextOptions<DataContext> options):base(options) { } public DataContext(DbContextOptions<DataContext> options):base(options) { }
@ -24,31 +24,31 @@ namespace api.Data
public DbSet<Log>Logs{get;set;} public DbSet<Log>Logs{get;set;}
public DbSet<Product>Products{get;set;} public DbSet<Product>Products{get;set;}
protected override void OnModelCreating(ModelBuilder builder) protected override void OnModelCreating(ModelBuilder builder)
{ {
base.OnModelCreating(builder); base.OnModelCreating(builder);
//para o ef saber as relações //para o ef saber as relações
builder.Entity<UserRole>(userRole => builder.Entity<UserRole>(userRole =>
{ {
userRole.HasKey(ur=> new {ur.UserId, ur.RoleId}); userRole.HasKey(ur=> new {ur.UserId, ur.RoleId});
userRole.HasOne( ur=>ur.Role) userRole.HasOne( ur=>ur.Role)
.WithMany(r=>r.UserRoles) .WithMany(r=>r.UserRoles)
.HasForeignKey(ur=> ur.RoleId) .HasForeignKey(ur=> ur.RoleId)
.IsRequired(); .IsRequired();
userRole.HasOne( ur=>ur.User) userRole.HasOne( ur=>ur.User)
.WithMany(r=>r.UserRoles) .WithMany(r=>r.UserRoles)
.HasForeignKey(ur=> ur.UserId) .HasForeignKey(ur=> ur.UserId)
.IsRequired(); .IsRequired();
}); });
} }
} }
} }

View File

@ -0,0 +1,48 @@
using System;
using System.Threading.Tasks;
using api.Models;
using api.Data;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
namespace api.Data
{
public class EventLocsRepository : IEventLocsRepository
{
public EventLocsRepository(DataContext context)
{
_context = context;
}
public DataContext _context { get; }
public async Task<EventLoc> GetEventLoc(int id)
{
var rEventLocs = await _context.EventLocs.FirstOrDefaultAsync(e=>e.Id == id);
return rEventLocs;
}
public async Task<List<EventLoc>> GetEventLocEvent(int id)
{
List<EventLoc> eLocs = await _context.EventLocs.ToListAsync();
List<EventLoc> rEventLocs = new List<EventLoc>();
eLocs.ForEach(delegate (EventLoc e){
if(e.EventId == id){
rEventLocs.Add(e);
}
});
return rEventLocs;
}
public async Task<IEnumerable<EventLoc>> GetEventLocs()
{
var rEventLocs = await _context.EventLocs.ToListAsync();
return rEventLocs;
}
}
}

View File

@ -0,0 +1,51 @@
using System;
using System.Threading.Tasks;
using api.Models;
using api.Data;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
namespace api.Data
{
public class EventLocsVisitedRepository : IEventLocsVisitedRepository
{
public EventLocsVisitedRepository(DataContext context)
{
_context = context;
}
public DataContext _context { get; }
public async Task<IEnumerable<EventLocVisited>> GetEventLocsVisited()
{
var rEventLocsVisitedList = await _context.EventLocsVisited.Include(e=>e.Team).Include(e=>e.Location).ToListAsync();
return rEventLocsVisitedList;
}
public async Task<List<EventLocVisited>> GetEventLocsVisitedTeam(int id)
{
List<EventLocVisited> allLocs = await _context.EventLocsVisited.Include(e=>e.Team).Include(e=>e.Location).ToListAsync();
List<EventLocVisited> rList = new List<EventLocVisited>();
for(var i=0;i<allLocs.Count;i++){
if(allLocs[i].Team.Id == id){
rList.Add(allLocs[i]);
}
}
return rList;
}
public async Task<List<EventLocVisited>> GetEventLocsVisitedEvent(int id)
{
List<EventLocVisited> allLocs = await _context.EventLocsVisited.Include(e=>e.Team).Include(e=>e.Location).ToListAsync();
List<EventLocVisited> rList = new List<EventLocVisited>();
for(var i=0;i<allLocs.Count;i++){
if(allLocs[i].Location.EventId == id){
rList.Add(allLocs[i]);
}
}
return rList;
}
}
}

View File

@ -0,0 +1,34 @@
using System;
using System.Threading.Tasks;
using api.Models;
using api.Data;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
namespace api.Data
{
public class EventsRepository : IEventsRepository
{
public EventsRepository(DataContext context)
{
_context = context;
}
public DataContext _context { get; }
public async Task<Event> GetEvent(int id)
{
var Event = await _context.Events.FirstOrDefaultAsync(e=>e.Id == id);
return Event;
}
public async Task<IEnumerable<Event>> GetEvents()
{
var Events = await _context.Events.ToListAsync();
return Events;
}
}
}

View File

@ -0,0 +1,16 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using api.Models;
namespace api.Data
{
public interface IEventLocsRepository
{
Task<IEnumerable<EventLoc>> GetEventLocs();
Task<EventLoc> GetEventLoc(int id);
Task<List<EventLoc>> GetEventLocEvent(int id);
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using api.Models;
namespace api.Data
{
public interface IEventLocsVisitedRepository
{
Task<IEnumerable<EventLocVisited>> GetEventLocsVisited();
Task<List<EventLocVisited>> GetEventLocsVisitedTeam(int id);
Task<List<EventLocVisited>> GetEventLocsVisitedEvent(int id);
}
}

View File

@ -0,0 +1,15 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using api.Models;
namespace api.Data
{
public interface IEventsRepository
{
Task<IEnumerable<Event>> GetEvents();
Task<Event> GetEvent(int id);
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using api.Models;
namespace api.Data
{
public interface ITeamsRepository
{
Task<IEnumerable<Team>> GetTeams();
Task<List<Team>> GetEventTeam(int id);
Task<Team> GetUserTeam(String QR);
}
}

View File

@ -0,0 +1,47 @@
using System;
using System.Threading.Tasks;
using api.Models;
using api.Data;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
namespace api.Data
{
public class TeamsRepository : ITeamsRepository
{
public TeamsRepository(DataContext context)
{
_context = context;
}
public DataContext _context { get; }
public async Task<List<Team>> GetEventTeam(int id)
{
List<Team> allTeams = await _context.Teams.Include(a=>a.Cap).ToListAsync();
List<Team> rTeam = new List<Team>();
allTeams.ForEach(delegate(Team t){
if(t.EventId == id){
rTeam.Add(t);
}
});
return rTeam;
}
public async Task<Team> GetUserTeam(String QR)
{
var rTeam = (await _context.Users.FirstAsync(u=>u.QRcode == QR)).team;
return rTeam;
}
public async Task<IEnumerable<Team>> GetTeams()
{
var rTeams = await _context.Teams.Include(a=>a.Cap).ToListAsync();
return rTeams;
}
}
}

16
api/Dtos/EventForAdd.cs Normal file
View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using api.Models;
namespace api.Dtos
{
public class EventForAdd
{
[Required]
public string Nome{get;set;} //equipa id
[Required]
public string Desc{get;set;} //novo membro
}
}

28
api/Dtos/EventLocAdd.cs Normal file
View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using api.Models;
namespace api.Dtos
{
public class EventLocAdd
{
[Required]
public int EventId{get;set;} //Event ID
[Required]
public float Lat{get;set;} //latitude
[Required]
public float Long{get;set;} //longitude
[Required]
public String Nome{get;set;} //Nome da localização
[Required]
public String Desc{get;set;} //Descrição
public Photo Img{get;set;} //Foto da localização
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using api.Models;
namespace api.Dtos
{
public class EventLocVisitedAdd
{
[Required]
public String USerQR{get;set;} //User ID
[Required]
public int EventLocID{get;set;} //Loc id
[Required]
public int pontos{get;set;} //Pontos a adicionar
}
}

16
api/Dtos/TeamAddMember.cs Normal file
View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using api.Models;
namespace api.Dtos
{
public class TeamAddMember
{
[Required]
public int id{get;set;} //equipa id
[Required]
public string newQR{get;set;} //novo membro
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using api.Models;
namespace api.Dtos
{
public class TeamChangeName
{
[Required]
public int TeamID{get;set;} //teamid
[Required]
public string nome{get;set;} //novo nome
[Required]
public string UserQR{get;set;} //user qr
}
}

17
api/Dtos/TeamDelete.cs Normal file
View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using api.Models;
namespace api.Dtos
{
public class TeamDelete
{
[Required]
public int TeamID{get;set;} //teamid
[Required]
public string UserQR{get;set;} //user qr
}
}

19
api/Dtos/TeamForAdd.cs Normal file
View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using api.Models;
namespace api.Dtos
{
public class TeamForAdd
{
[Required]
public int EventId{get;set;} //equipa para o evento ID
[Required]
public string Nome{get;set;} //Nome da equipa
[Required]
public string capQR{get;set;} //Capitao da equipa
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using api.Models;
namespace api.Dtos
{
public class TeamRemoveMEmber
{
[Required]
public int TeamID{get;set;} //teamid
[Required]
public string UserQR{get;set;} //user qr
[Required]
public string UserToRemoveQR{get;set;} //user qr
}
}

View File

@ -9,8 +9,8 @@ using api.Data;
namespace api.Migrations namespace api.Migrations
{ {
[DbContext(typeof(DataContext))] [DbContext(typeof(DataContext))]
[Migration("20190224020609_finos")] [Migration("20190309183026_TeamsV2")]
partial class finos partial class TeamsV2
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
@ -243,7 +243,7 @@ namespace api.Migrations
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<int?>("CapId"); b.Property<int?>("CapID");
b.Property<int>("EventId"); b.Property<int>("EventId");
@ -253,11 +253,9 @@ namespace api.Migrations
b.Property<int>("Pontos"); b.Property<int>("Pontos");
b.Property<string>("QRcode");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CapId"); b.HasIndex("CapID");
b.ToTable("Teams"); b.ToTable("Teams");
}); });
@ -297,8 +295,6 @@ namespace api.Migrations
b.Property<string>("SecurityStamp"); b.Property<string>("SecurityStamp");
b.Property<int?>("TeamId");
b.Property<bool>("TwoFactorEnabled"); b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName") b.Property<string>("UserName")
@ -308,6 +304,8 @@ namespace api.Migrations
b.Property<int>("food"); b.Property<int>("food");
b.Property<int?>("teamID");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("NormalizedEmail") b.HasIndex("NormalizedEmail")
@ -317,7 +315,7 @@ namespace api.Migrations
.IsUnique() .IsUnique()
.HasName("UserNameIndex"); .HasName("UserNameIndex");
b.HasIndex("TeamId"); b.HasIndex("teamID");
b.ToTable("AspNetUsers"); b.ToTable("AspNetUsers");
}); });
@ -424,14 +422,14 @@ namespace api.Migrations
{ {
b.HasOne("api.Models.User", "Cap") b.HasOne("api.Models.User", "Cap")
.WithMany() .WithMany()
.HasForeignKey("CapId"); .HasForeignKey("CapID");
}); });
modelBuilder.Entity("api.Models.User", b => modelBuilder.Entity("api.Models.User", b =>
{ {
b.HasOne("api.Models.Team") b.HasOne("api.Models.Team", "team")
.WithMany("Membros") .WithMany()
.HasForeignKey("TeamId"); .HasForeignKey("teamID");
}); });
modelBuilder.Entity("api.Models.UserRole", b => modelBuilder.Entity("api.Models.UserRole", b =>

View File

@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace api.Migrations namespace api.Migrations
{ {
public partial class finos : Migration public partial class TeamsV2 : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
@ -220,10 +220,9 @@ namespace api.Migrations
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
QRcode = table.Column<string>(nullable: true),
EventId = table.Column<int>(nullable: false), EventId = table.Column<int>(nullable: false),
Nome = table.Column<string>(nullable: true), Nome = table.Column<string>(nullable: true),
CapId = table.Column<int>(nullable: true), CapID = table.Column<int>(nullable: true),
NMembros = table.Column<int>(nullable: false), NMembros = table.Column<int>(nullable: false),
Pontos = table.Column<int>(nullable: false) Pontos = table.Column<int>(nullable: false)
}, },
@ -255,14 +254,14 @@ namespace api.Migrations
QRcode = table.Column<string>(nullable: true), QRcode = table.Column<string>(nullable: true),
drinks = table.Column<int>(nullable: false), drinks = table.Column<int>(nullable: false),
food = table.Column<int>(nullable: false), food = table.Column<int>(nullable: false),
TeamId = table.Column<int>(nullable: true) teamID = table.Column<int>(nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_AspNetUsers", x => x.Id); table.PrimaryKey("PK_AspNetUsers", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_AspNetUsers_Teams_TeamId", name: "FK_AspNetUsers_Teams_teamID",
column: x => x.TeamId, column: x => x.teamID,
principalTable: "Teams", principalTable: "Teams",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
@ -333,9 +332,9 @@ namespace api.Migrations
unique: true); unique: true);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_AspNetUsers_TeamId", name: "IX_AspNetUsers_teamID",
table: "AspNetUsers", table: "AspNetUsers",
column: "TeamId"); column: "teamID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_EventLocs_ImgId", name: "IX_EventLocs_ImgId",
@ -373,9 +372,9 @@ namespace api.Migrations
column: "UserId"); column: "UserId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Teams_CapId", name: "IX_Teams_CapID",
table: "Teams", table: "Teams",
column: "CapId"); column: "CapID");
migrationBuilder.AddForeignKey( migrationBuilder.AddForeignKey(
name: "FK_AspNetUserRoles_AspNetUsers_UserId", name: "FK_AspNetUserRoles_AspNetUsers_UserId",
@ -434,9 +433,9 @@ namespace api.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey( migrationBuilder.AddForeignKey(
name: "FK_Teams_AspNetUsers_CapId", name: "FK_Teams_AspNetUsers_CapID",
table: "Teams", table: "Teams",
column: "CapId", column: "CapID",
principalTable: "AspNetUsers", principalTable: "AspNetUsers",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
@ -445,7 +444,7 @@ namespace api.Migrations
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropForeignKey( migrationBuilder.DropForeignKey(
name: "FK_Teams_AspNetUsers_CapId", name: "FK_Teams_AspNetUsers_CapID",
table: "Teams"); table: "Teams");
migrationBuilder.DropTable( migrationBuilder.DropTable(

View File

@ -241,7 +241,7 @@ namespace api.Migrations
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<int?>("CapId"); b.Property<int?>("CapID");
b.Property<int>("EventId"); b.Property<int>("EventId");
@ -251,11 +251,9 @@ namespace api.Migrations
b.Property<int>("Pontos"); b.Property<int>("Pontos");
b.Property<string>("QRcode");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CapId"); b.HasIndex("CapID");
b.ToTable("Teams"); b.ToTable("Teams");
}); });
@ -295,8 +293,6 @@ namespace api.Migrations
b.Property<string>("SecurityStamp"); b.Property<string>("SecurityStamp");
b.Property<int?>("TeamId");
b.Property<bool>("TwoFactorEnabled"); b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName") b.Property<string>("UserName")
@ -306,6 +302,8 @@ namespace api.Migrations
b.Property<int>("food"); b.Property<int>("food");
b.Property<int?>("teamID");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("NormalizedEmail") b.HasIndex("NormalizedEmail")
@ -315,7 +313,7 @@ namespace api.Migrations
.IsUnique() .IsUnique()
.HasName("UserNameIndex"); .HasName("UserNameIndex");
b.HasIndex("TeamId"); b.HasIndex("teamID");
b.ToTable("AspNetUsers"); b.ToTable("AspNetUsers");
}); });
@ -422,14 +420,14 @@ namespace api.Migrations
{ {
b.HasOne("api.Models.User", "Cap") b.HasOne("api.Models.User", "Cap")
.WithMany() .WithMany()
.HasForeignKey("CapId"); .HasForeignKey("CapID");
}); });
modelBuilder.Entity("api.Models.User", b => modelBuilder.Entity("api.Models.User", b =>
{ {
b.HasOne("api.Models.Team") b.HasOne("api.Models.Team", "team")
.WithMany("Membros") .WithMany()
.HasForeignKey("TeamId"); .HasForeignKey("teamID");
}); });
modelBuilder.Entity("api.Models.UserRole", b => modelBuilder.Entity("api.Models.UserRole", b =>

View File

@ -7,7 +7,7 @@ namespace api.Models
public class EventLocVisited public class EventLocVisited
{ {
public int Id{get;set;} //id public int Id{get;set;} //id
public Team Team{get;set;} //teamQRID public Team Team{get;set;} //team
public EventLoc Location{get;set;} //location public EventLoc Location{get;set;} //location
public DateTime timestamp{get;set;} //time public DateTime timestamp{get;set;} //time
} }

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace api.Models namespace api.Models
@ -7,11 +8,11 @@ namespace api.Models
public class Team public class Team
{ {
public int Id{get;set;} //id public int Id{get;set;} //id
public string QRcode{get;set;} //QR ID code
public int EventId{get;set;} //equipa para o evento ID public int EventId{get;set;} //equipa para o evento ID
public string Nome{get;set;} //Nome da equipa public string Nome{get;set;} //Nome da equipa
[ForeignKey("CapID")]
public User Cap{get;set;} //Capitao da equipa public User Cap{get;set;} //Capitao da equipa
public ICollection<User> Membros {get;set;} //Membros da equipa
public int NMembros {get;set;} //Numero de Membros na equipa public int NMembros {get;set;} //Numero de Membros na equipa
public int Pontos {get;set;} //Postos da equipa public int Pontos {get;set;} //Postos da equipa
} }

View File

@ -1,6 +1,8 @@
using System; using System;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace api.Models namespace api.Models
@ -15,7 +17,9 @@ namespace api.Models
public ICollection<Photo> Photos {get;set;} public ICollection<Photo> Photos {get;set;}
public int drinks{get;set;} public int drinks{get;set;}
public int food{get;set;} public int food{get;set;}
[ForeignKey("teamID")]
public Team team{get;set;}
} }
} }

View File

@ -45,6 +45,10 @@ namespace api
services.AddAutoMapper(); services.AddAutoMapper();
services.AddScoped<IUsersRepository, UsersRepository>(); services.AddScoped<IUsersRepository, UsersRepository>();
services.AddScoped<IEventsRepository, EventsRepository>();
services.AddScoped<ITeamsRepository, TeamsRepository>();
services.AddScoped<IEventLocsRepository, EventLocsRepository>();
services.AddScoped<IEventLocsVisitedRepository, EventLocsVisitedRepository>();
//define a connection string indicada em appsettings.json //define a connection string indicada em appsettings.json
services.AddDbContext<DataContext>(x=>x.UseMySql(Configuration.GetConnectionString("DefaultConnection"))); services.AddDbContext<DataContext>(x=>x.UseMySql(Configuration.GetConnectionString("DefaultConnection")));

View File

@ -1,5 +1,5 @@
{ {
"ProjectFilePath": "/Users/henrique/ENEI2019/api/api.csproj", "ProjectFilePath": "c:\\Users\\ZMiguel\\Desktop\\ENEI2019\\api\\api.csproj",
"TargetFramework": "netcoreapp2.1", "TargetFramework": "netcoreapp2.1",
"TagHelpers": [], "TagHelpers": [],
"Configuration": { "Configuration": {

0
website/android-chrome-256x256.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

0
website/career-path.html Executable file → Normal file
View File

0
website/faqs.html Executable file → Normal file
View File

0
website/imgs/critical-sponsor.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

0
website/imgs/email.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 117 KiB

0
website/imgs/facebook.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 117 KiB

0
website/imgs/instagram.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 117 KiB

0
website/imgs/linkedin.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

0
website/imgs/logo-enei.ai Executable file → Normal file
View File

0
website/imgs/logo-enei.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB