Browse Source

More SQL development

Still doesnt work but it is very close
PabloPuig1 1 year ago
parent
commit
1521bc7145
4 changed files with 139 additions and 94 deletions
  1. 7
    0
      App.js
  2. 0
    92
      screens/calendar.js
  3. 131
    0
      screens/eventSearch.js
  4. 1
    2
      screens/solicitar.js

+ 7
- 0
App.js View File

@@ -9,6 +9,7 @@ import Donate from './screens/donar';
9 9
 import Solicitar from './screens/solicitar';
10 10
 import Account from './screens/account';
11 11
 import Header from './shared/header';
12
+import EventSearch from './screens/eventSearch';
12 13
 
13 14
 const screens = {
14 15
   About: {
@@ -81,6 +82,12 @@ export default function App() {
81 82
               headerTitle: () => <Header navigation={navigation}/>,
82 83
           }
83 84
         }}/>    
85
+        <Drawer.Screen name="Event Search" component={EventSearch} 
86
+        options={({navigation}) => {
87
+          return {
88
+              headerTitle: () => <Header navigation={navigation}/>,
89
+          }
90
+        }}/> 
84 91
       </Drawer.Navigator>
85 92
     </NavigationContainer>
86 93
   );

+ 0
- 92
screens/calendar.js View File

@@ -15,95 +15,3 @@ const styles = StyleSheet.create({
15 15
         padding: 24
16 16
     }
17 17
 });
18
-    // constructor(props)
19
-    // {
20
-    //     super(props);
21
-    //     this.state={eid:'',name:'',Sdate:'',Edate:'',Pcount:'',Plimit:'',description:''};
22
-    // }
23
-    // SearchDB=()=>
24
-    // {
25
-    //     var findeid=this.state.eid;
26
-
27
-    //     if(eid.length==0)
28
-    //     {
29
-    //         alert('required filed');
30
-    //     }
31
-    //     else{
32
-    //         var searchAPIURL='https://ada.uprrp.edu/~pablo.puig1/TPMG/React.php'
33
-
34
-    //         var header={
35
-    //                 'Accept':'application/json',
36
-    //                 'Content-Type':'application/json'
37
-    //         };
38
-
39
-    //         var Data={
40
-    //             eid:eid
41
-    //         };
42
-
43
-    //         fetch(
44
-    //             searchAPIURL,
45
-    //             {
46
-    //                 method:'POST',
47
-    //                 headers:header,
48
-    //                 body: JSON.stringify(Data)
49
-    //             }
50
-    //         )
51
-    //         .then((response)=>response.json())
52
-    //         .then((response)=>
53
-    //         {
54
-    //             this.setState({eid:response[0].eid});
55
-    //             this.setStare({name:response[0].name});
56
-    //             this.setState({Sdate:response[0].Sdate});
57
-    //             this.setState({Edate:response[0].Edate});
58
-    //             this.setState({Pcount:response[0].Pcount});
59
-    //             this.setState({Plimit:response[0].Plimit});
60
-    //             this.setState({description:response[0].description});
61
-    //         })
62
-    //         .catch((error)=>
63
-    //         {
64
-    //             alert("ERROR: "+ error);
65
-    //         })
66
-    //     }
67
-    // }
68
-    // render()
69
-    // {
70
-    //     return(
71
-    //         <View style={styles.viewStyle}>
72
-    //                 <TextInput
73
-    //                     placeholder={""}
74
-    //                     style={styles.txtStyle}
75
-    //                 />
76
-    //                 <TextInput
77
-    //                     style={styles.txtStyle}
78
-    //                     value={this.state.eid.toString()}
79
-    //                 />
80
-    //                 <TextInput
81
-    //                     style={styles.txtStyle}
82
-    //                     value={this.state.name.toString()}
83
-    //                 />
84
-    //                 <TextInput
85
-    //                     style={styles.txtStyle}
86
-    //                     value={this.state.Sdate.toString()}
87
-    //                 />
88
-    //                 <TextInput
89
-    //                     style={styles.txtStyle}
90
-    //                     value={this.state.Edate.toString()}
91
-    //                 />
92
-    //                 <TextInput
93
-    //                     style={styles.txtStyle}
94
-    //                     value={this.state.Pcount.toString()}
95
-    //                 />
96
-    //                 <TextInput
97
-    //                     style={styles.txtStyle}
98
-    //                     value={this.state.Plimit.toString()}
99
-    //                 />
100
-    //                 <TextInput
101
-    //                     style={styles.txtStyle}
102
-    //                     value={this.state.description.toString()}
103
-    //                 />
104
-
105
-
106
-    //         </View>
107
-
108
-    //     );
109
-    // }

+ 131
- 0
screens/eventSearch.js View File

@@ -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
+});

+ 1
- 2
screens/solicitar.js View File

@@ -1,5 +1,5 @@
1 1
 import * as React from 'react';
2
-import { StyleSheet, View, Text, Button, Linking } from 'text-native-paper';
2
+import { StyleSheet, View, Text, Button, Linking } from 'react-native';
3 3
 import Header from '../shared/header';
4 4
 // import '../shared/routes.js';
5 5
 
@@ -8,7 +8,6 @@ export default function Solicitar({navigation}) {
8 8
         <View style={styles.container}>
9 9
             <Text>Solicitar Screen{"\n\n"}</Text>
10 10
                 <Button
11
-                    mode="contained"
12 11
                     onPress={ () => {Linking.openURL("https://forms.gle/SciwvAdF3TAE6hE97")}}
13 12
                     title="Solicita Ayuda"
14 13
                     accessibilityLable="Solicitar presionando el botón"