Added the action-buttons.html template and retired the report-chooser.html and currency-chooser.html templates, as the template for the common action buttons.

This commit is contained in:
依瑪貓 2023-03-08 10:33:28 +08:00
parent 6e1d35eda4
commit 10d1be8bd1
10 changed files with 202 additions and 425 deletions

View File

@ -31,41 +31,12 @@ First written: 2023/3/7
{% block content %} {% block content %}
<div class="btn-group mb-2 d-none d-md-inline-flex"> <div class="btn-group mb-2 d-none d-md-inline-flex">
{% if accounting_can_edit() %} {% with use_add_new = true,
<div class="btn-group" role="group"> use_report_chooser = true,
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> use_currency_chooser = true,
<i class="fa-solid fa-plus"></i> use_period_chooser = true %}
{{ A_("New") }} {% include "accounting/report/include/action-buttons.html" %}
</button> {% endwith %}
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.CASH_EXPENSE)|accounting_append_next }}">
{{ A_("Cash Expense") }}
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.CASH_INCOME)|accounting_append_next }}">
{{ A_("Cash Income") }}
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.TRANSFER)|accounting_append_next }}">
{{ A_("Transfer") }}
</a>
</li>
</ul>
</div>
{% endif %}
{% include "accounting/report/include/report-chooser.html" %}
{% include "accounting/report/include/currency-chooser.html" %}
<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>
{{ report.period.desc|title }}
</button>
<a class="btn btn-primary" role="button" href="{{ report.csv_uri }}">
<i class="fa-solid fa-download"></i>
{{ A_("Download") }}
</a>
</div> </div>
{% with txn_types = report.txn_types %} {% with txn_types = report.txn_types %}
@ -73,12 +44,11 @@ First written: 2023/3/7
{% endwith %} {% endwith %}
<div class="btn-group btn-actions mb-3 d-md-none"> <div class="btn-group btn-actions mb-3 d-md-none">
{% include "accounting/report/include/report-chooser.html" %} {% with use_report_chooser = true,
{% include "accounting/report/include/currency-chooser.html" %} use_currency_chooser = true,
<button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-period-chooser-modal"> use_period_chooser = true %}
<i class="fa-solid fa-calendar-day"></i> {% include "accounting/report/include/action-buttons.html" %}
{{ A_("Period") }} {% endwith %}
</button>
</div> </div>
{% with period = report.period, period_chooser = report.period_chooser %} {% with period = report.period, period_chooser = report.period_chooser %}

View File

@ -0,0 +1,121 @@
{#
The Mia! Accounting Flask Project
action-buttons.html: The action buttons on the report
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
#}
{% if use_add_new %}
{% if accounting_can_edit() %}
<div class="btn-group" role="group">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-plus"></i>
<span class="d-none d-md-inline">{{ A_("New") }}</span>
</button>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.CASH_EXPENSE)|accounting_append_next }}">
{{ A_("Cash Expense") }}
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.CASH_INCOME)|accounting_append_next }}">
{{ A_("Cash Income") }}
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.TRANSFER)|accounting_append_next }}">
{{ A_("Transfer") }}
</a>
</li>
</ul>
</div>
{% endif %}
{% endif %}
{% if use_report_chooser %}
<div class="btn-group" role="group">
<button class="btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-book"></i>
<span class="d-none d-md-inline">{{ report.report_chooser.current_report }}</span>
</button>
<ul class="dropdown-menu" aria-label="{{ A_("Report") }}">
{% for report in report.report_chooser %}
<li><a class="dropdown-item {% if report.is_active %} active {% endif %}" href="{{ report.url }}">{{ report.title }}</a></li>
{% endfor %}
<li>
<span class="dropdown-item accounting-clickable" data-bs-toggle="modal" data-bs-target="#accounting-search-modal">
{{ A_("Search") }}
</span>
</li>
</ul>
</div>
{% endif %}
{% if use_currency_chooser %}
<div class="btn-group" role="group">
<button class="btn btn-primary dropdown-toggle" type="button" 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" aria-label="{{ A_("Currency") }}">
{% 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>
{% endif %}
{% if use_account_chooser %}
<div class="btn-group" role="group">
<button class="btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-clipboard"></i>
<span class="d-none d-md-inline">{{ report.account.title|title }}</span>
</button>
<ul class="dropdown-menu" aria-label="{{ A_("Account") }}">
{% for account in report.account_options %}
<li>
<a class="dropdown-item {% if account.is_active %} active {% endif %}" href="{{ account.url }}">
{{ account.title|title }}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if use_period_chooser %}
<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>
<span class="d-none d-md-inline">{{ report.period.desc|title }}</span>
</button>
{% endif %}
{% if use_search %}
<form class="btn btn-primary d-flex input-group accounting-search-{{ search_platform }}-form" action="{{ url_for("accounting.report.search") }}" method="get" role="search" aria-label="{{ search_aria_label }}">
<input id="accounting-search-{{ search_platform }}" class="form-control form-control-sm accounting-search-input" type="search" name="q" value="{{ request.args.q }}" placeholder=" " required="required">
<label for="accounting-search-{{ search_platform }}" class="accounting-search-label">
<button type="submit">
<i class="fa-solid fa-magnifying-glass"></i>
<span class="d-none d-md-inline">{{ A_("Search") }}</span>
</button>
</label>
</form>
{% endif %}
<a class="btn btn-primary" role="button" href="{{ report.csv_uri }}">
<i class="fa-solid fa-download"></i>
<span class="d-none d-md-inline">{{ A_("Download") }}</span>
</a>

