This commit is contained in:
henrydays 2019-03-17 20:17:03 +00:00
parent a810aa52ca
commit 5af35dcce3
7 changed files with 43 additions and 47 deletions

View File

@ -106,7 +106,7 @@ const AppStack = createBottomTabNavigator(
},
{
initialRouteName: 'Eventos',
initialRouteName: 'Home',
tabBarOptions: {
showLabel: true, // hide labels

View File

@ -69,10 +69,10 @@ _update=()=> {
<View style={styles.container}>
<ScrollView styles={styles.scroll}>
<FlatList
data={this.props.events}
data={this.props.eventsInternal}
renderItem={({item}) =>
<View>
<TouchableOpacity onPress={() => navigate('eventDetail')}>
<TouchableOpacity onPress={() => navigate('eventDetail',{ info: item })}>
<View style={styles.cardContainer}>
<Image
style={{
@ -173,7 +173,7 @@ function mapStateToProps(state, props) {
acesso: state.apiReducer.acesso,
team: state.apiReducer.team,
internalToken: state.apiReducer.internalToken,
events:state.apiReducer.events
eventsInternal:state.apiReducer.eventsInternal
};
}

View File

@ -104,8 +104,7 @@ class Home extends Component {
//fecha o scanner
this.props.addUserTeam({id:this.props.team.id, newQr:e.data}, "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIxIiwidW5pcXVlX25hbWUiOiJjZW5hIiwicm9sZSI6IkFkbWluIiwibmJmIjoxNTUyODQ3NTg5LCJleHAiOjE1NTI5MzM5ODksImlhdCI6MTU1Mjg0NzU4OX0.geNuHNEmo8EGn9yK5FyykDuDRhNQTAcEhheY-nwXTVFbs8hmHLbzPkV4xbPq2qMzEDffzxoc7WWdPwC6D-uTEQ" )
this.setState({addUser:!this.state.addUser})
}
_rm=(qr)=>{
this.props.removeUserTeam({TeamId: this.props.team.id, UserQR: this.props.team.cap.qRcode, UserToRemoveQR: qr},"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIxIiwidW5pcXVlX25hbWUiOiJjZW5hIiwicm9sZSI6IkFkbWluIiwibmJmIjoxNTUyODQ3NTg5LCJleHAiOjE1NTI5MzM5ODksImlhdCI6MTU1Mjg0NzU4OX0.geNuHNEmo8EGn9yK5FyykDuDRhNQTAcEhheY-nwXTVFbs8hmHLbzPkV4xbPq2qMzEDffzxoc7WWdPwC6D-uTEQ"
@ -282,9 +281,10 @@ _toggle=()=>{
alignSelf: "center",
marginTop:7
}}
>
>{this.props.team.nMembros<6 &&
<IconFA name="plus" color={"white"} size={30} />
<Text style={{ color: "white" }}>Adicionar</Text>
}{this.props.team.nMembros<6 &&
<Text style={{ color: "white" }}>Adicionar</Text>}
</View>
</TouchableOpacity>
</View>
@ -301,7 +301,7 @@ _toggle=()=>{
</View>
<View style={styles.userT}>
<Text style={styles.userName}>
{item.username}
{item.fullName}
</Text>
<Text>{item.qRcode}</Text>
</View>

View File

@ -59,21 +59,17 @@ class eventDetail extends React.Component {
state = {};
componentDidMount() {
this.props.getEvents(this.props.user);
const { navigation } = this.props;
const info = navigation.getParam("info", "error");
var a = moment(info.SessionStart);
var b = moment(info.SessionEnd);
console.log(b.diff(a, "minutes")); // 44700
}
_update = () => {
this.setState({ user: this.props.user });
console.log(this.props.events);
};
constructor(props) {
@ -98,7 +94,7 @@ class eventDetail extends React.Component {
<View style={styles.coverContainer}>
<ImageBackground
source={{
uri: `https://tickets.enei.pt/adminpoint/Content/Images/Uploads/Sessions/${this.props.sessionDetail.Image}`
uri: info.imagem
}}
style={styles.coverImage}
/>
@ -116,7 +112,7 @@ class eventDetail extends React.Component {
>
<View style={styles.timeText}>
<Text style={{ color: "#CC1A17", fontSize: 15 }}>
{`${moment(this.props.sessionDetail.SessionStart).format("HH:mm")}H - ${moment(this.props.sessionDetail.SessionEnd).format("HH:mm")}H`}
{info.hora}
</Text>
</View>
</View>
@ -130,27 +126,17 @@ class eventDetail extends React.Component {
color: "#CC1A17"
}}
>
{this.props.sessionDetail.Name}
{info.nome}
</Text>
</View>
<View style={{ margin: 10 }}>
<Progress.Bar
color={"#000000"}
progress={this.props.sessionDetail.Enrolled / this.props.sessionDetail.MaxAttendees}
height={10}
unfilledColor={"white"}
width={210}
/>
<Text>
{this.props.sessionDetail.Enrolled} / {this.props.sessionDetail.MaxAttendees}
</Text>
</View>
{this.props.sessionDetail != undefined && (
<FlatList
data={this.props.sessionDetail.Speakers}
renderItem={({ item }) => (
<View>
<View
style={{
@ -176,16 +162,16 @@ class eventDetail extends React.Component {
margin: 10
}}
>
{item.Name}
{info.nome}
</Text>
<Text style={{ marginLeft: 10 }}>
{item.MoreInfo}
{info.nome}
</Text>
<TouchableOpacity>
<Text
style={{ color: "#CC1A17", marginLeft: 10 }}
>
{item.Title}
{info.nome}
</Text>
</TouchableOpacity>
</View>
@ -202,12 +188,12 @@ class eventDetail extends React.Component {
>
Descrição do orador:
</Text>
<Text style={{ margin: 10 }}>{item.Description}</Text>
<Text style={{ margin: 10 }}>{info.desc}</Text>
</View>
</View>
)}
/>
)}
</View>
<View style={styles.block}>
@ -218,7 +204,7 @@ class eventDetail extends React.Component {
</Text>
<Divider style={{ backgroundColor: "#000" }} />
<View style={{ marginTop: 10 }}>
<Text>{this.props.sessionDetail.Description}</Text>
<Text>{info.desc}</Text>
</View>
</View>
</View>
@ -444,7 +430,6 @@ function mapStateToProps(state, props) {
token: state.apiReducer.token,
user: state.apiReducer.user,
logged: state.apiReducer.logged,
events: state.apiReducer.events,
careerPath: state.apiReducer.careerPath,
sessionDetail: state.apiReducer.sessionDetail
};

View File

@ -1,7 +1,7 @@
//MINHA API
export const GET_TEAM='GET_TEAM'
export const GET_INTERNAL_EVENTS ='GET_EVENTS'
export const GET_INTERNAL_EVENTS ='GET_INTERNAL_EVENTS'

View File

@ -57,7 +57,7 @@ export function getAllEvents(tokenInternal){
console.log(a);
dispatch({
type: GET_INTERNAL_EVENTS,
events:a.data
eventsInternal:a.data
});
})
.catch(p => {
@ -456,6 +456,7 @@ export const connectionState = status => {
};
export function removeSession(user, token, idSession) {
axios.defaults.baseURL = "https://tickets.enei.pt/internal/api";
var obj = {
IdSession: idSession,
Direction: 0
@ -544,7 +545,9 @@ export function removeSession(user, token, idSession) {
}
//inscrição em palestra através de ID
export function signSession(user, token, idSession) {
axios.defaults.baseURL = "https://tickets.enei.pt/internal/api";
var obj = {
IdSession: idSession,
Direction: 0
@ -696,6 +699,7 @@ export function getSessions(token) {
}
export function getAvailableGuestlists(token) {
axios.defaults.baseURL = "https://tickets.enei.pt/internal/api";
return dispatch => {
checkAndRefresh(token)
.then(newToken => {
@ -1023,7 +1027,9 @@ function getE(user, careerPath) {
export function getEvents(user, careerPath) {
var result = getE(user, careerPath);
console.log("putaaaaaaa")
console.log(result)
console.log("putaaaaaaa")
return dispatch => {
dispatch({
type: GET_EVENTS,

View File

@ -60,7 +60,7 @@ let apiState = {
sessionDetail:{},
team:{},
internalToken: "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIxIiwidW5pcXVlX25hbWUiOiJjZW5hIiwicm9sZSI6IkFkbWluIiwibmJmIjoxNTUyODM4NTk5LCJleHAiOjE1NTI5MjQ5OTksImlhdCI6MTU1MjgzODU5OX0.KmzDoneEdlzyaTS3N4pSuRYHkdrpTVjPFXVIB4tMKPh1BK4KtIOfqHJ_H3FsrUEkXKb_tnf38swO5SKQ1wt0cg",
events:[]
eventsInternal:[]
};
const apiReducer = (state = apiState, action) => {
@ -106,7 +106,10 @@ const apiReducer = (state = apiState, action) => {
},
token: action.payload.apiReducer.token,
team: action.payload.apiReducer.team,
events: action.payload.apiReducer.events
eventsInternal: action.payload.apiReducer.eventsInternal,
alimentacao: action.payload.apiReducer.alimentacao,
acesso: action.payload.apiReducer.acesso,
alojamento: action.payload.apiReducer.alojamento
};
}
@ -159,7 +162,7 @@ const apiReducer = (state = apiState, action) => {
});
case GET_INTERNAL_EVENTS:
return Object.assign({}, state, {
events: action.events
eventsInternal: action.eventsInternal
});
return state;
@ -195,6 +198,8 @@ const apiReducer = (state = apiState, action) => {
return state;
case GET_EVENTS:
console.log("aaaaaaqqquii")
console.log(action)
state = Object.assign({}, state, {
events: action.events,
a: action.day1,