diff --git a/src/app/database/databaseLoader.js b/src/app/database/databaseLoader.js
index 22b59dd..2aa06aa 100644
--- a/src/app/database/databaseLoader.js
+++ b/src/app/database/databaseLoader.js
@@ -18,8 +18,8 @@ function transaction(db, query, values) {
});
}
-function insertFloodZone({ images, description, passable, location }) {
- const query = `INSERT INTO FloodZones(Description, Images, Latitude, Longitude, Passable) VALUES(?, ?, ?, ?, ?);`;
+function insertFloodZone({ images, description, passable, location, date, time }) {
+ const query = `INSERT INTO FloodZones(Description, Images, Latitude, Longitude, Passable, Date, Time) VALUES(?, ?, ?, ?, ?, ?, ?);`;
if (location === undefined) {
console.debug("undefined location");
return;
@@ -31,6 +31,8 @@ function insertFloodZone({ images, description, passable, location }) {
parseFloat(location["latitude"]),
parseFloat(location["longitude"]),
parseInt(passable),
+ moment(date).format("DD/MM/YYYY"),
+ moment(time).format("HH:MM"),
];
transaction(global.userDataBase, query, values);
@@ -55,8 +57,8 @@ function insertPluviometerData({ pluviometer, images, dateTime, time, location }
transaction(global.userDataBase, query, values);
}
-function insertRainData({ images, description, rain, location }) {
- const query = `INSERT INTO RainLevel(RainIdx, Description, Images, Latitude, Longitude) VALUES(?, ?, ?, ?, ?);`;
+function insertRainData({ images, description, rain, location, date, time }) {
+ const query = `INSERT INTO RainLevel(RainIdx, Description, Images, Latitude, Longitude, Date, Time) VALUES(?, ?, ?, ?, ?, ?, ?);`;
if (location === undefined) {
console.debug("undefined location");
@@ -65,10 +67,12 @@ function insertRainData({ images, description, rain, location }) {
const values = [
parseInt(rain),
- description,
+ description,
JSON.stringify(images),
parseFloat(location["latitude"]),
parseFloat(location["longitude"]),
+ moment(date).format("DD/MM/YYYY"),
+ moment(time).format("HH:MM"),
];
console.log(values);
@@ -76,8 +80,8 @@ function insertRainData({ images, description, rain, location }) {
transaction(global.userDataBase, query, values);
}
-function insertRiverData({ images, description, riverScale, location }) {
- const query = `INSERT INTO RiverLevel(RiverIdx, Description, Images, Latitude, Longitude) VALUES(?, ?, ?, ?, ?);`;
+function insertRiverData({ images, description, riverScale, location, date, time }) {
+ const query = `INSERT INTO RiverLevel(RiverIdx, Description, Images, Latitude, Longitude, Date, Time) VALUES(?, ?, ?, ?, ?, ?, ?);`;
if (location === undefined) {
console.debug("undefined location");
@@ -90,6 +94,8 @@ function insertRiverData({ images, description, riverScale, location }) {
JSON.stringify(images),
parseFloat(location["latitude"]),
parseFloat(location["longitude"]),
+ moment(date).format("DD/MM/YYYY"),
+ moment(time).format("HH:MM"),
];
console.log(values);
diff --git a/src/app/screens/RainSharingDataScreen.js b/src/app/screens/RainSharingDataScreen.js
index 2dc6672..04d3ed9 100644
--- a/src/app/screens/RainSharingDataScreen.js
+++ b/src/app/screens/RainSharingDataScreen.js
@@ -34,7 +34,7 @@ function RainSharingDataScreen(props) {
const [error, setError] = useState(false);
const location = useLocation();
- const [dateTime, setDateTime] = useState(moment());
+ const [date, setDate] = useState(moment());
const [time, setTime] = useState(moment());
return (
@@ -60,13 +60,13 @@ function RainSharingDataScreen(props) {
setError(true);
return;
}
- insertRainData({ ...values, rain, location });
+ insertRainData({ ...values, rain, location, date, time });
showMessage({
message: "Informação enviada!",
duration: 1950,
icon: "success",
type: "success",
- onPress: () => {},
+ onPress: () => { },
});
props.navigation.navigate("Home");
}}
@@ -171,13 +171,15 @@ function RainSharingDataScreen(props) {
borderWidth: 3,
}}
defaultDate={new Date()}
- onDateChange={(value) => setDateTime(value)}
+ onDateChange={(value) => setDate(value)}
onTimeChange={(value) => setTime(value)}
/>
{/*Local do evento:*/}
-
+ props.navigation.navigate("FormMap")}>
+
+
diff --git a/src/app/screens/RiverFloodSharingDataScreen.js b/src/app/screens/RiverFloodSharingDataScreen.js
index a9f5654..0e05af9 100644
--- a/src/app/screens/RiverFloodSharingDataScreen.js
+++ b/src/app/screens/RiverFloodSharingDataScreen.js
@@ -35,7 +35,7 @@ function RiverFloodSharingDataScreen(props) {
const location = useLocation();
const [error, setError] = useState(false);
- const [dateTime, setDateTime] = useState(moment());
+ const [date, setDate] = useState(moment());
const [time, setTime] = useState(moment());
const dims = scaleDimsFromWidth(85, 85, 30);
@@ -66,7 +66,7 @@ function RiverFloodSharingDataScreen(props) {
setError(true);
return;
}
- insertRiverData({ ...values, riverScale, location });
+ insertRiverData({ ...values, riverScale, location, date, time });
showMessage({
message: "Informação enviada!",
duration: 1950,
@@ -146,7 +146,7 @@ function RiverFloodSharingDataScreen(props) {
borderWidth: 3,
}}
defaultDate={new Date()}
- onDateChange={(value) => setDateTime(value)}
+ onDateChange={(value) => setDate(value)}
onTimeChange={(value) => setTime(value)}
/>
diff --git a/src/app/screens/SharingFloodZonesScreen.js b/src/app/screens/SharingFloodZonesScreen.js
index 06794e0..87790d3 100644
--- a/src/app/screens/SharingFloodZonesScreen.js
+++ b/src/app/screens/SharingFloodZonesScreen.js
@@ -7,7 +7,7 @@ import FormImagePicker from "../components/forms/FormImagePicker";
import useLocation from "../hooks/useLocation";
import colors from "../config/colors";
import { scaleDimsFromWidth, dimensions } from "../config/dimensions";
-import { TouchableNativeFeedback } from "react-native-gesture-handler";
+import { TouchableNativeFeedback, TouchableOpacity } from "react-native-gesture-handler";
import { insertFloodZone } from "../database/databaseLoader";
import { showMessage } from "react-native-flash-message";
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
@@ -32,7 +32,7 @@ function SharingFloodZonesScreen(props) {
const [error, setError] = useState(false);
const location = useLocation();
- const [dateTime, setDateTime] = useState(moment());
+ const [date, setDate] = useState(moment());
const [time, setTime] = useState(moment());
return (
@@ -62,7 +62,9 @@ function SharingFloodZonesScreen(props) {
setError(true);
return;
}
- submitForm({ ...values, passable, location });
+ submitForm({ ...values, passable, location, date, time });
+ console.log("DATA: " + moment(date).format("DD/MM/YYYY"));
+ console.log("HORA: " + moment(time).format("HH:MM"));
showMessage({
message: "Informação enviada!",
duration: 1950,
@@ -116,13 +118,15 @@ function SharingFloodZonesScreen(props) {
borderWidth: 3,
}}
defaultDate={new Date()}
- onDateChange={(value) => setDateTime(value)}
+ onDateChange={(value) => setDate(value)}
onTimeChange={(value) => setTime(value)}
/>
{/*Local do evento:*/}
-
+ props.navigation.navigate("FormMap")}>
+
+