django-helpdeskmig/helpdesk/templates/helpdesk/ticket_list.html
2014-07-22 16:09:06 +02:00

264 lines
13 KiB
HTML

{% extends "helpdesk/base.html" %}{% load i18n humanize %}{% load url from future %}
{% block helpdesk_title %}{% trans "Tickets" %}{% endblock %}
{% block helpdesk_head %}
<script type='text/javascript' language='javascript' src='{{ STATIC_URL }}helpdesk/filter.js'></script>
<script type='text/javascript' language='javascript'>
$(document).ready(function() {
// Enable Tabs
$("#searchtabs").tabs({
collapsible:true
});
// Hide all tabs by default
$("#searchtabs > ul > li").removeClass().addClass("ui-corner-top ui-state-default");
$("#searchtabs > div").addClass("ui-tabs-hide");
$("#select_all").click(function() {
$(".ticket_multi_select").attr('checked', true);
return false;
});
$("#select_none").click(function() {
$(".ticket_multi_select").attr('checked', false);
return false;
});
$("#select_inverse").click(function() {
$(".ticket_multi_select").each(function() {
$(this).attr('checked', !$(this).attr('checked'));
});
return false;
});
});
</script>
{% endblock %}
{% block h1_title %}Tickets
{% if from_saved_query %} [{{ saved_query.title }}]{% endif %}{% endblock %}
{% block helpdesk_body %}
{% load in_list %}
<div id="searchtabs" class="row">
{% comment %}<ul>
<li><a href='#tabfilter'>{% trans "Query Options" %}</a></li>
{% if not from_saved_query %}
<li><a href='#tabsave'>{% trans "Save This Query" %}</a></li>
{% endif %}
{% if user_saved_queries %}
<li><a href='#tabload'>{% trans "Load Saved Query" %}</a></li>
{% endif %}
</ul>{% endcomment %}
<div class="panel-group filter-options" id="accordion">
<div id='tabfilter' class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
{% trans "Change Query" %}
</a>
</h3>
</div>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
<form>
<select name='select' id='filterBuilderSelect'>
<option value='Sort'>{% trans "Sorting" %}</option>
<option value='Owner'>{% trans "Owner" %}</option>
<option value='Queue'>{% trans "Queue" %}</option>
<option value='Status'>{% trans "Status" %}</option>
<option value='Keywords'>{% trans "Keywords" %}</option>
<option value='Dates'>{% trans "Date Range" %}</option>
</select>
<input type='button' id='filterBuilderButton' value='+' />
{% csrf_token %}</form>
<form method='get' action='./'>
<div class='thumbnail filterBox{% if query_params.sorting %} filterBoxShow{% endif %}' id='filterBoxSort'>
<label for='id_sort'>{% trans "Sorting" %}</label>
<select id='id_sort' name='sort'>
<option value='created'{% ifequal query_params.sorting "created"%} selected='selected'{% endifequal %}>
{% trans "Created" %}
</option>
<option value='title'{% ifequal query_params.sorting "title"%} selected='selected'{% endifequal %}>
{% trans "Title" %}
</option>
<option value='queue'{% ifequal query_params.sorting "queue"%} selected='selected'{% endifequal %}>
{% trans "Queue" %}
</option>
<option value='status'{% ifequal query_params.sorting "status"%} selected='selected'{% endifequal %}>
{% trans "Status" %}
</option>
<option value='priority'{% ifequal query_params.sorting "priority"%} selected='selected'{% endifequal %}>
{% trans "Priority" %}
</option>
<option value='assigned_to'{% ifequal query_params.sorting "assigned_to"%} selected='selected'{% endifequal %}>
{% trans "Owner" %}
</option>
</select>
<label for='id_sortreverse'>{% trans "Reverse" %}</label>
<input type='checkbox' name='sortreverse' id='id_sortreverse'{% if query_params.sortreverse %} checked='checked'{% endif %} />
<p class='filterHelp'>{% trans "Ordering applied to tickets" %}</p>
<input type='button' class='filterBuilderRemove' value='-' />
</div>
<div class='thumbnail filterBox{% if query_params.filtering.assigned_to__id__in %} filterBoxShow{% endif %}' id='filterBoxOwner'>
<label for='id_owners'>{% trans "Owner(s)" %}</label>
<select id='id_owners' name='assigned_to' multiple='selected' size='5'>
{% for u in user_choices %}
<option value='{{ u.id }}'{% if u.id|in_list:query_params.filtering.assigned_to__id__in %} selected='selected'{% endif %}>
{{ u.username }}{% ifequal u user %} {% trans "(ME)" %}{% endifequal %}
</option>
{% endfor %}
</select>
<p class='filterHelp'>{% trans "Ctrl-Click to select multiple options" %}</p>
<input type='button' class='filterBuilderRemove' value='-' />
</div>
<div class='thumbnail filterBox{% if query_params.filtering.queue__id__in %} filterBoxShow{% endif %}' id='filterBoxQueue'>
<label for='id_queues'>{% trans "Queue(s)" %}</label><select id='id_queues' name='queue' multiple='selected' size='5'>{% for q in queue_choices %}<option value='{{ q.id }}'{% if q.id|in_list:query_params.filtering.queue__id__in %} selected='selected'{% endif %}>{{ q.title }}</option>{% endfor %}</select>
<p class='filterHelp'>{% trans "Ctrl-click to select multiple options" %}</p>
<input type='button' class='filterBuilderRemove' value='-' />
</div>
<div class='thumbnail filterBox{% if query_params.filtering.status__in %} filterBoxShow{% endif %}' id='filterBoxStatus'>
<label for='id_statuses'>{% trans "Status(es)" %}</label><select id='id_statuses' name='status' multiple='selected' size='5'>{% for s in status_choices %}<option value='{{ s.0 }}'{% if s.0|in_list:query_params.filtering.status__in %} selected='selected'{% endif %}>{{ s.1 }}</option>{% endfor %}</select>
<p class='filterHelp'>{% trans "Ctrl-click to select multiple options" %}</p>
<input type='button' class='filterBuilderRemove' value='-' />
</div>
<div class='thumbnail filterBox{% if query_params.filtering.created__gte or query_params.filtering.created__lte %} filterBoxShow{% endif %}' id='filterBoxDates'>
<label for='id_date_from'>{% trans "Date (From)" %}</label><input type='text' name='date_from' value='{{ query_params.filtering.created__gte }}' id='id_date_from' />
<label for='id_date_to'>{% trans "Date (To)" %}</label><input type='text' name='date_to' value='{{ query_params.filtering.created__lte }}' id='id_date_to' />
<p class='filterHelp'>{% trans "Use YYYY-MM-DD date format, eg 2011-05-29" %}</p>
<input type='button' class='filterBuilderRemove' value='-' />
</div>
<div class='thumbnail filterBox{% if query %} filterBoxShow{% endif %}' id='filterBoxKeywords'>
<label for='id_query'>{% trans "Keywords" %}</label><input type='text' name='q' value='{{ query }}' id='id_query' />
<p class='filterHelp'>{% trans "Keywords are case-insensitive, and will be looked for in the title, body and submitter fields." %}</p>
<input type='button' class='filterBuilderRemove' value='-' />
</div>
<hr style='clear: both;' />
<input class="btn btn-primary" type='submit' value='{% trans "Apply Filter" %}' />
{% if from_saved_query and saved_query.user == user %}
<p>{% blocktrans with saved_query.title as query_name %}You are currently viewing saved query <strong>"{{ query_name }}"</strong>.{% endblocktrans %} <a href='{% url 'helpdesk_delete_query' saved_query.id %}'>{% trans "Delete Saved Query" %}</a></p>
{% endif %}
{% if from_saved_query %}
<p>{% blocktrans with saved_query.id as query_id %}<a href='../reports/?saved_query={{ query_id }}'>Run a report</a> on this query to see stats and charts for the data listed below.{% endblocktrans %}</p>
{% endif %}
{% csrf_token %}</form>
</div>
</div>
</div>
{% if not from_saved_query %}
<div class='panel panel-default' id='tabsave'>
<div class="panel-heading">
<h3 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
{% trans "Save Query" %}</a>
</h3>
</div>
<div id="collapseTwo" class="panel-collapse collapse">
<div class="panel-body">
<form method='post' action='{% url 'helpdesk_savequery' %}'>
<input type='hidden' name='query_encoded' value='{{ urlsafe_query }}' />
<dl>
<dt><label for='id_title'>{% trans "Query Name" %}</label></dt>
<dd><input type='text' name='title' id='id_title' /></dd>
<dd class='form_help_text'>{% trans "This name appears in the drop-down list of saved queries. If you share your query, other users will see this name, so choose something clear and descriptive!" %}</dd>
<dt><label for='id_shared'>{% trans "Shared?" %}</label></dt>
<dd><input type='checkbox' name='shared' id='id_shared' /> {% trans "Yes, share this query with other users." %}</dd>
<dd class='form_help_text'>{% trans "If you share this query, it will be visible by <em>all</em> other logged-in users." %}</dd>
</dl>
<div class='buttons'>
<input class="btn btn-primary" type='submit' value='{% trans "Save Query" %}'>
</div>
{% csrf_token %}</form>
</div>
</div>
</div>
{% endif %}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
{% trans "Use Saved Query" %}
</a>
</h3>
</div>
<div id="collapseThree" class="panel-collapse collapse">
<div class="panel-body">
<form method='get' action='{% url 'helpdesk_list' %}'>
<p><label for='id_query_selector'>{% trans "Query" %}</label> <select name='saved_query' id='id_query_selector'>
{% for q in user_saved_queries %}
<option value='{{ q.id }}'>{{ q.title }}{% if q.shared %} (Shared{% ifnotequal user q.user %} by {{ q.user.username }}{% endifnotequal %}){% endif %}</option>
{% endfor %}
</select></p>
<input class="btn btn-primary" type='submit' value='{% trans "Run Query" %}'>
{% csrf_token %}</form>
</div>
</div>
</div>
</div>
</div>
<div class="row">
{{ search_message|safe }}
<form method='post' action='{% url 'helpdesk_mass_update' %}' id="ticket_mass_update">
<table class="table table-hover table-bordered table-striped">
<caption>{% trans "Tickets" %}</caption>
<thead>
<tr><th>#</th><th>&nbsp;</th><th>{% trans "Pr" %}</th><th>{% trans "Title" %}</th><th>{% trans "Queue" %}</th><th>{% trans "Status" %}</th><th>{% trans "Created" %}</th><th>{% trans "Owner" %}</th></tr>
</thead>
<tbody>
{% for ticket in tickets.object_list %}
<tr>
<th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.ticket }}</a></th>
<td><input type='checkbox' name='ticket_id' value='{{ ticket.id }}' class='ticket_multi_select' /></td>
<td>{{ ticket.get_priority_span }}</td>
<th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.title }}</a></th>
<td>{{ ticket.queue }}</td>
<td>{{ ticket.get_status }}</td>
<td><span title='{{ ticket.created|date:"r" }}'>{{ ticket.created|naturaltime }}</span></td>
<td>{{ ticket.get_assigned_to }}</td>
</tr>
{% empty %}
<tr><td colspan='5'>{% trans "No Tickets Match Your Selection" %}</td></tr>
{% endfor %}
</tbody>
</table>
<div class="pagination">
<span class="step-links">
{% if tickets.has_previous %}
<a href="?{% if query_string %}{{ query_string }}&amp;{% endif %}page={{ tickets.previous_page_number }}">{% trans "Previous" %}</a>
{% endif %}
<span class="current">
{% blocktrans with tickets.number as ticket_num and tickets.paginator.num_pages as num_pages %}Page {{ ticket_num }} of {{ num_pages }}.{% endblocktrans %}
</span>
{% if tickets.has_next %}
<a href="?{% if query_string %}{{ query_string }}&amp;{% endif %}page={{ tickets.next_page_number }}">{% trans "Next" %}</a>
{% endif %}
</span>
</div>
<p><label>{% trans "Select:" %} </label> <a href='#select_all' id='select_all'>{% trans "All" %}</a> <a href='#select_none' id='select_none'>{% trans "None" %}</a> <a href='#select_inverse' id='select_inverse'>{% trans "Inverse" %}</a></p>
<p><label for='id_mass_action'>{% trans "With Selected Tickets:" %}</label> <select name='action' id='id_mass_action'><option value='take'>{% trans "Take (Assign to me)" %}</option><option value='delete'>{% trans "Delete" %}</option><optgroup label='{% trans "Close" %}'><option value='close'>{% trans "Close (Don't Send E-Mail)" %}</option><option value='close_public'>{% trans "Close (Send E-Mail)" %}</option></optgroup><optgroup label='{% trans "Assign To" %}'><option value='unassign'>{% trans "Nobody (Unassign)" %}</option>{% for u in user_choices %}<option value='assign_{{ u.id }}'>{{ u.username }}</option>{% endfor %}</optgroup></select> <input type='submit' value='Go' /></p>
{% csrf_token %}</form>
{% endblock %}
</div>