<div class="bubble-container is-third mesPoints">
<p class="center titreBubble"><span class="ralewayBold">{{ 'menu.mesPoints'|trans }}</span></p>
<div class="bubble bubble--white">
{% if getParam('carte.donuts') %}
<div id="donuts"></div>
{% endif %}
<p id="blocPoint" class="isGrey">
{{ client.civilite }} {{client.prenom}} {{client.nom}}, {{ 'client.pointCummulé' |trans}}<br>
<span id="ptsatteind" class="ralewayBold">{{ client.nbrePoints|force_to_int }} points</span><br>
{% if client.nbrePtsRestantCheque is empty %}
{{'client.dansLaCagnotte'|trans}} {{'client.possedeCheque'|trans}}
{% else %}
{{'client.dansLaCagnotte'|trans}}. <br>
{{'client.ilVousReste'|trans}} {{ client.nbrePtsRestantCheque|force_to_int }} {{'client.pourRecevoirVotreChqFid'|trans}}<br>
{% endif %}
</p>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
{% if getParam('carte.donuts') %}
<script type="text/javascript" src="{{ asset('js/d3.min.js') }}"></script>
{% endif %}
<script type="text/javascript">
{% if getParam('carte.donuts') %}
var color = null;
var dataset = null;
if ($('#donuts').length) {
if ({{ client.montantCarte }} !=
0 && {{ cagnotteReste }} != 0
)
{
var colorDonus = "{{ getParam('carte.donuts_color') }}";
color = d3.scale.ordinal().range([colorDonus, '#ffffff', '#cccccc', '#ffffff']);
//donnuts
dataset = {
apples: [({{ seuilUtilisationCagnotte }}-{{ cagnotteReste }}) * 50, 2,{{ cagnotteReste }} * 50,
2
]
}
;
}
else
{
color = d3.scale.ordinal().range([colorDonus, '#cfcfcf']);
//donnuts
dataset = {
apples: [({{ seuilUtilisationCagnotte }}-{{ cagnotteReste }}),{{ cagnotteReste }} ]
};
}
var width = 100,
height = 100,
radius = Math.min(width, height) / 2;
var pie = d3.layout.pie()
.sort(null);
var arc = d3.svg.arc()
.innerRadius(radius - 17)
.outerRadius(radius);
var svg = d3.select("#donuts").append("svg")
.attr("width", width)
.attr("height", height)
.append("g")
.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
var path = svg.selectAll("path")
.data(pie(dataset.apples))
.enter().append("path")
.attr("fill", function (d, n) {
return color(n);
})
.attr("d", arc);
}
{% endif %}
</script>
</div>