Add a condition to check if section is completed. If its complete it will display the information of that section if not it won't display
This commit is contained in:
parent
4ed0b26811
commit
8416c041d0
1 changed files with 24 additions and 14 deletions
|
@ -285,31 +285,41 @@ function displayReport(parsedData){
|
||||||
|
|
||||||
const card = document.createElement("div");
|
const card = document.createElement("div");
|
||||||
card.classList.add("card");
|
card.classList.add("card");
|
||||||
|
|
||||||
const cardHeader = document.createElement("div");
|
const cardHeader = document.createElement("div");
|
||||||
cardHeader.classList.add("card-header");
|
cardHeader.classList.add("card-header");
|
||||||
|
|
||||||
const cardBody = document.createElement("div");
|
const cardBody = document.createElement("div");
|
||||||
cardBody.classList.add("card-body");
|
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;
|
const sections = parsedData.sections;
|
||||||
for (let key in sections) {
|
for (let key in sections) {
|
||||||
let section = sections[key];
|
let section = sections[key];
|
||||||
const h4 = document.createElement("h4");
|
if(section.completed) {
|
||||||
const value = document.createTextNode(section.title);
|
const h4 = document.createElement("h4");
|
||||||
|
const value = document.createTextNode(section.title);
|
||||||
|
|
||||||
h4.appendChild(value);
|
h4.appendChild(value);
|
||||||
cardBody.appendChild(h4);
|
cardBody.appendChild(h4);
|
||||||
let fields = section.fields;
|
let fields = section.fields;
|
||||||
for (let key in fields) {
|
for (let key in fields) {
|
||||||
let field = fields[key];
|
let field = fields[key];
|
||||||
const p1 = document.createElement("p");
|
const p1 = document.createElement("p");
|
||||||
const p1Value = document.createTextNode(field.label + ": " +field.value);
|
const p1Value = document.createTextNode(field.label + ": " + field.value);
|
||||||
p1.appendChild(p1Value);
|
p1.appendChild(p1Value);
|
||||||
cardBody.appendChild(p1);
|
cardBody.appendChild(p1);
|
||||||
|
}
|
||||||
|
cardHeader.appendChild(cardBody);
|
||||||
|
card.appendChild(cardHeader);
|
||||||
}
|
}
|
||||||
cardHeader.appendChild(cardBody);
|
|
||||||
card.appendChild(cardHeader);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
modalBody.appendChild(card);
|
modalBody.appendChild(card);
|
||||||
|
|
Loading…
Reference in a new issue