Added the read-only view for the options.

This commit is contained in:
2023-03-22 16:08:16 +08:00
parent 619540da49
commit 7066f75e72
7 changed files with 171 additions and 7 deletions

View File

@ -53,7 +53,7 @@ First written: 2023/1/26
</li>
{% if accounting_can_admin() %}
<li>
<a class="dropdown-item {% if request.endpoint and request.endpoint.startswith("accounting.option.") %} active {% endif %}" href="{{ url_for("accounting.option.form") }}">
<a class="dropdown-item {% if request.endpoint and request.endpoint.startswith("accounting.option.") %} active {% endif %}" href="{{ url_for("accounting.option.detail") }}">
<i class="fa-solid fa-gear"></i>
{{ A_("Settings") }}
</a>

View File

@ -0,0 +1,63 @@
{#
The Mia! Accounting Flask Project
detail.html: The option detail
Copyright (c) 2023 imacat.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: imacat@mail.imacat.idv.tw (imacat)
First written: 2023/3/22
#}
{% extends "accounting/base.html" %}
{% block header %}{% block title %}{{ A_("Settings") }}{% endblock %}{% endblock %}
{% block content %}
<div class="mb-3 accounting-toolbar">
<a class="btn btn-primary d-none d-md-inline" role="button" href="{{ url_for("accounting.option.edit")|accounting_inherit_next }}">
<i class="fa-solid fa-pen-to-square"></i>
{{ A_("Edit") }}
</a>
</div>
<div class="d-md-none accounting-material-fab">
<a class="btn btn-primary" role="button" href="{{ url_for("accounting.option.edit")|accounting_inherit_next }}">
<i class="fa-solid fa-pen-to-square"></i>
</a>
</div>
<div id="accounting-default-currency" class="form-control mb-3 accounting-material-text-field accounting-not-empty">
<label class="form-label" for="accounting-default-currency">{{ A_("Default Currency") }}</label>
<div>{{ obj.default_currency_text }}</div>
</div>
<div id="accounting-default-ie-account" class="form-control mb-3 accounting-material-text-field accounting-not-empty">
<label class="form-label" for="accounting-default-ie-account">{{ A_("Default Account for the Income and Expenses Log") }}</label>
<div>{{ obj.default_ie_account_code_text }}</div>
</div>
{% with expense_income = "expense",
label = A_("Expense"),
recurring_items = obj.recurring.expenses %}
{% include "accounting/option/include/detail-recurring-expense-income.html" %}
{% endwith %}
{% with expense_income = "income",
label = A_("Income"),
recurring_items = obj.recurring.incomes %}
{% include "accounting/option/include/detail-recurring-expense-income.html" %}
{% endwith %}
{% endblock %}

View File

@ -29,7 +29,14 @@ First written: 2023/3/22
{% block content %}
<form id="accounting-form" action="{{ url_for("accounting.option.form") }}" method="post" data-recurring-item-template="{{ form.recurring.item_template }}">
<div class="mb-3 accounting-toolbar">
<a class="btn btn-primary" role="button" href="{{ url_for("accounting.option.detail")|accounting_inherit_next }}">
<i class="fa-solid fa-circle-chevron-left"></i>
<span class="d-none d-md-inline">{{ A_("Back") }}</span>
</a>
</div>
<form id="accounting-form" action="{{ url_for("accounting.option.update") }}" method="post" data-recurring-item-template="{{ form.recurring.item_template }}">
{{ form.csrf_token }}
{% if request.args.next %}
<input type="hidden" name="next" value="{{ request.args.next }}">

View File

@ -0,0 +1,29 @@
{#
The Mia! Accounting Flask Project
detail-recurring-expense-income.html: The recurring expense or income in the option detail
Copyright (c) 2023 imacat.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: imacat@mail.imacat.idv.tw (imacat)
First written: 2023/3/22
#}
<div id="accounting-recurring-{{ expense_income }}" class="form-control mb-3 accounting-material-text-field accounting-not-empty">
<label class="form-label" for="accounting-recurring-{{ expense_income }}">{{ label }}</label>
<ul class="list-group mb-2 mt-2">
{% for item in recurring_items %}
{% include "accounting/option/include/detail-recurring-item.html" %}
{% endfor %}
</ul>
</div>

View File

@ -0,0 +1,28 @@
{#
The Mia! Accounting Flask Project
detail-recurring-item.html: The recurring item in the option detail
Copyright (c) 2023 imacat.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: imacat@mail.imacat.idv.tw (imacat)
First written: 2023/3/22
#}
{# <ul> For SonarQube not to complain about incorrect HTML #}
<li class="list-group-item list-group-item-action">
<div class="small">{{ item.account_text }}</div>
<div>{{ item.name }}</div>
<div class="small">{{ item.description_template }}</div>
</li>
{# </ul> For SonarQube not to complain about incorrect HTML #}