Update on view report

This commit is contained in:
Jack 2019-02-23 14:40:30 -08:00
parent b58fff8888
commit 59056b3062

View file

@ -469,14 +469,6 @@ function displayReport(parsedData){
const cardBody = document.createElement("div");
cardBody.classList.add("card-body");
/*
const displayTable = document.createElement("table");
displayTable.classList.add("table table-striped table-responsive-sm");
displayTable.style.visibility = "visible";
cardBody.appendChild(displayTable);
*/
const sections = parsedData.sections;
for (let key in sections) {
let section = sections[key];
@ -490,9 +482,40 @@ function displayReport(parsedData){
for (let key in fields) {
let field = fields[key];
const p1 = document.createElement("p");
const p1Value = document.createTextNode(field.label + ": " + field.value);
p1.appendChild(p1Value);
cardBody.appendChild(p1);
let p1Value = "";
if(field.field_type == "boolean")
{
if(field.value == "true")
{
p1Value = document.createTextNode(field.label + ": " + "Yes");
p1.appendChild(p1Value);
cardBody.appendChild(p1);
}
else
{
p1Value = document.createTextNode(field.label + ": " + "No");
p1.appendChild(p1Value);
cardBody.appendChild(p1);
}
}
else if(field.field_type == "decimal")
{
p1Value = document.createTextNode(field.label + ": " + Math.trunc(field.value));
p1.appendChild(p1Value);
cardBody.appendChild(p1);
}
else if(field.value == "")
{
p1Value = document.createTextNode(field.label + ": " + "None");
p1.appendChild(p1Value);
cardBody.appendChild(p1);
}
else
{
p1Value = document.createTextNode(field.label + ": " + field.value);
p1.appendChild(p1Value);
cardBody.appendChild(p1);
}
}
cardHeader.appendChild(cardBody);
card.appendChild(cardHeader);