edited form display

This commit is contained in:
Luis Aleixo 2023-06-22 12:00:43 +02:00
parent 33f4491195
commit 8d2eb38025
3 changed files with 31 additions and 14 deletions

View file

@ -147,11 +147,10 @@ function submit_fitting_algorithm(url) {
})
.then((response) => response.json())
.then((json_response) => {
console.log(json_response)
$("#DIV_CO2_fitting_result").show();
$("#CO2_fitting_result").val(JSON.stringify(json_response));
$("#exhalation_rate_fit").html(String(json_response['exhalation_rate']));
$("#ventilation_rate_fit").html(json_response['ventilation_values']);
$("#exhalation_rate_fit").html('Exhalation rate: ' + String(json_response['exhalation_rate'].toFixed(2)) + ' m³/h');
// $("#ventilation_rate_fit").html(json_response['ventilation_values']);
$("#CO2_data_plot").attr("src", json_response['CO2_plot']);
$("#generate_fitting_data").html('Fit data');
$("#save_and_dismiss_dialog").show();

View file

@ -521,8 +521,8 @@ function on_CO2_data_option_change() {
CO2_data_options = $('input[type=radio][name=CO2_data_option]');
CO2_data_options.each(function (index){
if (this.checked) {
// if (this.id == 'CO2_data_yes') ventilation_from_fitting(true);
// else if (this.id == 'CO2_data_no') ventilation_from_fitting(false);
if (this.id == 'CO2_data_yes') ventilation_from_fitting(true);
else if (this.id == 'CO2_data_no') ventilation_from_fitting(false);
getChildElement($(this)).show();
require_fields(this);
}
@ -713,6 +713,8 @@ function validate_form(form) {
);
}
if ($("#CO2_fitting_result").val() == "") $("#CO2_data_no").click();
return submit;
}

View file

@ -671,13 +671,28 @@
<div>
<input class="ml-2" type="radio" id="CO2_data_no" name="CO2_data_option" value=0 checked="checked">
<label for="CO2_data_no">No</label>
<input class="ml-2" type="radio" id="CO2_data_yes" name="CO2_data_option" value=1 data-target="#DIVCO2_data" data-toggle="modal">
<input class="ml-2" type="radio" id="CO2_data_yes" name="CO2_data_option" value=1 data-enables="#DIVCO2_data">
<label for="CO2_data_yes">Yes</label>
</div>
</div>
<div id="DIVCO2_data" class="split" style="display: none">
<div>
For the CO₂ fitting algorithm, the following input values will be considered:
<ul>
<li>Room volume (m³)</li>
<li>Ventilation transition times</li>
<li>Total number of occupants</li>
<li>Presence transition times</li>
</ul>
</div>
<div class="align-self-center text-center">
<button type="button" class="btn btn-primary" style="width: 60%" data-toggle="modal" data-target="#DIVCO2_data_dialog" data-keyboard="false" data-backdrop="static">Fit Data</button>
</div>
</div>
<!-- CO2 Modal -->
<div class="modal fade" id="DIVCO2_data" tabindex="-1" role="dialog" aria-labelledby="CO2_values_title" aria-hidden="true" data-backdrop="static">
<div class="modal fade" id="DIVCO2_data_dialog" tabindex="-1" role="dialog" aria-labelledby="CO2_values_title" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog modal-lg" role="document" overflow: visible>
<div class="modal-content">
<div class="modal-header">
@ -701,18 +716,19 @@
<table id="display_excel_data" border="1" style="width: 70%; margin-left: auto; margin-right: auto"></table>
<input id="formatted_data" type="text" name="CO2_data" class="form-control form-control-sm d-none" placeholder='{"times": [...], "concentrations": [...]}' ><br>
<div id="CO2_input_data_div" style="display: none">
<p>The following data will be considered:</p><br>
<p id="CO2_input_data"></p>
{# <p>The following data will be considered:</p><br>
<p id="CO2_input_data"></p> #}
</div>
<input type="text" class="form-control d-none" name="CO2_fitting_result" id="CO2_fitting_result">
<div id="DIV_CO2_fitting_result" style="display: none">
<img id="CO2_data_plot"/>
<div>Exhalation rate: <p id="exhalation_rate_fit"></p> </div>
<div>Air exchange: <p id="ventilation_rate_fit"></p></div>
<h5 style="margin-top: auto; margin-bottom: auto">Fitting result</h5>
<img id="CO2_data_plot" style="margin-top: 2%"/>
<p id="exhalation_rate_fit"></p>
<p id="ventilation_rate_fit">Ventilation values in the plot (ACH)</p>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary dismiss_btn_frm_field" data-dismiss="modal" onclick="clear_fitting_algorithm()">Clear all</button>
<button type="button" class="btn btn-secondary dismiss_btn_frm_field" data-dismiss="modal" onclick="clear_fitting_algorithm()">Clear all/Discard</button>
<button type="button" id="generate_fitting_data" class="btn btn-primary close_btn_frm_field" onclick="submit_fitting_algorithm('{{ get_calculator_url() }}/co2-fit')" disabled>Fit data</button>
<button type="button" style="display: none" id="save_and_dismiss_dialog" class="btn btn-primary close_btn_frm_field" data-dismiss="modal">Save and close</button>
</div>