93 lines
5.6 KiB
HTML
93 lines
5.6 KiB
HTML
{#
|
|
The Mia! Accounting Flask Project
|
|
currency-sub-form.html: The currency sub-form in the cash expense transaction form
|
|
|
|
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/25
|
|
#}
|
|
<div id="accounting-currency-{{ currency_index }}" class="mb-3 accounting-currency" data-index="{{ currency_index }}">
|
|
<input id="accounting-currency-{{ currency_index }}-no" type="hidden" name="currency-{{ currency_index }}-no" value="{{ currency_index }}">
|
|
<input id="accounting-currency-{{ currency_index }}-code" type="hidden" name="currency-{{ currency_index }}-code" value="{{ currency_code_data }}">
|
|
<div id="accounting-currency-{{ currency_index }}-control" class="form-control accounting-currency-control {% if currency_errors %} is-invalid {% endif %}">
|
|
<div class="d-flex justify-content-between mt-2 mb-3">
|
|
<div class="form-floating accounting-currency-content">
|
|
<select id="accounting-currency-{{ currency_index }}-code-select" class="form-select {% if currency_code_errors %} is-invalid {% endif %}" name="currency-{{ currency_index }}-code" {% if currency_code_is_locked %} disabled="disabled" {% endif %}>
|
|
{% for currency in accounting_currency_options() %}
|
|
<option value="{{ currency.code }}" {% if currency.code == currency_code_data %} selected="selected" {% endif %}>{{ currency }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
<label class="form-label" for="accounting-currency-{{ currency_index }}-code-select">{{ A_("Currency") }}</label>
|
|
<div id="accounting-currency-{{ currency_index }}-code-error" class="invalid-feedback">{% if currency_code_errors %}{{ currency_code_errors[0] }}{% endif %}</div>
|
|
</div>
|
|
|
|
<div>
|
|
<button id="accounting-currency-{{ currency_index }}-delete" class="btn btn-danger rounded-circle {% if only_one_currency_form %} d-none {% endif %}" type="button" data-target="accounting-currency-{{ currency_index }}">
|
|
<i class="fas fa-minus"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<div id="accounting-currency-{{ currency_index }}-debit" class="form-control accounting-material-text-field accounting-not-empty {% if debit_errors %} is-invalid {% endif %}">
|
|
<label class="form-label" for="accounting-currency-{{ currency_index }}-debit">{{ A_("Content") }}</label>
|
|
<ul id="accounting-currency-{{ currency_index }}-debit-list" class="list-group accounting-entry-list">
|
|
{% for entry_form in debit_forms %}
|
|
{% with currency_index = currency_index,
|
|
entry_type = "debit",
|
|
entry_index = loop.index,
|
|
entry_id = entry_form.eid.data,
|
|
only_one_entry_form = debit_forms|length == 1,
|
|
account_code_data = entry_form.account_code.data|accounting_default,
|
|
account_code_error = entry_form.account_code.errors,
|
|
account_text = entry_form.account_text,
|
|
summary_data = entry_form.summary.data|accounting_default,
|
|
summary_errors = entry_form.summary.errors,
|
|
original_entry_id_data = entry_form.original_entry_id.data|accounting_default,
|
|
original_entry_date = entry_form.original_entry_date|accounting_default,
|
|
original_entry_text = entry_form.original_entry_text|accounting_default,
|
|
is_need_offset = entry_form.is_need_offset,
|
|
offset_entries = entry_form.offsets,
|
|
offset_total = entry_form.offset_total|accounting_default("0"),
|
|
net_balance_data = entry_form.net_balance,
|
|
net_balance_text = entry_form.net_balance|accounting_format_amount,
|
|
amount_data = entry_form.amount.data|accounting_txn_format_amount_input,
|
|
amount_errors = entry_form.amount.errors,
|
|
amount_text = entry_form.amount.data|accounting_format_amount,
|
|
entry_errors = entry_form.all_errors %}
|
|
{% include "accounting/transaction/include/form-entry-item.html" %}
|
|
{% endwith %}
|
|
{% endfor %}
|
|
</ul>
|
|
|
|
<div class="d-flex justify-content-between mb-2">
|
|
<div>{{ A_("Total") }}</div>
|
|
<div><span id="accounting-currency-{{ currency_index }}-debit-total" class="badge rounded-pill bg-primary">{{ debit_total }}</span></div>
|
|
</div>
|
|
|
|
<div>
|
|
<button id="accounting-currency-{{ currency_index }}-debit-add-entry" class="btn btn-primary" type="button" data-currency-index="{{ currency_index }}" data-entry-type="debit" data-bs-toggle="modal" data-bs-target="#accounting-entry-editor-modal">
|
|
<i class="fas fa-plus"></i>
|
|
{{ A_("New") }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div id="accounting-currency-{{ currency_index }}-debit-error" class="invalid-feedback">{% if debit_errors %}{{ debit_errors[0] }}{% endif %}</div>
|
|
</div>
|
|
</div>
|
|
<div id="accounting-currency-{{ currency_index }}-error" class="invalid-feedback">{% if currency_errors %}{{ currency_errors[0] }}{% endif %}</div>
|
|
</div>
|