Added informations about forms filled and being filled up
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
main h1 input, main h1 span{
|
||||
font-size: 30pt;
|
||||
font-weight: bold;
|
||||
color: teal;
|
||||
}
|
||||
|
||||
ol#questions-list {
|
||||
width: 90%;
|
||||
}
|
||||
ol#questions-list li {
|
||||
width: 90%;
|
||||
background-color: lemonchiffon;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* DCC */
|
||||
ol#questions-list li.dcc-box {
|
||||
background-color: gainsboro;
|
||||
color: black;
|
||||
font-size: 12pt;
|
||||
}
|
||||
li.dcc-box h5 {
|
||||
font-size: 12pt;
|
||||
font-weight: bold;
|
||||
width: 100%;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
main h1 input, main h1 span{
|
||||
font-size: 30pt;
|
||||
font-weight: bold;
|
||||
color: teal;
|
||||
}
|
||||
|
||||
table#forms-table {
|
||||
width: 90%;
|
||||
}
|
||||
table#forms-table tr {
|
||||
width: 90%;
|
||||
background-color: lemonchiffon;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* DCC */
|
||||
table#forms-table tbody tr.done-true {
|
||||
background-color: rgb(161, 161, 161);
|
||||
color: black;
|
||||
font-size: 12pt;
|
||||
font-style: italic;
|
||||
}
|
||||
table#forms-table tbody tr {
|
||||
background-color: gainsboro;
|
||||
color: black;
|
||||
font-size: 12pt;
|
||||
}
|
||||
table#forms-table thead tr {
|
||||
font-size: 14pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
@@ -7,11 +7,15 @@
|
||||
<body>
|
||||
<div th:replace="~{header}"/>
|
||||
<main>
|
||||
|
||||
<h3>Formulaires terminés</h3>
|
||||
<ul>
|
||||
<li><a href="/questions/form?f=132">Formulaire de réponse au quizz numéro 1</a></li>
|
||||
<li><a href="/questions/form?f=177">Formulaire de réponse au quizz numéro 2</a></li>
|
||||
<li><a href="/questions/form?f=16818">Formulaire de réponse au quizz numéro 3</a></li>
|
||||
<li th:if="${#lists.isEmpty(finishedForms)}">Vous n'avez fini aucun formulaire !</li>
|
||||
<li th:each="qf : ${finishedForms}"><a th:href="@{/questions/showform/{id}(id=${qf.id})}">Quizz <span th:text="${qf.quizz.name}"/></a></li>
|
||||
</ul>
|
||||
<h3>Formulaires non terminés</h3>
|
||||
<ul>
|
||||
<li th:if="${#lists.isEmpty(openForms)}">Aucun formulaire ici !</li>
|
||||
<li th:each="qf : ${openForms}"><a th:href="@{/questions/form/{id}(id=${qf.quizz.id})}">Quizz <span th:text="${qf.quizz.name}"/></a></li>
|
||||
</ul>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr" dir="ltr">
|
||||
<head>
|
||||
<div th:replace="~{html-head}"/>
|
||||
<link rel="stylesheet" th:href="@{/css/showform.css}"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div th:replace="~{header}"/>
|
||||
<script th:src="@{/webjars/jquery/1.9.1/jquery.min.js}" type="text/javascript"></script>
|
||||
<script th:src="@{/webjars/lodash/4.17.21/lodash.js}" type="text/javascript"></script>
|
||||
<main>
|
||||
|
||||
<ol id="questions-list">
|
||||
</ol>
|
||||
|
||||
<span id="error-textbox" style="color: red"></span>
|
||||
|
||||
<script th:inline="javascript">
|
||||
/*<![CDATA[*/
|
||||
var formid = /*[[${formId}]]*/ -1;
|
||||
/*]]>*/
|
||||
</script>
|
||||
<script>
|
||||
function error(txt) {
|
||||
console.log(txt)
|
||||
$("#error-textbox").text(txt)
|
||||
}
|
||||
QTYPES = {
|
||||
"DCC": makeAnswerBlockBCC,
|
||||
}
|
||||
|
||||
// question position -> question data
|
||||
questiondata=[]
|
||||
|
||||
function getdata() {
|
||||
$.ajax({
|
||||
url: "/questions/getformdata/"+formid,
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
success: function(res) {
|
||||
console.log(res)
|
||||
if(!res["success"]) {
|
||||
console.log(res["message"])
|
||||
error(res["message"])
|
||||
return
|
||||
}
|
||||
questiondata=res["data"]
|
||||
|
||||
for(let qd of questiondata) {
|
||||
content = QTYPES[qd["type"]](qd["qid"],qd["qvalue"],qd["avalue"])
|
||||
$(`#questions-list`).append(content)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function makeAnswerBlockBCC(id,qvalue,avalue) {
|
||||
switch(avalue["type"]){
|
||||
case 4:
|
||||
dcc = "carré"
|
||||
break
|
||||
case 2:
|
||||
dcc = "duo"
|
||||
break
|
||||
default:
|
||||
dcc = "cache"
|
||||
}
|
||||
html = `
|
||||
<li class="dcc-box" id="q-${id}">
|
||||
<h5>${_.escape(qvalue["text"])}</h5>
|
||||
Réponse ${dcc}: ${_.escape(avalue["answer"])}
|
||||
</li>
|
||||
`
|
||||
out = $('<li/>').html(html).contents()
|
||||
return out
|
||||
}
|
||||
|
||||
getdata()
|
||||
</script>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,81 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr" dir="ltr">
|
||||
<head>
|
||||
<div th:replace="~{html-head}"/>
|
||||
<link rel="stylesheet" th:href="@{/css/showformadvancements.css}"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div th:replace="~{header}"/>
|
||||
<script th:src="@{/webjars/jquery/1.9.1/jquery.min.js}" type="text/javascript"></script>
|
||||
<script th:src="@{/webjars/lodash/4.17.21/lodash.js}" type="text/javascript"></script>
|
||||
<main>
|
||||
|
||||
<button id="refresh-data">Refresh</button>
|
||||
<table id="forms-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>User</th>
|
||||
<th>Position</th>
|
||||
<th>Step</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="forms-body">
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<span id="error-textbox" style="color: red"></span>
|
||||
|
||||
<script th:inline="javascript">
|
||||
/*<![CDATA[*/
|
||||
var quizzid = /*[[${quizzId}]]*/ -1;
|
||||
/*]]>*/
|
||||
</script>
|
||||
<script>
|
||||
function error(txt) {
|
||||
console.log(txt)
|
||||
$("#error-textbox").text(txt)
|
||||
}
|
||||
|
||||
formsdata=[]
|
||||
|
||||
function getdata() {
|
||||
$('#refresh-data').prop('disabled',true)
|
||||
$.ajax({
|
||||
url: "/questions/getformadvancements/"+quizzid,
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
success: function(res) {
|
||||
console.log(res)
|
||||
if(!res["success"]) {
|
||||
console.log(res["message"])
|
||||
error(res["message"])
|
||||
$('#refresh-data').prop('disabled',false)
|
||||
return
|
||||
}
|
||||
formsdata=res["data"]
|
||||
|
||||
$('.form-line').remove()
|
||||
for(let qf of formsdata) {
|
||||
html = `
|
||||
<tr class="form-line done-${qf["done"]}" id="q-${qf["qfid"]}">
|
||||
<td>${qf["username"]}</td>
|
||||
<td>${qf["position"]}</td>
|
||||
<td>${qf["step"]}</td>
|
||||
</tr>
|
||||
`
|
||||
content = $('<li/>').html(html).contents()
|
||||
$(`#forms-body`).append(content)
|
||||
}
|
||||
$('#refresh-data').prop('disabled',false)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
$('#refresh-data').on('click',getdata)
|
||||
getdata()
|
||||
</script>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user