Skip to content

Commit

Permalink
Merge branch 'live' into 403-dark-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
reecehill committed Nov 29, 2024
2 parents 505de3f + 8bda0a4 commit e930034
Show file tree
Hide file tree
Showing 11 changed files with 179 additions and 133 deletions.
7 changes: 6 additions & 1 deletion project/npda/templates/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,9 @@
document.body.setAttribute('data-theme', desiredTheme);
localStorage.setItem('theme', desiredTheme);
}
</script>
</script>
<style>
.tooltip::before {
z-index: 50;
}
</style>
104 changes: 53 additions & 51 deletions project/npda/templates/partials/data_quality_report.html
Original file line number Diff line number Diff line change
@@ -1,62 +1,64 @@
{% load static %}
{% load npda_tags %}
<div class="overflow-x-auto">
<h5 class="text-lg font-bold text-gray-900">Data Quality Report</h5>
<table class="table">
<thead>
<tr>
<th class="text-rcpch_dark_blue">NHS Number</th>
<th class="text-rcpch_dark_blue">Total Visits</th>
<th class="text-rcpch_dark_blue">Visits with Errors</th>
</tr>
<h2 class="text-md font-montserrat font-semibold text-rcpch_dark_blue">Data Quality Report</h2>
<div class="max-h-screen">
<div class="w-full overflow-x-auto overflow-y-auto" style="max-height:inherit">
<table class="table table-auto table-pin-cols table-pin-rows border-collapse text-sm text-left text-gray-500 mb-5 font-montserrat">
<thead class="text-xs uppercase bg-rcpch_dark_blue text-white">
<tr class="bg-rcpch_dark_blue text-white z-40">
<td>NHS Number</td>
<td>Total Visits</td>
<td>Visits with Errors</td>
</tr>
</thead>
<tbody>
{% for patient in patients %}
<tr>
<td class="text-rcpch_dark_blue">{{patient.nhs_number}}</td>
<td class="text-rcpch_dark_blue">{{patient.visit_count}}</td>
<td class="text-rcpch_dark_blue">{{patient.visit_error_count}}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
{% for patient in patients %}
<tr>
<td colspan="100%" class="text-gray-900">This table shows the number of visits for each patient and the number of visits with errors for the current active submission.</td>
<td>{{ patient.nhs_number }}</td>
<td>{{ patient.visit_count }}</td>
<td>{{ patient.visit_error_count }}</td>
</tr>
</tfoot>
</table>

{% if submission_errors %}
<table class="table-auto w-full text-sm text-left text-gray-500 mb-5 font-montserrat">
<thead class="text-xs text-gray-700 uppercase bg-gray-50 bg-rcpch_dark_blue text-white">
<tr>
<th class="px-6 py-3">CSV Row Number</th>
<th class="px-6 py-3">Field</th>
<th class="px-6 py-3">Error</th>
</tr>
</thead>
<tbody>
{% for row_number, errors in submission_errors.items %}
{% for field, error_list in errors.items %}
{% for individual_errors in error_list %}
{% for individual_error in individual_errors %}
<tr>
<td class="px-6 py-4">{{ row_number }}</td>
<td class="px-6 py-4">{{ field|heading_for_field }}</td>
<td class="px-6 py-4">
{{ individual_error|join_with_comma }}
</td>
</tr>
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
</tbody>
<tfoot>
<tr>
<td colspan="3" class="text-gray-900">This table shows the errors found in the CSV file for the current active submission.</td>
</tr>
<tr>
<td colspan="100%" class="text-gray-900">This table shows the number of visits for each patient and the number of visits with errors for the current active submission.</td>
</tr>
</tfoot>
</table>
</div>
</div>

{% if submission_errors %}
<table class="table-auto w-full text-sm text-left text-gray-500 mb-5 font-montserrat">
<thead class="text-xs text-gray-700 uppercase bg-gray-50 bg-rcpch_dark_blue text-white">
<tr>
<th class="px-6 py-3">CSV Row Number</th>
<th class="px-6 py-3">Field</th>
<th class="px-6 py-3">Error</th>
</tr>
</thead>
<tbody>
{% for row_number, errors in submission_errors.items %}
{% for field, error_list in errors.items %}
{% for individual_errors in error_list %}
{% for individual_error in individual_errors %}
<tr>
<td class="px-6 py-4">{{ row_number }}</td>
<td class="px-6 py-4">{{ field|heading_for_field }}</td>
<td class="px-6 py-4">{{ individual_error|join_with_comma }}</td>
</tr>
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
</tbody>
<tfoot>
<tr>
<td colspan="3" class="text-gray-900">This table shows the errors found in the CSV file for the current active submission.</td>
</tr>
</tfoot>
</table>
{% endif %}
</div>
{% endif %}
</div>
8 changes: 1 addition & 7 deletions project/npda/templates/partials/kpi_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,4 @@
{% endfor %}
</tbody>
</table>
</div>

