diff --git a/caimira/apps/calculator/static/js/form.js b/caimira/apps/calculator/static/js/form.js index 6ed6c0b3..439daef7 100644 --- a/caimira/apps/calculator/static/js/form.js +++ b/caimira/apps/calculator/static/js/form.js @@ -328,6 +328,28 @@ function on_wearing_mask_change() { }) } +function on_vaccination_change() { + vaccination_option = $('input[type=radio][name=vaccine_option]'); + vaccination_option.each(function (index) { + if (this.checked) { + getChildElement($(this)).show(); + require_fields(this); + } + else { + getChildElement($(this)).hide(); + require_fields(this); + } + }) +} + +function on_vaccination_booster_change() { + vaccination_booster_option = $('input[type=radio][name=vaccine_booster_option]'); + vaccination_booster_option.each(function (index) { + if (this.checked) getChildElement($(this)).show(); + else getChildElement($(this)).hide(); + }) +} + function populate_temp_hum_values(data, index) { $("#sensor_temperature").text(Math.round(data[index].Details.T) + '°C'); $("#sensor_humidity").text(Math.round(data[index].Details.RH) + '%'); @@ -931,6 +953,18 @@ $(document).ready(function () { // Call the function now to handle forward/back button presses in the browser. on_wearing_mask_change(); + // When the vaccinated_option_option changes we want to make its respective + // children show/hide. + $("input[type=radio][name=vaccine_option]").change(on_vaccination_change); + // Call the function now to handle forward/back button presses in the browser. + on_vaccination_change(); + + // When the vaccinated_booster_option changes we want to make its respective + // children show/hide. + $("input[type=radio][name=vaccine_booster_option]").change(on_vaccination_booster_change); + // Call the function now to handle forward/back button presses in the browser. + on_vaccination_booster_change(); + // 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); diff --git a/caimira/apps/templates/base/calculator.form.html.j2 b/caimira/apps/templates/base/calculator.form.html.j2 index 665527f6..bc8ac04f 100644 --- a/caimira/apps/templates/base/calculator.form.html.j2 +++ b/caimira/apps/templates/base/calculator.form.html.j2 @@ -359,6 +359,67 @@ +
+
Vaccinated? 💉
+
+ + + + +
+
+ + +
@@ -381,7 +442,6 @@
-
Exposed person(s) presence:
@@ -427,7 +487,7 @@

The use of masks mitigates exposure at short-range. The analytical model with short-range interactions does not take mask wearing into account.

-
+

0 short-range interactions.

@@ -604,8 +664,6 @@
Coffee breaks are spread evenly throughout the day.
- -