lingo/lingo/invoicing/templates/lingo/invoicing/manager_pool_journal.html

103 lines
3.4 KiB
HTML

{% extends "lingo/invoicing/manager_pool_detail.html" %}
{% load i18n %}
{% block breadcrumb %}
{{ block.super }}
<a href="{% url 'lingo-manager-invoicing-pool-journal' pk=object.pk pool_pk=pool.pk %}">{% trans "Journal" %}</a>
{% endblock %}
{% block appbar %}
<h2 id="pool-title">
{% if pool.success_count %}<span class="tag tag-success">{{ pool.success_count }}</span>{% endif %}
{% if pool.warning_count %}<span class="tag tag-warning">{{ pool.warning_count }}</span>{% endif %}
{% if pool.error_count %}<span class="tag tag-error">{{ pool.error_count }}</span>{% endif %}
{{ pool.created_at|date:"DATETIME_FORMAT" }}
</h2>
{% if pool.draft and pool.status != 'registered' and pool.status != 'running' %}
<span class="actions">
<a href="{% url 'lingo-manager-invoicing-pool-delete' pk=object.pk pool_pk=pool.pk %}" rel="popup">{% trans "Delete" %}</a>
</span>
{% endif %}
{% endblock %}
{% block content %}
<div>
{% if pool.status == 'failed' %}
<div class="pk-error">
<p>{% trans "Error while running pool." %}</p>
{% if pool.exception %}<pre>{{ pool.exception }}</pre>{% endif %}
</div>
{% endif %}
<form class="journal-filters">
{{ filterset.form.as_p }}
<script>
$(function() {
$('form.journal-filters input,select').on('change',
function() {
$(this).parents('form').submit();
});
});
</script>
</form>
<table class="main lines">
<thead>
<tr>
<th>{% trans "PK" %}</th>
<th>{% trans "Invoice number" %}</th>
<th>{% trans "Event" %}</th>
<th>{% trans "Quantity" %}</th>
<th>{% trans "Unit amount" %}</th>
<th>{% trans "Total amount" %}</th>
<th>{% trans "User" %}</th>
<th>{% trans "Payer" %}</th>
<th>{% trans "Status" %}</th>
<th></th>
</tr>
</thead>
<tbody>
{% for line in lines %}
<tr data-line-id="{{ line.pk }}">
{% include 'lingo/invoicing/manager_line_detail_fragment.html' %}
</tr>
<tr data-details-for-line-id="{{ line.pk }}" style="display: none">
<td colspan="10">
{% trans "Pricing data:" %}
<pre>{{ line.pricing_data|pprint }}</pre>
{% trans "Event:" %}
<pre>{{ line.event|pprint }}</pre>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<script>
$(function() {
$(document).on('click', 'a.details-toggle', function(event) {
event.preventDefault();
var line_id = $(this).parents('tr').data('line-id');
var $details = $('tr[data-details-for-line-id=' + line_id + ']');
if ($details.is(':visible')) {
$(this).text('{% trans "see details" %}');
$details.hide();
} else {
$(this).text('{% trans "hide details" %}');
$details.show();
}
});
$(document).on('click', 'a.error-status', function(event) {
// avoid reloading the whole page. There is no refresh of counters, it is not so important.
event.preventDefault();
var $a = $(this);
$.ajax({
url: $a.attr('href')
}).done(function(html) {
$a.parents('tr').html(html);
}).fail(function() {
location.reload();
});
});
});
</script>
{% endblock %}