Renamed the HTML ID and class name prefix of the account selector modal, for consistency.
This commit is contained in:
parent
20cb5cecc4
commit
1b5e516413
@ -255,8 +255,8 @@ function initializeJournalEntryFormModal() {
|
||||
const formAmount = document.getElementById("accounting-entry-form-amount");
|
||||
const modal = document.getElementById("accounting-entry-form-modal");
|
||||
formAccountControl.onclick = function () {
|
||||
const prefix = "accounting-" + entryForm.dataset.entryType + "-account";
|
||||
const query = document.getElementById(prefix + "-selector-query")
|
||||
const prefix = "accounting-account-selector-" + entryForm.dataset.entryType;
|
||||
const query = document.getElementById(prefix + "-query")
|
||||
const more = document.getElementById(prefix + "-more");
|
||||
const options = Array.from(document.getElementsByClassName(prefix + "-option"));
|
||||
const btnClear = document.getElementById(prefix + "-btn-clear");
|
||||
@ -518,7 +518,7 @@ function initializeAccountSelectors() {
|
||||
* @private
|
||||
*/
|
||||
function initializeAccountQuery(selector) {
|
||||
const query = document.getElementById(selector.dataset.prefix + "-selector-query");
|
||||
const query = document.getElementById(selector.dataset.prefix + "-query");
|
||||
query.addEventListener("input", function () {
|
||||
filterAccountOptions(selector.dataset.prefix);
|
||||
});
|
||||
@ -531,7 +531,7 @@ function initializeAccountQuery(selector) {
|
||||
* @private
|
||||
*/
|
||||
function filterAccountOptions(prefix) {
|
||||
const query = document.getElementById(prefix + "-selector-query");
|
||||
const query = document.getElementById(prefix + "-query");
|
||||
const optionList = document.getElementById(prefix + "-option-list");
|
||||
if (optionList === null) {
|
||||
console.log(prefix + "-option-list");
|
||||
|
@ -70,7 +70,7 @@ First written: 2023/2/25
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button class="btn btn-primary accounting-btn-new-entry accounting-currency-{{ currency_index }}-btn-new-entry" type="button" data-currency-index="{{ currency_index }}" data-entry-type="debit" data-entry-index="new" data-account-modal="#accounting-debit-account-selector-modal" data-bs-toggle="modal" data-bs-target="#accounting-summary-helper-debit-modal">
|
||||
<button class="btn btn-primary accounting-btn-new-entry accounting-currency-{{ currency_index }}-btn-new-entry" type="button" data-currency-index="{{ currency_index }}" data-entry-type="debit" data-entry-index="new" data-account-modal="#accounting-account-selector-debit-modal" data-bs-toggle="modal" data-bs-target="#accounting-summary-helper-debit-modal">
|
||||
<i class="fas fa-plus"></i>
|
||||
{{ A_("New") }}
|
||||
</button>
|
||||
|
@ -19,35 +19,35 @@ account-selector-modal.html: The modal for the account selector
|
||||
Author: imacat@mail.imacat.idv.tw (imacat)
|
||||
First written: 2023/2/25
|
||||
#}
|
||||
<div id="accounting-{{ entry_type }}-account-selector-modal" class="modal fade accounting-account-selector-modal" data-prefix="accounting-{{ entry_type }}-account" tabindex="-1" aria-labelledby="accounting-{{ entry_type }}-account-selector-modal-label" aria-hidden="true">
|
||||
<div id="accounting-account-selector-{{ entry_type }}-modal" class="modal fade accounting-account-selector-modal" data-prefix="accounting-account-selector-{{ entry_type }}" tabindex="-1" aria-labelledby="accounting-account-selector-{{ entry_type }}-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-{{ entry_type }}-account-selector-modal-label">{{ A_("Select Account") }}</h1>
|
||||
<h1 class="modal-title fs-5" id="accounting-account-selector-{{ entry_type }}-modal-label">{{ A_("Select Account") }}</h1>
|
||||
<button type="button" class="btn-close" data-bs-toggle="modal" data-bs-target="#accounting-entry-form-modal" aria-label="{{ A_("Close") }}"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="input-group mb-2">
|
||||
<input id="accounting-{{ entry_type }}-account-selector-query" class="form-control form-control-sm" type="search" placeholder=" " required="required">
|
||||
<label class="input-group-text" for="accounting-{{ entry_type }}-account-selector-query">
|
||||
<input id="accounting-account-selector-{{ entry_type }}-query" class="form-control form-control-sm" type="search" placeholder=" " required="required">
|
||||
<label class="input-group-text" for="accounting-account-selector-{{ entry_type }}-query">
|
||||
<i class="fa-solid fa-magnifying-glass"></i>
|
||||
{{ A_("Search") }}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<ul id="accounting-{{ entry_type }}-account-option-list" class="list-group accounting-selector-list">
|
||||
<ul id="accounting-account-selector-{{ entry_type }}-option-list" class="list-group accounting-selector-list">
|
||||
{% for account in account_options %}
|
||||
<li id="accounting-{{ entry_type }}-account-option-{{ account.code }}" class="list-group-item accounting-clickable accounting-{{ entry_type }}-account-option {% if account.is_in_use %} accounting-account-in-use {% endif %}" data-code="{{ account.code }}" data-content="{{ account }}" data-query-values="{{ account.query_values|tojson|forceescape }}" data-bs-toggle="modal" data-bs-target="#accounting-entry-form-modal">
|
||||
<li id="accounting-account-selector-{{ entry_type }}-option-{{ account.code }}" class="list-group-item accounting-clickable accounting-account-selector-{{ entry_type }}-option {% if account.is_in_use %} accounting-account-in-use {% endif %}" data-code="{{ account.code }}" data-content="{{ account }}" data-query-values="{{ account.query_values|tojson|forceescape }}" data-bs-toggle="modal" data-bs-target="#accounting-entry-form-modal">
|
||||
{{ account }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
<li id="accounting-{{ entry_type }}-account-more" class="list-group-item accounting-clickable">{{ A_("More…") }}</li>
|
||||
<li id="accounting-account-selector-{{ entry_type }}-more" class="list-group-item accounting-clickable">{{ A_("More…") }}</li>
|
||||
</ul>
|
||||
<p id="accounting-{{ entry_type }}-account-option-no-result" class="d-none">{{ A_("There is no data.") }}</p>
|
||||
<p id="accounting-account-selector-{{ entry_type }}-option-no-result" class="d-none">{{ A_("There is no data.") }}</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-toggle="modal" data-bs-target="#accounting-entry-form-modal">{{ A_("Cancel") }}</button>
|
||||
<button id="accounting-{{ entry_type }}-account-btn-clear" type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#accounting-entry-form-modal">{{ A_("Clear") }}</button>
|
||||
<button id="accounting-account-selector-{{ entry_type }}-btn-clear" type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#accounting-entry-form-modal">{{ A_("Clear") }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -20,7 +20,7 @@ Author: imacat@mail.imacat.idv.tw (imacat)
|
||||
First written: 2023/2/25
|
||||
#}
|
||||
{# <ul> For SonarQube not to complain about incorrect HTML #}
|
||||
<li id="accounting-currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}" class="list-group-item list-group-item-action d-flex justify-content-between accounting-entry accounting-currency-{{ currency_index }}-{{ entry_type }}" data-currency-index="{{ currency_index }}" data-entry-type="{{ entry_type }}" data-entry-index="{{ entry_index }}" data-account-modal="#accounting-{{ entry_type }}-account-selector-modal" data-prefix="accounting-currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}">
|
||||
<li id="accounting-currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}" class="list-group-item list-group-item-action d-flex justify-content-between accounting-entry accounting-currency-{{ currency_index }}-{{ entry_type }}" data-currency-index="{{ currency_index }}" data-entry-type="{{ entry_type }}" data-entry-index="{{ entry_index }}" data-account-modal="#accounting-account-selector-{{ entry_type }}-modal" data-prefix="accounting-currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}">
|
||||
{% if entry_id %}
|
||||
<input type="hidden" name="currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}-eid" value="{{ entry_id }}">
|
||||
{% endif %}
|
||||
|
@ -70,7 +70,7 @@ First written: 2023/2/25
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button class="btn btn-primary accounting-btn-new-entry accounting-currency-{{ currency_index }}-btn-new-entry" type="button" data-currency-index="{{ currency_index }}" data-entry-type="credit" data-entry-index="new" data-account-modal="#accounting-credit-account-selector-modal" data-bs-toggle="modal" data-bs-target="#accounting-summary-helper-credit-modal">
|
||||
<button class="btn btn-primary accounting-btn-new-entry accounting-currency-{{ currency_index }}-btn-new-entry" type="button" data-currency-index="{{ currency_index }}" data-entry-type="credit" data-entry-index="new" data-account-modal="#accounting-account-selector-credit-modal" data-bs-toggle="modal" data-bs-target="#accounting-summary-helper-credit-modal">
|
||||
<i class="fas fa-plus"></i>
|
||||
{{ A_("New") }}
|
||||
</button>
|
||||
|
@ -72,7 +72,7 @@ First written: 2023/2/25
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button class="btn btn-primary accounting-btn-new-entry accounting-currency-{{ currency_index }}-btn-new-entry" type="button" data-currency-index="{{ currency_index }}" data-entry-type="debit" data-entry-index="new" data-account-modal="#accounting-debit-account-selector-modal" data-bs-toggle="modal" data-bs-target="#accounting-summary-helper-debit-modal">
|
||||
<button class="btn btn-primary accounting-btn-new-entry accounting-currency-{{ currency_index }}-btn-new-entry" type="button" data-currency-index="{{ currency_index }}" data-entry-type="debit" data-entry-index="new" data-account-modal="#accounting-account-selector-debit-modal" data-bs-toggle="modal" data-bs-target="#accounting-summary-helper-debit-modal">
|
||||
<i class="fas fa-plus"></i>
|
||||
{{ A_("New") }}
|
||||
</button>
|
||||
@ -112,7 +112,7 @@ First written: 2023/2/25
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button class="btn btn-primary accounting-btn-new-entry accounting-currency-{{ currency_index }}-btn-new-entry" type="button" data-currency-index="{{ currency_index }}" data-entry-type="credit" data-entry-index="new" data-account-modal="#accounting-credit-account-selector-modal" data-bs-toggle="modal" data-bs-target="#accounting-summary-helper-credit-modal">
|
||||
<button class="btn btn-primary accounting-btn-new-entry accounting-currency-{{ currency_index }}-btn-new-entry" type="button" data-currency-index="{{ currency_index }}" data-entry-type="credit" data-entry-index="new" data-account-modal="#accounting-account-selector-credit-modal" data-bs-toggle="modal" data-bs-target="#accounting-summary-helper-credit-modal">
|
||||
<i class="fas fa-plus"></i>
|
||||
{{ A_("New") }}
|
||||
</button>
|
||||
|
Loading…
Reference in New Issue
Block a user