Updated the URI of the reports to be the default views of the application.

This commit is contained in:
依瑪貓 2023-04-05 08:06:00 +08:00
parent 4c2dcc5070
commit 02fcabb0ce
14 changed files with 29 additions and 29 deletions

View File

@ -84,7 +84,7 @@ def init_app(app: Flask, user_utils: UserUtilityInterface,
journal_entry.init_app(app, bp)
from . import report
report.init_app(app, bp)
report.init_app(app, url_prefix)
from . import option
option.init_app(bp)

View File

@ -235,4 +235,4 @@ def __get_default_page_uri() -> str:
:return: The URI for the default page.
"""
return url_for("accounting.report.default")
return url_for("accounting-report.default")

View File

@ -17,14 +17,14 @@
"""The report management.
"""
from flask import Flask, Blueprint
from flask import Flask
def init_app(app: Flask, bp: Blueprint) -> None:
def init_app(app: Flask, url_prefix: str) -> None:
"""Initialize the application.
:param app: The Flask application.
:param bp: The blueprint of the accounting application.
:param url_prefix: The URL prefix of the accounting application.
:return: None.
"""
from .converters import PeriodConverter, IncomeExpensesAccountConverter
@ -32,4 +32,4 @@ def init_app(app: Flask, bp: Blueprint) -> None:
app.url_map.converters["ieAccount"] = IncomeExpensesAccountConverter
from .views import bp as report_bp
bp.register_blueprint(report_bp, url_prefix="/reports")
app.register_blueprint(report_bp, url_prefix=url_prefix)

View File

@ -34,8 +34,8 @@ def journal_url(period: Period) \
:return: The URL of the journal.
"""
if period.is_default:
return url_for("accounting.report.journal-default")
return url_for("accounting.report.journal", period=period)
return url_for("accounting-report.journal-default")
return url_for("accounting-report.journal", period=period)
def ledger_url(currency: Currency, account: Account, period: Period) \
@ -48,9 +48,9 @@ def ledger_url(currency: Currency, account: Account, period: Period) \
:return: The URL of the ledger.
"""
if period.is_default:
return url_for("accounting.report.ledger-default",
return url_for("accounting-report.ledger-default",
currency=currency, account=account)
return url_for("accounting.report.ledger",
return url_for("accounting-report.ledger",
currency=currency, account=account,
period=period)
@ -67,11 +67,11 @@ def income_expenses_url(currency: Currency, account: CurrentAccount,
if currency.code == default_currency_code() \
and account.code == options.default_ie_account_code \
and period.is_default:
return url_for("accounting.report.default")
return url_for("accounting-report.default")
if period.is_default:
return url_for("accounting.report.income-expenses-default",
return url_for("accounting-report.income-expenses-default",
currency=currency, account=account)
return url_for("accounting.report.income-expenses",
return url_for("accounting-report.income-expenses",
currency=currency, account=account,
period=period)
@ -84,9 +84,9 @@ def trial_balance_url(currency: Currency, period: Period) -> str:
:return: The URL of the trial balance.
"""
if period.is_default:
return url_for("accounting.report.trial-balance-default",
return url_for("accounting-report.trial-balance-default",
currency=currency)
return url_for("accounting.report.trial-balance",
return url_for("accounting-report.trial-balance",
currency=currency, period=period)
@ -98,9 +98,9 @@ def income_statement_url(currency: Currency, period: Period) -> str:
:return: The URL of the income statement.
"""
if period.is_default:
return url_for("accounting.report.income-statement-default",
return url_for("accounting-report.income-statement-default",
currency=currency)
return url_for("accounting.report.income-statement",
return url_for("accounting-report.income-statement",
currency=currency, period=period)
@ -112,7 +112,7 @@ def balance_sheet_url(currency: Currency, period: Period) -> str:
:return: The URL of the balance sheet.
"""
if period.is_default:
return url_for("accounting.report.balance-sheet-default",
return url_for("accounting-report.balance-sheet-default",
currency=currency)
return url_for("accounting.report.balance-sheet",
return url_for("accounting-report.balance-sheet",
currency=currency, period=period)

View File

@ -30,7 +30,7 @@ from .reports import Journal, Ledger, IncomeExpenses, TrialBalance, \
IncomeStatement, BalanceSheet, Search
from .template_filters import format_amount
bp: Blueprint = Blueprint("report", __name__)
bp: Blueprint = Blueprint("accounting-report", __name__)
"""The view blueprint for the reports."""
bp.add_app_template_filter(format_amount, "accounting_report_format_amount")

View File

@ -28,7 +28,7 @@ First written: 2023/1/26
</span>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item {% if request.endpoint and request.endpoint.startswith("accounting.report.") %} active {% endif %}" href="{{ url_for("accounting.report.default") }}">
<a class="dropdown-item {% if request.endpoint and request.endpoint.startswith("accounting-report.") %} active {% endif %}" href="{{ url_for("accounting-report.default") }}">
<i class="fa-solid fa-book"></i>
{{ A_("Reports") }}
</a>

View File

@ -23,6 +23,6 @@ First written: 2023/2/25
{% block header %}{% block title %}{{ A_("Add a New Cash Disbursement Journal Entry") }}{% endblock %}{% endblock %}
{% block back_url %}{{ request.args.get("next") or url_for("accounting.report.default") }}{% endblock %}
{% block back_url %}{{ request.args.get("next") or url_for("accounting-report.default") }}{% endblock %}
{% block action_url %}{{ url_for("accounting.journal-entry.store", journal_entry_type=journal_entry_type) }}{% endblock %}

View File

@ -26,7 +26,7 @@ First written: 2023/2/26
{% block content %}
<div class="mb-3 accounting-toolbar">
<a class="btn btn-primary" role="button" href="{{ url_for("accounting.report.default")|accounting_or_next }}">
<a class="btn btn-primary" role="button" href="{{ url_for("accounting-report.default")|accounting_or_next }}">
<i class="fa-solid fa-circle-chevron-left"></i>
<span class="d-none d-md-inline">{{ A_("Back") }}</span>
</a>

View File

@ -31,7 +31,7 @@ First written: 2023/2/26
{% block content %}
<div class="mb-3 accounting-toolbar">
<a class="btn btn-primary" role="button" href="{{ url_for("accounting.report.default")|accounting_or_next }}">
<a class="btn btn-primary" role="button" href="{{ url_for("accounting-report.default")|accounting_or_next }}">
<i class="fa-solid fa-circle-chevron-left"></i>
<span class="d-none d-md-inline">{{ A_("Back") }}</span>
</a>

View File

@ -23,6 +23,6 @@ First written: 2023/2/25
{% block header %}{% block title %}{{ A_("Add a New Cash Receipt Journal Entry") }}{% endblock %}{% endblock %}
{% block back_url %}{{ request.args.get("next") or url_for("accounting.report.default") }}{% endblock %}
{% block back_url %}{{ request.args.get("next") or url_for("accounting-report.default") }}{% endblock %}
{% block action_url %}{{ url_for("accounting.journal-entry.store", journal_entry_type=journal_entry_type) }}{% endblock %}

View File

@ -23,6 +23,6 @@ First written: 2023/2/25
{% block header %}{% block title %}{{ A_("Add a New Transfer Journal Entry") }}{% endblock %}{% endblock %}
{% block back_url %}{{ request.args.get("next") or url_for("accounting.report.default") }}{% endblock %}
{% block back_url %}{{ request.args.get("next") or url_for("accounting-report.default") }}{% endblock %}
{% block action_url %}{{ url_for("accounting.journal-entry.store", journal_entry_type=journal_entry_type) }}{% endblock %}

View File

@ -19,7 +19,7 @@ search-modal.html: The search modal
Author: imacat@mail.imacat.idv.tw (imacat)
First written: 2023/3/8
#}
<form action="{{ url_for("accounting.report.search") }}" method="get" role="search" aria-labelledby="accounting-search-modal-label">
<form action="{{ url_for("accounting-report.search") }}" method="get" role="search" aria-labelledby="accounting-search-modal-label">
<div class="modal fade" id="accounting-search-modal" tabindex="-1" aria-labelledby="accounting-search-modal-label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">

View File

@ -118,7 +118,7 @@ First written: 2023/3/8
</button>
{% endif %}
{% if use_search %}
<form class="btn btn-primary d-flex input-group" action="{{ url_for("accounting.report.search") }}" method="get" role="search" aria-labelledby="accounting-toolbar-search-label">
<form class="btn btn-primary d-flex input-group" action="{{ url_for("accounting-report.search") }}" method="get" role="search" aria-labelledby="accounting-toolbar-search-label">
<input id="accounting-toolbar-search" class="form-control form-control-sm" type="search" name="q" value="{{ request.args.q }}" placeholder=" " required="required">
<label id="accounting-toolbar-search-label" for="accounting-toolbar-search" class="input-group-text">
<button type="submit">

View File

@ -35,7 +35,7 @@ from testlib_journal_entry import NON_EMPTY_NOTE, EMPTY_NOTE, \
PREFIX: str = "/accounting/journal-entries"
"""The URL prefix for the journal entry management."""
RETURN_TO_URI: str = "/accounting/reports"
RETURN_TO_URI: str = "/accounting"
"""The URL to return to after the operation."""