Revised the accounting reordering to handle the cases with only one account or no account.
This commit is contained in:
parent
589da0c1c6
commit
1c1be87f3e
@ -24,6 +24,7 @@
|
|||||||
// Initializes the page JavaScript.
|
// Initializes the page JavaScript.
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
const list = document.getElementById("account-order-list");
|
const list = document.getElementById("account-order-list");
|
||||||
|
if (list !== null) {
|
||||||
const onReorder = function () {
|
const onReorder = function () {
|
||||||
const accounts = Array.from(list.children);
|
const accounts = Array.from(list.children);
|
||||||
for (let i = 0; i < accounts.length; i++) {
|
for (let i = 0; i < accounts.length; i++) {
|
||||||
@ -34,4 +35,5 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
initializeDragAndDropReordering(list, onReorder);
|
initializeDragAndDropReordering(list, onReorder);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@ -37,6 +37,7 @@ First written: 2023/2/2
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if base.accounts|length > 1 %}
|
||||||
<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 %}
|
||||||
@ -68,5 +69,14 @@ First written: 2023/2/2
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
{% elif base.accounts|length == 1 %}
|
||||||
|
<ul class="list-group mb-3">
|
||||||
|
<li class="list-group-item">
|
||||||
|
{{ base.accounts[0] }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{% else %}
|
||||||
|
<p>{{ A_("There is no data.") }}</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user