Revised to allow the viewers to view the account order page.

This commit is contained in:
依瑪貓 2023-02-03 12:29:37 +08:00
parent 784e7bde49
commit b5d87d2387
3 changed files with 14 additions and 10 deletions

View File

@ -169,7 +169,7 @@ def delete_account(account: Account) -> redirect:
@bp.get("/bases/<baseAccount:base>", endpoint="order") @bp.get("/bases/<baseAccount:base>", endpoint="order")
@has_permission(can_edit) @has_permission(can_view)
def show_account_order(base: BaseAccount) -> str: def show_account_order(base: BaseAccount) -> str:
"""Shows the order of the accounts under a same base account. """Shows the order of the accounts under a same base account.

View File

@ -35,10 +35,12 @@ First written: 2023/1/31
<i class="fa-solid fa-gear"></i> <i class="fa-solid fa-gear"></i>
{{ A_("Settings") }} {{ A_("Settings") }}
</a> </a>
<a class="btn btn-primary" href="{{ url_for("accounting.account.order", base=obj.base)|append_next }}"> {% endif %}
<i class="fa-solid fa-bars-staggered"></i> <a class="btn btn-primary" href="{{ url_for("accounting.account.order", base=obj.base)|append_next }}">
{{ A_("Order") }} <i class="fa-solid fa-bars-staggered"></i>
</a> {{ A_("Order") }}
</a>
{% if can_edit_accounting() %}
<button class="btn btn-danger" type="button" data-bs-toggle="modal" data-bs-target="#delete-modal"> <button class="btn btn-danger" type="button" data-bs-toggle="modal" data-bs-target="#delete-modal">
<i class="fa-solid fa-trash"></i> <i class="fa-solid fa-trash"></i>
{{ A_("Delete") }} {{ A_("Delete") }}

View File

@ -37,7 +37,7 @@ First written: 2023/2/2
</a> </a>
</div> </div>
{% if base.accounts|length > 1 %} {% if base.accounts|length > 1 and can_edit_accounting() %}
<form action="{{ url_for("accounting.account.sort", base=base) }}" method="post"> <form action="{{ url_for("accounting.account.sort", base=base) }}" method="post">
<input id="csrf_token" type="hidden" name="csrf_token" value="{{ csrf_token() }}"> <input id="csrf_token" type="hidden" name="csrf_token" value="{{ csrf_token() }}">
{% if "next" in request.args %} {% if "next" in request.args %}
@ -69,11 +69,13 @@ First written: 2023/2/2
</button> </button>
</div> </div>
</form> </form>
{% elif base.accounts|length == 1 %} {% elif base.accounts %}
<ul class="list-group mb-3"> <ul class="list-group mb-3">
<li class="list-group-item"> {% for account in base.accounts|sort(attribute="no") %}
{{ base.accounts[0] }} <li class="list-group-item">
</li> {{ account }}
</li>
{% endfor %}
</ul> </ul>
{% else %} {% else %}
<p>{{ A_("There is no data.") }}</p> <p>{{ A_("There is no data.") }}</p>