<style>
.tooltip::before {
z-index: 50;
}
</style>
</div>
95 changes: 62 additions & 33 deletions project/npda/templates/partials/submission_history.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% load static %}
{% load npda_tags %}
{% load humanize %}

<div>

{% if request.user.view_preference == 1 %}
Expand All @@ -11,29 +13,40 @@ <h1 class="text-md font-montserrat font-semibold text-rcpch_dark_blue">All Submi
{% endif %}

{% if submissions %}
<table class="table table-md w-full text-sm text-left rtl:text-right text-gray-500 text-gray-400 mb-5 font-montserrat">
<thead class="text-xs text-gray-700 uppercase bg-gray-50 bg-rcpch_dark_blue text-white">
<tr>
<th>Submission Date</th>
<th>Submission By</th>
<th>Audit Year</th>
<th>Patient Number</th>
<th>Active</th>
{% if request.user.view_preference == 2 %}<th>PDU</th>{% endif %}
<th>Download</th>
<div class="max-h-screen p-4 overflow-clip">
<div class="w-full overflow-x-auto overflow-y-auto" style="max-height:inherit">
<table class="table table-auto table-pin-cols border-collapse text-sm text-left text-gray-500 mb-5 font-montserrat">
<thead class="text-xs uppercase bg-rcpch_dark_blue text-white">
<tr class="bg-rcpch_dark_blue text-white z-40">
<td>Submission Date</td>
<td>Submitted By</td>
<td>Audit Year</td>
<td>Patient Qty</td>
<td>Status</td>
{% if request.user.view_preference == 2 %}<td>PDU</td>{% endif %}
<td>Actions</td>
</tr>
</thead>
<tbody>
{% for submission in submissions %}
{% if forloop.first %}
<tr class="border-b bg-white text-rcpch_light_blue border-gray-100 hover:bg-r hover:bg-rcpch_light_blue hover:text-white">
{% else %}
<tr class="border-b bg-rcpch_lightest_grey text-rcpch_light_blue border-gray-100 hover:bg-r hover:bg-rcpch_mid_grey hover:text-white">
{% endif %}
<td>{{ submission.submission_date|date:"d/m/Y H:i s" }} secs</td>
<td>{{ submission.full_name_submission_by}}</td>
{% if forloop.first %}
<tr class="border-b border-gray-100 hover:text-white
{% if submission_errors %}
text-rcpch_red_light_tint3 bg-rcpch_dark_red hover:bg-rcpch_red_dark_tint
{% else %}
text-rcpch_light_blue hover:bg-rcpch_pink
{% endif %}">
{% else %}
<tr class="border-b bg-slate-100 text-slate-500 border-gray-100 hover:bg-r hover:bg-rcpch_mid_grey hover:text-white">
{% endif %}
<td>
{% if submission_errors and submission.submission_active %}
<div class="tooltip tooltip-right" data-tip="We found some errors with this submission. Please check the Quality Report and try to reupload."><i class="fa-solid fa-circle-exclamation"></i></div>
{% endif %}
<div class="tooltip tooltip-right" data-tip="Uploaded at {{ submission.submission_date|date:"H:i:s" }} on {{ submission.submission_date|date:"d/m/Y" }}">{{ submission.submission_date|naturaltime }}</div></td>
<td>{{ submission.submission_by}}</td>
<td>{{ submission.audit_year}}</td>
<td>{% if submission.patient_count %}{{ submission.patient_count }}{% else %}-{% endif %}</td>
<td><div class="tooltip" data-tip="Total of {{ submission.patient_count|default:"?"}} patients uploaded in this submission">{{ submission.patient_count|default:"?"}}</div></td>
<td>
{% if submission.submission_active %}
<span class="bg-rcpch_pink px-1 py-0.25 mx-1 my-1 text-sm font-semibold text-white">
Expand All @@ -45,48 +58,62 @@ <h1 class="text-md font-montserrat font-semibold text-rcpch_dark_blue">All Submi
</span>
{% endif %}
</td>
{% if request.user.view_preference == 2 %}<td>{{ submission.paediatric_diabetes_unit.pz_code }} ({{submission.paediatric_diabetes_unit.lead_organisation_name}})</td>{% endif %}
<td class="flex flex-row">
{% if request.user.view_preference == 2 %}
<td>{{ submission.paediatric_diabetes_unit.pz_code }} ({{submission.paediatric_diabetes_unit.lead_organisation_name}})</td>
{% endif %}
<td class="flex flex-row gap-2 justify-between flex-wrap items-center">
<form method="post" action="{% url 'submissions' %}" class="join">
{% csrf_token %}
<input type="hidden" name="audit_id" value="{{submission.pk}}">
{% if submission.submission_active %}
<!-- data quality report only visible for PDU view -->
{% if request.user.view_preference == 1 %}
<div class="join join-vertical lg:join-horizontal items-center
">
<div class="bg-gray-400 h-full items-center flex px-2 text-white"><i class="fas fa-download mr-1"></i> Download: </div>
<div class="bg-gray-400 h-full items-center flex p-1 text-white">
<button
name="submit-data"
value="download-report"
type="submit"
class="join-item mr-2 bg-rcpch_pink text-white font-semibold hover:text-white py-1 px-2 hover:bg-rcpch_pink_light_tint1 btn-sm rounded-none">View Report</button>
class=" mr-2 bg-rcpch_light_blue text-white font-semibold hover:text-white py-1 px-2 hover:bg-rcpch_pink btn-sm rounded-none h-auto join-item">
<div class="tooltip tooltip-bottom" data-tip="Download a spreadsheet (.xlsx) that shows your uploaded data with validation comments"><i class="fa-solid fa-file-excel"></i> Quality Report</div></button>
{% endif %}
<button
name="submit-data"
value="download-data"
type="submit"
class="join-item bg-rcpch_light_blue text-white font-semibold hover:text-white py-1 px-2 border border-rcpch_light_blue hover:bg-rcpch_strong_blue hover:border-rcpch_strong_blue btn-sm rounded-none">Download</button>
class=" bg-rcpch_light_blue text-white font-semibold hover:text-white py-1 px-2 hover:bg-rcpch_pink btn-sm rounded-none h-auto join-item">
<div class="tooltip tooltip-bottom" data-tip="Download a copy of the uploaded .CSV file">
<i class="fa-solid fa-file-csv"></i>


