Add form-building function
This commit is contained in:
		
							parent
							
								
									3fe22134fd
								
							
						
					
					
						commit
						72dd3d9900
					
				
					 2 changed files with 20 additions and 5 deletions
				
			
		|  | @ -55,9 +55,24 @@ function getDataFromEndpoint(url, callback) { | |||
| } | ||||
| 
 | ||||
| function buildEditReportForm(parsedReport) { | ||||
|     const modalTitle = document.querySelector("#editReportModalLabel");  | ||||
|     console.log("In buildEditReportForm"); | ||||
|     console.log(JSON.stringify(parsedReport)); | ||||
|     const modalHeader = document.querySelector(".modal-header");  | ||||
|     const h5 = document.createElement("h5"); | ||||
|     h5.classList.add("modal-title", "text-center"); | ||||
|     const date = new Date(parsedReport.date_created).toLocaleDateString("en-US"); | ||||
|     h5.innerHTML = `${parsedReport.title}, ${date}`; | ||||
|     modalHeader.prepend(h5); | ||||
|      | ||||
|     const sections = parsedReport.sections; | ||||
|     for (let i = 0; i < sections.length; i++) { | ||||
|         console.log(sections[i].title); | ||||
|         console.log(sections[i].html_description); | ||||
|         console.log(sections[i].fields); | ||||
|         for (field in sections[i].fields) { | ||||
|             console.log(sections[i].fields[field].label); | ||||
|             console.log(sections[i].fields[field].type); | ||||
|             console.log(sections[i].fields[field].value); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| function editReportFormClickHandler(event) { | ||||
|  |  | |||
|  | @ -57,8 +57,8 @@ | |||
|         <div class="modal-dialog modal-lg" role="document"> | ||||
|             <div class="modal-content"> | ||||
|                 <div class="modal-header"> | ||||
|                     <h5 class="modal-title" id="editReportModalLabel">Edit Report</h5> | ||||
|                     <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||||
|                     <button type="button" class="close" data-dismiss="modal"> | ||||
|                         <span>×</span> | ||||
|                     </button> | ||||
|                 </div> | ||||
|                 <div class="modal-body"> | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Preston Doman
						Preston Doman