Replaced parsing the HTML element ID with the HTML custom data attributes in the JavaScripts.
This commit is contained in:
@ -20,14 +20,14 @@ Author: imacat@mail.imacat.idv.tw (imacat)
|
||||
First written: 2020/8/5
|
||||
{% endcomment %}
|
||||
|
||||
<li id="{{ record_type }}-{{ no }}" class="list-group-item d-flex justify-content-between draggable-record {{ record_type }}-record">
|
||||
<li id="{{ record_type }}-{{ no }}" class="list-group-item d-flex justify-content-between draggable-record {{ record_type }}-record" data-no="{{ no }}">
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
{% if record.id.value %}
|
||||
<input type="hidden" name="{{ record_type }}-{{ no }}-id" value="{{ record.id.value }}" />
|
||||
{% endif %}
|
||||
<input id="{{ record_type }}-{{ no }}-ord" class="{{ record_type }}-ord" type="hidden" name="{{ record_type }}-{{ no }}-ord" value="{{ order }}" />
|
||||
<select id="{{ record_type }}-{{ no }}-account" class="form-control record-account {{ record_type }}-account {% if should_validate and record.account.errors %} is-invalid {% endif %}" name="{{ record_type }}-{{ no }}-account">
|
||||
<select id="{{ record_type }}-{{ no }}-account" class="form-control record-account {{ record_type }}-account {% if should_validate and record.account.errors %} is-invalid {% endif %}" name="{{ record_type }}-{{ no }}-account" data-type="{{ record_type }}">
|
||||
{% if record.account is not None %}
|
||||
<option value="{{ record.account.value|default:"" }}" selected="selected">{{ record.account.value|default:"" }} {{ record.account_title|default:"" }}</option>
|
||||
{% else %}
|
||||
@ -40,11 +40,11 @@ First written: 2020/8/5
|
||||
<div class="col-lg-6">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<input id="{{ record_type }}-{{ no }}-summary" class="form-control record-summary {% if should_validate and record.summary.errors %} is-invalid {% endif %}" type="text" name="{{ record_type }}-{{ no }}-summary" value="{{ record.summary.value|default:"" }}" maxlength="128" data-toggle="modal" data-target="#summary-modal" />
|
||||
<input id="{{ record_type }}-{{ no }}-summary" class="form-control record-summary {% if should_validate and record.summary.errors %} is-invalid {% endif %}" type="text" name="{{ record_type }}-{{ no }}-summary" value="{{ record.summary.value|default:"" }}" maxlength="128" data-toggle="modal" data-target="#summary-modal" data-type="{{ record_type }}" data-no="{{ no }}" />
|
||||
<div id="{{ record_type }}-{{ no }}-summary-error" class="invalid-feedback">{% if should_validate %}{{ record.summary.errors.0|default:"" }}{% endif %}</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<input id="{{ record_type }}-{{ no }}-amount" class="form-control record-amount {{ record_type }}-to-sum {% if should_validate and record.amount.errors %} is-invalid {% endif %}" type="number" min="1" name="{{ record_type }}-{{ no }}-amount" value="{{ record.amount.value|default:"" }}" required="required" />
|
||||
<input id="{{ record_type }}-{{ no }}-amount" class="form-control record-amount {{ record_type }}-to-sum {% if should_validate and record.amount.errors %} is-invalid {% endif %}" type="number" min="1" name="{{ record_type }}-{{ no }}-amount" value="{{ record.amount.value|default:"" }}" required="required" data-type="{{ record_type }}" />
|
||||
<div id="{{ record_type }}-{{ no }}-amount-error" class="invalid-feedback">{% if should_validate %}{{ record.amount.errors.0|default:"" }}{% endif %}</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -55,7 +55,7 @@ First written: 2020/8/5
|
||||
<button class="btn btn-outline-secondary btn-sort-{{ record_type }}" type="button">
|
||||
<i class="fas fa-sort"></i>
|
||||
</button>
|
||||
<button id="{{ record_type }}-{{ no }}-delete" type="button" class="btn btn-danger btn-del-record btn-del-{{ record_type }}">
|
||||
<button id="{{ record_type }}-{{ no }}-delete" type="button" class="btn btn-danger btn-del-record btn-del-{{ record_type }}" data-type="{{ record_type }}" data-no="{{ no }}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
@ -63,7 +63,7 @@ First written: 2020/8/5
|
||||
<button class="btn btn-outline-secondary btn-sort-{{ record_type }}" type="button">
|
||||
<i class="fas fa-sort"></i>
|
||||
</button>
|
||||
<button id="{{ record_type }}-{{ no }}-delete" type="button" class="btn btn-danger btn-del-record btn-del-{{ record_type }}">
|
||||
<button id="{{ record_type }}-{{ no }}-m-delete" type="button" class="btn btn-danger btn-del-record btn-del-{{ record_type }}" data-type="{{ record_type }}" data-no="{{ no }}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -20,7 +20,7 @@ Author: imacat@mail.imacat.idv.tw (imacat)
|
||||
First written: 2020/8/5
|
||||
{% endcomment %}
|
||||
|
||||
<li id="{{ record_type }}-{{ no }}" class="list-group-item d-flex draggable-record {{ record_type }}-record">
|
||||
<li id="{{ record_type }}-{{ no }}" class="list-group-item d-flex draggable-record {{ record_type }}-record" data-no="{{ no }}">
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@ -28,7 +28,7 @@ First written: 2020/8/5
|
||||
<input type="hidden" name="{{ record_type }}-{{ no }}-id" value="{{ record.id.value }}" />
|
||||
{% endif %}
|
||||
<input id="{{ record_type }}-{{ no }}-ord" class="{{ record_type }}-ord" type="hidden" name="{{ record_type }}-{{ no }}-ord" value="{{ order }}" />
|
||||
<select id="{{ record_type }}-{{ no }}-account" class="form-control record-account {{ record_type }}-account {% if should_validate and record.account.errors %} is-invalid {% endif %}" name="{{ record_type }}-{{ no }}-account">
|
||||
<select id="{{ record_type }}-{{ no }}-account" class="form-control record-account {{ record_type }}-account {% if should_validate and record.account.errors %} is-invalid {% endif %}" name="{{ record_type }}-{{ no }}-account" data-type="{{ record_type }}">
|
||||
{% if record.account is not None %}
|
||||
<option value="{{ record.account.value|default:"" }}" selected="selected">{{ record.account.value|default:"" }} {{ record.account_title|default:"" }}</option>
|
||||
{% else %}
|
||||
@ -41,11 +41,11 @@ First written: 2020/8/5
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<input id="{{ record_type }}-{{ no }}-summary" class="form-control record-summary {% if should_validate and record.summary.errors %} is-invalid {% endif %}" type="text" name="{{ record_type }}-{{ no }}-summary" value="{{ record.summary.value|default:"" }}" maxlength="128" data-toggle="modal" data-target="#summary-modal" />
|
||||
<input id="{{ record_type }}-{{ no }}-summary" class="form-control record-summary {% if should_validate and record.summary.errors %} is-invalid {% endif %}" type="text" name="{{ record_type }}-{{ no }}-summary" value="{{ record.summary.value|default:"" }}" maxlength="128" data-toggle="modal" data-target="#summary-modal" data-type="{{ record_type }}" data-no="{{ no }}" />
|
||||
<div id="{{ record_type }}-{{ no }}-summary-error" class="invalid-feedback">{% if should_validate %}{{ record.summary.errors.0|default:"" }}{% endif %}</div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<input id="{{ record_type }}-{{ no }}-amount" class="form-control record-amount {{ record_type }}-to-sum {% if should_validate and record.amount.errors %} is-invalid {% endif %}" type="number" min="1" name="{{ record_type }}-{{ no }}-amount" value="{{ record.amount.value|default:"" }}" required="required" />
|
||||
<input id="{{ record_type }}-{{ no }}-amount" class="form-control record-amount {{ record_type }}-to-sum {% if should_validate and record.amount.errors %} is-invalid {% endif %}" type="number" min="1" name="{{ record_type }}-{{ no }}-amount" value="{{ record.amount.value|default:"" }}" required="required" data-type="{{ record_type }}" />
|
||||
<div id="{{ record_type }}-{{ no }}-amount-error" class="invalid-feedback">{% if should_validate %}{{ record.amount.errors.0|default:"" }}{% endif %}</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -55,7 +55,7 @@ First written: 2020/8/5
|
||||
<button class="btn btn-outline-secondary btn-sort-{{ record_type }}" type="button">
|
||||
<i class="fas fa-sort"></i>
|
||||
</button>
|
||||
<button id="{{ record_type }}-{{ no }}-m-delete" type="button" class="btn btn-danger btn-del-record btn-del-{{ record_type }}">
|
||||
<button id="{{ record_type }}-{{ no }}-m-delete" type="button" class="btn btn-danger btn-del-record btn-del-{{ record_type }}" data-type="{{ record_type }}" data-no="{{ no }}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -47,19 +47,19 @@ First written: 2020/4/3
|
||||
</div>
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item">
|
||||
<span id="summary-tab-category" class="summary-tab nav-link active">{{ _("General")|force_escape }}</span>
|
||||
<span id="summary-tab-category" class="summary-tab nav-link active" data-tab="category">{{ _("General")|force_escape }}</span>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<span id="summary-tab-travel" class="summary-tab nav-link">{{ _("Travel")|force_escape }}</span>
|
||||
<span id="summary-tab-travel" class="summary-tab nav-link" data-tab="travel">{{ _("Travel")|force_escape }}</span>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<span id="summary-tab-bus" class="summary-tab nav-link">{{ _("Bus")|force_escape }}</span>
|
||||
<span id="summary-tab-bus" class="summary-tab nav-link" data-tab="bus">{{ _("Bus")|force_escape }}</span>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<span id="summary-tab-regular" class="summary-tab nav-link">{{ _("Regular")|force_escape }}</span>
|
||||
<span id="summary-tab-regular" class="summary-tab nav-link" data-tab="regular">{{ _("Regular")|force_escape }}</span>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<span id="summary-tab-count" class="summary-tab nav-link">{{ _("Count")|force_escape }}</span>
|
||||
<span id="summary-tab-count" class="summary-tab nav-link" data-tab="count">{{ _("Count")|force_escape }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -71,7 +71,7 @@ First written: 2020/7/23
|
||||
</ul>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<button id="debit-new" class="btn btn-primary btn-new" type="button">
|
||||
<button class="btn btn-primary btn-new" type="button" data-type="debit">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</li>
|
||||
|
@ -71,7 +71,7 @@ First written: 2020/7/23
|
||||
</ul>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<button id="credit-new" class="btn btn-primary btn-new" type="button">
|
||||
<button class="btn btn-primary btn-new" type="button" data-type="credit">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</li>
|
||||
|
@ -73,7 +73,7 @@ First written: 2020/7/23
|
||||
</ul>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<button id="debit-new" class="btn btn-primary btn-new" type="button">
|
||||
<button class="btn btn-primary btn-new" type="button" data-type="debit">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</li>
|
||||
@ -93,13 +93,13 @@ First written: 2020/7/23
|
||||
<ul id="credit-records" class="list-group">
|
||||
{% for record in item.credit_records %}
|
||||
{% with record_type="credit" no=forloop.counter order=forloop.counter %}
|
||||
{% include "accounting/transactions/../../include/form-record-transfer.html" %}
|
||||
{% include "accounting/include/form-record-transfer.html" %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<button id="credit-new" class="btn btn-primary btn-new" type="button">
|
||||
<button class="btn btn-primary btn-new" type="button" data-type="credit">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</li>
|
||||
|
Reference in New Issue
Block a user