Replaced the function-based JavaScript with the object-oriented TransactionForm, CurrencySubForm, DebitCreditSideSubForm, JournalEntrySubForm, and JournalEntryForm classes for the transaction form.
This commit is contained in:
		| @@ -34,7 +34,7 @@ First written: 2023/2/25 | ||||
|       </div> | ||||
|  | ||||
|       <div> | ||||
|         <button id="accounting-btn-delete-currency-{{ currency_index }}" class="btn btn-danger rounded-circle accounting-btn-delete-currency {% if only_one_currency_form %} d-none {% endif %}" type="button" data-target="accounting-currency-{{ currency_index }}"> | ||||
|         <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> | ||||
| @@ -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-bs-toggle="modal" data-bs-target="#accounting-entry-form-modal"> | ||||
|           <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-form-modal"> | ||||
|             <i class="fas fa-plus"></i> | ||||
|             {{ A_("New") }} | ||||
|           </button> | ||||
|   | ||||
| @@ -19,7 +19,7 @@ entry-form-modal.html: The modal of the journal entry sub-form | ||||
| Author: imacat@mail.imacat.idv.tw (imacat) | ||||
| First written: 2023/2/25 | ||||
| #} | ||||
| <form id="accounting-entry-form" data-currency-index="" data-entry-type="" data-entry-index=""> | ||||
| <form id="accounting-entry-form" data-entry-type=""> | ||||
|   <div id="accounting-entry-form-modal" class="modal fade" tabindex="-1" aria-labelledby="accounting-entry-form-modal-label" aria-hidden="true"> | ||||
|     <div class="modal-dialog"> | ||||
|       <div class="modal-content"> | ||||
| @@ -52,7 +52,7 @@ First written: 2023/2/25 | ||||
|         </div> | ||||
|         <div class="modal-footer"> | ||||
|           <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ A_("Cancel") }}</button> | ||||
|           <button id="accounting-entry-form-btn-save" type="submit" class="btn btn-primary">{{ A_("Save") }}</button> | ||||
|           <button type="submit" class="btn btn-primary">{{ A_("Save") }}</button> | ||||
|         </div> | ||||
|       </div> | ||||
|     </div> | ||||
|   | ||||
| @@ -27,7 +27,7 @@ First written: 2023/2/25 | ||||
|   <input id="accounting-currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}-no" type="hidden" name="currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}-no" value="{{ entry_index }}"> | ||||
|   <input id="accounting-currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}-account-code" class="accounting-{{ entry_type }}-account-code" type="hidden" name="currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}-account_code" value="{{ account_code_data }}" data-text="{{ account_text }}"> | ||||
|   <input id="accounting-currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}-summary" type="hidden" name="currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}-summary" value="{{ summary_data }}"> | ||||
|   <input id="accounting-currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}-amount" class="accounting-currency-{{ currency_index }}-{{ entry_type }}-amount" type="hidden" name="currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}-amount" value="{{ amount_data }}"> | ||||
|   <input id="accounting-currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}-amount" type="hidden" name="currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}-amount" value="{{ amount_data }}"> | ||||
|   <div class="accounting-entry-content"> | ||||
|     <div id="accounting-currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}-control" class="form-control clickable d-flex justify-content-between accounting-entry-control {% if entry_errors %} is-invalid {% endif %}" data-bs-toggle="modal" data-bs-target="#accounting-entry-form-modal"> | ||||
|       <div> | ||||
| @@ -40,7 +40,7 @@ First written: 2023/2/25 | ||||
|   </div> | ||||
|  | ||||
|   <div> | ||||
|     <button id="accounting-currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}-btn-delete" class="btn btn-danger rounded-circle accounting-btn-delete-entry accounting-currency-{{ currency_index }}-{{ entry_type }}-btn-delete-entry {% if only_one_entry_form %} d-none {% endif %}" type="button" data-target="accounting-currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}" data-same-class="accounting-currency-{{ currency_index }}-{{ entry_type }}-btn-delete-entry"> | ||||
|     <button id="accounting-currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}-delete" class="btn btn-danger rounded-circle {% if only_one_entry_form %} d-none {% endif %}" type="button" data-target="accounting-currency-{{ currency_index }}-{{ entry_type }}-{{ entry_index }}" data-same-class="accounting-currency-{{ currency_index }}-{{ entry_type }}-btn-delete-entry"> | ||||
|       <i class="fas fa-minus"></i> | ||||
|     </button> | ||||
|   </div> | ||||
|   | ||||
| @@ -57,7 +57,7 @@ First written: 2023/2/26 | ||||
|       </div> | ||||
|  | ||||
|       <div> | ||||
|         <button id="accounting-btn-new-currency" class="btn btn-primary" type="button"> | ||||
|         <button id="accounting-add-currency" class="btn btn-primary" type="button"> | ||||
|           <i class="fas fa-plus"></i> | ||||
|           {{ A_("New") }} | ||||
|         </button> | ||||
|   | ||||
| @@ -34,7 +34,7 @@ First written: 2023/2/25 | ||||
|       </div> | ||||
|  | ||||
|       <div> | ||||
|         <button id="accounting-btn-delete-currency-{{ currency_index }}" class="btn btn-danger rounded-circle accounting-btn-delete-currency {% if only_one_currency_form %} d-none {% endif %}" type="button" data-target="accounting-currency-{{ currency_index }}"> | ||||
|         <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> | ||||
| @@ -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-bs-toggle="modal" data-bs-target="#accounting-entry-form-modal"> | ||||
|           <button id="accounting-currency-{{ currency_index }}-credit-add-entry" class="btn btn-primary" type="button" data-currency-index="{{ currency_index }}" data-entry-type="credit" data-bs-toggle="modal" data-bs-target="#accounting-entry-form-modal"> | ||||
|             <i class="fas fa-plus"></i> | ||||
|             {{ A_("New") }} | ||||
|           </button> | ||||
|   | ||||
| @@ -34,7 +34,7 @@ First written: 2023/2/25 | ||||
|       </div> | ||||
|  | ||||
|       <div> | ||||
|         <button id="accounting-btn-delete-currency-{{ currency_index }}" class="btn btn-danger rounded-circle accounting-btn-delete-currency {% if only_one_currency_form %} d-none {% endif %}" type="button" data-target="accounting-currency-{{ currency_index }}"> | ||||
|         <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> | ||||
| @@ -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-bs-toggle="modal" data-bs-target="#accounting-entry-form-modal"> | ||||
|             <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-form-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-bs-toggle="modal" data-bs-target="#accounting-entry-form-modal"> | ||||
|             <button id="accounting-currency-{{ currency_index }}-credit-add-entry" class="btn btn-primary" type="button" data-currency-index="{{ currency_index }}" data-entry-type="credit" data-bs-toggle="modal" data-bs-target="#accounting-entry-form-modal"> | ||||
|               <i class="fas fa-plus"></i> | ||||
|               {{ A_("New") }} | ||||
|             </button> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user