hide window parameters

This commit is contained in:
Luis Aleixo 2022-08-24 11:33:02 +01:00
parent 139e7ac91d
commit 862f65e5a0
2 changed files with 34 additions and 15 deletions

View file

@ -147,8 +147,6 @@ function require_air_supply(option) {
function require_venting(option) {
require_input_field("#windows_duration", option);
require_input_field("#windows_frequency", option);
set_disabled_status("#windows_duration", !option);
set_disabled_status("#windows_frequency", !option);
}
function require_lunch(id, option) {
@ -233,6 +231,20 @@ function on_ventilation_type_change() {
});
}
function on_window_opening_change() {
opening_regime = $('input[type=radio][name=window_opening_regime]')
opening_regime.each(function (index) {
if (this.checked) {
getChildElement($(this)).show();
require_fields(this);
}
else {
getChildElement($(this)).hide();
require_fields(this);
}
})
}
function on_hepa_option_change() {
hepa_option = $('input[type=radio][name=hepa_option]')
hepa_option.each(function (index) {
@ -493,7 +505,7 @@ function validate_form(form) {
});
//Validate window venting duration < venting frequency
if (!$("#windows_duration").hasClass("disabled")) {
if ($("#windows_open_periodically").prop('checked')) {
var windowsDurationObj = document.getElementById("windows_duration");
var windowsFrequencyObj = document.getElementById("windows_frequency");
removeErrorFor(windowsFrequencyObj);
@ -824,6 +836,12 @@ $(document).ready(function () {
// Call the function now to handle forward/back button presses in the browser.
on_ventilation_type_change();
// When the window_opening_regime changes we want to make its respective
// children show/hide.
$("input[type=radio][name=window_opening_regime]").change(on_window_opening_change);
// Call the function now to handle forward/back button presses in the browser.
on_window_opening_change();
// When the hepa filtration option changes we want to make its respective
// children show/hide.
$("input[type=radio][name=hepa_option]").change(on_hepa_option_change);
@ -839,7 +857,6 @@ $(document).ready(function () {
// When the short_range_option changes we want to make its respective
// children show/hide.
$("input[type=radio][name=short_range_option]").change(on_short_range_option_change);
// Call the function now to handle forward/back button presses in the browser.
on_short_range_option_change();

View file

@ -235,18 +235,20 @@
</div>
<input class="ml-2" type="radio" id="windows_open_permanently" name="window_opening_regime" value="windows_open_permanently" onclick="require_fields(this)" checked="checked"></span>
<label for="windows_open_permanently" class="col-form-label ml-2">Permanently</label>
<input class="ml-2" type="radio" id="windows_open_periodically" name="window_opening_regime" value="windows_open_periodically" onclick="require_fields(this)"></span>
<label for="windows_open_periodically" class="col-form-label ml-2 mr-2">Periodically:</label><br>
<input class="ml-2" type="radio" id="windows_open_periodically" name="window_opening_regime" value="windows_open_periodically" onclick="require_fields(this)" data-enables="#DIVperiodic_opening"></span>
<label for="windows_open_periodically" class="col-form-label ml-2 mr-2">Periodically</label>
<div id="DIVperiodic_opening">
<div class="form-group row tabbed">
<div class="col-md-5"><label for="window_duration" class="col-form-label ml-2">Duration (min):</label></div>
<div class="col-md-5"><input type="number" step="any" id="windows_duration" class="non_zero form-control" name="windows_duration" value="10" min="1" data-has-radio="#windows_open_periodically"></div>
</div>
<div class="form-group row tabbed">
<div class="col-md-5"><label for="window_frequency" class="col-form-label ml-2">Frequency (min):</label></div>
<div class="col-md-5"><input type="number" step="any" id="windows_frequency" class="non_zero form-control" name="windows_frequency" value="60" min="1" data-has-radio="#windows_open_periodically"></div>
</div>
</div>
<div class="form-group row tabbed">
<div class="col-md-5"><label for="window_duration" class="col-form-label ml-2">Duration (min):</label></div>
<div class="col-md-5"><input type="number" step="any" id="windows_duration" class="non_zero disabled form-control" name="windows_duration" value="10" min="1" data-has-radio="#windows_open_periodically"></div>
</div>
<div class="form-group row tabbed">
<div class="col-md-5"><label for="window_frequency" class="col-form-label ml-2">Frequency (min):</label></div>
<div class="col-md-5"><input type="number" step="any" id="windows_frequency" class="non_zero disabled form-control" name="windows_frequency" value="60" min="1" data-has-radio="#windows_open_periodically"></div>
</div>
<br>
</div>
<br/>
<div class='sub_title'>HEPA filtration:</div>