From 3f9f4a695fb9a0d87288dc9387fb1fcf6fe38864 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 24 Jan 2018 19:16:45 +0100 Subject: UI: work on dashboards --- ishtar_common/static/media/styles.css | 4 + .../ishtar/dashboards/dashboard_main.html | 49 ++++--- .../ishtar/dashboards/dashboard_main_detail.html | 159 +++++++++++++++------ .../dashboards/dashboard_main_detail_users.html | 4 +- ishtar_common/views.py | 2 + 5 files changed, 154 insertions(+), 64 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/static/media/styles.css b/ishtar_common/static/media/styles.css index ff27f7477..46a1b556a 100644 --- a/ishtar_common/static/media/styles.css +++ b/ishtar_common/static/media/styles.css @@ -199,6 +199,10 @@ table.dataTable thead th, table.dataTable thead td { display: block; } +.chart-img{ + display: none; +} + /* à adapter */ #message, #message div{ diff --git a/ishtar_common/templates/ishtar/dashboards/dashboard_main.html b/ishtar_common/templates/ishtar/dashboards/dashboard_main.html index 827fcf02d..f2eefd6d3 100644 --- a/ishtar_common/templates/ishtar/dashboards/dashboard_main.html +++ b/ishtar_common/templates/ishtar/dashboards/dashboard_main.html @@ -13,25 +13,40 @@ {% endblock %} {% block content %} - -
-
- -
+
+
+ +
+
+ {% for label, app in app_list %} +
{% endfor %} +
+
+ {% endblock %} diff --git a/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html b/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html index 5ebb05af4..ac779abe0 100644 --- a/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html +++ b/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html @@ -1,64 +1,134 @@ -{% load i18n date_formating humanize %} -
-
+{% load i18n date_formating humanize table_form %} +

{% trans "Numbers" %}

{% if form %}
- {% csrf_token %} - {{form}} -
- + {% csrf_token %} + {% bs_form form %} +
+ +
{% endif %}

{% trans "Total:" %} {{dashboard.total_number|intcomma}}

-
-
-

{% trans 'Draw rectangle on the graph to zoom. Double-click to reinitialize.' %}

-
- -
-
-

{% trans 'Right-click on this image to save it.' %}

-
+
+
+

+ {% trans 'Draw rectangle on the graph to zoom. Double-click to reinitialize.' %} +

+
+
+ +
+
+
+
+
+
+ {% trans 'Right-click on this image to save it.' %} +
+
+
+
+
-
-
-
- +
+
{% for idx, lbl, values in dashboard.values %} - + {% for value in values reversed %}{% if forloop.parentloop.counter0 %}{%endif%}{% endfor%} {% endfor%}
{{lbl}}{% else %}{%endif%}{{value|date_formating }}{% if forloop.parentloop.counter0 %}{% else %}
-
-
+
{% if dashboard.periods %}

{% trans "By years" %}

-
    -
  • {% trans "Average:" %} {{dashboard.average}}
  • -
  • {% trans "Variance:" %} {{dashboard.variance}}
  • -
  • {% trans "Standard deviation:" %} {{dashboard.standard_deviation}}
  • -
  • {% trans "Median:" %} {{dashboard.median}}
  • -
  • {% trans "Mode:" %} {{dashboard.mode}}
  • -
+
+
+ {% trans "Average:" %} +
+
+ {{dashboard.average}} +
+ +
+ {% trans "Variance:" %} +
+
+ {{dashboard.variance}} +
+ +
+ {% trans "Standard deviation:" %} +
+
+ {{dashboard.standard_deviation}} +
+
+ {% trans "Median:" %} +
+
+ {{dashboard.median}} +
+
+ {% trans "Mode:" %} +
+
+ {{dashboard.mode}} +
+
+
{% endif %} {% if dashboard.operation_average %}

{% trans "By operations" %}

-
    -
  • {% trans "Average:" %} {{dashboard.operation_average}}
  • -
  • {% trans "Variance:" %} {{dashboard.operation_variance}}
  • -
  • {% trans "Standard deviation:" %} {{dashboard.operation_standard_deviation}}
  • -
  • {% trans "Median:" %} {{dashboard.operation_median}}
  • -
  • {% trans "Mode:" %} {{dashboard.operation_mode}}
  • -
+
+
+ {% trans "Average:" %} +
+
+ {{dashboard.operation_average}} +
+ +
+ {% trans "Variance:" %} +
+
+ {{dashboard.operation_variance}} +
+ +
+ {% trans "Standard deviation:" %} +
+
+ {{dashboard.operation_standard_deviation}} +
+
+ {% trans "Median:" %} +
+
+ {{dashboard.operation_median}} +
+
+ {% trans "Mode:" %} +
+
+ {{dashboard.operation_mode}} +
+
+
{% endif %} -

{% trans "Created last" %}

- +
{% for item in dashboard.lasts %} @@ -68,10 +138,9 @@ {%endif%}{% endfor %}
{{lbl}}{% trans "Created" %}
{{item}}
-
-
+

{% trans "Recent changes" %}

- +
{% for item in dashboard.recents %} @@ -81,8 +150,7 @@ {%endif%}{% endfor %}
{{lbl}}{% trans "Modified" %}
{{item}}
-
-
+
diff --git a/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail_users.html b/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail_users.html index 6ffd8c3c9..4d9857bec 100644 --- a/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail_users.html +++ b/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail_users.html @@ -21,8 +21,7 @@ var plot_users = jQuery.jqplot ('user_chart', [values_users], });
-
- +
{% for user_type in ishtar_users.types %} @@ -31,6 +30,5 @@ var plot_users = jQuery.jqplot ('user_chart', [values_users], {% endfor%}
{% trans "User type" %}{% trans "Number" %}
-
diff --git a/ishtar_common/views.py b/ishtar_common/views.py index b0365c1cf..301860ae3 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -1521,6 +1521,7 @@ def dashboard_main(request, dct, obj_id=None, *args, **kwargs): dct = {'app_list': app_list} return render(request, 'ishtar/dashboards/dashboard_main.html', dct) + DASHBOARD_FORMS = { 'files': DashboardFormFile, 'operations': DashboardFormOpe, 'treatments': DashboardTreatmentForm, @@ -1655,6 +1656,7 @@ def merge_action(model, form, key): return merge + person_merge = merge_action(models.Person, forms.MergePersonForm, 'person') organization_merge = merge_action( models.Organization, -- cgit v1.2.3