Raw Data</div></button>
</div>
</div>
{% else %}

<button
name="submit-data"
disabled="true"
value="delete-data"
type="submit"
class="join-item bg-rcpch_red text-white font-semibold hover:text-white py-1 px-2 border border-rcpch_red hover:bg-rcpch_red_dark_tint hover:border-rcpch_red_dark_tint btn-sm rounded-none {% if submission.submission_active %}opacity-50 cursor-not-allowed {% endif %}">Delete</button>
class="join-item bg-rcpch_red text-white font-semibold hover:text-white py-1 px-2 border border-rcpch_red hover:bg-rcpch_red_dark_tint hover:border-rcpch_red_dark_tint btn-sm rounded-none {% if submission.submission_active %}opacity-50 cursor-not-allowed {% endif %} h-auto">Delete</button>
{% endif %}
</form>
{% if submission.submission_active %}
<a href="{% url 'patients' %}">
<svg
class="h-8 w-8 text-rcpch_pink self-center hover:text-white"
width="24" height="24" viewBox="0 0 24 24" stroke-width="2"
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z"/> <polyline points="9 6 15 12 9 18" />
</svg>
</a>
<a href="{% url 'patients' %}"
class="join-item bg-rcpch_light_blue text-white font-semibold hover:text-white py-1 px-2 border border-rcpch_light_blue hover:bg-rcpch_pink hover:border-rcpch_strong_blue btn-sm rounded-none h-auto">

<div class="tooltip tooltip-left" data-tip="View submission details, including the patients uploaded.">View Submission <i class="fa-solid fa-eye"></i></div></a>

{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr class="text-xs text-gray-700 uppercase bg-gray-50 bg-rcpch_dark_blue text-white py-5">
<tr class="text-xs uppercase bg-rcpch_dark_blue text-white py-5">
<th colspan="11" class="px-2">
<strong>

Expand All @@ -95,8 +122,9 @@ <h1 class="text-md font-montserrat font-semibold text-rcpch_dark_blue">All Submi
</tr>
</tfoot>
</table>

</div>
</div>

{% if data is not None %}
<!-- data quality report only visible for PDU view -->
{% if request.user.view_preference == 1 %}
Expand All @@ -116,4 +144,5 @@ <h1 class="text-md font-montserrat font-semibold text-rcpch_dark_blue">All Submi
<p class="text-gray-400">No submissions created yet for {{request.session.pz_code}}. {% text_for_data_submission can_upload_csv can_complete_questionnaire %}</p>
{% endif %}
{% endif %}
</div>
</div>
20 changes: 12 additions & 8 deletions project/npda/templates/submissions_list.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{% extends "base.html" %}
{% extends 'base.html' %}
{% load static %}
{% block content %}
<div class="flex flex-col justify-center px-10" hx-get="{% url 'submissions' %}" hx-trigger="submissions from:body" hx-target="#submissions_table">
<div class="overflow-x-auto sm:-mx-6 lg:-mx-8">
<div class="inline-block min-w-full py-2 sm:px-6 lg:px-8">
<div class="relative overflow-x-auto">
<div id="submissions_table">
<section class="mb-5 container-mx-auto flex items-center justify-center">
<div class="w-full" hx-get="/submissions" hx-trigger="submissions from:body" hx-target="#submissions_table">
<div class="flex flex-col justify-center px-10">
<div class="">
<div class="">
<div class="relative">
<div id="submissions_table" class="w-full mt-5 mx-2">
{% include 'partials/submission_history.html' with submissions=object_list data=data submission_errors=submission_errors patients=patients %}
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
</div>
</section>
{% endblock %}
Loading

0 comments on commit e930034

Please sign in to comment.