Merge pull request #105 from danieldupriest/collapse-scrolling
Collapse scrolling
This commit is contained in:
		
						commit
						9658afda32
					
				
					 1 changed files with 9 additions and 16 deletions
				
			
		|  | @ -1,7 +1,6 @@ | ||||||
| const reportType = { | const reportType = { | ||||||
|     NEW : 1, |     NEW : 1, | ||||||
|     EDIT : 2, |     EDIT : 2 | ||||||
|     VIEW : 3 |  | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| // Hack to change endpoint url
 | // Hack to change endpoint url
 | ||||||
|  | @ -153,14 +152,15 @@ function createFormGroup(sectionIdStr, field) { | ||||||
|             formGroup.appendChild(div); |             formGroup.appendChild(div); | ||||||
|             break; |             break; | ||||||
|         case "decimal": |         case "decimal": | ||||||
|             input.type = "text"; |             input.type = "number"; | ||||||
|             if (field.value === "0.00") { |             if (field.value === "0.00") { | ||||||
|                 input.value = ""; |                 input.value = ""; | ||||||
|             } else { |             } else { | ||||||
|                 input.value = field.value; |                 input.value = field.value; | ||||||
|             } |             } | ||||||
|             input.classList.add("form-control"); |             input.classList.add("form-control"); | ||||||
|             input.pattern = "\\d+(\\.\\d{2})?"; |             input.step = 0.01; | ||||||
|  |             input.min = 0.00; | ||||||
|             formGroup.appendChild(label); |             formGroup.appendChild(label); | ||||||
|             div.appendChild(input) |             div.appendChild(input) | ||||||
|             formGroup.appendChild(div); |             formGroup.appendChild(div); | ||||||
|  | @ -240,21 +240,14 @@ function createCollapsibleCardBody(form, type, sectionIdStr, sectionDescription, | ||||||
|     cardBody.classList.add("card-body"); |     cardBody.classList.add("card-body"); | ||||||
|     const sectionAlert = document.createElement("div"); |     const sectionAlert = document.createElement("div"); | ||||||
| 
 | 
 | ||||||
|     if (sectionCompleted) { |     if (sectionCompleted && ruleViolations.length === 0) { | ||||||
|         if (ruleViolations.length === 0) { |         collapseDiv.classList.add("collapse"); | ||||||
|             collapseDiv.classList.add("collapse"); |     } else if (sectionCompleted && ruleViolations.length > 0) { | ||||||
|         } else { |         collapseDiv.classList.add("collapse", "show"); | ||||||
|             collapseDiv.classList.add("collapse", "show"); |  | ||||||
|         } |  | ||||||
|     } else { |     } else { | ||||||
|         sectionAlert.classList.add("alert", "alert-danger", "section-alert"); |         sectionAlert.classList.add("alert", "alert-danger", "section-alert"); | ||||||
|         sectionAlert.innerHTML = "This section is not complete"; |         sectionAlert.innerHTML = "This section is not complete"; | ||||||
|     } |         collapseDiv.classList.add("collapse", "show"); | ||||||
| 
 |  | ||||||
|     if (type === reportType.EDIT) { |  | ||||||
|         collapseDiv.setAttribute("data-parent", "#editReportAccordion"); |  | ||||||
|     } else { |  | ||||||
|         collapseDiv.setAttribute("data-parent", "#newReportAccordion"); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // Create card body. Append form to body, body to wrapper div
 |     // Create card body. Append form to body, body to wrapper div
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 rupikad
						rupikad