Renamed "summary" to "description" in the voucher line item.

This commit is contained in:
2023-03-20 16:01:25 +08:00
parent 3251660092
commit d18dd7d4d2
38 changed files with 680 additions and 678 deletions

View File

@ -21,7 +21,7 @@ First written: 2023/3/8
#}
<div>{{ line_item.date|accounting_format_date }}</div>
<div>{{ line_item.account.title|title }}</div>
<div>{{ line_item.summary|accounting_default }}</div>
<div>{{ line_item.description|accounting_default }}</div>
<div class="accounting-amount">{{ line_item.income|accounting_format_amount|accounting_default }}</div>
<div class="accounting-amount">{{ line_item.expense|accounting_format_amount|accounting_default }}</div>
<div class="accounting-amount {% if line_item.balance < 0 %} text-danger {% endif %}">{{ line_item.balance|accounting_report_format_amount }}</div>

View File

@ -30,8 +30,8 @@ First written: 2023/3/5
{% endif %}
</div>
{% endif %}
{% if line_item.summary %}
<div>{{ line_item.summary }}</div>
{% if line_item.description %}
<div>{{ line_item.description }}</div>
{% endif %}
</div>

View File

@ -20,7 +20,7 @@ Author: imacat@mail.imacat.idv.tw (imacat)
First written: 2023/3/8
#}
<div>{{ line_item.date|accounting_format_date }}</div>
<div>{{ line_item.summary|accounting_default }}</div>
<div>{{ line_item.description|accounting_default }}</div>
<div class="accounting-amount">{{ line_item.debit|accounting_format_amount|accounting_default }}</div>
<div class="accounting-amount">{{ line_item.credit|accounting_format_amount|accounting_default }}</div>
{% if report.account.is_real %}

View File

@ -25,8 +25,8 @@ First written: 2023/3/5
{{ line_item.date|accounting_format_date }}
</div>
{% endif %}
{% if line_item.summary %}
<div>{{ line_item.summary }}</div>
{% if line_item.description %}
<div>{{ line_item.description }}</div>
{% endif %}
</div>

View File

@ -54,7 +54,7 @@ First written: 2023/3/5
<div class="accounting-report-table-row">
<div>{{ A_("Date") }}</div>
<div>{{ A_("Account") }}</div>
<div>{{ A_("Summary") }}</div>
<div>{{ A_("Description") }}</div>
<div class="accounting-amount">{{ A_("Income") }}</div>
<div class="accounting-amount">{{ A_("Expense") }}</div>
<div class="accounting-amount">{{ A_("Balance") }}</div>

View File

@ -53,7 +53,7 @@ First written: 2023/3/4
<div>{{ A_("Date") }}</div>
<div>{{ A_("Currency") }}</div>
<div>{{ A_("Account") }}</div>
<div>{{ A_("Summary") }}</div>
<div>{{ A_("Description") }}</div>
<div class="accounting-amount">{{ A_("Debit") }}</div>
<div class="accounting-amount">{{ A_("Credit") }}</div>
</div>
@ -67,7 +67,7 @@ First written: 2023/3/4
<span class="d-none d-md-inline">{{ line_item.account.code }}</span>
{{ line_item.account.title|title }}
</div>
<div>{{ line_item.summary|accounting_default }}</div>
<div>{{ line_item.description|accounting_default }}</div>
<div class="accounting-amount">{{ line_item.debit|accounting_format_amount|accounting_default }}</div>
<div class="accounting-amount">{{ line_item.credit|accounting_format_amount|accounting_default }}</div>
</a>
@ -87,8 +87,8 @@ First written: 2023/3/4
<span class="badge rounded-pill bg-info">{{ line_item.currency.code }}</span>
{% endif %}
</div>
{% if line_item.summary is not none %}
<div>{{ line_item.summary }}</div>
{% if line_item.description is not none %}
<div>{{ line_item.description }}</div>
{% endif %}
</div>

View File

@ -53,7 +53,7 @@ First written: 2023/3/5
<div class="accounting-report-table-header">
<div class="accounting-report-table-row">
<div>{{ A_("Date") }}</div>
<div>{{ A_("Summary") }}</div>
<div>{{ A_("Description") }}</div>
<div class="accounting-amount">{{ A_("Debit") }}</div>
<div class="accounting-amount">{{ A_("Credit") }}</div>
{% if report.account.is_real %}

View File

@ -50,7 +50,7 @@ First written: 2023/3/8
<div>{{ A_("Date") }}</div>
<div>{{ A_("Currency") }}</div>
<div>{{ A_("Account") }}</div>
<div>{{ A_("Summary") }}</div>
<div>{{ A_("Description") }}</div>
<div class="accounting-amount">{{ A_("Debit") }}</div>
<div class="accounting-amount">{{ A_("Credit") }}</div>
</div>
@ -64,7 +64,7 @@ First written: 2023/3/8
<span class="d-none d-md-inline">{{ line_item.account.code }}</span>
{{ line_item.account.title|title }}
</div>
<div>{{ line_item.summary|accounting_default }}</div>
<div>{{ line_item.description|accounting_default }}</div>
<div class="accounting-amount">{{ line_item.debit|accounting_format_amount|accounting_default }}</div>
<div class="accounting-amount">{{ line_item.credit|accounting_format_amount|accounting_default }}</div>
</a>
@ -84,8 +84,8 @@ First written: 2023/3/8
<span class="badge rounded-pill bg-info">{{ line_item.currency.code }}</span>
{% endif %}
</div>
{% if line_item.summary is not none %}
<div>{{ line_item.summary }}</div>
{% if line_item.description is not none %}
<div>{{ line_item.description }}</div>
{% endif %}
</div>

