diff --git a/cara/apps/calculator/static/css/form.css b/cara/apps/calculator/static/css/form.css index 3c048765..6a936803 100644 --- a/cara/apps/calculator/static/css/form.css +++ b/cara/apps/calculator/static/css/form.css @@ -6,6 +6,10 @@ color: black; } -.red { +.red_border { box-shadow: 0px 0px 2px 1px red; +} + +.red_text { + color: red; } \ No newline at end of file diff --git a/cara/apps/calculator/static/js/form.js b/cara/apps/calculator/static/js/form.js index 259cce35..33106522 100644 --- a/cara/apps/calculator/static/js/form.js +++ b/cara/apps/calculator/static/js/form.js @@ -160,12 +160,28 @@ function validate_form(form) { //Validate all dates $("input[required].datepicker").each(function () { - $(this).removeClass("red"); + $(this).removeClass("red_border"); + $(this).next().hide(); var fromDate = $(this).val(); if (!isValidDate(fromDate)) { - $(this).addClass("red"); + $(this).addClass("red_border"); submit = false; + $(this).next().show(); + } + }); + + //Validate all times + $("input[required].finish_time").each(function () { + $(this).removeClass("red_border"); + $(this).next().hide(); + + var startTime = parseValToNumber($(this).prev()); + var finishTime = parseValToNumber($(this)); + if (startTime > finishTime) { + $(this).addClass("red_border"); + submit = false; + $(this).next().show(); } }); @@ -183,6 +199,10 @@ function isValidDate(date) { return composedDate.getDate() == d && composedDate.getMonth() + 1 == m && composedDate.getFullYear() == y; } +function parseValToNumber(obj) { + return parseInt(obj.val().replace(':',''), 10); +} + /* ------ On Load ---------- */ $(document).ready(function () { diff --git a/cara/apps/calculator/templates/calculator.form.html.j2 b/cara/apps/calculator/templates/calculator.form.html.j2 index 74f3c3f7..d255f814 100644 --- a/cara/apps/calculator/templates/calculator.form.html.j2 +++ b/cara/apps/calculator/templates/calculator.form.html.j2 @@ -80,22 +80,25 @@ Beta v1.0.0 Please send feedback to Number of infected people:

Activity type:
Start:    - Finish:
+ Finish: +
Infected person(s) presence:
Start:    - Finish:
+ Finish: +
+
- When is the event?
   -
+ +
   - Finish:
+ Finish: +
@@ -162,7 +166,7 @@ Beta v1.0.0 Please send feedback to Enter the data on the available means for venting of indoor spaces. For mechanical ventilation, you should check with a specialist for the air flow or air change rate.
Event data
Enter the total number of occupants in the room and how many of them you assume are infected. We have provided common activity types:
- Office = typical scenario all persons seated, talking.
+ Office/Meeting = typical scenario all persons seated, talking.
Workshop = assembly workshop environment, all persons doing light exercise, talking.
Training = one person (the trainer) standing, talking, all others seated, talking quietly (whispering). It is assumed the trainer is the infected person, for the worst case scenario.
You should specify if the event is a one off (give date) or recurrent use of the same space for the same activity, in which case select the month when the activity takes place.
diff --git a/cara/apps/calculator/templates/report.html.j2 b/cara/apps/calculator/templates/report.html.j2 index 9f18d3f9..aab7f3dc 100644 --- a/cara/apps/calculator/templates/report.html.j2 +++ b/cara/apps/calculator/templates/report.html.j2 @@ -4,6 +4,8 @@ + Report | CARA (COVID Airborne Risk Assessment) + @@ -63,7 +65,7 @@ infected.

  • Activity type: {% if form.activity_type == "office" %} - Office work – typical scenario with all persons seated, talking. + Office/Meeting – typical scenario with all persons seated, talking. {% elif form.activity_type == "workshop" %} Workshop = assembly workshop environment, all persons doing light exercise, talking. {% elif form.activity_type == "training" %}