Added the currency-chooser.html template to simplify the templates of the report.

This commit is contained in:
依瑪貓 2023-03-08 07:49:34 +08:00
parent f9fc033de6
commit 52b5151fe0
6 changed files with 46 additions and 145 deletions

View File

@ -59,21 +59,7 @@ First written: 2023/3/7
{% with report_chooser = report.report_chooser %} {% with report_chooser = report.report_chooser %}
{% include "accounting/report/include/report-chooser.html" %} {% include "accounting/report/include/report-chooser.html" %}
{% endwith %} {% endwith %}
<div class="btn-group"> {% include "accounting/report/include/currency-chooser.html" %}
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-money-bill-wave"></i>
{{ report.currency.name|title }}
</button>
<ul class="dropdown-menu">
{% for currency in report.currency_options %}
<li>
<a class="dropdown-item {% if currency.is_active %} active {% endif %}" href="{{ currency.url }}">
{{ currency.title }}
</a>
</li>
{% endfor %}
</ul>
</div>
<button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-period-chooser-modal"> <button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-period-chooser-modal">
<i class="fa-solid fa-calendar-day"></i> <i class="fa-solid fa-calendar-day"></i>
{{ report.period.desc|title }} {{ report.period.desc|title }}
@ -92,20 +78,7 @@ First written: 2023/3/7
{% with report_chooser = report.report_chooser %} {% with report_chooser = report.report_chooser %}
{% include "accounting/report/include/report-chooser.html" %} {% include "accounting/report/include/report-chooser.html" %}
{% endwith %} {% endwith %}
<div class="btn-group"> {% include "accounting/report/include/currency-chooser.html" %}
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-money-bill-wave"></i>
</button>
<ul class="dropdown-menu">
{% for currency in report.currency_options %}
<li>
<a class="dropdown-item {% if currency.is_active %} active {% endif %}" href="{{ currency.url }}">
{{ currency.title }}
</a>
</li>
{% endfor %}
</ul>
</div>
<button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-period-chooser-modal"> <button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-period-chooser-modal">
<i class="fa-solid fa-calendar-day"></i> <i class="fa-solid fa-calendar-day"></i>
{{ A_("Period") }} {{ A_("Period") }}

View File

