simplified the way to select previous ventilations
This commit is contained in:
parent
ddfe158467
commit
780467c195
2 changed files with 6 additions and 10 deletions
|
|
@ -247,6 +247,8 @@ function on_ventilation_type_change() {
|
|||
ventilation_types = $('input[type=radio][name=ventilation_type]');
|
||||
ventilation_types.each(function (index) {
|
||||
if (this.checked) {
|
||||
|
||||
if ($(this).val() != 'from_fitting') $('#button_fit_data').attr('data-previous-vent', $(this).val())
|
||||
getChildElement($(this)).show();
|
||||
require_fields(this);
|
||||
} else {
|
||||
|
|
@ -498,20 +500,14 @@ function ventilation_from_fitting(condition_from_fitting) {
|
|||
$('input[type=radio][id=mechanical_ventilation]').prop("disabled", condition_from_fitting);
|
||||
$('input[type=radio][id=natural_ventilation]').prop("disabled", condition_from_fitting);
|
||||
$('input[type=radio][id=from_fitting]').prop("disabled", !condition_from_fitting);
|
||||
|
||||
if (condition_from_fitting) {
|
||||
$('input[type=radio][id=from_fitting]').prop('checked',true);
|
||||
$('#DIVfrom_fitting').after($('#window_opening_regime'));
|
||||
}
|
||||
else {
|
||||
// Select the URL ventilation option, if any (from back-navigation)
|
||||
var url = new URL(decodeURIComponent(window.location.href));
|
||||
let ventilation_from_url;
|
||||
if (url.searchParams.has('ventilation_type')) {
|
||||
ventilation_from_url = url.searchParams.get('ventilation_type');
|
||||
if (ventilation_from_url == 'from_fitting') ventilation_from_url = 'no_ventilation';
|
||||
}
|
||||
else ventilation_from_url = 'no_ventilation';
|
||||
$(`input[type=radio][id=${ventilation_from_url}]`).prop('checked',true);
|
||||
let selected_ventilation = $("#button_fit_data").attr('data-previous-vent');
|
||||
$(`input[type=radio][id=${selected_ventilation}]`).prop('checked',true);
|
||||
$('#DIVopening_distance').after($('#window_opening_regime'));
|
||||
}
|
||||
on_ventilation_type_change();
|
||||
|
|
|
|||
|
|
@ -692,7 +692,7 @@
|
|||
</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>
|
||||
<button id="button_fit_data" type="button" class="btn btn-primary" style="width: 60%" data-toggle="modal" data-target="#DIVCO2_data_dialog" data-keyboard="false" data-backdrop="static" data-previous-vent="no_ventilation">Fit Data</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue