added html2pdf property

This commit is contained in:
Luis Aleixo 2021-08-18 12:17:01 +02:00
parent 57b91fccdb
commit 8ff84963f2
4 changed files with 113 additions and 50 deletions

View file

@ -86,6 +86,47 @@ p.notes {
color: black;
}
.tabs-div {
margin: 1%;
border: #DFDFDF 1px solid;
border-radius: 5px;
}
.print-button {
margin-left: auto;
margin-right: 1%;
}
@media screen {
.card_break {
display: none!important;
}
}
@media print {
.collapse {
display: block!important;
}
.tab-content>.tab-pane {
display: contents!important;
}
.tab-content {
border-top: none!important;
}
.nav-tabs {
display: none!important;
}
.tabs-div {
border: none!important;
}
.icon_button {
display: none!important;
}
.print-button {
display: none!important;
}
}
/* CSS for the animation */

View file

@ -0,0 +1,15 @@
window.onload = function() {
document.getElementById("download-pdf")
.addEventListener("click", () => {
const pdf_version = this.document.getElementById("body");
console.log(pdf_version);
console.log(window);
var opt = {
filename: 'myfile.pdf',
image: { type: 'jpeg', quality: 0.98 },
html2canvas: { scale: 2, letterRendering: true },
jsPDF: { format: 'a4', orientation: 'portrait' },
};
html2pdf().from(pdf_version).set(opt).save();
})
}

View file

