|
@@ -5,8 +5,13 @@ import {
|
5
|
5
|
StyleSheet,
|
6
|
6
|
TouchableOpacity,
|
7
|
7
|
TextInput,
|
|
8
|
+ KeyboardAvoidingView
|
8
|
9
|
} from "react-native";
|
9
|
10
|
import { SelectList } from "react-native-dropdown-select-list";
|
|
11
|
+import {KeyboardAwareScrollView} from 'react-native-keyboard-aware-scroll-view';
|
|
12
|
+import leyesViolaciones from "./data/leyesViolaciones.json"
|
|
13
|
+import Municipalities from "./data/municipalities.json";
|
|
14
|
+
|
10
|
15
|
|
11
|
16
|
const postData = (URL, data) => {
|
12
|
17
|
fetch(URL, {
|
|
@@ -27,96 +32,112 @@ const postData = (URL, data) => {
|
27
|
32
|
};
|
28
|
33
|
|
29
|
34
|
const Drna = () => {
|
30
|
|
- const URL = "http://192.168.7.178:5001/complaints/add";
|
|
35
|
+ const URL = "http://172.20.10.2:5001/complaints/add";
|
31
|
36
|
const [name, onChangeName] = React.useState(null);
|
32
|
37
|
const [email, onChangeEmail] = React.useState(null);
|
33
|
38
|
const [place, onChangePlace] = React.useState(null);
|
34
|
39
|
const [selected, setSelected] = React.useState("");
|
35
|
40
|
const [description, onChangeDescription] = React.useState(null);
|
36
|
|
- const leyesViolaciones = [
|
37
|
|
- { key: "1", value: "Descarga de águas contaminadas" },
|
38
|
|
- { key: "2", value: "Olores objetables-fuertes" },
|
39
|
|
- { key: "3", value: "Tala y/o poda de árboles" },
|
40
|
|
- { key: "4", value: "Rellenando un bosque" },
|
41
|
|
- { key: "5", value: "Rellenando una quebrada" },
|
42
|
|
- { key: "6", value: "Realizando perforaciones en el suelo" },
|
43
|
|
- { key: "7", value: "Moviendo con maquinaria tierra de un lugar a otro" },
|
44
|
|
- { key: "8", value: "Peces y/o otros organismos muertos" },
|
45
|
|
- { key: "9", value: "Tapando la vegetación" },
|
46
|
|
- { key: "10", value: "Destrucción de humedal" },
|
47
|
|
- { key: "11", value: "Construcción sospechosa" },
|
48
|
|
- { key: "12", value: "Otros (vertederos clandestinos, entre otros)" },
|
49
|
|
- ];
|
|
41
|
+ const [location, onChangeLocation] = React.useState(null);
|
|
42
|
+ const [municipality, setMunicipality] = React.useState(null);
|
50
|
43
|
|
51
|
44
|
return (
|
52
|
|
- <View>
|
53
|
|
- <Text
|
54
|
|
- style={{
|
55
|
|
- fontSize: 30,
|
56
|
|
- textAlign: "center",
|
57
|
|
- marginTop: "20%",
|
58
|
|
- }}
|
59
|
|
- >
|
60
|
|
- Formulario DRNA
|
61
|
|
- </Text>
|
|
45
|
+ <KeyboardAwareScrollView>
|
|
46
|
+ <View>
|
|
47
|
+ <Text
|
|
48
|
+ style={{
|
|
49
|
+ fontSize: 30,
|
|
50
|
+ textAlign: "center",
|
|
51
|
+ marginTop: "20%",
|
|
52
|
+ }}
|
|
53
|
+ >
|
|
54
|
+ Formulario DRNA
|
|
55
|
+ </Text>
|
62
|
56
|
|
63
|
|
- <TextInput
|
64
|
|
- style={styles.input}
|
65
|
|
- value={name}
|
66
|
|
- onChangeText={onChangeName}
|
67
|
|
- placeholder="Nombre"
|
68
|
|
- placeholderTextColor={"grey"}
|
69
|
|
- />
|
70
|
|
- <TextInput
|
71
|
|
- style={styles.input}
|
72
|
|
- value={email}
|
73
|
|
- onChangeText={onChangeEmail}
|
74
|
|
- placeholder="Email"
|
75
|
|
- placeholderTextColor={"grey"}
|
76
|
|
- />
|
77
|
|
- {/* <TextInput
|
78
|
|
- style={styles.input}
|
79
|
|
- value={text}
|
80
|
|
- placeholder="Fecha"
|
81
|
|
- placeholderTextColor={"grey"}
|
82
|
|
- /> */}
|
83
|
|
- <SelectList
|
84
|
|
- boxStyles={styles.input}
|
85
|
|
- dropdownStyles={styles.input2}
|
86
|
|
- data={leyesViolaciones}
|
87
|
|
- setSelected={setSelected}
|
88
|
|
- placeholder="Leyes en violacion"
|
89
|
|
- />
|
90
|
|
- <TextInput
|
91
|
|
- style={styles.input}
|
92
|
|
- value={place}
|
93
|
|
- onChangeText={onChangePlace}
|
94
|
|
- placeholder="Lugar de los hechos"
|
95
|
|
- placeholderTextColor={"grey"}
|
96
|
|
- />
|
97
|
|
- <TextInput
|
98
|
|
- style={styles.input2}
|
99
|
|
- value={description}
|
100
|
|
- placeholder="Descripcion de los hechos"
|
101
|
|
- onChangeText={onChangeDescription}
|
102
|
|
- placeholderTextColor={"grey"}
|
103
|
|
- />
|
104
|
|
- <TouchableOpacity
|
105
|
|
- style={styles.button}
|
106
|
|
- onPress={() =>
|
107
|
|
- postData(URL, {
|
108
|
|
- name: name,
|
109
|
|
- email: email,
|
110
|
|
- place: place,
|
111
|
|
- complaint_status: "pending",
|
112
|
|
- complaint_type: selected.valueOf(),
|
113
|
|
- complaint_description: description,
|
114
|
|
- })
|
115
|
|
- }
|
116
|
|
- >
|
117
|
|
- <Text style={styles.text}>Someter</Text>
|
118
|
|
- </TouchableOpacity>
|
119
|
|
- </View>
|
|
57
|
+ <TextInput
|
|
58
|
+ style={styles.input}
|
|
59
|
+ value={name}
|
|
60
|
+ onChangeText={onChangeName}
|
|
61
|
+ placeholder="Nombre"
|
|
62
|
+ placeholderTextColor={"grey"}
|
|
63
|
+ />
|
|
64
|
+ <TextInput
|
|
65
|
+ style={styles.input}
|
|
66
|
+ value={email}
|
|
67
|
+ onChangeText={onChangeEmail}
|
|
68
|
+ placeholder="Email"
|
|
69
|
+ placeholderTextColor={"grey"}
|
|
70
|
+ />
|
|
71
|
+ {/* <TextInput
|
|
72
|
+ style={styles.input}
|
|
73
|
+ value={text}
|
|
74
|
+ placeholder="Fecha"
|
|
75
|
+ placeholderTextColor={"grey"}
|
|
76
|
+ /> */}
|
|
77
|
+ <SelectList
|
|
78
|
+ boxStyles={styles.input}
|
|
79
|
+ dropdownStyles={styles.input2}
|
|
80
|
+ data={
|
|
81
|
+ leyesViolaciones.map((der) => {
|
|
82
|
+ return(
|
|
83
|
+ der.value
|
|
84
|
+ )
|
|
85
|
+ })
|
|
86
|
+ }
|
|
87
|
+ setSelected={setSelected}
|
|
88
|
+ placeholder="Leyes en violacion"
|
|
89
|
+ />
|
|
90
|
+ <SelectList
|
|
91
|
+ boxStyles={styles.input}
|
|
92
|
+ dropdownStyles={styles.input2}
|
|
93
|
+ data={
|
|
94
|
+ Municipalities.map((der) => {
|
|
95
|
+ return(
|
|
96
|
+ der
|
|
97
|
+ )
|
|
98
|
+ })
|
|
99
|
+ }
|
|
100
|
+ setSelected={setMunicipality}
|
|
101
|
+ placeholder="Municipio donde ocurrio"
|
|
102
|
+ />
|
|
103
|
+ <TextInput
|
|
104
|
+ style={styles.input}
|
|
105
|
+ value={location}
|
|
106
|
+ onChangeText={onChangeLocation}
|
|
107
|
+ placeholder="Coordenadas de lo ocurrido"
|
|
108
|
+ placeholderTextColor={"grey"}
|
|
109
|
+ />
|
|
110
|
+ <TextInput
|
|
111
|
+ style={styles.input}
|
|
112
|
+ value={place}
|
|
113
|
+ onChangeText={onChangePlace}
|
|
114
|
+ placeholder="Lugar de los hechos"
|
|
115
|
+ placeholderTextColor={"grey"}
|
|
116
|
+ />
|
|
117
|
+ <TextInput
|
|
118
|
+ style={styles.input2}
|
|
119
|
+ value={description}
|
|
120
|
+ placeholder="Descripcion de los hechos"
|
|
121
|
+ onChangeText={onChangeDescription}
|
|
122
|
+ placeholderTextColor={"grey"}
|
|
123
|
+ />
|
|
124
|
+ <TouchableOpacity
|
|
125
|
+ style={styles.button}
|
|
126
|
+ onPress={() =>
|
|
127
|
+ postData(URL, {
|
|
128
|
+ name: name,
|
|
129
|
+ email: email,
|
|
130
|
+ place: place,
|
|
131
|
+ complaint_status: "pending",
|
|
132
|
+ complaint_type: selected.valueOf(),
|
|
133
|
+ complaint_description: description,
|
|
134
|
+ })
|
|
135
|
+ }
|
|
136
|
+ >
|
|
137
|
+ <Text style={styles.text}>Someter</Text>
|
|
138
|
+ </TouchableOpacity>
|
|
139
|
+ </View>
|
|
140
|
+ </KeyboardAwareScrollView>
|
120
|
141
|
);
|
121
|
142
|
};
|
122
|
143
|
|