Browse Source

preparing structure to add registered pluviometers to the API

master
analuizaff 3 years ago
parent
commit
6d9381378f
  1. 31
      src/app/components/forms/AssembleIngestionObject.js
  2. 3
      src/app/screens/PluviometerRegisterScreen.js

31
src/app/components/forms/AssembleIngestionObject.js

@ -64,4 +64,33 @@ const AssembleIngestionPluviometer = ({
},
};
};
export { AssembleIngestionObject, AssembleIngestionPluviometer };
const AssembleIngestionPluvRegistration = ({date, time, user}) => {
const pluvResgistrationObject = {
responseData: {
array_to_json: [
{
formcode: "PLUVIOMETER_REGISTRATION",
formsanswersuserinformer: "admin@wpd.com", //user
fieldsanswerslongitude: -46.5637, //location["longitude"],
fieldsanswerslatitude: -23.6230,//location["latitude"],
fields: [
{
fieldsanswerseventaddress: "Rua Rio de Janeiros, 81",//address
fieldsanswerseventdate: moment(date).format("DD-MM-YYYY"),
fieldsanswerseventtime: moment(time).format("HH:mm"),
fieldsanswersinstitutename: "E. E. Vagner",
fieldsanswerrinstitutetype: "Escola",
},
],
},
],
},
};
const a = sendFormAnswer(ingestionObject);
};
export {
AssembleIngestionObject,
AssembleIngestionPluviometer,
AssembleIngestionPluvRegistration,
};

3
src/app/screens/PluviometerRegisterScreen.js

@ -11,6 +11,7 @@ import { TouchableOpacity } from "react-native-gesture-handler";
import { FontAwesome5 } from "@expo/vector-icons";
import { AuthContext } from "../auth/context";
import { Shadow } from "react-native-shadow-2";
import { AssembleIngestionPluvRegistration } from "../components/forms/AssembleIngestionObject";
const dims = scaleDimsFromWidth(85, 85, 25);
@ -101,7 +102,7 @@ function PluviometerRegisterScreen(props) {
duration: 1950,
icon: "warning",
type: "warning",
onPress: () => {},
onPress: () => {AssembleIngestionPluvRegistration(date, time, user)},
});
}}
>

Loading…
Cancel
Save