Merge branch 'develop/training-infected-limit' into 'master'

Added training infected limit

See merge request cara/cara!90
This commit is contained in:
Philip James Elson 2020-11-13 15:35:54 +00:00
commit d3786b74b2
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">