Browse Source

adding user's nickname and institution to the modal screen

master
analuizaff 3 years ago
parent
commit
f65af4f27b
  1. 15
      src/app/components/AssembleModalObject.js

15
src/app/components/AssembleModalObject.js

@ -138,14 +138,14 @@ async function getPluviometerStatio_informations(id) {
const result = await getFieldsAnswers.fieldsAnswers(null, id);
if (result.data) {
return result.data.responseData.array_to_json[0].array_to_json;
return result.data.responseData.array_to_json[0];
}
return null;
}
const AssembleModalObject = async (response, name, userId, formId) => {
// console.log(response);
var situation = null;
var user = null;
var institution = null;
@ -163,8 +163,10 @@ const AssembleModalObject = async (response, name, userId, formId) => {
if (name == "pluviometer") {
situation = "PLUVIÔMETRO";
const pluv_sation = await getPluviometerStatio_informations(formId);
// console.log(pluv_sation);
if (pluv_sation) {
pluv_sation.forEach((field) => {
user = pluv_sation.formsanswersuserinformernickname
pluv_sation.array_to_json.forEach((field) => {
if (field.fieldname == "institutename") {
institution =
field.fieldsanswersvalue != "None"
@ -207,6 +209,7 @@ const AssembleModalObject = async (response, name, userId, formId) => {
}
} else if (JSON.parse(response).array_to_json) {
const r = JSON.parse(response).array_to_json;
//console.log(r[0].formsanswersuserinformernickname);
if (name == "automaticPluviometer") {
situation = "PLUVIÔMETRO";
r[0].array_to_json.forEach(function (f) {
@ -252,7 +255,9 @@ const AssembleModalObject = async (response, name, userId, formId) => {
// console.log(datapluv);
} else {
if (r[0].array_to_json) {
user = r[0].formsanswersuserinformer;
user = r[0].formsanswersuserinformernickname;
institution = r[0].formsanswersuserinformerinstitution;
r[0].array_to_json.forEach(function (f) {
if (f.fieldname == "situation") {
situation = f.fieldsanswersvalue;
@ -282,7 +287,7 @@ const AssembleModalObject = async (response, name, userId, formId) => {
return {
name: name,
title: _title,
user: null,
user: user,
institution: institution,
address: address,
date: date + " | " + time,

Loading…
Cancel
Save