You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

86 lines
2.3 KiB

import moment from 'moment';
import React from 'react'
import { View, Text } from 'react-native'
function getLogo(name, situation) {
if (name == "automaticPluviometer") {
return custom_assets.officialPluviometer;
}
if (name == "pluviometer") {
return custom_assets.pluviometer;
}
if (name == "rain") {
if (situation == "sem chuva") {
return custom_assets.rainLevel[0];
} else if (situation == "chuva fraca") {
return custom_assets.rainLevel[1];
} else if (situation == "chuva moderada") {
return custom_assets.rainLevel[2];
} else if (situation == "chuva forte") {
return custom_assets.rainLevel[3];
} else {
return custom_assets.rainLevel[3];
}
}
if (name == "riverFlood") {
if (situation == "baixo") {
return custom_assets.riverLevel[0];
} else if (situation == "normal") {
return custom_assets.riverLevel[1];
} else if (situation == "alto") {
return custom_assets.riverLevel[2];
} else if (situation == "inundar") {
return custom_assets.riverLevel[3];
}
return custom_assets.riverLevel[0];
}
if (name == "floodZones") {
return custom_assets.floodZones;
}
}
const AssembleModalObject = (response, name) => {
const r = JSON.parse(response);
var situation = null;
var address = null;
var date = null;
var time = null;
var comments = null;
var pictures = null;
if (r[0].array_to_json) {
r[0].array_to_json.forEach(function (f) {
if (f.fieldname == "situation") {
situation = f.fieldsanswersvalue;
}
if (f.fieldname == "eventaddress") {
address = f.fieldsanswersvalue;
}
if (f.fieldname == "eventdate") {
date = f.fieldsanswersvalue;
}
if (f.fieldname == "eventtime") {
time = f.fieldsanswersvalue;
}
if (f.fieldname == "comments") {
comments = f.fieldsanswersvalue;
}
});
}
return {
"name": name,
"title": situation,
"address": address,
"date": date + " | " + time,
"description": comments,
"logo": getLogo(),
"pictures": pictures,
};
}
export default AssembleModalObject