Moved getting the ReportUrl utility from the views to the report chooser template, to simplify the view in the accounting application.

This commit is contained in:
依瑪貓
2020-08-07 10:25:29 +08:00
parent 45ed53b085
commit 4f02dd88da
12 changed files with 25 additions and 30 deletions

View File

@ -37,7 +37,6 @@ First written: 2020/7/1
<i class="fas fa-plus"></i>
{{ _("New")|force_escape }}
</a>
{% report_url as reports %}
{% with current_report_icon="fas fa-list-ol" current_report_title=_("Accounts") %}
{% include "accounting/include/report-chooser.html" %}
{% endwith %}

View File

@ -53,7 +53,7 @@ First written: 2020/7/20
</a>
</div>
</div>
{% with current_report_icon="fas fa-balance-scale" current_report_title=_("Balance Sheet") %}
{% with current_report_icon="fas fa-balance-scale" current_report_title=_("Balance Sheet") period=period %}
{% include "accounting/include/report-chooser.html" %}
{% endwith %}
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#period-modal">

View File

@ -52,7 +52,7 @@ First written: 2020/7/15
</a>
</div>
</div>
{% with current_report_icon="fas fa-money-bill-wave" current_report_title=_("Cash Summary") %}
{% with current_report_icon="fas fa-money-bill-wave" current_report_title=_("Cash Summary") cash_account=account %}
{% include "accounting/include/report-chooser.html" %}
{% endwith %}
<div class="btn-group">

View File

@ -53,7 +53,7 @@ First written: 2020/7/1
</a>
</div>
</div>
{% with current_report_icon="fas fa-money-bill-wave" current_report_title=_("Cash Account") %}
{% with current_report_icon="fas fa-money-bill-wave" current_report_title=_("Cash Account") cash_account=account period=period %}
{% include "accounting/include/report-chooser.html" %}
{% endwith %}
<div class="btn-group">

View File

@ -20,6 +20,7 @@ Author: imacat@mail.imacat.idv.tw (imacat)
First written: 2020/7/9
{% endcomment %}
{% load i18n %}
{% load accounting %}
<!-- the accounting record search dialog -->
<form action="{% url "accounting:search" %}" method="GET">
@ -61,36 +62,37 @@ First written: 2020/7/9
</span>
<span class="d-md-none">{{ _("Book")|force_escape }}</span>
</button>
{% report_url cash_account=cash_account ledger_account=ledger_account period=period as report_url %}
<div class="dropdown-menu account-picker">
<a class="dropdown-item {% if request.resolver_match.url_name == "cash" %} active {% endif %}" href="{{ reports.cash }}">
<a class="dropdown-item {% if request.resolver_match.url_name == "cash" %} active {% endif %}" href="{{ report_url.cash }}">
<i class="fas fa-money-bill-wave"></i>
{{ _("Cash Account")|force_escape }}
</a>
<a class="dropdown-item {% if request.resolver_match.url_name == "cash-summary" %} active {% endif %}" href="{{ reports.cash_summary }}">
<a class="dropdown-item {% if request.resolver_match.url_name == "cash-summary" %} active {% endif %}" href="{{ report_url.cash_summary }}">
<i class="fas fa-money-bill-wave"></i>
{{ _("Cash Summary")|force_escape }}
</a>
<a class="dropdown-item {% if request.resolver_match.url_name == "ledger" %} active {% endif %}" href="{{ reports.ledger }}">
<a class="dropdown-item {% if request.resolver_match.url_name == "ledger" %} active {% endif %}" href="{{ report_url.ledger }}">
<i class="fas fa-file-invoice-dollar"></i>
{{ _("Ledger")|force_escape }}
</a>
<a class="dropdown-item {% if request.resolver_match.url_name == "ledger-summary" %} active {% endif %}" href="{{ reports.ledger_summary }}">
<a class="dropdown-item {% if request.resolver_match.url_name == "ledger-summary" %} active {% endif %}" href="{{ report_url.ledger_summary }}">
<i class="fas fa-file-invoice-dollar"></i>
{{ _("Ledger Summary")|force_escape }}
</a>
<a class="dropdown-item {% if request.resolver_match.url_name == "journal" %} active {% endif %}" href="{{ reports.journal }}">
<a class="dropdown-item {% if request.resolver_match.url_name == "journal" %} active {% endif %}" href="{{ report_url.journal }}">
<i class="fas fa-book"></i>
{{ _("Journal")|force_escape }}
</a>
<a class="dropdown-item {% if request.resolver_match.url_name == "trial-balance" %} active {% endif %}" href="{{ reports.trial_balance }}">
<a class="dropdown-item {% if request.resolver_match.url_name == "trial-balance" %} active {% endif %}" href="{{ report_url.trial_balance }}">
<i class="fas fa-balance-scale-right"></i>
{{ _("Trial Balance")|force_escape }}
</a>
<a class="dropdown-item {% if request.resolver_match.url_name == "income-statement" %} active {% endif %}" href="{{ reports.income_statement }}">
<a class="dropdown-item {% if request.resolver_match.url_name == "income-statement" %} active {% endif %}" href="{{ report_url.income_statement }}">
<i class="fas fa-file-invoice"></i>
{{ _("Income Statement")|force_escape }}
</a>
<a class="dropdown-item {% if request.resolver_match.url_name == "balance-sheet" %} active {% endif %}" href="{{ reports.balance_sheet }}">
<a class="dropdown-item {% if request.resolver_match.url_name == "balance-sheet" %} active {% endif %}" href="{{ report_url.balance_sheet }}">
<i class="fas fa-balance-scale"></i>
{{ _("Balance Sheet")|force_escape }}
</a>

View File

@ -53,7 +53,7 @@ First written: 2020/7/19
</a>
</div>
</div>
{% with current_report_icon="fas fa-file-invoice" current_report_title=_("Income Statement") %}
{% with current_report_icon="fas fa-file-invoice" current_report_title=_("Income Statement") period=period %}
{% include "accounting/include/report-chooser.html" %}
{% endwith %}
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#period-modal">

View File

@ -53,7 +53,7 @@ First written: 2020/7/17
</a>
</div>
</div>
{% with current_report_icon="fas fa-book" current_report_title=_("Journal") %}
{% with current_report_icon="fas fa-book" current_report_title=_("Journal") period=period %}
{% include "accounting/include/report-chooser.html" %}
{% endwith %}
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#period-modal">

View File

@ -52,7 +52,7 @@ First written: 2020/7/16
</a>
</div>
</div>
{% with current_report_icon="fas fa-file-invoice-dollar" current_report_title=_("Ledger Summary") %}
{% with current_report_icon="fas fa-file-invoice-dollar" current_report_title=_("Ledger Summary") ledger_account=account %}
{% include "accounting/include/report-chooser.html" %}
{% endwith %}
<div class="btn-group">

View File

@ -53,7 +53,7 @@ First written: 2020/7/16
</a>
</div>
</div>
{% with current_report_icon="fas fa-file-invoice-dollar" current_report_title=_("Ledger") %}
{% with current_report_icon="fas fa-file-invoice-dollar" current_report_title=_("Ledger") ledger_account=account period=period %}
{% include "accounting/include/report-chooser.html" %}
{% endwith %}
<div class="btn-group">

View File

@ -53,7 +53,7 @@ First written: 2020/7/19
</a>
</div>
</div>
{% with current_report_icon="fas fa-balance-scale-right" current_report_title=_("Trial Balance") %}
{% with current_report_icon="fas fa-balance-scale-right" current_report_title=_("Trial Balance") period=period %}
{% include "accounting/include/report-chooser.html" %}
{% endwith %}
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#period-modal">