View File

@ -49,25 +49,25 @@ First written: 2023/2/25
{% with currency_index = currency_index,
side = "debit",
line_item_index = loop.index,
line_item_id = line_item_form.eid.data,
line_item_id = line_item_form.form.eid.data,
only_one_line_item_form = debit_forms|length == 1,
account_code_data = line_item_form.account_code.data|accounting_default,
account_code_error = line_item_form.account_code.errors,
account_text = line_item_form.account_text,
summary_data = line_item_form.summary.data|accounting_default,
summary_errors = line_item_form.summary.errors,
original_line_item_id_data = line_item_form.original_line_item_id.data|accounting_default,
original_line_item_date = line_item_form.original_line_item_date|accounting_default,
original_line_item_text = line_item_form.original_line_item_text|accounting_default,
is_need_offset = line_item_form.is_need_offset,
offset_items = line_item_form.offsets,
offset_total = line_item_form.offset_total|accounting_default("0"),
net_balance_data = line_item_form.net_balance,
net_balance_text = line_item_form.net_balance|accounting_format_amount,
amount_data = line_item_form.amount.data|accounting_voucher_format_amount_input,
amount_errors = line_item_form.amount.errors,
amount_text = line_item_form.amount.data|accounting_format_amount,
line_item_errors = line_item_form.all_errors %}
account_code_data = line_item_form.form.account_code.data|accounting_default,
account_code_error = line_item_form.form.account_code.errors,
account_text = line_item_form.form.account_text,
description_data = line_item_form.form.description.data|accounting_default,
description_errors = line_item_form.form.description.errors,
original_line_item_id_data = line_item_form.form.original_line_item_id.data|accounting_default,
original_line_item_date = line_item_form.form.original_line_item_date|accounting_default,
original_line_item_text = line_item_form.form.original_line_item_text|accounting_default,
is_need_offset = line_item_form.form.is_need_offset,
offset_items = line_item_form.form.offsets,
offset_total = line_item_form.form.offset_total|accounting_default("0"),
net_balance_data = line_item_form.form.net_balance,
net_balance_text = line_item_form.form.net_balance|accounting_format_amount,
amount_data = line_item_form.form.amount.data|accounting_voucher_format_amount_input,
amount_errors = line_item_form.form.amount.errors,
amount_text = line_item_form.form.amount.data|accounting_format_amount,
line_item_errors = line_item_form.form.all_errors %}
{% include "accounting/voucher/include/form-line-item.html" %}
{% endwith %}
{% endfor %}

View File

@ -47,8 +47,8 @@ First written: 2023/2/25
{% endblock %}
{% block form_modals %}
{% with summary_editor = form.summary_editor.debit %}
{% include "accounting/voucher/include/summary-editor-modal.html" %}
{% with description_editor = form.description_editor.debit %}
{% include "accounting/voucher/include/description-editor-modal.html" %}
{% endwith %}
{% with side = "debit",
account_options = form.debit_account_options %}

View File