View File

@ -1,36 +0,0 @@
{#
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

@ -1,38 +0,0 @@
{#
The Mia! Accounting Flask Project
report-chooser.html: The report chooser
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/4
#}
<div class="btn-group" role="group">
<button id="accounting-report-chooser" class="btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-book"></i>
<span class="d-none d-md-inline">{{ report.report_chooser.current_report }}</span>
<span class="d-md-none">{{ A_("Report") }}</span>
</button>
<ul class="dropdown-menu" aria-labelledby="accounting-report-chooser">
{% for report in report.report_chooser %}
<li><a class="dropdown-item {% if report.is_active %} active {% endif %}" href="{{ report.url }}">{{ report.title }}</a></li>
{% endfor %}
<li>
<span class="dropdown-item accounting-clickable" data-bs-toggle="modal" data-bs-target="#accounting-search-modal">
{{ A_("Search") }}
</span>
</li>
</ul>
</div>

View File

@ -32,56 +32,13 @@ First written: 2023/3/5
{% block content %} {% block content %}
<div class="btn-group mb-2 d-none d-md-inline-flex"> <div class="btn-group mb-2 d-none d-md-inline-flex">
{% if accounting_can_edit() %} {% with use_add_new = true,
<div class="btn-group" role="group"> use_report_chooser = true,
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> use_currency_chooser = true,
<i class="fa-solid fa-plus"></i> use_account_chooser = true,
{{ A_("New") }} use_period_chooser = true %}
</button> {% include "accounting/report/include/action-buttons.html" %}
<ul class="dropdown-menu"> {% endwith %}
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.CASH_EXPENSE)|accounting_append_next }}">
{{ A_("Cash Expense") }}
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.CASH_INCOME)|accounting_append_next }}">
{{ A_("Cash Income") }}
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.TRANSFER)|accounting_append_next }}">
{{ A_("Transfer") }}
</a>
</li>
</ul>
</div>
{% endif %}
{% include "accounting/report/include/report-chooser.html" %}
{% include "accounting/report/include/currency-chooser.html" %}
<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-clipboard"></i>
{{ report.account.title|title }}
</button>
<ul class="dropdown-menu">
{% for account in report.account_options %}
<li>
<a class="dropdown-item {% if account.is_active %} active {% endif %}" href="{{ account.url }}">
{{ account.title|title }}
</a>
</li>
{% endfor %}
</ul>
</div>
<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>
{{ report.period.desc|title }}
</button>
<a class="btn btn-primary" role="button" href="{{ report.csv_uri }}">
<i class="fa-solid fa-download"></i>
{{ A_("Download") }}
</a>
</div> </div>
{% with txn_types = report.txn_types %} {% with txn_types = report.txn_types %}
@ -89,26 +46,12 @@ First written: 2023/3/5
{% endwith %} {% endwith %}
<div class="btn-group btn-actions mb-3 d-md-none"> <div class="btn-group btn-actions mb-3 d-md-none">
{% include "accounting/report/include/report-chooser.html" %} {% with use_report_chooser = true,
{% include "accounting/report/include/currency-chooser.html" %} use_currency_chooser = true,
<div class="btn-group"> use_account_chooser = true,
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> use_period_chooser = true %}
<i class="fa-solid fa-clipboard"></i> {% include "accounting/report/include/action-buttons.html" %}
</button> {% endwith %}
<ul class="dropdown-menu">
{% for account in report.account_options %}
<li>
<a class="dropdown-item {% if account.is_active %} active {% endif %}" href="{{ account.url }}">
{{ account.title|title }}
</a>
</li>
{% endfor %}
</ul>
</div>
<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>
{{ A_("Period") }}
</button>
</div> </div>
{% with period = report.period, period_chooser = report.period_chooser %} {% with period = report.period, period_chooser = report.period_chooser %}

