123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- import { alignProperty } from '@mui/material/styles/cssUtils';
- import React,{Component} from 'react';
- import {View, Text, TextInput, Button, StyleSheet} from 'react-native';
-
-
- export default class EventSearch extends Component
- {
- constructor(props)
- {
- super(props);
- this.state={UID:'',acc_type:'',name:'',email:'',phone:''};
- }
- SearchEvent=()=>
- {
- var UID=this.state.UID;
-
- if(UID.length==0)
- {
- alert('Field is blank');
- }
- else
- {
- var SearchAPIURL="https://ada.uprrp.edu/~pablo.puig1/TPMG/testusersearch.php";
-
- var header={
- 'Accept':'application/json',
- 'Content-Type':'application/json'
- };
-
- var Data={
- UID:UID
- };
-
- fetch(
- SearchAPIURL,
- {
- method:'POST',
- headers:header,
- body: JSON.stringify(Data)
- }
- )
-
- .then((response)=>response.json())
- // .then(console.log(response))
- .then((response)=>
- {
- this.setState({UID:response[0].id});
- this.setState({acc_type:response[0].acc_type});
- this.setState({name:response[0].name});
- this.setState({email:response[0].email});
- this.setState({phone:response[0].phone});
- })
- .catch((error)=>
- {
- alert("Error: " + error);
- })
- }
-
- }
- render()
- {
- return(
- <View style={styles.viewSyle}>
- <TextInput
- placeholder={"Enter UID"}
- placeholderTextColor={"red"}
- keyboardType={"numeric"}
- style={styles.txtStyle}
- onChangeText={UID=>this.setState({UID})}
- />
- <Button
- title={"Find Event"}
- onPress={this.SearchEvent}
- />
- <Text>{"\n\n"}</Text>
- <TextInput
- style={styles.txtStyle}
- value={this.state.UID}
- />
-
- <TextInput
- style={styles.txtStyle}
- value={this.state.acc_type}
- />
-
- <TextInput
- style={styles.txtStyle}
- value={this.state.name}
- />
-
- <TextInput
- style={styles.txtStyle}
- value={this.state.email}
- />
-
- <TextInput
- style={styles.txtStyle}
- value={this.state.phone}
- />
-
- </View>
-
- );
- }
- }
- const styles=StyleSheet.create({
- viewSyle:
- {
- flex:1,
- padding:1,
- marginTop:90
-
- },
- txtStyle:
- {
- borderBottomWidth:1,
- borderBottonColor:'red',
- marginBottom:20
- }
-
- });
|