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

View File

@ -5,6 +5,77 @@
{% block helpdesk_head %} {% 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 --> <!-- Flot Charts JavaScript -->
<script src="/static/helpdesk/vendor/flot/excanvas.min.js"></script> <script src="/static/helpdesk/vendor/flot/excanvas.min.js"></script>
<script src="/static/helpdesk/vendor/flot/jquery.flot.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> <script src="{% static 'helpdesk/vendor/morrisjs/morris.min.js' %}"></script>
{% endif %} {% 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" %} {% if charttype == "date" %}
<script type='text/javascript'> <script type='text/javascript'>