summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ishtar_common/static/media/styles.css4
-rw-r--r--ishtar_common/templates/ishtar/dashboards/dashboard_main.html49
-rw-r--r--ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html159
-rw-r--r--ishtar_common/templates/ishtar/dashboards/dashboard_main_detail_users.html4
-rw-r--r--ishtar_common/views.py2
5 files changed, 154 insertions, 64 deletions
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 @@
<link rel="stylesheet" href="{{STATIC_URL}}js/jqplot/jquery.jqplot.min.css?ver={{VERSION}}" />
{% endblock %}
{% block content %}
- <script>
+<script type="text/javascript">
$(function() {
- $( "#dash-tabs" ).tabs({
- beforeActivate: function( event, ui ) {
- $('.modal-progress').modal('show');
- },
- load: function( event, ui ) {
- $('.modal-progress').modal('hide');
- }
- });
+ $('#dashboard .nav-link').click(function () {
+ var url = $(this).attr('data-url');
+ $("#dashboard .card-body").load(url);
+ $('#dashboard li').removeClass('active');
+ $('#dashboard li').removeClass('show');
+ $(this).parent().tab('show');
+ })
+ $('#dashboard li:first-child a').click();
});
+
</script>
-<div id='dashboard'>
- <div id="dash-tabs">
- <ul>
- {% for label, app in app_list %}
- <li><a href="{% url 'dashboard-main-detail' app %}">{{label}}</a></li>{% endfor %}
- <li><a href="{% url 'dashboard-main-detail' 'users' %}">{% trans "Users" %}</a></li>
- </ul>
- </div>
+<div id='dashboard' class="card">
+ <div class="card-header">
+ <ul class="nav nav-tabs card-header-tabs">
+ {% for label, app in app_list %}
+ <li class="nav-item" id="{{app}}-tab">
+ <a class="nav-link" href="#{{app}}-pane"
+ data-url="{% url 'dashboard-main-detail' app %}">{{label}}</a>
+ </li>{% endfor %}
+ <li class="nav-item" id="users-tab">
+ <a class="nav-link" href="#users-pane"
+ data-url="{% url 'dashboard-main-detail' 'users' %}">{% trans "Users" %}</a>
+ </li>
+ </ul>
+ </div>
+ <div class="card-body tab-content">
+ {% for label, app in app_list %}
+ <div class="tab-pane{% if forloop.counter0 == 0%} active{% endif %}" id="{{app}}-pane"
+ role="tabpanel" aria-labelledby="{{app}}-tab"></div>{% endfor %}
+ <div class="tab-pane" id="users-pane" role="tabpanel"
+ aria-labelledby="users-tab"></div>
+ </div>
</div>
+
{% 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 %}
-<div class='dashboard' id="{{unique_id}}-tab">
- <div>
+{% load i18n date_formating humanize table_form %}
+<div id="{{unique_id}}-tab">
<h4>{% trans "Numbers" %}</h4>
{% if form %}
<div class='form'>
<form method='post' action="{% url 'dashboard-main-detail' item_name %}" id='{{unique_id}}_form'>
- <table>{% csrf_token %}
- {{form}}
- </table>
- <button id="search_{{unique_id}}" class="submit">{% trans "Change" %}</button>
+ {% csrf_token %}
+ {% bs_form form %}
+ <div class="text-center">
+ <button type='button' id="search_{{unique_id}}"
+ class="btn btn-primary">
+ {% trans "Change" %}</button>
+ </div>
</form>
</div>
{% endif %}
<p><strong>{% trans "Total:" %}</strong> {{dashboard.total_number|intcomma}}</p>
- <div class='table'>
- <div id="chart_{{unique_id}}" style="height:400px; width:700px;"></div>
- <p class='info-box'><i class="fa fa-info-circle" aria-hidden="true"></i> {% trans 'Draw rectangle on the graph to zoom. Double-click to reinitialize.' %}</p>
- <div class='form chart-img-form'>
- <button id="chart_img_display_{{unique_id}}" class='submit'>{% trans "Display as an image" %}</button>
- <div id="chart_img_{{unique_id}}" class='chart-img'>
- <div id="img_{{unique_id}}"></div>
- <p class='info-box'><i class="fa fa-info-circle" aria-hidden="true"></i> {% trans 'Right-click on this image to save it.' %}</p>
- </div>
+ <div>
+ <div id="chart_{{unique_id}}"
+ style="height:400px; width:700px; margin-right:auto; margin-left:auto"></div>
+ <p class='alert alert-info'>
+ {% trans 'Draw rectangle on the graph to zoom. Double-click to reinitialize.' %}
+ </p>
+ <div class='form chart-img-form'>
+ <div class="text-center">
+ <button id="chart_img_display_{{unique_id}}"
+ type='button' class='btn btn-secondary'>
+ {% trans "Display as an image" %}
+ </button>
+ </div>
+ <div id="chart_img_{{unique_id}}" class='chart-img'>
+ <div class="card">
+ <div id="img_{{unique_id}}"
+ class="card-img-top text-center"></div>
+ <div class="card-body">
+ <div class='alert alert-info'>
+ {% trans 'Right-click on this image to save it.' %}
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
</div>
- </div>
- <div class='clean-table'>
- <div class='clean-table-wrap'>
- <table>
+ <hr>
+ <table class="table table-striped">
{% for idx, lbl, values in dashboard.values %}
- <tr class='idx {% if forloop.counter0|divisibleby:"2" %}even{%else%}odd{%endif%}'>
+ <tr>
<th>{{lbl}}</th>
{% for value in values reversed %}{% if forloop.parentloop.counter0 %}<td>{% else %}<th>{%endif%}{{value|date_formating }}{% if forloop.parentloop.counter0 %}</td>{% else %}</th>{%endif%}{% endfor%}
</tr>
{% endfor%}
</table>
- </div>
- </div>
+ <hr>
{% if dashboard.periods %}
<h4>{% trans "By years" %}</h4>
- <ul>
- <li><strong>{% trans "Average:" %}</strong> {{dashboard.average}}</li>
- <li><strong>{% trans "Variance:" %}</strong> {{dashboard.variance}}</li>
- <li><strong>{% trans "Standard deviation:" %}</strong> {{dashboard.standard_deviation}}</li>
- <li><strong>{% trans "Median:" %}</strong> {{dashboard.median}}</li>
- <li><strong>{% trans "Mode:" %}</strong> {{dashboard.mode}}</li>
- </ul>
+ <dl class="row">
+ <dt class="col-sm-3">
+ {% trans "Average:" %}
+ </dt>
+ <dd class="col-sm-9">
+ {{dashboard.average}}
+ </dd>
+
+ <dt class="col-sm-3">
+ {% trans "Variance:" %}
+ </dt>
+ <dd class="col-sm-9">
+ {{dashboard.variance}}
+ </dd>
+
+ <dt class="col-sm-3">
+ {% trans "Standard deviation:" %}
+ </dt>
+ <dd class="col-sm-9">
+ {{dashboard.standard_deviation}}
+ </dd>
+ <dt class="col-sm-3">
+ {% trans "Median:" %}
+ </dt>
+ <dd class="col-sm-9">
+ {{dashboard.median}}
+ </dd>
+ <dt class="col-sm-3">
+ {% trans "Mode:" %}
+ </dt>
+ <dd class="col-sm-9">
+ {{dashboard.mode}}
+ </dd>
+ </dl>
+ <hr>
{% endif %}
{% if dashboard.operation_average %}
<h4>{% trans "By operations" %}</h4>
- <ul>
- <li><strong>{% trans "Average:" %}</strong> {{dashboard.operation_average}}</li>
- <li><strong>{% trans "Variance:" %}</strong> {{dashboard.operation_variance}}</li>
- <li><strong>{% trans "Standard deviation:" %}</strong> {{dashboard.operation_standard_deviation}}</li>
- <li><strong>{% trans "Median:" %}</strong> {{dashboard.operation_median}}</li>
- <li><strong>{% trans "Mode:" %}</strong> {{dashboard.operation_mode}}</li>
- </ul>
+ <dl class="row">
+ <dt class="col-sm-3">
+ {% trans "Average:" %}
+ </dt>
+ <dd class="col-sm-9">
+ {{dashboard.operation_average}}
+ </dd>
+
+ <dt class="col-sm-3">
+ {% trans "Variance:" %}
+ </dt>
+ <dd class="col-sm-9">
+ {{dashboard.operation_variance}}
+ </dd>
+
+ <dt class="col-sm-3">
+ {% trans "Standard deviation:" %}
+ </dt>
+ <dd class="col-sm-9">
+ {{dashboard.operation_standard_deviation}}
+ </dd>
+ <dt class="col-sm-3">
+ {% trans "Median:" %}
+ </dt>
+ <dd class="col-sm-9">
+ {{dashboard.operation_median}}
+ </dd>
+ <dt class="col-sm-3">
+ {% trans "Mode:" %}
+ </dt>
+ <dd class="col-sm-9">
+ {{dashboard.operation_mode}}
+ </dd>
+ </dl>
+ <hr>
{% endif %}
- <div class='clean-table'>
<h4>{% trans "Created last" %}</h4>
- <table>
+ <table class="table table-striped">
<tr><th>{{lbl}}</th><th>{% trans "Created" %}</th><th></th></tr>
{% for item in dashboard.lasts %}<tr>
<td class='ref'>{{item}}</td>
@@ -68,10 +138,9 @@
</a>{%endif%}</td>
</tr>{% endfor %}
</table>
- </div>
- <div class='clean-table'>
+ <hr>
<h4>{% trans "Recent changes" %}</h4>
- <table>
+ <table class="table table-striped">
<tr><th>{{lbl}}</th><th>{% trans "Modified" %}</th><th></th></tr>
{% for item in dashboard.recents %}<tr>
<td class='ref'>{{item}}</td>
@@ -81,8 +150,7 @@
</a>{%endif%}</td>
</tr>{% endfor %}
</table>
- </div>
- </div>
+</div>
<script language="javascript" type="text/javascript">
$(document).ready(function(){
@@ -177,9 +245,12 @@ $('#search_{{unique_id}}').click(function (){
return false;
});
+/*
{% if item_name == 'files' or item_name == "operations" or item_name == "treatments" or item_name == "treatmentfiles" %}
load_jquerydate_{{item_name}}_after();
load_jquerydate_{{item_name}}_before();
{% endif %}
+*/
+
});
</script>
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],
});
</script>
<div id="user_chart" style="height:300px; width:700px;"></div>
- <div class='table'>
- <table class='resume'>
+ <table class='table table-striped'>
<tr><th>{% trans "User type" %}</th><th>{% trans "Number" %}</th></tr>
{% for user_type in ishtar_users.types %}
<tr>
@@ -31,6 +30,5 @@ var plot_users = jQuery.jqplot ('user_chart', [values_users],
</tr>
{% endfor%}
</table>
- </div>
</div>
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,