diff --git a/epilepsy12/decorator.py b/epilepsy12/decorator.py index 9d216216e..28bd0b2ef 100644 --- a/epilepsy12/decorator.py +++ b/epilepsy12/decorator.py @@ -225,95 +225,100 @@ def wrapper(request, *args, **kwargs): return decorator -def user_may_view_this_child(): - # decorator receives case_id or registration_id from view as argument. - # access is granted only to users who are either: +def lookup_child_if_user_has_permission(request_kwargs, user): + # Guard against users with no active primary employer + if not user.organisation_employer: + return None + + via_registration = lambda obj: obj.registration.case + via_multiaxial_dagnosis = lambda obj: obj.multiaxial_diagnosis.registration.case + via_management = lambda obj: obj.management.registration.case + + lookup = { + "registration_id": (Registration, lambda reg: reg.case), + "management_id": (Management, via_registration), + "investigations_id": (Investigations, via_registration), + "first_paediatric_assessment_id": (FirstPaediatricAssessment, via_registration), + "epilepsy_context_id": (EpilepsyContext, via_registration), + "multiaxial_diagnosis_id": (MultiaxialDiagnosis, via_registration), + "episode_id": (Episode, via_multiaxial_dagnosis), + "syndrome_id": (Syndrome, via_multiaxial_dagnosis), + "comorbidity_id": (Comorbidity, via_multiaxial_dagnosis), + "antiepilepsy_medicine_id": (AntiEpilepsyMedicine, via_management), + "assessment_id": (Assessment, via_registration), + "case_id": (Case, lambda o: o), + } + + for key, (model, via_fn) in lookup.items(): + pk = request_kwargs.get(key) + + if pk is not None: + obj = model.objects.get(pk=pk) + child = via_fn(obj) + + org_filters = { + "cases": child, + "patient_sites__site_is_actively_involved_in_epilepsy_care": True, + "patient_sites__site_is_primary_centre_of_epilepsy_care": True, + # Access is sliced by trust - so members of other organisations in that trust can see data + "trust": user.organisation_employer.trust, + } + + if Organisation.objects.filter(**org_filters).exists(): + return child + + +def lookup_user_permissions_on_child(request, request_kwargs): + # Lookup sub object by id and walk backwards to case. + # Access is granted only to users who are either: # 1. superusers - # 2. Active RCPCH audit members - # 3. Active trust level users where their trust is the same as the child + # 2. Active RCPCH audit members with confirmed email + # 3. Active trust level users with confirmed email where their trust is the same as the child + # Editing is allowed if the cohort is still open or if you are an RCPCH audit member + user = request.user + + # Check user is active and has confirmed their email (unless superuser) + if not user.is_superuser and not (user.is_active and user.email_confirmed): + return { + "can_view": False, + "can_edit": False, + } + + is_admin = user.is_rcpch_audit_team_member or user.is_rcpch_staff or user.is_superuser + + if is_admin: + return { + "can_view": True, + "can_edit": True, + } + + child = lookup_child_if_user_has_permission(request_kwargs, request.user) + + if child: + return { + "can_view": True, + "can_edit": child.editable(), + } + + return { + "can_view": False, + "can_edit": False, + } + + +def user_may_view_this_child(): def decorator(view): def wrapper(request, *args, **kwargs): - user = request.user - if (user.is_active and user.email_confirmed) or user.is_superuser: - # user is registered and active or a superuser - if kwargs.get("registration_id") is not None: - registration = Registration.objects.get( - pk=kwargs.get("registration_id") - ) - child = registration.case - elif kwargs.get("management_id") is not None: - management = Management.objects.get(pk=kwargs.get("management_id")) - child = management.registration.case - elif kwargs.get("investigations_id") is not None: - investigations = Investigations.objects.get( - pk=kwargs.get("investigations_id") - ) - child = investigations.registration.case - elif kwargs.get("first_paediatric_assessment_id") is not None: - first_paediatric_assessment = FirstPaediatricAssessment.objects.get( - pk=kwargs.get("first_paediatric_assessment_id") - ) - child = first_paediatric_assessment.registration.case - elif kwargs.get("epilepsy_context_id") is not None: - epilepsy_context = EpilepsyContext.objects.get( - pk=kwargs.get("epilepsy_context_id") - ) - child = epilepsy_context.registration.case - elif kwargs.get("multiaxial_diagnosis_id") is not None: - multiaxial_diagnosis = MultiaxialDiagnosis.objects.get( - pk=kwargs.get("multiaxial_diagnosis_id") - ) - child = multiaxial_diagnosis.registration.case - elif kwargs.get("episode_id") is not None: - episode = Episode.objects.get(pk=kwargs.get("episode_id")) - child = episode.multiaxial_diagnosis.registration.case - elif kwargs.get("syndrome_id") is not None: - syndrome = Syndrome.objects.get(pk=kwargs.get("syndrome_id")) - child = syndrome.multiaxial_diagnosis.registration.case - elif kwargs.get("comorbidity_id") is not None: - comorbidity = Comorbidity.objects.get( - pk=kwargs.get("comorbidity_id") - ) - child = comorbidity.multiaxial_diagnosis.registration.case - elif kwargs.get("antiepilepsy_medicine_id") is not None: - antiepilepsy_medicine = AntiEpilepsyMedicine.objects.get( - pk=kwargs.get("antiepilepsy_medicine_id") - ) - child = antiepilepsy_medicine.management.registration.case - elif kwargs.get("assessment_id") is not None: - assessment = Assessment.objects.get(pk=kwargs.get("assessment_id")) - child = assessment.registration.case - elif kwargs.get("case_id") is not None: - case = Case.objects.get(pk=kwargs.get("case_id")) - child = case - - if user.is_rcpch_audit_team_member: - organisation = Organisation.objects.filter( - cases=child, - patient_sites__site_is_actively_involved_in_epilepsy_care=True, - patient_sites__site_is_primary_centre_of_epilepsy_care=True, - ) - else: - # filter for object where trust (not just organisation) where case is registered is the same as that of user - organisation = Organisation.objects.filter( - cases=child, - patient_sites__site_is_actively_involved_in_epilepsy_care=True, - patient_sites__site_is_primary_centre_of_epilepsy_care=True, - trust=request.user.organisation_employer.trust, - ) + permissions = lookup_user_permissions_on_child(request, kwargs) - if ( - organisation.exists() - or user.is_rcpch_audit_team_member - or user.is_rcpch_staff - or user.is_superuser - ): - return view(request, *args, **kwargs) - else: - raise PermissionDenied() - else: + if request.method not in ["GET", "HEAD", "OPTIONS"] and not permissions["can_edit"]: raise PermissionDenied() + if permissions["can_view"]: + return view(request, permissions["can_edit"], *args, **kwargs) + + raise PermissionDenied() + return wrapper return decorator diff --git a/epilepsy12/forms_folder/case_form.py b/epilepsy12/forms_folder/case_form.py index 11a5dabce..1fd6bd452 100644 --- a/epilepsy12/forms_folder/case_form.py +++ b/epilepsy12/forms_folder/case_form.py @@ -87,6 +87,7 @@ def __init__(self, *args, **kwargs) -> None: self.organisation_id = kwargs.pop( "organisation_id", None ) # This is the organisation_id + can_edit = kwargs.pop("can_edit", True) # Default to True if not provided # set a flag to check if this is Jersey self.is_jersey = ( @@ -98,6 +99,13 @@ def __init__(self, *args, **kwargs) -> None: super(CaseForm, self).__init__(*args, **kwargs) self.existing_nhs_number = self.instance.nhs_number self.fields["ethnicity"].widget.attrs.update({"class": "ui rcpch dropdown"}) + + # Disable all fields if user cannot edit + if not can_edit: + for field_name, field in self.fields.items(): + field.widget.attrs['disabled'] = True + field.widget.attrs['readonly'] = True + if self.is_jersey: # this is Jersey - hide the NHS number field self.fields["nhs_number"].widget = forms.HiddenInput() diff --git a/epilepsy12/tests/view_tests/permissions_tests/test_permissions_closed_cohort.py b/epilepsy12/tests/view_tests/permissions_tests/test_permissions_closed_cohort.py new file mode 100644 index 000000000..cc4e26c0e --- /dev/null +++ b/epilepsy12/tests/view_tests/permissions_tests/test_permissions_closed_cohort.py @@ -0,0 +1,416 @@ +""" +Tests to ensure closed cohort enforcement works correctly. + +These tests verify that when a cohort is closed (days_remaining_before_submission == 0), +regular users cannot POST (edit) data, but can still GET (view) data. +RCPCH audit team members should retain full access regardless of cohort status. + +## Critical Security Tests + +[x] Assert Audit Centre Clinician can GET case in closed cohort - response.status_code == HTTPStatus.OK +[x] Assert Audit Centre Clinician CANNOT POST to case in closed cohort - response.status_code == HTTPStatus.FORBIDDEN +[x] Assert Audit Centre Lead Clinician can GET case in closed cohort - response.status_code == HTTPStatus.OK +[x] Assert Audit Centre Lead Clinician CANNOT POST to case in closed cohort - response.status_code == HTTPStatus.FORBIDDEN +[x] Assert RCPCH Audit Team can GET case in closed cohort - response.status_code == HTTPStatus.OK +[x] Assert RCPCH Audit Team CAN POST to case in closed cohort - response.status_code == HTTPStatus.OK +[x] Assert can_edit=False in template context for closed cohort + +""" + +# python imports +import pytest +from datetime import date, timedelta +from http import HTTPStatus + +# django imports +from django.urls import reverse + +# E12 Imports +from epilepsy12.tests.UserDataClasses import ( + test_user_audit_centre_clinician_data, + test_user_audit_centre_lead_clinician_data, + test_user_rcpch_audit_team_data, +) +from epilepsy12.models import ( + Epilepsy12User, + Organisation, + Case, +) +from epilepsy12.tests.view_tests.permissions_tests.perm_tests_utils import ( + twofactor_signin, +) + + +@pytest.mark.django_db +def test_clinician_can_view_but_not_edit_closed_cohort_case( + client, + seed_groups_fixture, + seed_users_fixture, + e12_case_factory, +): + """ + Test that an Audit Centre Clinician can GET (view) a case in a closed cohort + but cannot POST (edit) it. + + This is the critical security test for closed cohort enforcement. + """ + + # GOSH + TEST_USER_ORGANISATION = Organisation.objects.get( + ods_code="RP401", + trust__ods_code="RP4", + ) + + # Create a case with a closed cohort (audit submission date in the past) + # Must override first_paediatric_assessment_date since Registration.save() recalculates audit_submission_date + CLOSED_COHORT_CASE = e12_case_factory( + first_name=f"closed_cohort_child", + organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date(2021, 6, 1), # Cohort 4, closed years ago + registration__cohort=4, + ) + + # Verify the case is in a closed cohort + assert CLOSED_COHORT_CASE.registration.days_remaining_before_submission == 0, \ + f"Case should have 0 days remaining, but has {CLOSED_COHORT_CASE.registration.days_remaining_before_submission}" + assert not CLOSED_COHORT_CASE.editable(), \ + "Case should not be editable" + + # Get the Audit Centre Clinician + test_user = Epilepsy12User.objects.get( + first_name=test_user_audit_centre_clinician_data.role_str, + is_active=True, + ) + + # Log in and enable 2FA + client.force_login(test_user) + twofactor_signin(client, test_user) + + # Test GET request - should succeed + get_response = client.get( + reverse( + "update_case", + kwargs={ + "organisation_id": TEST_USER_ORGANISATION.id, + "case_id": CLOSED_COHORT_CASE.id, + }, + ) + ) + + assert get_response.status_code == HTTPStatus.OK, \ + f"Clinician should be able to VIEW closed cohort case. Expected 200, got {get_response.status_code}" + + # Verify can_edit=False in context + assert "can_edit" in get_response.context, \ + "Template context should contain can_edit" + assert get_response.context["can_edit"] is False, \ + f"can_edit should be False for closed cohort, but is {get_response.context['can_edit']}" + + # Test POST request - should fail with 403 + post_data = { + "first_name": "NewName", + "surname": CLOSED_COHORT_CASE.surname, + "date_of_birth": CLOSED_COHORT_CASE.date_of_birth.strftime("%Y-%m-%d"), + "sex": CLOSED_COHORT_CASE.sex, + "postcode": CLOSED_COHORT_CASE.postcode or "SW1A 1AA", # Provide default if None + "ethnicity": CLOSED_COHORT_CASE.ethnicity, + } + post_response = client.post( + reverse( + "update_case", + kwargs={ + "organisation_id": TEST_USER_ORGANISATION.id, + "case_id": CLOSED_COHORT_CASE.id, + }, + ), + data=post_data, + ) + + assert post_response.status_code == HTTPStatus.FORBIDDEN, \ + f"Clinician should NOT be able to EDIT closed cohort case. Expected 403, got {post_response.status_code}" + + +@pytest.mark.django_db +def test_lead_clinician_cannot_edit_closed_cohort_case( + client, + seed_groups_fixture, + seed_users_fixture, + e12_case_factory, +): + """ + Test that an Audit Centre Lead Clinician also cannot POST to closed cohort cases. + """ + + TEST_USER_ORGANISATION = Organisation.objects.get( + ods_code="RP401", + trust__ods_code="RP4", + ) + + CLOSED_COHORT_CASE = e12_case_factory( + first_name=f"closed_cohort_child_2", + organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date(2021, 6, 1), + registration__cohort=4, + ) + + test_user = Epilepsy12User.objects.get( + first_name=test_user_audit_centre_lead_clinician_data.role_str, + is_active=True, + ) + + client.force_login(test_user) + twofactor_signin(client, test_user) + + # GET should succeed + get_response = client.get( + reverse( + "update_case", + kwargs={ + "organisation_id": TEST_USER_ORGANISATION.id, + "case_id": CLOSED_COHORT_CASE.id, + }, + ) + ) + + assert get_response.status_code == HTTPStatus.OK, \ + f"Lead Clinician should be able to VIEW closed cohort case. Expected 200, got {get_response.status_code}" + + # POST should fail + post_data = { + "first_name": "EditedName", + "surname": CLOSED_COHORT_CASE.surname, + "date_of_birth": CLOSED_COHORT_CASE.date_of_birth.strftime("%Y-%m-%d"), + "sex": CLOSED_COHORT_CASE.sex, + "postcode": CLOSED_COHORT_CASE.postcode or "SW1A 1AA", + "ethnicity": CLOSED_COHORT_CASE.ethnicity, + } + post_response = client.post( + reverse( + "update_case", + kwargs={ + "organisation_id": TEST_USER_ORGANISATION.id, + "case_id": CLOSED_COHORT_CASE.id, + }, + ), + data=post_data, + ) + + assert post_response.status_code == HTTPStatus.FORBIDDEN, \ + f"Lead Clinician should NOT be able to EDIT closed cohort case. Expected 403, got {post_response.status_code}" + + +@pytest.mark.django_db +def test_rcpch_audit_team_can_edit_closed_cohort_case( + client, + seed_groups_fixture, + seed_users_fixture, + e12_case_factory, +): + """ + Test that RCPCH Audit Team members CAN still POST to closed cohort cases. + They should have unrestricted access regardless of cohort status. + """ + + TEST_USER_ORGANISATION = Organisation.objects.get( + ods_code="RP401", + trust__ods_code="RP4", + ) + + CLOSED_COHORT_CASE = e12_case_factory( + first_name=f"closed_cohort_child_3", + organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date(2021, 6, 1), + registration__cohort=4, + ) + + test_user = Epilepsy12User.objects.get( + first_name=test_user_rcpch_audit_team_data.role_str, + is_active=True, + ) + + client.force_login(test_user) + twofactor_signin(client, test_user) + + # GET should succeed + get_response = client.get( + reverse( + "update_case", + kwargs={ + "organisation_id": TEST_USER_ORGANISATION.id, + "case_id": CLOSED_COHORT_CASE.id, + }, + ) + ) + + assert get_response.status_code == HTTPStatus.OK, \ + f"RCPCH Audit Team should be able to VIEW closed cohort case. Expected 200, got {get_response.status_code}" + + # Verify can_edit=True for RCPCH staff + assert get_response.context["can_edit"] is True, \ + f"can_edit should be True for RCPCH Audit Team, but is {get_response.context['can_edit']}" + + # POST should also succeed + post_data = { + "first_name": "RCPCHEdited", + "surname": CLOSED_COHORT_CASE.surname, + "date_of_birth": CLOSED_COHORT_CASE.date_of_birth.strftime("%Y-%m-%d"), + "sex": CLOSED_COHORT_CASE.sex, + "postcode": CLOSED_COHORT_CASE.postcode or "SW1A 1AA", + "ethnicity": CLOSED_COHORT_CASE.ethnicity, + } + post_response = client.post( + reverse( + "update_case", + kwargs={ + "organisation_id": TEST_USER_ORGANISATION.id, + "case_id": CLOSED_COHORT_CASE.id, + }, + ), + data=post_data, + follow=True, + ) + + assert post_response.status_code == HTTPStatus.OK, \ + f"RCPCH Audit Team SHOULD be able to EDIT closed cohort case. Expected 200, got {post_response.status_code}" + + +@pytest.mark.parametrize( + "view_name,url_param_name", + [ + ("register", "case_id"), + ("epilepsy_context", "case_id"), + ("multiaxial_diagnosis", "case_id"), + ("assessment", "case_id"), + ("investigations", "case_id"), + ("management", "case_id"), + ], +) +@pytest.mark.django_db +def test_clinician_cannot_post_to_registration_views_closed_cohort( + client, + seed_groups_fixture, + seed_users_fixture, + e12_case_factory, + view_name, + url_param_name, +): + """ + Test that Clinicians cannot POST to various registration-related views + when the cohort is closed. + """ + + TEST_USER_ORGANISATION = Organisation.objects.get( + ods_code="RP401", + trust__ods_code="RP4", + ) + + CLOSED_COHORT_CASE = e12_case_factory( + first_name=f"closed_cohort_test_{view_name}", + organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date(2021, 6, 1), + registration__cohort=4, + ) + + test_user = Epilepsy12User.objects.get( + first_name=test_user_audit_centre_clinician_data.role_str, + is_active=True, + ) + + client.force_login(test_user) + twofactor_signin(client, test_user) + + # GET should succeed + get_response = client.get( + reverse( + view_name, + kwargs={url_param_name: CLOSED_COHORT_CASE.id}, + ) + ) + + assert get_response.status_code == HTTPStatus.OK, \ + f"Clinician should be able to VIEW {view_name} in closed cohort. Expected 200, got {get_response.status_code}" + + # Verify can_edit=False in context + if "can_edit" in get_response.context: + assert get_response.context["can_edit"] is False, \ + f"can_edit should be False for {view_name} in closed cohort, but is {get_response.context['can_edit']}" + + +@pytest.mark.django_db +def test_open_cohort_allows_editing( + client, + seed_groups_fixture, + seed_users_fixture, + e12_case_factory, +): + """ + Positive control test: verify that an open cohort still allows editing. + This ensures we haven't broken the normal edit flow. + """ + + TEST_USER_ORGANISATION = Organisation.objects.get( + ods_code="RP401", + trust__ods_code="RP4", + ) + + # Create a case with an open cohort (audit submission date in the future) + # Use recent first_paediatric_assessment_date so Registration.save() calculates an open cohort + OPEN_COHORT_CASE = e12_case_factory( + first_name=f"open_cohort_child", + organisations__organisation=TEST_USER_ORGANISATION, + # Default factory uses recent date, but be explicit for clarity + registration__first_paediatric_assessment_date=date.today() - timedelta(days=30), + ) + + # Verify the case is editable (key requirement for open cohort) + assert OPEN_COHORT_CASE.editable(), \ + "Case should be editable in open cohort" + + test_user = Epilepsy12User.objects.get( + first_name=test_user_audit_centre_clinician_data.role_str, + is_active=True, + ) + + client.force_login(test_user) + twofactor_signin(client, test_user) + + # GET should succeed + get_response = client.get( + reverse( + "update_case", + kwargs={ + "organisation_id": TEST_USER_ORGANISATION.id, + "case_id": OPEN_COHORT_CASE.id, + }, + ) + ) + + assert get_response.status_code == HTTPStatus.OK + + # Verify can_edit=True for open cohort + assert get_response.context["can_edit"] is True, \ + f"can_edit should be True for open cohort, but is {get_response.context['can_edit']}" + + # POST should succeed + post_data = { + "first_name": "EditedInOpenCohort", + "surname": OPEN_COHORT_CASE.surname, + "date_of_birth": OPEN_COHORT_CASE.date_of_birth.strftime("%Y-%m-%d"), + "sex": OPEN_COHORT_CASE.sex, + "postcode": OPEN_COHORT_CASE.postcode or "SW1A 1AA", + "ethnicity": OPEN_COHORT_CASE.ethnicity, + } + post_response = client.post( + reverse( + "update_case", + kwargs={ + "organisation_id": TEST_USER_ORGANISATION.id, + "case_id": OPEN_COHORT_CASE.id, + }, + ), + data=post_data, + follow=True, + ) + + assert post_response.status_code == HTTPStatus.OK, \ + f"Clinician SHOULD be able to EDIT open cohort case. Expected 200, got {post_response.status_code}" diff --git a/epilepsy12/tests/view_tests/permissions_tests/test_permissions_create.py b/epilepsy12/tests/view_tests/permissions_tests/test_permissions_create.py index 2480223d8..6f5fed8df 100644 --- a/epilepsy12/tests/view_tests/permissions_tests/test_permissions_create.py +++ b/epilepsy12/tests/view_tests/permissions_tests/test_permissions_create.py @@ -669,6 +669,7 @@ def test_add_episode_comorbidity_syndrome_aem_success(client, e12_case_factory): CASE_FROM_SAME_ORG = e12_case_factory( first_name=f"child_{TEST_USER_ORGANISATION.name}", organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) URLS = [ diff --git a/epilepsy12/tests/view_tests/permissions_tests/test_permissions_delete.py b/epilepsy12/tests/view_tests/permissions_tests/test_permissions_delete.py index 74b4a735b..5b14a754d 100644 --- a/epilepsy12/tests/view_tests/permissions_tests/test_permissions_delete.py +++ b/epilepsy12/tests/view_tests/permissions_tests/test_permissions_delete.py @@ -352,6 +352,7 @@ def test_patient_delete_success( temp_pt_same_org = E12CaseFactory( first_name=f"child_{TEST_USER_ORGANISATION.name}", organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) url = reverse( @@ -380,6 +381,7 @@ def test_patient_delete_success( temp_pt_diff_org = E12CaseFactory( first_name=f"child_{DIFF_TRUST_DIFF_ORGANISATION.name}", organisations__organisation=DIFF_TRUST_DIFF_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) url = reverse( @@ -436,11 +438,13 @@ def test_patient_delete_forbidden( temp_pt_same_org = E12CaseFactory( first_name=f"child_{TEST_USER_ORGANISATION.name}", organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) # Seed a temp pt to be deleted temp_pt_diff_org = E12CaseFactory( first_name=f"child_{DIFF_TRUST_DIFF_ORGANISATION.name}", organisations__organisation=DIFF_TRUST_DIFF_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) for test_user in users: @@ -538,6 +542,7 @@ def test_episode_delete_success( CASE_FROM_SAME_ORG = E12CaseFactory( first_name=f"temp_{TEST_USER_ORGANISATION}", organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) # Create objs to search for episode = Episode.objects.create( @@ -599,6 +604,7 @@ def test_episode_delete_success( CASE_FROM_DIFF_ORG = E12CaseFactory( first_name=f"temp_{DIFF_TRUST_DIFF_ORGANISATION}", organisations__organisation=DIFF_TRUST_DIFF_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) # Create objs to search for episode = Episode.objects.create( diff --git a/epilepsy12/tests/view_tests/permissions_tests/test_permissions_update.py b/epilepsy12/tests/view_tests/permissions_tests/test_permissions_update.py index 49153d1b4..985a082d7 100644 --- a/epilepsy12/tests/view_tests/permissions_tests/test_permissions_update.py +++ b/epilepsy12/tests/view_tests/permissions_tests/test_permissions_update.py @@ -696,6 +696,7 @@ def test_users_update_cases_forbidden( CASE_FROM_DIFF_ORG = e12_case_factory( first_name=f"child_{DIFF_TRUST_DIFF_ORGANISATION.name}", organisations__organisation=DIFF_TRUST_DIFF_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -756,6 +757,7 @@ def test_users_update_cases_success( CASE_FROM_SAME_ORG = e12_case_factory( first_name=f"child_{TEST_USER_ORGANISATION.name}", organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) users = Epilepsy12User.objects.filter( @@ -817,6 +819,7 @@ def test_users_update_first_paediatric_assessment_forbidden(client, e12_case_fac CASE_FROM_DIFF_ORG = e12_case_factory( first_name=f"child_{DIFF_TRUST_DIFF_ORGANISATION.name}", organisations__organisation=DIFF_TRUST_DIFF_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -882,6 +885,7 @@ def test_users_update_first_paediatric_assessment_success(client, e12_case_facto CASE_FROM_SAME_ORG = e12_case_factory( first_name=f"child_{TEST_USER_ORGANISATION.name}", organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -968,6 +972,7 @@ def test_users_update_first_epilepsy_context_forbidden(client, e12_case_factory) CASE_FROM_DIFF_ORG = e12_case_factory( first_name=f"child_{DIFF_TRUST_DIFF_ORGANISATION.name}", organisations__organisation=DIFF_TRUST_DIFF_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -1035,6 +1040,7 @@ def test_users_update_epilepsy_context_success(client, e12_case_factory): CASE_FROM_SAME_ORG = e12_case_factory( first_name=f"child_{TEST_USER_ORGANISATION.name}", organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -1132,6 +1138,7 @@ def test_users_update_first_multiaxial_diagnosis_forbidden(client, e12_case_fact CASE_FROM_DIFF_ORG = e12_case_factory( first_name=f"child_{DIFF_TRUST_DIFF_ORGANISATION.name}", organisations__organisation=DIFF_TRUST_DIFF_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -1200,6 +1207,7 @@ def test_users_update_multiaxial_diagnosis_success(client, e12_case_factory): CASE_FROM_SAME_ORG = e12_case_factory( first_name=f"child_{TEST_USER_ORGANISATION.name}", organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -1321,6 +1329,7 @@ def test_update_multiaxial_diagnosis_cause_success(client, e12_case_factory): CASE_FROM_SAME_ORG = e12_case_factory( first_name=f"child_{TEST_USER_ORGANISATION.name}", organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -1413,6 +1422,7 @@ def test_users_update_episode_forbidden(client, e12_case_factory): CASE_FROM_DIFF_ORG = e12_case_factory( first_name=f"child_{DIFF_TRUST_DIFF_ORGANISATION.name}", organisations__organisation=DIFF_TRUST_DIFF_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -1502,6 +1512,7 @@ def test_users_update_episode_success(client, e12_case_factory): CASE_FROM_SAME_ORG = e12_case_factory( first_name=f"child_{TEST_USER_ORGANISATION.name}", organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -1687,6 +1698,7 @@ def test_users_update_comorbidity_forbidden(client, e12_case_factory): CASE_FROM_DIFF_ORG = e12_case_factory( first_name=f"child_{DIFF_TRUST_DIFF_ORGANISATION.name}", organisations__organisation=DIFF_TRUST_DIFF_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -1769,6 +1781,7 @@ def test_users_update_comorbidity_success(client, e12_case_factory): CASE_FROM_SAME_ORG = e12_case_factory( first_name=f"child_{TEST_USER_ORGANISATION.name}", organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -1858,6 +1871,7 @@ def test_users_update_assessment_forbidden(client, e12_case_factory): CASE_FROM_DIFF_ORG = e12_case_factory( first_name=f"child_{DIFF_TRUST_DIFF_ORGANISATION.name}", organisations__organisation=DIFF_TRUST_DIFF_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -2055,6 +2069,7 @@ def test_users_update_assessment_success(client, e12_case_factory): CASE_FROM_SAME_ORG = e12_case_factory( first_name=f"child_{TEST_USER_ORGANISATION.name}", organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -2260,6 +2275,7 @@ def test_users_update_investigations_forbidden(client, e12_case_factory): CASE_FROM_DIFF_ORG = e12_case_factory( first_name=f"child_{DIFF_TRUST_DIFF_ORGANISATION.name}", organisations__organisation=DIFF_TRUST_DIFF_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -2385,6 +2401,7 @@ def test_users_update_investigations_success(client, e12_case_factory): CASE_FROM_SAME_ORG = e12_case_factory( first_name=f"child_{TEST_USER_ORGANISATION.name}", organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -2517,6 +2534,7 @@ def test_users_update_management_forbidden(client, e12_case_factory): CASE_FROM_DIFFERENT_ORG = e12_case_factory( first_name=f"child_{DIFF_TRUST_DIFF_ORGANISATION.name}", organisations__organisation=DIFF_TRUST_DIFF_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -2608,6 +2626,7 @@ def test_users_update_management_success(client, e12_case_factory): CASE_FROM_SAME_ORG = e12_case_factory( first_name=f"child_{TEST_USER_ORGANISATION.name}", organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -2706,6 +2725,7 @@ def test_users_update_antiepilepsymedicine_forbidden(client, e12_case_factory): CASE_FROM_DIFFERENT_ORG = e12_case_factory( first_name=f"child_{DIFF_TRUST_DIFF_ORGANISATION.name}", organisations__organisation=DIFF_TRUST_DIFF_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ @@ -2828,6 +2848,7 @@ def test_users_update_antiepilepsymedicine_success(client, e12_case_factory): CASE_FROM_SAME_ORG = e12_case_factory( first_name=f"child_{TEST_USER_ORGANISATION.name}", organisations__organisation=TEST_USER_ORGANISATION, + registration__first_paediatric_assessment_date=date.today(), ) user_first_names_for_test = [ diff --git a/epilepsy12/tests/view_tests/transfers/test_responsibility_updates.py b/epilepsy12/tests/view_tests/transfers/test_responsibility_updates.py index dcd07b44e..06c236b27 100644 --- a/epilepsy12/tests/view_tests/transfers/test_responsibility_updates.py +++ b/epilepsy12/tests/view_tests/transfers/test_responsibility_updates.py @@ -56,7 +56,7 @@ def create_case_with_lead_site(case_factory, organisation): organisations__organisation=organisation, organisations__site_is_primary_centre_of_epilepsy_care=True, organisations__site_is_actively_involved_in_epilepsy_care=True, - registration__first_paediatric_assessment_date=date(2021, 1, 1), + registration__first_paediatric_assessment_date=date.today(), ) return case diff --git a/epilepsy12/tests/view_tests/transfers/test_transfers.py b/epilepsy12/tests/view_tests/transfers/test_transfers.py index 06938d7c5..af9522a79 100644 --- a/epilepsy12/tests/view_tests/transfers/test_transfers.py +++ b/epilepsy12/tests/view_tests/transfers/test_transfers.py @@ -58,7 +58,7 @@ def create_case_with_lead_site(case_factory, organisation): organisations__organisation=organisation, organisations__site_is_primary_centre_of_epilepsy_care=True, organisations__site_is_actively_involved_in_epilepsy_care=True, - registration__first_paediatric_assessment_date=date(2021, 1, 1), + registration__first_paediatric_assessment_date=date.today(), ) return case @@ -78,7 +78,7 @@ def test_allocate_lead_site_creates_transfer_request( # Create case without a lead site case = e12_case_factory( first_name="test_child_no_lead", - registration__first_paediatric_assessment_date=date(2021, 1, 1), + registration__first_paediatric_assessment_date=date.today(), ) # Create and login user @@ -434,7 +434,7 @@ def test_transfer_preserves_origin_organisation_additional_responsibilities( organisations__site_is_primary_centre_of_epilepsy_care=True, organisations__site_is_actively_involved_in_epilepsy_care=True, organisations__site_is_childrens_epilepsy_surgery_centre=True, - registration__first_paediatric_assessment_date=date(2021, 1, 1), + registration__first_paediatric_assessment_date=date.today(), ) original_site = Site.objects.get( @@ -647,7 +647,7 @@ def test_lead_centre_retains_responsibilities_when_transferring_lead_status( organisations__site_is_paediatric_neurology_centre=True, organisations__site_is_childrens_epilepsy_surgery_centre=True, organisations__site_is_general_paediatric_centre=True, - registration__first_paediatric_assessment_date=date(2021, 1, 1), + registration__first_paediatric_assessment_date=date.today(), ) original_site = Site.objects.get( @@ -781,7 +781,7 @@ def test_non_lead_responsibility_changes_do_not_affect_lead_status( organisations__site_is_primary_centre_of_epilepsy_care=True, organisations__site_is_actively_involved_in_epilepsy_care=True, organisations__site_is_paediatric_neurology_centre=True, - registration__first_paediatric_assessment_date=date(2021, 1, 1), + registration__first_paediatric_assessment_date=date.today(), ) lead_site = Site.objects.get( @@ -867,7 +867,7 @@ def test_inactive_site_loses_all_responsibilities_including_lead( organisations__site_is_actively_involved_in_epilepsy_care=True, organisations__site_is_paediatric_neurology_centre=True, organisations__site_is_childrens_epilepsy_surgery_centre=True, - registration__first_paediatric_assessment_date=date(2021, 1, 1), + registration__first_paediatric_assessment_date=date.today(), ) site = Site.objects.get( @@ -909,7 +909,7 @@ def test_transfer_with_partial_responsibilities_at_both_sites( organisations__site_is_primary_centre_of_epilepsy_care=True, organisations__site_is_actively_involved_in_epilepsy_care=True, organisations__site_is_paediatric_neurology_centre=True, - registration__first_paediatric_assessment_date=date(2021, 1, 1), + registration__first_paediatric_assessment_date=date.today(), ) # Target org already provides surgery services @@ -984,7 +984,7 @@ def test_rejected_transfer_maintains_all_original_responsibilities( organisations__site_is_actively_involved_in_epilepsy_care=True, organisations__site_is_paediatric_neurology_centre=True, organisations__site_is_general_paediatric_centre=True, - registration__first_paediatric_assessment_date=date(2021, 1, 1), + registration__first_paediatric_assessment_date=date.today(), ) original_site = Site.objects.get( diff --git a/epilepsy12/views/assessment_views.py b/epilepsy12/views/assessment_views.py index 8149b0fbf..5152a066e 100644 --- a/epilepsy12/views/assessment_views.py +++ b/epilepsy12/views/assessment_views.py @@ -154,7 +154,7 @@ def update_site_model( @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def consultant_paediatrician_referral_made(request, assessment_id): +def consultant_paediatrician_referral_made(request, can_edit, assessment_id): """ POST request callback from toggle_button in consultant_paediatrician partial """ @@ -212,7 +212,7 @@ def consultant_paediatrician_referral_made(request, assessment_id): else: site.delete() - context = {"assessment": assessment, "organisation_list": Organisation.objects.get_organisation_list() } + context = {"can_edit": can_edit, "assessment": assessment, "organisation_list": Organisation.objects.get_organisation_list() } # add previous and current sites to context sites_context = add_sites_and_site_history_to_context(assessment.registration.case) @@ -235,7 +235,7 @@ def consultant_paediatrician_referral_made(request, assessment_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def consultant_paediatrician_referral_date(request, assessment_id): +def consultant_paediatrician_referral_date(request, can_edit, assessment_id): """ This is an HTMX callback from the consultant_paediatrician partial template It is triggered by a change in custom date input in the partial, generating a post request. @@ -262,6 +262,7 @@ def consultant_paediatrician_referral_date(request, assessment_id): assessment = Assessment.objects.get(pk=assessment_id) context = { + "can_edit": can_edit, "assessment": assessment, "general_paediatric_edit_active": False, "organisation_list": Organisation.objects.get_organisation_list(), @@ -288,7 +289,7 @@ def consultant_paediatrician_referral_date(request, assessment_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def consultant_paediatrician_input_achieved(request, assessment_id): +def consultant_paediatrician_input_achieved(request, can_edit, assessment_id): """ This is an HTMX callback from the consultant_paediatrician partial template It is triggered by a change in input achieved toggle in the partial, generating a post request. @@ -323,6 +324,7 @@ def consultant_paediatrician_input_achieved(request, assessment_id): assessment = Assessment.objects.get(pk=assessment_id) context = { + "can_edit": can_edit, "assessment": assessment, "general_paediatric_edit_active": False, "organisation_list": organisation_list, @@ -349,7 +351,7 @@ def consultant_paediatrician_input_achieved(request, assessment_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def consultant_paediatrician_input_date(request, assessment_id): +def consultant_paediatrician_input_date(request, can_edit, assessment_id): """ This is an HTMX callback from the consultant_paediatrician partial template It is triggered by a change in custom date input in the partial, generating a post request. @@ -379,6 +381,7 @@ def consultant_paediatrician_input_date(request, assessment_id): organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "assessment": Assessment.objects.get(pk=assessment_id), "general_paediatric_edit_active": False, "organisation_list": organisation_list, @@ -408,7 +411,7 @@ def consultant_paediatrician_input_date(request, assessment_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def general_paediatric_centre(request, assessment_id): +def general_paediatric_centre(request, can_edit, assessment_id): """ HTMX call back from organisation_list partial. POST request to update/save centre in Site model @@ -434,6 +437,7 @@ def general_paediatric_centre(request, assessment_id): ) context = { + "can_edit": can_edit, "assessment": Assessment.objects.get(pk=assessment_id), "general_paediatric_edit_active": False, "organisation_list": organisation_list, @@ -459,7 +463,7 @@ def general_paediatric_centre(request, assessment_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def edit_general_paediatric_centre(request, assessment_id, site_id): +def edit_general_paediatric_centre(request, can_edit, assessment_id, site_id): """ HTMX call back from consultant_paediatrician partial template. This is a POST request on button click. It updates the Site object and returns the same partial template. @@ -485,6 +489,7 @@ def edit_general_paediatric_centre(request, assessment_id, site_id): ) context = { + "can_edit": can_edit, "assessment": Assessment.objects.get(pk=assessment_id), "general_paediatric_edit_active": False, "organisation_list": organisation_list, @@ -510,7 +515,7 @@ def edit_general_paediatric_centre(request, assessment_id, site_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def update_general_paediatric_centre_pressed(request, assessment_id, site_id, action): +def update_general_paediatric_centre_pressed(request, can_edit, assessment_id, site_id, action): """ HTMX callback from consultant_paediatrician partial on click of Update or Cancel (action is 'edit' or 'cancel') to change the general_paediatric_edit_active flag @@ -533,6 +538,7 @@ def update_general_paediatric_centre_pressed(request, assessment_id, site_id, ac ) context = { + "can_edit": can_edit, "assessment": assessment, "general_paediatric_edit_active": general_paediatric_edit_active, "organisation_list": organisation_list, @@ -558,7 +564,7 @@ def update_general_paediatric_centre_pressed(request, assessment_id, site_id, ac @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def delete_general_paediatric_centre(request, assessment_id, site_id): +def delete_general_paediatric_centre(request, can_edit, assessment_id, site_id): """ HTMX call back from organisations_select partial template. This is a POST request on button click. @@ -595,6 +601,7 @@ def delete_general_paediatric_centre(request, assessment_id, site_id): organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "assessment": assessment, "general_paediatric_edit_active": False, "error": error_message, @@ -626,7 +633,7 @@ def delete_general_paediatric_centre(request, assessment_id, site_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def paediatric_neurologist_referral_made(request, assessment_id): +def paediatric_neurologist_referral_made(request, can_edit, assessment_id): """ This is an HTMX callback from the paediatric_neurologist partial template It is triggered by a toggle in the partial generating a post request @@ -686,7 +693,7 @@ def paediatric_neurologist_referral_made(request, assessment_id): # filter list to include only NHS organisations organisation_list = Organisation.objects.get_organisation_list() - context = {"assessment": assessment, "organisation_list": organisation_list} + context = {"can_edit": can_edit, "assessment": assessment, "organisation_list": organisation_list} # add previous and current sites to context sites_context = add_sites_and_site_history_to_context(assessment.registration.case) @@ -709,7 +716,7 @@ def paediatric_neurologist_referral_made(request, assessment_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def paediatric_neurologist_referral_date(request, assessment_id): +def paediatric_neurologist_referral_date(request, can_edit, assessment_id): """ This is an HTMX callback from the paediatric_neurologist partial template It is triggered by a change in custom date input in the partial, generating a post request. @@ -742,6 +749,7 @@ def paediatric_neurologist_referral_date(request, assessment_id): organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "assessment": assessment, "neurology_edit_active": False, "organisation_list": organisation_list, @@ -768,7 +776,7 @@ def paediatric_neurologist_referral_date(request, assessment_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def paediatric_neurologist_input_date(request, assessment_id): +def paediatric_neurologist_input_date(request, can_edit, assessment_id): """ This is an HTMX callback from the paediatric_neurologist partial template It is triggered by a change in custom date input in the partial, generating a post request. @@ -805,6 +813,7 @@ def paediatric_neurologist_input_date(request, assessment_id): organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "assessment": assessment, "neurology_edit_active": False, "organisation_list": organisation_list, @@ -831,7 +840,7 @@ def paediatric_neurologist_input_date(request, assessment_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def paediatric_neurologist_input_achieved(request, assessment_id): +def paediatric_neurologist_input_achieved(request, can_edit, assessment_id): """ This is an HTMX callback from the paediatric_neurologist partial template It is triggered by a change in input achieved toggle in the partial, generating a post request. @@ -867,6 +876,7 @@ def paediatric_neurologist_input_achieved(request, assessment_id): assessment = Assessment.objects.get(pk=assessment_id) context = { + "can_edit": can_edit, "assessment": assessment, "neurology_edit_active": False, "organisation_list": organisation_list, @@ -896,7 +906,7 @@ def paediatric_neurologist_input_achieved(request, assessment_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def paediatric_neurology_centre(request, assessment_id): +def paediatric_neurology_centre(request, can_edit, assessment_id): """ HTMX call back from organisation_list partial. POST request to update/save centre in Site model @@ -919,6 +929,7 @@ def paediatric_neurology_centre(request, assessment_id): organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "assessment": assessment, "neurology_edit_active": False, "organisation_list": organisation_list, @@ -944,7 +955,7 @@ def paediatric_neurology_centre(request, assessment_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def edit_paediatric_neurology_centre(request, assessment_id, site_id): +def edit_paediatric_neurology_centre(request, can_edit, assessment_id, site_id): """ HTMX call back from epilepsy_surgery partial template. This is a POST request on button click. It updates the Site object and returns the same partial template. @@ -967,6 +978,7 @@ def edit_paediatric_neurology_centre(request, assessment_id, site_id): organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "assessment": assessment, "neurology_edit_active": False, "organisation_list": organisation_list, @@ -992,7 +1004,7 @@ def edit_paediatric_neurology_centre(request, assessment_id, site_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def update_paediatric_neurology_centre_pressed(request, assessment_id, site_id, action): +def update_paediatric_neurology_centre_pressed(request, can_edit, assessment_id, site_id, action): """ HTMX callback from paediatric_neurology partial on click of Update or Cancel (action is 'edit' or 'cancel') to change the neurology_edit_active flag @@ -1010,6 +1022,7 @@ def update_paediatric_neurology_centre_pressed(request, assessment_id, site_id, organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "assessment": assessment, "neurology_edit_active": neurology_edit_active, "organisation_list": organisation_list, @@ -1035,7 +1048,7 @@ def update_paediatric_neurology_centre_pressed(request, assessment_id, site_id, @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def delete_paediatric_neurology_centre(request, assessment_id, site_id): +def delete_paediatric_neurology_centre(request, can_edit, assessment_id, site_id): """ HTMX call back from epilepsy_surgery partial template. This is a POST request on button click. @@ -1072,6 +1085,7 @@ def delete_paediatric_neurology_centre(request, assessment_id, site_id): organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "assessment": assessment, "surgery_edit_active": False, "error": error_message, @@ -1103,7 +1117,7 @@ def delete_paediatric_neurology_centre(request, assessment_id, site_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def childrens_epilepsy_surgical_service_referral_criteria_met(request, assessment_id): +def childrens_epilepsy_surgical_service_referral_criteria_met(request, can_edit, assessment_id): """ This is an HTMX callback from the epilepsy_surgery partial template It is triggered by a toggle in the partial generating a post request @@ -1127,6 +1141,7 @@ def childrens_epilepsy_surgical_service_referral_criteria_met(request, assessmen organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "assessment": assessment, "organisation_list": organisation_list, "show_input_date": assessment.childrens_epilepsy_surgical_service_input_date @@ -1149,7 +1164,7 @@ def childrens_epilepsy_surgical_service_referral_criteria_met(request, assessmen @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def childrens_epilepsy_surgical_service_referral_made(request, assessment_id): +def childrens_epilepsy_surgical_service_referral_made(request, can_edit, assessment_id): """ This is an HTMX callback from the paediatric_neurologist partial template It is triggered by a toggle in the partial generating a post request @@ -1215,6 +1230,7 @@ def childrens_epilepsy_surgical_service_referral_made(request, assessment_id): organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "assessment": assessment, "surgery_edit_active": False, "error": None, @@ -1244,7 +1260,7 @@ def childrens_epilepsy_surgical_service_referral_made(request, assessment_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def childrens_epilepsy_surgical_service_referral_date(request, assessment_id): +def childrens_epilepsy_surgical_service_referral_date(request, can_edit, assessment_id): """ This is an HTMX callback from the epilepsy_surgery partial template It is triggered by a change in custom date input in the partial, generating a post request. @@ -1273,6 +1289,7 @@ def childrens_epilepsy_surgical_service_referral_date(request, assessment_id): organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "assessment": assessment, "surgery_edit_active": False, "error": None, @@ -1303,7 +1320,7 @@ def childrens_epilepsy_surgical_service_referral_date(request, assessment_id): @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() def childrens_epilepsy_surgical_service_review_date_status( - request, assessment_id, status + request, can_edit, assessment_id, status ): """ This is an HTMX callback from the epilepsy_surgery partial template @@ -1327,6 +1344,7 @@ def childrens_epilepsy_surgical_service_review_date_status( assessment.save() context = { + "can_edit": can_edit, "assessment": assessment, "surgery_edit_active": False, "error": None, @@ -1355,7 +1373,7 @@ def childrens_epilepsy_surgical_service_review_date_status( @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def childrens_epilepsy_surgical_service_input_date(request, assessment_id): +def childrens_epilepsy_surgical_service_input_date(request, can_edit, assessment_id): """ This is an HTMX callback from the epilepsy_surgery partial template It is triggered by a change in custom date input in the partial, generating a post request. @@ -1384,6 +1402,7 @@ def childrens_epilepsy_surgical_service_input_date(request, assessment_id): organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "assessment": assessment, "surgery_edit_active": False, "error": None, @@ -1413,7 +1432,7 @@ def childrens_epilepsy_surgical_service_input_date(request, assessment_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def epilepsy_surgery_centre(request, assessment_id): +def epilepsy_surgery_centre(request, can_edit, assessment_id): """ HTMX call back from organisation_list partial. POST request to update/save centre in Site model @@ -1436,6 +1455,7 @@ def epilepsy_surgery_centre(request, assessment_id): organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "assessment": assessment, "surgery_edit_active": False, "error": None, @@ -1464,7 +1484,7 @@ def epilepsy_surgery_centre(request, assessment_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def edit_epilepsy_surgery_centre(request, assessment_id, site_id): +def edit_epilepsy_surgery_centre(request, can_edit, assessment_id, site_id): """ HTMX call back from epilepsy_surgery partial template. This is a POST request on button click. @@ -1489,6 +1509,7 @@ def edit_epilepsy_surgery_centre(request, assessment_id, site_id): organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "assessment": assessment, "surgery_edit_active": False, "error": None, @@ -1517,7 +1538,7 @@ def edit_epilepsy_surgery_centre(request, assessment_id, site_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def update_epilepsy_surgery_centre_pressed(request, assessment_id, site_id, action): +def update_epilepsy_surgery_centre_pressed(request, can_edit, assessment_id, site_id, action): """ HTMX callback from epilepsy_surgery partial on click of Update or Cancel (action is 'edit' or 'cancel') to change the surgery_edit_active flag @@ -1533,6 +1554,7 @@ def update_epilepsy_surgery_centre_pressed(request, assessment_id, site_id, acti organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "assessment": Assessment.objects.get(pk=assessment_id), "surgery_edit_active": surgery_edit_active, "error": None, @@ -1561,7 +1583,7 @@ def update_epilepsy_surgery_centre_pressed(request, assessment_id, site_id, acti @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def delete_epilepsy_surgery_centre(request, assessment_id, site_id): +def delete_epilepsy_surgery_centre(request, can_edit, assessment_id, site_id): """ HTMX call back from epilepsy_surgery partial template. This is a POST request on button click. @@ -1598,6 +1620,7 @@ def delete_epilepsy_surgery_centre(request, assessment_id, site_id): organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "assessment": Assessment.objects.get(pk=assessment_id), "surgery_edit_active": False, "error": error_message, @@ -1631,7 +1654,7 @@ def delete_epilepsy_surgery_centre(request, assessment_id, site_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def epilepsy_specialist_nurse_referral_made(request, assessment_id): +def epilepsy_specialist_nurse_referral_made(request, can_edit, assessment_id): """ This is an HTMX callback from the epilepsy_nurse partial template It is triggered by a toggle in the partial generating a post request @@ -1666,7 +1689,7 @@ def epilepsy_specialist_nurse_referral_made(request, assessment_id): assessment = Assessment.objects.get(pk=assessment_id) - context = {"assessment": assessment} + context = {"can_edit": can_edit, "assessment": assessment} template_name = "epilepsy12/partials/assessment/epilepsy_nurse.html" @@ -1684,7 +1707,7 @@ def epilepsy_specialist_nurse_referral_made(request, assessment_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def epilepsy_specialist_nurse_referral_date(request, assessment_id): +def epilepsy_specialist_nurse_referral_date(request, can_edit, assessment_id): """ This is an HTMX callback from the epilepsy_nurse partial template It is triggered by a change in custom date input in the partial, generating a post request. @@ -1709,7 +1732,7 @@ def epilepsy_specialist_nurse_referral_date(request, assessment_id): assessment = Assessment.objects.get(pk=assessment_id) - context = {"assessment": assessment} + context = {"can_edit": can_edit, "assessment": assessment} template_name = "epilepsy12/partials/assessment/epilepsy_nurse.html" @@ -1727,7 +1750,7 @@ def epilepsy_specialist_nurse_referral_date(request, assessment_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def epilepsy_specialist_nurse_input_achieved(request, assessment_id): +def epilepsy_specialist_nurse_input_achieved(request, can_edit, assessment_id): """ This is an HTMX callback from the epilepsy_nurse partial template It is triggered by a change in the input achieved toggle in the partial, generating a post request. @@ -1760,6 +1783,7 @@ def epilepsy_specialist_nurse_input_achieved(request, assessment_id): template_name = "epilepsy12/partials/assessment/epilepsy_nurse.html" context = { + "can_edit": can_edit, "assessment": assessment, } @@ -1777,7 +1801,7 @@ def epilepsy_specialist_nurse_input_achieved(request, assessment_id): @login_and_otp_required() @permission_required("epilepsy12.change_assessment", raise_exception=True) @user_may_view_this_child() -def epilepsy_specialist_nurse_input_date(request, assessment_id): +def epilepsy_specialist_nurse_input_date(request, can_edit, assessment_id): """ This is an HTMX callback from the epilepsy_nurse partial template It is triggered by a change in custom date input in the partial, generating a post request. @@ -1802,7 +1826,7 @@ def epilepsy_specialist_nurse_input_date(request, assessment_id): assessment = Assessment.objects.get(pk=assessment_id) - context = {"assessment": assessment} + context = {"can_edit": can_edit, "assessment": assessment} template_name = "epilepsy12/partials/assessment/epilepsy_nurse.html" @@ -1820,7 +1844,7 @@ def epilepsy_specialist_nurse_input_date(request, assessment_id): @login_and_otp_required() @permission_required("epilepsy12.view_assessment", raise_exception=True) @user_may_view_this_child() -def assessment(request, case_id): +def assessment(request, can_edit, case_id): case = Case.objects.get(pk=case_id) registration = Registration.objects.filter(case=case).get() @@ -1842,6 +1866,7 @@ def assessment(request, case_id): organisation_id = site.organisation.pk context = { + "can_edit": can_edit and request.user.has_perm("epilepsy12.change_assessment"), "case_id": case_id, "assessment": assessment, "registration": assessment.registration, diff --git a/epilepsy12/views/case_views.py b/epilepsy12/views/case_views.py index bdef11930..6365a4779 100644 --- a/epilepsy12/views/case_views.py +++ b/epilepsy12/views/case_views.py @@ -482,7 +482,7 @@ def case_statistics(request, organisation_id): @permission_required( "epilepsy12.can_transfer_epilepsy12_lead_centre", raise_exception=True ) -def transfer_response(request, organisation_id, case_id, organisation_response): +def transfer_response(request, can_edit, organisation_id, case_id, organisation_response): """ POST callback from case table on click of accept/reject buttons against transfer request Updates associated Site instance and redirects back to case table @@ -630,7 +630,7 @@ def transfer_response(request, organisation_id, case_id, organisation_response): @permission_required( "epilepsy12.change_case", ) -def case_submit(request, organisation_id, case_id): +def case_submit(request, can_edit, organisation_id, case_id): """ POST request callback from submit button in case_list partial. Disables further editing of case information. Case considered submitted @@ -657,7 +657,7 @@ def case_submit(request, organisation_id, case_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.view_case") -def case_performance_summary(request, case_id): +def case_performance_summary(request, can_edit, case_id): case = Case.objects.get(pk=case_id) site = Site.objects.filter( site_is_actively_involved_in_epilepsy_care=True, @@ -667,6 +667,7 @@ def case_performance_summary(request, case_id): organisation_id = site.organisation.pk context = { + "can_edit": can_edit, "case": case, "case_id": case.pk, "active_template": "case_performance_summary", @@ -754,6 +755,7 @@ def create_case(request, organisation_id): "form": form, "choices": choices, "child_has_unknown_postcode": False, + "can_edit": True, # Always allow editing when creating a new case } return render(request=request, template_name=template_name, context=context) @@ -762,13 +764,13 @@ def create_case(request, organisation_id): @user_may_view_this_child() @user_may_view_this_organisation() @permission_required("epilepsy12.change_case", raise_exception=True) -def update_case(request, organisation_id, case_id): +def update_case(request, can_edit, organisation_id, case_id): """ Django function based view. Receives POST request to update view or delete """ organisation = Organisation.objects.filter(pk=organisation_id, active=True).get() case = get_object_or_404(Case, pk=case_id) - form = CaseForm(instance=case, organisation_id=organisation_id) + form = CaseForm(instance=case, organisation_id=organisation_id, can_edit=can_edit) # set select boxes for situations when postcode unknown country_choice = ( @@ -800,7 +802,7 @@ def update_case(request, organisation_id, case_id): return HttpResponseClientRedirect(redirect_to=url, status=200) if request.method == "POST": - form = CaseForm(request.POST, instance=case, organisation_id=organisation_id) + form = CaseForm(request.POST, instance=case, organisation_id=organisation_id, can_edit=can_edit) if form.is_valid(): obj = form.save() if case.locked != obj.locked: @@ -824,6 +826,7 @@ def update_case(request, organisation_id, case_id): test_positive = case.postcode context = { + "can_edit": can_edit, "organisation_id": organisation_id, "organisation": organisation, "form": form, @@ -875,7 +878,7 @@ def unknown_postcode(request, organisation_id): @permission_required( "epilepsy12.can_opt_out_child_from_inclusion_in_audit", raise_exception=True ) -def opt_out(request, organisation_id, case_id): +def opt_out(request, can_edit, organisation_id, case_id): """ This child has opted out of Epilepsy12 Their unique E12 ID will be retained but all associated fields will be set to None, and associated records deleted except their @@ -927,7 +930,7 @@ def opt_out(request, organisation_id, case_id): @permission_required( "epilepsy12.can_consent_to_audit_participation", raise_exception=True ) -def consent(request, case_id): +def consent(request, can_edit, case_id): case = Case.objects.get(pk=case_id) site = Site.objects.filter( site_is_actively_involved_in_epilepsy_care=True, @@ -937,6 +940,7 @@ def consent(request, case_id): organisation_id = site.organisation.pk context = { + "can_edit": can_edit, "case": case, "case_id": case.pk, "active_template": "consent", @@ -961,7 +965,7 @@ def consent(request, case_id): @permission_required( "epilepsy12.can_consent_to_audit_participation", raise_exception=True ) -def consent_confirmation(request, case_id, consent_type): +def consent_confirmation(request, can_edit, case_id, consent_type): """ POST request on click of confirm button in patient_confirmation.html template params: consent_type is one of 'consent', 'denied' @@ -994,6 +998,7 @@ def consent_confirmation(request, case_id, consent_type): case = Case.objects.get(pk=case_id) context = { + "can_edit": can_edit, "case": case, "case_id": case.pk, "active_template": "consent", diff --git a/epilepsy12/views/epilepsy_context_views.py b/epilepsy12/views/epilepsy_context_views.py index 6746fb6a0..ca20f3579 100644 --- a/epilepsy12/views/epilepsy_context_views.py +++ b/epilepsy12/views/epilepsy_context_views.py @@ -11,7 +11,7 @@ @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.view_epilepsycontext", raise_exception=True) -def epilepsy_context(request, case_id): +def epilepsy_context(request, can_edit, case_id): registration = Registration.objects.filter(case=case_id).first() epilepsy_context, created = EpilepsyContext.objects.get_or_create( @@ -33,6 +33,7 @@ def epilepsy_context(request, case_id): "audit_progress": epilepsy_context.registration.audit_progress, "active_template": "epilepsy_context", "organisation_id": organisation_id, + "can_edit": can_edit and request.user.has_perm("epilepsy12.change_epilepsycontext"), } response = recalculate_form_generate_response( @@ -48,7 +49,7 @@ def epilepsy_context(request, case_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_epilepsycontext", raise_exception=True) -def previous_febrile_seizure(request, epilepsy_context_id): +def previous_febrile_seizure(request, can_edit, epilepsy_context_id): """ HTMX callback from the previous_febrile_seizure partial, parent of single_choice_multiple_toggle @@ -73,6 +74,7 @@ def previous_febrile_seizure(request, epilepsy_context_id): context = { "epilepsy_context": epilepsy_context, "uncertain_choices": OPT_OUT_UNCERTAIN, + "can_edit": can_edit } response = recalculate_form_generate_response( @@ -89,7 +91,7 @@ def previous_febrile_seizure(request, epilepsy_context_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_epilepsycontext", raise_exception=True) -def previous_acute_symptomatic_seizure(request, epilepsy_context_id): +def previous_acute_symptomatic_seizure(request, can_edit, epilepsy_context_id): """ HTMX callback from the previous_febrile_seizure partial, parent of single_choice_multiple_toggle @@ -114,6 +116,7 @@ def previous_acute_symptomatic_seizure(request, epilepsy_context_id): context = { "epilepsy_context": epilepsy_context, "uncertain_choices": OPT_OUT_UNCERTAIN, + "can_edit": can_edit } response = recalculate_form_generate_response( @@ -130,7 +133,7 @@ def previous_acute_symptomatic_seizure(request, epilepsy_context_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_epilepsycontext", raise_exception=True) -def is_there_a_family_history_of_epilepsy(request, epilepsy_context_id): +def is_there_a_family_history_of_epilepsy(request, can_edit, epilepsy_context_id): """ HTMX callback from the previous_febrile_seizure partial, parent of single_choice_multiple_toggle @@ -155,6 +158,7 @@ def is_there_a_family_history_of_epilepsy(request, epilepsy_context_id): context = { "epilepsy_context": epilepsy_context, "uncertain_choices": OPT_OUT_UNCERTAIN, + "can_edit": can_edit } response = recalculate_form_generate_response( @@ -171,7 +175,7 @@ def is_there_a_family_history_of_epilepsy(request, epilepsy_context_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_epilepsycontext", raise_exception=True) -def previous_neonatal_seizures(request, epilepsy_context_id): +def previous_neonatal_seizures(request, can_edit, epilepsy_context_id): """ HTMX callback from the previous_febrile_seizure partial, parent of single_choice_multiple_toggle @@ -196,6 +200,7 @@ def previous_neonatal_seizures(request, epilepsy_context_id): context = { "epilepsy_context": epilepsy_context, "uncertain_choices": OPT_OUT_UNCERTAIN, + "can_edit": can_edit } response = recalculate_form_generate_response( @@ -212,7 +217,7 @@ def previous_neonatal_seizures(request, epilepsy_context_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_epilepsycontext", raise_exception=True) -def were_any_of_the_epileptic_seizures_convulsive(request, epilepsy_context_id): +def were_any_of_the_epileptic_seizures_convulsive(request, can_edit, epilepsy_context_id): """ Post request from multiple choice toggle within epilepsy partial. Updates the model and returns the epilepsy partial and parameters @@ -236,6 +241,7 @@ def were_any_of_the_epileptic_seizures_convulsive(request, epilepsy_context_id): context = { "epilepsy_context": epilepsy_context, "uncertain_choices": OPT_OUT_UNCERTAIN, + "can_edit": can_edit } response = recalculate_form_generate_response( @@ -252,7 +258,7 @@ def were_any_of_the_epileptic_seizures_convulsive(request, epilepsy_context_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_epilepsycontext", raise_exception=True) -def experienced_prolonged_generalized_convulsive_seizures(request, epilepsy_context_id): +def experienced_prolonged_generalized_convulsive_seizures(request, can_edit, epilepsy_context_id): """ HTMX callback from the experienced_prolonged_generalized_convulsive_seizures partial, parent of single_choice_multiple_toggle @@ -277,6 +283,7 @@ def experienced_prolonged_generalized_convulsive_seizures(request, epilepsy_cont context = { "epilepsy_context": epilepsy_context, "uncertain_choices": OPT_OUT_UNCERTAIN, + "can_edit": can_edit } response = recalculate_form_generate_response( @@ -293,7 +300,7 @@ def experienced_prolonged_generalized_convulsive_seizures(request, epilepsy_cont @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_epilepsycontext", raise_exception=True) -def experienced_prolonged_focal_seizures(request, epilepsy_context_id): +def experienced_prolonged_focal_seizures(request, can_edit, epilepsy_context_id): """ HTMX callback from the experienced_prolonged_focal_seizures partial, parent of single_choice_multiple_toggle @@ -318,6 +325,7 @@ def experienced_prolonged_focal_seizures(request, epilepsy_context_id): context = { "epilepsy_context": epilepsy_context, "uncertain_choices": OPT_OUT_UNCERTAIN, + "can_edit": can_edit } response = recalculate_form_generate_response( @@ -334,7 +342,7 @@ def experienced_prolonged_focal_seizures(request, epilepsy_context_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_epilepsycontext", raise_exception=True) -def diagnosis_of_epilepsy_withdrawn(request, epilepsy_context_id): +def diagnosis_of_epilepsy_withdrawn(request, can_edit, epilepsy_context_id): """ HTMX callback from the previous_febrile_seizure partial, parent of single_choice_multiple_toggle @@ -356,7 +364,10 @@ def diagnosis_of_epilepsy_withdrawn(request, epilepsy_context_id): epilepsy_context = EpilepsyContext.objects.get(pk=epilepsy_context_id) - context = {"epilepsy_context": epilepsy_context} + context = { + "epilepsy_context": epilepsy_context, + "can_edit": can_edit + } response = recalculate_form_generate_response( model_instance=epilepsy_context, diff --git a/epilepsy12/views/first_paediatric_assessment_views.py b/epilepsy12/views/first_paediatric_assessment_views.py index b37213002..0984172aa 100644 --- a/epilepsy12/views/first_paediatric_assessment_views.py +++ b/epilepsy12/views/first_paediatric_assessment_views.py @@ -6,13 +6,16 @@ recalculate_form_generate_response, ) from ..models import Registration, FirstPaediatricAssessment, Site -from ..decorator import user_may_view_this_child, login_and_otp_required +from ..decorator import ( + user_may_view_this_child, + login_and_otp_required +) @login_and_otp_required() @permission_required("epilepsy12.view_firstpaediatricassessment", raise_exception=True) @user_may_view_this_child() -def first_paediatric_assessment(request, case_id) -> HttpResponse: +def first_paediatric_assessment(request, can_edit, case_id) -> HttpResponse: registration = Registration.objects.get(case=case_id) if FirstPaediatricAssessment.objects.filter(registration=registration).exists(): @@ -45,6 +48,7 @@ def first_paediatric_assessment(request, case_id) -> HttpResponse: "audit_progress": registration.audit_progress, "active_template": "first_paediatric_assessment", "organisation_id": organisation_id, + "can_edit": can_edit and request.user.has_perm("epilepsy12.change_firstpaediatricassessment"), } response = recalculate_form_generate_response( @@ -63,7 +67,7 @@ def first_paediatric_assessment(request, case_id) -> HttpResponse: "epilepsy12.change_firstpaediatricassessment", raise_exception=True ) def first_paediatric_assessment_in_acute_or_nonacute_setting( - request, first_paediatric_assessment_id + request, can_edit, first_paediatric_assessment_id ): """ HTMX callback from first_paediatric_assessment_in_acute_or_nonacute_setting partial, itself @@ -91,6 +95,7 @@ def first_paediatric_assessment_in_acute_or_nonacute_setting( context = { "chronicity_selection": CHRONICITY, "first_paediatric_assessment": first_paediatric_assessment, + "can_edit": can_edit } response = recalculate_form_generate_response( @@ -110,7 +115,7 @@ def first_paediatric_assessment_in_acute_or_nonacute_setting( "epilepsy12.change_firstpaediatricassessment", raise_exception=True ) def has_number_of_episodes_since_the_first_been_documented( - request, first_paediatric_assessment_id + request, can_edit, first_paediatric_assessment_id ): """ POST request from toggle in has_number_of_episodes_since_the_first_been_documented partial @@ -136,6 +141,7 @@ def has_number_of_episodes_since_the_first_been_documented( context = { "first_paediatric_assessment": first_paediatric_assessment, "diagnostic_status_selection": DIAGNOSTIC_STATUS, + "can_edit": can_edit } response = recalculate_form_generate_response( @@ -154,7 +160,7 @@ def has_number_of_episodes_since_the_first_been_documented( @permission_required( "epilepsy12.change_firstpaediatricassessment", raise_exception=True ) -def general_examination_performed(request, first_paediatric_assessment_id): +def general_examination_performed(request, can_edit, first_paediatric_assessment_id): """ POST request from toggle in has_general_examination_performed partial """ @@ -178,6 +184,7 @@ def general_examination_performed(request, first_paediatric_assessment_id): context = { "first_paediatric_assessment": first_paediatric_assessment, "diagnostic_status_selection": DIAGNOSTIC_STATUS, + "can_edit": can_edit } response = recalculate_form_generate_response( @@ -196,7 +203,7 @@ def general_examination_performed(request, first_paediatric_assessment_id): @permission_required( "epilepsy12.change_firstpaediatricassessment", raise_exception=True ) -def neurological_examination_performed(request, first_paediatric_assessment_id): +def neurological_examination_performed(request, can_edit, first_paediatric_assessment_id): """ POST request from toggle in neurological_examination_performed partial """ @@ -220,6 +227,7 @@ def neurological_examination_performed(request, first_paediatric_assessment_id): context = { "first_paediatric_assessment": first_paediatric_assessment, "diagnostic_status_selection": DIAGNOSTIC_STATUS, + "can_edit": can_edit } response = recalculate_form_generate_response( @@ -239,7 +247,7 @@ def neurological_examination_performed(request, first_paediatric_assessment_id): "epilepsy12.change_firstpaediatricassessment", raise_exception=True ) def developmental_learning_or_schooling_problems( - request, first_paediatric_assessment_id + request, can_edit, first_paediatric_assessment_id ): """ POST request from toggle in developmental_learning_or_schooling_problems partial @@ -264,6 +272,7 @@ def developmental_learning_or_schooling_problems( context = { "first_paediatric_assessment": first_paediatric_assessment, "diagnostic_status_selection": DIAGNOSTIC_STATUS, + "can_edit": can_edit } response = recalculate_form_generate_response( @@ -282,7 +291,7 @@ def developmental_learning_or_schooling_problems( @permission_required( "epilepsy12.change_firstpaediatricassessment", raise_exception=True ) -def behavioural_or_emotional_problems(request, first_paediatric_assessment_id): +def behavioural_or_emotional_problems(request, can_edit, first_paediatric_assessment_id): """ POST request from toggle in developmental_learning_or_schooling_problems partial """ @@ -306,6 +315,7 @@ def behavioural_or_emotional_problems(request, first_paediatric_assessment_id): context = { "first_paediatric_assessment": first_paediatric_assessment, "diagnostic_status_selection": DIAGNOSTIC_STATUS, + "can_edit": can_edit } response = recalculate_form_generate_response( diff --git a/epilepsy12/views/investigation_views.py b/epilepsy12/views/investigation_views.py index 058144ffb..2bbf3306b 100644 --- a/epilepsy12/views/investigation_views.py +++ b/epilepsy12/views/investigation_views.py @@ -12,7 +12,7 @@ @login_and_otp_required() @permission_required("epilepsy12.view_investigations", raise_exception=True) @user_may_view_this_child() -def investigations(request, case_id): +def investigations(request, can_edit, case_id): registration = Registration.objects.filter(case=case_id).first() investigations, created = Investigations.objects.get_or_create( @@ -37,6 +37,7 @@ def investigations(request, case_id): mri_brain_declined = False context = { + "can_edit": can_edit and request.user.has_perm("epilepsy12.change_investigations"), "case_id": case_id, "registration": registration, "investigations": investigations, @@ -63,7 +64,7 @@ def investigations(request, case_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_investigations", raise_exception=True) -def eeg_indicated(request, investigations_id): +def eeg_indicated(request, can_edit, investigations_id): """ This is an HTMX callback from the eeg_information.html partial template It is triggered by a toggle in the partial generating a post request @@ -98,7 +99,7 @@ def eeg_indicated(request, investigations_id): else: eeg_declined = False - context = {"investigations": investigations, "eeg_declined": eeg_declined} + context = {"can_edit": can_edit, "investigations": investigations, "eeg_declined": eeg_declined} template_name = "epilepsy12/partials/investigations/eeg_information.html" @@ -116,7 +117,7 @@ def eeg_indicated(request, investigations_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_investigations", raise_exception=True) -def eeg_request_date(request, investigations_id): +def eeg_request_date(request, can_edit, investigations_id): """ This is an HTMX callback from the ecg_information.html partial template which contains fields on eeg_indicated, eeg_request_date and eeg_performed_date. @@ -150,7 +151,7 @@ def eeg_request_date(request, investigations_id): else: eeg_declined = False - context = {"investigations": investigations, "eeg_declined": eeg_declined} + context = {"can_edit": can_edit, "investigations": investigations, "eeg_declined": eeg_declined} response = recalculate_form_generate_response( model_instance=investigations, @@ -166,7 +167,7 @@ def eeg_request_date(request, investigations_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_investigations", raise_exception=True) -def eeg_performed_date(request, investigations_id): +def eeg_performed_date(request, can_edit, investigations_id): """ This is an HTMX callback from the ecg_information.html partial template which contains fields on eeg_indicated, eeg_request_date and eeg_performed_date. @@ -199,7 +200,7 @@ def eeg_performed_date(request, investigations_id): else: eeg_declined = False - context = {"investigations": investigations, "eeg_declined": eeg_declined} + context = {"can_edit": can_edit, "investigations": investigations, "eeg_declined": eeg_declined} template_name = "epilepsy12/partials/investigations/eeg_information.html" @@ -217,7 +218,7 @@ def eeg_performed_date(request, investigations_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_investigations", raise_exception=True) -def eeg_declined(request, investigations_id, confirm): +def eeg_declined(request, can_edit, investigations_id, confirm): """ This is an HTMX callback from the ecg_information.html partial template which contains fields on eeg_indicated, eeg_request_date and eeg_performed_date. @@ -244,7 +245,7 @@ def eeg_declined(request, investigations_id, confirm): investigations.save() - context = {"investigations": investigations, "eeg_declined": eeg_declined} + context = {"can_edit": can_edit, "investigations": investigations, "eeg_declined": eeg_declined} template_name = "epilepsy12/partials/investigations/eeg_information.html" @@ -262,7 +263,7 @@ def eeg_declined(request, investigations_id, confirm): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_investigations", raise_exception=True) -def twelve_lead_ecg_status(request, investigations_id): +def twelve_lead_ecg_status(request, can_edit, investigations_id): """ This is an HTMX callback from the ecg_status.html partial template It is triggered by a toggle in the partial generating a post request @@ -285,7 +286,7 @@ def twelve_lead_ecg_status(request, investigations_id): investigations = Investigations.objects.get(pk=investigations_id) - context = {"investigations": investigations} + context = {"can_edit": can_edit, "investigations": investigations} template_name = "epilepsy12/partials/investigations/ecg_status.html" @@ -303,7 +304,7 @@ def twelve_lead_ecg_status(request, investigations_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_investigations", raise_exception=True) -def ct_head_scan_status(request, investigations_id): +def ct_head_scan_status(request, can_edit, investigations_id): """ This is an HTMX callback from the ct_head_status.html partial template It is triggered by a toggle in the partial generating a post request @@ -326,7 +327,7 @@ def ct_head_scan_status(request, investigations_id): investigations = Investigations.objects.get(pk=investigations_id) - context = {"investigations": investigations} + context = {"can_edit": can_edit, "investigations": investigations} template_name = "epilepsy12/partials/investigations/ct_head_status.html" @@ -344,7 +345,7 @@ def ct_head_scan_status(request, investigations_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_investigations", raise_exception=True) -def mri_indicated(request, investigations_id): +def mri_indicated(request, can_edit, investigations_id): """ This is an HTMX callback from the mri_brain_information.html partial template It is triggered by a toggle in the partial generating a post request @@ -381,6 +382,7 @@ def mri_indicated(request, investigations_id): mri_brain_declined = False context = { + "can_edit": can_edit, "investigations": investigations, "mri_brain_declined": mri_brain_declined, } @@ -401,7 +403,7 @@ def mri_indicated(request, investigations_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_investigations", raise_exception=True) -def mri_brain_requested_date(request, investigations_id): +def mri_brain_requested_date(request, can_edit, investigations_id): """ This is an HTMX callback from the mri_brain_information.html partial template It is triggered by a change in the date_input_field partial generating a post request @@ -433,6 +435,7 @@ def mri_brain_requested_date(request, investigations_id): mri_brain_declined = False context = { + "can_edit": can_edit, "investigations": investigations, "mri_brain_declined": mri_brain_declined, } @@ -453,7 +456,7 @@ def mri_brain_requested_date(request, investigations_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_investigations", raise_exception=True) -def mri_brain_reported_date(request, investigations_id): +def mri_brain_reported_date(request, can_edit, investigations_id): """ This is an HTMX callback from the mri_brain_information.html partial template It is triggered by a change in the date_input_field partial generating a post request @@ -485,6 +488,7 @@ def mri_brain_reported_date(request, investigations_id): mri_brain_declined = False context = { + "can_edit": can_edit, "investigations": investigations, "mri_brain_declined": mri_brain_declined, } @@ -505,7 +509,7 @@ def mri_brain_reported_date(request, investigations_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_investigations", raise_exception=True) -def mri_brain_declined(request, investigations_id, confirm): +def mri_brain_declined(request, can_edit, investigations_id, confirm): """ This is an HTMX callback from the mri_brain_information.html partial template which contains fields on mri_indicated, mri_request_date and mri_performed_date. @@ -537,6 +541,7 @@ def mri_brain_declined(request, investigations_id, confirm): mri_brain_declined = False context = { + "can_edit": can_edit, "investigations": investigations, "mri_brain_declined": mri_brain_declined, } diff --git a/epilepsy12/views/management_views.py b/epilepsy12/views/management_views.py index 4c9371210..0d90bcd3a 100644 --- a/epilepsy12/views/management_views.py +++ b/epilepsy12/views/management_views.py @@ -22,7 +22,7 @@ @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.view_management", raise_exception=True) -def management(request, case_id): +def management(request, can_edit, case_id): # function called on form load # creates a new management object if one does not exist # loads historical medicines and passes them to template @@ -51,6 +51,7 @@ def management(request, case_id): organisation_id = site.organisation.pk context = { + "can_edit": can_edit and request.user.has_perm("epilepsy12.change_management"), "case_id": case_id, "registration": registration, "management": management, @@ -81,7 +82,7 @@ def management(request, case_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_antiepilepsymedicine", raise_exception=True) -def has_an_aed_been_given(request, management_id): +def has_an_aed_been_given(request, can_edit, management_id): # HTMX call back from management template # POST request on toggle button click # if AED has been prescribed returns partial template comprising AED search box and dropdown @@ -115,6 +116,7 @@ def has_an_aed_been_given(request, management_id): ).order_by("-antiepilepsy_medicine_start_date") context = { + "can_edit": can_edit, "management": management, "antiepilepsy_medicines": antiepilepsy_medicines, } @@ -135,7 +137,7 @@ def has_an_aed_been_given(request, management_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.add_antiepilepsymedicine", raise_exception=True) -def add_antiepilepsy_medicine(request, management_id, is_rescue_medicine): +def add_antiepilepsy_medicine(request, can_edit, management_id, is_rescue_medicine): """ Callback POST request from aed_list.html partial to add new AEM to antiepilepsy_medicine model """ @@ -167,6 +169,7 @@ def add_antiepilepsy_medicine(request, management_id, is_rescue_medicine): ) context = { + "can_edit": can_edit, "choices": choices, "antiepilepsy_medicine": antiepilepsy_medicine, "management_id": management_id, @@ -188,7 +191,7 @@ def add_antiepilepsy_medicine(request, management_id, is_rescue_medicine): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.delete_antiepilepsymedicine", raise_exception=True) -def remove_antiepilepsy_medicine(request, antiepilepsy_medicine_id): +def remove_antiepilepsy_medicine(request, can_edit, antiepilepsy_medicine_id): """ POST request from either the rescue_medicine_list or the epilepsy_medicine_list Returns the epilepsy_medicine_list template filtered with a list of medicines depending whether are rescue @@ -209,6 +212,7 @@ def remove_antiepilepsy_medicine(request, antiepilepsy_medicine_id): ).order_by("-antiepilepsy_medicine_start_date") context = { + "can_edit": can_edit, "medicines": antiepilepsy_medicines, "management_id": management.pk, "is_rescue_medicine": is_rescue_medicine, @@ -229,7 +233,7 @@ def remove_antiepilepsy_medicine(request, antiepilepsy_medicine_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.view_antiepilepsymedicine", raise_exception=True) -def edit_antiepilepsy_medicine(request, antiepilepsy_medicine_id): +def edit_antiepilepsy_medicine(request, can_edit, antiepilepsy_medicine_id): """ Call back from onclick of edit button in antiepilepsy_medicine_list partial returns the antiepilepsy_medicine partial form populated with the medicine fields for editing @@ -254,6 +258,7 @@ def edit_antiepilepsy_medicine(request, antiepilepsy_medicine_id): show_end_date = False context = { + "can_edit": can_edit, "choices": choices, "antiepilepsy_medicine": antiepilepsy_medicine, "is_rescue_medicine": antiepilepsy_medicine.is_rescue_medicine, @@ -275,7 +280,7 @@ def edit_antiepilepsy_medicine(request, antiepilepsy_medicine_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.view_antiepilepsymedicine", raise_exception=True) -def close_antiepilepsy_medicine(request, antiepilepsy_medicine_id): +def close_antiepilepsy_medicine(request, can_edit, antiepilepsy_medicine_id): """ Call back from onclick of edit button in antiepilepsy_medicine_list partial returns the antiepilepsy_medicine partial form populated with the medicine fields for editing @@ -301,6 +306,7 @@ def close_antiepilepsy_medicine(request, antiepilepsy_medicine_id): ).order_by("-antiepilepsy_medicine_start_date") context = { + "can_edit": can_edit, "medicines": antiepilepsy_medicines, "management_id": antiepilepsy_medicine.management.pk, "is_rescue_medicine": is_rescue_medicine, @@ -321,7 +327,7 @@ def close_antiepilepsy_medicine(request, antiepilepsy_medicine_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_antiepilepsymedicine", raise_exception=True) -def medicine_id(request, antiepilepsy_medicine_id, medicine_status): +def medicine_id(request, can_edit, antiepilepsy_medicine_id, medicine_status): """ POST callback from antiepilepsy_medicine.html partial to update medicine_name medicine_status is a string that is either 'rescue' or 'antiepilepsy' @@ -426,6 +432,7 @@ def requires_pregnancy_prevention_programme(cohort, medicine_concept_id, age, se show_end_date = False context = { + "can_edit": can_edit, "choices": choices, "antiepilepsy_medicine": antiepilepsy_medicine, "is_rescue_medicine": is_rescue, @@ -447,7 +454,7 @@ def requires_pregnancy_prevention_programme(cohort, medicine_concept_id, age, se @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_antiepilepsymedicine", raise_exception=True) -def antiepilepsy_medicine_start_date(request, antiepilepsy_medicine_id): +def antiepilepsy_medicine_start_date(request, can_edit, antiepilepsy_medicine_id): """ POST callback from antiepilepsy_medicine.html partial to update antiepilepsy_medicine_start_date """ @@ -489,6 +496,7 @@ def antiepilepsy_medicine_start_date(request, antiepilepsy_medicine_id): show_end_date = False context = { + "can_edit": can_edit, "choices": choices, "antiepilepsy_medicine": antiepilepsy_medicine, "is_rescue_medicine": antiepilepsy_medicine.is_rescue_medicine, @@ -511,7 +519,7 @@ def antiepilepsy_medicine_start_date(request, antiepilepsy_medicine_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_antiepilepsymedicine", raise_exception=True) -def antiepilepsy_medicine_add_stop_date(request, antiepilepsy_medicine_id): +def antiepilepsy_medicine_add_stop_date(request, can_edit, antiepilepsy_medicine_id): """ POST callback from antiepilepsy_medicine.html partial to toggle antiepilepsy_medicine_end_date """ @@ -531,6 +539,7 @@ def antiepilepsy_medicine_add_stop_date(request, antiepilepsy_medicine_id): ) context = { + "can_edit": can_edit, "choices": choices, "antiepilepsy_medicine": antiepilepsy_medicine, "is_rescue_medicine": antiepilepsy_medicine.is_rescue_medicine, @@ -553,7 +562,7 @@ def antiepilepsy_medicine_add_stop_date(request, antiepilepsy_medicine_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_antiepilepsymedicine", raise_exception=True) -def antiepilepsy_medicine_remove_stop_date(request, antiepilepsy_medicine_id): +def antiepilepsy_medicine_remove_stop_date(request, can_edit, antiepilepsy_medicine_id): """ POST callback from antiepilepsy_medicine.html partial to toggle closed antiepilepsy_medicine_end_date """ @@ -577,6 +586,7 @@ def antiepilepsy_medicine_remove_stop_date(request, antiepilepsy_medicine_id): ) context = { + "can_edit": can_edit, "choices": choices, "antiepilepsy_medicine": antiepilepsy_medicine, "is_rescue_medicine": antiepilepsy_medicine.is_rescue_medicine, @@ -599,7 +609,7 @@ def antiepilepsy_medicine_remove_stop_date(request, antiepilepsy_medicine_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_antiepilepsymedicine", raise_exception=True) -def antiepilepsy_medicine_stop_date(request, antiepilepsy_medicine_id): +def antiepilepsy_medicine_stop_date(request, can_edit, antiepilepsy_medicine_id): """ POST callback from antiepilepsy_medicine.html partial to update antiepilepsy_medicine_stop_date """ @@ -635,6 +645,7 @@ def antiepilepsy_medicine_stop_date(request, antiepilepsy_medicine_id): ) context = { + "can_edit": can_edit, "choices": choices, "antiepilepsy_medicine": antiepilepsy_medicine, "is_rescue_medicine": antiepilepsy_medicine.is_rescue_medicine, @@ -657,7 +668,7 @@ def antiepilepsy_medicine_stop_date(request, antiepilepsy_medicine_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_antiepilepsymedicine", raise_exception=True) -def antiepilepsy_medicine_risk_discussed(request, antiepilepsy_medicine_id): +def antiepilepsy_medicine_risk_discussed(request, can_edit, antiepilepsy_medicine_id): """ POST callback from antiepilepsy_medicine.html partial to update antiepilepsy_medicine_risk_discussed """ @@ -692,6 +703,7 @@ def antiepilepsy_medicine_risk_discussed(request, antiepilepsy_medicine_id): show_end_date = False context = { + "can_edit": can_edit, "choices": choices, "antiepilepsy_medicine": antiepilepsy_medicine, "is_rescue_medicine": antiepilepsy_medicine.is_rescue_medicine, @@ -714,7 +726,7 @@ def antiepilepsy_medicine_risk_discussed(request, antiepilepsy_medicine_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_antiepilepsymedicine", raise_exception=True) -def is_a_pregnancy_prevention_programme_in_place(request, antiepilepsy_medicine_id): +def is_a_pregnancy_prevention_programme_in_place(request, can_edit, antiepilepsy_medicine_id): """ POST callback from antiepilepsy_medicine.html partial to update is_a_pregnancy_prevention_programme_in_place """ @@ -749,6 +761,7 @@ def is_a_pregnancy_prevention_programme_in_place(request, antiepilepsy_medicine_ show_end_date = False context = { + "can_edit": can_edit, "choices": choices, "antiepilepsy_medicine": antiepilepsy_medicine, "is_rescue_medicine": antiepilepsy_medicine.is_rescue_medicine, @@ -772,7 +785,7 @@ def is_a_pregnancy_prevention_programme_in_place(request, antiepilepsy_medicine_ @user_may_view_this_child() @permission_required("epilepsy12.change_antiepilepsymedicine", raise_exception=True) def has_a_valproate_annual_risk_acknowledgement_form_been_completed( - request, antiepilepsy_medicine_id + request, can_edit, antiepilepsy_medicine_id ): """ POST callback from antiepilepsy_medicine.html partial to update has_a_valproate_annual_risk_acknowledgement_form_been_completed @@ -808,6 +821,7 @@ def has_a_valproate_annual_risk_acknowledgement_form_been_completed( show_end_date = False context = { + "can_edit": can_edit, "choices": choices, "antiepilepsy_medicine": antiepilepsy_medicine, "is_rescue_medicine": antiepilepsy_medicine.is_rescue_medicine, @@ -835,7 +849,7 @@ def has_a_valproate_annual_risk_acknowledgement_form_been_completed( @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_antiepilepsymedicine", raise_exception=True) -def has_rescue_medication_been_prescribed(request, management_id): +def has_rescue_medication_been_prescribed(request, can_edit, management_id): """ HTMX call from management template POST request on toggle button click @@ -870,6 +884,7 @@ def has_rescue_medication_been_prescribed(request, management_id): ).all() context = { + "can_edit": can_edit, "management": management, "rescue_medicines": rescue_medicines, } @@ -897,7 +912,7 @@ def has_rescue_medication_been_prescribed(request, management_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_management", raise_exception=True) -def individualised_care_plan_in_place(request, management_id): +def individualised_care_plan_in_place(request, can_edit, management_id): """ This is an HTMX callback from the individualised_care_plan partial template It is triggered by a toggle in the partial generating a post request @@ -938,7 +953,7 @@ def individualised_care_plan_in_place(request, management_id): management = Management.objects.get(pk=management_id) - context = {"management": management} + context = {"can_edit": can_edit, "management": management} template_name = "epilepsy12/partials/management/individualised_care_plan.html" @@ -956,7 +971,7 @@ def individualised_care_plan_in_place(request, management_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_management", raise_exception=True) -def individualised_care_plan_date(request, management_id): +def individualised_care_plan_date(request, can_edit, management_id): """ This is an HTMX callback from the individualised_care_plan partial template It is triggered by a toggle in the partial generating a post request @@ -981,7 +996,7 @@ def individualised_care_plan_date(request, management_id): management = Management.objects.get(pk=management_id) - context = {"management": management} + context = {"can_edit": can_edit, "management": management} template_name = "epilepsy12/partials/management/individualised_care_plan.html" @@ -999,7 +1014,7 @@ def individualised_care_plan_date(request, management_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_management", raise_exception=True) -def individualised_care_plan_has_parent_carer_child_agreement(request, management_id): +def individualised_care_plan_has_parent_carer_child_agreement(request, can_edit, management_id): """ This is an HTMX callback from the individualised_care_plan partial template It is triggered by a toggle in the partial generating a post request @@ -1020,7 +1035,7 @@ def individualised_care_plan_has_parent_carer_child_agreement(request, managemen management = Management.objects.get(pk=management_id) - context = {"management": management} + context = {"can_edit": can_edit, "management": management} template_name = "epilepsy12/partials/management/individualised_care_plan.html" @@ -1038,7 +1053,7 @@ def individualised_care_plan_has_parent_carer_child_agreement(request, managemen @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_management", raise_exception=True) -def individualised_care_plan_includes_service_contact_details(request, management_id): +def individualised_care_plan_includes_service_contact_details(request, can_edit, management_id): """ This is an HTMX callback from the individualised_care_plan partial template It is triggered by a toggle in the partial generating a post request @@ -1058,7 +1073,7 @@ def individualised_care_plan_includes_service_contact_details(request, managemen error_message = error management = Management.objects.get(pk=management_id) - context = {"management": management} + context = {"can_edit": can_edit, "management": management} template_name = "epilepsy12/partials/management/individualised_care_plan.html" @@ -1076,7 +1091,7 @@ def individualised_care_plan_includes_service_contact_details(request, managemen @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_management", raise_exception=True) -def individualised_care_plan_include_first_aid(request, management_id): +def individualised_care_plan_include_first_aid(request, can_edit, management_id): """ This is an HTMX callback from the individualised_care_plan partial template It is triggered by a toggle in the partial generating a post request @@ -1095,7 +1110,7 @@ def individualised_care_plan_include_first_aid(request, management_id): error_message = error management = Management.objects.get(pk=management_id) - context = {"management": management} + context = {"can_edit": can_edit, "management": management} template_name = "epilepsy12/partials/management/individualised_care_plan.html" @@ -1113,7 +1128,7 @@ def individualised_care_plan_include_first_aid(request, management_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_management", raise_exception=True) -def individualised_care_plan_parental_prolonged_seizure_care(request, management_id): +def individualised_care_plan_parental_prolonged_seizure_care(request, can_edit, management_id): """ This is an HTMX callback from the individualised_care_plan partial template It is triggered by a toggle in the partial generating a post request @@ -1133,7 +1148,7 @@ def individualised_care_plan_parental_prolonged_seizure_care(request, management error_message = error management = Management.objects.get(pk=management_id) - context = {"management": management} + context = {"can_edit": can_edit, "management": management} template_name = "epilepsy12/partials/management/individualised_care_plan.html" @@ -1152,7 +1167,7 @@ def individualised_care_plan_parental_prolonged_seizure_care(request, management @user_may_view_this_child() @permission_required("epilepsy12.change_management", raise_exception=True) def individualised_care_plan_includes_general_participation_risk( - request, management_id + request, can_edit, management_id ): """ This is an HTMX callback from the individualised_care_plan partial template @@ -1172,7 +1187,7 @@ def individualised_care_plan_includes_general_participation_risk( error_message = error management = Management.objects.get(pk=management_id) - context = {"management": management} + context = {"can_edit": can_edit, "management": management} template_name = "epilepsy12/partials/management/individualised_care_plan.html" @@ -1190,7 +1205,7 @@ def individualised_care_plan_includes_general_participation_risk( @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_management", raise_exception=True) -def individualised_care_plan_addresses_water_safety(request, management_id): +def individualised_care_plan_addresses_water_safety(request, can_edit, management_id): """ This is an HTMX callback from the individualised_care_plan partial template It is triggered by a toggle in the partial generating a post request @@ -1209,7 +1224,7 @@ def individualised_care_plan_addresses_water_safety(request, management_id): error_message = error management = Management.objects.get(pk=management_id) - context = {"management": management} + context = {"can_edit": can_edit, "management": management} template_name = "epilepsy12/partials/management/individualised_care_plan.html" @@ -1227,7 +1242,7 @@ def individualised_care_plan_addresses_water_safety(request, management_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_management", raise_exception=True) -def individualised_care_plan_addresses_sudep(request, management_id): +def individualised_care_plan_addresses_sudep(request, can_edit, management_id): """ This is an HTMX callback from the individualised_care_plan partial template It is triggered by a toggle in the partial generating a post request @@ -1246,7 +1261,7 @@ def individualised_care_plan_addresses_sudep(request, management_id): error_message = error management = Management.objects.get(pk=management_id) - context = {"management": management} + context = {"can_edit": can_edit, "management": management} template_name = "epilepsy12/partials/management/individualised_care_plan.html" @@ -1264,7 +1279,7 @@ def individualised_care_plan_addresses_sudep(request, management_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_management", raise_exception=True) -def individualised_care_plan_includes_ehcp(request, management_id): +def individualised_care_plan_includes_ehcp(request, can_edit, management_id): """ This is an HTMX callback from the individualised_care_plan partial template It is triggered by a toggle in the partial generating a post request @@ -1283,7 +1298,7 @@ def individualised_care_plan_includes_ehcp(request, management_id): error_message = error management = Management.objects.get(pk=management_id) - context = {"management": management} + context = {"can_edit": can_edit, "management": management} template_name = "epilepsy12/partials/management/individualised_care_plan.html" @@ -1301,7 +1316,7 @@ def individualised_care_plan_includes_ehcp(request, management_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_management", raise_exception=True) -def has_individualised_care_plan_been_updated_in_the_last_year(request, management_id): +def has_individualised_care_plan_been_updated_in_the_last_year(request, can_edit, management_id): """ This is an HTMX callback from the individualised_care_plan partial template It is triggered by a toggle in the partial generating a post request @@ -1321,7 +1336,7 @@ def has_individualised_care_plan_been_updated_in_the_last_year(request, manageme management = Management.objects.get(pk=management_id) - context = {"management": management} + context = {"can_edit": can_edit, "management": management} template_name = "epilepsy12/partials/management/individualised_care_plan.html" @@ -1339,7 +1354,7 @@ def has_individualised_care_plan_been_updated_in_the_last_year(request, manageme @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_management", raise_exception=True) -def has_been_referred_for_mental_health_support(request, management_id): +def has_been_referred_for_mental_health_support(request, can_edit, management_id): """ This is an HTMX callback from the has_been_referred_for_mental_health_support partial template It is triggered by a toggle in the partial generating a post request @@ -1359,7 +1374,7 @@ def has_been_referred_for_mental_health_support(request, management_id): management = Management.objects.get(pk=management_id) - context = {"management": management} + context = {"can_edit": can_edit, "management": management} template_name = "epilepsy12/partials/management/mental_health_support.html" @@ -1377,7 +1392,7 @@ def has_been_referred_for_mental_health_support(request, management_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_management", raise_exception=True) -def has_support_for_mental_health_support(request, management_id): +def has_support_for_mental_health_support(request, can_edit, management_id): """ This is an HTMX callback from the has_support_for_mental_health_support partial template It is triggered by a toggle in the partial generating a post request @@ -1397,7 +1412,7 @@ def has_support_for_mental_health_support(request, management_id): management = Management.objects.get(pk=management_id) - context = {"management": management} + context = {"can_edit": can_edit, "management": management} template_name = "epilepsy12/partials/management/mental_health_support.html" diff --git a/epilepsy12/views/multiaxial_diagnosis_views.py b/epilepsy12/views/multiaxial_diagnosis_views.py index 5d606dd48..1dee18cee 100644 --- a/epilepsy12/views/multiaxial_diagnosis_views.py +++ b/epilepsy12/views/multiaxial_diagnosis_views.py @@ -78,7 +78,7 @@ @login_and_otp_required() @permission_required("epilepsy12.view_multiaxialdiagnosis", raise_exception=True) @user_may_view_this_child() -def multiaxial_diagnosis(request, case_id): +def multiaxial_diagnosis(request, can_edit, case_id): """ Called on load of form. If no instance exists, one is created. @@ -137,6 +137,7 @@ def multiaxial_diagnosis(request, case_id): "mental_health_issues_choices": NEUROPSYCHIATRIC, "global_developmental_delay_or_learning_difficulties_severity_choices": SEVERITY, "organisation_id": organisation_id, + "can_edit": can_edit and request.user.has_perm("epilepsy12.change_multiaxialdiagnosis"), } response = recalculate_form_generate_response( @@ -152,7 +153,7 @@ def multiaxial_diagnosis(request, case_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.add_episode", raise_exception=True) -def add_episode(request, multiaxial_diagnosis_id): +def add_episode(request, can_edit, multiaxial_diagnosis_id): """ HTMX post request from episodes.html partial on button click to add new episode """ @@ -205,6 +206,7 @@ def add_episode(request, multiaxial_diagnosis_id): keywords = Keyword.objects.all() context = { + "can_edit": can_edit, "episode": new_episode, "seizure_onset_date_confidence_selection": DATE_ACCURACY, "episode_definition_selection": EPISODE_DEFINITION, @@ -245,7 +247,7 @@ def add_episode(request, multiaxial_diagnosis_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.view_episode", raise_exception=True) -def edit_episode(request, episode_id): +def edit_episode(request, can_edit, episode_id): """ HTMX post request from episodes.html partial on button click to add new episode """ @@ -254,6 +256,7 @@ def edit_episode(request, episode_id): keywords = Keyword.objects.all() context = { + "can_edit": can_edit, "episode": episode, "seizure_onset_date_confidence_selection": DATE_ACCURACY, "episode_definition_selection": EPISODE_DEFINITION, @@ -295,7 +298,7 @@ def edit_episode(request, episode_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.delete_episode", raise_exception=True) -def remove_episode(request, episode_id): +def remove_episode(request, can_edit, episode_id): """ POST request on button click from episodes partial in multiaxial_diagnosis form Deletes episode from table @@ -308,6 +311,7 @@ def remove_episode(request, episode_id): ).order_by("seizure_onset_date") context = { + "can_edit": can_edit, "multiaxial_diagnosis": multiaxial_diagnosis, "episodes": episodes, } @@ -325,7 +329,7 @@ def remove_episode(request, episode_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.view_episode", raise_exception=True) -def close_episode(request, episode_id): +def close_episode(request, can_edit, episode_id): """ Call back from onclick of close episode in episode.html returns the episodes list partial @@ -346,6 +350,7 @@ def close_episode(request, episode_id): ).exists() context = { + "can_edit": can_edit, "multiaxial_diagnosis": multiaxial_diagnosis, "episodes": episodes, "there_are_epileptic_episodes": there_are_epileptic_episodes, @@ -364,7 +369,7 @@ def close_episode(request, episode_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_episode", raise_exception=True) -def seizure_onset_date(request, episode_id): +def seizure_onset_date(request, can_edit, episode_id): """ HTMX post request from episode.html partial on date change """ @@ -387,6 +392,7 @@ def seizure_onset_date(request, episode_id): episode = Episode.objects.get(pk=episode_id) context = { + "can_edit": can_edit, "episode": episode, "seizure_onset_date_confidence_selection": DATE_ACCURACY, "episode_definition_selection": EPISODE_DEFINITION, @@ -429,7 +435,7 @@ def seizure_onset_date(request, episode_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_episode", raise_exception=True) -def seizure_onset_date_confidence(request, episode_id): +def seizure_onset_date_confidence(request, can_edit, episode_id): """ HTMX post request from episode.html partial on toggle click """ @@ -451,6 +457,7 @@ def seizure_onset_date_confidence(request, episode_id): keywords = Keyword.objects.all() context = { + "can_edit": can_edit, "episode": episode, "seizure_onset_date_confidence_selection": DATE_ACCURACY, "episode_definition_selection": EPISODE_DEFINITION, @@ -493,7 +500,7 @@ def seizure_onset_date_confidence(request, episode_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_episode", raise_exception=True) -def episode_definition(request, episode_id): +def episode_definition(request, can_edit, episode_id): """ HTMX post request from episode.html partial on toggle click """ @@ -515,6 +522,7 @@ def episode_definition(request, episode_id): keywords = Keyword.objects.all() context = { + "can_edit": can_edit, "episode": episode, "seizure_onset_date_confidence_selection": DATE_ACCURACY, "episode_definition_selection": EPISODE_DEFINITION, @@ -557,7 +565,7 @@ def episode_definition(request, episode_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_episode", raise_exception=True) -def has_description_of_the_episode_or_episodes_been_gathered(request, episode_id): +def has_description_of_the_episode_or_episodes_been_gathered(request, can_edit, episode_id): """ HTMX post request from episode.html partial on toggle click """ @@ -586,6 +594,7 @@ def has_description_of_the_episode_or_episodes_been_gathered(request, episode_id episode.save() context = { + "can_edit": can_edit, "episode": episode, "seizure_onset_date_confidence_selection": DATE_ACCURACY, "episode_definition_selection": EPISODE_DEFINITION, @@ -633,7 +642,7 @@ def has_description_of_the_episode_or_episodes_been_gathered(request, episode_id @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_episode", raise_exception=True) -def edit_description(request, episode_id): +def edit_description(request, can_edit, episode_id): """ This function is triggered by an htmx post request from the partials/episode/description.html form for the desscribe description. This component comprises the input free text describing a seizure episode and labels for each of the keywords identified. @@ -657,7 +666,7 @@ def edit_description(request, episode_id): episode = Episode.objects.get(pk=episode_id) - context = {"episode": episode, "keyword_selection": keywords} + context = {"can_edit": can_edit, "episode": episode, "keyword_selection": keywords} response = recalculate_form_generate_response( model_instance=episode.multiaxial_diagnosis, @@ -672,7 +681,7 @@ def edit_description(request, episode_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_episode", raise_exception=True) -def delete_description_keyword(request, episode_id, description_keyword_id): +def delete_description_keyword(request, can_edit, episode_id, description_keyword_id): """ This function is triggered by an htmx post request from the partials/desscribe/description.html form for the desscribe description_keyword. This component comprises the input free text describing a seizure episode and labels for each of the keywords identified. @@ -695,7 +704,7 @@ def delete_description_keyword(request, episode_id, description_keyword_id): keywords = Keyword.objects.all() - context = {"episode": episode, "keyword_selection": keywords} + context = {"can_edit": can_edit, "episode": episode, "keyword_selection": keywords} response = recalculate_form_generate_response( model_instance=episode.multiaxial_diagnosis, @@ -715,7 +724,7 @@ def delete_description_keyword(request, episode_id, description_keyword_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_episode", raise_exception=True) -def epilepsy_or_nonepilepsy_status(request, episode_id): +def epilepsy_or_nonepilepsy_status(request, can_edit, episode_id): """ Function triggered by a click in the epilepsy_or_nonepilepsy_status partial leading to a post request. The episode_id is also passed in allowing update of the model. @@ -751,6 +760,7 @@ def epilepsy_or_nonepilepsy_status(request, episode_id): "epilepsy12/partials/multiaxial_diagnosis/epilepsy_or_nonepilepsy_status.html" ) context = { + "can_edit": can_edit, "epilepsy_or_nonepilepsy_status_choices": sorted( EPILEPSY_DIAGNOSIS_STATUS, key=itemgetter(1) ), @@ -794,7 +804,7 @@ def epilepsy_or_nonepilepsy_status(request, episode_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_episode", raise_exception=True) -def epileptic_seizure_onset_type(request, episode_id): +def epileptic_seizure_onset_type(request, can_edit, episode_id): """ Defines type of onset if considered to be epilepsy Accepts POST request from epilepsy partial and returns the same having @@ -835,6 +845,7 @@ def epileptic_seizure_onset_type(request, episode_id): episode = Episode.objects.get(pk=episode_id) context = { + "can_edit": can_edit, "episode": episode, "epileptic_seizure_onset_types": sorted( EPILEPSY_SEIZURE_TYPE, key=itemgetter(1) @@ -862,7 +873,7 @@ def epileptic_seizure_onset_type(request, episode_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_episode", raise_exception=True) -def focal_onset_epilepsy_checked_changed(request, episode_id): +def focal_onset_epilepsy_checked_changed(request, can_edit, episode_id): """ Function triggered by a change in any checkbox/toggle in the focal_onset_epilepsy template leading to a post request. The episode_id is also passed in allowing update of the model. @@ -908,6 +919,7 @@ def focal_onset_epilepsy_checked_changed(request, episode_id): episode = Episode.objects.get(pk=episode_id) context = { + "can_edit": can_edit, "episode": episode, "LATERALITY": LATERALITY, "FOCAL_EPILEPSY_MOTOR_MANIFESTATIONS": FOCAL_EPILEPSY_MOTOR_MANIFESTATIONS, @@ -928,7 +940,7 @@ def focal_onset_epilepsy_checked_changed(request, episode_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_episode", raise_exception=True) -def epileptic_generalised_onset(request, episode_id): +def epileptic_generalised_onset(request, can_edit, episode_id): """ POST request from epileptic_generalised_onset field in generalised_onset_epilepsy """ @@ -948,6 +960,7 @@ def epileptic_generalised_onset(request, episode_id): episode = Episode.objects.get(pk=episode_id) context = { + "can_edit": can_edit, "episode": episode, "GENERALISED_SEIZURE_TYPE": sorted(GENERALISED_SEIZURE_TYPE), } @@ -975,7 +988,7 @@ def epileptic_generalised_onset(request, episode_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_episode", raise_exception=True) -def nonepilepsy_generalised_onset(request, episode_id): +def nonepilepsy_generalised_onset(request, can_edit, episode_id): """ POST request from toggle """ @@ -995,6 +1008,7 @@ def nonepilepsy_generalised_onset(request, episode_id): episode = Episode.objects.get(id=episode_id) context = { + "can_edit": can_edit, "nonepilepsy_onset_types": NON_EPILEPSY_SEIZURE_ONSET, "nonepilepsy_types": sorted(NON_EPILEPSY_SEIZURE_TYPE, key=itemgetter(1)), "syncopes": sorted(NON_EPILEPTIC_SYNCOPES, key=itemgetter(1)), @@ -1022,7 +1036,7 @@ def nonepilepsy_generalised_onset(request, episode_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_episode", raise_exception=True) -def nonepileptic_seizure_type(request, episode_id): +def nonepileptic_seizure_type(request, can_edit, episode_id): """ POST request from select element within nonepilepsy partial Returns one of the select options: @@ -1055,6 +1069,7 @@ def nonepileptic_seizure_type(request, episode_id): episode = Episode.objects.get(pk=episode_id) context = { + "can_edit": can_edit, "nonepilepsy_onset_types": NON_EPILEPSY_SEIZURE_ONSET, "nonepilepsy_types": sorted(NON_EPILEPSY_SEIZURE_TYPE, key=itemgetter(1)), "syncopes": sorted(NON_EPILEPTIC_SYNCOPES, key=itemgetter(1)), @@ -1081,7 +1096,7 @@ def nonepileptic_seizure_type(request, episode_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_episode", raise_exception=True) -def nonepileptic_seizure_subtype(request, episode_id): +def nonepileptic_seizure_subtype(request, can_edit, episode_id): """ POST request from the nonepileptic_seizure_subtype partial select component in the nonepilepsy partial @@ -1103,6 +1118,7 @@ def nonepileptic_seizure_subtype(request, episode_id): episode = Episode.objects.get(pk=episode_id) context = { + "can_edit": can_edit, "nonepilepsy_onset_types": NON_EPILEPSY_SEIZURE_ONSET, "nonepilepsy_types": sorted(NON_EPILEPSY_SEIZURE_TYPE, key=itemgetter(1)), "syncopes": sorted(NON_EPILEPTIC_SYNCOPES, key=itemgetter(1)), @@ -1134,7 +1150,7 @@ def nonepileptic_seizure_subtype(request, episode_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.add_syndrome", raise_exception=True) -def add_syndrome(request, multiaxial_diagnosis_id): +def add_syndrome(request, can_edit, multiaxial_diagnosis_id): """ HTMX post request from syndromes.html partial on button click to add new syndrome """ @@ -1158,6 +1174,7 @@ def add_syndrome(request, multiaxial_diagnosis_id): ).order_by("syndrome_name") context = { + "can_edit": can_edit, "syndrome": syndrome, "syndrome_selection": syndrome_selection, } @@ -1175,7 +1192,7 @@ def add_syndrome(request, multiaxial_diagnosis_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.view_syndrome", raise_exception=True) -def edit_syndrome(request, syndrome_id): +def edit_syndrome(request, can_edit, syndrome_id): """ HTMX post request from episodes.html partial on button click to add new episode """ @@ -1195,6 +1212,7 @@ def edit_syndrome(request, syndrome_id): ).order_by("syndrome_name") context = { + "can_edit": can_edit, "syndrome": syndrome, "syndrome_selection": syndrome_selection, "seizure_onset_date_confidence_selection": DATE_ACCURACY, @@ -1236,7 +1254,7 @@ def edit_syndrome(request, syndrome_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.delete_syndrome", raise_exception=True) -def remove_syndrome(request, syndrome_id): +def remove_syndrome(request, can_edit, syndrome_id): """ POST request on button click from episodes partial in multiaxial_diagnosis form Deletes syndrome from table @@ -1248,7 +1266,7 @@ def remove_syndrome(request, syndrome_id): multiaxial_diagnosis=multiaxial_diagnosis ).order_by("-syndrome_diagnosis_date") - context = {"multiaxial_diagnosis": multiaxial_diagnosis, "syndromes": syndromes} + context = {"can_edit": can_edit, "multiaxial_diagnosis": multiaxial_diagnosis, "syndromes": syndromes} response = recalculate_form_generate_response( model_instance=syndrome.multiaxial_diagnosis, @@ -1263,7 +1281,7 @@ def remove_syndrome(request, syndrome_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.view_episode", raise_exception=True) -def close_syndrome(request, syndrome_id): +def close_syndrome(request, can_edit, syndrome_id): """ Call back from onclick of close episode in episode.html returns the episodes list partial @@ -1279,7 +1297,7 @@ def close_syndrome(request, syndrome_id): multiaxial_diagnosis=multiaxial_diagnosis ).order_by("-syndrome_diagnosis_date") - context = {"multiaxial_diagnosis": multiaxial_diagnosis, "syndromes": syndromes} + context = {"can_edit": can_edit, "multiaxial_diagnosis": multiaxial_diagnosis, "syndromes": syndromes} response = recalculate_form_generate_response( model_instance=syndrome.multiaxial_diagnosis, @@ -1294,7 +1312,7 @@ def close_syndrome(request, syndrome_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_multiaxialdiagnosis", raise_exception=True) -def syndrome_present(request, multiaxial_diagnosis_id): +def syndrome_present(request, can_edit, multiaxial_diagnosis_id): """ # POST request from the syndrome partial in the multiaxial_description_form # Updates model and returns the syndrome partial""" @@ -1321,7 +1339,7 @@ def syndrome_present(request, multiaxial_diagnosis_id): multiaxial_diagnosis=multiaxial_diagnosis ).order_by("-syndrome_diagnosis_date") - context = {"multiaxial_diagnosis": multiaxial_diagnosis, "syndromes": syndromes} + context = {"can_edit": can_edit, "multiaxial_diagnosis": multiaxial_diagnosis, "syndromes": syndromes} response = recalculate_form_generate_response( model_instance=multiaxial_diagnosis, @@ -1336,7 +1354,7 @@ def syndrome_present(request, multiaxial_diagnosis_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_multiaxialdiagnosis", raise_exception=True) -def epilepsy_cause_known(request, multiaxial_diagnosis_id): +def epilepsy_cause_known(request, can_edit, multiaxial_diagnosis_id): """ # POST request from the syndrome partial in the multiaxial_description_form # Updates model and returns the syndrome partial""" @@ -1360,6 +1378,7 @@ def epilepsy_cause_known(request, multiaxial_diagnosis_id): multiaxial_diagnosis = MultiaxialDiagnosis.objects.get(pk=multiaxial_diagnosis_id) context = { + "can_edit": can_edit, "multiaxial_diagnosis": multiaxial_diagnosis, "epilepsy_cause_selection": EPILEPSY_CAUSES, } @@ -1400,6 +1419,7 @@ def epilepsy_cause_known(request, multiaxial_diagnosis_id): # multiaxial_diagnosis = MultiaxialDiagnosis.objects.get(pk=multiaxial_diagnosis_id) # context = { +# "can_edit": can_edit, # # "multiaxial_diagnosis": multiaxial_diagnosis, # "epilepsy_cause_selection": EPILEPSY_CAUSES, @@ -1419,7 +1439,7 @@ def epilepsy_cause_known(request, multiaxial_diagnosis_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_multiaxialdiagnosis", raise_exception=True) -def epilepsy_cause_categories(request, multiaxial_diagnosis_id): +def epilepsy_cause_categories(request, can_edit, multiaxial_diagnosis_id): """ POST from multiple select in epilepsy_causes partial """ @@ -1447,6 +1467,7 @@ def epilepsy_cause_categories(request, multiaxial_diagnosis_id): ) context = { + "can_edit": can_edit, "epilepsy_cause_selection": EPILEPSY_CAUSES, "multiaxial_diagnosis": multiaxial_diagnosis, # 'epilepsy_causes': sorted(epilepsy_causes, key=itemgetter('preferredTerm')), @@ -1470,7 +1491,7 @@ def epilepsy_cause_categories(request, multiaxial_diagnosis_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_multiaxialdiagnosis", raise_exception=True) -def relevant_impairments_behavioural_educational(request, multiaxial_diagnosis_id): +def relevant_impairments_behavioural_educational(request, can_edit, multiaxial_diagnosis_id): """ POST request from """ @@ -1497,6 +1518,7 @@ def relevant_impairments_behavioural_educational(request, multiaxial_diagnosis_i ) context = { + "can_edit": can_edit, "multiaxial_diagnosis": multiaxial_diagnosis, "comorbidities": Comorbidity.objects.filter( multiaxial_diagnosis=multiaxial_diagnosis @@ -1516,7 +1538,7 @@ def relevant_impairments_behavioural_educational(request, multiaxial_diagnosis_i @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.add_comorbidity", raise_exception=True) -def add_comorbidity(request, multiaxial_diagnosis_id): +def add_comorbidity(request, can_edit, multiaxial_diagnosis_id): """ POST request from comorbidities_section partial """ @@ -1536,7 +1558,7 @@ def add_comorbidity(request, multiaxial_diagnosis_id): multiaxial_diagnosis=multiaxial_diagnosis ) - context = {"comorbidity": comorbidity, "comorbidity_choices": comorbidity_choices} + context = {"can_edit": can_edit, "comorbidity": comorbidity, "comorbidity_choices": comorbidity_choices} response = recalculate_form_generate_response( model_instance=comorbidity.multiaxial_diagnosis, @@ -1551,7 +1573,7 @@ def add_comorbidity(request, multiaxial_diagnosis_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.view_comorbidity", raise_exception=True) -def edit_comorbidity(request, comorbidity_id): +def edit_comorbidity(request, can_edit, comorbidity_id): """ POST request from comorbidities.html partial on button click to edit episode """ @@ -1561,7 +1583,7 @@ def edit_comorbidity(request, comorbidity_id): comorbidity_choices = get_comorbidity_choices( multiaxial_diagnosis=multiaxial_diagnosis, comorbidity_id=comorbidity_id ) - context = {"comorbidity": comorbidity, "comorbidity_choices": comorbidity_choices} + context = {"can_edit": can_edit, "comorbidity": comorbidity, "comorbidity_choices": comorbidity_choices} response = recalculate_form_generate_response( model_instance=comorbidity.multiaxial_diagnosis, @@ -1576,7 +1598,7 @@ def edit_comorbidity(request, comorbidity_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.delete_comorbidity", raise_exception=True) -def remove_comorbidity(request, comorbidity_id): +def remove_comorbidity(request, can_edit, comorbidity_id): """ POST request from comorbidities.html partial on button click to edit episode """ @@ -1591,6 +1613,7 @@ def remove_comorbidity(request, comorbidity_id): ).all() context = { + "can_edit": can_edit, "multiaxial_diagnosis": multiaxial_diagnosis, "comorbidities": comorbidities, } @@ -1608,7 +1631,7 @@ def remove_comorbidity(request, comorbidity_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.view_comorbidity", raise_exception=True) -def close_comorbidity(request, comorbidity_id): +def close_comorbidity(request, can_edit, comorbidity_id): """ Call back from onclick of close comorbidity in comorbidity.html returns the episodes list partial @@ -1628,6 +1651,7 @@ def close_comorbidity(request, comorbidity_id): ).order_by("-comorbidity_diagnosis_date") context = { + "can_edit": can_edit, "multiaxial_diagnosis": multiaxial_diagnosis, "comorbidities": comorbidities, } @@ -1645,7 +1669,7 @@ def close_comorbidity(request, comorbidity_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_comorbidity", raise_exception=True) -def comorbidity_diagnosis_date(request, comorbidity_id): +def comorbidity_diagnosis_date(request, can_edit, comorbidity_id): """ POST request from comorbidity partial with comorbidity_diagnosis_date """ @@ -1672,7 +1696,7 @@ def comorbidity_diagnosis_date(request, comorbidity_id): multiaxial_diagnosis=multiaxial_diagnosis, comorbidity_id=comorbidity_id ) - context = {"comorbidity": comorbidity, "comorbidity_choices": comorbidity_choices} + context = {"can_edit": can_edit, "comorbidity": comorbidity, "comorbidity_choices": comorbidity_choices} response = recalculate_form_generate_response( model_instance=comorbidity.multiaxial_diagnosis, @@ -1688,7 +1712,7 @@ def comorbidity_diagnosis_date(request, comorbidity_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_comorbidity", raise_exception=True) -def comorbidity_diagnosis(request, comorbidity_id): +def comorbidity_diagnosis(request, can_edit, comorbidity_id): """ POST request on change select from comorbidity partial Choices for comorbidities fed from SNOMED server @@ -1718,6 +1742,7 @@ def comorbidity_diagnosis(request, comorbidity_id): ) context = { + "can_edit": can_edit, "comorbidity_choices": comorbidity_choices, "comorbidity": comorbidity, } @@ -1736,7 +1761,7 @@ def comorbidity_diagnosis(request, comorbidity_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.view_comorbidity", raise_exception=True) -def comorbidities(request, multiaxial_diagnosis_id): +def comorbidities(request, can_edit, multiaxial_diagnosis_id): """ POST request from comorbidity partial to replace it with table """ @@ -1746,6 +1771,7 @@ def comorbidities(request, multiaxial_diagnosis_id): ).order_by("-comorbidity_diagnosis_date") context = { + "can_edit": can_edit, "multiaxial_diagnosis": multiaxial_diagnosis, "comorbidities": comorbidities, } @@ -1763,7 +1789,7 @@ def comorbidities(request, multiaxial_diagnosis_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_multiaxialdiagnosis", raise_exception=True) -def mental_health_screen(request, multiaxial_diagnosis_id): +def mental_health_screen(request, can_edit, multiaxial_diagnosis_id): """ POST request callback for mental_health_screen toggle """ @@ -1783,6 +1809,7 @@ def mental_health_screen(request, multiaxial_diagnosis_id): multiaxial_diagnosis = MultiaxialDiagnosis.objects.get(pk=multiaxial_diagnosis_id) context = { + "can_edit": can_edit, "multiaxial_diagnosis": multiaxial_diagnosis, "mental_health_issues_choices": NEUROPSYCHIATRIC, "global_developmental_delay_or_learning_difficulties_severity_choices": SEVERITY, @@ -1802,7 +1829,7 @@ def mental_health_screen(request, multiaxial_diagnosis_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_multiaxialdiagnosis", raise_exception=True) -def mental_health_issue_identified(request, multiaxial_diagnosis_id): +def mental_health_issue_identified(request, can_edit, multiaxial_diagnosis_id): """ POST request callback for mental_health_issue_identified toggle """ @@ -1830,6 +1857,7 @@ def mental_health_issue_identified(request, multiaxial_diagnosis_id): multiaxial_diagnosis.save() context = { + "can_edit": can_edit, "multiaxial_diagnosis": multiaxial_diagnosis, "mental_health_issues_choices": NEUROPSYCHIATRIC, "global_developmental_delay_or_learning_difficulties_severity_choices": SEVERITY, @@ -1849,7 +1877,7 @@ def mental_health_issue_identified(request, multiaxial_diagnosis_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_multiaxialdiagnosis", raise_exception=True) -def mental_health_issues(request, multiaxial_diagnosis_id): +def mental_health_issues(request, can_edit, multiaxial_diagnosis_id): """ POST callback from mental_health_issue multiple choice multiple toggle hx_name of the individual issue is mental_health_issue @@ -1879,6 +1907,7 @@ def mental_health_issues(request, multiaxial_diagnosis_id): multiaxial_diagnosis = MultiaxialDiagnosis.objects.get(pk=multiaxial_diagnosis_id) context = { + "can_edit": can_edit, "multiaxial_diagnosis": multiaxial_diagnosis, "mental_health_issues_choices": NEUROPSYCHIATRIC, "global_developmental_delay_or_learning_difficulties_severity_choices": SEVERITY, @@ -1899,7 +1928,7 @@ def mental_health_issues(request, multiaxial_diagnosis_id): @user_may_view_this_child() @permission_required("epilepsy12.change_multiaxialdiagnosis", raise_exception=True) def global_developmental_delay_or_learning_difficulties( - request, multiaxial_diagnosis_id + request, can_edit, multiaxial_diagnosis_id ): """ POST request callback for mental_health_issue_identified toggle @@ -1930,6 +1959,7 @@ def global_developmental_delay_or_learning_difficulties( multiaxial_diagnosis.save() context = { + "can_edit": can_edit, "multiaxial_diagnosis": multiaxial_diagnosis, "mental_health_issues_choices": NEUROPSYCHIATRIC, "global_developmental_delay_or_learning_difficulties_severity_choices": SEVERITY, @@ -1950,7 +1980,7 @@ def global_developmental_delay_or_learning_difficulties( @user_may_view_this_child() @permission_required("epilepsy12.change_multiaxialdiagnosis", raise_exception=True) def global_developmental_delay_or_learning_difficulties_severity( - request, multiaxial_diagnosis_id + request, can_edit, multiaxial_diagnosis_id ): """ POST callback from global_developmental_delay_or_learning_difficulties_severity multiple toggle @@ -1971,6 +2001,7 @@ def global_developmental_delay_or_learning_difficulties_severity( multiaxial_diagnosis = MultiaxialDiagnosis.objects.get(pk=multiaxial_diagnosis_id) context = { + "can_edit": can_edit, "multiaxial_diagnosis": multiaxial_diagnosis, "mental_health_issues_choices": NEUROPSYCHIATRIC, "global_developmental_delay_or_learning_difficulties_severity_choices": SEVERITY, @@ -1990,7 +2021,7 @@ def global_developmental_delay_or_learning_difficulties_severity( @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_multiaxialdiagnosis", raise_exception=True) -def autistic_spectrum_disorder(request, multiaxial_diagnosis_id): +def autistic_spectrum_disorder(request, can_edit, multiaxial_diagnosis_id): """ POST callback from autistic_spectrum_disorder multiple toggle """ @@ -2009,6 +2040,7 @@ def autistic_spectrum_disorder(request, multiaxial_diagnosis_id): multiaxial_diagnosis = MultiaxialDiagnosis.objects.get(pk=multiaxial_diagnosis_id) context = { + "can_edit": can_edit, "multiaxial_diagnosis": multiaxial_diagnosis, "mental_health_issues_choices": NEUROPSYCHIATRIC, "global_developmental_delay_or_learning_difficulties_severity_choices": SEVERITY, diff --git a/epilepsy12/views/registration_views.py b/epilepsy12/views/registration_views.py index 97e01cccc..97f0bc81c 100644 --- a/epilepsy12/views/registration_views.py +++ b/epilepsy12/views/registration_views.py @@ -28,7 +28,10 @@ validate_and_update_model, recalculate_form_generate_response, ) -from ..decorator import user_may_view_this_child, login_and_otp_required +from ..decorator import ( + user_may_view_this_child, + login_and_otp_required +) from ..general_functions import ( construct_transfer_epilepsy12_site_email, cohorts_and_dates, @@ -39,7 +42,7 @@ @login_and_otp_required() @permission_required("epilepsy12.view_registration", raise_exception=True) @user_may_view_this_child() -def register(request, case_id): +def register(request, can_edit, case_id): """ Called on registration form page load. If first time, creates new Registration object KPI object and AuditProgress object. Creates a new Site with selected organisation and associates with this case. @@ -152,7 +155,7 @@ def register(request, case_id): "active_template": active_template, # pass back organisation_id to steps for return to cases button "organisation_id": lead_site.organisation.pk, - "field_enabled": False, + "can_edit": can_edit and request.user.has_perm("epilepsy12.change_registration"), } template_name = "epilepsy12/register.html" @@ -178,7 +181,7 @@ def register(request, case_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.can_edit_epilepsy12_lead_centre", raise_exception=True) -def allocate_lead_site(request, registration_id): +def allocate_lead_site(request, can_edit, registration_id): """ Allocate site when none have been assigned """ @@ -236,6 +239,7 @@ def allocate_lead_site(request, registration_id): organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "organisation_list": organisation_list, "registration": registration, "site": site, @@ -260,7 +264,7 @@ def allocate_lead_site(request, registration_id): @permission_required( "epilepsy12.can_transfer_epilepsy12_lead_centre", raise_exception=True ) -def transfer_lead_site(request, registration_id, site_id): +def transfer_lead_site(request, can_edit, registration_id, site_id): """ POST request from lead_site.html on click of transfer lead centre button Does not update model @@ -274,6 +278,7 @@ def transfer_lead_site(request, registration_id, site_id): organisation_list = Organisation.objects.get_organisation_list(exclude_pk=site.organisation.pk) context = { + "can_edit": can_edit, "organisation_list": organisation_list, "registration": registration, "site": site, @@ -299,12 +304,13 @@ def transfer_lead_site(request, registration_id, site_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.view_registration", raise_exception=True) -def cancel_lead_site(request, registration_id, site_id): +def cancel_lead_site(request, can_edit, registration_id, site_id): registration = Registration.objects.get(pk=registration_id) site = Site.objects.get(pk=site_id) organisation_list = Organisation.objects.get_organisation_list() context = { + "can_edit": can_edit, "registration": registration, "site": site, "edit": False, @@ -329,7 +335,7 @@ def cancel_lead_site(request, registration_id, site_id): @permission_required( "epilepsy12.can_transfer_epilepsy12_lead_centre", raise_exception=True ) -def update_lead_site(request, registration_id, site_id, update): +def update_lead_site(request, can_edit, registration_id, site_id, update): """ HTMX POST request on button click from the lead_site partial If the update parameter is 'transfer', @@ -484,7 +490,7 @@ def update_lead_site(request, registration_id, site_id, update): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.view_registration", raise_exception=True) -def previous_sites(request, registration_id): +def previous_sites(request, can_edit, registration_id): registration = Registration.objects.get(pk=registration_id) previous_sites = Site.objects.filter( case=registration.case, @@ -493,6 +499,7 @@ def previous_sites(request, registration_id): ) context = { + "can_edit": can_edit, "previously_registered_sites": previous_sites, "registration": registration, } @@ -519,7 +526,7 @@ def previous_sites(request, registration_id): @permission_required( "epilepsy12.can_register_child_in_epilepsy12", raise_exception=True ) -def confirm_eligible(request, registration_id): +def confirm_eligible(request, can_edit, registration_id): """ HTMX POST request on button press in registration_form confirming child meets eligibility criteria of the audit. @@ -528,6 +535,7 @@ def confirm_eligible(request, registration_id): eligibility. The button will not be shown again. """ context = { + "can_edit": can_edit, "has_error": False, "message": "Eligibility Criteria Confirmed.", "is_positive": True, @@ -537,7 +545,7 @@ def confirm_eligible(request, registration_id): pk=registration_id, defaults={"eligibility_criteria_met": True} ) except Exception as error: - context = {"has_error": True, "message": error, "is_positive": False} + context = {"can_edit": can_edit, "has_error": True, "message": error, "is_positive": False} registration = Registration.objects.filter(pk=registration_id).get() @@ -567,11 +575,11 @@ def confirm_eligible(request, registration_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_registration", raise_exception=True) -def registration_status(request, registration_id): +def registration_status(request, can_edit, registration_id): registration = Registration.objects.get(pk=registration_id) case = registration.case - context = {"case_id": case.pk, "registration": registration} + context = {"can_edit": can_edit, "case_id": case.pk, "registration": registration} template_name = "epilepsy12/partials/registration/registration_dates.html" @@ -590,7 +598,7 @@ def registration_status(request, registration_id): @permission_required( "epilepsy12.can_register_child_in_epilepsy12", raise_exception=True ) -def first_paediatric_assessment_date(request, case_id): +def first_paediatric_assessment_date(request, can_edit, case_id): """ This defines registration in the audit and refers to the date of first paediatric assessment. Call back from POST request on button press of register button @@ -630,7 +638,7 @@ def first_paediatric_assessment_date(request, case_id): # requery to get most up to date instance registration = Registration.objects.filter(case=case).get() - context = {"case_id": case_id, "registration": registration} + context = {"can_edit": can_edit, "case_id": case_id, "registration": registration} template_name = "epilepsy12/partials/registration/registration_dates.html" diff --git a/epilepsy12/views/syndrome_views.py b/epilepsy12/views/syndrome_views.py index 239249f8d..a560b98e1 100644 --- a/epilepsy12/views/syndrome_views.py +++ b/epilepsy12/views/syndrome_views.py @@ -12,7 +12,7 @@ @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.add_syndrome", raise_exception=True) -def syndrome_diagnosis_date(request, syndrome_id): +def syndrome_diagnosis_date(request, can_edit, syndrome_id): """ HTMX post request from syndrome.html partial on date change """ @@ -45,6 +45,7 @@ def syndrome_diagnosis_date(request, syndrome_id): ).order_by("syndrome_name") context = { + "can_edit": can_edit, "syndrome_selection": syndrome_selection, "syndrome": syndrome, } @@ -63,7 +64,7 @@ def syndrome_diagnosis_date(request, syndrome_id): @login_and_otp_required() @user_may_view_this_child() @permission_required("epilepsy12.change_syndrome", raise_exception=True) -def syndrome_name(request, syndrome_id): +def syndrome_name(request, can_edit, syndrome_id): """ HTMX post request from syndrome.html partial on syndrome name change """ @@ -94,6 +95,7 @@ def syndrome_name(request, syndrome_id): ).order_by("syndrome_name") context = { + "can_edit": can_edit, "syndrome_selection": syndrome_selection, "syndrome": syndrome, } diff --git a/templates/epilepsy12/cases/case.html b/templates/epilepsy12/cases/case.html index b8be5771c..d033777b0 100644 --- a/templates/epilepsy12/cases/case.html +++ b/templates/epilepsy12/cases/case.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% load static %} {% block content %}
- {% include '../forms/case_form.html' with form=form organisation_id=organisation_id organisation=organisation choices=choices hide_completion_fields=True %} + {% include '../forms/case_form.html' with form=form organisation_id=organisation_id organisation=organisation choices=choices hide_completion_fields=True can_edit=can_edit %}
{% endblock %} diff --git a/templates/epilepsy12/cases/postcode_options.html b/templates/epilepsy12/cases/postcode_options.html index b3615ed07..fbf14ebd2 100644 --- a/templates/epilepsy12/cases/postcode_options.html +++ b/templates/epilepsy12/cases/postcode_options.html @@ -16,7 +16,8 @@ + {% endif %} @@ -174,20 +176,21 @@ href="{% url 'cases' organisation_id %}" class="ui rcpch_negative button"> Cancel - {% if perms.epilepsy12.change_case or perms.epilepsy12.add_case %} - - + {% if can_edit %} + {% if perms.epilepsy12.change_case or perms.epilepsy12.add_case %} + + {% endif %} {% endif %} {% if case %} - {% if perms.epilepsy12.delete_case %} + {% if can_edit and perms.epilepsy12.delete_case %} - {% if not perms.epilepsy12.can_consent_to_audit_participation %} + {% if not can_edit %} Your access level does not allow you to consent to participation in Epilepsy12 {% endif %} diff --git a/templates/epilepsy12/partials/assessment/consultant_paediatrician.html b/templates/epilepsy12/partials/assessment/consultant_paediatrician.html index f13abd9e5..535f65946 100644 --- a/templates/epilepsy12/partials/assessment/consultant_paediatrician.html +++ b/templates/epilepsy12/partials/assessment/consultant_paediatrician.html @@ -3,7 +3,7 @@
{% url 'consultant_paediatrician_referral_made' assessment_id=assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=assessment.consultant_paediatrician_referral_made hx_post=hx_post hx_swap="innerHTML" hx_target="#general_paediatric" hx_trigger="click" tooltip_id='consultant_paediatrician_referral_made_tooltip' label=assessment.get_consultant_paediatrician_referral_made_help_label_text reference=assessment.get_consultant_paediatrician_referral_made_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_assessment %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=assessment.consultant_paediatrician_referral_made hx_post=hx_post hx_swap="innerHTML" hx_target="#general_paediatric" hx_trigger="click" tooltip_id='consultant_paediatrician_referral_made_tooltip' label=assessment.get_consultant_paediatrician_referral_made_help_label_text reference=assessment.get_consultant_paediatrician_referral_made_help_reference_text data_position="top left" enabled=can_edit %}
{% if assessment.consultant_paediatrician_referral_made %} @@ -11,14 +11,14 @@
{% url 'consultant_paediatrician_referral_date' assessment_id=assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_swap="innerHTML" hx_target="#general_paediatric" hx_trigger="change delay:1s" label=assessment.get_consultant_paediatrician_referral_date_help_label_text reference=assessment.get_consultant_paediatrician_referral_date_help_reference_text date_value=assessment.consultant_paediatrician_referral_date input_date_field_name="consultant_paediatrician_referral_date" data_position="top left" error_message=error_message enabled=perms.epilepsy12.change_assessment has_permission=perms.epilepsy12.change_assessment %} + {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_swap="innerHTML" hx_target="#general_paediatric" hx_trigger="change delay:1s" label=assessment.get_consultant_paediatrician_referral_date_help_label_text reference=assessment.get_consultant_paediatrician_referral_date_help_reference_text date_value=assessment.consultant_paediatrician_referral_date input_date_field_name="consultant_paediatrician_referral_date" data_position="top left" error_message=error_message enabled=can_edit has_permission=can_edit %} {% url 'consultant_paediatrician_input_achieved' assessment_id=assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=assessment.consultant_paediatrician_input_achieved hx_post=hx_post hx_swap="innerHTML" hx_target="#general_paediatric" hx_trigger="click" tooltip_id='consultant_paediatrician_input_achieved_tooltip' label=assessment.get_consultant_paediatrician_input_achieved_help_label_text reference=assessment.get_consultant_paediatrician_achieved_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_assessment %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=assessment.consultant_paediatrician_input_achieved hx_post=hx_post hx_swap="innerHTML" hx_target="#general_paediatric" hx_trigger="click" tooltip_id='consultant_paediatrician_input_achieved_tooltip' label=assessment.get_consultant_paediatrician_input_achieved_help_label_text reference=assessment.get_consultant_paediatrician_achieved_help_reference_text data_position="top left" enabled=can_edit %} {% if assessment.consultant_paediatrician_input_achieved %} {% url 'consultant_paediatrician_input_date' assessment_id=assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_swap="innerHTML" hx_target="#general_paediatric" hx_trigger="change delay:1s" label=assessment.get_consultant_paediatrician_input_date_help_label_text reference=assessment.get_consultant_paediatrician_input_date_help_reference_text date_value=assessment.consultant_paediatrician_input_date input_date_field_name="consultant_paediatrician_input_date" data_position="top left" error_message=error_message enabled=perms.epilepsy12.change_assessment has_permission=perms.epilepsy12.change_assessment %} + {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_swap="innerHTML" hx_target="#general_paediatric" hx_trigger="change delay:1s" label=assessment.get_consultant_paediatrician_input_date_help_label_text reference=assessment.get_consultant_paediatrician_input_date_help_reference_text date_value=assessment.consultant_paediatrician_input_date input_date_field_name="consultant_paediatrician_input_date" data_position="top left" error_message=error_message enabled=can_edit has_permission=can_edit %}
@@ -51,7 +51,7 @@
{% endif %} @@ -102,7 +102,7 @@ There is currently no general paediatric centre involved in the care of {{assessment.registration.case.first_name}} {{assessment.registration.case.surname}} {% url 'general_paediatric_centre' assessment_id=assessment.pk as hx_post %} {% url 'update_general_paediatric_centre_pressed' assessment_id=assessment.pk site_id=active_general_paediatric_site.pk action='cancel' as hx_cancel %} - {% include 'epilepsy12/partials/page_elements/organisations_select.html' with organisation_list=organisation_list hx_post=hx_post hx_target="#general_paediatric" hx_trigger="click" hx_swap="innerHTML" hx_name="general_paediatric_centre" test_positive=None label="Update General Paediatric Site" hx_default_text="Search general paediatric organisations..." data_position="top left" enabled=perms.epilepsy12.change_assessment hx_cancel=hx_cancel %} + {% include 'epilepsy12/partials/page_elements/organisations_select.html' with organisation_list=organisation_list hx_post=hx_post hx_target="#general_paediatric" hx_trigger="click" hx_swap="innerHTML" hx_name="general_paediatric_centre" test_positive=None label="Update General Paediatric Site" hx_default_text="Search general paediatric organisations..." data_position="top left" enabled=can_edit hx_cancel=hx_cancel %}
{% endif %} diff --git a/templates/epilepsy12/partials/assessment/epilepsy_nurse.html b/templates/epilepsy12/partials/assessment/epilepsy_nurse.html index 7a053ddbf..178e40347 100644 --- a/templates/epilepsy12/partials/assessment/epilepsy_nurse.html +++ b/templates/epilepsy12/partials/assessment/epilepsy_nurse.html @@ -4,7 +4,7 @@
{% url "epilepsy_specialist_nurse_referral_made" assessment_id=assessment.pk as hx_post %} - {% include "epilepsy12/partials/page_elements/toggle_button.html" with test_positive=assessment.epilepsy_specialist_nurse_referral_made hx_post=hx_post hx_swap="innerHTML" hx_target="#epilepsy_specialist_nurse" hx_trigger="click" tooltip_id="epilepsy_specialist_nurse_referral_made_tooltip" label=assessment.get_epilepsy_specialist_nurse_referral_made_help_label_text reference=assessment.get_epilepsy_specialist_nurse_referral_made_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_assessment %} + {% include "epilepsy12/partials/page_elements/toggle_button.html" with test_positive=assessment.epilepsy_specialist_nurse_referral_made hx_post=hx_post hx_swap="innerHTML" hx_target="#epilepsy_specialist_nurse" hx_trigger="click" tooltip_id="epilepsy_specialist_nurse_referral_made_tooltip" label=assessment.get_epilepsy_specialist_nurse_referral_made_help_label_text reference=assessment.get_epilepsy_specialist_nurse_referral_made_help_reference_text data_position="top left" enabled=can_edit %}
{% if assessment.epilepsy_specialist_nurse_referral_made %} @@ -13,15 +13,15 @@
{% url "epilepsy_specialist_nurse_referral_date" assessment_id=assessment.pk as hx_post %} - {% include "epilepsy12/partials/page_elements/date_field.html" with hx_post=hx_post hx_swap="innerHTML" hx_target="#epilepsy_specialist_nurse" hx_trigger="change delay:1s" label=assessment.get_epilepsy_specialist_nurse_referral_date_help_label_text reference=assessment.get_epilepsy_specialist_nurse_referral_date_help_reference_text date_value=assessment.epilepsy_specialist_nurse_referral_date data_position="top left" input_date_field_name="epilepsy_specialist_nurse_referral_date" error_message=error_message enabled=perms.epilepsy12.change_assessment has_permission=perms.epilepsy12.change_assessment %} + {% include "epilepsy12/partials/page_elements/date_field.html" with hx_post=hx_post hx_swap="innerHTML" hx_target="#epilepsy_specialist_nurse" hx_trigger="change delay:1s" label=assessment.get_epilepsy_specialist_nurse_referral_date_help_label_text reference=assessment.get_epilepsy_specialist_nurse_referral_date_help_reference_text date_value=assessment.epilepsy_specialist_nurse_referral_date data_position="top left" input_date_field_name="epilepsy_specialist_nurse_referral_date" error_message=error_message enabled=can_edit has_permission=can_edit %} {% url "epilepsy_specialist_nurse_input_achieved" assessment_id=assessment.pk as hx_post %} - {% include "epilepsy12/partials/page_elements/toggle_button.html" with test_positive=assessment.epilepsy_specialist_nurse_input_achieved hx_post=hx_post hx_swap="innerHTML" hx_target="#epilepsy_specialist_nurse" hx_trigger="click" tooltip_id="epilepsy_specialist_nurse_input_achieved_tooltip" label=assessment.get_epilepsy_specialist_nurse_input_achieved_help_label_text reference=assessment.get_epilepsy_specialist_nurse_achieved_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_assessment %} + {% include "epilepsy12/partials/page_elements/toggle_button.html" with test_positive=assessment.epilepsy_specialist_nurse_input_achieved hx_post=hx_post hx_swap="innerHTML" hx_target="#epilepsy_specialist_nurse" hx_trigger="click" tooltip_id="epilepsy_specialist_nurse_input_achieved_tooltip" label=assessment.get_epilepsy_specialist_nurse_input_achieved_help_label_text reference=assessment.get_epilepsy_specialist_nurse_achieved_help_reference_text data_position="top left" enabled=can_edit %} {% if assessment.epilepsy_specialist_nurse_input_achieved %} {% url "epilepsy_specialist_nurse_input_date" assessment_id=assessment.pk as hx_post %} - {% include "epilepsy12/partials/page_elements/date_field.html" with hx_post=hx_post hx_swap="innerHTML" hx_target="#epilepsy_specialist_nurse" hx_trigger="change delay:1s" label=assessment.get_epilepsy_specialist_nurse_input_date_help_label_text reference=assessment.get_epilepsy_specialist_nurse_input_date_help_reference_text date_value=assessment.epilepsy_specialist_nurse_input_date data_position="top left" input_date_field_name="epilepsy_specialist_nurse_input_date" error_message=error_message enabled=perms.epilepsy12.change_assessment has_permission=perms.epilepsy12.change_assessment %} + {% include "epilepsy12/partials/page_elements/date_field.html" with hx_post=hx_post hx_swap="innerHTML" hx_target="#epilepsy_specialist_nurse" hx_trigger="change delay:1s" label=assessment.get_epilepsy_specialist_nurse_input_date_help_label_text reference=assessment.get_epilepsy_specialist_nurse_input_date_help_reference_text date_value=assessment.epilepsy_specialist_nurse_input_date data_position="top left" input_date_field_name="epilepsy_specialist_nurse_input_date" error_message=error_message enabled=can_edit has_permission=can_edit %}
diff --git a/templates/epilepsy12/partials/assessment/epilepsy_surgery.html b/templates/epilepsy12/partials/assessment/epilepsy_surgery.html index be9f13056..4fb1d393e 100644 --- a/templates/epilepsy12/partials/assessment/epilepsy_surgery.html +++ b/templates/epilepsy12/partials/assessment/epilepsy_surgery.html @@ -17,26 +17,26 @@
  • Children with epilepsy associated with hypothalamic hamartoma
  • {% url 'childrens_epilepsy_surgical_service_referral_criteria_met' assessment_id=assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=assessment.childrens_epilepsy_surgical_service_referral_criteria_met hx_post=hx_post hx_swap="innerHTML" hx_target="#childrens_epilepsy_surgical_service" hx_trigger="click" tooltip_id='childrens_epilepsy_surgical_service_referral_criteria_met_tooltip' label=assessment.get_childrens_epilepsy_surgical_service_referral_criteria_met_help_label_text reference=assessment.get_childrens_epilepsy_surgical_service_referral_criteria_met_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_assessment %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=assessment.childrens_epilepsy_surgical_service_referral_criteria_met hx_post=hx_post hx_swap="innerHTML" hx_target="#childrens_epilepsy_surgical_service" hx_trigger="click" tooltip_id='childrens_epilepsy_surgical_service_referral_criteria_met_tooltip' label=assessment.get_childrens_epilepsy_surgical_service_referral_criteria_met_help_label_text reference=assessment.get_childrens_epilepsy_surgical_service_referral_criteria_met_help_reference_text data_position="top left" enabled=can_edit %}
    {% url 'childrens_epilepsy_surgical_service_referral_made' assessment_id=assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=assessment.childrens_epilepsy_surgical_service_referral_made hx_post=hx_post hx_swap="innerHTML" hx_target="#childrens_epilepsy_surgical_service" hx_trigger="click" tooltip_id='childrens_epilepsy_surgical_service_tooltip' label=assessment.get_childrens_epilepsy_surgical_service_referral_made_help_label_text reference=assessment.get_childrens_epilepsy_surgical_service_referral_made_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_assessment %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=assessment.childrens_epilepsy_surgical_service_referral_made hx_post=hx_post hx_swap="innerHTML" hx_target="#childrens_epilepsy_surgical_service" hx_trigger="click" tooltip_id='childrens_epilepsy_surgical_service_tooltip' label=assessment.get_childrens_epilepsy_surgical_service_referral_made_help_label_text reference=assessment.get_childrens_epilepsy_surgical_service_referral_made_help_reference_text data_position="top left" enabled=can_edit %} {% if assessment.childrens_epilepsy_surgical_service_referral_made %}
    {% url 'childrens_epilepsy_surgical_service_referral_date' assessment_id=assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_swap="innerHTML" hx_target="#childrens_epilepsy_surgical_service" hx_trigger="change delay:1s" label=assessment.get_childrens_epilepsy_surgical_service_referral_date_help_label_text reference=assessment.get_childrens_epilepsy_surgical_service_referral_date_help_reference_text date_value=assessment.childrens_epilepsy_surgical_service_referral_date input_date_field_name="childrens_epilepsy_surgical_service_referral_date" error_message=error_message enabled=perms.epilepsy12.change_assessment has_permission=perms.epilepsy12.change_assessment %} + {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_swap="innerHTML" hx_target="#childrens_epilepsy_surgical_service" hx_trigger="change delay:1s" label=assessment.get_childrens_epilepsy_surgical_service_referral_date_help_label_text reference=assessment.get_childrens_epilepsy_surgical_service_referral_date_help_reference_text date_value=assessment.childrens_epilepsy_surgical_service_referral_date input_date_field_name="childrens_epilepsy_surgical_service_referral_date" error_message=error_message enabled=can_edit has_permission=can_edit %} {% if show_input_date %}
    {% url 'childrens_epilepsy_surgical_service_input_date' assessment_id=assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_swap="innerHTML" hx_target="#childrens_epilepsy_surgical_service" hx_trigger="change delay:1s" label=assessment.get_childrens_epilepsy_surgical_service_input_date_help_label_text reference=assessment.get_childrens_epilepsy_surgical_service_input_date_help_reference_text date_value=assessment.childrens_epilepsy_surgical_service_input_date input_date_field_name="childrens_epilepsy_surgical_service_input_date" error_message=error_message enabled=perms.epilepsy12.change_assessment has_permission=perms.epilepsy12.change_assessment %} + {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_swap="innerHTML" hx_target="#childrens_epilepsy_surgical_service" hx_trigger="change delay:1s" label=assessment.get_childrens_epilepsy_surgical_service_input_date_help_label_text reference=assessment.get_childrens_epilepsy_surgical_service_input_date_help_reference_text date_value=assessment.childrens_epilepsy_surgical_service_input_date input_date_field_name="childrens_epilepsy_surgical_service_input_date" error_message=error_message enabled=can_edit has_permission=can_edit %}
    @@ -45,7 +45,7 @@
    Edit
    {% endif %} @@ -142,7 +146,7 @@ {% url 'epilepsy_surgery_centre' assessment_id=assessment.pk as hx_post %} {% url 'update_epilepsy_surgery_centre_pressed' assessment_id=assessment.pk site_id=active_surgical_site.pk action='cancel' as hx_cancel %} - {% include 'epilepsy12/partials/page_elements/organisations_select.html' with organisation_list=organisation_list hx_post=hx_post hx_target="#childrens_epilepsy_surgical_service" hx_trigger="click" hx_swap="innerHTML" hx_name="epilepsy_surgery_centre" test_positive=None label="Allocate Children's Surgical Centre" hx_default_text="Search children's surgical centres..." data_position="top left" enabled=perms.epilepsy12.change_assessment has_permission=perms.epilepsy12.change_assessment %} + {% include 'epilepsy12/partials/page_elements/organisations_select.html' with organisation_list=organisation_list hx_post=hx_post hx_target="#childrens_epilepsy_surgical_service" hx_trigger="click" hx_swap="innerHTML" hx_name="epilepsy_surgery_centre" test_positive=None label="Allocate Children's Surgical Centre" hx_default_text="Search children's surgical centres..." data_position="top left" enabled=can_edit has_permission=can_edit %}
    {% endif %} diff --git a/templates/epilepsy12/partials/assessment/paediatric_neurology.html b/templates/epilepsy12/partials/assessment/paediatric_neurology.html index abf113099..23d0f5cb5 100644 --- a/templates/epilepsy12/partials/assessment/paediatric_neurology.html +++ b/templates/epilepsy12/partials/assessment/paediatric_neurology.html @@ -2,21 +2,21 @@
    {% url 'paediatric_neurologist_referral_made' assessment_id=assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=assessment.paediatric_neurologist_referral_made hx_post=hx_post hx_swap="innerHTML" hx_target="#paediatric_neurology" hx_trigger="click" tooltip_id='paediatric_neurologist_referral_made_tooltip' label=assessment.get_paediatric_neurologist_referral_made_help_label_text reference=assessment.get_paediatric_neurologist_referral_made_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_assessment %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=assessment.paediatric_neurologist_referral_made hx_post=hx_post hx_swap="innerHTML" hx_target="#paediatric_neurology" hx_trigger="click" tooltip_id='paediatric_neurologist_referral_made_tooltip' label=assessment.get_paediatric_neurologist_referral_made_help_label_text reference=assessment.get_paediatric_neurologist_referral_made_help_reference_text data_position="top left" enabled=can_edit %} {% if assessment.paediatric_neurologist_referral_made %}
    {% url 'paediatric_neurologist_referral_date' assessment_id=assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_swap="innerHTML" hx_target="#paediatric_neurology" hx_trigger="change delay:1s" label=assessment.get_paediatric_neurologist_referral_date_help_label_text reference=assessment.get_paediatric_neurologist_referral_date_help_reference_text date_value=assessment.paediatric_neurologist_referral_date input_date_field_name="paediatric_neurologist_referral_date" error_message=error_message enabled=perms.epilepsy12.change_assessment has_permission=perms.epilepsy12.change_assessment %} + {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_swap="innerHTML" hx_target="#paediatric_neurology" hx_trigger="change delay:1s" label=assessment.get_paediatric_neurologist_referral_date_help_label_text reference=assessment.get_paediatric_neurologist_referral_date_help_reference_text date_value=assessment.paediatric_neurologist_referral_date input_date_field_name="paediatric_neurologist_referral_date" error_message=error_message enabled=can_edit has_permission=can_edit %} {% url 'paediatric_neurologist_input_achieved' assessment_id=assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=assessment.paediatric_neurologist_input_achieved hx_post=hx_post hx_swap="innerHTML" hx_target="#paediatric_neurology" hx_trigger="click" tooltip_id='paediatric_neurologist_input_achieved_tooltip' label=assessment.get_paediatric_neurologist_input_achieved_help_label_text reference=assessment.get_paediatric_neurologist_input_achieved_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_assessment %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=assessment.paediatric_neurologist_input_achieved hx_post=hx_post hx_swap="innerHTML" hx_target="#paediatric_neurology" hx_trigger="click" tooltip_id='paediatric_neurologist_input_achieved_tooltip' label=assessment.get_paediatric_neurologist_input_achieved_help_label_text reference=assessment.get_paediatric_neurologist_input_achieved_help_reference_text data_position="top left" enabled=can_edit %} {% if assessment.paediatric_neurologist_input_achieved %} {% url 'paediatric_neurologist_input_date' assessment_id=assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_swap="innerHTML" hx_target="#paediatric_neurology" hx_trigger="change delay:1s" label=assessment.get_paediatric_neurologist_input_date_help_label_text reference=assessment.get_paediatric_neurologist_input_date_help_reference_text date_value=assessment.paediatric_neurologist_input_date input_date_field_name="paediatric_neurologist_input_date" error_message=error_message enabled=perms.epilepsy12.change_assessment has_permission=perms.epilepsy12.change_assessment %} + {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_swap="innerHTML" hx_target="#paediatric_neurology" hx_trigger="change delay:1s" label=assessment.get_paediatric_neurologist_input_date_help_label_text reference=assessment.get_paediatric_neurologist_input_date_help_reference_text date_value=assessment.paediatric_neurologist_input_date input_date_field_name="paediatric_neurologist_input_date" error_message=error_message enabled=can_edit has_permission=can_edit %} {% if error_message %}
    {{ error_message }} @@ -46,7 +46,7 @@
    {% endif %} @@ -97,7 +97,7 @@ {% url 'paediatric_neurology_centre' assessment_id=assessment.pk as hx_post %} {% url 'update_paediatric_neurology_centre_pressed' assessment_id=assessment.pk site_id=active_neurology_site.pk action='cancel' as hx_cancel %} - {% include 'epilepsy12/partials/page_elements/organisations_select.html' with organisation_list=organisation_list hx_post=hx_post hx_target="#paediatric_neurology" hx_trigger="click" hx_swap="innerHTML" hx_name="paediatric_neurology_centre" test_positive=None label="Allocate Paediatric Neurology Centre" hx_default_text="Search paediatric neurology centres..." data_position="top left" enabled=perms.epilepsy12.change_assessment hx_cancel=hx_cancel %} + {% include 'epilepsy12/partials/page_elements/organisations_select.html' with organisation_list=organisation_list hx_post=hx_post hx_target="#paediatric_neurology" hx_trigger="click" hx_swap="innerHTML" hx_name="paediatric_neurology_centre" test_positive=None label="Allocate Paediatric Neurology Centre" hx_default_text="Search paediatric neurology centres..." data_position="top left" enabled=can_edit hx_cancel=hx_cancel %}
    {% endif %} diff --git a/templates/epilepsy12/partials/assessment/seizure_length_checkboxes.html b/templates/epilepsy12/partials/assessment/seizure_length_checkboxes.html index 6c32f1320..24fc72f95 100644 --- a/templates/epilepsy12/partials/assessment/seizure_length_checkboxes.html +++ b/templates/epilepsy12/partials/assessment/seizure_length_checkboxes.html @@ -18,7 +18,7 @@ @@ -44,7 +44,7 @@ @@ -70,7 +70,7 @@ diff --git a/templates/epilepsy12/partials/case_table.html b/templates/epilepsy12/partials/case_table.html index 9b29e5481..72640b5bb 100644 --- a/templates/epilepsy12/partials/case_table.html +++ b/templates/epilepsy12/partials/case_table.html @@ -133,21 +133,28 @@ diff --git a/templates/epilepsy12/partials/epilepsy_context/epilepsy_diagnosis_withdrawn.html b/templates/epilepsy12/partials/epilepsy_context/epilepsy_diagnosis_withdrawn.html index b00a5689a..93e0416f9 100644 --- a/templates/epilepsy12/partials/epilepsy_context/epilepsy_diagnosis_withdrawn.html +++ b/templates/epilepsy12/partials/epilepsy_context/epilepsy_diagnosis_withdrawn.html @@ -1,2 +1,2 @@ {% url 'diagnosis_of_epilepsy_withdrawn' epilepsy_context_id=epilepsy_context.pk as hx_post %} -{% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target="#diagnosis_of_epilepsy_withdrawn" hx_trigger="click" hx_swap="innerHTML" test_positive=epilepsy_context.diagnosis_of_epilepsy_withdrawn tooltip_id='diagnosis_of_epilepsy_withdrawn_tooltip' label=epilepsy_context.get_diagnosis_of_epilepsy_withdrawn_help_label_text reference=epilepsy_context.get_diagnosis_of_epilepsy_withdrawn_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_epilepsycontext %} \ No newline at end of file +{% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target="#diagnosis_of_epilepsy_withdrawn" hx_trigger="click" hx_swap="innerHTML" test_positive=epilepsy_context.diagnosis_of_epilepsy_withdrawn tooltip_id='diagnosis_of_epilepsy_withdrawn_tooltip' label=epilepsy_context.get_diagnosis_of_epilepsy_withdrawn_help_label_text reference=epilepsy_context.get_diagnosis_of_epilepsy_withdrawn_help_reference_text data_position='top left' enabled=can_edit %} \ No newline at end of file diff --git a/templates/epilepsy12/partials/epilepsy_context/experienced_prolonged_focal_seizures.html b/templates/epilepsy12/partials/epilepsy_context/experienced_prolonged_focal_seizures.html index d14e61847..5d8e05485 100644 --- a/templates/epilepsy12/partials/epilepsy_context/experienced_prolonged_focal_seizures.html +++ b/templates/epilepsy12/partials/epilepsy_context/experienced_prolonged_focal_seizures.html @@ -1,2 +1,2 @@ {% url 'experienced_prolonged_focal_seizures' epilepsy_context_id=epilepsy_context.pk as hx_post %} -{% include 'epilepsy12/partials/page_elements/single_choice_multiple_toggle_button.html' with choices=uncertain_choices hx_post=hx_post hx_target="#experienced_prolonged_focal_seizures" hx_trigger="click" hx_swap="innerHTML" test_positive=epilepsy_context.experienced_prolonged_focal_seizures tooltip_id='experienced_prolonged_focal_seizures_tooltip' label=epilepsy_context.get_experienced_prolonged_focal_seizures_help_label_text reference=epilepsy_context.get_experienced_prolonged_focal_seizures_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_epilepsycontext %} \ No newline at end of file +{% include 'epilepsy12/partials/page_elements/single_choice_multiple_toggle_button.html' with choices=uncertain_choices hx_post=hx_post hx_target="#experienced_prolonged_focal_seizures" hx_trigger="click" hx_swap="innerHTML" test_positive=epilepsy_context.experienced_prolonged_focal_seizures tooltip_id='experienced_prolonged_focal_seizures_tooltip' label=epilepsy_context.get_experienced_prolonged_focal_seizures_help_label_text reference=epilepsy_context.get_experienced_prolonged_focal_seizures_help_reference_text data_position='top left' enabled=can_edit %} \ No newline at end of file diff --git a/templates/epilepsy12/partials/epilepsy_context/experienced_prolonged_generalized_convulsive_seizures.html b/templates/epilepsy12/partials/epilepsy_context/experienced_prolonged_generalized_convulsive_seizures.html index 59e65d32e..b5eb59e7b 100644 --- a/templates/epilepsy12/partials/epilepsy_context/experienced_prolonged_generalized_convulsive_seizures.html +++ b/templates/epilepsy12/partials/epilepsy_context/experienced_prolonged_generalized_convulsive_seizures.html @@ -1,2 +1,2 @@ {% url 'experienced_prolonged_generalized_convulsive_seizures' epilepsy_context_id=epilepsy_context.pk as hx_post %} -{% include 'epilepsy12/partials/page_elements/single_choice_multiple_toggle_button.html' with choices=uncertain_choices hx_post=hx_post hx_target="#experienced_prolonged_generalized_convulsive_seizures" hx_trigger="click" hx_swap="innerHTML" test_positive=epilepsy_context.experienced_prolonged_generalized_convulsive_seizures tooltip_id='experienced_prolonged_generalized_convulsive_seizures_tooltip' label=epilepsy_context.get_experienced_prolonged_generalized_convulsive_seizures_help_label_text reference=epilepsy_context.get_experienced_prolonged_generalized_convulsive_seizures_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_epilepsycontext %} \ No newline at end of file +{% include 'epilepsy12/partials/page_elements/single_choice_multiple_toggle_button.html' with choices=uncertain_choices hx_post=hx_post hx_target="#experienced_prolonged_generalized_convulsive_seizures" hx_trigger="click" hx_swap="innerHTML" test_positive=epilepsy_context.experienced_prolonged_generalized_convulsive_seizures tooltip_id='experienced_prolonged_generalized_convulsive_seizures_tooltip' label=epilepsy_context.get_experienced_prolonged_generalized_convulsive_seizures_help_label_text reference=epilepsy_context.get_experienced_prolonged_generalized_convulsive_seizures_help_reference_text data_position='top left' enabled=can_edit %} \ No newline at end of file diff --git a/templates/epilepsy12/partials/epilepsy_context/is_there_a_family_history_of_epilepsy.html b/templates/epilepsy12/partials/epilepsy_context/is_there_a_family_history_of_epilepsy.html index f85e196ec..dd7baefab 100644 --- a/templates/epilepsy12/partials/epilepsy_context/is_there_a_family_history_of_epilepsy.html +++ b/templates/epilepsy12/partials/epilepsy_context/is_there_a_family_history_of_epilepsy.html @@ -1,2 +1,2 @@ {% url 'is_there_a_family_history_of_epilepsy' epilepsy_context_id=epilepsy_context.pk as hx_post %} -{% include 'epilepsy12/partials/page_elements/single_choice_multiple_toggle_button.html' with choices=uncertain_choices hx_post=hx_post hx_target="#is_there_a_family_history_of_epilepsy" hx_trigger="click" hx_swap="innerHTML" test_positive=epilepsy_context.is_there_a_family_history_of_epilepsy tooltip_id='is_there_a_family_history_of_epilepsy_tooltip' label=epilepsy_context.get_is_there_a_family_history_of_epilepsy_help_label_text reference=epilepsy_context.get_is_there_a_family_history_of_epilepsy_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_epilepsycontext %} \ No newline at end of file +{% include 'epilepsy12/partials/page_elements/single_choice_multiple_toggle_button.html' with choices=uncertain_choices hx_post=hx_post hx_target="#is_there_a_family_history_of_epilepsy" hx_trigger="click" hx_swap="innerHTML" test_positive=epilepsy_context.is_there_a_family_history_of_epilepsy tooltip_id='is_there_a_family_history_of_epilepsy_tooltip' label=epilepsy_context.get_is_there_a_family_history_of_epilepsy_help_label_text reference=epilepsy_context.get_is_there_a_family_history_of_epilepsy_help_reference_text data_position='top left' enabled=can_edit %} \ No newline at end of file diff --git a/templates/epilepsy12/partials/epilepsy_context/previous_acute_symptomatic_seizure.html b/templates/epilepsy12/partials/epilepsy_context/previous_acute_symptomatic_seizure.html index 87798bc02..1a420deea 100644 --- a/templates/epilepsy12/partials/epilepsy_context/previous_acute_symptomatic_seizure.html +++ b/templates/epilepsy12/partials/epilepsy_context/previous_acute_symptomatic_seizure.html @@ -1,2 +1,2 @@ {% url 'previous_acute_symptomatic_seizure' epilepsy_context_id=epilepsy_context.pk as hx_post %} -{% include 'epilepsy12/partials/page_elements/single_choice_multiple_toggle_button.html' with choices=uncertain_choices hx_post=hx_post hx_target="#previous_acute_symptomatic_seizure" hx_trigger="click" hx_swap="innerHTML" test_positive=epilepsy_context.previous_acute_symptomatic_seizure tooltip_id='previous_acute_symptomatic_seizure_tooltip' label=epilepsy_context.get_previous_acute_symptomatic_seizure_help_label_text reference=epilepsy_context.get_previous_acute_symptomatic_seizure_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_epilepsycontext %} \ No newline at end of file +{% include 'epilepsy12/partials/page_elements/single_choice_multiple_toggle_button.html' with choices=uncertain_choices hx_post=hx_post hx_target="#previous_acute_symptomatic_seizure" hx_trigger="click" hx_swap="innerHTML" test_positive=epilepsy_context.previous_acute_symptomatic_seizure tooltip_id='previous_acute_symptomatic_seizure_tooltip' label=epilepsy_context.get_previous_acute_symptomatic_seizure_help_label_text reference=epilepsy_context.get_previous_acute_symptomatic_seizure_help_reference_text data_position='top left' enabled=can_edit %} \ No newline at end of file diff --git a/templates/epilepsy12/partials/epilepsy_context/previous_febrile_seizure.html b/templates/epilepsy12/partials/epilepsy_context/previous_febrile_seizure.html index 4312483ae..989bd9d60 100644 --- a/templates/epilepsy12/partials/epilepsy_context/previous_febrile_seizure.html +++ b/templates/epilepsy12/partials/epilepsy_context/previous_febrile_seizure.html @@ -1,2 +1,2 @@ {% url 'previous_febrile_seizure' epilepsy_context_id=epilepsy_context.pk as hx_post %} -{% include 'epilepsy12/partials/page_elements/single_choice_multiple_toggle_button.html' with choices=uncertain_choices hx_post=hx_post hx_target="#previous_febrile_seizure" hx_trigger="click" hx_swap="innerHTML" test_positive=epilepsy_context.previous_febrile_seizure tooltip_id='previous_febrile_seizure_tooltip' label=epilepsy_context.get_previous_febrile_seizure_help_label_text reference=epilepsy_context.get_previous_febrile_seizure_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_epilepsycontext %} \ No newline at end of file +{% include 'epilepsy12/partials/page_elements/single_choice_multiple_toggle_button.html' with choices=uncertain_choices hx_post=hx_post hx_target="#previous_febrile_seizure" hx_trigger="click" hx_swap="innerHTML" test_positive=epilepsy_context.previous_febrile_seizure tooltip_id='previous_febrile_seizure_tooltip' label=epilepsy_context.get_previous_febrile_seizure_help_label_text reference=epilepsy_context.get_previous_febrile_seizure_help_reference_text data_position='top left' enabled=can_edit %} \ No newline at end of file diff --git a/templates/epilepsy12/partials/epilepsy_context/previous_neonatal_seizures.html b/templates/epilepsy12/partials/epilepsy_context/previous_neonatal_seizures.html index a5b6d7576..01ba73315 100644 --- a/templates/epilepsy12/partials/epilepsy_context/previous_neonatal_seizures.html +++ b/templates/epilepsy12/partials/epilepsy_context/previous_neonatal_seizures.html @@ -1,2 +1,2 @@ {% url 'previous_neonatal_seizures' epilepsy_context_id=epilepsy_context.pk as hx_post %} -{% include 'epilepsy12/partials/page_elements/single_choice_multiple_toggle_button.html' with choices=uncertain_choices hx_post=hx_post hx_target="#previous_neonatal_seizures" hx_trigger="click" hx_swap="innerHTML" test_positive=epilepsy_context.previous_neonatal_seizures tooltip_id='previous_neonatal_seizures_tooltip' label=epilepsy_context.get_previous_neonatal_seizures_help_label_text reference=epilepsy_context.get_previous_neonatal_seizures_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_epilepsycontext %} \ No newline at end of file +{% include 'epilepsy12/partials/page_elements/single_choice_multiple_toggle_button.html' with choices=uncertain_choices hx_post=hx_post hx_target="#previous_neonatal_seizures" hx_trigger="click" hx_swap="innerHTML" test_positive=epilepsy_context.previous_neonatal_seizures tooltip_id='previous_neonatal_seizures_tooltip' label=epilepsy_context.get_previous_neonatal_seizures_help_label_text reference=epilepsy_context.get_previous_neonatal_seizures_help_reference_text data_position='top left' enabled=can_edit %} \ No newline at end of file diff --git a/templates/epilepsy12/partials/epilepsy_context/were_any_of_the_epileptic_seizures_convulsive.html b/templates/epilepsy12/partials/epilepsy_context/were_any_of_the_epileptic_seizures_convulsive.html index df7067f9c..b07e2b47e 100644 --- a/templates/epilepsy12/partials/epilepsy_context/were_any_of_the_epileptic_seizures_convulsive.html +++ b/templates/epilepsy12/partials/epilepsy_context/were_any_of_the_epileptic_seizures_convulsive.html @@ -1,2 +1,2 @@ {% url 'were_any_of_the_epileptic_seizures_convulsive' epilepsy_context_id=epilepsy_context.pk as hx_post %} -{% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target="#were_any_of_the_epileptic_seizures_convulsive" hx_trigger="click" hx_swap="innerHTML" test_positive=epilepsy_context.were_any_of_the_epileptic_seizures_convulsive tooltip_id='were_any_of_the_epileptic_seizures_convulsive_tooltip' label=epilepsy_context.get_were_any_of_the_epileptic_seizures_convulsive_help_label_text reference=epilepsy_context.get_were_any_of_the_epileptic_seizures_convulsive_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_epilepsycontext %} \ No newline at end of file +{% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target="#were_any_of_the_epileptic_seizures_convulsive" hx_trigger="click" hx_swap="innerHTML" test_positive=epilepsy_context.were_any_of_the_epileptic_seizures_convulsive tooltip_id='were_any_of_the_epileptic_seizures_convulsive_tooltip' label=epilepsy_context.get_were_any_of_the_epileptic_seizures_convulsive_help_label_text reference=epilepsy_context.get_were_any_of_the_epileptic_seizures_convulsive_help_reference_text data_position="top left" enabled=can_edit %} \ No newline at end of file diff --git a/templates/epilepsy12/partials/first_paediatric_assessment/first_paediatric_assessment_in_acute_or_nonacute_setting.html b/templates/epilepsy12/partials/first_paediatric_assessment/first_paediatric_assessment_in_acute_or_nonacute_setting.html index aead0291c..5ea0e584f 100644 --- a/templates/epilepsy12/partials/first_paediatric_assessment/first_paediatric_assessment_in_acute_or_nonacute_setting.html +++ b/templates/epilepsy12/partials/first_paediatric_assessment/first_paediatric_assessment_in_acute_or_nonacute_setting.html @@ -1,4 +1,4 @@
    {% url 'first_paediatric_assessment_in_acute_or_nonacute_setting' first_paediatric_assessment_id=first_paediatric_assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/single_choice_multiple_toggle_button.html' with hx_post=hx_post hx_target='#first_paediatric_assessment_in_acute_or_nonacute_setting' hx_trigger="click" tooltip_id='first_paediatric_assessment_in_acute_or_nonacute_setting_tooltip' label=first_paediatric_assessment.get_first_paediatric_assessment_in_acute_or_nonacute_setting_help_label_text reference=first_paediatric_assessment.get_first_paediatric_assessment_in_acute_or_nonacute_setting_help_reference_text test_positive=first_paediatric_assessment.first_paediatric_assessment_in_acute_or_nonacute_setting data_position="top left" choices=chronicity_selection enabled=perms.epilepsy12.change_firstpaediatricassessment %} + {% include 'epilepsy12/partials/page_elements/single_choice_multiple_toggle_button.html' with hx_post=hx_post hx_target='#first_paediatric_assessment_in_acute_or_nonacute_setting' hx_trigger="click" tooltip_id='first_paediatric_assessment_in_acute_or_nonacute_setting_tooltip' label=first_paediatric_assessment.get_first_paediatric_assessment_in_acute_or_nonacute_setting_help_label_text reference=first_paediatric_assessment.get_first_paediatric_assessment_in_acute_or_nonacute_setting_help_reference_text test_positive=first_paediatric_assessment.first_paediatric_assessment_in_acute_or_nonacute_setting data_position="top left" choices=chronicity_selection enabled=can_edit %}
    \ No newline at end of file diff --git a/templates/epilepsy12/partials/first_paediatric_assessment/when_the_first_epileptic_episode_occurred.html b/templates/epilepsy12/partials/first_paediatric_assessment/when_the_first_epileptic_episode_occurred.html index 038ce899a..bfdcb698d 100644 --- a/templates/epilepsy12/partials/first_paediatric_assessment/when_the_first_epileptic_episode_occurred.html +++ b/templates/epilepsy12/partials/first_paediatric_assessment/when_the_first_epileptic_episode_occurred.html @@ -19,20 +19,20 @@
    {% url 'general_examination_performed' first_paediatric_assessment_id=first_paediatric_assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target='#when_the_first_epileptic_episode_occurred' hx_trigger='click' hx_swap='innerHTML' test_positive=first_paediatric_assessment.general_examination_performed tooltip_id='general_examination_performed' label=first_paediatric_assessment.get_general_examination_performed_help_label_text reference=first_paediatric_assessment.get_general_examination_performed_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_firstpaediatricassessment %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target='#when_the_first_epileptic_episode_occurred' hx_trigger='click' hx_swap='innerHTML' test_positive=first_paediatric_assessment.general_examination_performed tooltip_id='general_examination_performed' label=first_paediatric_assessment.get_general_examination_performed_help_label_text reference=first_paediatric_assessment.get_general_examination_performed_help_reference_text data_position='top left' enabled=can_edit %} {% url 'developmental_learning_or_schooling_problems' first_paediatric_assessment_id=first_paediatric_assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target='#when_the_first_epileptic_episode_occurred' hx_trigger='click' hx_swap='innerHTML' test_positive=first_paediatric_assessment.developmental_learning_or_schooling_problems tooltip_id='developmental_learning_or_schooling_problems' label=first_paediatric_assessment.get_developmental_learning_or_schooling_problems_help_label_text reference=first_paediatric_assessment.get_developmental_learning_or_schooling_problems_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_firstpaediatricassessment %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target='#when_the_first_epileptic_episode_occurred' hx_trigger='click' hx_swap='innerHTML' test_positive=first_paediatric_assessment.developmental_learning_or_schooling_problems tooltip_id='developmental_learning_or_schooling_problems' label=first_paediatric_assessment.get_developmental_learning_or_schooling_problems_help_label_text reference=first_paediatric_assessment.get_developmental_learning_or_schooling_problems_help_reference_text data_position='top left' enabled=can_edit %} {% url 'behavioural_or_emotional_problems' first_paediatric_assessment_id=first_paediatric_assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target='#when_the_first_epileptic_episode_occurred' hx_trigger='click' hx_swap='innerHTML' test_positive=first_paediatric_assessment.behavioural_or_emotional_problems tooltip_id='behavioural_or_emotional_problems' label=first_paediatric_assessment.get_behavioural_or_emotional_problems_help_label_text reference=first_paediatric_assessment.get_behavioural_or_emotional_problems_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_firstpaediatricassessment %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target='#when_the_first_epileptic_episode_occurred' hx_trigger='click' hx_swap='innerHTML' test_positive=first_paediatric_assessment.behavioural_or_emotional_problems tooltip_id='behavioural_or_emotional_problems' label=first_paediatric_assessment.get_behavioural_or_emotional_problems_help_label_text reference=first_paediatric_assessment.get_behavioural_or_emotional_problems_help_reference_text data_position='top left' enabled=can_edit %} {% url 'has_number_of_episodes_since_the_first_been_documented' first_paediatric_assessment_id=first_paediatric_assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target='#when_the_first_epileptic_episode_occurred' hx_trigger='click' hx_swap='innerHTML' test_positive=first_paediatric_assessment.has_number_of_episodes_since_the_first_been_documented tooltip_id='has_number_of_episodes_since_the_first_been_documented' label=first_paediatric_assessment.get_has_number_of_episodes_since_the_first_been_documented_help_label_text reference=first_paediatric_assessment.get_has_number_of_episodes_since_the_first_been_documented_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_firstpaediatricassessment %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target='#when_the_first_epileptic_episode_occurred' hx_trigger='click' hx_swap='innerHTML' test_positive=first_paediatric_assessment.has_number_of_episodes_since_the_first_been_documented tooltip_id='has_number_of_episodes_since_the_first_been_documented' label=first_paediatric_assessment.get_has_number_of_episodes_since_the_first_been_documented_help_label_text reference=first_paediatric_assessment.get_has_number_of_episodes_since_the_first_been_documented_help_reference_text data_position='top left' enabled=can_edit %}
    {% url 'neurological_examination_performed' first_paediatric_assessment_id=first_paediatric_assessment.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target='#when_the_first_epileptic_episode_occurred' hx_trigger='click' hx_swap='innerHTML' test_positive=first_paediatric_assessment.neurological_examination_performed tooltip_id='neurological_examination_performed' label=first_paediatric_assessment.get_neurological_examination_performed_help_label_text reference=first_paediatric_assessment.get_neurological_examination_performed_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_firstpaediatricassessment %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target='#when_the_first_epileptic_episode_occurred' hx_trigger='click' hx_swap='innerHTML' test_positive=first_paediatric_assessment.neurological_examination_performed tooltip_id='neurological_examination_performed' label=first_paediatric_assessment.get_neurological_examination_performed_help_label_text reference=first_paediatric_assessment.get_neurological_examination_performed_help_reference_text data_position='top left' enabled=can_edit %}
    diff --git a/templates/epilepsy12/partials/investigations/ct_head_status.html b/templates/epilepsy12/partials/investigations/ct_head_status.html index f7b43d510..0a8e75fdd 100644 --- a/templates/epilepsy12/partials/investigations/ct_head_status.html +++ b/templates/epilepsy12/partials/investigations/ct_head_status.html @@ -6,7 +6,7 @@
    {% url 'ct_head_scan_status' investigations_id=investigations.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target="#ct_head_information" hx_trigger="click" hx_swap="innerHTML" test_positive=investigations.ct_head_scan_status tooltip_id='ct_head_scan_status_tooltip' label=investigations.get_ct_head_scan_status_help_label_text reference=investigations.get_ct_head_scan_status_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_investigations %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target="#ct_head_information" hx_trigger="click" hx_swap="innerHTML" test_positive=investigations.ct_head_scan_status tooltip_id='ct_head_scan_status_tooltip' label=investigations.get_ct_head_scan_status_help_label_text reference=investigations.get_ct_head_scan_status_help_reference_text data_position="top left" enabled=can_edit %}
    diff --git a/templates/epilepsy12/partials/investigations/ecg_status.html b/templates/epilepsy12/partials/investigations/ecg_status.html index 0103e82f5..f19266451 100644 --- a/templates/epilepsy12/partials/investigations/ecg_status.html +++ b/templates/epilepsy12/partials/investigations/ecg_status.html @@ -6,7 +6,7 @@
    {% url 'twelve_lead_ecg_status' investigations_id=investigations.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target="#ecg_information" hx_trigger="click" hx_swap="innerHTML" test_positive=investigations.twelve_lead_ecg_status tooltip_id='ecg_information_tooltip' label=investigations.get_twelve_lead_ecg_status_help_label_text reference=investigations.get_twelve_lead_ecg_status_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_investigations %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target="#ecg_information" hx_trigger="click" hx_swap="innerHTML" test_positive=investigations.twelve_lead_ecg_status tooltip_id='ecg_information_tooltip' label=investigations.get_twelve_lead_ecg_status_help_label_text reference=investigations.get_twelve_lead_ecg_status_help_reference_text data_position="top left" enabled=can_edit %}
    diff --git a/templates/epilepsy12/partials/investigations/eeg_information.html b/templates/epilepsy12/partials/investigations/eeg_information.html index 50c662954..134d57f60 100644 --- a/templates/epilepsy12/partials/investigations/eeg_information.html +++ b/templates/epilepsy12/partials/investigations/eeg_information.html @@ -6,7 +6,7 @@
    {% url 'eeg_indicated' investigations_id=investigations.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target="#eeg_information" hx_trigger="click" hx_swap="innerHTML" test_positive=investigations.eeg_indicated tooltip_id='eeg_indicated_tooltip' label=investigations.get_eeg_indicated_help_label_text reference=investigations.get_eeg_indicated_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_investigations %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target="#eeg_information" hx_trigger="click" hx_swap="innerHTML" test_positive=investigations.eeg_indicated tooltip_id='eeg_indicated_tooltip' label=investigations.get_eeg_indicated_help_label_text reference=investigations.get_eeg_indicated_help_reference_text data_position="top left" enabled=can_edit %}
    @@ -15,7 +15,7 @@
    {% url 'eeg_request_date' investigations_id=investigations.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_target="#eeg_information" hx_trigger="change delay:1s" hx_swap="innerHTML" date_value=investigations.eeg_request_date label=investigations.get_eeg_request_date_help_label_text reference=investigations.get_eeg_request_date_help_reference_text data_position="top left" input_date_field_name='eeg_request_date' enabled=perms.epilepsy12.change_investigations has_permission=perms.epilepsy12.change_investigations %} + {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_target="#eeg_information" hx_trigger="change delay:1s" hx_swap="innerHTML" date_value=investigations.eeg_request_date label=investigations.get_eeg_request_date_help_label_text reference=investigations.get_eeg_request_date_help_reference_text data_position="top left" input_date_field_name='eeg_request_date' enabled=can_edit has_permission=can_edit %} {% if eeg_declined %}
    @@ -48,7 +48,7 @@ {% else %} {% url 'eeg_performed_date' investigations_id=investigations.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_target="#eeg_information" hx_trigger="change delay:1s" hx_swap="innerHTML" date_value=investigations.eeg_performed_date label=investigations.get_eeg_performed_date_help_label_text reference=investigations.get_eeg_performed_date_help_reference_text data_position="top left" input_date_field_name='eeg_performed_date' enabled=perms.epilepsy12.change_investigations has_permission=perms.epilepsy12.change_investigations %} + {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_target="#eeg_information" hx_trigger="change delay:1s" hx_swap="innerHTML" date_value=investigations.eeg_performed_date label=investigations.get_eeg_performed_date_help_label_text reference=investigations.get_eeg_performed_date_help_reference_text data_position="top left" input_date_field_name='eeg_performed_date' enabled=can_edit has_permission=can_edit %} {% if investigations.eeg_request_date and investigations.eeg_performed_date %}
    diff --git a/templates/epilepsy12/partials/investigations/mri_brain_information.html b/templates/epilepsy12/partials/investigations/mri_brain_information.html index fea12d25b..51a87c4c0 100644 --- a/templates/epilepsy12/partials/investigations/mri_brain_information.html +++ b/templates/epilepsy12/partials/investigations/mri_brain_information.html @@ -6,7 +6,7 @@
    {% url 'mri_indicated' investigations_id=investigations.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target="#mri_brain_information" hx_trigger="click" hx_swap="innerHTML" test_positive=investigations.mri_indicated tooltip_id='mri_indicated_tooltip' label=investigations.get_mri_indicated_help_label_text reference=investigations.get_mri_indicated_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_investigations %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target="#mri_brain_information" hx_trigger="click" hx_swap="innerHTML" test_positive=investigations.mri_indicated tooltip_id='mri_indicated_tooltip' label=investigations.get_mri_indicated_help_label_text reference=investigations.get_mri_indicated_help_reference_text data_position="top left" enabled=can_edit %}
    @@ -15,7 +15,7 @@
    {% url 'mri_brain_requested_date' investigations_id=investigations.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_target="#mri_brain_information" hx_trigger="change delay:1s" hx_swap="innerHTML" date_value=investigations.mri_brain_requested_date label=investigations.get_mri_brain_requested_date_help_label_text reference=investigations.get_mri_brain_requested_date_help_reference_text data_position="top left" input_date_field_name='mri_brain_requested_date' error_messages=error_messages enabled=perms.epilepsy12.change_investigations has_permission=perms.epilepsy12.change_investigations %} + {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_target="#mri_brain_information" hx_trigger="change delay:1s" hx_swap="innerHTML" date_value=investigations.mri_brain_requested_date label=investigations.get_mri_brain_requested_date_help_label_text reference=investigations.get_mri_brain_requested_date_help_reference_text data_position="top left" input_date_field_name='mri_brain_requested_date' error_messages=error_messages enabled=can_edit has_permission=can_edit %} {% if mri_brain_declined %}
    @@ -48,7 +48,7 @@ {% else %} {% url 'mri_brain_reported_date' investigations_id=investigations.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_target="#mri_brain_information" hx_trigger="change delay:1s" hx_swap="innerHTML" date_value=investigations.mri_brain_reported_date label=investigations.get_mri_brain_reported_date_help_label_text reference=investigations.get_mri_brain_reported_date_help_reference_text data_position="top left" input_date_field_name='mri_brain_reported_date' error_messages=error_messages enabled=perms.epilepsy12.change_investigations has_permission=perms.epilepsy12.change_investigations %} + {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_target="#mri_brain_information" hx_trigger="change delay:1s" hx_swap="innerHTML" date_value=investigations.mri_brain_reported_date label=investigations.get_mri_brain_reported_date_help_label_text reference=investigations.get_mri_brain_reported_date_help_reference_text data_position="top left" input_date_field_name='mri_brain_reported_date' error_messages=error_messages enabled=can_edit has_permission=can_edit %} {% if investigations.mri_brain_requested_date and investigations.mri_brain_reported_date %}
    diff --git a/templates/epilepsy12/partials/management/antiepilepsy_medicines/antiepilepsy_medicine.html b/templates/epilepsy12/partials/management/antiepilepsy_medicines/antiepilepsy_medicine.html index 7d2212fcf..b5b255ae3 100644 --- a/templates/epilepsy12/partials/management/antiepilepsy_medicines/antiepilepsy_medicine.html +++ b/templates/epilepsy12/partials/management/antiepilepsy_medicines/antiepilepsy_medicine.html @@ -16,9 +16,9 @@
    {% url 'antiepilepsy_medicine_start_date' antiepilepsy_medicine_id=antiepilepsy_medicine.pk as hx_post %} {% if is_rescue_medicine %} - {% include 'epilepsy12/partials/page_elements/date_field.html' with choices=choices hx_post=hx_post hx_target='#rescue_medicine_list' hx_trigger='change delay:1s' hx_swap='innerHTML' input_date_field_name='antiepilepsy_medicine_start_date' date_value=antiepilepsy_medicine.antiepilepsy_medicine_start_date label=antiepilepsy_medicine.get_antiepilepsy_medicine_start_date_help_label_text reference=antiepilepsy_medicine.get_antiepilepsy_medicine_start_date_help_reference_text hx_default_text='enter date' data_position='top left' error_message=error_message enabled=perms.epilepsy12.change_antiepilepsymedicine has_permission=perms.epilepsy12.change_antiepilepsymedicine tooltip_id="is_rescue_medicine" %} + {% include 'epilepsy12/partials/page_elements/date_field.html' with choices=choices hx_post=hx_post hx_target='#rescue_medicine_list' hx_trigger='change delay:1s' hx_swap='innerHTML' input_date_field_name='antiepilepsy_medicine_start_date' date_value=antiepilepsy_medicine.antiepilepsy_medicine_start_date label=antiepilepsy_medicine.get_antiepilepsy_medicine_start_date_help_label_text reference=antiepilepsy_medicine.get_antiepilepsy_medicine_start_date_help_reference_text hx_default_text='enter date' data_position='top left' error_message=error_message enabled=can_edit has_permission=can_edit tooltip_id="is_rescue_medicine" %} {% else %} - {% include 'epilepsy12/partials/page_elements/date_field.html' with choices=choices hx_post=hx_post hx_target='#antiepilepsy_medicine_list' hx_trigger='change delay:1s' hx_swap='innerHTML' input_date_field_name='antiepilepsy_medicine_start_date' date_value=antiepilepsy_medicine.antiepilepsy_medicine_start_date label=antiepilepsy_medicine.get_antiepilepsy_medicine_start_date_help_label_text reference=antiepilepsy_medicine.get_antiepilepsy_medicine_start_date_help_reference_text hx_default_text='enter date' data_position='top left' error_message=error_message enabled=perms.epilepsy12.change_antiepilepsymedicine has_permission=perms.epilepsy12.change_antiepilepsymedicine tooltip_id="is_antiepilepsy_medicine" %} + {% include 'epilepsy12/partials/page_elements/date_field.html' with choices=choices hx_post=hx_post hx_target='#antiepilepsy_medicine_list' hx_trigger='change delay:1s' hx_swap='innerHTML' input_date_field_name='antiepilepsy_medicine_start_date' date_value=antiepilepsy_medicine.antiepilepsy_medicine_start_date label=antiepilepsy_medicine.get_antiepilepsy_medicine_start_date_help_label_text reference=antiepilepsy_medicine.get_antiepilepsy_medicine_start_date_help_reference_text hx_default_text='enter date' data_position='top left' error_message=error_message enabled=can_edit has_permission=can_edit tooltip_id="is_antiepilepsy_medicine" %} {% endif %}
    @@ -26,9 +26,9 @@
    {% url 'antiepilepsy_medicine_stop_date' antiepilepsy_medicine_id=antiepilepsy_medicine.pk as hx_post %} {% if is_rescue_medicine %} - {% include 'epilepsy12/partials/page_elements/date_field.html' with choices=choices hx_post=hx_post hx_target='#rescue_medicine_list' hx_trigger='change delay:1s' hx_swap='innerHTML' input_date_field_name='antiepilepsy_medicine_stop_date' date_value=antiepilepsy_medicine.antiepilepsy_medicine_stop_date label=antiepilepsy_medicine.get_antiepilepsy_medicine_stop_date_help_label_text reference=antiepilepsy_medicine.get_antiepilepsy_medicine_stop_date_help_reference_text hx_default_text='enter date' data_position='top left' error_message=error_message enabled=perms.epilepsy12.change_antiepilepsymedicine has_permission=perms.epilepsy12.change_antiepilepsymedicine tooltip_id="is_rescue_medicine" %} + {% include 'epilepsy12/partials/page_elements/date_field.html' with choices=choices hx_post=hx_post hx_target='#rescue_medicine_list' hx_trigger='change delay:1s' hx_swap='innerHTML' input_date_field_name='antiepilepsy_medicine_stop_date' date_value=antiepilepsy_medicine.antiepilepsy_medicine_stop_date label=antiepilepsy_medicine.get_antiepilepsy_medicine_stop_date_help_label_text reference=antiepilepsy_medicine.get_antiepilepsy_medicine_stop_date_help_reference_text hx_default_text='enter date' data_position='top left' error_message=error_message enabled=can_edit has_permission=can_edit tooltip_id="is_rescue_medicine" %} {% else %} - {% include 'epilepsy12/partials/page_elements/date_field.html' with choices=choices hx_post=hx_post hx_target='#antiepilepsy_medicine_list' hx_trigger='change delay:1s' hx_swap='innerHTML' input_date_field_name='antiepilepsy_medicine_stop_date' date_value=antiepilepsy_medicine.antiepilepsy_medicine_stop_date label=antiepilepsy_medicine.get_antiepilepsy_medicine_stop_date_help_label_text reference=antiepilepsy_medicine.get_antiepilepsy_medicine_stop_date_help_reference_text hx_default_text='enter date' data_position='top left' error_message=error_message enabled=perms.epilepsy12.change_antiepilepsymedicine has_permission=perms.epilepsy12.change_antiepilepsymedicine tooltip_id="is_antiepilepsy_medicine" %} + {% include 'epilepsy12/partials/page_elements/date_field.html' with choices=choices hx_post=hx_post hx_target='#antiepilepsy_medicine_list' hx_trigger='change delay:1s' hx_swap='innerHTML' input_date_field_name='antiepilepsy_medicine_stop_date' date_value=antiepilepsy_medicine.antiepilepsy_medicine_stop_date label=antiepilepsy_medicine.get_antiepilepsy_medicine_stop_date_help_label_text reference=antiepilepsy_medicine.get_antiepilepsy_medicine_stop_date_help_reference_text hx_default_text='enter date' data_position='top left' error_message=error_message enabled=can_edit has_permission=can_edit tooltip_id="is_antiepilepsy_medicine" %} {% endif %}
    {% endif %} @@ -103,19 +103,19 @@
    {% if is_rescue_medicine %} {% url 'medicine_id' antiepilepsy_medicine_id=antiepilepsy_medicine.pk medicine_status='rescue' as hx_post %} - {% include 'epilepsy12/partials/page_elements/select_model.html' with choices=choices hx_post=hx_post hx_target='#rescue_medicine_list' hx_trigger='change' hx_swap='innerHTML' hx_name='rescue_medicine_id' field_name='medicine_name' field_name2='preferredTerm' test_positive=antiepilepsy_medicine.medicine_entity.pk label=antiepilepsy_medicine.get_medicine_entity_help_label_text reference=antiepilepsy_medicine.get_medicine_entity_help_reference_text hx_default_text='Antiseizure medicine' data_position='top left' enabled=perms.epilepsy12.change_antiepilepsymedicine %} + {% include 'epilepsy12/partials/page_elements/select_model.html' with choices=choices hx_post=hx_post hx_target='#rescue_medicine_list' hx_trigger='change' hx_swap='innerHTML' hx_name='rescue_medicine_id' field_name='medicine_name' field_name2='preferredTerm' test_positive=antiepilepsy_medicine.medicine_entity.pk label=antiepilepsy_medicine.get_medicine_entity_help_label_text reference=antiepilepsy_medicine.get_medicine_entity_help_reference_text hx_default_text='Antiseizure medicine' data_position='top left' enabled=can_edit %} {% else %} {% url 'medicine_id' antiepilepsy_medicine_id=antiepilepsy_medicine.pk medicine_status='epilepsy' as hx_post %} - {% include 'epilepsy12/partials/page_elements/select_model.html' with choices=choices hx_post=hx_post hx_target='#antiepilepsy_medicine_list' hx_trigger='change' hx_swap='innerHTML' hx_name='epilepsy_medicine_id' field_name='medicine_name' field_name2='preferredTerm' test_positive=antiepilepsy_medicine.medicine_entity.pk label=antiepilepsy_medicine.get_medicine_entity_help_label_text reference=antiepilepsy_medicine.get_medicine_entity_help_reference_text hx_default_text='Antiseizure medicine' data_position='top left' enabled=perms.epilepsy12.change_antiepilepsymedicine %} + {% include 'epilepsy12/partials/page_elements/select_model.html' with choices=choices hx_post=hx_post hx_target='#antiepilepsy_medicine_list' hx_trigger='change' hx_swap='innerHTML' hx_name='epilepsy_medicine_id' field_name='medicine_name' field_name2='preferredTerm' test_positive=antiepilepsy_medicine.medicine_entity.pk label=antiepilepsy_medicine.get_medicine_entity_help_label_text reference=antiepilepsy_medicine.get_medicine_entity_help_reference_text hx_default_text='Antiseizure medicine' data_position='top left' enabled=can_edit %} {% endif %}
    {% url 'antiepilepsy_medicine_risk_discussed' antiepilepsy_medicine_id=antiepilepsy_medicine.pk as hx_post %} {% if is_rescue_medicine %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with choices=choices hx_post=hx_post hx_target='#rescue_medicine_list' hx_trigger='click' hx_swap='innerHTML' hx_name='antiepilepsy_medicine_risk_discussed' test_positive=antiepilepsy_medicine.antiepilepsy_medicine_risk_discussed tooltip_id='antiepilepsy_medicine_risk_discussed_tooltip' label=antiepilepsy_medicine.get_antiepilepsy_medicine_risk_discussed_help_label_text reference=antiepilepsy_medicine.get_antiepilepsy_medicine_risk_discussed_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_antiepilepsymedicine %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with choices=choices hx_post=hx_post hx_target='#rescue_medicine_list' hx_trigger='click' hx_swap='innerHTML' hx_name='antiepilepsy_medicine_risk_discussed' test_positive=antiepilepsy_medicine.antiepilepsy_medicine_risk_discussed tooltip_id='antiepilepsy_medicine_risk_discussed_tooltip' label=antiepilepsy_medicine.get_antiepilepsy_medicine_risk_discussed_help_label_text reference=antiepilepsy_medicine.get_antiepilepsy_medicine_risk_discussed_help_reference_text data_position='top left' enabled=can_edit %} {% else %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with choices=choices hx_post=hx_post hx_target='#antiepilepsy_medicine_list' hx_trigger='click' hx_swap='innerHTML' hx_name='antiepilepsy_medicine_risk_discussed' test_positive=antiepilepsy_medicine.antiepilepsy_medicine_risk_discussed tooltip_id='antiepilepsy_medicine_risk_discussed_tooltip' label=antiepilepsy_medicine.get_antiepilepsy_medicine_risk_discussed_help_label_text reference=antiepilepsy_medicine.get_antiepilepsy_medicine_risk_discussed_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_antiepilepsymedicine %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with choices=choices hx_post=hx_post hx_target='#antiepilepsy_medicine_list' hx_trigger='click' hx_swap='innerHTML' hx_name='antiepilepsy_medicine_risk_discussed' test_positive=antiepilepsy_medicine.antiepilepsy_medicine_risk_discussed tooltip_id='antiepilepsy_medicine_risk_discussed_tooltip' label=antiepilepsy_medicine.get_antiepilepsy_medicine_risk_discussed_help_label_text reference=antiepilepsy_medicine.get_antiepilepsy_medicine_risk_discussed_help_reference_text data_position='top left' enabled=can_edit %} {% endif %}
    @@ -128,20 +128,20 @@
    {% url 'has_a_valproate_annual_risk_acknowledgement_form_been_completed' antiepilepsy_medicine_id=antiepilepsy_medicine.pk as hx_post_acknowledge %} {% if is_rescue_medicine %}
    - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with choices=choices hx_post=hx_post_acknowledge hx_target='#rescue_medicine_list' hx_trigger='click' hx_swap='innerHTML' hx_name='has_a_valproate_annual_risk_acknowledgement_form_been_completed' test_positive=antiepilepsy_medicine.has_a_valproate_annual_risk_acknowledgement_form_been_completed tooltip_id='has_a_valproate_annual_risk_acknowledgement_form_been_completed_tooltip' label=antiepilepsy_medicine.get_has_a_valproate_annual_risk_acknowledgement_form_been_completed_help_label_text reference=antiepilepsy_medicine.get_has_a_valproate_annual_risk_acknowledgement_form_been_completed_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_antiepilepsymedicine %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with choices=choices hx_post=hx_post_acknowledge hx_target='#rescue_medicine_list' hx_trigger='click' hx_swap='innerHTML' hx_name='has_a_valproate_annual_risk_acknowledgement_form_been_completed' test_positive=antiepilepsy_medicine.has_a_valproate_annual_risk_acknowledgement_form_been_completed tooltip_id='has_a_valproate_annual_risk_acknowledgement_form_been_completed_tooltip' label=antiepilepsy_medicine.get_has_a_valproate_annual_risk_acknowledgement_form_been_completed_help_label_text reference=antiepilepsy_medicine.get_has_a_valproate_annual_risk_acknowledgement_form_been_completed_help_reference_text data_position='top left' enabled=can_edit %}
    {% if antiepilepsy_medicine.management.registration.case.sex == 2 %}
    - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with choices=choices hx_post=hx_post_ppp hx_target='#rescue_medicine_list' hx_trigger='click' hx_swap='innerHTML' hx_name='is_a_pregnancy_prevention_programme_in_place' test_positive=antiepilepsy_medicine.is_a_pregnancy_prevention_programme_in_place tooltip_id='is_a_pregnancy_prevention_programme_in_place_tooltip' label=antiepilepsy_medicine.get_is_a_pregnancy_prevention_programme_in_place_help_label_text reference=antiepilepsy_medicine.get_is_a_pregnancy_prevention_programme_in_place_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_antiepilepsymedicine %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with choices=choices hx_post=hx_post_ppp hx_target='#rescue_medicine_list' hx_trigger='click' hx_swap='innerHTML' hx_name='is_a_pregnancy_prevention_programme_in_place' test_positive=antiepilepsy_medicine.is_a_pregnancy_prevention_programme_in_place tooltip_id='is_a_pregnancy_prevention_programme_in_place_tooltip' label=antiepilepsy_medicine.get_is_a_pregnancy_prevention_programme_in_place_help_label_text reference=antiepilepsy_medicine.get_is_a_pregnancy_prevention_programme_in_place_help_reference_text data_position='top left' enabled=can_edit %}
    {% endif %} {% else %}
    - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with choices=choices hx_post=hx_post_acknowledge hx_target='#antiepilepsy_medicine_list' hx_trigger='click' hx_swap='innerHTML' hx_name='has_a_valproate_annual_risk_acknowledgement_form_been_completed' test_positive=antiepilepsy_medicine.has_a_valproate_annual_risk_acknowledgement_form_been_completed tooltip_id='has_a_valproate_annual_risk_acknowledgement_form_been_completed_tooltip' label=antiepilepsy_medicine.get_has_a_valproate_annual_risk_acknowledgement_form_been_completed_help_label_text reference=antiepilepsy_medicine.get_has_a_valproate_annual_risk_acknowledgement_form_been_completed_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_antiepilepsymedicine %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with choices=choices hx_post=hx_post_acknowledge hx_target='#antiepilepsy_medicine_list' hx_trigger='click' hx_swap='innerHTML' hx_name='has_a_valproate_annual_risk_acknowledgement_form_been_completed' test_positive=antiepilepsy_medicine.has_a_valproate_annual_risk_acknowledgement_form_been_completed tooltip_id='has_a_valproate_annual_risk_acknowledgement_form_been_completed_tooltip' label=antiepilepsy_medicine.get_has_a_valproate_annual_risk_acknowledgement_form_been_completed_help_label_text reference=antiepilepsy_medicine.get_has_a_valproate_annual_risk_acknowledgement_form_been_completed_help_reference_text data_position='top left' enabled=can_edit %}
    {% if antiepilepsy_medicine|show_topiramate_valproate_fields:True %}
    - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with choices=choices hx_post=hx_post_ppp hx_target='#antiepilepsy_medicine_list' hx_trigger='click' hx_swap='innerHTML' hx_name='is_a_pregnancy_prevention_programme_in_place' test_positive=antiepilepsy_medicine.is_a_pregnancy_prevention_programme_in_place tooltip_id='is_a_pregnancy_prevention_programme_in_place_tooltip' label=antiepilepsy_medicine.get_is_a_pregnancy_prevention_programme_in_place_help_label_text reference=antiepilepsy_medicine.get_is_a_pregnancy_prevention_programme_in_place_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_antiepilepsymedicine %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with choices=choices hx_post=hx_post_ppp hx_target='#antiepilepsy_medicine_list' hx_trigger='click' hx_swap='innerHTML' hx_name='is_a_pregnancy_prevention_programme_in_place' test_positive=antiepilepsy_medicine.is_a_pregnancy_prevention_programme_in_place tooltip_id='is_a_pregnancy_prevention_programme_in_place_tooltip' label=antiepilepsy_medicine.get_is_a_pregnancy_prevention_programme_in_place_help_label_text reference=antiepilepsy_medicine.get_is_a_pregnancy_prevention_programme_in_place_help_reference_text data_position='top left' enabled=can_edit %}
    {% endif %} {% endif %} diff --git a/templates/epilepsy12/partials/management/antiepilepsy_medicines/antiepilepsy_medicine_list.html b/templates/epilepsy12/partials/management/antiepilepsy_medicines/antiepilepsy_medicine_list.html index bec9e5f23..59f78014d 100644 --- a/templates/epilepsy12/partials/management/antiepilepsy_medicines/antiepilepsy_medicine_list.html +++ b/templates/epilepsy12/partials/management/antiepilepsy_medicines/antiepilepsy_medicine_list.html @@ -43,7 +43,7 @@
    - {% if not perms.epilepsy12.add_antiepilepsymedicine or not perms.epilepsy12.change_antiepilepsymedicine or not perms.epilepsy12.delete_aantiepilepsymedicine %} - {% permission_text perms.epilepsy12.add_antiepilepsymedicine perms.epilepsy12.change_antiepilepsymedicine perms.epilepsy12.delete_antiepilepsymedicine 'antiepilepsy/seizure medicines' %} + {% if not can_edit %} + You do not have permission to add, change, or delete antiepilepsy/seizure medicines. {% endif %}
    \ No newline at end of file diff --git a/templates/epilepsy12/partials/management/antiepilepsy_medicines/antiepilepsy_medicines.html b/templates/epilepsy12/partials/management/antiepilepsy_medicines/antiepilepsy_medicines.html index 64aea3743..959648db4 100644 --- a/templates/epilepsy12/partials/management/antiepilepsy_medicines/antiepilepsy_medicines.html +++ b/templates/epilepsy12/partials/management/antiepilepsy_medicines/antiepilepsy_medicines.html @@ -2,7 +2,7 @@
    {% url 'has_an_aed_been_given' management_id=management.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.has_an_aed_been_given hx_post=hx_post hx_swap="innerHTML" hx_target="#aeds" hx_trigger="click" tooltip_id='has_an_aed_been_given_tooltip' label=management.get_has_an_aed_been_given_help_label_text reference=management.get_has_an_aed_been_given_help_reference_text enabled=perms.epilepsy12.change_management %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.has_an_aed_been_given hx_post=hx_post hx_swap="innerHTML" hx_target="#aeds" hx_trigger="click" tooltip_id='has_an_aed_been_given_tooltip' label=management.get_has_an_aed_been_given_help_label_text reference=management.get_has_an_aed_been_given_help_reference_text enabled=can_edit %} {% if management.has_an_aed_been_given %}
    diff --git a/templates/epilepsy12/partials/management/antiepilepsy_medicines/rescue_medicines.html b/templates/epilepsy12/partials/management/antiepilepsy_medicines/rescue_medicines.html index bb8a2f07f..8ef01baa3 100644 --- a/templates/epilepsy12/partials/management/antiepilepsy_medicines/rescue_medicines.html +++ b/templates/epilepsy12/partials/management/antiepilepsy_medicines/rescue_medicines.html @@ -2,7 +2,7 @@
    {% url 'has_rescue_medication_been_prescribed' management_id=management.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.has_rescue_medication_been_prescribed hx_post=hx_post hx_swap="innerHTML" hx_target="#rescue_medicines" hx_trigger="click" tooltip_id='has_rescue_medication_been_prescribed_tooltip' label=management.get_has_rescue_medication_been_prescribed_help_label_text reference=management.get_has_rescue_medication_been_prescribed_help_reference_text enabled=perms.epilepsy12.change_management %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.has_rescue_medication_been_prescribed hx_post=hx_post hx_swap="innerHTML" hx_target="#rescue_medicines" hx_trigger="click" tooltip_id='has_rescue_medication_been_prescribed_tooltip' label=management.get_has_rescue_medication_been_prescribed_help_label_text reference=management.get_has_rescue_medication_been_prescribed_help_reference_text enabled=can_edit %} {% if management.has_rescue_medication_been_prescribed %}
    diff --git a/templates/epilepsy12/partials/management/individualised_care_plan.html b/templates/epilepsy12/partials/management/individualised_care_plan.html index 20700b141..6475f83dd 100644 --- a/templates/epilepsy12/partials/management/individualised_care_plan.html +++ b/templates/epilepsy12/partials/management/individualised_care_plan.html @@ -3,7 +3,7 @@
    {% url 'individualised_care_plan_in_place' management_id=management.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target="#individualised_care_plan" test_positive=management.individualised_care_plan_in_place hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_in_place_tooltip' label=management.get_individualised_care_plan_in_place_help_label_text reference=management.get_individualised_care_plan_in_place_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_management %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target="#individualised_care_plan" test_positive=management.individualised_care_plan_in_place hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_in_place_tooltip' label=management.get_individualised_care_plan_in_place_help_label_text reference=management.get_individualised_care_plan_in_place_help_reference_text data_position="top left" enabled=can_edit %}
    @@ -11,7 +11,7 @@
    {% url 'individualised_care_plan_date' management_id=management.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="change delay:1s" date_value=management.individualised_care_plan_date input_date_field_name='individualised_care_plan_date' label=management.get_individualised_care_plan_date_help_label_text reference=management.get_individualised_care_plan_date_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_management error_message=error_message has_permission=perms.epilepsy12.change_management enabled=perms.epilepsy12.change_management %} + {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="change delay:1s" date_value=management.individualised_care_plan_date input_date_field_name='individualised_care_plan_date' label=management.get_individualised_care_plan_date_help_label_text reference=management.get_individualised_care_plan_date_help_reference_text data_position="top left" enabled=can_edit error_message=error_message has_permission=can_edit enabled=can_edit %}
    {% if error_message %}
    @@ -25,12 +25,12 @@
    Does ongoing individualised care planning include:
    {% url 'individualised_care_plan_has_parent_carer_child_agreement' management_id=management.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.individualised_care_plan_has_parent_carer_child_agreement hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_has_parent_carer_child_agreement_tooltip' label=management.get_individualised_care_plan_has_parent_carer_child_agreement_help_label_text reference=management.get_individualised_care_plan_has_parent_carer_child_agreement_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_management %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.individualised_care_plan_has_parent_carer_child_agreement hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_has_parent_carer_child_agreement_tooltip' label=management.get_individualised_care_plan_has_parent_carer_child_agreement_help_label_text reference=management.get_individualised_care_plan_has_parent_carer_child_agreement_help_reference_text data_position="top left" enabled=can_edit %}
    {% url 'individualised_care_plan_includes_service_contact_details' management_id=management.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.individualised_care_plan_includes_service_contact_details hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_includes_service_contact_details_tooltip' label=management.get_individualised_care_plan_includes_service_contact_details_help_label_text reference=management.get_individualised_care_plan_includes_service_contact_details_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_management %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.individualised_care_plan_includes_service_contact_details hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_includes_service_contact_details_tooltip' label=management.get_individualised_care_plan_includes_service_contact_details_help_label_text reference=management.get_individualised_care_plan_includes_service_contact_details_help_reference_text data_position="top left" enabled=can_edit %}
    @@ -40,12 +40,12 @@
    Does ongoing individualised care planning include:
    {% url 'individualised_care_plan_include_first_aid' management_id=management.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.individualised_care_plan_include_first_aid hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_include_first_aid_tooltip' label=management.get_individualised_care_plan_include_first_aid_help_label_text reference=management.get_individualised_care_plan_include_first_aid_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_management %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.individualised_care_plan_include_first_aid hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_include_first_aid_tooltip' label=management.get_individualised_care_plan_include_first_aid_help_label_text reference=management.get_individualised_care_plan_include_first_aid_help_reference_text data_position="top left" enabled=can_edit %}
    {% url 'individualised_care_plan_parental_prolonged_seizure_care' management_id=management.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.individualised_care_plan_parental_prolonged_seizure_care hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_parental_prolonged_seizure_care_tooltip' label=management.get_individualised_care_plan_parental_prolonged_seizure_care_help_label_text reference=management.get_individualised_care_plan_parental_prolonged_seizure_care_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_management %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.individualised_care_plan_parental_prolonged_seizure_care hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_parental_prolonged_seizure_care_tooltip' label=management.get_individualised_care_plan_parental_prolonged_seizure_care_help_label_text reference=management.get_individualised_care_plan_parental_prolonged_seizure_care_help_reference_text data_position="top left" enabled=can_edit %}
    @@ -55,12 +55,12 @@
    Does ongoing individualised care planning include:
    {% url 'individualised_care_plan_includes_general_participation_risk' management_id=management.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.individualised_care_plan_includes_general_participation_risk hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_includes_general_participation_risk_tooltip' label=management.get_individualised_care_plan_includes_general_participation_risk_help_label_text reference=management.get_individualised_care_plan_includes_general_participation_risk_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_management %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.individualised_care_plan_includes_general_participation_risk hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_includes_general_participation_risk_tooltip' label=management.get_individualised_care_plan_includes_general_participation_risk_help_label_text reference=management.get_individualised_care_plan_includes_general_participation_risk_help_reference_text data_position="top left" enabled=can_edit %}
    {% url 'individualised_care_plan_addresses_water_safety' management_id=management.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.individualised_care_plan_addresses_water_safety hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_addresses_water_safety_tooltip' label=management.get_individualised_care_plan_addresses_water_safety_help_label_text reference=management.get_individualised_care_plan_addresses_water_safety_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_management %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.individualised_care_plan_addresses_water_safety hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_addresses_water_safety_tooltip' label=management.get_individualised_care_plan_addresses_water_safety_help_label_text reference=management.get_individualised_care_plan_addresses_water_safety_help_reference_text data_position="top left" enabled=can_edit %}
    @@ -70,19 +70,19 @@
    Does ongoing individualised care planning include:
    {% url 'individualised_care_plan_addresses_sudep' management_id=management.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.individualised_care_plan_addresses_sudep hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_addresses_sudep_tooltip' label=management.get_individualised_care_plan_addresses_sudep_help_label_text reference=management.get_individualised_care_plan_addresses_sudep_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_management %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.individualised_care_plan_addresses_sudep hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_addresses_sudep_tooltip' label=management.get_individualised_care_plan_addresses_sudep_help_label_text reference=management.get_individualised_care_plan_addresses_sudep_help_reference_text data_position="top left" enabled=can_edit %}
    {% url 'individualised_care_plan_includes_ehcp' management_id=management.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.individualised_care_plan_includes_ehcp hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_includes_ehcp_tooltip' label=management.get_individualised_care_plan_includes_ehcp_help_label_text reference=management.get_individualised_care_plan_includes_ehcp_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_management %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.individualised_care_plan_includes_ehcp hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='individualised_care_plan_includes_ehcp_tooltip' label=management.get_individualised_care_plan_includes_ehcp_help_label_text reference=management.get_individualised_care_plan_includes_ehcp_help_reference_text data_position="top left" enabled=can_edit %}
    {% url 'has_individualised_care_plan_been_updated_in_the_last_year' management_id=management.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.has_individualised_care_plan_been_updated_in_the_last_year hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='has_individualised_care_plan_been_updated_in_the_last_year_tooltip' label=management.get_has_individualised_care_plan_been_updated_in_the_last_year_help_label_text reference=management.get_has_individualised_care_plan_been_updated_in_the_last_year_help_reference_text data_position="top left" enabled=perms.epilepsy12.change_management %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with test_positive=management.has_individualised_care_plan_been_updated_in_the_last_year hx_post=hx_post hx_target="#individualised_care_plan" hx_swap="innerHTML" hx_trigger="click" tooltip_id='has_individualised_care_plan_been_updated_in_the_last_year_tooltip' label=management.get_has_individualised_care_plan_been_updated_in_the_last_year_help_label_text reference=management.get_has_individualised_care_plan_been_updated_in_the_last_year_help_reference_text data_position="top left" enabled=can_edit %}
    diff --git a/templates/epilepsy12/partials/management/mental_health_support.html b/templates/epilepsy12/partials/management/mental_health_support.html index 00a955c96..ad5466de6 100644 --- a/templates/epilepsy12/partials/management/mental_health_support.html +++ b/templates/epilepsy12/partials/management/mental_health_support.html @@ -2,12 +2,12 @@
    {% url 'has_been_referred_for_mental_health_support' management_id=management.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target='#mental_health_support' hx_trigger='click' hx_swap='innerHTML' test_positive=management.has_been_referred_for_mental_health_support tooltip_id='has_been_referred_for_mental_health_support_tooltip' label=management.get_has_been_referred_for_mental_health_support_help_label_text reference=management.get_has_been_referred_for_mental_health_support_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_management %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target='#mental_health_support' hx_trigger='click' hx_swap='innerHTML' test_positive=management.has_been_referred_for_mental_health_support tooltip_id='has_been_referred_for_mental_health_support_tooltip' label=management.get_has_been_referred_for_mental_health_support_help_label_text reference=management.get_has_been_referred_for_mental_health_support_help_reference_text data_position='top left' enabled=can_edit %}
    {% url 'has_support_for_mental_health_support' management_id=management.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target='#mental_health_support' hx_trigger='click' hx_swap='innerHTML' test_positive=management.has_support_for_mental_health_support tooltip_id='has_support_for_mental_health_support_tooltip' label=management.get_has_support_for_mental_health_support_help_label_text reference=management.get_has_support_for_mental_health_support_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_management %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target='#mental_health_support' hx_trigger='click' hx_swap='innerHTML' test_positive=management.has_support_for_mental_health_support tooltip_id='has_support_for_mental_health_support_tooltip' label=management.get_has_support_for_mental_health_support_help_label_text reference=management.get_has_support_for_mental_health_support_help_reference_text data_position='top left' enabled=can_edit %}
    diff --git a/templates/epilepsy12/partials/multiaxial_diagnosis/comorbidities/comorbidities.html b/templates/epilepsy12/partials/multiaxial_diagnosis/comorbidities/comorbidities.html index 1bb6f1897..a4d77838e 100644 --- a/templates/epilepsy12/partials/multiaxial_diagnosis/comorbidities/comorbidities.html +++ b/templates/epilepsy12/partials/multiaxial_diagnosis/comorbidities/comorbidities.html @@ -54,7 +54,7 @@ Edit
    -{% if not perms.epilepsy12.add_comorbidity or not perms.epilepsy12.change_comorbidity or not perms.epilepsy12.delete_comorbidity %} - {% permission_text perms.epilepsy12.add_comorbidity perms.epilepsy12.change_comorbidity perms.epilepsy12.delete_comorbidity 'comorbidities' %} +{% if not can_edit %} + You do not have permission to add, change or delete comorbidities. {% endif %} \ No newline at end of file diff --git a/templates/epilepsy12/partials/multiaxial_diagnosis/comorbidities/comorbidity.html b/templates/epilepsy12/partials/multiaxial_diagnosis/comorbidities/comorbidity.html index 60b8261ad..945a6b335 100644 --- a/templates/epilepsy12/partials/multiaxial_diagnosis/comorbidities/comorbidity.html +++ b/templates/epilepsy12/partials/multiaxial_diagnosis/comorbidities/comorbidity.html @@ -16,7 +16,7 @@
    {% url 'comorbidity_diagnosis_date' comorbidity_id=comorbidity.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_target='#comorbidities' hx_trigger='change delay:1s' hx_swap="innerHTML" date_value=comorbidity.comorbidity_diagnosis_date label=comorbidity.get_comorbidity_diagnosis_date_help_label_text reference=comorbidity.get_comorbidity_diagnosis_date_help_reference_text input_date_field_name='comorbidity_diagnosis_date' enabled=perms.epilepsy12.change_comorbidity has_permission=perms.epilepsy12.change_comorbidity %} + {% include 'epilepsy12/partials/page_elements/date_field.html' with hx_post=hx_post hx_target='#comorbidities' hx_trigger='change delay:1s' hx_swap="innerHTML" date_value=comorbidity.comorbidity_diagnosis_date label=comorbidity.get_comorbidity_diagnosis_date_help_label_text reference=comorbidity.get_comorbidity_diagnosis_date_help_reference_text input_date_field_name='comorbidity_diagnosis_date' enabled=can_edit has_permission=can_edit %}
    {% if error_message %}
    @@ -26,7 +26,7 @@
    {% url 'comorbidity_diagnosis' comorbidity_id=comorbidity.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/select_model.html' with choices=comorbidity_choices hx_post=hx_post hx_target="#comorbidities" hx_trigger='change' hx_swap="innerHTML" hx_name='comorbidityentity' field_name='preferredTerm' field_name2='term' hx_default_text="Select a comorbidity..." test_positive=comorbidity.comorbidityentity.pk label=comorbidity.get_comorbidityentity_help_label_text reference=comorbidity.get_comorbidityentity_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_comorbidity %} + {% include 'epilepsy12/partials/page_elements/select_model.html' with choices=comorbidity_choices hx_post=hx_post hx_target="#comorbidities" hx_trigger='change' hx_swap="innerHTML" hx_name='comorbidityentity' field_name='preferredTerm' field_name2='term' hx_default_text="Select a comorbidity..." test_positive=comorbidity.comorbidityentity.pk label=comorbidity.get_comorbidityentity_help_label_text reference=comorbidity.get_comorbidityentity_help_reference_text data_position='top left' enabled=can_edit %}
    diff --git a/templates/epilepsy12/partials/multiaxial_diagnosis/comorbidities/comorbidity_section.html b/templates/epilepsy12/partials/multiaxial_diagnosis/comorbidities/comorbidity_section.html index 94c6f8bb1..9559b0ac4 100644 --- a/templates/epilepsy12/partials/multiaxial_diagnosis/comorbidities/comorbidity_section.html +++ b/templates/epilepsy12/partials/multiaxial_diagnosis/comorbidities/comorbidity_section.html @@ -2,7 +2,7 @@ {% csrf_token %}
    {% url 'relevant_impairments_behavioural_educational' multiaxial_diagnosis_id=multiaxial_diagnosis.pk as hx_post %} - {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target='#comorbidity_section' hx_trigger='click' hx_swap='innerHTML' test_positive=multiaxial_diagnosis.relevant_impairments_behavioural_educational tooltip_id='relevant_impairments_behavioural_educational_tooltip' label=multiaxial_diagnosis.get_relevant_impairments_behavioural_educational_help_label_text reference=multiaxial_diagnosis.get_relevant_impairments_behavioural_educational_help_reference_text data_position='top left' enabled=perms.epilepsy12.change_comorbidity %} + {% include 'epilepsy12/partials/page_elements/toggle_button.html' with hx_post=hx_post hx_target='#comorbidity_section' hx_trigger='click' hx_swap='innerHTML' test_positive=multiaxial_diagnosis.relevant_impairments_behavioural_educational tooltip_id='relevant_impairments_behavioural_educational_tooltip' label=multiaxial_diagnosis.get_relevant_impairments_behavioural_educational_help_label_text reference=multiaxial_diagnosis.get_relevant_impairments_behavioural_educational_help_reference_text data_position='top left' enabled=can_edit %} {% if multiaxial_diagnosis.relevant_impairments_behavioural_educational %}
    diff --git a/templates/epilepsy12/partials/multiaxial_diagnosis/description.html b/templates/epilepsy12/partials/multiaxial_diagnosis/description.html index 6bc14efa3..51e3fe33d 100644 --- a/templates/epilepsy12/partials/multiaxial_diagnosis/description.html +++ b/templates/epilepsy12/partials/multiaxial_diagnosis/description.html @@ -14,7 +14,7 @@