diff --git a/src/app/components/LoadingMarkersModal.js b/src/app/components/LoadingMarkersModal.js
index 9ee53b1..eff0cb5 100644
--- a/src/app/components/LoadingMarkersModal.js
+++ b/src/app/components/LoadingMarkersModal.js
@@ -3,9 +3,8 @@ import {
Modal,
StyleSheet,
Text,
- TouchableHighlight,
- View,
TouchableOpacity,
+ View,
} from "react-native";
import { MaterialCommunityIcons } from "@expo/vector-icons";
diff --git a/src/app/components/forms/AssembleIngestionObject.js b/src/app/components/forms/AssembleIngestionObject.js
index 619e05e..1cfa82f 100644
--- a/src/app/components/forms/AssembleIngestionObject.js
+++ b/src/app/components/forms/AssembleIngestionObject.js
@@ -1,7 +1,7 @@
import moment from "moment";
import sendFormAnswer from "../../api/Ingestion/sendFormAnswer";
-const AssembleIngestionObject = (
+async function AssembleIngestionObject(
{ images, description },
user,
situation,
@@ -10,7 +10,7 @@ const AssembleIngestionObject = (
date,
time,
address
-) => {
+) {
const ingestionObject = {
responseData: {
array_to_json: [
@@ -33,9 +33,9 @@ const AssembleIngestionObject = (
},
};
- const a = sendFormAnswer(ingestionObject);
-};
-const AssembleIngestionPluviometer = ({
+ return sendFormAnswer(ingestionObject);
+}
+const AssembleIngestionPluviometer = async ({
pluviometer,
description,
images,
@@ -70,8 +70,6 @@ async function AssembleIngestionPluvRegistration(
address,
coordinates
) {
- console.log(user);
- console.log(coordinates);
const pluvResgistrationObject = {
responseData: {
array_to_json: [
diff --git a/src/app/components/forms/OnSubmitAwaitModal.js b/src/app/components/forms/OnSubmitAwaitModal.js
new file mode 100644
index 0000000..8258aa2
--- /dev/null
+++ b/src/app/components/forms/OnSubmitAwaitModal.js
@@ -0,0 +1,61 @@
+import React, { useState } from "react";
+import { Modal, StyleSheet, Text, TouchableOpacity, View } from "react-native";
+import colors from "../../config/colors";
+
+import { MaterialCommunityIcons } from "@expo/vector-icons";
+import { dimensions, screen_height } from "../../config/dimensions";
+
+const OnSubmitAwaitModal = ({ show }) => {
+ if(show){
+ return (
+
+
+
+
+ Aguarde um momento. Estamos enviando o formulário.
+
+
+
+
+ );
+ }else{
+ return(
+ <>>
+ );
+ }
+};
+
+const styles = StyleSheet.create({
+ container: {
+ position: "absolute",
+ width: "80%",
+ height: 170,
+ // justifyContent: "center",
+ alignSelf: "center",
+ backgroundColor: colors.lightestGray,
+ borderColor: colors.primary,
+ borderWidth: 2,
+ borderRadius: 12,
+ padding: 12,
+ },
+ text: {
+ fontSize: dimensions.text.secondary,
+ textAlign: "center",
+ color: colors.primary,
+ fontWeight: "bold",
+ },
+});
+
+export default OnSubmitAwaitModal;
diff --git a/src/app/components/forms/OnSubmitMessageModal.js b/src/app/components/forms/OnSubmitMessageModal.js
new file mode 100644
index 0000000..de60da4
--- /dev/null
+++ b/src/app/components/forms/OnSubmitMessageModal.js
@@ -0,0 +1,93 @@
+import React, { useState } from "react";
+import { Modal, StyleSheet, Text, TouchableOpacity, View } from "react-native";
+import colors from "../../config/colors";
+
+import { AntDesign } from "@expo/vector-icons";
+import { MaterialCommunityIcons } from "@expo/vector-icons";
+import { dimensions, screen_height } from "../../config/dimensions";
+import ConfirmationModal from "../ConfirmationModal";
+
+function OnSubmitMessageModal({ show, setShow, sucess, navigation }){
+const onModalClose = () =>{
+ setShow(false);
+ navigation.navigate("Home");
+}
+ if (show) {
+ return (
+
+
+
+ {!sucess && (
+
+
+
+ Erro ao enviar informação. Por favor, tente mais tarde!
+
+
+ )}
+ {sucess && (
+
+
+ Informação enviada com sucesso!
+
+ )}
+
+
+ onModalClose()}>OK
+
+
+
+ );
+ } else {
+ return <>>;
+ }
+};
+
+const styles = StyleSheet.create({
+ container: {
+ flex: 1,
+ position: "absolute",
+ width: "80%",
+ height: 170,
+ // justifyContent: "center",
+ alignSelf: "center",
+ backgroundColor: colors.lightestGray,
+ borderColor: colors.primary,
+ borderWidth: 2,
+ borderRadius: 12,
+ padding: 12,
+ },
+ text: {
+ fontSize: dimensions.text.secondary,
+ textAlign: "center",
+ color: colors.black,
+ fontWeight: "bold",
+ alignSelf: "center",
+ },
+ btn: {
+ fontSize: dimensions.text.secondary,
+ textAlign: "right",
+ alignContent: "center",
+ color: colors.primary,
+ fontWeight: "bold",
+ },
+});
+
+export default OnSubmitMessageModal;
diff --git a/src/app/screens/PluviometerRegisterScreen.js b/src/app/screens/PluviometerRegisterScreen.js
index 1f2deaa..7ea7da6 100644
--- a/src/app/screens/PluviometerRegisterScreen.js
+++ b/src/app/screens/PluviometerRegisterScreen.js
@@ -12,6 +12,8 @@ import { FontAwesome5 } from "@expo/vector-icons";
import { AuthContext } from "../auth/context";
import { Shadow } from "react-native-shadow-2";
import { AssembleIngestionPluvRegistration } from "../components/forms/AssembleIngestionObject";
+import OnSubmitAwaitModal from "../components/forms/OnSubmitAwaitModal";
+import OnSubmitMessageModal from "../components/forms/OnSubmitMessageModal";
const dims = scaleDimsFromWidth(85, 85, 25);
@@ -114,45 +116,50 @@ function PluviometerRegisterScreen(props) {
const [coordinates, setCoordinates] = useState(null);
const { user, _ } = useContext(AuthContext);
+ const [showAwaitModal, setShowAwaitModal] = useState(false);
+ const [showMessageModal, setShowMessageModal] = useState(false);
+ const [apiMessage, setApiMessage] = useState(null);
+
+ const sendForm = async (date,
+ time,
+ user,
+ address,
+ coordinates) => {
+ const isSent = await AssembleIngestionPluvRegistration(date,
+ time,
+ user,
+ address,
+ coordinates);
+ if (isSent) {
+ setApiMessage(isSent.ok);
+ }
+
+ return apiMessage;
+ };
+
return (
+
+