Renamed the template variables in the transaction views and forms and sorting form to be more meaningful in the accounting application.
This commit is contained in:
parent
fe1e4a40be
commit
651f527c86
@ -38,7 +38,7 @@ First written: 2020/7/23
|
||||
|
||||
{% include "accounting/include/summary-helper.html" %}
|
||||
|
||||
{% for message in item.non_field_errors %}
|
||||
{% for message in txn.non_field_errors %}
|
||||
<div class="alert alert-danger alert-dismissible fade show">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<strong>{{ _("Error:")|force_escape }}</strong> {{ message }}
|
||||
@ -46,7 +46,7 @@ First written: 2020/7/23
|
||||
{% endfor %}
|
||||
|
||||
<div class="btn-group btn-actions">
|
||||
<a class="btn btn-primary" role="button" href="{% if item.transaction %}{% url_keep_return "accounting:transactions.show" "expense" item.transaction %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
||||
<a class="btn btn-primary" role="button" href="{% if txn.transaction %}{% url_keep_return "accounting:transactions.show" "expense" txn.transaction %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
||||
<i class="fas fa-chevron-circle-left"></i>
|
||||
{{ _("Back")|force_escape }}
|
||||
</a>
|
||||
@ -55,22 +55,22 @@ First written: 2020/7/23
|
||||
<input id="account-option-url" type="hidden" value="{% url "accounting:accounts.options" %}" />
|
||||
<input id="summary-categories" type="hidden" value="{{ summary_categories }}" />
|
||||
<input id="new-record-template" type="hidden" value="{{ new_record_template }}" />
|
||||
<form id="txn-form" action="{% if item.transaction %}{% url_keep_return "accounting:transactions.update" "expense" item.transaction %}{% else %}{% url_keep_return "accounting:transactions.store" "expense" %}{% endif %}" method="post">
|
||||
<form id="txn-form" action="{% if txn.transaction %}{% url_keep_return "accounting:transactions.update" "expense" txn.transaction %}{% else %}{% url_keep_return "accounting:transactions.store" "expense" %}{% endif %}" method="post">
|
||||
{% csrf_token %}
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-2">
|
||||
<label for="txn-date">{{ _("Date:")|force_escape }}</label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<input id="txn-date" class="form-control {% if should_validate and item.date.errors %} is-invalid {% endif %}" type="date" name="date" value="{{ item.date.value }}" required="required" />
|
||||
<div id="txn-date-error" class="invalid-feedback">{% if should_validate %}{{ item.date.errors.0|default:"" }}{% endif %}</div>
|
||||
<input id="txn-date" class="form-control {% if should_validate and txn.date.errors %} is-invalid {% endif %}" type="date" name="date" value="{{ txn.date.value }}" required="required" />
|
||||
<div id="txn-date-error" class="invalid-feedback">{% if should_validate %}{{ txn.date.errors.0|default:"" }}{% endif %}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-12">
|
||||
<ul id="debit-records" class="list-group">
|
||||
{% for record in item.debit_records %}
|
||||
{% for record in txn.debit_records %}
|
||||
{% with record_type="debit" no=forloop.counter order=forloop.counter %}
|
||||
{% include "accounting/include/form-record-non-transfer.html" %}
|
||||
{% endwith %}
|
||||
@ -85,7 +85,7 @@ First written: 2020/7/23
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
{{ _("Total")|force_escape }}
|
||||
<span id="debit-total" class="amount">{{ item.debit_total }}</span>
|
||||
<span id="debit-total" class="amount">{{ txn.debit_total }}</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
@ -97,8 +97,8 @@ First written: 2020/7/23
|
||||
<label for="txn-note">{{ _("Notes:")|force_escape }}</label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<textarea id="txn-note" class="form-control {% if should_validate and item.notes.errors %} is-invalid {% endif %}" name="notes">{{ item.notes.value|default:"" }}</textarea>
|
||||
<div id="txn-note-error" class="invalid-feedback">{% if should_validate %}{{ item.notes.errors.0|default:"" }}{% endif %}</div>
|
||||
<textarea id="txn-note" class="form-control {% if should_validate and txn.notes.errors %} is-invalid {% endif %}" name="notes">{{ txn.notes.value|default:"" }}</textarea>
|
||||
<div id="txn-note-error" class="invalid-feedback">{% if should_validate %}{{ txn.notes.errors.0|default:"" }}{% endif %}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -32,7 +32,7 @@ First written: 2020/7/23
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if item.has_order_hole %}
|
||||
{% if txn.has_order_hole %}
|
||||
<div class="alert alert-danger alert-dismissible fade show">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<strong>{{ _("Error:") }}</strong> {{ _("The transactions on this day are not well-ordered. Please reorder them.")|force_escape }}
|
||||
@ -40,7 +40,7 @@ First written: 2020/7/23
|
||||
{% endif %}
|
||||
|
||||
<!-- the delete confirmation dialog -->
|
||||
<form action="{% url_keep_return "accounting:transactions.delete" item %}" method="post">
|
||||
<form action="{% url_keep_return "accounting:transactions.delete" txn %}" method="post">
|
||||
{% csrf_token %}
|
||||
<!-- The Modal -->
|
||||
<div class="modal" id="del-modal">
|
||||
@ -71,22 +71,22 @@ First written: 2020/7/23
|
||||
<i class="fas fa-chevron-circle-left"></i>
|
||||
{{ _("Back")|force_escape }}
|
||||
</a>
|
||||
<a class="btn btn-primary" role="button" href="{% url_keep_return "accounting:transactions.edit" "expense" item %}">
|
||||
<a class="btn btn-primary" role="button" href="{% url_keep_return "accounting:transactions.edit" "expense" txn %}">
|
||||
<i class="fas fa-edit"></i>
|
||||
{{ _("Edit")|force_escape }}
|
||||
</a>
|
||||
{% if not item.has_many_same_day %}
|
||||
{% if not txn.has_many_same_day %}
|
||||
<button type="button" class="btn btn-secondary d-none d-sm-inline" disabled="disabled" title="{{ _("There is no other transaction at the same day.")|force_escape }}">
|
||||
<i class="fas fa-sort"></i>
|
||||
{{ _("Sort")|force_escape }}
|
||||
</button>
|
||||
{% else %}
|
||||
<a class="btn btn-primary d-none d-sm-inline" role="button" href="{% url_with_return "accounting:transactions.sort" item.date %}">
|
||||
<a class="btn btn-primary d-none d-sm-inline" role="button" href="{% url_with_return "accounting:transactions.sort" txn.date %}">
|
||||
<i class="fas fa-sort"></i>
|
||||
{{ _("Sort")|force_escape }}
|
||||
</a>
|
||||
{% endif %}
|
||||
<a class="btn btn-primary d-none d-sm-inline" href="{% url_keep_return "accounting:transactions.show" "transfer" item %}">
|
||||
<a class="btn btn-primary d-none d-sm-inline" href="{% url_keep_return "accounting:transactions.show" "transfer" txn %}">
|
||||
<i class="fas fa-exchange-alt"></i>
|
||||
{{ _("To Transfer")|force_escape }}
|
||||
</a>
|
||||
@ -95,18 +95,18 @@ First written: 2020/7/23
|
||||
<i class="fas fa-bars"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
{% if not item.has_many_same_day %}
|
||||
{% if not txn.has_many_same_day %}
|
||||
<span class="dropdown-item disabled" title="{{ _("There is no other transaction at the same day.")|force_escape }}">
|
||||
<i class="fas fa-sort"></i>
|
||||
{{ _("Sort")|force_escape }}
|
||||
</span>
|
||||
{% else %}
|
||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.sort" item.date %}">
|
||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.sort" txn.date %}">
|
||||
<i class="fas fa-sort"></i>
|
||||
{{ _("Sort")|force_escape }}
|
||||
</a>
|
||||
{% endif %}
|
||||
<a class="dropdown-item" href="{% url_keep_return "accounting:transactions.show" "transfer" item %}">
|
||||
<a class="dropdown-item" href="{% url_keep_return "accounting:transactions.show" "transfer" txn %}">
|
||||
<i class="fas fa-exchange-alt"></i>
|
||||
{{ _("To Transfer")|force_escape }}
|
||||
</a>
|
||||
@ -120,7 +120,7 @@ First written: 2020/7/23
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-2">{{ _("Date:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.date|smart_date }}</div>
|
||||
<div class="col-sm-10">{{ txn.date|smart_date }}</div>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped table-hover d-none d-sm-table">
|
||||
@ -132,7 +132,7 @@ First written: 2020/7/23
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for x in item.debit_records %}
|
||||
{% for x in txn.debit_records %}
|
||||
<tr>
|
||||
<td>{{ x.account.title|title_case }}</td>
|
||||
<td>{{ x.summary|default:"" }}</td>
|
||||
@ -143,13 +143,13 @@ First written: 2020/7/23
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="2">{{ _("Total")|force_escape }}</td>
|
||||
<td class="amount">{{ item.debit_total|accounting_amount }}</td>
|
||||
<td class="amount">{{ txn.debit_total|accounting_amount }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<ul class="list-group d-sm-none">
|
||||
{% for x in item.debit_records %}
|
||||
{% for x in txn.debit_records %}
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between align-items-center account-line">
|
||||
{{ x.account.title|title_case }}
|
||||
@ -161,36 +161,36 @@ First written: 2020/7/23
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between align-items-center account-line">
|
||||
{{ _("Total")|force_escape }}
|
||||
<span class="badge badge-info">{{ item.debit_total|accounting_amount }}</span>
|
||||
<span class="badge badge-info">{{ txn.debit_total|accounting_amount }}</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% if item.notes %}
|
||||
{% if txn.notes %}
|
||||
<div class="row">
|
||||
<div class="col-sm-2">{{ _("Notes:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.notes }}</div>
|
||||
<div class="col-sm-10">{{ txn.notes }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-2">{{ _("Created at:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.created_at }}</div>
|
||||
<div class="col-sm-10">{{ txn.created_at }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-2">{{ _("Created by:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.created_by.name }}</div>
|
||||
<div class="col-sm-10">{{ txn.created_by.name }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-2">{{ _("Updated at:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.updated_at }}</div>
|
||||
<div class="col-sm-10">{{ txn.updated_at }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-2">{{ _("Updated by:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.updated_by.name }}</div>
|
||||
<div class="col-sm-10">{{ txn.updated_by.name }}</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -38,7 +38,7 @@ First written: 2020/7/23
|
||||
|
||||
{% include "accounting/include/summary-helper.html" %}
|
||||
|
||||
{% for message in item.non_field_errors %}
|
||||
{% for message in txn.non_field_errors %}
|
||||
<div class="alert alert-danger alert-dismissible fade show">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<strong>{{ _("Error:")|force_escape }}</strong> {{ message }}
|
||||
@ -46,7 +46,7 @@ First written: 2020/7/23
|
||||
{% endfor %}
|
||||
|
||||
<div class="btn-group btn-actions">
|
||||
<a class="btn btn-primary" role="button" href="{% if item.transaction %}{% url_keep_return "accounting:transactions.show" "income" item.transaction %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
||||
<a class="btn btn-primary" role="button" href="{% if txn.transaction %}{% url_keep_return "accounting:transactions.show" "income" txn.transaction %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
||||
<i class="fas fa-chevron-circle-left"></i>
|
||||
{{ _("Back")|force_escape }}
|
||||
</a>
|
||||
@ -55,22 +55,22 @@ First written: 2020/7/23
|
||||
<input id="account-option-url" type="hidden" value="{% url "accounting:accounts.options" %}" />
|
||||
<input id="summary-categories" type="hidden" value="{{ summary_categories }}" />
|
||||
<input id="new-record-template" type="hidden" value="{{ new_record_template }}" />
|
||||
<form id="txn-form" action="{% if item.transaction %}{% url_keep_return "accounting:transactions.update" "income" item.transaction %}{% else %}{% url_keep_return "accounting:transactions.store" "income" %}{% endif %}" method="post">
|
||||
<form id="txn-form" action="{% if txn.transaction %}{% url_keep_return "accounting:transactions.update" "income" txn.transaction %}{% else %}{% url_keep_return "accounting:transactions.store" "income" %}{% endif %}" method="post">
|
||||
{% csrf_token %}
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-2">
|
||||
<label for="txn-date">{{ _("Date:")|force_escape }}</label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<input id="txn-date" class="form-control {% if should_validate and item.date.errors %} is-invalid {% endif %}" type="date" name="date" value="{{ item.date.value }}" required="required" />
|
||||
<div id="txn-date-error" class="invalid-feedback">{% if should_validate %}{{ item.date.errors.0|default:"" }}{% endif %}</div>
|
||||
<input id="txn-date" class="form-control {% if should_validate and txn.date.errors %} is-invalid {% endif %}" type="date" name="date" value="{{ txn.date.value }}" required="required" />
|
||||
<div id="txn-date-error" class="invalid-feedback">{% if should_validate %}{{ txn.date.errors.0|default:"" }}{% endif %}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-12">
|
||||
<ul id="credit-records" class="list-group">
|
||||
{% for record in item.credit_records %}
|
||||
{% for record in txn.credit_records %}
|
||||
{% with record_type="credit" no=forloop.counter order=forloop.counter %}
|
||||
{% include "accounting/include/form-record-non-transfer.html" %}
|
||||
{% endwith %}
|
||||
@ -85,7 +85,7 @@ First written: 2020/7/23
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
{{ _("Total")|force_escape }}
|
||||
<span id="credit-total" class="amount">{{ item.credit_total }}</span>
|
||||
<span id="credit-total" class="amount">{{ txn.credit_total }}</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
@ -97,8 +97,8 @@ First written: 2020/7/23
|
||||
<label for="txn-note">{{ _("Notes:")|force_escape }}</label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<textarea id="txn-note" class="form-control {% if should_validate and item.notes.errors %} is-invalid {% endif %}" name="notes">{{ item.notes.value|default:"" }}</textarea>
|
||||
<div id="txn-note-error" class="invalid-feedback">{% if should_validate %}{{ item.notes.errors.0|default:"" }}{% endif %}</div>
|
||||
<textarea id="txn-note" class="form-control {% if should_validate and txn.notes.errors %} is-invalid {% endif %}" name="notes">{{ txn.notes.value|default:"" }}</textarea>
|
||||
<div id="txn-note-error" class="invalid-feedback">{% if should_validate %}{{ txn.notes.errors.0|default:"" }}{% endif %}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -32,7 +32,7 @@ First written: 2020/7/23
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if item.has_order_hole %}
|
||||
{% if txn.has_order_hole %}
|
||||
<div class="alert alert-danger alert-dismissible fade show">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<strong>{{ _("Error:") }}</strong> {{ _("The transactions on this day are not well-ordered. Please reorder them.")|force_escape }}
|
||||
@ -40,7 +40,7 @@ First written: 2020/7/23
|
||||
{% endif %}
|
||||
|
||||
<!-- the delete confirmation dialog -->
|
||||
<form action="{% url_keep_return "accounting:transactions.delete" item %}" method="post">
|
||||
<form action="{% url_keep_return "accounting:transactions.delete" txn %}" method="post">
|
||||
{% csrf_token %}
|
||||
<!-- The Modal -->
|
||||
<div class="modal" id="del-modal">
|
||||
@ -71,22 +71,22 @@ First written: 2020/7/23
|
||||
<i class="fas fa-chevron-circle-left"></i>
|
||||
{{ _("Back")|force_escape }}
|
||||
</a>
|
||||
<a class="btn btn-primary" role="button" href="{% url_keep_return "accounting:transactions.edit" "income" item %}">
|
||||
<a class="btn btn-primary" role="button" href="{% url_keep_return "accounting:transactions.edit" "income" txn %}">
|
||||
<i class="fas fa-edit"></i>
|
||||
{{ _("Edit")|force_escape }}
|
||||
</a>
|
||||
{% if not item.has_many_same_day %}
|
||||
{% if not txn.has_many_same_day %}
|
||||
<button type="button" class="btn btn-secondary d-none d-sm-inline" disabled="disabled" title="{{ _("There is no other transaction at the same day.")|force_escape }}">
|
||||
<i class="fas fa-sort"></i>
|
||||
{{ _("Sort")|force_escape }}
|
||||
</button>
|
||||
{% else %}
|
||||
<a class="btn btn-primary d-none d-sm-inline" role="button" href="{% url_with_return "accounting:transactions.sort" item.date %}">
|
||||
<a class="btn btn-primary d-none d-sm-inline" role="button" href="{% url_with_return "accounting:transactions.sort" txn.date %}">
|
||||
<i class="fas fa-sort"></i>
|
||||
{{ _("Sort")|force_escape }}
|
||||
</a>
|
||||
{% endif %}
|
||||
<a class="btn btn-primary d-none d-sm-inline" href="{% url_keep_return "accounting:transactions.show" "transfer" item %}">
|
||||
<a class="btn btn-primary d-none d-sm-inline" href="{% url_keep_return "accounting:transactions.show" "transfer" txn %}">
|
||||
<i class="fas fa-exchange-alt"></i>
|
||||
{{ _("To Transfer")|force_escape }}
|
||||
</a>
|
||||
@ -95,18 +95,18 @@ First written: 2020/7/23
|
||||
<i class="fas fa-bars"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
{% if not item.has_many_same_day %}
|
||||
{% if not txn.has_many_same_day %}
|
||||
<span class="dropdown-item disabled" title="{{ _("There is no other transaction at the same day.")|force_escape }}">
|
||||
<i class="fas fa-sort"></i>
|
||||
{{ _("Sort")|force_escape }}
|
||||
</span>
|
||||
{% else %}
|
||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.sort" item.date %}">
|
||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.sort" txn.date %}">
|
||||
<i class="fas fa-sort"></i>
|
||||
{{ _("Sort")|force_escape }}
|
||||
</a>
|
||||
{% endif %}
|
||||
<a class="dropdown-item" href="{% url_keep_return "accounting:transactions.show" "transfer" item %}">
|
||||
<a class="dropdown-item" href="{% url_keep_return "accounting:transactions.show" "transfer" txn %}">
|
||||
<i class="fas fa-exchange-alt"></i>
|
||||
{{ _("To Transfer")|force_escape }}
|
||||
</a>
|
||||
@ -120,7 +120,7 @@ First written: 2020/7/23
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-2">{{ _("Date:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.date|smart_date }}</div>
|
||||
<div class="col-sm-10">{{ txn.date|smart_date }}</div>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped table-hover d-none d-sm-table">
|
||||
@ -132,7 +132,7 @@ First written: 2020/7/23
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for x in item.credit_records %}
|
||||
{% for x in txn.credit_records %}
|
||||
<tr>
|
||||
<td>{{ x.account.title|title_case }}</td>
|
||||
<td>{{ x.summary|default:"" }}</td>
|
||||
@ -143,13 +143,13 @@ First written: 2020/7/23
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="2">{{ _("Total")|force_escape }}</td>
|
||||
<td class="amount">{{ item.credit_total|accounting_amount }}</td>
|
||||
<td class="amount">{{ txn.credit_total|accounting_amount }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<ul class="list-group d-sm-none">
|
||||
{% for x in item.credit_records %}
|
||||
{% for x in txn.credit_records %}
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between align-items-center account-line">
|
||||
{{ x.account.title|title_case }}
|
||||
@ -161,36 +161,36 @@ First written: 2020/7/23
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between align-items-center account-line">
|
||||
{{ _("Total")|force_escape }}
|
||||
<span class="badge badge-info">{{ item.credit_total|accounting_amount }}</span>
|
||||
<span class="badge badge-info">{{ txn.credit_total|accounting_amount }}</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% if item.notes %}
|
||||
{% if txn.notes %}
|
||||
<div class="row">
|
||||
<div class="col-sm-2">{{ _("Notes:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.notes }}</div>
|
||||
<div class="col-sm-10">{{ txn.notes }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-2">{{ _("Created at:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.created_at }}</div>
|
||||
<div class="col-sm-10">{{ txn.created_at }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-2">{{ _("Created by:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.created_by.name }}</div>
|
||||
<div class="col-sm-10">{{ txn.created_by.name }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-2">{{ _("Updated at:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.updated_at }}</div>
|
||||
<div class="col-sm-10">{{ txn.updated_at }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-2">{{ _("Updated by:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.updated_by.name }}</div>
|
||||
<div class="col-sm-10">{{ txn.updated_by.name }}</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -54,7 +54,7 @@ First written: 2020/8/6
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if item_list|length > 1 %}
|
||||
{% if txn_list|length > 1 %}
|
||||
<form action="{% url_keep_return "accounting:transactions.sort" date %}" method="post">
|
||||
{% csrf_token %}
|
||||
<table class="table general-journal-table">
|
||||
@ -68,63 +68,63 @@ First written: 2020/8/6
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="transactions">
|
||||
{% for item in item_list %}
|
||||
<tr id="transaction-{{ item.pk }}" class="transaction {% if not item.is_balanced %} table-danger {% endif %}">
|
||||
{% 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_with_return "accounting:transactions.show" item.type item %}">
|
||||
<a class="btn btn-primary" role="button" href="{% url_with_return "accounting:transactions.show" txn.type txn %}">
|
||||
<i class="fas fa-eye"></i>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{% if item.is_cash_expense %}
|
||||
{% if txn.is_cash_expense %}
|
||||
{{ _("Cash Expense")|force_escape }}
|
||||
{% elif item.is_cash_income %}
|
||||
{% elif txn.is_cash_income %}
|
||||
{{ _("Cash Income")|force_escape }}
|
||||
{% else %}
|
||||
{{ _("Transfer")|force_escape }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<input id="transaction-{{ item.pk }}-ord" type="hidden" name="transaction-{{ item.pk }}-ord" value="{{ forloop.counter }}" />
|
||||
{% if item.is_cash_expense %}
|
||||
<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 item.debit_sumaries %}
|
||||
{% for summary in txn.debit_sumaries %}
|
||||
<li>{{ summary }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% elif item.is_cash_income %}
|
||||
{% elif txn.is_cash_income %}
|
||||
<ul class="txn-content-income">
|
||||
{% for summary in item.credit_summaries %}
|
||||
{% for summary in txn.credit_summaries %}
|
||||
<li>{{ summary }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<ul class="txn-content-expense">
|
||||
{% for summary in item.debit_sumaries %}
|
||||
{% for summary in txn.debit_sumaries %}
|
||||
<li>{{ summary }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<ul class="txn-content-income">
|
||||
{% for summary in item.credit_summaries %}
|
||||
{% for summary in txn.credit_summaries %}
|
||||
<li>{{ summary }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if not item.is_balanced %}
|
||||
{% if not txn.is_balanced %}
|
||||
<span class="badge badge-danger badge-pill">
|
||||
{{ _("Unbalanced")|force_escape }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="amount">
|
||||
{{ item.amount|accounting_amount }}
|
||||
{{ txn.amount|accounting_amount }}
|
||||
</td>
|
||||
<td>{{ item.notes|default:"" }}</td>
|
||||
<td>{{ txn.notes|default:"" }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
@ -38,7 +38,7 @@ First written: 2020/7/23
|
||||
|
||||
{% include "accounting/include/summary-helper.html" %}
|
||||
|
||||
{% for message in item.non_field_errors %}
|
||||
{% for message in txn.non_field_errors %}
|
||||
<div class="alert alert-danger alert-dismissible fade show">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<strong>{{ _("Error:")|force_escape }}</strong> {{ message }}
|
||||
@ -46,7 +46,7 @@ First written: 2020/7/23
|
||||
{% endfor %}
|
||||
|
||||
<div class="btn-group btn-actions">
|
||||
<a class="btn btn-primary" role="button" href="{% if item.transaction %}{% url_keep_return "accounting:transactions.show" "transfer" item.transaction %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
||||
<a class="btn btn-primary" role="button" href="{% if txn.transaction %}{% url_keep_return "accounting:transactions.show" "transfer" txn.transaction %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
||||
<i class="fas fa-chevron-circle-left"></i>
|
||||
{{ _("Back")|force_escape }}
|
||||
</a>
|
||||
@ -55,15 +55,15 @@ First written: 2020/7/23
|
||||
<input id="account-option-url" type="hidden" value="{% url "accounting:accounts.options" %}" />
|
||||
<input id="summary-categories" type="hidden" value="{{ summary_categories }}" />
|
||||
<input id="new-record-template" type="hidden" value="{{ new_record_template }}" />
|
||||
<form id="txn-form" action="{% if item.transaction %}{% url_keep_return "accounting:transactions.update" "transfer" item.transaction %}{% else %}{% url_keep_return "accounting:transactions.store" "transfer" %}{% endif %}" method="post">
|
||||
<form id="txn-form" action="{% if txn.transaction %}{% url_keep_return "accounting:transactions.update" "transfer" txn.transaction %}{% else %}{% url_keep_return "accounting:transactions.store" "transfer" %}{% endif %}" method="post">
|
||||
{% csrf_token %}
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-2">
|
||||
<label for="txn-date">{{ _("Date:")|force_escape }}</label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<input id="txn-date" class="form-control {% if should_validate and item.date.errors %} is-invalid {% endif %}" type="date" name="date" value="{{ item.date.value }}" required="required" />
|
||||
<div id="txn-date-error" class="invalid-feedback">{% if should_validate %}{{ item.date.errors.0|default:"" }}{% endif %}</div>
|
||||
<input id="txn-date" class="form-control {% if should_validate and txn.date.errors %} is-invalid {% endif %}" type="date" name="date" value="{{ txn.date.value }}" required="required" />
|
||||
<div id="txn-date-error" class="invalid-feedback">{% if should_validate %}{{ txn.date.errors.0|default:"" }}{% endif %}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -72,7 +72,7 @@ First written: 2020/7/23
|
||||
<h2>{{ _("Debit")|force_escape }}</h2>
|
||||
|
||||
<ul id="debit-records" class="list-group">
|
||||
{% for record in item.debit_records %}
|
||||
{% for record in txn.debit_records %}
|
||||
{% with record_type="debit" no=forloop.counter order=forloop.counter %}
|
||||
{% include "accounting/include/form-record-transfer.html" %}
|
||||
{% endwith %}
|
||||
@ -85,11 +85,11 @@ First written: 2020/7/23
|
||||
</button>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div id="debit-total-row" class="d-flex justify-content-between align-items-center form-control {% if should_validate and item.balance_error %} is-invalid {% endif %} balance-row">
|
||||
<div id="debit-total-row" class="d-flex justify-content-between align-items-center form-control {% if should_validate and txn.balance_error %} is-invalid {% endif %} balance-row">
|
||||
{{ _("Total")|force_escape }}
|
||||
<span id="debit-total" class="amount">{{ item.debit_total }}</span>
|
||||
<span id="debit-total" class="amount">{{ txn.debit_total }}</span>
|
||||
</div>
|
||||
<div id="debit-total-error" class="invalid-feedback balance-error">{% if should_validate %}{{ item.balance_error|default:"" }}{% endif %}</div>
|
||||
<div id="debit-total-error" class="invalid-feedback balance-error">{% if should_validate %}{{ txn.balance_error|default:"" }}{% endif %}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -98,7 +98,7 @@ First written: 2020/7/23
|
||||
<h2>{{ _("Credit")|force_escape }}</h2>
|
||||
|
||||
<ul id="credit-records" class="list-group">
|
||||
{% for record in item.credit_records %}
|
||||
{% for record in txn.credit_records %}
|
||||
{% with record_type="credit" no=forloop.counter order=forloop.counter %}
|
||||
{% include "accounting/include/form-record-transfer.html" %}
|
||||
{% endwith %}
|
||||
@ -111,11 +111,11 @@ First written: 2020/7/23
|
||||
</button>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div id="credit-total-row" class="d-flex justify-content-between align-items-center form-control {% if should_validate and item.balance_error %} is-invalid {% endif %} balance-row">
|
||||
<div id="credit-total-row" class="d-flex justify-content-between align-items-center form-control {% if should_validate and txn.balance_error %} is-invalid {% endif %} balance-row">
|
||||
{{ _("Total")|force_escape }}
|
||||
<span id="credit-total" class="amount">{{ item.credit_total }}</span>
|
||||
<span id="credit-total" class="amount">{{ txn.credit_total }}</span>
|
||||
</div>
|
||||
<div id="credit-total-error" class="invalid-feedback balance-error">{% if should_validate %}{{ item.balance_error|default:"" }}{% endif %}</div>
|
||||
<div id="credit-total-error" class="invalid-feedback balance-error">{% if should_validate %}{{ txn.balance_error|default:"" }}{% endif %}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -126,8 +126,8 @@ First written: 2020/7/23
|
||||
<label for="txn-note">{{ _("Notes:")|force_escape }}</label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<textarea id="txn-note" class="form-control {% if should_validate and item.notes.errors %} is-invalid {% endif %}" name="notes">{{ item.notes.value|default:"" }}</textarea>
|
||||
<div id="txn-note-error" class="invalid-feedback">{% if should_validate %}{{ item.notes.errors.0|default:"" }}{% endif %}</div>
|
||||
<textarea id="txn-note" class="form-control {% if should_validate and txn.notes.errors %} is-invalid {% endif %}" name="notes">{{ txn.notes.value|default:"" }}</textarea>
|
||||
<div id="txn-note-error" class="invalid-feedback">{% if should_validate %}{{ txn.notes.errors.0|default:"" }}{% endif %}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -32,7 +32,7 @@ First written: 2020/7/23
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if item.has_order_hole %}
|
||||
{% if txn.has_order_hole %}
|
||||
<div class="alert alert-danger alert-dismissible fade show">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<strong>{{ _("Error:") }}</strong> {{ _("The transactions on this day are not well-ordered. Please reorder them.")|force_escape }}
|
||||
@ -40,7 +40,7 @@ First written: 2020/7/23
|
||||
{% endif %}
|
||||
|
||||
<!-- the delete confirmation dialog -->
|
||||
<form action="{% url_keep_return "accounting:transactions.delete" item %}" method="post">
|
||||
<form action="{% url_keep_return "accounting:transactions.delete" txn %}" method="post">
|
||||
{% csrf_token %}
|
||||
<!-- The Modal -->
|
||||
<div class="modal" id="del-modal">
|
||||
@ -71,17 +71,17 @@ First written: 2020/7/23
|
||||
<i class="fas fa-chevron-circle-left"></i>
|
||||
{{ _("Back")|force_escape }}
|
||||
</a>
|
||||
<a class="btn btn-primary" role="button" href="{% url_keep_return "accounting:transactions.edit" "transfer" item %}">
|
||||
<a class="btn btn-primary" role="button" href="{% url_keep_return "accounting:transactions.edit" "transfer" txn %}">
|
||||
<i class="fas fa-edit"></i>
|
||||
{{ _("Edit")|force_escape }}
|
||||
</a>
|
||||
{% if not item.has_many_same_day %}
|
||||
{% if not txn.has_many_same_day %}
|
||||
<button type="button" class="btn btn-secondary d-none d-sm-inline" disabled="disabled" title="{{ _("There is no other transaction at the same day.")|force_escape }}">
|
||||
<i class="fas fa-sort"></i>
|
||||
{{ _("Sort")|force_escape }}
|
||||
</button>
|
||||
{% else %}
|
||||
<a class="btn btn-primary d-none d-sm-inline" role="button" href="{% url_with_return "accounting:transactions.sort" item.date %}">
|
||||
<a class="btn btn-primary d-none d-sm-inline" role="button" href="{% url_with_return "accounting:transactions.sort" txn.date %}">
|
||||
<i class="fas fa-sort"></i>
|
||||
{{ _("Sort")|force_escape }}
|
||||
</a>
|
||||
@ -91,13 +91,13 @@ First written: 2020/7/23
|
||||
<i class="fas fa-bars"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
{% if not item.has_many_same_day %}
|
||||
{% if not txn.has_many_same_day %}
|
||||
<span class="dropdown-item disabled" title="{{ _("There is no other transaction at the same day.")|force_escape }}">
|
||||
<i class="fas fa-sort"></i>
|
||||
{{ _("Sort")|force_escape }}
|
||||
</span>
|
||||
{% else %}
|
||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.sort" item.date %}">
|
||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.sort" txn.date %}">
|
||||
<i class="fas fa-sort"></i>
|
||||
{{ _("Sort")|force_escape }}
|
||||
</a>
|
||||
@ -112,7 +112,7 @@ First written: 2020/7/23
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-2">{{ _("Date:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.date|smart_date }}</div>
|
||||
<div class="col-sm-10">{{ txn.date|smart_date }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@ -128,7 +128,7 @@ First written: 2020/7/23
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for x in item.debit_records %}
|
||||
{% for x in txn.debit_records %}
|
||||
<tr>
|
||||
<td>{{ x.account.title|title_case }}</td>
|
||||
<td>{{ x.summary|default:"" }}</td>
|
||||
@ -139,13 +139,13 @@ First written: 2020/7/23
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="2">{{ _("Total")|force_escape }}</td>
|
||||
<td class="amount">{{ item.debit_total|accounting_amount }}</td>
|
||||
<td class="amount">{{ txn.debit_total|accounting_amount }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<ul class="list-group d-lg-none">
|
||||
{% for x in item.debit_records %}
|
||||
{% for x in txn.debit_records %}
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between align-items-center account-line">
|
||||
{{ x.account.title|title_case }}
|
||||
@ -157,7 +157,7 @@ First written: 2020/7/23
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between align-items-center account-line">
|
||||
{{ _("Total")|force_escape }}
|
||||
<span class="badge badge-info">{{ item.debit_total|accounting_amount }}</span>
|
||||
<span class="badge badge-info">{{ txn.debit_total|accounting_amount }}</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
@ -175,7 +175,7 @@ First written: 2020/7/23
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for x in item.credit_records %}
|
||||
{% for x in txn.credit_records %}
|
||||
<tr>
|
||||
<td>{{ x.account.title|title_case }}</td>
|
||||
<td>{{ x.summary|default:"" }}</td>
|
||||
@ -186,13 +186,13 @@ First written: 2020/7/23
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="2">{{ _("Total")|force_escape }}</td>
|
||||
<td class="amount">{{ item.credit_total|accounting_amount }}</td>
|
||||
<td class="amount">{{ txn.credit_total|accounting_amount }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<ul class="list-group d-lg-none">
|
||||
{% for x in item.credit_records %}
|
||||
{% for x in txn.credit_records %}
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between align-items-center account-line">
|
||||
{{ x.account.title|title_case }}
|
||||
@ -205,38 +205,38 @@ First written: 2020/7/23
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between align-items-center account-line">
|
||||
{{ _("Total")|force_escape }}
|
||||
<span class="badge badge-info">{{ item.credit_total|accounting_amount }}</span>
|
||||
<span class="badge badge-info">{{ txn.credit_total|accounting_amount }}</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if item.notes %}
|
||||
{% if txn.notes %}
|
||||
<div class="row">
|
||||
<div class="col-sm-2">{{ _("Notes:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.notes }}</div>
|
||||
<div class="col-sm-10">{{ txn.notes }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-2">{{ _("Created at:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.created_at }}</div>
|
||||
<div class="col-sm-10">{{ txn.created_at }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-2">{{ _("Created by:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.created_by.name }}</div>
|
||||
<div class="col-sm-10">{{ txn.created_by.name }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-2">{{ _("Updated at:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.updated_at }}</div>
|
||||
<div class="col-sm-10">{{ txn.updated_at }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-2">{{ _("Updated by:")|force_escape }}</div>
|
||||
<div class="col-sm-10">{{ item.updated_by.name }}</div>
|
||||
<div class="col-sm-10">{{ txn.updated_by.name }}</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -813,7 +813,7 @@ def txn_show(request, txn_type, txn):
|
||||
HttpResponse: The response.
|
||||
"""
|
||||
return render(request, F"accounting/transactions/{txn_type}/view.html", {
|
||||
"item": txn,
|
||||
"txn": txn,
|
||||
})
|
||||
|
||||
|
||||
@ -854,7 +854,7 @@ def txn_edit(request, txn_type, txn=None):
|
||||
"accounting/include/form-record-non-transfer.html",
|
||||
new_record_context))
|
||||
return render(request, F"accounting/transactions/{txn_type}/form.html", {
|
||||
"item": form,
|
||||
"txn": form,
|
||||
"summary_categories": get_summary_categories,
|
||||
"should_validate": should_validate,
|
||||
"new_record_template": new_record_template,
|
||||
@ -997,7 +997,7 @@ def txn_sort(request, date):
|
||||
raise Http404
|
||||
if request.method != "POST":
|
||||
return render(request, "accounting/transactions/sort.html", {
|
||||
"item_list": transactions,
|
||||
"txn_list": transactions,
|
||||
"date": date,
|
||||
})
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user