diff --git a/.gitignore b/.gitignore
index c34fb51e..81e27181 100755
--- a/.gitignore
+++ b/.gitignore
@@ -84,4 +84,5 @@ typings/
bin/
obj/
-.vscode/
\ No newline at end of file
+.vscode/
+*.cache
diff --git a/App/app/App.js b/App/app/App.js
index a2be73cc..fbf0aeb1 100755
--- a/App/app/App.js
+++ b/App/app/App.js
@@ -1,551 +1,505 @@
-import React, {Component} from 'react';
+import React, { Component } from "react";
import {
- Platform,
- StyleSheet,
- Text,
- View,
- StatusBar,
- Dimensions,
- Image,
- ActivityIndicator,
- Button,
- TouchableHighlight,
- Keyboard,
- ImageBackground,
- LinearGradient,
- TouchableOpacity,
- TextInput,
- NetInfo,
- Animated
+ Platform,
+ StyleSheet,
+ Text,
+ View,
+ StatusBar,
+ Dimensions,
+ Image,
+ ActivityIndicator,
+ Button,
+ TouchableHighlight,
+ Keyboard,
+ ImageBackground,
+ LinearGradient,
+ TouchableOpacity,
+ TextInput,
+ NetInfo,
+ Animated
+} from "react-native";
-} from 'react-native';
+import { bindActionCreators } from "redux";
+import { connect } from "react-redux";
-import {bindActionCreators} from 'redux';
-import {connect} from 'react-redux';
+import QRCodeScanner from "react-native-qrcode-scanner";
+import { UtilStyles } from "./assets/styles";
-import QRCodeScanner from 'react-native-qrcode-scanner';
-import {UtilStyles} from './assets/styles'
+import * as Actions from "./store/actions";
-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 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_WIDTH = Dimensions.get("window").width;
-import Swiper from 'react-native-swiper';
-
-var TimerMixin = require('react-timer-mixin');
+import Swiper from "react-native-swiper";
+var TimerMixin = require("react-timer-mixin");
function handleConnectivityChange() {
- console.log("asdasd");
+ console.log("asdasd");
}
class App extends Component {
- handleConnectivityChange = isConnected => {
- this.setState({isConnected});
- }
- _activate = () => {
+ handleConnectivityChange = isConnected => {
+ this.setState({ isConnected });
+ };
+ _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});
- this.scanner.reactivate();
+ _toggleModal = () =>
+ this.setState({ isModalVisible: !this.state.isModalVisible });
- }
- _scanQr = () => {
- this.props.openScannerLogin()
- console.log(this.props.UI_loginScannerActive)
- }
- _tryLogin = () => {
+ constructor(props) {
+ super(props);
- //console.log(this.state.text)
- //this.scanner.reactivate();
- this.props.login(this.state.username, this.state.text);
-
-
- }
-
- _toggleModal = () =>
- this.setState({isModalVisible: !this.state.isModalVisible});
-
- constructor(props) {
-
- super(props);
-
- 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})
+ 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,
+ modalOpen: false
};
+ }
+ _print = () => {
+ console.log("hello");
+ this.setState({ push: 0 });
+ };
+ checkValue = e => {
+ console.log("check" + e);
+ };
+ _handleConnectionChange = isConnected => {
+ this.props.connectionState(true);
+ };
- checkValue = (e) => {
- console.log("check" + e)
- };
+ componentDidMount() {
+ //this.props.hold();
+ this.props.loginInternal();
+ NetInfo.isConnected.addEventListener(
+ "connectionChange",
+ this.handleConnectivityChange
+ );
- _handleConnectionChange = (isConnected) => {
- this.props.connectionState(true);
- };
+ this.setState({ isModalVisible: false });
+ //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() {
- this.props.hold();
- NetInfo.isConnected.addEventListener('connectionChange', this.handleConnectivityChange);
+ _keyboardDidHide() {
+ //this.setState({push:4})
+ }
+ 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})
- //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);
+ console.log("QR code lido");
+ };
+ render() {
+
+ if (!this.props.logged && this.props.onHold) {
+ return (
+
+
+
+ );
+ } else {
+ // console.log('token... '+ this.props.logged)
- }
+ //se existir token
- componentWillUnmount() {
- NetInfo.isConnected.removeEventListener('connectionChange', this.handleConnectivityChange);
- }
+ if (this.props.logged) {
+ return ;
+ }
+ return (
+
+
+
+
- _keyboardDidShow() {
- //alert('Keyboard Shown');
- // this.setState({push:0})
+
+
+
+ {
-
- // this.setState({ isModalVisible: !this.state.isModalVisible });
- // this.props.login(e.data, 'f8908cc0');
- this.props.closeLoginQRScan();
- this.setState({username: e.data})
-
- console.log("QR code lido");
-
-
- };
-
- render() {
- if (!this.state.isConnected) {
- return (
-
- cenas da vida
+ justifyContent: "center",
+ alignItems: "center"
+ }}
+ >
+
+
+
+
+ {
+ this.setState({ searchString });
+ }}
+ maxLength={15}
+ underlineColorAndroid="transparent"
+ />
+
+
+
+ Scan QR
- );
- }
- if (!this.props.logged && this.props.onHold) {
+
+
-
- return (
-
-
-
-
- )
-
- }
- else {
-
- // console.log('token... '+ this.props.logged)
-
- //se existir token
-
- if (this.props.logged) {
-
- return (
-
-
- )
+ this.setState({ text })}
+ clearButtonMode="always"
+ value={this.state.text}
+ clearTextOnFocus={true}
+ onSubmitEditing={Keyboard.dismiss}
+ placeholder="Password"
+ />
+ { !this.props.loadingLogin &&
+
+ Entrar
+
}
- return (
+ {this.props.alignItems &&
+
+ }
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {
- this.setState({searchString})
- }}
- maxLength={15}
- underlineColorAndroid="transparent"
- />
-
-
-
-
-
- Scan QR
-
-
-
-
-
-
- this.setState({text})}
- clearButtonMode='always'
- value={this.state.text}
- clearTextOnFocus={true}
- onSubmitEditing={Keyboard.dismiss}
- placeholder='Password'/>
-
- Entrar
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Não sabes a password?
-
-
-
- Recuperar Password
-
-
-
-
-
-
-
-
-
- );
-
- }
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Não sabes a password?
+
+
+
+ Recuperar Password
+
+
+
+
+
+
+ );
}
+ }
}
+RkTheme.setType("RkButton", "dark", {
+ container: {
+ paddingTop: 10,
+ backgroundColor: "gray",
-RkTheme.setType('RkButton', 'dark', {
- container: {
- paddingTop: 10,
- backgroundColor: 'gray',
-
- borderRadius: 90,
- }
+ borderRadius: 90
+ }
});
-
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 = {
- cameraContainer: {
- // height: Dimensions.get('window').height ,
- },
- passwordInput: {
- borderRadius: 90,
+ cameraContainer: {
+ // height: Dimensions.get('window').height ,
+ },
+ passwordInput: {
+ borderRadius: 90,
- borderColor: '#bfbdbd',
- borderWidth: 1,
- marginTop: 20,
- marginBottom: 20,
- width: SCREEN_WIDTH * 0.8,
+ borderColor: "#bfbdbd",
+ borderWidth: 1,
+ marginTop: 20,
+ marginBottom: 20,
+ width: SCREEN_WIDTH * 0.8,
- backgroundColor: 'white',
+ backgroundColor: "white",
- borderRadius: 90,
- height: SCREEN_HEIGHT * 0.08,
- borderColor: '#bfbdbd',
- borderWidth: 1,
- paddingLeft: SCREEN_WIDTH * 0.05,
+ borderRadius: 90,
+ height: SCREEN_HEIGHT * 0.08,
+ borderColor: "#bfbdbd",
+ borderWidth: 1,
+ paddingLeft: SCREEN_WIDTH * 0.05
+ },
+ scanQRText: {
+ paddingTop: 50
+ // paddingTop:20,
+ },
+ scanQR: {
+ //flexDirection: 'row',
+ paddingTop: 5,
+ backgroundColor: 10,
- },
- scanQRText: {
+ width: 80,
+ paddingLeft: 10,
+ backgroundColor: "#f24b4b",
+ borderBottomRightRadius: 90,
+ borderTopRightRadius: 90,
+ height: "100%"
+ },
+ inputSection: {
+ flexDirection: "row",
+ backgroundColor: "#fff",
- paddingTop: 50
- // paddingTop:20,
+ backgroundColor: "white",
+ borderRadius: 90,
+ height: SCREEN_HEIGHT * 0.08,
+ borderColor: "#bfbdbd",
+ borderWidth: 1
+ },
+ searchIcon: {
+ paddingLeft: 10
+ },
- },
- scanQR: {
+ input: {
+ flex: 1,
+ paddingRight: 10,
- //flexDirection: 'row',
- paddingTop: 5,
- backgroundColor: 10,
+ 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%"
+ },
- width: 80,
- paddingLeft: 10,
- backgroundColor: '#f24b4b',
- borderBottomRightRadius: 90,
- borderTopRightRadius: 90,
- height: '100%',
+ 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: {},
- },
- inputSection: {
+ buttons: {
+ flexDirection: "row",
+ marginBottom: 24,
+ marginHorizontal: 24,
+ marginTop: 24,
+ justifyContent: "space-around"
+ },
- flexDirection: 'row',
- backgroundColor: '#fff',
+ logoContainer: {
+ width: "100%",
- backgroundColor: 'white',
+ justifyContent: "center",
+ alignItems: "center",
+ marginTop: 200
+ },
- borderRadius: 90,
- height: SCREEN_HEIGHT * 0.08,
- borderColor: '#bfbdbd',
- borderWidth: 1,
+ 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"
+ },
- },
- searchIcon: {
- paddingLeft: 10
- },
+ rectangle: {
+ height: rectDimensions,
+ 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,
- paddingRight: 10,
-
-
- 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
- },
+ leftAndRightOverlay: {
+ height: rectDimensions,
+ width: SCREEN_WIDTH,
+ backgroundColor: overlayColor
+ }
};
-RkTheme.setType('RkTextInput', 'frame', {
- input: {
- backgroundColor: 'white',
- marginLeft: 0,
- marginHorizontal: 0,
- borderRadius: 5
- },
- color: 'gray',
- backgroundColor: 'gray',
- borderRadius: 10,
- container: {
- paddingHorizontal: 20
- }
+RkTheme.setType("RkTextInput", "frame", {
+ input: {
+ backgroundColor: "white",
+ marginLeft: 0,
+ marginHorizontal: 0,
+ borderRadius: 5
+ },
+ color: "gray",
+ backgroundColor: "gray",
+ borderRadius: 10,
+ container: {
+ paddingHorizontal: 20
+ }
});
mapStateToProps = (state, props) => {
-
- return {
- token: state.apiReducer.token,
- loggedIn: state.apiReducer.loggedIn,
- onHold: state.apiReducer.onHold,
- logged: state.apiReducer.logged,
- failedAttempt: state.apiReducer.failedAttempt,
- UI_loginScannerActive: state.uiReducer.UI_loginScannerActive,
- userDetails: state.apiReducer.userDetails,
- }
+ return {
+ token: state.apiReducer.token,
+ loggedIn: state.apiReducer.loggedIn,
+ onHold: state.apiReducer.onHold,
+ logged: state.apiReducer.logged,
+ failedAttempt: state.apiReducer.failedAttempt,
+ UI_loginScannerActive: state.uiReducer.UI_loginScannerActive,
+ userDetails: state.apiReducer.userDetails,
+ modalOpen: state.apiReducer.modalOpen,
+ modalInfo: state.apiReducer.modalInfo,
+ type: state.apiReducer.type,
+ loadingLogin:state.apiReducer.loadingLogin
+ };
};
-mapDispatchToProps = (dispatch) => {
-
- return bindActionCreators(Actions, dispatch);
+mapDispatchToProps = dispatch => {
+ return bindActionCreators(Actions, dispatch);
};
-
-export default connect(mapStateToProps, mapDispatchToProps)(App);
\ No newline at end of file
+export default connect(
+ mapStateToProps,
+ mapDispatchToProps
+)(App);
diff --git a/App/app/assets/53060147_934731486858214_2889790267471167488_o.jpg b/App/app/assets/53060147_934731486858214_2889790267471167488_o.jpg
new file mode 100644
index 00000000..effc11c7
Binary files /dev/null and b/App/app/assets/53060147_934731486858214_2889790267471167488_o.jpg differ
diff --git a/App/app/assets/altice.png b/App/app/assets/altice.png
new file mode 100644
index 00000000..17bdf0de
Binary files /dev/null and b/App/app/assets/altice.png differ
diff --git a/App/app/assets/altice_logo.png b/App/app/assets/altice_logo.png
new file mode 100644
index 00000000..cde50fb0
Binary files /dev/null and b/App/app/assets/altice_logo.png differ
diff --git a/App/app/assets/img/logos/logo_ubiwhere_full_rgb_blue (1).png b/App/app/assets/img/logos/ubiwhere.png
similarity index 100%
rename from App/app/assets/img/logos/logo_ubiwhere_full_rgb_blue (1).png
rename to App/app/assets/img/logos/ubiwhere.png
diff --git a/App/app/screens/Calendar.js b/App/app/screens/Calendar.js
index 02c8a0fe..b68a44a0 100644
--- a/App/app/screens/Calendar.js
+++ b/App/app/screens/Calendar.js
@@ -1,397 +1,415 @@
-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 * as React from "react";
import {
- RkButton, RkCard, RkText,
- RkTheme
-} from 'react-native-ui-kitten';
-import Timeline from 'react-native-timeline-feed'
+ View,
+ StyleSheet,
+ Dimensions,
+ Image,
+ ScrollView,
+ Text,
+ Button,
+ TouchableOpacity,
+ 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) => {
-
- let a = {};
-
- a.push({});
-
- return a
-
+ return a;
};
-
-const ThirdRoute = () => (
-
-);
-
-
-const FourthRoute = () => (
-
-);
-
-
class Calendar extends React.Component {
-
- state = {
- index: 0,
- routes: [
- {key: 'first', weekDay: 'sex', day:12},
- {key: 'second', weekDay: 'sab', day:13},
- {key: 'third', weekDay: 'dom', day:14},
- {key: 'fourth', weekDay: 'seg', day:15},
+ state = {
+ index: 0,
+ routes: [
+ { key: "first", weekDay: "sex", day: 12 },
+ { key: "second", weekDay: "sab", day: 13 },
+ { key: "third", weekDay: "dom", day: 14 },
+ { 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);
- console.log('didMount');
- console.log(this.props.events);
- }
+ _openDetails = () => {
+ console.log("los");
+ };
- _openDetails=()=>{
-
- console.log("los");
- }
-
- renderDetail = ({item, index}) => {
- const {navigate} = this.props.navigation;
- //
- return (
- navigate('calendarDetail', { info: item })} >
-
-
-
- {item.name}
- Local: 1
-
-
-
-
-
- {item.description}
-
-
- {item.Enrolled} / {item.MaxAttendees}
-
-
-
-
-
-
- );
- }
-
-
-
- _update = () => {
- this.setState({user: this.props.user});
- console.log(this.props.events);
- }
-
-
- _renderTabBar = props => {
- const inputRange = props.navigationState.routes.map((x, i) => i);
-
- return (
-
- {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 (
- this.setState({ index: i })}>
-
- {route.weekDay}
- {route.day}
-
-
- );
- })}
+ renderDetail = ({ item, index }) => {
+ const { navigate } = this.props.navigation;
+ //
+ return (
+ navigate("calendarDetail", { info: item })}
+ >
+
+
+ {item.name}
+ Local: 1
- );
- };
-
- constructor() {
-
- super();
-
- const archeryImgSource = require('../assets/img/archery.png');
- const badmintonImgSource = require('../assets/img/badminton.png');
- const lunchImgSource = require('../assets/img/lunch.png');
- const soccerImgSource = require('../assets/img/soccer.png');
- const dumbbellImgSource = require('../assets/img/dumbbell.png');
-
- const ArcheryImage = (props) => ;
- const BadmintonImage = (props) => ;
- const LunchImage = (props) => ;
- const SoccerImage = (props) => ;
- const DumbbellImage = (props) => ;
- const VectorIconImage = (props) => ;
-
- this.data = [
-
-
-
- ]
- }
-
- render() {
-
- const FirstRoute = () => (
-
-
-
- index.toString()}
-
-
- />
-
-
-
-
- );
- const SecondRoute = () => (
-
-
-
- index.toString()}
-
-
- />
-
-
-
-
- )
-
-
- return (
-
-
-
- WEB DEVELOPMENT
-
-
- this.setState({index})}
- initialLayout={{width: Dimensions.get('window').width, height: Dimensions.get('window').height}}
- style={{backgroundColor:"#F2F2F2"}}
- indicatorStyle={{ backgroundColor: 'pink' }}
- />
+
+ {item.description}
+
+
+
+ {item.Enrolled} / {item.MaxAttendees}
+
- );
- }
+
+
+
+ );
+ };
+
+ _update = () => {
+ this.setState({ user: this.props.user });
+ console.log(this.props.events);
+ };
+
+ _renderTabBar = props => {
+ const inputRange = props.navigationState.routes.map((x, i) => i);
+
+ return (
+
+ {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 (
+ this.setState({ index: i })}
+ >
+
+ {route.weekDay}
+
+
+ {route.day}
+
+
+ );
+ })}
+
+ );
+ };
+
+ constructor() {
+ super();
+ }
+
+ render() {
+ const ThirdRoute = () => (
+
+ {this.props.events != undefined && (
+ index.toString()}
+ />
+ )}
+
+ );
+
+ const FourthRoute = () => (
+
+ {this.props.events != undefined && (
+ index.toString()}
+ />
+ )}
+
+ );
+ const FirstRoute = () => (
+
+ {this.props.events != undefined && (
+ index.toString()}
+ />
+ )}
+
+ );
+ const SecondRoute = () => (
+
+ {this.props.events != undefined && (
+ index.toString()}
+ />
+ )}
+
+ );
+
+ return (
+
+
+ {this.props.careerPath != undefined && (
+
+ {this.props.careerPath.name}
+
+ )}
+
+ this.setState({ index })}
+ initialLayout={{
+ width: Dimensions.get("window").width,
+ height: Dimensions.get("window").height
+ }}
+ style={{ backgroundColor: "#F2F2F2" }}
+ indicatorStyle={{ backgroundColor: "pink" }}
+ />
+
+ );
+ }
}
const styles = StyleSheet.create({
- tabBar: {
- flexDirection: 'row',
- paddingTop:0,
- marginTop:0,
- backgroundColor:'white',
- borderWidth: 1,
- borderRadius: 2,
- borderColor: '#ddd',
- borderBottomWidth: 0,
- shadowColor: '#000',
- shadowOffset: { width: 0, height: 2 },
- shadowOpacity: 0.8,
- shadowRadius: 2,
- elevation: 2,
-
-
- },
- tabItem: {
- flex: 1,
- alignItems: 'center',
- padding: 10,
- },
- details: {
- backgroundColor: "#FFFFFF",
- borderBottomRightRadius: 10,
- borderBottomLeftRadius: 10,
- padding: 10,
- paddingTop:0
-
- },
- description: {
- padding: 10,
- paddingLeft:0,
- paddingTop:0
-
- },
- title: {
- color: '#212121',
- fontWeight: 'bold',
- fontSize: 15,
-
- },
- titleContainer:{
- padding: 10
- },
- event: {
- borderRadius: 5,
- backgroundColor: "#FFFFFF",
- marginLeft:-25,
+ tabBar: {
+ flexDirection: "row",
+ paddingTop: 0,
+ marginTop: 0,
+ backgroundColor: "white",
+ borderWidth: 1,
+ borderRadius: 2,
+ borderColor: "#ddd",
+ borderBottomWidth: 0,
+ shadowColor: "#000",
+ shadowOffset: { width: 0, height: 2 },
+ shadowOpacity: 0.8,
+ shadowRadius: 2,
+ elevation: 2
+ },
+ tabItem: {
+ flex: 1,
+ alignItems: "center",
+ padding: 10
+ },
+ details: {
+ backgroundColor: "#FFFFFF",
+ borderBottomRightRadius: 10,
+ borderBottomLeftRadius: 10,
+ padding: 10,
+ paddingTop: 0
+ },
+ description: {
+ padding: 10,
+ paddingLeft: 0,
+ paddingTop: 0
+ },
+ title: {
+ color: "#212121",
+ fontWeight: "bold",
+ fontSize: 15
+ },
+ titleContainer: {
+ padding: 10
+ },
+ event: {
+ borderRadius: 5,
+ backgroundColor: "#FFFFFF",
+ marginLeft: -25,
- shadowColor: "#000",
- shadowOffset: { width: 0, height: 2,},
- shadowOpacity: 0.25,
- shadowRadius: 1,
- elevation: 2,
- marginRight:2
-
-
- },
- scene: {
- flex: 1,
- },
- contentContainer: {
- //paddingVertical: 20,
- backgroundColor:'#F2F2F2'
- }
+ shadowColor: "#000",
+ shadowOffset: { width: 0, height: 2 },
+ shadowOpacity: 0.25,
+ shadowRadius: 1,
+ elevation: 2,
+ marginRight: 2
+ },
+ scene: {
+ flex: 1
+ },
+ contentContainer: {
+ //paddingVertical: 20,
+ backgroundColor: "#F2F2F2"
+ }
});
-RkTheme.setType('RkCard', 'story', {
- img: {
- height: 100,
- opacity: 0.7
- },
- header: {
- alignSelf: 'center'
- },
- content: {
- alignSelf: 'center'
- }
+RkTheme.setType("RkCard", "story", {
+ img: {
+ height: 100,
+ opacity: 0.7
+ },
+ header: {
+ alignSelf: "center"
+ },
+ content: {
+ alignSelf: "center"
+ }
});
-
function mapStateToProps(state, props) {
-
- return {
-
- token: state.apiReducer.token,
- user: state.apiReducer.user,
- logged: state.apiReducer.logged,
- events: state.apiReducer.events
-
- }
+ return {
+ token: state.apiReducer.token,
+ user: state.apiReducer.user,
+ logged: state.apiReducer.logged,
+ events: state.apiReducer.events,
+ userDetails: state.apiReducer.userDetails,
+ 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) {
-
- return bindActionCreators(Actions, dispatch);
+ return bindActionCreators(Actions, dispatch);
}
-export default connect(mapStateToProps, mapDispatchToProps)(Calendar);
\ No newline at end of file
+export default connect(
+ mapStateToProps,
+ mapDispatchToProps
+)(Calendar);
diff --git a/App/app/screens/Eventos.js b/App/app/screens/Eventos.js
index 9a7e42a5..043d39c4 100644
--- a/App/app/screens/Eventos.js
+++ b/App/app/screens/Eventos.js
@@ -1,57 +1,47 @@
-import * as React from 'react';
-import {
- View,
- StyleSheet,
- Dimensions,
- Text
-} from 'react-native';
-import { TabView, TabBar, SceneMap } from 'react-native-tab-view';
-
+import * as React from "react";
+import { View, StyleSheet, Dimensions, Text, Button } from "react-native";
+import { TabView, TabBar, SceneMap } from "react-native-tab-view";
const FirstRoute = () => (
-
+
);
const SecondRoute = () => (
-
+
);
-
const ThirdRoute = () => (
-
+
);
const FourthRoute = () => (
-
+
);
-
-
-
-
-export default class Eventos extends React.Component {
-
+export default class Eventos extends React.Component {
state = {
- index: 0,
- routes: [
- { key: 'first', title: 'Festarola' },
- { key: 'second', title: 'Febrada' },
- { key: 'third', title: 'Rally' },
- { key: 'fourth', title: 'Peddy' },
+ index: 0,
+ routes: [
+ { key: "first", title: "Festarola" },
+ { key: "second", title: "Febrada" },
+ { key: "third", title: "Rally" },
+ { key: "fourth", title: "Peddy" }
+ ]
+ };
- ],
-};
-
-render() {
- return (
-
- asd
-
- );
-}
+ render() {
+ return (
+
+
+ );
+ }
}
const styles = StyleSheet.create({
scene: {
- flex: 1,
- },
-});
\ No newline at end of file
+ flex: 1
+ }
+});
diff --git a/App/app/screens/Home.js b/App/app/screens/Home.js
index 95c6f34c..ff426610 100755
--- a/App/app/screens/Home.js
+++ b/App/app/screens/Home.js
@@ -85,7 +85,7 @@ class Home extends Component {
//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);
@@ -184,36 +184,6 @@ _update=()=>{
-
-
-
- {this.props.user.Job}
-
-
-
-
- {this.props.user.Email}
-
-
-
-
- {this.props.user.Mobile}
-
-
-
-
- {this.props.user.Address}, {this.props.user.City}
-
-
-
-
- O meu Curriculo
-
-
-
-
-
-
diff --git a/App/app/screens/Jogo.js b/App/app/screens/Jogo.js
index 3dc5702b..26738857 100644
--- a/App/app/screens/Jogo.js
+++ b/App/app/screens/Jogo.js
@@ -1,12 +1,12 @@
import React from 'react';
-import {
- StyleSheet,
- Text,
- View,
- ImageBackground,
- Dimensions,
- Button,
- TouchableOpacity
+import {
+ StyleSheet,
+ Text,
+ View,
+ ImageBackground,
+ Dimensions,
+ Button,
+ TouchableOpacity
} from 'react-native';
import ProgressBarAnimated from 'react-native-progress-bar-animated';
import Modal from "react-native-modal";
@@ -14,617 +14,709 @@ import Modal from "react-native-modal";
import IconF from "react-native-vector-icons/Foundation"
import IconFA from "react-native-vector-icons/FontAwesome5"
-import {ScrollView} from 'react-native-gesture-handler';
+import { ScrollView, ViewPagerAndroid } from 'react-native-gesture-handler';
const SCREEN_HEIGHT = Dimensions.get("window").height;
const SCREEN_WIDTH = Dimensions.get("window").width;
-
+import FitImage from 'react-native-fit-image';
export default class Jogo extends React.Component {
- state = {
- progress: 20,
- progressWithOnComplete: 0,
- progressCustomized: 0,
- isModalVisible: false,
- };
+state = {
+ progress: 20,
+ progressWithOnComplete: 0,
+ progressCustomized: 0,
+ isModalVisible: false,
+ } ;
increase = (key, value) => {
- this.setState({
- [key]: this.state[key] + value,
- });
- }
+ this.setState({
+ [key]: this.state[key] + value,
+ });
+ }
- _toggleModal = () => {
- this.setState({isModalVisible: !this.state.isModalVisible});
- console.log("assd")
- }
+ _toggleModal = () =>{
+ this.setState({ isModalVisible: !this.state.isModalVisible });
+ console.log("assd")
+ }
- render() {
-
- const {navigate} = this.props.navigation;
+ render() {
+
+ const { navigate } = this.props.navigation;
- const progressCustomStyles = {
- backgroundColor: 'red',
- borderRadius: 0,
- borderColor: 'orange',
- };
+ const progressCustomStyles = {
+ backgroundColor: 'red',
+ borderRadius: 0,
+ borderColor: 'orange',
+ };
- const barWidth = Dimensions.get('screen').width - 30;
+ const barWidth = Dimensions.get('screen').width - 30;
- return (
+
-
-
-
+
+
+
+
+
+
+
-
- Hello!
-
- Hide me!
-
+
+
-
-
-
-
- Jogo do ENEI'19
-
-
-
-
+
+
+
+
+
+
+ A CRITICAL Software fornece sistemas e serviços de software para segurança e
+aplicações essenciais aos negócios, ajudando a garantir que os clientes atendam aos requisitos mais exigentes de qualidade - padrões de segurança, desempenho e fiabilidade
+
+ website
+
+
+
+
+
+
+
-
-
-
-
- 45
- pontos
-
-
-
-
-
-
+
+
+
+
+
+ Jogo do ENEI'19
+
+
+
+
+
+
+
+
+
+
+ 45
+ pontos
-
-
-
-
-
-
-
- 1
-
- 2
-
-
+
+
-
-
-
-
-
-
-
- 15
-
- 0
-
-
-
-
-
-
-
-
-
-
-
-
- 15
-
- 1
-
-
-
-
-
-
-
- 15
-
- 2
-
-
-
-
-
-
-
-
-
- 15
-
- 3
-
-
-
-
-
-
-
- 15
-
- 4
-
-
-
-
-
-
-
- 15
-
- 5
-
-
-
-
-
-
-
-
-
-
-
- 15
-
- 6
-
-
-
-
-
-
-
-
-
- 15
-
- 7
-
-
-
-
-
-
-
- 15
-
- 8
-
-
-
-
-
-
-
-
- 15
-
- 9
-
-
-
-
-
-
-
-
- 15
-
- 10
-
-
-
-
-
-
-
-
- 15
-
- 11
-
-
-
-
-
-
-
-
-
-
-
-
- 15
-
- 12
-
-
-
-
-
-
-
-
-
- 15
-
- 13
-
-
-
-
-
-
-
- 15
-
- 14
-
-
-
-
-
-
-
-
- 15
-
- 15
-
-
-
-
-
-
-
-
- 15
-
- 16
-
-
-
-
-
-
-
-
- 15
-
- 17
-
-
-
-
-
-
-
-
-
-
-
-
- 15
-
- 18
-
-
-
-
-
-
-
-
- 15
-
- 19
-
-
-
-
-
-
-
- 15
-
- 20
-
-
-
-
-
-
-
-
- 15
-
- 21
-
-
-
-
-
-
-
-
- 15
-
- 22
-
-
-
-
-
-
-
-
- 15
-
- 23
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+ 2
+
+
+
+
+
+
- );
+
+
- }
+
+
+
+
+ 15
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 15
+
+ 1
+
+
+
+
+
+
+
+
+ 15
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+ 15
+
+ 3
+
+
+
+
+
+
+
+
+ 15
+
+ 4
+
+
+
+
+
+
+
+
+ 15
+
+ 5
+
+
+
+
+
+
+
+
+
+
+
+
+ 15
+
+ 6
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 15
+
+ 7
+
+
+
+
+
+
+
+
+ 15
+
+ 8
+
+
+
+
+
+
+
+
+
+ 15
+
+ 9
+
+
+
+
+
+
+
+
+
+ 15
+
+ 10
+
+
+
+
+
+
+
+
+
+ 15
+
+ 11
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 15
+
+ 12
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 15
+
+ 13
+
+
+
+
+
+
+
+
+ 15
+
+ 14
+
+
+
+
+
+
+
+
+
+ 15
+
+ 15
+
+
+
+
+
+
+
+
+
+ 15
+
+ 16
+
+
+
+
+
+
+
+
+
+ 15
+
+ 17
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 15
+
+ 18
+
+
+
+
+
+
+
+
+ 15
+
+ 19
+
+
+
+
+
+
+
+
+ 15
+
+ 20
+
+
+
+
+
+
+
+
+
+ 15
+
+ 21
+
+
+
+
+
+
+
+
+
+ 15
+
+ 22
+
+
+
+
+
+
+
+
+
+ 15
+
+ 23
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+
+ }
}
const styles = StyleSheet.create({
- points: {
- marginTop: -25,
- marginLeft: 10,
- fontWeight: 'bold',
- color: '#CC1A17'
+
+ fitImage:{
+
+
+ },
+ points:{
+ marginTop:-25,
+ marginLeft:10,
+ fontWeight:'bold',
+ color:'#CC1A17'
},
- cromosContainer: {
- flex: 1,
- flexDirection: 'row',
- flexWrap: 'wrap',
+ cromosContainer:{
+ flex:1,
+ flexDirection:'row',
+ flexWrap: 'wrap',
justifyContent: 'space-around',
- marginLeft: 10,
- marginRight: 10,
+ marginLeft:10,
+ marginRight:10,
},
cromo:
{
- backgroundColor: 'white',
- margin: 3,
- height: 200,
- width: 130,
- borderRadius: 0
- }
+ backgroundColor:'white',
+ margin:3,
+ height:200,
+ width:130,
+ borderRadius:0}
,
- imageBg: {
+ imageBg:{
+
+ height:190,
+ margin:5
+ },
+ label:{
+ margin:10
+ },
+ progress:{
+ backgroundColor:'#eeeeee',
+ shadowColor:'#000',
+ shadowOffset:{width:0, height:2},
+ shadowRadius:1,
+ elevation:1,
+ },
+ title:{
+ fontWeight:'bold',
+ fontSize:25,
+ color:'white',
+ textAlign:'center'
+
+ },
+ titleContainer:{
+
+ margin:10,
+ },
+ header:{
+ backgroundColor:'#CC2A17',
- height: '97%',
- margin: 5
- },
- label: {
- margin: 10
- },
- progress: {
- backgroundColor: '#eeeeee',
- shadowColor: '#000',
- shadowOffset: {width: 0, height: 2},
- shadowRadius: 1,
- elevation: 1,
- },
- title: {
- fontWeight: 'bold',
- fontSize: 25,
- color: 'white',
- textAlign: 'center'
-
- },
- titleContainer: {
-
- margin: 10,
- },
- header: {
- backgroundColor: '#CC2A17',
-
- //alignItems:'center',
- shadowColor: '#000',
- shadowOffset: {width: 0, height: 2},
- shadowRadius: 1,
- elevation: 5,
-
- },
- container: {
- flex: 1,
- backgroundColor: '#eeeeee',
- // alignItems: 'center',
- //justifyContent: 'space-around',
- },
- triangle: {
- width: 0,
- height: 0,
- backgroundColor: 'transparent',
- borderStyle: 'solid',
- borderLeftWidth: 67,
- borderRightWidth: 0,
- borderBottomWidth: 20,
- transform: [{rotate: '180deg'}],
- borderLeftColor: 'transparent',
- borderRightColor: 'transparent',
- borderBottomColor: 'white'
- },
- triangleNumber: {
- width: 0,
- height: 0,
- backgroundColor: 'transparent',
- borderStyle: 'solid',
- borderLeftWidth: 67,
- borderRightWidth: 0,
- borderBottomWidth: 20,
- transform: [{rotate: '0deg'}],
- borderLeftColor: 'transparent',
- borderRightColor: 'transparent',
- borderBottomColor: 'white',
- marginLeft: 54,
- marginTop: 155
- },
- number: {
- marginTop: -18,
- marginLeft: 103,
- textAlign: 'center'
- }
+ //alignItems:'center',
+ shadowColor:'#000',
+ shadowOffset:{width:0, height:2},
+ shadowRadius:1,
+ elevation:5,
+
+ },
+ container: {
+ flex: 1,
+ backgroundColor: '#eeeeee',
+ // alignItems: 'center',
+ //justifyContent: 'space-around',
+ },
+ triangle: {
+ width: 0,
+ height: 0,
+ backgroundColor: 'transparent',
+ borderStyle: 'solid',
+ borderLeftWidth:67,
+ borderRightWidth: 0,
+ borderBottomWidth: 20,
+ transform: [{ rotate: '180deg'}],
+ borderLeftColor: 'transparent',
+ borderRightColor: 'transparent',
+ borderBottomColor: 'white'
+ },
+ triangleNumber: {
+ width: 0,
+ height: 0,
+ backgroundColor: 'transparent',
+ borderStyle: 'solid',
+ borderLeftWidth:67,
+ borderRightWidth: 0,
+ borderBottomWidth: 20,
+ transform: [{ rotate: '0deg'}],
+ borderLeftColor: 'transparent',
+ borderRightColor: 'transparent',
+ borderBottomColor: 'white',
+ marginLeft:54,
+ marginTop:156
+ },
+ number:{
+ marginTop:-18,
+ marginLeft:103,
+ textAlign: 'center'
+ }
});
\ No newline at end of file
diff --git a/App/app/screens/Profile.js b/App/app/screens/Profile.js
index 51e16d04..dde2531f 100644
--- a/App/app/screens/Profile.js
+++ b/App/app/screens/Profile.js
@@ -45,6 +45,8 @@ class Profile extends Component {
super(props);
this.state = {
+ name:this.props.user.Name,
+ userDetails:{},
token: false,
tokenData: '',
loggedIn: false,
@@ -56,7 +58,7 @@ class Profile extends Component {
formValid: true,
- jobs: this.props.user.Job,
+ jobs: this.props.user.Company,
jobsError: false,
jobsErrorMessage: '',
@@ -68,7 +70,7 @@ class Profile extends Component {
phoneError: false,
phoneErrorMessage: '',
- address: this.props.user.Adress,
+ address: this.props.user.Address,
addressError: false,
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;
+ v = Validate('name',name );
+
+
let v = Validate('email', email);
this.setState({emailError: v[0], emailErrorMessage: v[1]});
@@ -133,14 +138,31 @@ class Profile extends Component {
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);
- if (formValid)
+ if (formValid){
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
console.log("data not valid");
@@ -158,11 +180,21 @@ class Profile extends Component {
this.saveData()}>
-
+ Save
+
+
+
+ {
+ this.setState({name:n })
+ }}
+ value={this.state.name}/>
+
+
@@ -174,17 +206,7 @@ class Profile extends Component {
-
-
-
- {
- this.setState({email: email})
- }}
- value={this.state.email}/>
-
-
-
+
@@ -339,7 +361,8 @@ mapStateToProps = (state, props) => {
return {
token: state.apiReducer.token,
- user: state.apiReducer.user
+ user: state.apiReducer.user,
+ userDetails: state.apiReducer.userDetails,
}
};
diff --git a/App/app/screens/choosePath.js b/App/app/screens/choosePath.js
index e610d2aa..ce320784 100644
--- a/App/app/screens/choosePath.js
+++ b/App/app/screens/choosePath.js
@@ -1,377 +1,508 @@
-import * as React from 'react';
+import * as React from "react";
import {
- View,
- StyleSheet,
- Dimensions,
- Image,
- ScrollView,
- Text,
- Button,
- TouchableOpacity,
- Picker,
- CheckBox,
- ActivityIndicator,
- SectionList,
- FlatList
- } from 'react-native';
+ View,
+ StyleSheet,
+ Dimensions,
+ ScrollView,
+ Text,
+ Button,
+ TouchableOpacity,
+ Picker,
+ ActivityIndicator,
+
+ FlatList
+} from "react-native";
+import moment from "moment";
-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 Modal from "react-native-modal";
-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_WIDTH = Dimensions.get("window").width;
-import FitImage from 'react-native-fit-image';
-import { Dropdown } from 'react-native-material-dropdown';
-import {Card, Divider} from 'react-native-elements'
-import IconF from "react-native-vector-icons/Foundation"
+import FitImage from "react-native-fit-image";
-
-const formatObj = (obj) => {
-
- let a = {};
-
- a.push({})
-
- return a
-
-};
+import { Divider } from "react-native-elements";
+import LinearGradient from "react-native-linear-gradient";
+
+import IconFA from "react-native-vector-icons/FontAwesome5";
-
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 }) => ({
-
- headerTitleStyle : {textAlign: 'center',alignSelf:'center'},
- headerStyle:{
- backgroundColor:'rgba(0,0,0,0)',
- shadowRadius:0,
- elevation:0
- },
- });
+ state = {
+ calendar: {},
+ guest: "9"
+ };
- state = {
- calendar:{}
+ _mount = () => {
+ 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);
- this.props.getAvailableGuestlists(this.props.userDetails.token)
- console.log('didMount');
- console.log(this.props.events);
- }
+ _s() {
+
+ this.props.signSession(this.props.userDetails.token, item[index].Id);
+ }
+ getCareerPaths = () => {
+ this.props.getAvailableGuestlists(this.props.userDetails.token);
+ console.log(this.props.calendar);
+ };
+ _keyExtractor = (item, index) => item.id;
+ _renderItem = ({ item }) => (
+
+ );
+ _toggleModal = () =>
+ this.setState({ isModalVisible: !this.state.isModalVisible });
- _update = () => {
- this.setState({user: this.props.user});
- console.log(this.props.events);
- }
+
+ _onPressItem = id => {
+ // 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 }) => {
+ Cenas: {item.Name};
+ };
- constructor() {
+ render() {
+ return (
+
+
+
- super()
-
-
-
- this.data = [
-
-
-
- ]
- }
- getCareerPaths=()=>{
-
- this.props.getAvailableGuestlists(this.props.userDetails.token)
- console.log(this.props.calendar)
- }
- _keyExtractor = (item, index) => item.id;
-
- _renderItem = ({item}) => (
-
- );
- _onPressItem = (id) => {
- // 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() {
-
-
- return (
-
-
-
-
-
-
-
-
-
-
- {
- this.setState({guest: itemValue})
- this.props.waitChangeGuest();
- this.props.changeGuestList(this.props.userDetails.token,itemValue)
- this.props.waitChangeGuest();
- this.props.getAvailableSessions(this.props.userDetails.token);
-
-
- }
-
- }>
-
-
-
-
-
-
-
-
-
- (
-
+ {this._findPath("IA") && (
+
+
+ {" "}
+ Empresa responsável:{" "}
+
+
+
+
+ Critical Software
+
+
+ A CRITICAL Software fornece sistemas e serviços de software
+ para segurança e aplicações essenciais aos negócios.
+
+
+
+
+
+
+
+ )}
+ {this._findPath("NET") && (
+
+
+ {" "}
+ Empresa responsável:{" "}
+
+
+
+
+ Altice
+
+
+ Altice é uma multinacional neerlandesa de telecomunicações,
+ conteúdos, media, entretenimento e publicidade.
+
+
+
+
+
+
+
)}
- keyExtractor={item => item.email}
- />
-
- { !this.props.changingGuest &&
-
-
-
-
-
- 9:00
- até
-
- 9:30
-
-
-
-
+
+
+ {
+ this.setState({ guest: itemValue });
+ this.props.timerChangeGuest();
+ this.props.waitChangeGuest();
+ 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)
+ }}
+ >
+
+
+
+
+
+
+
+
+
+
+
+ {!this.props.changingGuest && (
+ (
+
+
+
+ {moment(item[0].SessionStart).format("HH:mm")}
+
+ às
+
+ {moment(item[0].SessionEnd).format("HH:mm")}
+
+
+
+ (
+
+ {this._verifySession(item[index].Id) && (
+ {}}
+ style={{ flex: 1, alignSelf: "center" }}
+ >
+
+
+
+
+ )}
+ {!this._verifySession(item[index].Id) && (
+ {
+ this.props.waitChangeGuest()
+ this.props.signSession(
+ this.props.userDetails.token,
+ item[index].Id
+ );
+ }}
+ style={{ flex: 1, alignSelf: "center" }}
+ >
+
+
+
+
+ )}
- this.setState({ checkbox1: !this.state.checkbox1 })}
- />
-
- Nome da palestra
- 12 Lugares disponíveis
-
-
-
-
-
+
+ this.props.navigation.navigate("febrada")
+ }
+ >
+
+
+ {item[index].Name}
+
+
+ {item[index].MaxAttendees -
+ item[index].Enrolled}{" "}
+ Lugares disponíveis
+
+
+
+
-
-
-
-
- this.setState({ checkbox1: !this.state.checkbox1 })}
-/>
-
- Nome da palestra
- 12 Lugares disponíveis
-
-
-
-
-
-
-
-
-
-
-
- this.setState({ checkbox1: !this.state.checkbox1 })}
-/>
-
- Nome da palestra
- 12 Lugares disponíveis
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ )}
+ />
- }
- {this.props.changingGuest &&
+
+ )}
+ />
+ )}
+
+
-
- }
-
-
-
-
- );
- }
-
+ {(this.props.changingGuest || this.props.Blocks == true) && (
+
+ )}
+
+
+ );
+ }
}
const styles = StyleSheet.create({
- sessionInfo:{
- margin:5
- },
- sessionTitle:{
- fontSize:15,
- fontWeight:'bold'
- },
- day:{
- margin:10
- },
- dayText:{
- fontSize:20,
- color: '#CC1A17',
- textAlign: 'center',
-
- },
- time:{
- alignContent:'center',
- width:SCREEN_WIDTH*0.20,
- backgroundColor:'white'
- },
-
- block:{
-
- flex:1,
- flexDirection:'row',
- backgroundColor:'red',
- margin:10,
- borderRadius:5
-
- },
-
- companyContainer:{
- flex:1,
- backgroundColor:'blue',
- height:SCREEN_HEIGHT*0.25,
-
+ companyLogo: {
+ backgroundColor: "white",
+ margin: 20,
+ width: SCREEN_WIDTH * 0.35,
+ borderRadius: 3,
+ padding: 5
+ },
+ companyDescription: {
+ // backgroundColor:'white',
+ margin: 20,
+ marginRight: 0,
+ width: SCREEN_WIDTH * 0.5,
+ borderRadius: 3
+ },
+ sessionInfo: {
+ margin: 5
+ },
+ sessionTitle: {
+ fontSize: 15,
+ fontWeight: "bold"
+ },
+ day: {
+ margin: 10
+ },
+ dayText: {
+ fontSize: 20,
+ color: "#CC1A17",
+ textAlign: "center"
+ },
+ time: {
+ alignContent: "center",
+ width: SCREEN_WIDTH * 0.23,
+ backgroundColor: "white"
},
-
- sessions:{
- flex:1,
- flexDirection:'column',
-
- backgroundColor:'white',
-
+ block: {
+ flex: 1,
+ flexDirection: "row",
+ backgroundColor: "red",
+ margin: 10,
+ borderRadius: 5
},
- page:{
- backgroundColor:'#eeeeee',
-
- },
- pickerCareer:{
-
- paddingLeft:30,
- paddingRight:30,
- backgroundColor:'white',
- width:SCREEN_WIDTH,
+ companyContainer: {
+ flex: 1,
+ // backgroundColor:'blue',
+ flexDirection: "row",
+ marginTop: 0
},
- session:{
- margin:10,
- flex:1,
- flexDirection:'row',
-
+
+ sessions: {
+ flex: 1,
+ 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) {
-
- return {
-
- // token: state.apiReducer.token,
- user: state.apiReducer.user,
- logged: state.apiReducer.logged,
- events: state.apiReducer.events,
- userDetails: state.apiReducer.userDetails,
- calendar : state.apiReducer.calendar,
- changingGuest : state.apiReducer.changingGuest,
- sessions:state.apiReducer.sessions,
-
-
- }
+ return {
+ // token: state.apiReducer.token,
+ showAlert: state.apiReducer.showAlert,
+ user: state.apiReducer.user,
+ logged: state.apiReducer.logged,
+ events: state.apiReducer.events,
+ userDetails: state.apiReducer.userDetails,
+ calendar: state.apiReducer.calendar,
+ changingGuest: state.apiReducer.changingGuest,
+ sessions: state.apiReducer.sessions,
+ Blocks: state.apiReducer.Blocks,
+ showAlert: state.apiReducer.showAlert
+ };
}
function mapDispatchToProps(dispatch) {
-
- return bindActionCreators(Actions, dispatch);
+ return bindActionCreators(Actions, dispatch);
}
-export default connect(mapStateToProps, mapDispatchToProps)(choosePath);
\ No newline at end of file
+export default connect(
+ mapStateToProps,
+ mapDispatchToProps
+)(choosePath);
diff --git a/App/app/store/actions/actionTypes.js b/App/app/store/actions/actionTypes.js
index a4a0036c..e2e128e8 100644
--- a/App/app/store/actions/actionTypes.js
+++ b/App/app/store/actions/actionTypes.js
@@ -31,4 +31,7 @@ export const UI_LOGIN_NOINTERNET='UI_LOGIN_NOINTERNET'
export const UI_LOGIN_OPEN_SCANNER='UI_LOIN_OPEN_SCANNER'
-//HOME
\ No newline at end of file
+
+
+export const OPEN_MODAL='OPEN_MODAL'
+export const CLOSE_MODAL='CLOSE_MODAL'
\ No newline at end of file
diff --git a/App/app/store/actions/api.js b/App/app/store/actions/api.js
index 5cf2d326..b5466f1b 100644
--- a/App/app/store/actions/api.js
+++ b/App/app/store/actions/api.js
@@ -1,78 +1,320 @@
-import {AsyncStorage} from 'react-native';
+import { AsyncStorage } from "react-native";
-import {NetInfo} from 'react-native';
+import { NetInfo , Alert} from "react-native";
+var _ = require("lodash");
import {
- DATA_AVAILABLE,
- API_LOGIN,
- CHECK_USER,
- LOGOUT_USER,
- USER_INFO,
- HOLD,
- GET_EVENTS,
- GET_CAREERS,
- GET_SESSIONS,
- CHANGE_GUEST,
- WAIT_CHANGE
-} from "./actionTypes" //Import the actions types constant we defined in our actions
+ TIMERWAIT_CHANGE,
+ SESSION_BLOCKS,
+ DATA_AVAILABLE,
+ API_LOGIN,
+ CHECK_USER,
+ LOGOUT_USER,
+ USER_INFO,
+ HOLD,
+ GET_EVENTS,
+ GET_CAREERS,
+ GET_SESSIONS,
+ CHANGE_GUEST,
+ WAIT_CHANGE,
+ SIGN_SESSION,
+ OPEN_MODAL,
+ LOADINGLOGIN
+} from "./actionTypes"; //Import the actions types constant we defined in our actions
-import moment from 'moment'
+import moment from "moment";
-import {compose} from 'redux';
+import { compose } from "redux";
+import tap from "lodash/fp/tap";
+import flow from "lodash/fp/flow";
+import groupBy from "lodash/fp/groupBy";
+import { colors } from "react-native-elements";
-const axios = require('axios');
+const axios = require("axios");
+
+axios.defaults.baseURL = "http://enei2019.uingress.com/internal/api";
+
+//http://enei2019.uingress.com/internal/api/Attendee/Edit
+
+const map = require("lodash/fp/map").convert({ cap: false });
-export const waitChangeGuest = () => {
- return (dispatch) => {
- dispatch({
- type: WAIT_CHANGE,
- });
- }
+export function waitLogin(){
+ return dispatch=>{
+ dispatch({
+ type: LOADINGLOGIN,
+
+ });
+ }
+}
+
+
+//faz autenticação com API interna
+export function loginInternal(userDetails){
+ axios.defaults.baseURL = "http://127.0.0.1:5000";
+ return dispatch => {
+
+ axios.post('/api/login',{
+ "username": "cena",
+ "password": "password"
+
+ }).then(a=>{
+ console.log("sucesso!")
+ console.log(a)
+ }).catch(p=>{
+ console.log(p)
+ })
+
+ dispatch({
+ type: OPEN_MODAL,
+
+ });
+ };
+
}
-export const connectionState = (status) => {
- console.log(status);
- return {type: 'CHANGE_CONNECTION_STATUS', isConnected: status};
+
+export function openModal(info, t) {
+ return dispatch => {
+ dispatch({
+ type: OPEN_MODAL,
+ modalInfo: info,
+ modalType: t
+ });
+ };
+}
+
+export function closeModal() {
+ return dispatch => {
+ dispatch({
+ type: OPEN_MODAL,
+ modalInfo: info
+ });
+ };
+}
+
+export function updateUser(token, user) {
+ axios.defaults.headers.common = {
+ Authorization: `bearer ${token.access_token}`
+ };
+
+ return dispatch => {
+ axios
+ .post("/Attendee/Edit", user)
+ .then(a => {
+ console.log(a);
+ alert("guardado com sucesso");
+ dispatch({
+ type: UPDATE_USER
+ // guests: response.data
+ });
+ })
+ .catch(b => {
+ alert("Erro a guardar os dados");
+ });
+ };
+}
+function getCareerPath(sessions) {
+ careerPath = "Sem Career Path";
+ careerColor = "white";
+
+ for (let key in sessions) {
+ if (sessions[key].Name == "IA") {
+ careerPath = "Artificial Inteligence";
+ careerColor='#CC1A17'
+ }
+ if (sessions[key].Name == "IOT") {
+ careerPath = "Internet of Things";
+ careerColor= "green"
+ }
+ if (sessions[key].Name == "WEB") {
+ careerPath = "Web Development";
+ careerColor="purple"
+ }
+ if (sessions[key].Name == "NET") {
+ careerPath = "Networking and Security";
+ careerColor="blue"
+ }
+ if (sessions[key].Name == "MOB") {
+ careerPath = "Mobile Development";
+ careerColor="orange"
+ }
+ if(sessions[key].Name=="DS"){
+ careerPath="Data Science"
+ careerColor="yellow"
+ }
+ }
+ return { name: careerPath, color: careerColor };
+}
+export const waitChangeGuest = () => {
+ return dispatch => {
+ dispatch({
+ type: WAIT_CHANGE
+ });
+ };
+};
+export const timerChangeGuest = () => {
+ return dispatch => {
+ dispatch({
+ type: TIMERWAIT_CHANGE
+ });
+ };
};
+export const connectionState = status => {
+ console.log(status);
+ return { type: "CHANGE_CONNECTION_STATUS", isConnected: status };
+};
-///Attendee/AvailableGuestlists
+//inscrição em palestra através de ID
+export function signSession(token, idSession) {
+ axios.defaults.headers.common = {
+ Authorization: `bearer ${token.access_token}`
+ };
+ var obj = {
+ IdSession: idSession,
+ Direction: 0
+ };
-axios.defaults.baseURL = 'http://enei2019.uingress.com/internal/api';
+ return dispatch => {
+ //adiciona participante a uma palestra
+ axios
+ .post("/Session/AddAttendee", obj)
+ //se não existir erro na chamada...
+ .then(a => {
+ if (a.data.Success) {
+ axios
+ .get("/Attendee/AvailableSessions")
-export function getAvailableGuestlists(token) {
+ .then(function(response) {
+ console.log(response);
+ var sessions = response.data;
+ var careerPath = getCareerPath(sessions);
+ var cenas = [];
- axios.defaults.headers.common = {'Authorization': `bearer ${token.access_token}`};
+ const result = flow(groupBy("SessionStart"))(response.data);
- return (dispatch) => {
+ for (let key in result) {
+ result[key].option = 0;
+ cenas.push(result[key]);
+ }
- axios.get('/Attendee/AvailableGuestlists')
- .then(function (response) {
+ alert("Inscrição efectuada com sucesso");
- // handle success
- console.log(response);
- dispatch({
- type: GET_CAREERS,
- guests: response.data
+ //obter informações pessoais:
+ axios
+ .get("/Attendee/Detail")
+ .catch(error => {
+ alert(error);
+ })
+ .then(sucess => {
+ dispatch({
+ type: SIGN_SESSION,
+ sessions: response.data,
+ Blocks: cenas,
+ changeGuestList: false,
+ careerPath: careerPath,
+ user: sucess.data
+ });
});
})
- .catch(function (error) {
- // handle error
- console.log(error);
- })
- .then(function () {
- // always executed
+ .catch(function(error) {
+ alert("Erro a obter sessões disponíveis!!");
+
+ console.log(error);
});
- }
+ } else {
+ alert("Erro a inscrever na palestra");
+ dispatch({
+ type: SIGN_SESSION,
+ waitChangeGuest: false
+ });
+ }
+ })
+ .catch(b => {
+ alert("Erro a inscrever na palestra");
+ });
+ };
}
+export function getSessions(token) {
+ axios.defaults.headers.common = {
+ Authorization: `bearer ${token.access_token}`
+ };
+
+ return dispatch => {
+ axios.defaults.baseURL = "http://enei2019.uingress.com/internal/api";
+
+ axios.defaults.headers.common = {
+ Authorization: `bearer ${token.access_token}`
+ };
+
+ axios
+ .get("/Attendee/AvailableSessions")
+ .then(function(response) {
+ var sessions = response.data;
+
+ var careerPath = getCareerPath(sessions);
+
+ console.log(careerPath);
+
+ var cenas = [];
+
+ const result = flow(
+ groupBy("SessionStart")
+ // map((Id) => ({Id})),
+ //tap(console.log)
+ )(response.data);
+ for (let key in result) {
+ result[key].option = 0;
+ cenas.push(result[key]);
+ }
+ dispatch({
+ type: GET_SESSIONS,
+ sessions: response.data,
+ Blocks: cenas,
+ careerPath: careerPath
+ //guests: response.data
+ });
+ })
+ .catch(function(error) {
+ alert("Error a obter sessões disponíveis!!");
+ console.log(error);
+ });
+ };
+}
+
+export function getAvailableGuestlists(token) {
+ axios.defaults.headers.common = {
+ Authorization: `bearer ${token.access_token}`
+ };
+
+ return dispatch => {
+ axios
+ .get("/Attendee/AvailableGuestlists")
+ .then(function(response) {
+ // handle success
+ console.log(response);
+ dispatch({
+ type: GET_CAREERS,
+ guests: response.data
+ });
+ })
+ .catch(function(error) {
+ // handle error
+ console.log(error);
+ })
+ .then(function() {
+ // always executed
+ });
+ };
+}
/*
8 - group
@@ -85,578 +327,677 @@ export function getAvailableGuestlists(token) {
*/
export function changeGuestList(token, guestID) {
- //http://enei2019.uingress.com/internal/api/Attendee/ChangeGuestlist/
+
+ //http://enei2019.uingress.com/internal/api/Attendee/ChangeGuestlist/
+ axios.defaults.headers.common = {
+ Authorization: `bearer ${token.access_token}`
+ };
- axios.defaults.headers.common = {'Authorization': `bearer ${token.access_token}`}
+ return dispatch => {
+ var full = `/Attendee/ChangeGuestlist/${guestID}`;
+ axios
+ .get(full)
+ .then(function(response) {
+ console.log(response)
+ axios.defaults.baseURL = "http://enei2019.uingress.com/internal/api";
- return (dispatch) => {
+ axios.defaults.headers.common = {
+ Authorization: `bearer ${token.access_token}`
+ };
- let full = `/Attendee/ChangeGuestlist/${guestID}`;
- console.log(full);
- axios.get(full)
- .then(function (response) {
+ axios
+ .get("/Attendee/AvailableSessions")
- // handle success
- console.log(response);
- dispatch({
- type: CHANGE_GUEST,
- //guests: response.data
+ .then(function(response) {
+ // handle success
+ //console.log(response);
- });
- })
- .catch(function (error) {
- // handle error
- console.log(response);
- console.log(error);
- })
- .then(function () {
- // always executed
+ var cenas = [];
+ c= getCareerPath(response.data);
+ const result = flow(
+ groupBy("SessionStart")
+ // map((Id) => ({Id})),
+ //tap(console.log)
+ )(response.data);
+
+ for (let key in result) {
+ result[key].option = 0;
+ cenas.push(result[key]);
+ console.log();
+ }
+ console.log(cenas);
+ dispatch({
+ type: CHANGE_GUEST,
+ sessions: response.data,
+ Blocks: cenas,
+ careerPath: c
+
+ //guests: response.data
});
+ })
+ .catch(function(error) {
+ alert("Error a obter sessões disponíveis!!");
+ console.log(error);
+ });
+ })
+ .catch(function(error) {
+ // handle error
+ console.log(response);
+ console.log(error);
+ alert("Erro a mudar de career path");
+ })
+ .then(function() {
+ // always executed
+ });
+ };
+}
+export function getSessionBlocks(sessions) {
+ var a;
+ var cenas = [];
+
+ const result = flow(
+ groupBy("SessionStart")
+ // map((Id) => ({Id})),
+ //tap(console.log)
+ )(sessions);
+
+ return dispatch => {
+ for (let key in result) {
+ cenas.push(result[key]);
+ console.log();
}
+ console.log(cenas);
+
+ dispatch({
+ type: SESSION_BLOCKS,
+ Blocks: cenas
+ });
+ };
}
export function getAvailableSessions(token) {
- //http://enei2019.uingress.com/internal/api/Attendee/AvailableSessions
+ //http://enei2019.uingress.com/internal/api/Attendee/AvailableSessions
- axios.defaults.baseURL = 'http://enei2019.uingress.com/internal/api'
+ axios.defaults.baseURL = "http://enei2019.uingress.com/internal/api";
- axios.defaults.headers.common = {'Authorization': `bearer ${token.access_token}`}
+ axios.defaults.headers.common = {
+ Authorization: `bearer ${token.access_token}`
+ };
- return (dispatch) => {
+ return dispatch => {
+ axios
+ .get("/Attendee/AvailableSessions")
+ .then(function(response) {
+ // handle success
+ console.log(response);
- axios.get('/Attendee/AvailableSessions')
- .then(function (response) {
-
- // handle success
- console.log(response);
- dispatch({
- type: GET_SESSIONS,
- sessions: response.data
-
- });
- })
- .catch(function (error) {
- // handle error
- console.log(error);
- })
- .then(function () {
- // always executed
- });
- }
-
-}
-
-export function getEvents(user) {
-
- return (dispatch) => {
-
- let events = [];
- console.log("chegou aqui")
-
-
- for (let key in user.Sessions) {
-
- events.push({
- time: moment(user.Sessions[key].SessionStart).format('h:mm'),
- timeEnd: moment(user.Sessions[key].SessionEnd).format('h:mm'),
- //lineColor:'#009688',
- imageUrl: 'https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/Vjkyj2hBg/welcome-white-sign-with-falling-colorful-confetti-animation-on-white-background_sglmmh3qm__F0013.png',
- description: user.Sessions[key].Description,
- name: user.Sessions[key].Name,
- Enrolled: user.Sessions[key].Enrolled,
- MaxAttendees: user.Sessions[key].MaxAttendees
- })
+ var cenas = [];
+ const result = flow(
+ groupBy("SessionStart")
+ // map((Id) => ({Id})),
+ //tap(console.log)
+ )(response.data);
+ for (let key in result) {
+ cenas.push(result[key]);
+ console.log();
}
dispatch({
- type: GET_EVENTS,
- events: events
+ type: GET_SESSIONS,
+ sessions: response.data,
+ Blocks: cenas
});
+ })
+ .catch(function(error) {
+ alert("Error a obter sessões disponíveis!!");
+ console.log(error);
+ });
+ };
+}
+export function getEvents(user) {
+ return dispatch => {
+ let events = [];
+ console.log("chegou aqui");
+var i=0
+ for (let key in user.Sessions) {
+ events.push({
+ key:i++,
+ time: moment(user.Sessions[key].SessionStart).format("HH:mm"),
+ timeEnd: moment(user.Sessions[key].SessionEnd).format("HH:mm"),
+ //lineColor:'#009688',
+ imageUrl:
+ "https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/Vjkyj2hBg/welcome-white-sign-with-falling-colorful-confetti-animation-on-white-background_sglmmh3qm__F0013.png",
+ description: user.Sessions[key].Description,
+ name: user.Sessions[key].Name,
+ Enrolled: user.Sessions[key].Enrolled,
+ MaxAttendees: user.Sessions[key].MaxAttendees,
+ day: moment(user.Sessions[key].SessionStart).format("DD")
+ });
}
+
+
+ const result = flow(
+ groupBy("day")
+
+
+ )(events);
+
+
+ var cenas=[];
+ for (let key in result) {
+ cenas.push(result[key]);
+ console.log();
+ }
+ console.log(".--------")
+ console.log(cenas);
+ console.log(".--------")
+
+ var a=[], b=[],c=[],d=[]
+
+ for (let key in cenas[0]) {
+ a.push({
+ time:cenas[0][key].time ,
+ timeEnd: cenas[0][key].timeEnd,
+ imageUrl:cenas[0][key].imageUrl,
+ description: cenas[0][key].description,
+ name:cenas[0][key].name,
+ Enrolled: cenas[0][key].Enrolled,
+ MaxAttendees: cenas[0][key].MaxAttendees,
+ day: cenas[0][key].day
+ });
+ }
+
+
+
+ for (let key in cenas[1]) {
+ b.push({
+ time:cenas[1][key].time ,
+ timeEnd: cenas[1][key].timeEnd,
+ imageUrl:cenas[1][key].imageUrl,
+ description: cenas[1][key].description,
+ name:cenas[1][key].name,
+ Enrolled: cenas[1][key].Enrolled,
+ MaxAttendees: cenas[1][key].MaxAttendees,
+ day: cenas[1][key].day
+ });
+ }
+ for (let key in cenas[2]) {
+ c.push({
+ time:cenas[2][key].time ,
+ timeEnd: cenas[2][key].timeEnd,
+ imageUrl:cenas[2][key].imageUrl,
+ description: cenas[2][key].description,
+ name:cenas[2][key].name,
+ Enrolled: cenas[2][key].Enrolled,
+ MaxAttendees: cenas[2][key].MaxAttendees,
+ day: cenas[2][key].day
+ });
+ }
+
+ for (let key in cenas[3]) {
+ d.push({
+ time:cenas[3][key].time ,
+ timeEnd: cenas[3][key].timeEnd,
+ imageUrl:cenas[3][key].imageUrl,
+ description: cenas[3][key].description,
+ name:cenas[3][key].name,
+ Enrolled: cenas[3][key].Enrolled,
+ MaxAttendees: cenas[3][key].MaxAttendees,
+ day: cenas[3][key].day
+ });
+ }
+ a=_.sortBy(a, function(o) { return o.time; });
+ b=_.sortBy(b, function(o) { return o.time; });
+ c=_.sortBy(c, function(o) { return o.time; });
+ d=_.sortBy(d, function(o) { return o.time; });
+ dispatch({
+
+ type: GET_EVENTS,
+ events:a,
+ day1:a,
+ day2:b,
+ day3:c,
+ day4:d
+
+ });
+ };
}
const saveToken = async token => {
-
-
- try {
- await AsyncStorage.setItem('refreshToken', token.refreshToken).catch(a => {
-
- })
- await AsyncStorage.setItem('userToken', token.access_token).catch(a => {
-
- })
- await AsyncStorage.setItem('expirationDateToken', token.expirationDateToken.toString()).catch(a => {
-
- })
-
-
- } catch (error) {
-
- // Error retrieving data
- console.log(error.message);
-
- }
-
+ try {
+ await AsyncStorage.setItem("refreshToken", token.refreshToken).catch(
+ a => {}
+ );
+ await AsyncStorage.setItem("userToken", token.access_token).catch(a => {});
+ await AsyncStorage.setItem(
+ "expirationDateToken",
+ token.expirationDateToken.toString()
+ ).catch(a => {});
+ } catch (error) {
+ // Error retrieving data
+ console.log(error.message);
+ }
};
-
const getToken = async () => {
-
- obj = {}
- try {
-
- obj.access_token = await AsyncStorage.getItem('userToken') || 'none';
- obj.expirationDateToken = await AsyncStorage.getItem('expirationDateToken') || 'none';
- obj.refreshToken = await AsyncStorage.getItem('refreshToken') || 'none';
-
-
- } catch (error) {
- // Error retrieving data
- console.log(error.message);
- }
- return obj;
-}
-
+ obj = {};
+ try {
+ obj.access_token = (await AsyncStorage.getItem("userToken")) || "none";
+ obj.expirationDateToken =
+ (await AsyncStorage.getItem("expirationDateToken")) || "none";
+ obj.refreshToken = (await AsyncStorage.getItem("refreshToken")) || "none";
+ } catch (error) {
+ // Error retrieving data
+ console.log(error.message);
+ }
+ return obj;
+};
const deleteToken = async () => {
+ try {
+ await AsyncStorage.removeItem("userToken");
+ await AsyncStorage.removeItem("expirationDateToken");
+ await AsyncStorage.removeItem("refreshToken");
+ } catch (error) {
+ // Error retrieving data
+ console.log(error.message);
+ }
+};
- try {
- await AsyncStorage.removeItem('userToken');
- await AsyncStorage.removeItem('expirationDateToken');
- await AsyncStorage.removeItem('refreshToken');
- } catch (error) {
- // Error retrieving data
- console.log(error.message);
- }
-}
-
-const renewToken = (refresh) => {
-
-
-}
-
+const renewToken = refresh => {};
export function login(user, pass) {
+ return dispatch => {
+ console.log("user: " + user + " password: " + pass);
- return (dispatch) => {
+ var details = {
+ username: user,
+ password: pass,
+ grant_type: "password"
+ };
- console.log('user: ' + user + ' password: ' + pass);
+ var formBody = [];
+
+ for (var property in details) {
+ var encodedKey = encodeURIComponent(property);
+
+ var encodedValue = encodeURIComponent(details[property]);
+
+ formBody.push(encodedKey + "=" + encodedValue);
+ }
+
+ formBody = formBody.join("&");
+
+ fetch("http://enei2019.uingress.com/internal/api/token", {
+ method: "POST",
+
+ headers: {
+ "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
+ },
+
+ body: formBody
+ })
+ .catch(err => {
+ console.log(err);
+ alert("Erro no login!!");
+
+ alert("error");
+ co;
+ dispatch({
+ type: API_LOGIN,
+ logged: false,
+ failedAttempt: true,
+ tokenData: "error",
+ user: { Name: "" },
+ });
+ })
+ .catch(err=>{
+ console.log("error")
+ })
+ .then(res => res.json())
+ .then(parsed => {
+ console.log(parsed)
+ if (
+ parsed.error_description ==
+ "Provided username and password is incorrect"
+ ) {
+ Alert.alert("Dados Inválidos","Podes sempre fazer reset da password para o email.")
+
+ dispatch({
+ type: API_LOGIN,
+ logged: false,
+ failedAttempt: true,
+ token: obj,
+ user: { Name: "Henrique" },
+ userDetails:{},
+ waitLogin:false,
+ onHold:false
+
+ });
+ return;
+ }
+ else{
+ var obj = {
+ access_token: parsed.access_token,
+ expirationDateToken: Math.round(new Date().getTime() / 1000) + 3598,
+ refreshToken: parsed.refresh_token,
+ valid: true
+ };
var details = {
- 'username': user,
- 'password': pass,
- 'grant_type': 'password'
+ username: user,
+ password: pass
+ };
+ dispatch({
+ type: API_LOGIN,
+ logged: true,
+ failedAttempt: false,
+ token: obj,
+ user: { Name: "Henrique" },
+ userDetails: details
+ });}
+ });
+ };
+}
+export function hold() {
+ return dispatch => {
+ dispatch({
+ type: HOLD,
+ onHold: true
+ });
+ };
+}
+
+export function getUserInfo(token) {
+ return dispatch => {
+ //TODO: verificar validade do token
+
+ console.log('Chamada "getUserInfo"');
+
+ var obj = {
+ method: "GET",
+ headers: {
+ Authorization: `Bearer ${token.access_token}`
+ }
+ };
+
+ fetch("http://enei2019.uingress.com/internal/api/Attendee/Detail", obj)
+ .then(function(res) {
+ console.log(res);
+ let obj = JSON.parse(res._bodyText);
+
+ dispatch({ type: USER_INFO, user: obj, onHold: false, logged: true });
+ })
+ .catch(function(res) {
+ console.log("erro");
+ // dispatch({ type: USER_INFO,onHold:false});
+ alert("Erro a obter a informação pessoal.");
+ });
+ };
+}
+
+export function logoutUser() {
+ return dispatch => {
+ deleteToken()
+ .then(a => {
+ console.log("token apagado");
+ dispatch({
+ type: LOGOUT_USER,
+ loggedIn: false,
+ tokenData: "error",
+ token: false
+ });
+ })
+ .catch(err => {
+ console.log("errors");
+ });
+ };
+}
+
+//
+function refreshToken() {
+ refresh = a.refreshToken;
+
+ //chamar funçao para renovar
+ console.log("expirou");
+
+ var details = {
+ grant_type: "refresh_token",
+ refresh_token: refresh
+ };
+
+ var formBody = [];
+
+ for (var property in details) {
+ var encodedKey = encodeURIComponent(property);
+
+ var encodedValue = encodeURIComponent(details[property]);
+
+ formBody.push(encodedKey + "=" + encodedValue);
+ }
+
+ formBody = formBody.join("&");
+
+ fetch("http://enei2019.uingress.com/internal/api/token", {
+ method: "POST",
+
+ headers: {
+ "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
+ },
+
+ body: formBody
+ })
+ .then(res => res.json())
+ .then(parsed => {
+ console.log(parsed);
+
+ if (parsed.error == "invalid_grant") {
+ console.log(formBody);
+ dispatch({ type: CHECK_USER, token: "", logged: false, onHold: false });
+ } else {
+ var obj = {
+ access_token: parsed.access_token,
+ expirationDateToken: Math.round(new Date().getTime() / 1000) + 3598,
+ refreshToken: parsed.refresh_token,
+ valid: true
+ };
+
+ // deleteToken();
+ saveToken(obj).then(a => {
+ console.log("Token guardado");
+ console.log(obj);
+ dispatch({
+ type: CHECK_USER,
+ token: obj,
+ logged: true,
+ onHold: false
+ });
+ });
+ }
+ })
+ .catch(a => {
+ console.log("erro na api");
+ dispatch({ type: CHECK_USER, token: "", logged: false, onHold: false });
+ });
+}
+
+refreshLogin = async (user, pass) => {
+ console.log("login");
+
+ console.log("user: " + user + " password: " + pass);
+
+ var details = {
+ username: user,
+ password: pass,
+ grant_type: "password"
+ };
+
+ var formBody = [];
+
+ for (var property in details) {
+ var encodedKey = encodeURIComponent(property);
+
+ var encodedValue = encodeURIComponent(details[property]);
+
+ formBody.push(encodedKey + "=" + encodedValue);
+ }
+
+ formBody = formBody.join("&");
+
+ fetch("http://enei2019.uingress.com/internal/api/token", {
+ method: "POST",
+
+ headers: {
+ "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
+ },
+
+ body: formBody
+ })
+ .catch(err => {
+ console.log(err);
+
+ alert("error");
+ })
+ .then(res => res.json())
+ .then(parsed => {
+ if (
+ parsed.error_description ==
+ "Provided username and password is incorrect"
+ ) {
+ console.error("cenas da vida");
+ } else {
+ console.log(parsed);
+
+ var obj = {
+ access_token: parsed.access_token,
+ expirationDateToken: Math.round(new Date().getTime() / 1000) + 3598,
+ refreshToken: parsed.refresh_token,
+ valid: true
+ };
+
+ go();
+ return obj;
+ }
+ });
+};
+
+go = t => {
+ dispatch({
+ type: CHECK_USER,
+ logged: true,
+ onHold: false,
+ user: { Name: "Henrique" },
+ token: t
+ });
+};
+
+export function checkUser(userDetails) {
+ var u = userDetails;
+
+ return dispatch => {
+ //verifica se existe utilizador em memória
+ if (
+ userDetails.username != undefined &&
+ userDetails.username != "" &&
+ userDetails.password != undefined &&
+ userDetails.password != ""
+ ) {
+ //verifica a validade do token
+ if (
+ Math.round(new Date().getTime() / 1000) >=
+ userDetails.token.expirationDateToken
+ ) {
+ var details = {
+ username: userDetails.username,
+ password: userDetails.password,
+ grant_type: "password"
};
var formBody = [];
for (var property in details) {
+ var encodedKey = encodeURIComponent(property);
- var encodedKey = encodeURIComponent(property);
-
- var encodedValue = encodeURIComponent(details[property]);
-
- formBody.push(encodedKey + "=" + encodedValue);
+ var encodedValue = encodeURIComponent(details[property]);
+ formBody.push(encodedKey + "=" + encodedValue);
}
formBody = formBody.join("&");
- fetch('http://enei2019.uingress.com/internal/api/token', {
+ fetch("http://enei2019.uingress.com/internal/api/token", {
+ method: "POST",
- method: 'POST',
-
- headers: {
-
- 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
- },
-
- body: formBody
-
- }).catch(err => {
-
- console.log(err);
-
- alert("error");
- co
- dispatch({
- type: API_LOGIN,
- logged: false,
- failedAttempt: true,
- tokenData: 'error'
- });
-
-
- }).then(res => res.json()).then(parsed => {
-
- if (parsed.error_description == "Provided username and password is incorrect") {
- dispatch({
- type: API_LOGIN,
- logged: false,
- failedAttempt: true,
- token: obj,
- user: {Name: 'Henrique'}
-
- });
- }
- var obj = {
- access_token: parsed.access_token,
- expirationDateToken: Math.round(new Date().getTime() / 1000) + 3598,
- refreshToken: parsed.refresh_token,
- valid: true
- };
-
- var details = {
- username: user,
- password: pass
- }
- dispatch({
- type: API_LOGIN,
- logged: true,
- failedAttempt: false,
- token: obj,
- user: {Name: 'Henrique'},
- userDetails: details
-
- });
-
-
- }
- )
-
-
- }
-}
-
-export function hold() {
- return (dispatch) => {
- dispatch({
- type: HOLD,
- onHold: true
-
- });
- }
-}
-
-
-export function getUserInfo(token) {
-
-
- return (dispatch) => {
-
- //TODO: verificar validade do token
-
- console.log('Chamada "getUserInfo"');
-
- var obj = {
-
- method: 'GET',
- headers: {
-
- 'Authorization': `Bearer ${token.access_token}`,
- },
- }
-
- fetch('http://enei2019.uingress.com/internal/api/Attendee/Detail', obj)
-
- .then(function (res) {
-
- console.log(res);
- let obj = JSON.parse(res._bodyText);
-
- dispatch({type: USER_INFO, user: obj, onHold: false, logged: true});
-
- }).catch(function (res) {
-
- console.log("erro")
- // dispatch({ type: USER_INFO,onHold:false});
+ headers: {
+ "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
+ },
+ body: formBody
})
+ .catch(err => {
+ alert("Erro a validar o utilizador");
+ })
+ .then(res => res.json())
+ .then(parsed => {
+ if (
+ parsed.error_description ==
+ "Provided username and password is incorrect"
+ ) {
+ alert("Ups, password ou utilizador errada");
+ } else {
+ console.log(parsed);
-
- }
-}
-
-export function logoutUser() {
- return (dispatch) => {
-
- deleteToken().then(a => {
-
- console.log('token apagado');
- dispatch({
- type: LOGOUT_USER,
- loggedIn: false,
- tokenData: 'error',
- token: false
- });
- }).catch(err => {
-
- console.log('errors');
-
- })
-
- }
-}
-
-//
-function refreshToken() {
-
- refresh = a.refreshToken
-
- //chamar funçao para renovar
- console.log("expirou")
-
- var details = {
-
- 'grant_type': 'refresh_token',
- 'refresh_token': refresh
-
- };
-
- var formBody = [];
-
- for (var property in details) {
-
- var encodedKey = encodeURIComponent(property);
-
- var encodedValue = encodeURIComponent(details[property]);
-
- formBody.push(encodedKey + "=" + encodedValue);
-
- }
-
- formBody = formBody.join("&");
-
- fetch('http://enei2019.uingress.com/internal/api/token', {
-
- method: 'POST',
-
- headers: {
-
- 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
- },
-
- body: formBody
-
- }).then(res => res.json()).then(parsed => {
-
- console.log(parsed);
-
- if (parsed.error == 'invalid_grant') {
-
- console.log(formBody);
- dispatch({type: CHECK_USER, token: '', logged: false, onHold: false});
-
- } else {
-
- var obj = {
+ var obj = {
access_token: parsed.access_token,
- expirationDateToken: Math.round(new Date().getTime() / 1000) + 3598,
+ expirationDateToken:
+ Math.round(new Date().getTime() / 1000) + 3598,
refreshToken: parsed.refresh_token,
valid: true
+ };
+ dispatch({
+ type: CHECK_USER,
+ logged: true,
+ onHold: false,
+ userDetails: u,
+ token: obj
+ });
+ }
+ });
+ } else {
+ console.log(
+ "Tempo restante token: " +
+ Math.round(
+ (userDetails.token.expirationDateToken -
+ Math.round(new Date().getTime() / 1000)) /
+ 60
+ ) +
+ " Minutos"
+ );
- };
-
- // deleteToken();
- saveToken(obj).then(a => {
- console.log("Token guardado")
- console.log(obj)
- dispatch({type: CHECK_USER, token: obj, logged: true, onHold: false});
-
- })
- }
-
-
- }).catch(a => {
- console.log("erro na api")
- dispatch({type: CHECK_USER, token: '', logged: false, onHold: false});
- })
-
-}
-
-refreshLogin = async (user, pass) => {
-
-
- console.log("login")
-
-
- console.log('user: ' + user + ' password: ' + pass);
-
- var details = {
- 'username': user,
- 'password': pass,
- 'grant_type': 'password'
- };
-
- var formBody = [];
-
- for (var property in details) {
-
- var encodedKey = encodeURIComponent(property);
-
- var encodedValue = encodeURIComponent(details[property]);
-
- formBody.push(encodedKey + "=" + encodedValue);
-
+ //dispatch home
+ dispatch({
+ type: CHECK_USER,
+ logged: true,
+ onHold: false,
+ user: { Name: "Henrique" },
+ userDetails: u
+ });
+ }
}
-
- formBody = formBody.join("&");
-
- fetch('http://enei2019.uingress.com/internal/api/token', {
-
- method: 'POST',
-
- headers: {
-
- 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
- },
-
- body: formBody
-
- }).catch(err => {
-
- console.log(err);
-
- alert("error");
-
-
- }).then(res => res.json()).then(parsed => {
-
- if (parsed.error_description == "Provided username and password is incorrect") {
-
- console.error("cenas da vida")
-
- }
- else {
-
- console.log(parsed)
-
- var obj = {
- access_token: parsed.access_token,
- expirationDateToken: Math.round(new Date().getTime() / 1000) + 3598,
- refreshToken: parsed.refresh_token,
- valid: true
- };
-
- go();
- return obj;
-
-
- }
-
- }
- )
-
-}
-
-
-go = (t) => {
- dispatch({type: CHECK_USER, logged: true, onHold: false, user: {Name: 'Henrique'}, token: t});
-}
-
-
-export function checkUser(userDetails) {
-
- var u = userDetails;
-
- return (dispatch) => {
-
- //verifica se existe utilizador em memória
- if (
- userDetails.username != undefined &&
- userDetails.username != '' &&
- userDetails.password != undefined &&
- userDetails.password != ''
-
- ) {
-
- //verifica a validade do token
- if (Math.round(new Date().getTime() / 1000) >= userDetails.token.expirationDateToken) {
-
-
- var details = {
- 'username': userDetails.username,
- 'password': userDetails.password,
- 'grant_type': 'password'
- };
-
- var formBody = [];
-
- for (var property in details) {
-
- var encodedKey = encodeURIComponent(property);
-
- var encodedValue = encodeURIComponent(details[property]);
-
- formBody.push(encodedKey + "=" + encodedValue);
-
- }
-
- formBody = formBody.join("&");
-
- fetch('http://enei2019.uingress.com/internal/api/token', {
-
- method: 'POST',
-
- headers: {
-
- 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
- },
-
- body: formBody
-
- }).catch(err => {
-
- console.log(err);
-
- alert("error");
-
-
- }).then(res => res.json()).then(parsed => {
-
- if (parsed.error_description == "Provided username and password is incorrect") {
-
- console.error("cenas da vida")
-
- }
- else {
-
- console.log(parsed)
-
- var obj = {
- access_token: parsed.access_token,
- expirationDateToken: Math.round(new Date().getTime() / 1000) + 3598,
- refreshToken: parsed.refresh_token,
- valid: true
- };
-
- dispatch({type: CHECK_USER, logged: true, onHold: false, userDetails: u, token: obj});
-
-
- }
-
- }
- )
- } else {
- console.log("Tempo restante token: " + Math.round((userDetails.token.expirationDateToken - Math.round(new Date().getTime() / 1000)) / 60) + " Minutos");
-
- //dispatch home
- dispatch({type: CHECK_USER, logged: true, onHold: false, user: {Name: 'Henrique'}, userDetails: u});
-
- }
-
-
- }
- //utilizador não existe em memória
- else {
-
- dispatch({type: CHECK_USER, logged: false, onHold: false, userDetails: u});
- //dispatch menu de login
- }
+ //utilizador não existe em memória
+ else {
+ dispatch({
+ type: CHECK_USER,
+ logged: false,
+ onHold: false,
+ userDetails: u
+ });
+ //dispatch menu de login
}
-}
\ No newline at end of file
+ };
+}
diff --git a/App/app/store/actions/index.js b/App/app/store/actions/index.js
index 26d618d4..282219b8 100644
--- a/App/app/store/actions/index.js
+++ b/App/app/store/actions/index.js
@@ -1,11 +1,20 @@
export {checkUser,
- login,getEvents,
- hold, getUserInfo,
+ login,
+ getEvents,
+ hold,
+ getUserInfo,
logoutUser,
getAvailableGuestlists,
changeGuestList,
waitChangeGuest,
- getAvailableSessions
+ getAvailableSessions,
+ updateUser,
+ getSessionBlocks,
+ timerChangeGuest,
+ getSessions,
+ signSession,
+ openModal,
+ closeModal
} from "./api"
export {
diff --git a/App/app/store/reducers/api.js b/App/app/store/reducers/api.js
index c8ebb28f..bca3c594 100644
--- a/App/app/store/reducers/api.js
+++ b/App/app/store/reducers/api.js
@@ -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 { REHYDRATE } from 'redux-persist';
+import {
+ 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) => {
-
- switch(action.type){
+ switch (action.type) {
+ case REHYDRATE:
+ console.log(action);
+ if (action.payload != undefined) {
+ console.log(action.payload);
- case REHYDRATE:
- console.log(action)
- if(action.payload!=undefined){
-
- console.log( action.payload)
+ var expirationDateTokenA = 0;
+ var access_tokenA = "";
- var expirationDateTokenA=0;
- var access_tokenA='';
+ if (action.payload.apiReducer.userDetails.token != undefined) {
+ 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.expirationDateToken!= undefined){
-
- expirationDateTokenA= action.payload.apiReducer.userDetails.token.expirationDateToken;
- }
-
- if((action.payload.apiReducer.userDetails.token.access_token!= undefined)){
+ if (
+ action.payload.apiReducer.userDetails.token.access_token !=
+ undefined
+ ) {
+ access_tokenA =
+ action.payload.apiReducer.userDetails.token.access_token;
+ }
+ }
- 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
+ }
+ };
+ }
- }
-
- }
-
- 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":
+ return Object.assign({}, state, {
+ isConnected: action.isConnected
+ });
- case 'CHANGE_CONNECTION_STATUS':
- return Object.assign({}, state, {
- isConnected: action.isConnected,
- });
-
-
- case HOLD:
+ case LOADINGLOGIN:
+ state= Object.assign({}, state, {loadingLogin:true});
- state=Object.assign({},state, { onHold:true });
- return state;
+ case HOLD:
+ state = Object.assign({}, state, { onHold: true });
+ return state;
- case API_LOGIN:
-
-
- state=Object.assign({},state, {
- logged:action.logged,
- //token:action.token,
- failedAttempt: action.failedAttempt,
- user:action.user,
- userDetails: {token:action.token, username:action.userDetails.username, password:action.userDetails.password},
-
-
- });
+ case API_LOGIN:
+ state = Object.assign({}, state, {
+ logged: action.logged,
+ //token:action.token,
+ failedAttempt: action.failedAttempt,
+ user: action.user,
+ userDetails: {
+ token: action.token,
+ 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;
- if(action.token != undefined)
- u.token= action.token;
+ state = Object.assign({}, state, {
+ logged: action.logged,
+ 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;
-
- case GET_EVENTS:
+ return state;
- state=Object.assign({},state, { events: action.events});
-
- return state;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- case GET_CAREERS:
- var c= {
- guests:action.guests
- }
- state=Object.assign({},state, { calendar:c });
+ case OPEN_MODAL:
+ console.log("open modal")
+ state = Object.assign({}, state, {
+ modalOpen: true,
+ modalInfo: action.modalInfo,
+ modalType: action.type
+ });
+ return state;
- return state;
-
- case CHANGE_GUEST:
- state=Object.assign({},state, { changingGuest:false});
- return state;
+ case CLOSE_MODAL:
+ state = Object.assign({}, state, {
+ modalOpen: false,
+ modalInfo: "",
+ type: ""
+ });
+ return state;
- case WAIT_CHANGE:
- state=Object.assign({},state, { changingGuest:true});
- return state;
+ case SIGN_SESSION:
+ state = Object.assign({}, state, {
+ sessions: action.sessions,
+ Blocks: action.Blocks,
+ careerPath: action.careerPath,
+ changingGuest: action.changingGuest,
+ user:action.user
+ });
+ return state;
- case GET_SESSIONS:
- state=Object.assign({},state, { changingGuest:false, sessions:action.sessions});
- return state;
- default:
- return state;
- }
-}
-export default apiReducer;
\ No newline at end of file
+ case SESSION_BLOCKS:
+ state = Object.assign({}, state, {
+ Blocks: action.Blocks,
+ onHoldBlocks: false,
+ changingGuest: false
+ });
+ return state;
+
+ 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;
diff --git a/App/package-lock.json b/App/package-lock.json
index 45c0891a..84fa35f8 100755
--- a/App/package-lock.json
+++ b/App/package-lock.json
@@ -7844,6 +7844,14 @@
"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=="
},
+ "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": {
"version": "2.2.5",
"resolved": "https://registry.npmjs.org/react-native-branch/-/react-native-branch-2.2.5.tgz",
diff --git a/App/package.json b/App/package.json
index 889caa03..5cf0dd02 100755
--- a/App/package.json
+++ b/App/package.json
@@ -17,6 +17,7 @@
"react-native": "0.57.8",
"react-native-action-button": "^2.8.5",
"react-native-app-intro-slider": "^1.0.1",
+ "react-native-awesome-alerts": "^1.2.0",
"react-native-camera": "^1.9.2",
"react-native-check-box": "^2.1.7",
"react-native-cli": "^2.0.1",
diff --git a/api/Controllers/AuthController.cs b/api/Controllers/AuthController.cs
index 527fb2b2..94f95a04 100755
--- a/api/Controllers/AuthController.cs
+++ b/api/Controllers/AuthController.cs
@@ -28,7 +28,6 @@ namespace api.Controllers
public UserManager _userManager { get; }
public SignInManager _signInManager { get; }
public IUsersRepository _repo { get; }
-
private readonly IMapper _mapper;
private readonly RoleManager _roleManager;
diff --git a/api/Controllers/EventLocsController.cs b/api/Controllers/EventLocsController.cs
new file mode 100644
index 00000000..fa3345e8
--- /dev/null
+++ b/api/Controllers/EventLocsController.cs
@@ -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 _roleManager;
+ private readonly UserManager _userManager;
+ public EventLocsController(DataContext context,IEventLocsRepository repo, IMapper mapper,RoleManager roleManager,UserManager UserManager)
+ {
+ this.context = context;
+ _mapper = mapper;
+ _roleManager = roleManager;
+ _userManager = UserManager;
+ _repo = repo;
+ }
+
+ // GET api/EventLocs
+ // GET all EventLocs
+ [HttpGet]
+ public async Task GetEventLocs()
+ {
+ var Teams = await _repo.GetEventLocs();
+ return Ok(Teams);
+ }
+
+ // GET api/EventLocs/[id]
+ [HttpGet("{id}")]
+ public async Task GetEventLoc(int id)
+ {
+ var Teams = await _repo.GetEventLoc(id);
+ return Ok(Teams);
+ }
+
+ // GET api/EventLocs/[id]
+ [HttpGet("e/{id}")]
+ public async Task GetEventLocEvent(int id)
+ {
+ var Teams = await _repo.GetEventLocEvent(id);
+ return Ok(Teams);
+ }
+
+ // POST api/eventLocs/add
+ // add new event
+ [HttpPost("add")]
+ public async Task 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();
+ }
+ }
+}
diff --git a/api/Controllers/EventLocsVisitedController.cs b/api/Controllers/EventLocsVisitedController.cs
new file mode 100644
index 00000000..2f810294
--- /dev/null
+++ b/api/Controllers/EventLocsVisitedController.cs
@@ -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 _roleManager;
+ private readonly UserManager _userManager;
+ public EventLocsVisitedController(DataContext context,IEventLocsVisitedRepository repo, IMapper mapper,RoleManager roleManager,UserManager UserManager)
+ {
+ this.context = context;
+ _mapper = mapper;
+ _roleManager = roleManager;
+ _userManager = UserManager;
+ _repo = repo;
+ }
+
+ // GET api/EventLocsVisited
+ // GET all EventLocsVisited
+ [HttpGet]
+ public async Task 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 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 GetEventLocsVisitedEvent(int id)
+ {
+ var Locs = await _repo.GetEventLocsVisitedEvent(id);
+ return Ok(Locs);
+ }
+
+
+ // POST api/eventLocsVisited/add
+ // add new event
+ [HttpPost("add")]
+ public async Task 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();
+ }
+
+ }
+}
diff --git a/api/Controllers/EventsController.cs b/api/Controllers/EventsController.cs
new file mode 100644
index 00000000..36a8458f
--- /dev/null
+++ b/api/Controllers/EventsController.cs
@@ -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 GetEvents()
+ {
+ var Events = await _repo.GetEvents();
+ return Ok(Events);
+ }
+
+ // GET api/events/[id]
+ // GET events id x
+ [HttpGet("{id}")]
+ public async Task GetEvent(int id)
+ {
+ var Event = await _repo.GetEvent(id);
+ return Ok(Event);
+ }
+
+ // POST api/events/add
+ // add new event
+ [HttpPost("add")]
+ public async Task 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();
+ }
+ }
+}
diff --git a/api/Controllers/TeamsController.cs b/api/Controllers/TeamsController.cs
new file mode 100644
index 00000000..a7274ace
--- /dev/null
+++ b/api/Controllers/TeamsController.cs
@@ -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 _roleManager;
+ private readonly UserManager _userManager;
+ public TeamsController(DataContext context,ITeamsRepository repo, IMapper mapper,RoleManager roleManager,UserManager UserManager)
+ {
+ this.context = context;
+ _mapper = mapper;
+ _roleManager = roleManager;
+ _userManager = UserManager;
+ _repo = repo;
+ }
+
+ // GET api/teams
+ // GET all teams
+ [HttpGet]
+ public async Task 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 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 GetTeamsUser(String QR)
+ {
+ var Teams = await _repo.GetUserTeam(QR);
+ return Ok(Teams);
+ }
+
+ // POST api/teams/add
+ // create team
+ [HttpPost("add")]
+ public async Task 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 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 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 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 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);
+ }
+
+ }
+ }
+}
diff --git a/api/Data/DataContext.cs b/api/Data/DataContext.cs
index 2b4d4713..e6ac56e1 100755
--- a/api/Data/DataContext.cs
+++ b/api/Data/DataContext.cs
@@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore;
namespace api.Data
{
- public class DataContext : IdentityDbContext,
- UserRole,IdentityUserLogin,IdentityRoleClaim,IdentityUserToken>
+ public class DataContext : IdentityDbContext,UserRole,IdentityUserLogin,
+ IdentityRoleClaim,IdentityUserToken>
{
public DataContext(DbContextOptions options):base(options) { }
@@ -24,31 +24,31 @@ namespace api.Data
public DbSetLogs{get;set;}
-public DbSetProducts{get;set;}
+ public DbSetProducts{get;set;}
- protected override void OnModelCreating(ModelBuilder builder)
- {
- base.OnModelCreating(builder);
+ protected override void OnModelCreating(ModelBuilder builder)
+ {
+ base.OnModelCreating(builder);
- //para o ef saber as relações
- builder.Entity(userRole =>
- {
- userRole.HasKey(ur=> new {ur.UserId, ur.RoleId});
+ //para o ef saber as relações
+ builder.Entity(userRole =>
+ {
+ userRole.HasKey(ur=> new {ur.UserId, ur.RoleId});
- userRole.HasOne( ur=>ur.Role)
- .WithMany(r=>r.UserRoles)
- .HasForeignKey(ur=> ur.RoleId)
- .IsRequired();
+ userRole.HasOne( ur=>ur.Role)
+ .WithMany(r=>r.UserRoles)
+ .HasForeignKey(ur=> ur.RoleId)
+ .IsRequired();
- userRole.HasOne( ur=>ur.User)
- .WithMany(r=>r.UserRoles)
- .HasForeignKey(ur=> ur.UserId)
- .IsRequired();
-
- });
- }
+ userRole.HasOne( ur=>ur.User)
+ .WithMany(r=>r.UserRoles)
+ .HasForeignKey(ur=> ur.UserId)
+ .IsRequired();
+
+ });
+ }
}
}
\ No newline at end of file
diff --git a/api/Data/EventLocsRepository.cs b/api/Data/EventLocsRepository.cs
new file mode 100644
index 00000000..c4b22884
--- /dev/null
+++ b/api/Data/EventLocsRepository.cs
@@ -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 GetEventLoc(int id)
+ {
+ var rEventLocs = await _context.EventLocs.FirstOrDefaultAsync(e=>e.Id == id);
+
+ return rEventLocs;
+ }
+
+ public async Task> GetEventLocEvent(int id)
+ {
+ List eLocs = await _context.EventLocs.ToListAsync();
+ List rEventLocs = new List();
+
+ eLocs.ForEach(delegate (EventLoc e){
+ if(e.EventId == id){
+ rEventLocs.Add(e);
+ }
+ });
+
+ return rEventLocs;
+ }
+
+ public async Task> GetEventLocs()
+ {
+ var rEventLocs = await _context.EventLocs.ToListAsync();
+
+ return rEventLocs;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/api/Data/EventLocsVisitedRepository.cs b/api/Data/EventLocsVisitedRepository.cs
new file mode 100644
index 00000000..4b326980
--- /dev/null
+++ b/api/Data/EventLocsVisitedRepository.cs
@@ -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> GetEventLocsVisited()
+ {
+ var rEventLocsVisitedList = await _context.EventLocsVisited.Include(e=>e.Team).Include(e=>e.Location).ToListAsync();
+
+ return rEventLocsVisitedList;
+ }
+
+ public async Task> GetEventLocsVisitedTeam(int id)
+ {
+ List allLocs = await _context.EventLocsVisited.Include(e=>e.Team).Include(e=>e.Location).ToListAsync();
+ List rList = new List();
+ for(var i=0;i> GetEventLocsVisitedEvent(int id)
+ {
+ List allLocs = await _context.EventLocsVisited.Include(e=>e.Team).Include(e=>e.Location).ToListAsync();
+ List rList = new List();
+ for(var i=0;i GetEvent(int id)
+ {
+ var Event = await _context.Events.FirstOrDefaultAsync(e=>e.Id == id);
+
+ return Event;
+ }
+
+ public async Task> GetEvents()
+ {
+ var Events = await _context.Events.ToListAsync();
+
+ return Events;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/api/Data/IEventLocsRepository.cs b/api/Data/IEventLocsRepository.cs
new file mode 100644
index 00000000..d8b60e05
--- /dev/null
+++ b/api/Data/IEventLocsRepository.cs
@@ -0,0 +1,16 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using api.Models;
+
+namespace api.Data
+{
+ public interface IEventLocsRepository
+ {
+
+ Task> GetEventLocs();
+ Task GetEventLoc(int id);
+ Task> GetEventLocEvent(int id);
+
+
+ }
+}
\ No newline at end of file
diff --git a/api/Data/IEventLocsVisitedRepository.cs b/api/Data/IEventLocsVisitedRepository.cs
new file mode 100644
index 00000000..42005dee
--- /dev/null
+++ b/api/Data/IEventLocsVisitedRepository.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using api.Models;
+
+namespace api.Data
+{
+ public interface IEventLocsVisitedRepository
+ {
+
+ Task> GetEventLocsVisited();
+ Task> GetEventLocsVisitedTeam(int id);
+ Task> GetEventLocsVisitedEvent(int id);
+
+
+ }
+}
\ No newline at end of file
diff --git a/api/Data/IEventsRepository.cs b/api/Data/IEventsRepository.cs
new file mode 100644
index 00000000..79233e7f
--- /dev/null
+++ b/api/Data/IEventsRepository.cs
@@ -0,0 +1,15 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using api.Models;
+
+namespace api.Data
+{
+ public interface IEventsRepository
+ {
+
+ Task> GetEvents();
+ Task GetEvent(int id);
+
+
+ }
+}
\ No newline at end of file
diff --git a/api/Data/ITeamsRepository.cs b/api/Data/ITeamsRepository.cs
new file mode 100644
index 00000000..ac5a220d
--- /dev/null
+++ b/api/Data/ITeamsRepository.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using api.Models;
+
+namespace api.Data
+{
+ public interface ITeamsRepository
+ {
+
+ Task> GetTeams();
+ Task> GetEventTeam(int id);
+ Task GetUserTeam(String QR);
+
+
+ }
+}
\ No newline at end of file
diff --git a/api/Data/TeamsReposiroty.cs b/api/Data/TeamsReposiroty.cs
new file mode 100644
index 00000000..0a0e3544
--- /dev/null
+++ b/api/Data/TeamsReposiroty.cs
@@ -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> GetEventTeam(int id)
+ {
+ List allTeams = await _context.Teams.Include(a=>a.Cap).ToListAsync();
+ List rTeam = new List();
+ allTeams.ForEach(delegate(Team t){
+ if(t.EventId == id){
+ rTeam.Add(t);
+ }
+ });
+
+ return rTeam;
+ }
+
+ public async Task GetUserTeam(String QR)
+ {
+ var rTeam = (await _context.Users.FirstAsync(u=>u.QRcode == QR)).team;
+
+ return rTeam;
+ }
+
+ public async Task> GetTeams()
+ {
+ var rTeams = await _context.Teams.Include(a=>a.Cap).ToListAsync();
+
+ return rTeams;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/api/Dtos/EventForAdd.cs b/api/Dtos/EventForAdd.cs
new file mode 100644
index 00000000..8c23d5f9
--- /dev/null
+++ b/api/Dtos/EventForAdd.cs
@@ -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
+ }
+}
\ No newline at end of file
diff --git a/api/Dtos/EventLocAdd.cs b/api/Dtos/EventLocAdd.cs
new file mode 100644
index 00000000..1a1b1163
--- /dev/null
+++ b/api/Dtos/EventLocAdd.cs
@@ -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
+ }
+}
\ No newline at end of file
diff --git a/api/Dtos/EventLocVisitedAdd.cs b/api/Dtos/EventLocVisitedAdd.cs
new file mode 100644
index 00000000..87edbdc9
--- /dev/null
+++ b/api/Dtos/EventLocVisitedAdd.cs
@@ -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
+
+ }
+}
\ No newline at end of file
diff --git a/api/Dtos/TeamAddMember.cs b/api/Dtos/TeamAddMember.cs
new file mode 100644
index 00000000..7637c55e
--- /dev/null
+++ b/api/Dtos/TeamAddMember.cs
@@ -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
+ }
+}
\ No newline at end of file
diff --git a/api/Dtos/TeamChangeName.cs b/api/Dtos/TeamChangeName.cs
new file mode 100644
index 00000000..33f5174a
--- /dev/null
+++ b/api/Dtos/TeamChangeName.cs
@@ -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
+
+ }
+}
\ No newline at end of file
diff --git a/api/Dtos/TeamDelete.cs b/api/Dtos/TeamDelete.cs
new file mode 100644
index 00000000..578d665d
--- /dev/null
+++ b/api/Dtos/TeamDelete.cs
@@ -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
+
+ }
+}
\ No newline at end of file
diff --git a/api/Dtos/TeamForAdd.cs b/api/Dtos/TeamForAdd.cs
new file mode 100644
index 00000000..57f97841
--- /dev/null
+++ b/api/Dtos/TeamForAdd.cs
@@ -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
+ }
+}
\ No newline at end of file
diff --git a/api/Dtos/TeamRemoveMember.cs b/api/Dtos/TeamRemoveMember.cs
new file mode 100644
index 00000000..dca243db
--- /dev/null
+++ b/api/Dtos/TeamRemoveMember.cs
@@ -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
+
+ }
+}
\ No newline at end of file
diff --git a/api/Migrations/20190224020609_finos.Designer.cs b/api/Migrations/20190309183026_TeamsV2.Designer.cs
similarity index 96%
rename from api/Migrations/20190224020609_finos.Designer.cs
rename to api/Migrations/20190309183026_TeamsV2.Designer.cs
index ff88151c..68ef50d4 100644
--- a/api/Migrations/20190224020609_finos.Designer.cs
+++ b/api/Migrations/20190309183026_TeamsV2.Designer.cs
@@ -9,8 +9,8 @@ using api.Data;
namespace api.Migrations
{
[DbContext(typeof(DataContext))]
- [Migration("20190224020609_finos")]
- partial class finos
+ [Migration("20190309183026_TeamsV2")]
+ partial class TeamsV2
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
@@ -243,7 +243,7 @@ namespace api.Migrations
b.Property("Id")
.ValueGeneratedOnAdd();
- b.Property("CapId");
+ b.Property("CapID");
b.Property("EventId");
@@ -253,11 +253,9 @@ namespace api.Migrations
b.Property("Pontos");
- b.Property("QRcode");
-
b.HasKey("Id");
- b.HasIndex("CapId");
+ b.HasIndex("CapID");
b.ToTable("Teams");
});
@@ -297,8 +295,6 @@ namespace api.Migrations
b.Property("SecurityStamp");
- b.Property("TeamId");
-
b.Property("TwoFactorEnabled");
b.Property("UserName")
@@ -308,6 +304,8 @@ namespace api.Migrations
b.Property("food");
+ b.Property("teamID");
+
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
@@ -317,7 +315,7 @@ namespace api.Migrations
.IsUnique()
.HasName("UserNameIndex");
- b.HasIndex("TeamId");
+ b.HasIndex("teamID");
b.ToTable("AspNetUsers");
});
@@ -424,14 +422,14 @@ namespace api.Migrations
{
b.HasOne("api.Models.User", "Cap")
.WithMany()
- .HasForeignKey("CapId");
+ .HasForeignKey("CapID");
});
modelBuilder.Entity("api.Models.User", b =>
{
- b.HasOne("api.Models.Team")
- .WithMany("Membros")
- .HasForeignKey("TeamId");
+ b.HasOne("api.Models.Team", "team")
+ .WithMany()
+ .HasForeignKey("teamID");
});
modelBuilder.Entity("api.Models.UserRole", b =>
diff --git a/api/Migrations/20190224020609_finos.cs b/api/Migrations/20190309183026_TeamsV2.cs
similarity index 96%
rename from api/Migrations/20190224020609_finos.cs
rename to api/Migrations/20190309183026_TeamsV2.cs
index 493d3c7f..9cd33c02 100644
--- a/api/Migrations/20190224020609_finos.cs
+++ b/api/Migrations/20190309183026_TeamsV2.cs
@@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace api.Migrations
{
- public partial class finos : Migration
+ public partial class TeamsV2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
@@ -220,10 +220,9 @@ namespace api.Migrations
{
Id = table.Column(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- QRcode = table.Column(nullable: true),
EventId = table.Column(nullable: false),
Nome = table.Column(nullable: true),
- CapId = table.Column(nullable: true),
+ CapID = table.Column(nullable: true),
NMembros = table.Column(nullable: false),
Pontos = table.Column(nullable: false)
},
@@ -255,14 +254,14 @@ namespace api.Migrations
QRcode = table.Column(nullable: true),
drinks = table.Column(nullable: false),
food = table.Column(nullable: false),
- TeamId = table.Column(nullable: true)
+ teamID = table.Column(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
table.ForeignKey(
- name: "FK_AspNetUsers_Teams_TeamId",
- column: x => x.TeamId,
+ name: "FK_AspNetUsers_Teams_teamID",
+ column: x => x.teamID,
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
@@ -333,9 +332,9 @@ namespace api.Migrations
unique: true);
migrationBuilder.CreateIndex(
- name: "IX_AspNetUsers_TeamId",
+ name: "IX_AspNetUsers_teamID",
table: "AspNetUsers",
- column: "TeamId");
+ column: "teamID");
migrationBuilder.CreateIndex(
name: "IX_EventLocs_ImgId",
@@ -373,9 +372,9 @@ namespace api.Migrations
column: "UserId");
migrationBuilder.CreateIndex(
- name: "IX_Teams_CapId",
+ name: "IX_Teams_CapID",
table: "Teams",
- column: "CapId");
+ column: "CapID");
migrationBuilder.AddForeignKey(
name: "FK_AspNetUserRoles_AspNetUsers_UserId",
@@ -434,9 +433,9 @@ namespace api.Migrations
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
- name: "FK_Teams_AspNetUsers_CapId",
+ name: "FK_Teams_AspNetUsers_CapID",
table: "Teams",
- column: "CapId",
+ column: "CapID",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
@@ -445,7 +444,7 @@ namespace api.Migrations
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
- name: "FK_Teams_AspNetUsers_CapId",
+ name: "FK_Teams_AspNetUsers_CapID",
table: "Teams");
migrationBuilder.DropTable(
diff --git a/api/Migrations/DataContextModelSnapshot.cs b/api/Migrations/DataContextModelSnapshot.cs
index 524187e6..7b8d9f5b 100644
--- a/api/Migrations/DataContextModelSnapshot.cs
+++ b/api/Migrations/DataContextModelSnapshot.cs
@@ -241,7 +241,7 @@ namespace api.Migrations
b.Property("Id")
.ValueGeneratedOnAdd();
- b.Property("CapId");
+ b.Property("CapID");
b.Property("EventId");
@@ -251,11 +251,9 @@ namespace api.Migrations
b.Property("Pontos");
- b.Property("QRcode");
-
b.HasKey("Id");
- b.HasIndex("CapId");
+ b.HasIndex("CapID");
b.ToTable("Teams");
});
@@ -295,8 +293,6 @@ namespace api.Migrations
b.Property("SecurityStamp");
- b.Property("TeamId");
-
b.Property("TwoFactorEnabled");
b.Property("UserName")
@@ -306,6 +302,8 @@ namespace api.Migrations
b.Property("food");
+ b.Property("teamID");
+
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
@@ -315,7 +313,7 @@ namespace api.Migrations
.IsUnique()
.HasName("UserNameIndex");
- b.HasIndex("TeamId");
+ b.HasIndex("teamID");
b.ToTable("AspNetUsers");
});
@@ -422,14 +420,14 @@ namespace api.Migrations
{
b.HasOne("api.Models.User", "Cap")
.WithMany()
- .HasForeignKey("CapId");
+ .HasForeignKey("CapID");
});
modelBuilder.Entity("api.Models.User", b =>
{
- b.HasOne("api.Models.Team")
- .WithMany("Membros")
- .HasForeignKey("TeamId");
+ b.HasOne("api.Models.Team", "team")
+ .WithMany()
+ .HasForeignKey("teamID");
});
modelBuilder.Entity("api.Models.UserRole", b =>
diff --git a/api/Models/EventLocVisited.cs b/api/Models/EventLocVisited.cs
index 3cb2b045..28fb9870 100755
--- a/api/Models/EventLocVisited.cs
+++ b/api/Models/EventLocVisited.cs
@@ -7,7 +7,7 @@ namespace api.Models
public class EventLocVisited
{
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 DateTime timestamp{get;set;} //time
}
diff --git a/api/Models/Team.cs b/api/Models/Team.cs
index f029e0b9..b70deb1e 100755
--- a/api/Models/Team.cs
+++ b/api/Models/Team.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
namespace api.Models
@@ -7,11 +8,11 @@ namespace api.Models
public class Team
{
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 string Nome{get;set;} //Nome da equipa
+
+ [ForeignKey("CapID")]
public User Cap{get;set;} //Capitao da equipa
- public ICollection Membros {get;set;} //Membros da equipa
public int NMembros {get;set;} //Numero de Membros na equipa
public int Pontos {get;set;} //Postos da equipa
}
diff --git a/api/Models/User.cs b/api/Models/User.cs
index 6a90fdff..56acc712 100755
--- a/api/Models/User.cs
+++ b/api/Models/User.cs
@@ -1,6 +1,8 @@
using System;
using Microsoft.AspNetCore.Identity;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+
namespace api.Models
@@ -15,7 +17,9 @@ namespace api.Models
public ICollection Photos {get;set;}
public int drinks{get;set;}
public int food{get;set;}
-
+
+ [ForeignKey("teamID")]
+ public Team team{get;set;}
}
}
\ No newline at end of file
diff --git a/api/Startup.cs b/api/Startup.cs
index 62aee96b..9098d755 100755
--- a/api/Startup.cs
+++ b/api/Startup.cs
@@ -45,6 +45,10 @@ namespace api
services.AddAutoMapper();
services.AddScoped();
+ services.AddScoped();
+ services.AddScoped();
+ services.AddScoped();
+ services.AddScoped();
//define a connection string indicada em appsettings.json
services.AddDbContext(x=>x.UseMySql(Configuration.GetConnectionString("DefaultConnection")));
diff --git a/api/obj/Debug/netcoreapp2.1/api.assets.cache b/api/obj/Debug/netcoreapp2.1/api.assets.cache
deleted file mode 100644
index b5b8a63c..00000000
Binary files a/api/obj/Debug/netcoreapp2.1/api.assets.cache and /dev/null differ
diff --git a/api/obj/Debug/netcoreapp2.1/project.razor.json b/api/obj/Debug/netcoreapp2.1/project.razor.json
index d0f0bc73..04482418 100644
--- a/api/obj/Debug/netcoreapp2.1/project.razor.json
+++ b/api/obj/Debug/netcoreapp2.1/project.razor.json
@@ -1,5 +1,5 @@
{
- "ProjectFilePath": "/Users/henrique/ENEI2019/api/api.csproj",
+ "ProjectFilePath": "c:\\Users\\ZMiguel\\Desktop\\ENEI2019\\api\\api.csproj",
"TargetFramework": "netcoreapp2.1",
"TagHelpers": [],
"Configuration": {
diff --git a/website/android-chrome-256x256.png b/website/android-chrome-256x256.png
old mode 100755
new mode 100644
diff --git a/website/career-path.html b/website/career-path.html
old mode 100755
new mode 100644
diff --git a/website/faqs.html b/website/faqs.html
old mode 100755
new mode 100644
diff --git a/website/imgs/critical-sponsor.svg b/website/imgs/critical-sponsor.svg
old mode 100755
new mode 100644
diff --git a/website/imgs/email.svg b/website/imgs/email.svg
old mode 100755
new mode 100644
diff --git a/website/imgs/facebook.svg b/website/imgs/facebook.svg
old mode 100755
new mode 100644
diff --git a/website/imgs/instagram.svg b/website/imgs/instagram.svg
old mode 100755
new mode 100644
diff --git a/website/imgs/linkedin.svg b/website/imgs/linkedin.svg
old mode 100755
new mode 100644
diff --git a/website/imgs/logo-enei.ai b/website/imgs/logo-enei.ai
old mode 100755
new mode 100644
diff --git a/website/imgs/logo-enei.svg b/website/imgs/logo-enei.svg
old mode 100755
new mode 100644