@ -0,0 +1,193 @@
{#
The Mia! Accounting Flask Project
description-editor-modal.html: The modal of the description editor
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/2/28
#}
<form id="accounting-description-editor-{{ description_editor.side }}" class="accounting-description-editor" data-side="{{ description_editor.side }}">
<div id="accounting-description-editor-{{ description_editor.side }}-modal" class="modal fade" tabindex="-1" aria-labelledby="accounting-description-editor-{{ description_editor.side }}-modal-label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="accounting-description-editor-{{ description_editor.side }}-modal-label">
<label for="accounting-description-editor-{{ description_editor.side }}-description">{{ A_("Description") }}</label>
</h1>
<button class="btn-close" type="button" data-bs-toggle="modal" data-bs-target="#accounting-line-item-editor-modal" aria-label="{{ A_("Close") }}"></button>
</div>
<div class="modal-body">
<div class="d-flex justify-content-between mb-3">
<input id="accounting-description-editor-{{ description_editor.side }}-description" class="form-control" type="text" aria-labelledby="accounting-description-editor-{{ description_editor.side }}-modal-label">
<button id="accounting-description-editor-{{ description_editor.side }}-offset" class="btn btn-primary text-nowrap ms-2" type="button" data-bs-toggle="modal" data-bs-target="#accounting-original-line-item-selector-modal">
{{ A_("Offset...") }}
</button>
</div>
{# Tab navigation #}
<ul class="nav nav-tabs mb-2">
<li class="nav-item">
<span id="accounting-description-editor-{{ description_editor.side }}-general-tab" class="nav-link active accounting-clickable" aria-current="page">
{{ A_("General") }}
</span>
</li>
<li class="nav-item">
<span id="accounting-description-editor-{{ description_editor.side }}-travel-tab" class="nav-link accounting-clickable" aria-current="false">
{{ A_("Travel") }}
</span>
</li>
<li class="nav-item">
<span id="accounting-description-editor-{{ description_editor.side }}-bus-tab" class="nav-link accounting-clickable" aria-current="false">
{{ A_("Bus") }}
</span>
</li>
<li class="nav-item">
<span id="accounting-description-editor-{{ description_editor.side }}-regular-tab" class="nav-link accounting-clickable" aria-current="false">
{{ A_("Regular") }}
</span>
</li>
<li class="nav-item">
<span id="accounting-description-editor-{{ description_editor.side }}-annotation-tab" class="nav-link accounting-clickable" aria-current="false">
{{ A_("Annotation") }}
</span>
</li>
</ul>
{# A general description with a tag #}
<div id="accounting-description-editor-{{ description_editor.side }}-general-page" aria-current="page" aria-labelledby="accounting-description-editor-{{ description_editor.side }}-general-tab">
<div class="form-floating mb-2">
<input id="accounting-description-editor-{{ description_editor.side }}-general-tag" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-description-editor-{{ description_editor.side }}-general-tag">{{ A_("Tag") }}</label>
<div id="accounting-description-editor-{{ description_editor.side }}-general-tag-error" class="invalid-feedback"></div>
</div>
<div>
{% for tag in description_editor.general.tags %}
<button class="btn btn-outline-primary accounting-description-editor-{{ description_editor.side }}-general-btn-tag" type="button" tabindex="-1" data-value="{{ tag.name }}" data-accounts="{{ tag.account_codes|tojson|forceescape }}">
{{ tag }}
</button>
{% endfor %}
</div>
</div>
{# A general trip with the origin and distination #}
<div id="accounting-description-editor-{{ description_editor.side }}-travel-page" class="d-none" aria-current="false" aria-labelledby="accounting-description-editor-{{ description_editor.side }}-travel-tab">
<div class="form-floating mb-2">
<input id="accounting-description-editor-{{ description_editor.side }}-travel-tag" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-description-editor-{{ description_editor.side }}-travel-tag">{{ A_("Tag") }}</label>
<div id="accounting-description-editor-{{ description_editor.side }}-travel-tag-error" class="invalid-feedback"></div>
</div>
<div>
{% for tag in description_editor.travel.tags %}
<button class="btn btn-outline-primary accounting-description-editor-{{ description_editor.side }}-travel-btn-tag" type="button" tabindex="-1" data-value="{{ tag.name }}" data-accounts="{{ tag.account_codes|tojson|forceescape }}">
{{ tag }}
</button>
{% endfor %}
</div>
<div class="d-flex justify-content-between mt-2">
<div class="form-floating">
<input id="accounting-description-editor-{{ description_editor.side }}-travel-from" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-description-editor-{{ description_editor.side }}-travel-from">{{ A_("From") }}</label>
<div id="accounting-description-editor-{{ description_editor.side }}-travel-from-error" class="invalid-feedback"></div>
</div>
<div class="btn-group-vertical ms-1 me-1">
<button class="btn btn-primary accounting-description-editor-{{ description_editor.side }}-travel-direction accounting-default" type="button" tabindex="-1" data-arrow="&rarr;">&rarr;</button>
<button class="btn btn-outline-primary accounting-description-editor-{{ description_editor.side }}-travel-direction" type="button" tabindex="-1" data-arrow="&harr;">&harr;</button>
</div>
<div class="form-floating">
<input id="accounting-description-editor-{{ description_editor.side }}-travel-to" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-description-editor-{{ description_editor.side }}-travel-to">{{ A_("To") }}</label>
<div id="accounting-description-editor-{{ description_editor.side }}-travel-to-error" class="invalid-feedback"></div>
</div>
</div>
</div>
{# A bus trip with the route name or route number, the origin and distination #}
<div id="accounting-description-editor-{{ description_editor.side }}-bus-page" class="d-none" aria-current="false" aria-labelledby="accounting-description-editor-{{ description_editor.side }}-bus-tab">
<div class="d-flex justify-content-between mb-2">
<div class="form-floating me-2">
<input id="accounting-description-editor-{{ description_editor.side }}-bus-tag" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-description-editor-{{ description_editor.side }}-bus-tag">{{ A_("Tag") }}</label>
<div id="accounting-description-editor-{{ description_editor.side }}-bus-tag-error" class="invalid-feedback"></div>
</div>
<div class="form-floating">
<input id="accounting-description-editor-{{ description_editor.side }}-bus-route" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-description-editor-{{ description_editor.side }}-bus-route">{{ A_("Route") }}</label>
<div id="accounting-description-editor-{{ description_editor.side }}-bus-route-error" class="invalid-feedback"></div>
</div>
</div>
<div>
{% for tag in description_editor.bus.tags %}
<button class="btn btn-outline-primary accounting-description-editor-{{ description_editor.side }}-bus-btn-tag" type="button" tabindex="-1" data-value="{{ tag.name }}" data-accounts="{{ tag.account_codes|tojson|forceescape }}">
{{ tag }}
</button>
{% endfor %}
</div>
<div class="d-flex justify-content-between mt-2">
<div class="form-floating me-2">
<input id="accounting-description-editor-{{ description_editor.side }}-bus-from" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-description-editor-{{ description_editor.side }}-bus-from">{{ A_("From") }}</label>
<div id="accounting-description-editor-{{ description_editor.side }}-bus-from-error" class="invalid-feedback"></div>
</div>
<div class="form-floating">
<input id="accounting-description-editor-{{ description_editor.side }}-bus-to" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-description-editor-{{ description_editor.side }}-bus-to">{{ A_("To") }}</label>
<div id="accounting-description-editor-{{ description_editor.side }}-bus-to-error" class="invalid-feedback"></div>
</div>
</div>
</div>
{# A regular income or payment #}
<div id="accounting-description-editor-{{ description_editor.side }}-regular-page" class="d-none" aria-current="false" aria-labelledby="accounting-description-editor-{{ description_editor.side }}-regular-tab">
{# TODO: To be done #}
</div>
{# The annotation #}
<div id="accounting-description-editor-{{ description_editor.side }}-annotation-page" class="d-none" aria-current="false" aria-labelledby="accounting-description-editor-{{ description_editor.side }}-annotation-tab">
<div class="form-floating">
<input id="accounting-description-editor-{{ description_editor.side }}-annotation-number" class="form-control" type="number" min="1" value="" placeholder=" ">
<label class="form-label" for="accounting-description-editor-{{ description_editor.side }}-annotation-number">{{ A_("The number of items") }}</label>
<div id="accounting-description-editor-{{ description_editor.side }}-annotation-number-error" class="invalid-feedback"></div>
</div>
<div class="form-floating mt-2">
<input id="accounting-description-editor-{{ description_editor.side }}-annotation-note" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-description-editor-{{ description_editor.side }}-annotation-note">{{ A_("Note") }}</label>
<div id="accounting-description-editor-{{ description_editor.side }}-annotation-note-error" class="invalid-feedback"></div>
</div>
</div>
{# The suggested accounts #}
<div class="mt-3">
{% for account in description_editor.accounts %}
<button class="btn btn-outline-primary d-none accounting-description-editor-{{ description_editor.side }}-account {% if account.is_need_offset %} accounting-account-is-need-offset {% endif %}" type="button" data-code="{{ account.code }}" data-text="{{ account }}">
{{ account }}
</button>
{% endfor %}
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-line-item-editor-modal">{{ A_("Cancel") }}</button>
<button id="accounting-description-editor-{{ description_editor.side }}-btn-save" type="submit" class="btn btn-primary">{{ A_("Save") }}</button>
</div>
</div>
</div>
</div>
</form>

View File

@ -25,8 +25,8 @@ First written: 2023/3/14
<div class="d-flex justify-content-between">
<div>
<div class="small">{{ line_item.account }}</div>
{% if line_item.summary is not none %}
<div>{{ line_item.summary }}</div>
{% if line_item.description is not none %}
<div>{{ line_item.description }}</div>
{% endif %}
{% if line_item.original_line_item %}
<div class="fst-italic small accounting-original-line-item">

View File

@ -27,13 +27,13 @@ First written: 2023/2/25
<input id="accounting-currency-{{ currency_index }}-{{ side }}-{{ line_item_index }}-no" type="hidden" name="currency-{{ currency_index }}-{{ side }}-{{ line_item_index }}-no" value="{{ line_item_index }}">
<input id="accounting-currency-{{ currency_index }}-{{ side }}-{{ line_item_index }}-original-line-item-id" class="accounting-original-line-item-id" type="hidden" name="currency-{{ currency_index }}-{{ side }}-{{ line_item_index }}-original_line_item_id" value="{{ original_line_item_id_data }}" data-date="{{ original_line_item_date }}" data-text="{{ original_line_item_text }}">
<input id="accounting-currency-{{ currency_index }}-{{ side }}-{{ line_item_index }}-account-code" type="hidden" name="currency-{{ currency_index }}-{{ side }}-{{ line_item_index }}-account_code" value="{{ account_code_data }}" data-text="{{ account_text }}">
<input id="accounting-currency-{{ currency_index }}-{{ side }}-{{ line_item_index }}-summary" type="hidden" name="currency-{{ currency_index }}-{{ side }}-{{ line_item_index }}-summary" value="{{ summary_data }}">
<input id="accounting-currency-{{ currency_index }}-{{ side }}-{{ line_item_index }}-description" type="hidden" name="currency-{{ currency_index }}-{{ side }}-{{ line_item_index }}-description" value="{{ description_data }}">
<input id="accounting-currency-{{ currency_index }}-{{ side }}-{{ line_item_index }}-amount" type="hidden" name="currency-{{ currency_index }}-{{ side }}-{{ line_item_index }}-amount" value="{{ amount_data }}" data-min="{{ offset_total }}">
<div class="accounting-line-item-content">
<div id="accounting-currency-{{ currency_index }}-{{ side }}-{{ line_item_index }}-control" class="form-control clickable d-flex justify-content-between {% if line_item_errors %} is-invalid {% endif %}" data-bs-toggle="modal" data-bs-target="#accounting-line-item-editor-modal">
<div>
<div id="accounting-currency-{{ currency_index }}-{{ side }}-{{ line_item_index }}-account-text" class="small">{{ account_text }}</div>
<div id="accounting-currency-{{ currency_index }}-{{ side }}-{{ line_item_index }}-summary-text">{{ summary_data }}</div>
<div id="accounting-currency-{{ currency_index }}-{{ side }}-{{ line_item_index }}-description-text">{{ description_data }}</div>
<div id="accounting-currency-{{ currency_index }}-{{ side }}-{{ line_item_index }}-original-line-item-text" class="fst-italic small accounting-original-line-item {% if not original_line_item_text %} d-none {% endif %}">
{% if original_line_item_text %}{{ A_("Offset %(item)s", item=original_line_item_text) }}{% endif %}
</div>

View File

@ -27,7 +27,7 @@ First written: 2023/2/26
<script src="{{ url_for("accounting.static", filename="js/voucher-line-item-editor.js") }}"></script>
<script src="{{ url_for("accounting.static", filename="js/account-selector.js") }}"></script>
<script src="{{ url_for("accounting.static", filename="js/original-line-item-selector.js") }}"></script>
<script src="{{ url_for("accounting.static", filename="js/summary-editor.js") }}"></script>
<script src="{{ url_for("accounting.static", filename="js/description-editor.js") }}"></script>
{% endblock %}
{% block content %}

View File

@ -37,8 +37,8 @@ First written: 2023/2/25
<ul id="accounting-original-line-item-selector-option-list" class="list-group accounting-selector-list">
{% for line_item in form.original_line_item_options %}
<li id="accounting-original-line-item-selector-option-{{ line_item.id }}" class="list-group-item d-flex justify-content-between accounting-clickable accounting-original-line-item-selector-option" data-id="{{ line_item.id }}" data-date="{{ line_item.voucher.date }}" data-side="{{ "debit" if line_item.is_debit else "credit" }}" data-currency-code="{{ line_item.currency.code }}" data-account-code="{{ line_item.account_code }}" data-account-text="{{ line_item.account }}" data-summary="{{ line_item.summary|accounting_default }}" data-net-balance="{{ line_item.net_balance|accounting_voucher_format_amount_input }}" data-text="{{ line_item }}" data-query-values="{{ line_item.query_values|tojson|forceescape }}" data-bs-toggle="modal" data-bs-target="#accounting-line-item-editor-modal">
<div>{{ line_item.voucher.date|accounting_format_date }} {{ line_item.summary|accounting_default }}</div>
<li id="accounting-original-line-item-selector-option-{{ line_item.id }}" class="list-group-item d-flex justify-content-between accounting-clickable accounting-original-line-item-selector-option" data-id="{{ line_item.id }}" data-date="{{ line_item.voucher.date }}" data-side="{{ "debit" if line_item.is_debit else "credit" }}" data-currency-code="{{ line_item.currency.code }}" data-account-code="{{ line_item.account_code }}" data-account-text="{{ line_item.account }}" data-description="{{ line_item.description|accounting_default }}" data-net-balance="{{ line_item.net_balance|accounting_voucher_format_amount_input }}" data-text="{{ line_item }}" data-query-values="{{ line_item.query_values|tojson|forceescape }}" data-bs-toggle="modal" data-bs-target="#accounting-line-item-editor-modal">
<div>{{ line_item.voucher.date|accounting_format_date }} {{ line_item.description|accounting_default }}</div>
<div>
<span class="badge bg-primary rounded-pill">
<span id="accounting-original-line-item-selector-option-{{ line_item.id }}-net-balance">{{ line_item.net_balance|accounting_format_amount }}</span>

View File

@ -1,193 +0,0 @@
{#
The Mia! Accounting Flask Project
summary-editor-modal.html: The modal of the summary editor
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/2/28
#}
<form id="accounting-summary-editor-{{ summary_editor.side }}" class="accounting-summary-editor" data-side="{{ summary_editor.side }}">
<div id="accounting-summary-editor-{{ summary_editor.side }}-modal" class="modal fade" tabindex="-1" aria-labelledby="accounting-summary-editor-{{ summary_editor.side }}-modal-label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="accounting-summary-editor-{{ summary_editor.side }}-modal-label">
<label for="accounting-summary-editor-{{ summary_editor.side }}-summary">{{ A_("Summary") }}</label>
</h1>
<button class="btn-close" type="button" data-bs-toggle="modal" data-bs-target="#accounting-line-item-editor-modal" aria-label="{{ A_("Close") }}"></button>
</div>
<div class="modal-body">
<div class="d-flex justify-content-between mb-3">
<input id="accounting-summary-editor-{{ summary_editor.side }}-summary" class="form-control" type="text" aria-labelledby="accounting-summary-editor-{{ summary_editor.side }}-modal-label">
<button id="accounting-summary-editor-{{ summary_editor.side }}-offset" class="btn btn-primary text-nowrap ms-2" type="button" data-bs-toggle="modal" data-bs-target="#accounting-original-line-item-selector-modal">
{{ A_("Offset...") }}
</button>
</div>
{# Tab navigation #}
<ul class="nav nav-tabs mb-2">
<li class="nav-item">
<span id="accounting-summary-editor-{{ summary_editor.side }}-general-tab" class="nav-link active accounting-clickable" aria-current="page">
{{ A_("General") }}
</span>
</li>
<li class="nav-item">
<span id="accounting-summary-editor-{{ summary_editor.side }}-travel-tab" class="nav-link accounting-clickable" aria-current="false">
{{ A_("Travel") }}
</span>
</li>
<li class="nav-item">
<span id="accounting-summary-editor-{{ summary_editor.side }}-bus-tab" class="nav-link accounting-clickable" aria-current="false">
{{ A_("Bus") }}
</span>
</li>
<li class="nav-item">
<span id="accounting-summary-editor-{{ summary_editor.side }}-regular-tab" class="nav-link accounting-clickable" aria-current="false">
{{ A_("Regular") }}
</span>
</li>
<li class="nav-item">
<span id="accounting-summary-editor-{{ summary_editor.side }}-annotation-tab" class="nav-link accounting-clickable" aria-current="false">
{{ A_("Annotation") }}
</span>
</li>
</ul>
{# A general summary with a tag #}
<div id="accounting-summary-editor-{{ summary_editor.side }}-general-page" aria-current="page" aria-labelledby="accounting-summary-editor-{{ summary_editor.side }}-general-tab">
<div class="form-floating mb-2">
<input id="accounting-summary-editor-{{ summary_editor.side }}-general-tag" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-summary-editor-{{ summary_editor.side }}-general-tag">{{ A_("Tag") }}</label>
<div id="accounting-summary-editor-{{ summary_editor.side }}-general-tag-error" class="invalid-feedback"></div>
</div>
<div>
{% for tag in summary_editor.general.tags %}
<button class="btn btn-outline-primary accounting-summary-editor-{{ summary_editor.side }}-general-btn-tag" type="button" tabindex="-1" data-value="{{ tag.name }}" data-accounts="{{ tag.account_codes|tojson|forceescape }}">
{{ tag }}
</button>
{% endfor %}
</div>
</div>
{# A general trip with the origin and distination #}
<div id="accounting-summary-editor-{{ summary_editor.side }}-travel-page" class="d-none" aria-current="false" aria-labelledby="accounting-summary-editor-{{ summary_editor.side }}-travel-tab">
<div class="form-floating mb-2">
<input id="accounting-summary-editor-{{ summary_editor.side }}-travel-tag" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-summary-editor-{{ summary_editor.side }}-travel-tag">{{ A_("Tag") }}</label>
<div id="accounting-summary-editor-{{ summary_editor.side }}-travel-tag-error" class="invalid-feedback"></div>
</div>
<div>
{% for tag in summary_editor.travel.tags %}
<button class="btn btn-outline-primary accounting-summary-editor-{{ summary_editor.side }}-travel-btn-tag" type="button" tabindex="-1" data-value="{{ tag.name }}" data-accounts="{{ tag.account_codes|tojson|forceescape }}">
{{ tag }}
</button>
{% endfor %}
</div>
<div class="d-flex justify-content-between mt-2">
<div class="form-floating">
<input id="accounting-summary-editor-{{ summary_editor.side }}-travel-from" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-summary-editor-{{ summary_editor.side }}-travel-from">{{ A_("From") }}</label>
<div id="accounting-summary-editor-{{ summary_editor.side }}-travel-from-error" class="invalid-feedback"></div>
</div>
<div class="btn-group-vertical ms-1 me-1">
<button class="btn btn-primary accounting-summary-editor-{{ summary_editor.side }}-travel-direction accounting-default" type="button" tabindex="-1" data-arrow="&rarr;">&rarr;</button>
<button class="btn btn-outline-primary accounting-summary-editor-{{ summary_editor.side }}-travel-direction" type="button" tabindex="-1" data-arrow="&harr;">&harr;</button>
</div>
<div class="form-floating">
<input id="accounting-summary-editor-{{ summary_editor.side }}-travel-to" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-summary-editor-{{ summary_editor.side }}-travel-to">{{ A_("To") }}</label>
<div id="accounting-summary-editor-{{ summary_editor.side }}-travel-to-error" class="invalid-feedback"></div>
</div>
</div>
</div>
{# A bus trip with the route name or route number, the origin and distination #}
<div id="accounting-summary-editor-{{ summary_editor.side }}-bus-page" class="d-none" aria-current="false" aria-labelledby="accounting-summary-editor-{{ summary_editor.side }}-bus-tab">
<div class="d-flex justify-content-between mb-2">
<div class="form-floating me-2">
<input id="accounting-summary-editor-{{ summary_editor.side }}-bus-tag" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-summary-editor-{{ summary_editor.side }}-bus-tag">{{ A_("Tag") }}</label>
<div id="accounting-summary-editor-{{ summary_editor.side }}-bus-tag-error" class="invalid-feedback"></div>
</div>
<div class="form-floating">
<input id="accounting-summary-editor-{{ summary_editor.side }}-bus-route" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-summary-editor-{{ summary_editor.side }}-bus-route">{{ A_("Route") }}</label>
<div id="accounting-summary-editor-{{ summary_editor.side }}-bus-route-error" class="invalid-feedback"></div>
</div>
</div>
<div>
{% for tag in summary_editor.bus.tags %}
<button class="btn btn-outline-primary accounting-summary-editor-{{ summary_editor.side }}-bus-btn-tag" type="button" tabindex="-1" data-value="{{ tag.name }}" data-accounts="{{ tag.account_codes|tojson|forceescape }}">
{{ tag }}
</button>
{% endfor %}
</div>
<div class="d-flex justify-content-between mt-2">
<div class="form-floating me-2">
<input id="accounting-summary-editor-{{ summary_editor.side }}-bus-from" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-summary-editor-{{ summary_editor.side }}-bus-from">{{ A_("From") }}</label>
<div id="accounting-summary-editor-{{ summary_editor.side }}-bus-from-error" class="invalid-feedback"></div>
</div>
<div class="form-floating">
<input id="accounting-summary-editor-{{ summary_editor.side }}-bus-to" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-summary-editor-{{ summary_editor.side }}-bus-to">{{ A_("To") }}</label>
<div id="accounting-summary-editor-{{ summary_editor.side }}-bus-to-error" class="invalid-feedback"></div>
</div>
</div>
</div>
{# A regular income or payment #}
<div id="accounting-summary-editor-{{ summary_editor.side }}-regular-page" class="d-none" aria-current="false" aria-labelledby="accounting-summary-editor-{{ summary_editor.side }}-regular-tab">
{# TODO: To be done #}
</div>
{# The annotation #}
<div id="accounting-summary-editor-{{ summary_editor.side }}-annotation-page" class="d-none" aria-current="false" aria-labelledby="accounting-summary-editor-{{ summary_editor.side }}-annotation-tab">
<div class="form-floating">
<input id="accounting-summary-editor-{{ summary_editor.side }}-annotation-number" class="form-control" type="number" min="1" value="" placeholder=" ">
<label class="form-label" for="accounting-summary-editor-{{ summary_editor.side }}-annotation-number">{{ A_("The number of items") }}</label>
<div id="accounting-summary-editor-{{ summary_editor.side }}-annotation-number-error" class="invalid-feedback"></div>
</div>
<div class="form-floating mt-2">
<input id="accounting-summary-editor-{{ summary_editor.side }}-annotation-note" class="form-control" type="text" value="" placeholder=" ">
<label class="form-label" for="accounting-summary-editor-{{ summary_editor.side }}-annotation-note">{{ A_("Note") }}</label>
<div id="accounting-summary-editor-{{ summary_editor.side }}-annotation-note-error" class="invalid-feedback"></div>
</div>
</div>
{# The suggested accounts #}
<div class="mt-3">
{% for account in summary_editor.accounts %}
<button class="btn btn-outline-primary d-none accounting-summary-editor-{{ summary_editor.side }}-account {% if account.is_need_offset %} accounting-account-is-need-offset {% endif %}" type="button" data-code="{{ account.code }}" data-text="{{ account }}">
{{ account }}
</button>
{% endfor %}
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-target="#accounting-line-item-editor-modal">{{ A_("Cancel") }}</button>
<button id="accounting-summary-editor-{{ summary_editor.side }}-btn-save" type="submit" class="btn btn-primary">{{ A_("Save") }}</button>
</div>
</div>
</div>
</div>
</form>

View File

@ -45,11 +45,11 @@ First written: 2023/2/25
</div>
<div class="mb-3">
<div id="accounting-line-item-editor-summary-control" class="form-control accounting-clickable accounting-material-text-field" data-bs-toggle="modal" data-bs-target="">
<label class="form-label" for="accounting-line-item-editor-summary">{{ A_("Summary") }}</label>
<div id="accounting-line-item-editor-summary"></div>
<div id="accounting-line-item-editor-description-control" class="form-control accounting-clickable accounting-material-text-field" data-bs-toggle="modal" data-bs-target="">
<label class="form-label" for="accounting-line-item-editor-description">{{ A_("Description") }}</label>
<div id="accounting-line-item-editor-description"></div>
</div>
<div id="accounting-line-item-editor-summary-error" class="invalid-feedback"></div>
<div id="accounting-line-item-editor-description-error" class="invalid-feedback"></div>
</div>
<div class="mb-3">

View File

@ -49,25 +49,25 @@ First written: 2023/2/25
{% with currency_index = currency_index,
side = "credit",
line_item_index = loop.index,
only_one_line_item_form = debit_forms|length == 1,
line_item_id = line_item_form.eid.data,
account_code_data = line_item_form.account_code.data|accounting_default,
account_code_error = line_item_form.account_code.errors,
account_text = line_item_form.account_text,
summary_data = line_item_form.summary.data|accounting_default,
summary_errors = line_item_form.summary.errors,
original_line_item_id_data = line_item_form.original_line_item_id.data|accounting_default,
original_line_item_date = line_item_form.original_line_item_date|accounting_default,
original_line_item_text = line_item_form.original_line_item_text|accounting_default,
is_need_offset = line_item_form.is_need_offset,
offset_items = line_item_form.offsets,
offset_total = line_item_form.offset_total|accounting_default("0"),
net_balance_data = line_item_form.net_balance,
net_balance_text = line_item_form.net_balance|accounting_format_amount,
amount_data = line_item_form.amount.data|accounting_voucher_format_amount_input,
amount_errors = line_item_form.amount.errors,
amount_text = line_item_form.amount.data|accounting_format_amount,
line_item_errors = line_item_form.all_errors %}
only_one_line_item_form = credit_forms|length == 1,
line_item_id = line_item_form.form.eid.data,
account_code_data = line_item_form.form.account_code.data|accounting_default,
account_code_error = line_item_form.form.account_code.errors,
account_text = line_item_form.form.account_text,
description_data = line_item_form.form.description.data|accounting_default,
description_errors = line_item_form.form.description.errors,
original_line_item_id_data = line_item_form.form.original_line_item_id.data|accounting_default,
original_line_item_date = line_item_form.form.original_line_item_date|accounting_default,
original_line_item_text = line_item_form.form.original_line_item_text|accounting_default,
is_need_offset = line_item_form.form.is_need_offset,
offset_items = line_item_form.form.offsets,
offset_total = line_item_form.form.offset_total|accounting_default("0"),
net_balance_data = line_item_form.form.net_balance,
net_balance_text = line_item_form.form.net_balance|accounting_format_amount,
amount_data = line_item_form.form.amount.data|accounting_voucher_format_amount_input,
amount_errors = line_item_form.form.amount.errors,
amount_text = line_item_form.form.amount.data|accounting_format_amount,
line_item_errors = line_item_form.form.all_errors %}
{% include "accounting/voucher/include/form-line-item.html" %}
{% endwith %}
{% endfor %}

View File

@ -47,8 +47,8 @@ First written: 2023/2/25
{% endblock %}
{% block form_modals %}
{% with summary_editor = form.summary_editor.credit %}
{% include "accounting/voucher/include/summary-editor-modal.html" %}
{% with description_editor = form.description_editor.credit %}
{% include "accounting/voucher/include/description-editor-modal.html" %}
{% endwith %}
{% with side = "credit",
account_options = form.credit_account_options %}

View File

@ -52,24 +52,24 @@ First written: 2023/2/25
side = "debit",
line_item_index = loop.index,
only_one_line_item_form = debit_forms|length == 1,
line_item_id = line_item_form.eid.data,
account_code_data = line_item_form.account_code.data|accounting_default,
account_code_error = line_item_form.account_code.errors,
account_text = line_item_form.account_text,
summary_data = line_item_form.summary.data|accounting_default,
summary_errors = line_item_form.summary.errors,
original_line_item_id_data = line_item_form.original_line_item_id.data|accounting_default,
original_line_item_date = line_item_form.original_line_item_date|accounting_default,
original_line_item_text = line_item_form.original_line_item_text|accounting_default,
is_need_offset = line_item_form.is_need_offset,
offset_items = line_item_form.offsets,
offset_total = line_item_form.offset_total|accounting_default,
net_balance_data = line_item_form.net_balance,
net_balance_text = line_item_form.net_balance|accounting_format_amount,
amount_data = line_item_form.amount.data|accounting_voucher_format_amount_input,
amount_errors = line_item_form.amount.errors,
amount_text = line_item_form.amount.data|accounting_format_amount,
line_item_errors = line_item_form.all_errors %}
line_item_id = line_item_form.form.eid.data,
account_code_data = line_item_form.form.account_code.data|accounting_default,
account_code_error = line_item_form.form.account_code.errors,
account_text = line_item_form.form.account_text,
description_data = line_item_form.form.description.data|accounting_default,
description_errors = line_item_form.form.description.errors,
original_line_item_id_data = line_item_form.form.original_line_item_id.data|accounting_default,
original_line_item_date = line_item_form.form.original_line_item_date|accounting_default,
original_line_item_text = line_item_form.form.original_line_item_text|accounting_default,
is_need_offset = line_item_form.form.is_need_offset,
offset_items = line_item_form.form.offsets,
offset_total = line_item_form.form.offset_total|accounting_default,
net_balance_data = line_item_form.form.net_balance,
net_balance_text = line_item_form.form.net_balance|accounting_format_amount,
amount_data = line_item_form.form.amount.data|accounting_voucher_format_amount_input,
amount_errors = line_item_form.form.amount.errors,
amount_text = line_item_form.form.amount.data|accounting_format_amount,
line_item_errors = line_item_form.form.all_errors %}
{% include "accounting/voucher/include/form-line-item.html" %}
{% endwith %}
{% endfor %}
@ -100,24 +100,24 @@ First written: 2023/2/25
side = "credit",
line_item_index = loop.index,
only_one_line_item_form = debit_forms|length == 1,
line_item_id = line_item_form.eid.data,
account_code_data = line_item_form.account_code.data|accounting_default,
account_code_error = line_item_form.account_code.errors,
account_text = line_item_form.account_text,
summary_data = line_item_form.summary.data|accounting_default,
summary_errors = line_item_form.summary.errors,
original_line_item_id_data = line_item_form.original_line_item_id.data|accounting_default,
original_line_item_date = line_item_form.original_line_item_date|accounting_default,
original_line_item_text = line_item_form.original_line_item_text|accounting_default,
is_need_offset = line_item_form.is_need_offset,
offset_items = line_item_form.offsets,
offset_total = line_item_form.offset_total|accounting_default("0"),
net_balance_data = line_item_form.net_balance,
net_balance_text = line_item_form.net_balance|accounting_format_amount,
amount_data = line_item_form.amount.data|accounting_voucher_format_amount_input,
amount_errors = line_item_form.amount.errors,
amount_text = line_item_form.amount.data|accounting_format_amount,
line_item_errors = line_item_form.all_errors %}
line_item_id = line_item_form.form.eid.data,
account_code_data = line_item_form.form.account_code.data|accounting_default,
account_code_error = line_item_form.form.account_code.errors,
account_text = line_item_form.form.account_text,
description_data = line_item_form.form.description.data|accounting_default,
description_errors = line_item_form.form.description.errors,
original_line_item_id_data = line_item_form.form.original_line_item_id.data|accounting_default,
original_line_item_date = line_item_form.form.original_line_item_date|accounting_default,
original_line_item_text = line_item_form.form.original_line_item_text|accounting_default,
is_need_offset = line_item_form.form.is_need_offset,
offset_items = line_item_form.form.offsets,
offset_total = line_item_form.form.offset_total|accounting_default("0"),
net_balance_data = line_item_form.form.net_balance,
net_balance_text = line_item_form.form.net_balance|accounting_format_amount,
amount_data = line_item_form.form.amount.data|accounting_voucher_format_amount_input,
amount_errors = line_item_form.form.amount.errors,
amount_text = line_item_form.form.amount.data|accounting_format_amount,
line_item_errors = line_item_form.form.all_errors %}
{% include "accounting/voucher/include/form-line-item.html" %}
{% endwith %}
{% endfor %}

View File

@ -51,11 +51,11 @@ First written: 2023/2/25
{% endblock %}
{% block form_modals %}
{% with summary_editor = form.summary_editor.debit %}
{% include "accounting/voucher/include/summary-editor-modal.html" %}
{% with description_editor = form.description_editor.debit %}
{% include "accounting/voucher/include/description-editor-modal.html" %}
{% endwith %}
{% with summary_editor = form.summary_editor.credit %}
{% include "accounting/voucher/include/summary-editor-modal.html" %}
{% with description_editor = form.description_editor.credit %}
{% include "accounting/voucher/include/description-editor-modal.html" %}
{% endwith %}
{% with side = "debit",
account_options = form.debit_account_options %}