Skip to content

Commit

Permalink
Merge pull request #476 from rcpch/mbarton/tidy-up-patient-list
Browse files Browse the repository at this point in the history
Remove unused UI components from patient list
  • Loading branch information
mbarton authored Jan 11, 2025
2 parents e6bfb02 + 1eb4a7d commit 9eb179c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 124 deletions.
56 changes: 1 addition & 55 deletions project/npda/templates/partials/patient_table.html
Original file line number Diff line number Diff line change
@@ -1,61 +1,7 @@
{% load static %}
{% load npda_tags %}
{% url 'patients' as patients_url %}
{% if request.user.view_preference == 1 %}
<!-- PDU view -->
<div role="alert" class="alert mt-2 bg-slate-200">
<p>
<i class="fa-solid fa-users-viewfinder"></i> Showing patients filtered by:
</p>
<ul class="list-inside list-disc">
<li>
<b>Audit Year </b>[<span class="p-1 mx-1 font-mono bg-gray-300">{{ selected_audit_year }} only</span>].
</li>
<li>
<b>Patient Diabetic Unit </b>[<span class="p-1 mx-1 font-mono bg-gray-300">{{ pz_code }} only</span>].
</li>
</ul>
<button data-tip="You can change the audit year by using the filters below the navigation menu."
class="text-rcpch_pink tooltip p-2 hover:text-rcpch_pink_light_tint1 hover:bg-gray-50"
hx-on:click="event.stopPropagation(); window.scrollTo(0, 0); document.getElementById('global_view_preference_wrapper').classList.remove('translate-x-full'); document.getElementById('audit_year_select_id').classList.toggle('animate-[bounce_1s_ease-in-out_1]'); ">
<i class="fa-question-circle fas"></i> Change Audit Year
</button>
<button data-tip="You can change the PDU by using the dropdown below the navigation menu."
class="text-rcpch_pink tooltip p-2 hover:text-rcpch_pink_light_tint1 hover:bg-gray-50"
hx-on:click="event.stopPropagation(); window.scrollTo(0, 0); document.getElementById('global_view_preference_wrapper').classList.remove('translate-x-full'); window.scrollTo(0, 0); document.getElementById('pz_code_select_id').classList.toggle('animate-[bounce_1s_ease-in-out_1]'); ">
<i class="fa-question-circle fas"></i> Change PDU
</button>
<button class="text-rcpch_pink p-2 hover:text-rcpch_pink_light_tint1 hover:bg-gray-50"
hx-on:click="event.stopPropagation(); window.scrollTo(0, 0); document.getElementById('global_view_preference_wrapper').classList.remove('translate-x-full'); document.getElementById('view_preference_2').click();">
<i class="fa-solid fa-square-xmark"></i> Remove filter
</button>
</div>
{% elif request.user.view_preference == 2 %}
<!-- national view -->
<!-- PDU view -->
<div role="alert" class="alert mt-2 bg-slate-200">
<p>
<i class="fa-solid fa-users-viewfinder"></i> Showing patients filtered by:
</p>
<ul class="list-inside list-disc">
<li>
<b>Audit Year </b>[<span class="p-1 mx-1 font-mono bg-gray-300">{{ selected_audit_year }} only</span>].
</li>
<li>
<b>National patients</b> [<span class="p-1 mx-1 font-mono bg-gray-300">no filters</span>].
</li>
</ul>
<button data-tip="You can change the audit year by using the filters below the navigation menu."
class="text-rcpch_pink tooltip p-2 hover:text-rcpch_pink_light_tint1 hover:bg-gray-50"
hx-on:click="event.stopPropagation(); window.scrollTo(0, 0); document.getElementById('global_view_preference_wrapper').classList.remove('translate-x-full'); document.getElementById('audit_year_select_id').classList.toggle('animate-[bounce_1s_ease-in-out_1]'); ">
<i class="fa-question-circle fas"></i> Change Audit Year
</button>
<button class="text-rcpch_pink p-2 hover:text-rcpch_pink_light_tint1 hover:bg-gray-50"
hx-on:click="event.stopPropagation(); document.getElementById('global_view_preference_wrapper').classList.remove('translate-x-full'); document.getElementById('view_preference_1').click();">
<i class="fa-solid fa-square-plus"></i> Apply PDU Filter
</button>
</div>
{% endif %}

