|
@@ -0,0 +1,131 @@
|
|
1
|
+import { alignProperty } from '@mui/material/styles/cssUtils';
|
|
2
|
+import React,{Component} from 'react';
|
|
3
|
+import {View, Text, TextInput, Button, StyleSheet} from 'react-native';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+export default class EventSearch extends Component
|
|
7
|
+{
|
|
8
|
+ constructor(props)
|
|
9
|
+ {
|
|
10
|
+ super(props);
|
|
11
|
+ this.state={EID:'',Name:'',Sdate:'',Edate:'',Pcount:'',Plimit:'',Description:''};
|
|
12
|
+ }
|
|
13
|
+ SearchEvent=()=>
|
|
14
|
+ {
|
|
15
|
+ var EID=this.state.EID;
|
|
16
|
+
|
|
17
|
+ if(EID.length==0)
|
|
18
|
+ {
|
|
19
|
+
|
|
20
|
+ alert('Field is blank');
|
|
21
|
+ }
|
|
22
|
+ else
|
|
23
|
+ {
|
|
24
|
+ var SearchAPIURL="https://ada.uprrp.edu/~pablo.puig1/TPMG/React.php";
|
|
25
|
+
|
|
26
|
+ var header={
|
|
27
|
+ 'Accept':'application/json',
|
|
28
|
+ 'Content-Type':'application/json'
|
|
29
|
+ };
|
|
30
|
+
|
|
31
|
+ var Data={
|
|
32
|
+ EID:EID
|
|
33
|
+ };
|
|
34
|
+
|
|
35
|
+ fetch(
|
|
36
|
+ SearchAPIURL,
|
|
37
|
+ {
|
|
38
|
+ method:'POST',
|
|
39
|
+ headers:header,
|
|
40
|
+ body: JSON.stringify(Data)
|
|
41
|
+ }
|
|
42
|
+ )
|
|
43
|
+ .then((response)=>response.json())
|
|
44
|
+ .then((response)=>
|
|
45
|
+ {
|
|
46
|
+ this.setState({EID:response[0].EID});
|
|
47
|
+ this.setState({Name:response[0].Name});
|
|
48
|
+ this.setState({Sdate:response[0].Sdate});
|
|
49
|
+ this.setState({Edate:response[0].Edate});
|
|
50
|
+ this.setState({Pcount:response[0].Pcount});
|
|
51
|
+ this.setState({Plimit:response[0].Plimit});
|
|
52
|
+ this.setState({Description:response[0].Description});
|
|
53
|
+ })
|
|
54
|
+ .catch((error)=>
|
|
55
|
+ {
|
|
56
|
+ alert("Error: " + error);
|
|
57
|
+ })
|
|
58
|
+ }
|
|
59
|
+
|
|
60
|
+ }
|
|
61
|
+ render()
|
|
62
|
+ {
|
|
63
|
+ return(
|
|
64
|
+ <View style={styles.viewSyle}>
|
|
65
|
+ <TextInput
|
|
66
|
+ placeholder={"Enter EID"}
|
|
67
|
+ placeholderTextColor={"red"}
|
|
68
|
+ keyboardType={"numeric"}
|
|
69
|
+ style={styles.txtStyle}
|
|
70
|
+ onChangeText={EID=>this.setState({EID})}
|
|
71
|
+ />
|
|
72
|
+ <Button
|
|
73
|
+ title={"Find Event"}
|
|
74
|
+ onPress={this.SearchEvent}
|
|
75
|
+ />
|
|
76
|
+ <TextInput
|
|
77
|
+ style={styles.txtStyle}
|
|
78
|
+ value={this.state.EID}
|
|
79
|
+ />
|
|
80
|
+
|
|
81
|
+ <TextInput
|
|
82
|
+ style={styles.txtStyle}
|
|
83
|
+ value={this.state.Name}
|
|
84
|
+ />
|
|
85
|
+
|
|
86
|
+ <TextInput
|
|
87
|
+ style={styles.txtStyle}
|
|
88
|
+ value={this.state.Sdate}
|
|
89
|
+ />
|
|
90
|
+
|
|
91
|
+ <TextInput
|
|
92
|
+ style={styles.txtStyle}
|
|
93
|
+ value={this.state.Edate}
|
|
94
|
+ />
|
|
95
|
+
|
|
96
|
+ <TextInput
|
|
97
|
+ style={styles.txtStyle}
|
|
98
|
+ value={this.state.Pcount}
|
|
99
|
+ />
|
|
100
|
+
|
|
101
|
+ <TextInput
|
|
102
|
+ style={styles.txtStyle}
|
|
103
|
+ value={this.state.Plimit}
|
|
104
|
+ />
|
|
105
|
+
|
|
106
|
+ <TextInput
|
|
107
|
+ style={styles.txtStyle}
|
|
108
|
+ value={this.state.Description}
|
|
109
|
+ />
|
|
110
|
+
|
|
111
|
+ </View>
|
|
112
|
+
|
|
113
|
+ );
|
|
114
|
+ }
|
|
115
|
+}
|
|
116
|
+const styles=StyleSheet.create({
|
|
117
|
+ viewSyle:
|
|
118
|
+ {
|
|
119
|
+ flex:1,
|
|
120
|
+ padding:1,
|
|
121
|
+ marginTop:90
|
|
122
|
+
|
|
123
|
+ },
|
|
124
|
+ txtStyle:
|
|
125
|
+ {
|
|
126
|
+ borderBottomWidth:1,
|
|
127
|
+ borderBottonColor:'red',
|
|
128
|
+ marginBottom:20
|
|
129
|
+ }
|
|
130
|
+
|
|
131
|
+});
|