View File

@ -31,41 +31,12 @@ First written: 2023/3/7
{% block content %} {% block content %}
<div class="btn-group mb-2 d-none d-md-inline-flex"> <div class="btn-group mb-2 d-none d-md-inline-flex">
{% if accounting_can_edit() %} {% with use_add_new = true,
<div class="btn-group" role="group"> use_report_chooser = true,
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> use_currency_chooser = true,
<i class="fa-solid fa-plus"></i> use_period_chooser = true %}
{{ A_("New") }} {% include "accounting/report/include/action-buttons.html" %}
</button> {% endwith %}
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.CASH_EXPENSE)|accounting_append_next }}">
{{ A_("Cash Expense") }}
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.CASH_INCOME)|accounting_append_next }}">
{{ A_("Cash Income") }}
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.TRANSFER)|accounting_append_next }}">
{{ A_("Transfer") }}
</a>
</li>
</ul>
</div>
{% endif %}
{% include "accounting/report/include/report-chooser.html" %}
{% include "accounting/report/include/currency-chooser.html" %}
<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>
{{ report.period.desc|title }}
</button>
<a class="btn btn-primary" role="button" href="{{ report.csv_uri }}">
<i class="fa-solid fa-download"></i>
{{ A_("Download") }}
</a>
</div> </div>
{% with txn_types = report.txn_types %} {% with txn_types = report.txn_types %}
@ -73,12 +44,11 @@ First written: 2023/3/7
{% endwith %} {% endwith %}
<div class="btn-group btn-actions mb-3 d-md-none"> <div class="btn-group btn-actions mb-3 d-md-none">
{% include "accounting/report/include/report-chooser.html" %} {% with use_report_chooser = true,
{% include "accounting/report/include/currency-chooser.html" %} use_currency_chooser = true,
<button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-period-chooser-modal"> use_period_chooser = true %}
<i class="fa-solid fa-calendar-day"></i> {% include "accounting/report/include/action-buttons.html" %}
{{ A_("Period") }} {% endwith %}
</button>
</div> </div>
{% with period = report.period, period_chooser = report.period_chooser %} {% with period = report.period, period_chooser = report.period_chooser %}

View File

@ -32,40 +32,11 @@ First written: 2023/3/4
{% block content %} {% block content %}
<div class="btn-group mb-2 d-none d-md-inline-flex"> <div class="btn-group mb-2 d-none d-md-inline-flex">
{% if accounting_can_edit() %} {% with use_add_new = true,
<div class="btn-group" role="group"> use_report_chooser = true,
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> use_period_chooser = true %}
<i class="fa-solid fa-plus"></i> {% include "accounting/report/include/action-buttons.html" %}
{{ A_("New") }} {% endwith %}
</button>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.CASH_EXPENSE)|accounting_append_next }}">
{{ A_("Cash Expense") }}
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.CASH_INCOME)|accounting_append_next }}">
{{ A_("Cash Income") }}
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.TRANSFER)|accounting_append_next }}">
{{ A_("Transfer") }}
</a>
</li>
</ul>
</div>
{% endif %}
{% include "accounting/report/include/report-chooser.html" %}
<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>
{{ report.period.desc|title }}
</button>
<a class="btn btn-primary" role="button" href="{{ report.csv_uri }}">
<i class="fa-solid fa-download"></i>
{{ A_("Download") }}
</a>
</div> </div>
{% with txn_types = report.txn_types %} {% with txn_types = report.txn_types %}
@ -73,11 +44,10 @@ First written: 2023/3/4
{% endwith %} {% endwith %}
<div class="btn-group btn-actions mb-3 d-md-none"> <div class="btn-group btn-actions mb-3 d-md-none">
{% include "accounting/report/include/report-chooser.html" %} {% with use_report_chooser = true,
<button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-period-chooser-modal"> use_period_chooser = true %}
<i class="fa-solid fa-calendar-day"></i> {% include "accounting/report/include/action-buttons.html" %}
{{ A_("Period") }} {% endwith %}
</button>
</div> </div>
{% with period = report.period, period_chooser = report.period_chooser %} {% with period = report.period, period_chooser = report.period_chooser %}

View File

@ -32,56 +32,13 @@ First written: 2023/3/5
{% block content %} {% block content %}
<div class="btn-group mb-2 d-none d-md-inline-flex"> <div class="btn-group mb-2 d-none d-md-inline-flex">
{% if accounting_can_edit() %} {% with use_add_new = true,
<div class="btn-group" role="group"> use_report_chooser = true,
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> use_currency_chooser = true,
<i class="fa-solid fa-plus"></i> use_account_chooser = true,
{{ A_("New") }} use_period_chooser = true %}
</button> {% include "accounting/report/include/action-buttons.html" %}
<ul class="dropdown-menu"> {% endwith %}
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.CASH_EXPENSE)|accounting_append_next }}">
{{ A_("Cash Expense") }}
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.CASH_INCOME)|accounting_append_next }}">
{{ A_("Cash Income") }}
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.TRANSFER)|accounting_append_next }}">
{{ A_("Transfer") }}
</a>
</li>
</ul>
</div>
{% endif %}
{% include "accounting/report/include/report-chooser.html" %}
{% include "accounting/report/include/currency-chooser.html" %}
<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-clipboard"></i>
{{ report.account.title|title }}
</button>
<ul class="dropdown-menu">
{% for account in report.account_options %}
<li>
<a class="dropdown-item {% if account.is_active %} active {% endif %}" href="{{ account.url }}">
{{ account.title|title }}
</a>
</li>
{% endfor %}
</ul>
</div>
<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>
{{ report.period.desc|title }}
</button>
<a class="btn btn-primary" role="button" href="{{ report.csv_uri }}">
<i class="fa-solid fa-download"></i>
{{ A_("Download") }}
</a>
</div> </div>
{% with txn_types = report.txn_types %} {% with txn_types = report.txn_types %}
@ -89,26 +46,12 @@ First written: 2023/3/5
{% endwith %} {% endwith %}
<div class="btn-group btn-actions mb-3 d-md-none"> <div class="btn-group btn-actions mb-3 d-md-none">
{% include "accounting/report/include/report-chooser.html" %} {% with use_report_chooser = true,
{% include "accounting/report/include/currency-chooser.html" %} use_currency_chooser = true,
<div class="btn-group"> use_account_chooser = true,
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> use_period_chooser = true %}
<i class="fa-solid fa-clipboard"></i> {% include "accounting/report/include/action-buttons.html" %}
</button> {% endwith %}
<ul class="dropdown-menu">
{% for account in report.account_options %}
<li>
<a class="dropdown-item {% if account.is_active %} active {% endif %}" href="{{ account.url }}">
{{ account.title|title }}
</a>
</li>
{% endfor %}
</ul>
</div>
<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>
{{ A_("Period") }}
</button>
</div> </div>
{% with period = report.period, period_chooser = report.period_chooser %} {% with period = report.period, period_chooser = report.period_chooser %}

