|
|
@ -1,9 +1,10 @@ |
|
|
|
import moment from "moment"; |
|
|
|
import React from "react"; |
|
|
|
import sendFormAnswer from "../../api/Ingestion/sendFormAnswer"; |
|
|
|
|
|
|
|
|
|
|
|
const AssembleIngestionObject = ( |
|
|
|
{ images, description }, |
|
|
|
user, |
|
|
|
situation, |
|
|
|
code, |
|
|
|
location, |
|
|
@ -16,7 +17,7 @@ const AssembleIngestionObject = ( |
|
|
|
array_to_json: [ |
|
|
|
{ |
|
|
|
formcode: code, |
|
|
|
formsanswersuserinformer: "admin@wpd.com", |
|
|
|
formsanswersuserinformer: user.id, |
|
|
|
fieldsanswerslongitude: location["longitude"], |
|
|
|
fieldsanswerslatitude: location["latitude"], |
|
|
|
fields: [ |
|
|
@ -39,6 +40,7 @@ const AssembleIngestionPluviometer = ({ |
|
|
|
pluviometer, |
|
|
|
description, |
|
|
|
images, |
|
|
|
user, |
|
|
|
date, |
|
|
|
time, |
|
|
|
}) => { |
|
|
@ -47,7 +49,7 @@ const AssembleIngestionPluviometer = ({ |
|
|
|
array_to_json: [ |
|
|
|
{ |
|
|
|
formcode: "PLUVIOMETERS_FORM", |
|
|
|
formsanswersuserinformer: "admin@wpd.com", |
|
|
|
formsanswersuserinformer: user.id, |
|
|
|
fias: [ |
|
|
|
{ |
|
|
|
fieldsanswersdate: moment(date).format("DD-MM-YYYY"), |
|
|
@ -62,29 +64,31 @@ const AssembleIngestionPluviometer = ({ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
const AssembleIngestionPluvRegistration = ({ date, time, user }) => { |
|
|
|
const AssembleIngestionPluvRegistration = ( date, time, user, address, coordinates ) => { |
|
|
|
console.log(user); |
|
|
|
console.log(coordinates); |
|
|
|
const pluvResgistrationObject = { |
|
|
|
responseData: { |
|
|
|
array_to_json: [ |
|
|
|
{ |
|
|
|
formcode: "PLUVIOMETER_REGISTRATION", |
|
|
|
formsanswersuserinformer: "admin@wpd.com", //user
|
|
|
|
fieldsanswerslongitude: -46.5637, //location["longitude"],
|
|
|
|
fieldsanswerslatitude: -23.623, //location["latitude"],
|
|
|
|
formsanswersuserinformer: user.id, |
|
|
|
fieldsanswerslongitude: coordinates["longitude"], |
|
|
|
fieldsanswerslatitude: coordinates["latitude"], |
|
|
|
fields: [ |
|
|
|
{ |
|
|
|
fieldsanswerseventaddress: "Rua Rio de Janeiros, 81", //address
|
|
|
|
fieldsanswerseventaddress: address, |
|
|
|
fieldsanswerseventdate: moment(date).format("DD-MM-YYYY"), |
|
|
|
fieldsanswerseventtime: moment(time).format("HH:mm"), |
|
|
|
fieldsanswersinstitutename: "E. E. Vagner", |
|
|
|
fieldsanswerrinstitutetype: "Escola", |
|
|
|
fieldsanswersinstitutename: user.institutionName ? user.institutionName : null, |
|
|
|
fieldsanswerrinstitutetype: user.institutionType ? user.institutionType : null |
|
|
|
}, |
|
|
|
], |
|
|
|
}, |
|
|
|
], |
|
|
|
}, |
|
|
|
}; |
|
|
|
const a = sendFormAnswer(ingestionObject); |
|
|
|
const a = sendFormAnswer(pluvResgistrationObject); |
|
|
|
}; |
|
|
|
export { |
|
|
|
AssembleIngestionObject, |
|
|
|