ninesurvey/src/ninesurvey-1.0/templates/Quest/result.html.twig

230 lines
8.6 KiB
Twig

{% extends 'base.html.twig' %}
{% block localstyle %}
{% if type is defined and type=="pdf" %}
body, .card, .card-header {
background-color:transparent !important;
}
{% endif %}
.card-header {
font-size: 15px;
text-align: center;
}
.flot-chart {
display: block;
height: 250px;
}
.flot-chart-content {
width: 250px;
height: 250px;
}
.average {
font-size: 50px;
text-align: center;
height: 250px;
padding-top:80px;
}
.breakpage{
page-break-before: always;
}
.legend {
position: relative;
left: 150px;
}
{% endblock %}
{% block body %}
<div class="container">
{% if (not type is defined or type !="pdf") and access=="" %}
<a class="btn btn-secondary mb-3 mt-3" href={{ path('app_quest') }}>Retour</a>
<a class="btn btn-secondary mb-3 mt-3 float-right" href={{ path('app_quest_result',{id:quest.id,type:'csv'}) }}><i class="fas fa-file-csv fa-fw fa-2x"></i>Exporter en CSV</a>
<a class="btn btn-secondary mb-3 mt-3 float-right mr-3" href={{ path('app_quest_result',{id:quest.id,type:'pdf'}) }}><i class="fas fa-file-pdf fa-fw fa-2x"></i>Exporter en PDF</a>
{% endif %}
{% if (not type is defined or type !="pdf") and access=="byuserkey" %}
<a class="btn btn-secondary mb-3 mt-3" href={{ path('app_quest') }}>Retour</a>
{% endif %}
<h1>Synthèse</h1>
<b>Titre de l'enquête =</b> {{ quest.title }}<br>
<b>Nombre de réponses récoltées =</b>
{% set nbvote=0 %}
{% for guest in questguests %}
{% if not guest.questvotes is empty %}
{% set nbvote=nbvote+1 %}
{% endif %}
{% endfor %}
{{nbvote}} <br>
{% if quest.description %}
<br>
{{ quest.description|raw }}
{% endif %}
<hr>
<div class="row">
{% for graph in graphs %}
{% if graph.datatype == "donut" %}
<div class="col-md-6 mb-3">
<div class="card card-default">
<div class="card-header">
{{ graph.dataname}}
</div>
<div class="card-body">
<div class="flot-chart">
<div id="floatdonut{{ graph.datacode }}" class="flot-chart-content"></div>
</div>
</div>
</div>
</div>
{% else %}
<div class="col-md-6 mb-3">
<div class="card card-default">
<div class="card-header">
{{ graph.dataname}}
</div>
<div class="card-body">
<div class="average">
{{ (graph.data.total / graph.data.count)|number_format(2, ',', ' ') }} / {{graph.datamax}}
</div>
</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
{% if access=="" %}
{% for guest in questguests %}
{% if not guest.questvotes is empty %}
<hr>
<h2>
Réponse n° {{loop.index}}
</h2>
{% if not quest.anonymous %}<small>email = {{ guest.email }}</small>{%endif%}
<div class="row">
{% for vote in guest.questvotes %}
<div class="col-md-4 mb-3" style="zoom:80%">
<div class="card card-default">
<div class="card-header">
{{vote.questoption.name}}
</div>
<div class="card-body">
{% if vote.questoption.type == "10" %}
<div style="text-align:center;font-size:150%;">
{% if vote.vote == 0 %}non
{% else %}oui
{% endif %}
</div>
{% endif %}
{% if vote.questoption.type == "20" %}
<div style="text-align:center;font-size:150%;">
{% if vote.vote == 0 %}non
{% elseif vote.vote== 1 %}oui
{% else %}peut-être
{% endif %}
</div>
{% endif %}
{% if vote.questoption.type == "30" %}
<div style="text-align:center;font-size:150%;">
{% if vote.vote == 0 %}non
{% elseif vote.vote== 1 %}oui
{% else %}en partie
{% endif %}
</div>
{% endif %}
{% if vote.questoption.type == "40" %}
<div style="text-align:center;font-size:150%;">
{% if vote.vote == 0 %}Très Satisfait
{% elseif vote.vote== 1 %}Satisfait
{% elseif vote.vote== 2 %}Peu Satisfait
{% else %}Insatisfait
{% endif %}
</div>
{% endif %}
{% if vote.questoption.type == "50" %}
{% endif %}
{% if vote.questoption.type == "60" %}
<div style="text-align:center;font-size:150%;">
{{ vote.vote }} / 5
</div>
{% endif %}
{% if vote.questoption.type == "70" %}
<div style="text-align:center;font-size:150%;">
{{ vote.vote }} / 10
</div>
{% endif %}
{% if vote.questoption.type == "80" %}
<div style="text-align:center;font-size:150%;">
{{ vote.vote }} / 20
</div>
{% endif %}
{% if vote.questoption.type == "90" %}
{{ vote.vote|raw }}
{% endif %}
{% if vote.questoption.type == "100" %}
{{ vote.vote|raw }}
{% endif %}
{% if vote.questoption.type == "110" %}
<div style="text-align:center;font-size:150%;">
{{ vote.vote|raw }}
</div>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
{% endif %}
{% endfor %}
{% endif %}
</div>
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
{% for graph in graphs %}
{% if graph.datatype == "donut" %}
var data = [
{% for data in graph.data %}
{
label: "{{ data.label}}",
data: {{ data.total }},
color: "{{ data.color }}",
},
{% endfor %}
];
var plotObj = $.plot($("#floatdonut{{ graph.datacode }}"), data, {
series: {
pie: {
show: true
}
},
});
{% endif %}
{% endfor %}
});
{% endblock %}