View File

@ -31,45 +31,13 @@ First written: 2023/3/8
{% block content %} {% block content %}
<div class="btn-group mb-2 d-none d-md-inline-flex"> <div class="btn-group mb-2 d-none d-md-inline-flex">
{% if accounting_can_edit() %} {% with use_add_new = true,
<div class="btn-group" role="group"> use_report_chooser = true,
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> use_search = true,
<i class="fa-solid fa-plus"></i> search_platform = "desktop",
{{ A_("New") }} search_aria_label = A_("Search for Desktop") %}
</button> {% include "accounting/report/include/action-buttons.html" %}
<ul class="dropdown-menu"> {% endwith %}
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.CASH_EXPENSE)|accounting_append_next }}">
{{ A_("Cash Expense") }}
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.CASH_INCOME)|accounting_append_next }}">
{{ A_("Cash Income") }}
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.TRANSFER)|accounting_append_next }}">
{{ A_("Transfer") }}
</a>
</li>
</ul>
</div>
{% endif %}
{% include "accounting/report/include/report-chooser.html" %}
<form class="btn btn-primary d-flex input-group accounting-search-desktop-form" action="{{ url_for("accounting.report.search") }}" method="get" role="search" aria-label="{{ A_("Search for Desktop") }}">
<input id="accounting-search-desktop" class="form-control form-control-sm accounting-search-input" type="search" name="q" value="{{ request.args.q }}" placeholder=" " required="required">
<label for="accounting-search-desktop" class="accounting-search-label">
<button type="submit">
<i class="fa-solid fa-magnifying-glass"></i>
{{ A_("Search") }}
</button>
</label>
</form>
<a class="btn btn-primary" role="button" href="{{ report.csv_uri }}">
<i class="fa-solid fa-download"></i>
{{ A_("Download") }}
</a>
</div> </div>
{% with txn_types = report.txn_types %} {% with txn_types = report.txn_types %}
@ -77,16 +45,12 @@ First written: 2023/3/8
{% endwith %} {% endwith %}
<div class="btn-group btn-actions mb-3 d-md-none"> <div class="btn-group btn-actions mb-3 d-md-none">
{% include "accounting/report/include/report-chooser.html" %} {% with use_report_chooser = true,
<form class="btn btn-primary d-flex input-group" action="{{ url_for("accounting.report.search") }}" method="get" role="search" aria-label="{{ A_("Search for Mobile") }}"> use_search = true,
<input id="accounting-search-mobile" class="form-control form-control-sm accounting-search-input" type="search" name="q" value="{{ request.args.q }}" placeholder=" " required="required"> search_platform = "mobile",
<label for="accounting-search-mobile" class="accounting-search-label"> search_aria_label = A_("Search for Mobile") %}
<button type="submit"> {% include "accounting/report/include/action-buttons.html" %}
<i class="fa-solid fa-magnifying-glass"></i> {% endwith %}
{{ A_("Search") }}
</button>
</label>
</form>
</div> </div>
{% include "accounting/report/include/search-modal.html" %} {% include "accounting/report/include/search-modal.html" %}