@ -0,0 +1,36 @@
{#
The Mia! Accounting Flask Project
currency-chooser.html: The currency chooser in the action buttons
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/8
#}
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-money-bill-wave"></i>
<span class="d-none d-md-inline">{{ report.currency.name|title }}</span>
</button>
<ul class="dropdown-menu">
{% for currency in report.currency_options %}
<li>
<a class="dropdown-item {% if currency.is_active %} active {% endif %}" href="{{ currency.url }}">
{{ currency.title }}
</a>
</li>
{% endfor %}
</ul>
</div>

View File

@ -60,21 +60,7 @@ First written: 2023/3/5
{% with report_chooser = report.report_chooser %} {% with report_chooser = report.report_chooser %}
{% include "accounting/report/include/report-chooser.html" %} {% include "accounting/report/include/report-chooser.html" %}
{% endwith %} {% endwith %}
<div class="btn-group"> {% include "accounting/report/include/currency-chooser.html" %}
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-money-bill-wave"></i>
{{ report.currency.name|title }}
</button>
<ul class="dropdown-menu">
{% for currency in report.currency_options %}
<li>
<a class="dropdown-item {% if currency.is_active %} active {% endif %}" href="{{ currency.url }}">
{{ currency.title }}
</a>
</li>
{% endfor %}
</ul>
</div>
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-clipboard"></i> <i class="fa-solid fa-clipboard"></i>
@ -108,20 +94,7 @@ First written: 2023/3/5
{% with report_chooser = report.report_chooser %} {% with report_chooser = report.report_chooser %}
{% include "accounting/report/include/report-chooser.html" %} {% include "accounting/report/include/report-chooser.html" %}
{% endwith %} {% endwith %}
<div class="btn-group"> {% include "accounting/report/include/currency-chooser.html" %}
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-money-bill-wave"></i>
</button>
<ul class="dropdown-menu">
{% for currency in report.currency_options %}
<li>
<a class="dropdown-item {% if currency.is_active %} active {% endif %}" href="{{ currency.url }}">
{{ currency.title }}
</a>
</li>
{% endfor %}
</ul>
</div>
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-clipboard"></i> <i class="fa-solid fa-clipboard"></i>

View File

@ -59,21 +59,7 @@ First written: 2023/3/7
{% with report_chooser = report.report_chooser %} {% with report_chooser = report.report_chooser %}
{% include "accounting/report/include/report-chooser.html" %} {% include "accounting/report/include/report-chooser.html" %}
{% endwith %} {% endwith %}
<div class="btn-group"> {% include "accounting/report/include/currency-chooser.html" %}
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-money-bill-wave"></i>
{{ report.currency.name|title }}
</button>
<ul class="dropdown-menu">
{% for currency in report.currency_options %}
<li>
<a class="dropdown-item {% if currency.is_active %} active {% endif %}" href="{{ currency.url }}">
{{ currency.title }}
</a>
</li>
{% endfor %}
</ul>
</div>
<button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-period-chooser-modal"> <button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-period-chooser-modal">
<i class="fa-solid fa-calendar-day"></i> <i class="fa-solid fa-calendar-day"></i>
{{ report.period.desc|title }} {{ report.period.desc|title }}
@ -92,20 +78,7 @@ First written: 2023/3/7
{% with report_chooser = report.report_chooser %} {% with report_chooser = report.report_chooser %}
{% include "accounting/report/include/report-chooser.html" %} {% include "accounting/report/include/report-chooser.html" %}
{% endwith %} {% endwith %}
<div class="btn-group"> {% include "accounting/report/include/currency-chooser.html" %}
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-money-bill-wave"></i>
</button>
<ul class="dropdown-menu">
{% for currency in report.currency_options %}
<li>
<a class="dropdown-item {% if currency.is_active %} active {% endif %}" href="{{ currency.url }}">
{{ currency.title }}
</a>
</li>
{% endfor %}
</ul>
</div>
<button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-period-chooser-modal"> <button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-period-chooser-modal">
<i class="fa-solid fa-calendar-day"></i> <i class="fa-solid fa-calendar-day"></i>
{{ A_("Period") }} {{ A_("Period") }}

View File

@ -60,21 +60,7 @@ First written: 2023/3/5
{% with report_chooser = report.report_chooser %} {% with report_chooser = report.report_chooser %}
{% include "accounting/report/include/report-chooser.html" %} {% include "accounting/report/include/report-chooser.html" %}
{% endwith %} {% endwith %}
<div class="btn-group"> {% include "accounting/report/include/currency-chooser.html" %}
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-money-bill-wave"></i>
{{ report.currency.name|title }}
</button>
<ul class="dropdown-menu">
{% for currency in report.currency_options %}
<li>
<a class="dropdown-item {% if currency.is_active %} active {% endif %}" href="{{ currency.url }}">
{{ currency.title }}
</a>
</li>
{% endfor %}
</ul>
</div>
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-clipboard"></i> <i class="fa-solid fa-clipboard"></i>
@ -108,20 +94,7 @@ First written: 2023/3/5
{% with report_chooser = report.report_chooser %} {% with report_chooser = report.report_chooser %}
{% include "accounting/report/include/report-chooser.html" %} {% include "accounting/report/include/report-chooser.html" %}
{% endwith %} {% endwith %}
<div class="btn-group"> {% include "accounting/report/include/currency-chooser.html" %}
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-money-bill-wave"></i>
</button>
<ul class="dropdown-menu">
{% for currency in report.currency_options %}
<li>
<a class="dropdown-item {% if currency.is_active %} active {% endif %}" href="{{ currency.url }}">
{{ currency.title }}
</a>
</li>
{% endfor %}
</ul>
</div>
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-clipboard"></i> <i class="fa-solid fa-clipboard"></i>

View File

@ -59,21 +59,7 @@ First written: 2023/3/5
{% with report_chooser = report.report_chooser %} {% with report_chooser = report.report_chooser %}
{% include "accounting/report/include/report-chooser.html" %} {% include "accounting/report/include/report-chooser.html" %}
{% endwith %} {% endwith %}
<div class="btn-group"> {% include "accounting/report/include/currency-chooser.html" %}
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-money-bill-wave"></i>
{{ report.currency.name|title }}
</button>
<ul class="dropdown-menu">
{% for currency in report.currency_options %}
<li>
<a class="dropdown-item {% if currency.is_active %} active {% endif %}" href="{{ currency.url }}">
{{ currency.title }}
</a>
</li>
{% endfor %}
</ul>
</div>
<button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-period-chooser-modal"> <button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-period-chooser-modal">
<i class="fa-solid fa-calendar-day"></i> <i class="fa-solid fa-calendar-day"></i>
{{ report.period.desc|title }} {{ report.period.desc|title }}
@ -92,20 +78,7 @@ First written: 2023/3/5
{% with report_chooser = report.report_chooser %} {% with report_chooser = report.report_chooser %}
{% include "accounting/report/include/report-chooser.html" %} {% include "accounting/report/include/report-chooser.html" %}
{% endwith %} {% endwith %}
<div class="btn-group"> {% include "accounting/report/include/currency-chooser.html" %}
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-money-bill-wave"></i>
</button>
<ul class="dropdown-menu">
{% for currency in report.currency_options %}
<li>
<a class="dropdown-item {% if currency.is_active %} active {% endif %}" href="{{ currency.url }}">
{{ currency.title }}
</a>
</li>
{% endfor %}
</ul>
</div>
<button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-period-chooser-modal"> <button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-period-chooser-modal">
<i class="fa-solid fa-calendar-day"></i> <i class="fa-solid fa-calendar-day"></i>
{{ A_("Period") }} {{ A_("Period") }}