{% extends 'baseCuveo.html.twig' %}
{# {% block stylesheets %}
<meta charset="utf-8">
{% endblock %} #}
{% block body %}
<script>
// Code JavaScript pour afficher/masquer le texte
function toggleContent(button, content) {
button.addEventListener("click", function() {
if (content.style.display === "none" || content.style.display === "") {
content.style.display = "block";
button.textContent = "▲"; // Flèche vers le haut
} else {
content.style.display = "none";
button.textContent = "▼"; // Flèche vers le bas
}
});
}
</script>
<br>
Calcul du taux de réutilisation d'eaux pluviales :
<br>
{{ form_start(form) }}
{{ form_errors(form) }}
{{ form_label(form.nomDuProjet, 'Nom du projet') }}
{{ form_widget(form.nomDuProjet, {'attr': {'value': fichePluvio.nomDuProjet}}) }}
<div class="form-row">
<div class="form-group col-md-4">
{{ form_label(form.climat, 'Climat') }}
{{ form_widget(form.climat, {'attr': {'value': fichePluvio.climat}}) }}</div>
<div class="form-group col-md-3">
{{ form_label(form.stationmeteo, 'Station météo') }}
{{ form_widget(form.stationmeteo, {'attr': {'value': fichePluvio.stationMeteo}}) }}</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
{{ form_label(form.nomSurface, 'Nom de la surface 1') }}
{{ form_widget(form.nomSurface, {'attr': {'value': fichePluvio.nomSurface}}) }}</div>
<div class="form-group col-md-3">
{{ form_label(form.surfaceRecuperee, 'Surface de toiture récupérée en m²') }}
{{ form_widget(form.surfaceRecuperee, {'attr': {'value': fichePluvio.surfaceRecuperee}}) }}</div>
<div class="form-group col-md-3">
{{ form_label(form.rendementToiture, 'Type de toiture') }}
{{ form_widget(form.rendementToiture, {'attr': {'value': fichePluvio.rendementToiture}}) }}</div>
<div class="form-group col-md-1">
<img src="{{ asset('img/information.png') }}" height="18" title="Kt est le coefficient de rendement de la toiture (La gestion durable de l'eau - CSTB 2009)">
</a></div>
</div>
<div>
<button type="button" id="toggleButton1" style="font-size: 12px;">▼</button>
<label for="toggleButton1">Ajouter d'autres toitures:</label>
</div>
<div id="texte1" style="display: none;">
<div class="form-row">
<div class="form-group col-md-4">
{{ form_label(form.nomSurface2, 'Nom de la surface 2') }}
{{ form_widget(form.nomSurface2, {'attr': {'value': fichePluvio.nomSurface2}}) }}</div>
<div class="form-group col-md-3">
{{ form_label(form.surfaceRecuperee2, 'Surface n°2 de toiture récupérée') }}
{{ form_widget(form.surfaceRecuperee2, {'attr': {'value': fichePluvio.surfaceRecuperee2}}) }}</div>
<div class="form-group col-md-3">
{{ form_label(form.rendementToiture2, 'Type de toiture n°2') }}
{{ form_widget(form.rendementToiture2, {'attr': {'value': fichePluvio.rendementToiture2}}) }}</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
{{ form_label(form.nomSurface3, 'Nom de la surface 3') }}
{{ form_widget(form.nomSurface3, {'attr': {'value': fichePluvio.nomSurface3}}) }}</div>
<div class="form-group col-md-3">
{{ form_label(form.surfaceRecuperee3, 'Surface n°3 de toiture récupérée') }}
{{ form_widget(form.surfaceRecuperee3, {'attr': {'value': fichePluvio.surfaceRecuperee3}}) }}</div>
<div class="form-group col-md-3">
{{ form_label(form.rendementToiture3, 'Type de toiture n°3') }}
{{ form_widget(form.rendementToiture3, {'attr': {'value': fichePluvio.rendementToiture3}}) }}</div>
</div>
</div>
<div>
<button type="button" id="toggleButton2" style="font-size: 12px;">▼</button>
<label for="toggleButton2">Usage pour les WC :</label>
</div>
<div id="texte2" style="display: none;">
<div class="form-row">
<div class="form-group col-md-3">
{{ form_label(form.nbreUtilisateur, 'Nombre d\'utilisateur moyen journalier') }}
{{ form_widget(form.nbreUtilisateur, {'attr': {'value': fichePluvio.nbreUtilisateur}}) }}</div>
<div class="form-group col-md-3">
{{ form_label(form.volumeParUtilisation, 'Volume par jour par utilisateur (L/jr)') }}
{{ form_widget(form.volumeParUtilisation, {'attr': {'value': fichePluvio.volumeParUtilisation}}) }}</div>
<div class="form-group col-md-2">
{{ form_label(form.scenarioUtilisation, 'Scénario d\'utilisation') }}
{{ form_widget(form.scenarioUtilisation, {'attr': {'value': fichePluvio.scenarioUtilisation}}) }}</div>
<div class="form-group col-md-3">
{{ form_label(form.tauxRaccordement, 'Taux de WC raccordés en %') }}
{{ form_widget(form.tauxRaccordement, {'attr': {'value': fichePluvio.tauxRaccordement}}) }}</div>
</div>
</div>
<div>
<button type="button" id="toggleButton3" style="font-size: 12px;">▼</button>
<label for="toggleButton3">Usage pour l'arrosage :</label>
</div>
<div id="texte3" style="display: none;">
<div class="form-row">
<div class="form-group col-md-3">
{{ form_label(form.ru, 'Type de sol') }}
{{ form_widget(form.ru, {'attr': {'value': fichePluvio.ru}}) }}</div>
<div class="form-group col-md-3">
{{ form_label(form.typePlante, 'Type de plantes') }}
{{ form_widget(form.typePlante) }}
{# {{ form_widget(form.typePlante, {'attr': {'value': fichePluvio.typePlante}}) }}
#} </div>
<div class="form-group col-md-3">
{{ form_label(form.profondeurTerre, 'Profondeur de la terre') }}
{{ form_widget(form.profondeurTerre, {'attr': {'value': fichePluvio.profondeurTerre}}) }}</div>
<div class="form-group col-md-3">
{{ form_label(form.sArrosage, 'Surface arrosée en m²') }}
{{ form_widget(form.sArrosage, {'attr': {'value': fichePluvio.sArrosage}}) }}
</div>
</div>
</div>
<div>
<button type="button" id="toggleButton4" style="font-size: 12px;">▼</button>
<label for="toggleButton4">Autres besoins :</label>
</div>
<div id="texte4" style="display: none;">
<div class="form-row">
<div class="form-group col-md-3">
{{ form_label(form.besoinEau, 'Autre besoin en eau en litres par jour :') }}
{{ form_widget(form.besoinEau, {'attr': {'value': fichePluvio.besoinEau}}) }}</div>
<div class="form-group col-md-1">
<img src="{{ asset('img/information.png') }}" height="18" title="Lavage du sol, remplissage de camionnettes autolaveuses... Si le besoin varie suivant les jours, séparez les données par un point-virgule. Les données seront répétées. Exemple : une suite de 7 chiffres '4;0;9;0;0;0;0' pour une suite hebdomadaire">
</a>
</div>
</div>
</div>
<div>
<button type="button" id="toggleButton5" style="font-size: 12px;">▼</button>
<label for="toggleButton5">Analyse économique :</label>
</div>
<div id="texte5" style="display: none;">
<div class="form-row" style="background:#f8f9fa">
</div>
<div class="form-row" style="background:#f8f9fa">
<div class="form-group col-md-3">
{{ form_label(form.coutEau, 'Coût de l\'eau épargnée en €/m3') }}
{{ form_widget(form.coutEau, {'attr': {'value': fichePluvio.coutEau}}) }}
</div>
<div class="form-group col-md-6">
{{ form_label(form.coutPompe, 'Forfait pour le coût de la pompe et du double réseau en €') }}
{{ form_widget(form.coutPompe, {'attr': {'value': fichePluvio.coutPompe}}) }}
</div>
</div>
<div class="form-row" style="background:#f8f9fa">
<div class="form-group col-md-2">
Volumes et coûts de cuve à interpoler :
</div>
<div class="form-group col-md-2">
{{ form_label(form.choixVolume, 'Volume n°1 en litres') }}
{{ form_widget(form.choixVolume, {'attr': {'value': fichePluvio.choixVolume}}) }}
</div>
<div class="form-group col-md-2">
{{ form_label(form.coutVolume, 'Coût du volume n°1') }}
{{ form_widget(form.coutVolume, {'attr': {'value': fichePluvio.coutVolume}}) }}
</div>
<div class="form-group col-md-2">
{{ form_label(form.choixVolume2, 'Volume n°2 en litres') }}
{{ form_widget(form.choixVolume2, {'attr': {'value': fichePluvio.choixVolume2}}) }}
</div>
<div class="form-group col-md-2">
{{ form_label(form.coutVolume2, 'Coût du volume n°2') }}
{{ form_widget(form.coutVolume2, {'attr': {'value': fichePluvio.coutVolume2}}) }}
</div>
</div>
</div>
<div class="form-group col-md-4">
{{ form_label(form.certivea, 'L\'operation est-elle certifiée HQE par Certivéa \?') }}
{{ form_widget(form.certivea, {'attr': {'value': fichePluvio.certivea}}) }}
</div>
<script>
if ({{ fichePluvio.nbreUtilisateur }}0 > 0) {
document.getElementById("texte2").style.display = "block";
document.getElementById("toggleButton2").textContent = "▲";
} else {
document.getElementById("texte2").style.display = "none";
document.getElementById("toggleButton2").textContent = "▼";
}
if ({{ fichePluvio.surfaceRecuperee2 }}0 > 0) {
document.getElementById("texte1").style.display = "block";
document.getElementById("toggleButton1").textContent = "▲";
} else {
document.getElementById("texte1").style.display = "none";
document.getElementById("toggleButton1").textContent = "▼";
}
if ({{ fichePluvio.sArrosage }}0 > 0) {
document.getElementById("texte3").style.display = "block";
document.getElementById("toggleButton3").textContent = "▲";
} else {
document.getElementById("texte3").style.display = "none";
document.getElementById("toggleButton3").textContent = "▼";
}
let besoinEau = parseFloat('{{ fichePluvio.besoinEau|split(";")|first|default(0) }}');
if (besoinEau > 0) {
document.getElementById("texte4").style.display = "block";
document.getElementById("toggleButton4").textContent = "▲";
} else {
document.getElementById("texte4").style.display = "none";
document.getElementById("toggleButton4").textContent = "▼";
}
// Code JavaScript for afficher le texte lorsque la case est cochée
toggleContent(document.getElementById("toggleButton1"), document.getElementById("texte1"));
toggleContent(document.getElementById("toggleButton2"), document.getElementById("texte2"));
toggleContent(document.getElementById("toggleButton3"), document.getElementById("texte3"));
toggleContent(document.getElementById("toggleButton4"), document.getElementById("texte4"));
toggleContent(document.getElementById("toggleButton5"), document.getElementById("texte5"));
</script>
{% if graphParametrique %}
<BR>
<BR>
Résultats de l'étude :
<BR>
<BR>
<div id="chartParamatrique" style="height: 370px; width: 100%;"></div>
{% endif %}
{% if graphParametrique %}
<br><br>
<table class='table table-striped table-hover table-sm text-center'>
<thead>
<tr>
<th>Volume de la cuve en Litres</th>
<th >Taux d'autonomie en %</th>
<th >Quantitée réutilisée moyenne en m3/an</th>
<th >Complément annuel moyen m3/an</th>
<th >Trop plein moyen en m3/an</th>
<th >Gain financier moyen annuel en €/an</th>
<th >Coût de la cuve + réseau estimée en €HT</th>
<th >Temps de retour brut en années</th>
</tr>
</thead>
<tbody>
{% for Volume in tableauParametrique %}
<tr>
{% for data in Volume %}
<td>
{{ data }}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
<br><br>
<table class='table table-striped table-hover table-sm text-center'>
<thead>
<tr>
<th>Pluviométrie moyenne en mm/an</th>
<th >Besoin total en eau en m3/an</th>
<th >Arrosage en mm/an</th>
</tr>
</thead>
<tbody>
<tr>
<td>
{{ tableauSynthese.pluviometrieMoyenne }}
</td>
<td>
{{ tableauSynthese.besoinAnnuel }}
</td>
<td>
{{ tableauSynthese.besoinArrosage }}
</td>
</tr>
</tbody>
</table>
<BR>
<BR>
Obtenez les graphiques jour par jour en choisisssant le volume de la cuve. Un optimum de volume peut être au fléchissement de la courbe du taux de couverture.
<BR>
<div class="form-row mt-4" {% if not show_complement %}style="display:none"{% endif %}>
<div class="form-group col-md-4" >
{{ form_row(form.volumeCuve, {'label': 'Volume de la cuve choisi en Litres (optionnel) :'}) }}</div>
<div class="form-group col-md-1 align-self-center d-flex justify-content-center"> OU </div>
<div class="form-group col-md-4">{{ form_row(form.tauxObjectif, {'label': 'Taux couverture souhaité en %'}) }}</div>
</div>
<div class="form-row mt-4">
<div class="form-group col-md-2">
{%if show_complement %}
{{ form_row(form.analyser, {'label': 'Compléter et/ou actualiser l\'analyse'}) }}
{# <a class="btn btn-primary" href="{{ path('CopieCalcul') }}" role="button">Faire une copie du calcul</a>
<a class="btn btn-primary" href="{{ path('NouveauCalcul') }}" role="button">Nouveau calcul</a>#}
{% else %}
{{ form_row(form.analyser ) }}
{% endif %}
</div>
</div>
{% else %}
<div class="form-row mt-4" {% if not show_complement %}style="display:none"{% endif %}>
<div class="form-group col-md-4">
{{ form_row(form.volumeCuve, {'label': 'Volume de la cuve choisi en Litres (optionnel) :'}) }}</div>
<div class="form-group col-md-1 align-self-center d-flex justify-content-center"> OU</div>
<div class="form-group col-md-4">{{ form_row(form.tauxObjectif, {'label': 'Taux couverture souhaité en %'}) }}</div>
</div>
<div class="form-row mt-4">
<div class="form-group col-md-2">
{% if show_complement %}oo
{{ form_row(form.analyser, {'label': 'Compléter et/ou actualiser l\'analyse'}) }}
{% else %}
{{ form_row(form.analyser ) }}
{% endif %}
</div>
</div>
{% endif %}
{{ form_rest(form) }}
{{ form_end(form) }}
<br><br>
<script type="text/javascript" src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
{% if volumeCuveUser %}
Détails pour le volume choisi : {{ volumeCuveUser }} Litres:
<BR>
<BR>
<div id="chartPie" style="height: 370px; width: 100%;"></div>
<div id="chartPluviometrie" style="height: 100px; width: 100%;"></div><br><br>
<div id="chartContainer" style="height: 370px; width: 100%;"></div><br><br>
<div id="chartBarres" style="height: 370px; width: 100%;"></div><br><br>
{% endif %}
{% if allowPDF %}
<a class="btn btn-success btnPDF" >Télécharger le bilan en PDF</a>
{% endif %}
<br><br>
{#
{% if graphParametrique %} Tableau de vérification
<br><br>
<table class='table table-striped table-hover table-sm'>
<thead>
<th>jour</th>
<th >pluieDuJour</th>
<th >RFUJournalier</th>
<th >ETP</th>
<th >ConsoPlanteJournalier</th>
<th >besoinArrosageJournalier</th>
<th >besoinEauJournalier</th>
<th >volumeEauToiture</th>
<th >volumeEau</th>
<th >bilanEau</th>
<th >manqueEau)</th>
</thead>
<tbody>
{% for jour in tableau %}
<tr>
{% for data in jour %}
<td>
{{ data }}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}#}
<script>
//let myForm = document.getElementById('form');
document.querySelectorAll('form select').forEach(elem => {
elem.addEventListener('submit', function(e){ e.preventDefault(); });
});
function showFile(blob){
// It is necessary to create a new blob object with mime-type explicitly set
// otherwise only Chrome works like it should
var newBlob = new Blob([blob], {type: "application/pdf"})
// IE doesn't allow using a blob object directly as link href
// instead it is necessary to use msSaveOrOpenBlob
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(newBlob);
return;
}
// For other browsers:
// Create a link pointing to the ObjectURL containing the blob.
const data = window.URL.createObjectURL(newBlob);
var link = document.createElement('a');
link.href = data;
link.download="bilan.pdf";
link.click();
setTimeout(function(){
// For Firefox it is necessary to delay revoking the ObjectURL
window.URL.revokeObjectURL(data);
}, 100);
}
const pdfLink="{{ path('RetutilisationBilanPdf',{'idFiche' : idPluvio}) }}";
const btnPDF = document.querySelector('.btnPDF');
if (btnPDF) {
// On click convert charts to png and download pdf
btnPDF.addEventListener('click', () => {
// create new FormData object
const formData = new FormData();
// append form data to formData object
formData.append('idFiche', {{ idPluvio }});
// Convert charts to png
const charts = document.querySelectorAll('.canvasjs-chart-container');
var index=0;
charts.forEach(container => {
chart = container.querySelector('canvas');
console.log(chart);
const img = chart.toDataURL("image/png");
// add Img from chart to formData
formData.append('img['+(index++)+']', img);
});
// Send multipart formData to server
fetch(pdfLink, {
method: 'POST',
body: formData
}).then(r => r.blob())
.then(showFile)
});
}
function generatePDF() {
var doc = new jsPDF();
doc.fromHTML(document.getElementById('content'), 15, 15, {
'width': 170
});
doc.save('sample-file.pdf');
}
</script>
<script>
var renderedImages = [];
window.onload = function () {
{% if graphParametrique %}
var chart = new CanvasJS.Chart("chartParamatrique", {
animationEnabled: true,
zoomEnabled: true,
theme: "light2",
title: {
text: "Etude paramétrique de la taille de la cuve"
},
axisX: {
title: "Nombre de litres",
titleFontColor: "#4F81BC",
includeZero: true,
valueFormatString: "# ###L",
},
axisY: {
title: "Taux de couverture des besoins",
titleFontColor: "#4F81BC",
includeZero: true,
suffix: "%"
},
axisY2: {
title: "Temps de retour",
titleFontColor: "#4F81BC",
includeZero: true,
suffix: " ans"
},
toolTip: {
shared: true
},
data: [{
indexLabelFontColor: "darkSlateGray",
name: "Taux de couverture",
type: "line",
markerSize: 0,
showInLegend: true,
xValueFormatString: "Volume cuve : # ###L",
yValueFormatString: "# '%'",
dataPoints: [
{{ graphParametrique }}
]
},
{
indexLabelFontColor: "red",
name: "Selection utilisateur",
type: "line",
markerSize: 12,
showInLegend: true,
yValueFormatString: "Couverture à #'%'",
dataPoints: [
{{ graphParametriqueUserJson }}
]},
{
type: "line",
name: "Temps de retour",
axisYType: "secondary",
markerSize: 0,
showInLegend: true,
yValueFormatString: "0.0 ans",
dataPoints:[
{{ graphTempsDeRetour }}
]
}
]
});
chart.render();
renderedImages.push(chart.exportChart({format: "png",toDataURL: true}));
{% endif %}
{% if graphJourParJour %}
{% endif %}
{% if volumeCuveUser %}
var chart1 = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
zoomEnabled: true,
theme: "light2",
title: {
text: "Niveau de la cuve de la première année"
},
axisX: {
title: "Jour dans l'année",
titleFontColor: "#4F81BC",
includeZero: true,
suffix: ""
},
axisY: {
title: "Nombre de litres",
titleFontColor: "#4F81BC",
includeZero: true,
scaleBreaks: {
autoCalculate: true
},
suffix: " L",
maximum:{{graphJourParJour.maximum}}
},
data: [
{
indexLabelFontColor: "red",
name: "Trop plein de la cuve",
type: "area",
showInLegend: true,
color: "#DF7970",
yValueFormatString: "# ##0 L",
xValueFormatString: "J#",
dataPoints: [
{{ graphJourParJour.tropPlein }}
]
},
{
indexLabelFontColor: "green",
name: "Complément eau de ville",
type: "area",
showInLegend: true,
color:"#51CDA0",
yValueFormatString: "# ##0 L",
xValueFormatString: "J#",
dataPoints: [
{{ graphJourParJour.manqueEau }}
]
},
{indexLabelFontColor: "darkSlateGray",
name: "Volume d'eau dans la cuve",
type: "area",
showInLegend: true,
color: "#6D78AD",
yValueFormatString: "# ##0 L",
xValueFormatString: "J#",
dataPoints: [
{{ graphJourParJour.volumeEau }}
]
}
]
});
chart1.render();
renderedImages.push(chart1.exportChart({format: "png",toDataURL: true}));
{% endif %}
{% if volumeCuveUser %}
var chart3 = new CanvasJS.Chart("chartBarres", {
animationEnabled: true,
zoomEnabled: true,
theme: "light2",
title: {
text: "Répartition des besoins jour par jour sur la première année"
},
axisX: {
title: "Jour dans l'année",
titleFontColor: "#4F81BC",
includeZero: true,
suffix: ""
},
axisY: {
title: "Nombre de litres",
titleFontColor: "#4F81BC",
includeZero: true,
suffix: " L"
},
data: [{
indexLabelFontColor: "green",
name: "Eau de pluie réutilisée",
type: "stackedColumn",
yValueFormatString: "# ##0 L",
xValueFormatString: "J#",
showInLegend: true,
dataPoints: [
{{ graphJourParJour.apportCuve }}
]
},
{
indexLabelFontColor: "darkSlateGray",
name: "Complément eau de ville",
showInLegend: true,
type: "stackedColumn",
yValueFormatString: "# ##0 L",
xValueFormatString: "J#",
dataPoints: [
{{ graphJourParJour.manqueEauPositif }}
]
}
]
});
chart3.render();
renderedImages.push(chart3.exportChart({format: "png",toDataURL: true}));
{% endif %}
{% if volumeCuveUser %}
var chart2 = new CanvasJS.Chart("chartPluviometrie", {
animationEnabled: true,
theme: "light2",
title: {
text: "Pluviometrie"
},
axisX: {
{# minimum: new Date(2015, 01, 25),
maximum: new Date(2017, 02, 15),
valueFormatString: "MMM YY"#}
},
axisY: {
title: "mm par jour",
titleFontColor: "#4F81BC",
includeZero: true,
suffix: ""
},
data: [{
indexLabelFontColor: "darkSlateGray",
name: "views",
type: "area",
yValueFormatString: "0.0",
dataPoints: [
{{ graphJourParJour.pluviometrie }}
]
}]
});
chart2.render();
renderedImages.push(chart2.exportChart({format: "png",toDataURL: true}));
{% endif %}
{% if volumeCuveUser %}
var chartpie = new CanvasJS.Chart("chartPie", {
animationEnabled: true,
theme: "light2",
title: {
text: "Répartition des besoins"
},
data: [{
type: "pie",
startAngle: 240,
yValueFormatString: "0.0%",
indexLabel: "{label} {y}",
dataPoints: [
{y:{{graphTarte.tauxArrosage}}, label: "Arrosage ({{graphTarte.Arrosage}} m3/an) :"},
{y:{{graphTarte.tauxWc}}, label: "WC ({{graphTarte.Wc}} m3/an) :"},
{y:{{graphTarte.tauxAutres}}, label: "Autres ({{graphTarte.Autres}} m3/an) :"},
]
}]
});
chartpie.render();
renderedImages.push(chartpie.exportChart({format: "png",toDataURL: true}));
{% endif %}
}
</script>
{% endblock %}