View File

@ -31,41 +31,12 @@ First written: 2023/3/5
{% block content %} {% block content %}
<div class="btn-group mb-2 d-none d-md-inline-flex"> <div class="btn-group mb-2 d-none d-md-inline-flex">
{% if accounting_can_edit() %} {% with use_add_new = true,
<div class="btn-group" role="group"> use_report_chooser = true,
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> use_currency_chooser = true,
<i class="fa-solid fa-plus"></i> use_period_chooser = true %}
{{ A_("New") }} {% include "accounting/report/include/action-buttons.html" %}
</button> {% endwith %}
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.CASH_EXPENSE)|accounting_append_next }}">
{{ A_("Cash Expense") }}
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.CASH_INCOME)|accounting_append_next }}">
{{ A_("Cash Income") }}
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for("accounting.transaction.create", txn_type=report.txn_types.TRANSFER)|accounting_append_next }}">
{{ A_("Transfer") }}
</a>
</li>
</ul>
</div>
{% endif %}
{% include "accounting/report/include/report-chooser.html" %}
{% include "accounting/report/include/currency-chooser.html" %}
<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>
{{ report.period.desc|title }}
</button>
<a class="btn btn-primary" role="button" href="{{ report.csv_uri }}">
<i class="fa-solid fa-download"></i>
{{ A_("Download") }}
</a>
</div> </div>
{% with txn_types = report.txn_types %} {% with txn_types = report.txn_types %}
@ -73,12 +44,11 @@ First written: 2023/3/5
{% endwith %} {% endwith %}
<div class="btn-group btn-actions mb-3 d-md-none"> <div class="btn-group btn-actions mb-3 d-md-none">
{% include "accounting/report/include/report-chooser.html" %} {% with use_report_chooser = true,
{% include "accounting/report/include/currency-chooser.html" %} use_currency_chooser = true,
<button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-period-chooser-modal"> use_period_chooser = true %}
<i class="fa-solid fa-calendar-day"></i> {% include "accounting/report/include/action-buttons.html" %}
{{ A_("Period") }} {% endwith %}
</button>
</div> </div>
{% with period = report.period, period_chooser = report.period_chooser %} {% with period = report.period, period_chooser = report.period_chooser %}