mia-accounting-django/accounting/templates/accounting/transaction-sort.html

145 lines
5.1 KiB
HTML

{% extends "base.html" %}
{% comment %}
The Mia Accounting Application
sort.html: The template to sort transactions in a same day
Copyright (c) 2020 imacat.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: imacat@mail.imacat.idv.tw (imacat)
First written: 2020/8/6
{% endcomment %}
{% load static %}
{% load i18n %}
{% load humanize %}
{% load mia_core %}
{% load accounting %}
{% block settings %}
{% blocktrans asvar title with date=date|smart_date %}Reorder the Transactions in {{ date }}{% endblocktrans %}
{% setvar "title" title %}
{% setvar "use_jqueryui" True %}
{% static "accounting/css/report.css" as file %}{% add_css file %}
{% static "accounting/css/transactions-sort.css" as file %}{% add_css file %}
{% static "accounting/js/transaction-sort.js" as file %}{% add_js file %}
{% endblock %}
{% block content %}
<div class="btn-group btn-actions">
<a class="btn btn-primary" role="button" href="{% if "r" in request.GET %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
<i class="fas fa-chevron-circle-left"></i>
{{ _("Back")|force_escape }}
</a>
</div>
<div class="form-group row">
<div class="col-sm-2">
<label for="txn-date">{{ _("Date:")|force_escape }}</label>
</div>
<div id="txn-date" class="col-sm-10">
{{ date|smart_date }}
</div>
</div>
{% if txn_list|length > 1 %}
<form action="{% url "accounting:transactions.sort" date as url %}{% url_keep_return url %}" method="post">
{% csrf_token %}
<table class="table general-journal-table">
<thead>
<tr>
<th class="actions" scope="col"></th>
<th scope="col">{{ _("Type")|force_escape }}</th>
<th scope="col">{{ _("Content")|force_escape }}</th>
<th class="amount" scope="col">{{ _("Amount")|force_escape }}</th>
<th scope="col">{{ _("Notes")|force_escape }}</th>
</tr>
</thead>
<tbody id="transactions">
{% for txn in txn_list %}
<tr id="transaction-{{ txn.pk }}" class="transaction {% if not txn.is_balanced %} table-danger {% endif %}">
<td class="actions">
<div class="btn-group">
<button class="btn btn-outline-secondary" type="button">
<i class="fas fa-sort"></i>
</button>
<a class="btn btn-primary" role="button" href="{% url "accounting:transactions.detail" txn.type txn as url %}{% url_with_return url %}">
<i class="fas fa-eye"></i>
</a>
</div>
</td>
<td>
{% if txn.is_cash_expense %}
{{ _("Cash Expense")|force_escape }}
{% elif txn.is_cash_income %}
{{ _("Cash Income")|force_escape }}
{% else %}
{{ _("Transfer")|force_escape }}
{% endif %}
</td>
<td>
<input id="transaction-{{ txn.pk }}-ord" type="hidden" name="transaction-{{ txn.pk }}-ord" value="{{ forloop.counter }}" />
{% if txn.is_cash_expense %}
<ul class="txn-content-expense">
{% for summary in txn.debit_sumaries %}
<li>{{ summary }}</li>
{% endfor %}
</ul>
{% elif txn.is_cash_income %}
<ul class="txn-content-income">
{% for summary in txn.credit_summaries %}
<li>{{ summary }}</li>
{% endfor %}
</ul>
{% else %}
<ul class="txn-content-expense">
{% for summary in txn.debit_sumaries %}
<li>{{ summary }}</li>
{% endfor %}
</ul>
<ul class="txn-content-income">
{% for summary in txn.credit_summaries %}
<li>{{ summary }}</li>
{% endfor %}
</ul>
{% endif %}
{% if not txn.is_balanced %}
<span class="badge badge-danger badge-pill">
{{ _("Unbalanced")|force_escape }}
</span>
{% endif %}
</td>
<td class="amount">
{{ txn.amount|accounting_amount }}
</td>
<td>{{ txn.notes|default:"" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="form-group row">
<div class="col-sm-12">
<button class="btn btn-primary" type="submit">
<i class="fas fa-save"></i>
{{ _("Save")|force_escape }}
</button>
</div>
</div>
</form>
{% endif %}
{% endblock %}