diff --git a/project/npda/templates/npda/visit_form.html b/project/npda/templates/npda/visit_form.html index 07fcf9dc..ffe0c9bb 100644 --- a/project/npda/templates/npda/visit_form.html +++ b/project/npda/templates/npda/visit_form.html @@ -29,12 +29,28 @@ {% endfor %}
- -
+ +
{% for field_category in form.categories %} {% with field_category|colour_for_category as background_colour %} {% if field_category == "Measurements" or field_category == "HBA1c" or field_category == "Treatment" or field_category == "CGM" or field_category == "BP"%} -
+
{% for field in form %} {% if field.field.category == field_category %}
@@ -70,17 +86,42 @@ {% endfor %}
- +
{% for field_category in form.categories %} {% with field_category|colour_for_category as background_colour %} {% if field_category == "Foot Care" or field_category == "DECS" or field_category == "ACR" or field_category == "Cholesterol" or field_category == "Thyroid" or field_category == "Coeliac" or field_category == "Psychology" or field_category == "Smoking" or field_category == "Dietician" or field_category == "Sick Day Rules" or field_category == "Immunisation (flu)" %} -
+
{{field_category}}
-
+
{% for field in form %} {% if field.field.category == field_category %}
@@ -117,45 +158,59 @@ {% endfor %}
- -
- {% for field_category in form.categories %} - {% with field_category|colour_for_category as background_colour %} - {% if field_category == "Hospital Admission" %} -
- {% for field in form %} - {% if field.field.category == field_category %} -
-
- -
-
- {% if field.field.widget|is_select %} - - {% elif field.field.widget|is_dateinput %} - - - - {% else %} - + +
+ {% for field_category in form.categories %} + {% with field_category|colour_for_category as background_colour %} + {% if field_category == "Hospital Admission" %} +
{{ error|escape }} -

- {% endfor %} -
+ {% if "Hospital Admission" in categories_with_errors %} + outline outline-8 outline-rcpch_red + {% endif %}" + > + {% for field in form %} + {% if field.field.category == field_category %} +
+
+ +
+
+ {% if field.field.widget|is_select %} + + {% elif field.field.widget|is_dateinput %} + + + + {% else %} + + {% endif %} + {% for error in field.errors %} +

+ {{ error|escape }} +

+ {% endfor %} +
+
+ {% endif %} + {% endfor %}
- {% endif %} - {% endfor %} -
- {% endif %} - {% endwith %} - {% endfor %} + {% endif %} + {% endwith %} + {% endfor %}
diff --git a/project/npda/templatetags/npda_tags.py b/project/npda/templatetags/npda_tags.py index a5ffc63d..89f63076 100644 --- a/project/npda/templatetags/npda_tags.py +++ b/project/npda/templatetags/npda_tags.py @@ -47,7 +47,7 @@ def colour_for_category(category): # returns a colour for a given category colours = [ {"category": VisitCategories.HBA1, "colour": "rcpch_red_light_tint2"}, - {"category": VisitCategories.MEASUREMENT, "colour": "rcpch_red"}, + {"category": VisitCategories.MEASUREMENT, "colour": "rcpch_vivid_green"}, {"category": VisitCategories.TREATMENT, "colour": "rcpch_orange"}, {"category": VisitCategories.CGM, "colour": "rcpch_orange_light_tint2"}, {"category": VisitCategories.BP, "colour": "rcpch_yellow"}, diff --git a/project/npda/views/visit.py b/project/npda/views/visit.py index c3b53011..a61268e1 100644 --- a/project/npda/views/visit.py +++ b/project/npda/views/visit.py @@ -85,15 +85,26 @@ def get_context_data(self, **kwargs): visit_instance = Visit.objects.get(pk=self.kwargs["pk"]) visit_categories = get_visit_categories(visit_instance) context["visit_categories"] = visit_categories + context["routine_measurements_categories"] = ["Measurements", "HBA1c", "Treatment", "CGM", "BP"] + context["annual_review_categories"] = ["Foot Care", "DECS", "ACR", "Cholesterol", "Thyroid", "Coeliac", "Psychology", "Smoking", "Dietician", "Sick Day Rules", "Immunisation (flu)"] categories_with_errors = [] categories_without_errors = [] + routine_measurements_categories_with_errors = [] + annual_review_categories_with_errors = [] for category in visit_categories: if category["has_error"] == False: categories_without_errors.append(category["category"]) else: categories_with_errors.append(category["category"]) + if category["category"] in context["routine_measurements_categories"]: + routine_measurements_categories_with_errors.append(category["category"]) + elif category["category"] in context["annual_review_categories"]: + annual_review_categories_with_errors.append(category["category"]) + context["routine_measurements_categories_with_errors"] = routine_measurements_categories_with_errors + context["annual_review_categories_with_errors"] = annual_review_categories_with_errors context["categories_with_errors"] = categories_with_errors context["categories_without_errors"] = categories_without_errors + return context def get_success_url(self):