Fix collapse issue
This commit is contained in:
parent
b58fff8888
commit
792c3afe7b
1 changed files with 5 additions and 13 deletions
|
@ -1,7 +1,6 @@
|
|||
const reportType = {
|
||||
NEW : 1,
|
||||
EDIT : 2,
|
||||
VIEW : 3
|
||||
};
|
||||
|
||||
// Hack to change endpoint url
|
||||
|
@ -240,21 +239,14 @@ function createCollapsibleCardBody(form, type, sectionIdStr, sectionDescription,
|
|||
cardBody.classList.add("card-body");
|
||||
const sectionAlert = document.createElement("div");
|
||||
|
||||
if (sectionCompleted) {
|
||||
if (ruleViolations.length === 0) {
|
||||
collapseDiv.classList.add("collapse");
|
||||
} else {
|
||||
collapseDiv.classList.add("collapse", "show");
|
||||
}
|
||||
if (sectionCompleted && ruleViolations.length === 0) {
|
||||
collapseDiv.classList.add("collapse");
|
||||
} else if (sectionCompleted && ruleViolations.length > 0) {
|
||||
collapseDiv.classList.add("collapse", "show");
|
||||
} else {
|
||||
sectionAlert.classList.add("alert", "alert-danger", "section-alert");
|
||||
sectionAlert.innerHTML = "This section is not complete";
|
||||
}
|
||||
|
||||
if (type === reportType.EDIT) {
|
||||
collapseDiv.setAttribute("data-parent", "#editReportAccordion");
|
||||
} else {
|
||||
collapseDiv.setAttribute("data-parent", "#newReportAccordion");
|
||||
collapseDiv.classList.add("collapse", "show");
|
||||
}
|
||||
|
||||
// Create card body. Append form to body, body to wrapper div
|
||||
|
|
Loading…
Reference in a new issue