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,92 +16,85 @@
<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">
{% trans "Current Ticket Stats" %}
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<tbody>
<tr>
<td>{% trans "Average number of days until ticket is closed (all tickets): " %}</td>
<td><strong style="color: red;">{{ basic_ticket_stats.average_nbr_days_until_ticket_closed }}</strong>.</td>
</tr>
<tr>
<td>{% trans "Average number of days until ticket is closed (tickets opened in last 60 days): " %}</td>
<td><strong style="color: red;">{{ basic_ticket_stats.average_nbr_days_until_ticket_closed_last_60_days }}</strong>. {% trans "Click" %} <strong><a href="{% url 'helpdesk:report_index' %}daysuntilticketclosedbymonth">here</a></strong> {% trans "for detailed average by month." %} </td>
</tr>
</tbody>
</table>
</div>
<!-- /.table-responsive -->
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>{% trans "Queue" %}</th>
<th>{% trans "Open" %}</th>
<th>{% trans "Resolved" %}</th>
<th>{% trans "Closed" %}</th>
</tr>
</thead>
<tbody>
{% for queue in dash_tickets %}
<tr>{% url 'helpdesk:list' as hdlist %}
<td><a href='{{ hdlist }}?queue={{ queue.queue }}&status=1&status=2'>{{ queue.name }}</a></td>
<td>{% if queue.open %}<a href='{{ hdlist }}?queue={{ queue.queue }}&status=1&status=2'>{% endif %}{{ queue.open }}{% if queue.open %}</a>{% endif %}</td>
<td>{% if queue.resolved %}<a href='{{ hdlist }}?queue={{ queue.queue }}&status=3'>{% endif %}{{ queue.resolved }}{% if queue.resolved %}</a>{% endif %}</td>
<td>{% if queue.closed %}<a href='{{ hdlist }}?queue={{ queue.queue }}&status=4'>{% endif %}{{ queue.closed }}{% if queue.closed %}</a>{% endif %}</td>
</tr>
{% empty %}
<tr><td colspan='6'>{% trans "There are no unassigned tickets." %}</td></tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- /.table-responsive -->
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
</div>
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-info-circle"></i>
{% trans "Current Ticket Stats" %}
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<tbody>
<tr>
<td>{% trans "Average number of days until ticket is closed (all tickets): " %}</td>
<td><strong style="color: red;">{{ basic_ticket_stats.average_nbr_days_until_ticket_closed }}</strong>.</td>
</tr>
<tr>
<td>{% trans "Average number of days until ticket is closed (tickets opened in last 60 days): " %}</td>
<td><strong style="color: red;">{{ basic_ticket_stats.average_nbr_days_until_ticket_closed_last_60_days }}</strong>. {% trans "Click" %} <strong><a href="{% url 'helpdesk:report_index' %}daysuntilticketclosedbymonth">here</a></strong> {% trans "for detailed average by month." %} </td>
</tr>
</tbody>
</table>
</div>
<!-- /.table-responsive -->
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>{% trans "Queue" %}</th>
<th>{% trans "Open" %}</th>
<th>{% trans "Resolved" %}</th>
<th>{% trans "Closed" %}</th>
</tr>
</thead>
<tbody>
{% for queue in dash_tickets %}
<tr>{% url 'helpdesk:list' as hdlist %}
<td><a href='{{ hdlist }}?queue={{ queue.queue }}&status=1&status=2'>{{ queue.name }}</a></td>
<td>{% if queue.open %}<a href='{{ hdlist }}?queue={{ queue.queue }}&status=1&status=2'>{% endif %}{{ queue.open }}{% if queue.open %}</a>{% endif %}</td>
<td>{% if queue.resolved %}<a href='{{ hdlist }}?queue={{ queue.queue }}&status=3'>{% endif %}{{ queue.resolved }}{% if queue.resolved %}</a>{% endif %}</td>
<td>{% if queue.closed %}<a href='{{ hdlist }}?queue={{ queue.queue }}&status=4'>{% endif %}{{ queue.closed }}{% if queue.closed %}</a>{% endif %}</td>
</tr>
{% empty %}
<tr><td colspan='6'>{% trans "There are no unassigned tickets." %}</td></tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- /.table-responsive -->
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading">
{% trans "Generate Report" %}
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<ul>
<li>{% trans "Reports By User" %}
<ul>
<li><a href='userpriority/{% if saved_query %}?saved_query={{ saved_query }}{% endif %}'>{% trans "by Priority" %}</a></li>
<li><a href='userqueue/{% if saved_query %}?saved_query={{ saved_query }}{% endif %}'>{% trans "by Queue" %}</a></li>
<li><a href='userstatus/{% if saved_query %}?saved_query={{ saved_query }}{% endif %}'>{% trans "by Status" %}</a></li>
<li><a href='usermonth/{% if saved_query %}?saved_query={{ saved_query }}{% endif %}'>{% trans "by Month" %}</a></li>
</ul>
</li>
<li>{% trans "Reports By Queue" %}
<ul>
<li><a href='queuepriority/{% if saved_query %}?saved_query={{ saved_query }}{% endif %}'>{% trans "by Priority" %}</a></li>
<li><a href='queuestatus/{% if saved_query %}?saved_query={{ saved_query }}{% endif %}'>{% trans "by Status" %}</a></li>
<li><a href='queuemonth/{% if saved_query %}?saved_query={{ saved_query }}{% endif %}'>{% trans "by Month" %}</a></li>
<li><a href='daysuntilticketclosedbymonth/{% if saved_query %}?saved_query={{ saved_query }}{% endif %}'>{% trans "Days until ticket closed by Month" %}</a></li>
</ul>
</li>
</ul>
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
</div>
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-print"></i>
{% trans "Generate Report" %}
</div>
<div class="card-body">
<ul>
<li>{% trans "Reports By User" %}
<ul>
<li><a href='userpriority/{% if saved_query %}?saved_query={{ saved_query }}{% endif %}'>{% trans "by Priority" %}</a></li>
<li><a href='userqueue/{% if saved_query %}?saved_query={{ saved_query }}{% endif %}'>{% trans "by Queue" %}</a></li>
<li><a href='userstatus/{% if saved_query %}?saved_query={{ saved_query }}{% endif %}'>{% trans "by Status" %}</a></li>
<li><a href='usermonth/{% if saved_query %}?saved_query={{ saved_query }}{% endif %}'>{% trans "by Month" %}</a></li>
</ul>
</li>
<li>{% trans "Reports By Queue" %}
<ul>
<li><a href='queuepriority/{% if saved_query %}?saved_query={{ saved_query }}{% endif %}'>{% trans "by Priority" %}</a></li>
<li><a href='queuestatus/{% if saved_query %}?saved_query={{ saved_query }}{% endif %}'>{% trans "by Status" %}</a></li>
<li><a href='queuemonth/{% if saved_query %}?saved_query={{ saved_query }}{% endif %}'>{% trans "by Month" %}</a></li>
<li><a href='daysuntilticketclosedbymonth/{% if saved_query %}?saved_query={{ saved_query }}{% endif %}'>{% trans "Days until ticket closed by Month" %}</a></li>
</ul>
</li>
</ul>
</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'>