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

Loading…
Cancel
Save