{% if patient_list %}
<div class="w-full overflow-x-scroll">
<table class="font-montserrat table-md table mt-2 mb-5 text-sm text-left rtl:text-right">
Expand Down
92 changes: 23 additions & 69 deletions project/npda/templates/patients.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,7 @@
<div hx-get="/patients"
hx-trigger="patients from:body"
hx-target="#patient_table">
<div class="flex flex-col justify-center px-10">
<div class="breadcrumbs text-sm">
<ul>
<li>
<a href="/"><i class="fa-solid fa-house mr-1"></i> Dashboard</a>
</li>
<li>Questionnaire</li>
</ul>
</div>
<div class="flex flex-col justify-center px-10 mt-5">
<div class="flex flex-wrap">
<label class="form-control flex items-center gap-2 grow">
<label class="bg-rcpch_strong_blue mx-6 text-white input flex items-center gap-2 w-full h-auto">
Expand Down Expand Up @@ -41,69 +33,31 @@
<div id="search_spinner"
class="htmx-indicator flex items-center px-4 text-white absolute right-14 loading loading-bars loading-sm">
</div>
<button class="btn btn-info h-auto w-full md:w-auto"
hx-include="#search-input"
hx-swap="innerHTML"
hx-target="#patient_table"
hx-trigger="click"
hx-indicator="#search_spinner"
hx-get="{% url 'patients' %}"
hx-disabled-elt="this">
<span class="md:hidden text-white">Search patients</span>
<i class="fa-solid fa-magnifying-glass text-white"></i>
</button>
<div class="divider divider-horizontal after:bg-rcpch_strong_blue_light_tint1 before:bg-rcpch_strong_blue_light_tint3 hidden lg:flex">
</div>
{% if perms.npda.add_patient %}
<a href="{% url 'patient-add' %}"
class="btn btn-info h-auto w-full md:w-auto {% if not can_alter_this_audit_year_submission %} btn-disabled {% endif %}">
<i class="fa-solid fa-person-circle-plus"></i>
Add patient
</a>
{% endif %}
</label>
</label>
<button class="btn btn-info h-auto w-full md:w-auto"
hx-include="#search-input"
hx-swap="innerHTML"
hx-target="#patient_table"
hx-trigger="click"
hx-indicator="#search_spinner"
hx-get="{% url 'patients' %}"
hx-disabled-elt="this">
<span class="md:hidden text-white">Search patients</span>
<i class="fa-solid fa-magnifying-glass text-white"></i>
</button>
</div>
<div>
<div>
<div class="relative">
<div class="mt-1 menu bg-base-200 lg:menu-horizontal rounded-box w-full shadow-sm shadow-rcpch_strong_blue_dark_tint mb-2">
<div class="flex sm:hidden divider m-0 h-auto font-bold">Quick access</div>
<div class="hidden sm:flex divider divider-vertical m-0 h-auto font-bold">
Quick access
</div>
<div class="flex justify-items-stretch grow align-middle justify-between flex-wrap">
<ul class="flex items-center flex-wrap grow">
<li>
<a href="{% url 'patients' %}">
<i class="fa-solid fa-hospital-user"></i>Patient Index
<span class="badge badge-sm">ALL</span>
</a>
</li>
</ul>
<ul class="flex items-center flex-wrap">
<li>
<div class="tooltip tooltip-bottom" data-tip="No updates to display.">
<button class="opacity-40" disabled>
<i class="fa-solid fa-circle-exclamation"></i> Notifications
</button>
</div>
</li>
{% if perms.npda.add_patient %}
<li>
{% if can_alter_this_audit_year_submission %}
<a href="{% url 'patient-add' %}"
class="underline decoration-rcpch_strong_blue hover:decoration-rcpch_pink decoration-2 underline-offset-4">
<i class="fa-solid fa-person-circle-plus"></i>
Add child
</a>
{% else %}
<span class="underline decoration-rcpch_strong_blue decoration-2 underline-offset-4 opacity-40 pointer-events-none">
<i class="fa-solid fa-person-circle-plus"></i>
Add child
</span>
{% endif %}
</li>
{% endif %}
</ul>
</div>
</div>
<div id="patient_table">
{% include 'partials/patient_table.html' with patient_list=patient_list index_of_first_invalid_patient=index_of_first_invalid_patient total_invalid_patients=total_invalid_patients %}
</div>
</div>
</div>
<div id="patient_table">
{% include 'partials/patient_table.html' with patient_list=patient_list index_of_first_invalid_patient=index_of_first_invalid_patient total_invalid_patients=total_invalid_patients %}
</div>
</div>
</div>
Expand Down

0 comments on commit 9eb179c

Please sign in to comment.