Added training infected limit

This commit is contained in:
gaazzopa 2020-11-13 16:30:35 +01:00
parent 8c3bd0dad8
commit ad604a3e5b
2 changed files with 14 additions and 1 deletions

View file

@ -153,7 +153,17 @@ function require_hepa(option) {
}
function setMaxInfectedPeople() {
$("#infected_people").attr("max", $("#total_people").val());
$("#training_limit_error").hide();
var max = $("#total_people").val()
if ($("#activity_type").val() === "training")
{
max = 1;
$("#training_limit_error").show();
}
$("#infected_people").attr("max", max);
}
/* -------UI------- */
@ -251,6 +261,8 @@ $(document).ready(function () {
setMaxInfectedPeople();
$("#total_people").change(setMaxInfectedPeople);
$("#activity_type").change(setMaxInfectedPeople);
var radioValue = $("input[name='event_type']:checked");
if (radioValue.val()) {
require_fields(radioValue.get(0));

View file

@ -106,6 +106,7 @@
</div><br>
Total number of occupants: <input type="number" id="total_people" name="total_people" min=1 required><br>
Number of infected people: <input type="number" id="infected_people" name="infected_people" min=1 required><br>
<span id="training_limit_error" class="red_text" hidden>Training activities limited to 1 infected</span><br>
<hr width="80%">
Activity type: <select id="activity_type" name="activity_type">