@ -8,6 +8,8 @@
<link rel="stylesheet" type="text/css" href="{{ calculator_prefix }}/static/css/report.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="{{ calculator_prefix }}/static/js/pdf.js"></script>
</head>
<body id="body">
@ -20,12 +22,13 @@
<h2 class="text-component-title" style="margin-bottom: 0">CARA - CALCULATOR REPORT</h1>
<p style="margin-bottom: 0"> Created {{ creation_date }} using CARA calculator version v{{ form.calculator_version }}</p>
</div>
<button type="button" class="btn btn-outline-dark align-self-center print-button" id="download-pdf">Download PDF</button>
</div>
{% endblock report_header %}
<div style="margin: 1%; border: #DFDFDF 1px solid; border-radius: 5px">
<div class="tabs-div">
<ul class="nav nav-tabs"role="tablist" style="margin: 0.5% 0% 0% 1%">
<li class="nav-item">
<a class="nav-link active" id="results-tab" data-toggle="tab" href="#results" role="tab" aria-controls="results" aria-selected="true">Results</a>
@ -55,12 +58,12 @@
<p class="card-text">
<div class="align-self-center">
<div class="d-flex">
<div class="card bg-light w-25 mb-3 mr-3">
<div class="card-header"><b>Probability of infection (%)</b></div>
<div class="card-body d-flex" style="min-height: 160px">
<div style="min-width: 25%">
<div style="text-align:center"><b>Probability of infection (%)</b></div>
<div class="d-flex" style="min-height: 160px">
{% block warning_animation %}
<div class="intro-banner-vdo-play-btn bg-secondary m-auto d-flex align-items-center justify-content-center">
<b style="font-size: larger">{{prob_inf | non_zero_percentage}}</b>
<b>{{prob_inf | non_zero_percentage}}</b>
<i class="glyphicon glyphicon-play whiteText" aria-hidden="true"></i>
<span class="ripple bg-secondary"></span>
<span class="ripple bg-secondary"></span>
@ -157,55 +160,12 @@
</div>
</div>
<div style="clear: both;"></div>
{% block disclaimer_container %}
<br><br><br>
<div style="border: 2px solid black; padding: 15px;">
{% block disclaimer %}
<p class="image"> <img align="middle" src="{{ calculator_prefix }}/static/images/disclaimer.jpg" width="40" height="40"><b>Disclaimer:</b><br><br></p>
<p>
CARA is a risk assessment tool developed to model the concentration of viruses in enclosed spaces, in order to inform space-management decisions.
</p>
<p>
CARA models the concentration profile of potential infectious viruses in enclosed spaces with clear and intuitive graphs.
The user can set a number of parameters, including room volume, exposure time, activity type, mask-wearing and ventilation.
The report generated indicates how to avoid exceeding critical concentrations and chains of airborne transmission in spaces such as individual offices, meeting rooms and labs.
</p>
<p>
The risk assessment tool simulates the long-range airborne spread SARS-CoV-2 virus in a finite volume, assuming a homogenous mixture, and estimates the risk of COVID-19 infection therein.
The results DO NOT include short-range airborne exposure (where the physical distance is a significant factor) nor the other known modes of SARS-CoV-2 transmission.
Hence, the output from this model is only valid when the other recommended public health & safety instructions are observed, such as adequate physical distancing, good hand hygiene and other barrier measures.
</p>
<p>
The model used is based on scientific publications relating to airborne transmission of infectious diseases, dose-response exposures and aerosol science, as of February 2021.
It can be used to compare the effectiveness of different airborne-related risk mitigation measures.
</p>
<p>
Note that this model applies a deterministic approach, i.e., it is assumed at least one person is infected and shedding viruses into the simulated volume.
Nonetheless, it is also important to understand that the absolute risk of infection is uncertain, as it will depend on the probability that someone infected attends the event.
The model is most useful for comparing the impact and effectiveness of different mitigation measures such as ventilation, filtration, exposure time, physical activity and
the size of the room, only considering long-range airborne transmission of COVID-19 in indoor settings.
</p>
<p>
This tool is designed to be informative, allowing the user to adapt different settings and model the relative impact on the estimated infection probabilities.
The objective is to facilitate targeted decision-making and investment through comparisons, rather than a singular determination of absolute risk.
While the SARS-CoV-2 virus is in circulation among the population, the notion of 'zero risk' or 'completely safe scenario' does not exist.
Each event modelled is unique, and the results generated therein are only as accurate as the inputs and assumptions.
</p>
<p>
CARA has not undergone review, approval or certification by competent authorities, and as a result, it cannot be considered
as a fully endorsed and reliable tool, namely in the assessment of potential viral emissions from infected hosts to be modelled.
</p>
{% endblock disclaimer %}
</div>
{% endblock disclaimer_container %}
{% endblock report_footer %}
</div>
<div class="tab-pane fade" id="data" role="tabpanel" aria-labelledby="data-tab" style="padding: 1%">
{% block simulation_overview %}
<br class="card_break">
<div class=card>
<div class="card-header"><strong>Simulation:</strong></div>
<div class="card-body">
@ -414,8 +374,54 @@
</div>
</div>
{% block disclaimer_container %}
<br><br><br>
<div style="border: 2px solid black; padding: 15px;">
{% block disclaimer %}
<p class="image"> <img align="middle" src="{{ calculator_prefix }}/static/images/disclaimer.jpg" width="40" height="40"><b>Disclaimer:</b><br><br></p>
<p>
CARA is a risk assessment tool developed to model the concentration of viruses in enclosed spaces, in order to inform space-management decisions.
</p>
<p>
CARA models the concentration profile of potential infectious viruses in enclosed spaces with clear and intuitive graphs.
The user can set a number of parameters, including room volume, exposure time, activity type, mask-wearing and ventilation.
The report generated indicates how to avoid exceeding critical concentrations and chains of airborne transmission in spaces such as individual offices, meeting rooms and labs.
</p>
<p>
The risk assessment tool simulates the long-range airborne spread SARS-CoV-2 virus in a finite volume, assuming a homogenous mixture, and estimates the risk of COVID-19 infection therein.
The results DO NOT include short-range airborne exposure (where the physical distance is a significant factor) nor the other known modes of SARS-CoV-2 transmission.
Hence, the output from this model is only valid when the other recommended public health & safety instructions are observed, such as adequate physical distancing, good hand hygiene and other barrier measures.
</p>
<p>
The model used is based on scientific publications relating to airborne transmission of infectious diseases, dose-response exposures and aerosol science, as of February 2021.
It can be used to compare the effectiveness of different airborne-related risk mitigation measures.
</p>
<p>
Note that this model applies a deterministic approach, i.e., it is assumed at least one person is infected and shedding viruses into the simulated volume.
Nonetheless, it is also important to understand that the absolute risk of infection is uncertain, as it will depend on the probability that someone infected attends the event.
The model is most useful for comparing the impact and effectiveness of different mitigation measures such as ventilation, filtration, exposure time, physical activity and
the size of the room, only considering long-range airborne transmission of COVID-19 in indoor settings.
</p>
<p>
This tool is designed to be informative, allowing the user to adapt different settings and model the relative impact on the estimated infection probabilities.
The objective is to facilitate targeted decision-making and investment through comparisons, rather than a singular determination of absolute risk.
While the SARS-CoV-2 virus is in circulation among the population, the notion of 'zero risk' or 'completely safe scenario' does not exist.
Each event modelled is unique, and the results generated therein are only as accurate as the inputs and assumptions.
</p>
<p>
CARA has not undergone review, approval or certification by competent authorities, and as a result, it cannot be considered
as a fully endorsed and reliable tool, namely in the assessment of potential viral emissions from infected hosts to be modelled.
</p>
{% endblock disclaimer %}
</div>
{% endblock disclaimer_container %}
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.2/html2pdf.bundle.js"></script>
</body>
</html>

View file

@ -13,7 +13,7 @@
{% endif %}
<div class="intro-banner-vdo-play-btn {{warning_color}} m-auto d-flex align-items-center justify-content-center">
<b style="font-size: larger">{{prob_inf | non_zero_percentage}}</b>
<b>{{prob_inf | non_zero_percentage}}</b>
<i class="glyphicon glyphicon-play whiteText" aria-hidden="true"></i>
<span class="ripple {{warning_color}}"></span>
<span class="ripple {{warning_color}}"></span>
@ -106,6 +106,7 @@
{% endblock report_scenarios_summary_table %}
{% block report_preamble %}
<br class="card_break">
<div class="tab-pane fade" id="rules" role="tabpanel" aria-labelledby="rules-tab" style="padding: 1%">
<div class="card bg-light mb-3">
<div class="card-header"><strong>Applicable rules </strong>