Fix templates and javascript for reports

This commit is contained in:
Garret Wassermann 2018-12-21 22:37:33 -05:00
parent d5a06a8082
commit 7c64a01e6f
2 changed files with 151 additions and 160 deletions

View File

@ -16,14 +16,12 @@
<p>{% trans "You haven't created any tickets yet, so you cannot run any reports." %}</p>
{% else %}
<div class="row">
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading">
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-info-circle"></i>
{% trans "Current Ticket Stats" %}
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<tbody>
@ -65,20 +63,16 @@
</div>
<!-- /.table-responsive -->
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading">
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-print"></i>
{% trans "Generate Report" %}
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="card-body">
<ul>
<li>{% trans "Reports By User" %}
<ul>
@ -98,10 +92,9 @@
</li>
</ul>
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
{% endif %}{% endblock %}
{% endif %}
{% endblock %}

View File

@ -5,6 +5,77 @@
{% block helpdesk_head %}
{% endblock %}
{% block helpdesk_breadcrumb %}
<li class="breadcrumb-item">
<a href="{% url 'helpdesk:report_index' %}">{% trans "Reports &amp; Statistics" %}</a>
</li>
<li class="breadcrumb-item active">{{ title }}</li>
{% endblock %}
{% block helpdesk_body %}
<h2>{% trans "Reports &amp; Statistics" %}</h2>
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-filter"></i>
{% trans 'Saved Queries' %}
</div>
<div class="card-body">
{% if user_saved_queries_ %}
<p>{% trans "You can run this query on filtered data by using one of your saved queries." %}</p>
<form method='GET' action='./'>
<label for='saved_query'>{% trans "Select Query:" %}</label>
<select name='saved_query'>
<option value="">--------</option>{% for q in user_saved_queries_ %}
<option value="{{ q.id }}"{% ifequal saved_query q %} selected{% endifequal %}>{{ q.title }}</option>{% endfor %}
</select>
<input class="btn btn-primary" type='submit' value='{% trans "Filter Report" %}'>
</form>
{% else %}
<p>{% trans "Want to filter this report to just show a subset of data? Go to the Ticket List, filter your query, and save your query." %}</p>
{% endif %}
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-chart-line"></i>
{{ title }}
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>{% for h in headings %}
<th>{% if forloop.first %}{{ h|title }}{% else %}{{ h }}{% endif %}</th>{% endfor %}
</tr>
</thead>
<tbody>
{% for d in data %}
<tr class='row_{% cycle 'odd' 'even' %}'>
{% for f in d %}<td class='report'>{{ f }}</td>{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- /.table-responsive -->
<div class="flot-chart">
<div class="flot-chart-content" id="chart-content"></div>
</div>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
{% endblock %}
{% block helpdesk_js %}
<!-- Flot Charts JavaScript -->
<script src="/static/helpdesk/vendor/flot/excanvas.min.js"></script>
<script src="/static/helpdesk/vendor/flot/jquery.flot.js"></script>
@ -23,79 +94,6 @@
<script src="{% static 'helpdesk/vendor/morrisjs/morris.min.js' %}"></script>
{% endif %}
{% endblock %}
{% block helpdesk_breadcrumb %}
<li class="breadcrumb-item">
<a href="{% url 'helpdesk:report_index' %}">{% trans "Reports &amp; Statistics" %}</a>
</li>
<li class="breadcrumb-item active">{{ title }}</li>
{% endblock %}
{% block helpdesk_body %}
<h2>{% trans "Reports &amp; Statistics" %}</h2>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading">
{% trans 'Saved Queries' %}
</div>
<!-- /.panel-heading -->
<div class="panel-body">
{% if user_saved_queries_ %}
<p>{% trans "You can run this query on filtered data by using one of your saved queries." %}</p>
<form method='GET' action='./'>
<label for='saved_query'>{% trans "Select Query:" %}</label>
<select name='saved_query'>
<option value="">--------</option>{% for q in user_saved_queries_ %}
<option value="{{ q.id }}"{% ifequal saved_query q %} selected{% endifequal %}>{{ q.title }}</option>{% endfor %}
</select>
<input class="btn btn-primary" type='submit' value='{% trans "Filter Report" %}'>
</form>
{% else %}
<p>{% trans "Want to filter this report to just show a subset of data? Go to the Ticket List, filter your query, and save your query." %}</p>
{% endif %}
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading">
{{ title }}
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>{% for h in headings %}
<th>{% if forloop.first %}{{ h|title }}{% else %}{{ h }}{% endif %}</th>{% endfor %}
</tr>
</thead>
<tbody>
{% for d in data %}<tr class='row_{% cycle 'odd' 'even' %}'>
{% for f in d %}<td class='report'>{{ f }}</td>{% endfor %}
</tr>{% endfor %}
</tbody>
</table>
</div>
<!-- /.table-responsive -->
<div class="flot-chart">
<div class="flot-chart-content" id="chart-content"></div>
</div>
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
</div>
{% if charttype == "date" %}
<script type='text/javascript'>