-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add delivery-type, year, quarter filter to admin report
- Loading branch information
Showing
6 changed files
with
244 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
from django.urls import path | ||
|
||
from commcare_connect.reports import views | ||
from commcare_connect.reports.views import DeliveryStatsReportView | ||
|
||
app_name = "reports" | ||
|
||
urlpatterns = [ | ||
path("delivery_stats", views.delivery_stats_report, name="delivery_stats_report"), | ||
# path("delivery_stats", views.delivery_stats_report, name="delivery_stats_report"), | ||
path("delivery_stats", view=DeliveryStatsReportView.as_view(), name="delivery_stats_report"), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{% extends "django_tables2/bootstrap5.html" %} | ||
|
||
{% load django_tables2 %} | ||
{% load i18n %} | ||
|
||
{% block table.thead %} | ||
{% if table.show_header %} | ||
<thead {{ table.attrs.thead.as_html }}> | ||
<tr> | ||
{% for column in table.columns %} | ||
<th {{ column.attrs.th.as_html }} | ||
{% if column.orderable %} | ||
hx-get="{% querystring table.prefixed_order_by_field=column.order_by_alias.next%}&{{ table.prefixed_page_field }}=1" | ||
{% endif %} | ||
hx-trigger="click" | ||
hx-target="div.table-container" | ||
hx-swap="outerHTML" | ||
style="cursor: pointer;"> | ||
{{ column.header }} | ||
{% if column.orderable %} | ||
{% if column.order_by_alias == column.order_by_alias.next %} | ||
<i class="bi bi-arrow-down-short"></i> | ||
{% elif column.order_by_alias|slice:":1" == "-" %} | ||
<i class="bi bi-arrow-down-square-fill"></i> | ||
{% else %} | ||
<i class="bi bi-arrow-up-square-fill"></i> | ||
{% endif %} | ||
{% endif%} | ||
</th> | ||
{% endfor %} | ||
</tr> | ||
</thead> | ||
{% endif %} | ||
{% endblock table.thead %} | ||
|
||
{% block pagination %} | ||
{% if table.page and table.paginator.num_pages > 1 %} | ||
<nav aria-label="Table navigation"> | ||
<ul class="pagination justify-content-center mt-2"> | ||
{% if table.page.has_previous %} | ||
{% block pagination.previous %} | ||
<li class="previous page-item"> | ||
<div hx-get="{% querystring table.prefixed_page_field=table.page.previous_page_number %}" | ||
hx-trigger="click" | ||
hx-target="div.table-container" | ||
hx-swap="outerHTML" | ||
hx-indicator=".progress" | ||
class="page-link"> | ||
<span aria-hidden="true">«</span> | ||
{% trans 'previous' %} | ||
</div> | ||
</li> | ||
{% endblock pagination.previous %} | ||
{% endif %} | ||
{% if table.page.has_previous or table.page.has_next %} | ||
{% for p in table.page|table_page_range:table.paginator %} | ||
<li class="page-item{% if table.page.number == p %} active{% endif %}"> | ||
<div class="page-link" | ||
{% if p != '...' %}hx-get="{% querystring table.prefixed_page_field=p %}"{% endif %} | ||
hx-trigger="click" | ||
hx-target="div.table-container" | ||
hx-swap="outerHTML" | ||
hx-indicator=".progress"> | ||
{{ p }} | ||
</div> | ||
</li> | ||
{% endfor %} | ||
{% endif %} | ||
{% if table.page.has_next %} | ||
{% block pagination.next %} | ||
<li class="next page-item"> | ||
<div hx-get="{% querystring table.prefixed_page_field=table.page.next_page_number %}" | ||
hx-trigger="click" | ||
hx-target="div.table-container" | ||
hx-swap="outerHTML" | ||
hx-indicator=".progress" | ||
class="page-link"> | ||
{% trans 'next' %} | ||
<span aria-hidden="true">»</span> | ||
</div> | ||
</li> | ||
{% endblock pagination.next %} | ||
{% endif %} | ||
</ul> | ||
</nav> | ||
{% endif %} | ||
{% endblock pagination %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{% extends "base.html" %} | ||
|
||
{% load render_table from django_tables2 %} | ||
{% load i18n %} | ||
{% load crispy_forms_tags %} | ||
|
||
{% block content %} | ||
<h1>Events</h1> | ||
|
||
<form hx-get="{{ report_url }}" | ||
hx-target="div.table-container" | ||
hx-swap="outerHTML" | ||
hx-trigger="change" | ||
hx-push-url="true" | ||
class="form-inline"> | ||
{% crispy filter.form %} | ||
</form> | ||
|
||
{% render_table table %} | ||
{% endblock %} | ||
|
||
{% block javascript %} | ||
{{ block.super }} | ||
<!-- This is required for select2 'user' field--> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> | ||
|
||
<script> | ||
window.addEventListener("DOMContentLoaded", (e) => { | ||
$('select').on('select2:select', function (e) { | ||
$(this).closest('form').get(0).dispatchEvent(new Event('change')); | ||
}); | ||
}) | ||
</script> | ||
|
||
{% endblock %} | ||
|
||
{% block css %} | ||
{{ block.super }} | ||
<style> | ||
.select2-selection__rendered { | ||
line-height: initial!important; | ||
} | ||
</style> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters