mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Display survey responses
This commit is contained in:
		@@ -145,8 +145,28 @@
 | 
			
		||||
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
		<!-- All survey responses -->
 | 
			
		||||
		<div id="survey-responses" class="category container">
 | 
			
		||||
			Loading survey responses
 | 
			
		||||
			
 | 
			
		||||
			<h1>All your responses to surveys</h1>
 | 
			
		||||
 | 
			
		||||
			<table id="all-survey-responses">
 | 
			
		||||
 | 
			
		||||
				<thead>
 | 
			
		||||
					<tr>
 | 
			
		||||
						<th>Response number</th>
 | 
			
		||||
						<th>Survey Number</th>
 | 
			
		||||
						<th>Choice number</th>
 | 
			
		||||
						<th>Date</th>
 | 
			
		||||
					</tr>
 | 
			
		||||
				</thead>
 | 
			
		||||
 | 
			
		||||
				<tbody>
 | 
			
		||||
					<!-- Survey responses will go here -->
 | 
			
		||||
				</tbody>
 | 
			
		||||
 | 
			
		||||
			</table>
 | 
			
		||||
 | 
			
		||||
		</div>
 | 
			
		||||
		
 | 
			
		||||
		<div id="movies" class="category container">
 | 
			
		||||
@@ -172,6 +192,7 @@
 | 
			
		||||
	<script src="assets/js/categories/posts.js"></script>
 | 
			
		||||
	<script src="assets/js/categories/comments.js"></script>
 | 
			
		||||
	<script src="assets/js/categories/likes.js"></script>
 | 
			
		||||
	<script	src="assets/js/categories/survey.js"></script>
 | 
			
		||||
	<script src="assets/js/main.js"></script>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -0,0 +1,28 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Surveys category
 | 
			
		||||
 * 
 | 
			
		||||
 * @author Pierre HUBERT
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Apply all survey responses
 | 
			
		||||
 */
 | 
			
		||||
function ApplySurveyResponses(){
 | 
			
		||||
 | 
			
		||||
    let target = document.querySelector("#all-survey-responses tbody");
 | 
			
		||||
 | 
			
		||||
    data.survey_responses.forEach(response => {
 | 
			
		||||
 | 
			
		||||
        createElem2({
 | 
			
		||||
            appendTo: target,
 | 
			
		||||
            type: "tr",
 | 
			
		||||
            innerHTML:
 | 
			
		||||
                "<td>"+response.id+"</td>" +
 | 
			
		||||
                "<td>"+response.surveyID+"</td>" +
 | 
			
		||||
                "<td>"+response.choiceID+"</td>" +
 | 
			
		||||
                "<td>"+timeToStr(response.time_sent)+"</td>"
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -78,6 +78,7 @@ xhr.onload = function(){
 | 
			
		||||
	ApplyPosts();
 | 
			
		||||
	ApplyCommentsList();
 | 
			
		||||
	ApplyUserLikes();
 | 
			
		||||
	ApplySurveyResponses();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
xhr.send(null);
 | 
			
		||||
		Reference in New Issue
	
	Block a user