122 lines
		
	
	
		
			4.9 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			122 lines
		
	
	
		
			4.9 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| {% extends "base.html" %}
 | |
| {% comment %}
 | |
| The Mia Accounting Application
 | |
| transaction_form-expense.html: The template for the form of the
 | |
| cash-expense transactions
 | |
| 
 | |
|  Copyright (c) 2020 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: 2020/7/23
 | |
| {% endcomment %}
 | |
| {% load static %}
 | |
| {% load i18n %}
 | |
| {% load mia_core %}
 | |
| 
 | |
| {% block settings %}
 | |
|   {% setvar "title" _("Cash Expense Transaction") %}
 | |
|   {% setvar "use_jqueryui" True %}
 | |
|   {% static "accounting/css/transactions.css" as file %}{% add_css file %}
 | |
|   {% static "accounting/css/summary-helper.css" as file %}{% add_css file %}
 | |
|   {% static "accounting/js/transaction-form.js" as file %}{% add_js file %}
 | |
|   {% static "js/regular-payments.js" as file %}{% add_js file %}
 | |
|   {% static "accounting/js/summary-helper.js" as file %}{% add_js file %}
 | |
| {% endblock %}
 | |
| 
 | |
| {% block content %}
 | |
| 
 | |
| {% include "accounting/include/summary-helper.html" %}
 | |
| 
 | |
| {% for message in form.non_field_errors %}
 | |
|   <div class="alert alert-danger alert-dismissible fade show">
 | |
|     <button type="button" class="close" data-dismiss="alert">×</button>
 | |
|     <strong>{{ _("Error:")|force_escape }}</strong> {{ message }}
 | |
|   </div>
 | |
| {% endfor %}
 | |
| 
 | |
| <div class="btn-group btn-actions">
 | |
|   <a class="btn btn-primary" role="button" href="{% if form.transaction %}{% url "accounting:transactions.detail" "expense" form.transaction as url %}{% url_keep_return url %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
 | |
|     <i class="fas fa-chevron-circle-left"></i>
 | |
|     {{ _("Back")|force_escape }}
 | |
|   </a>
 | |
| </div>
 | |
| 
 | |
| <input id="account-option-url" type="hidden" value="{% url "accounting:api.accounts.options" %}" />
 | |
| <input id="summary-categories" type="hidden" value="{{ summary_categories }}" />
 | |
| <input id="new-record-template" type="hidden" value="{{ new_record_template }}" />
 | |
| <form id="txn-form" action="{% if form.transaction %}{% url "accounting:transactions.update" "expense" form.transaction as url %}{% url_keep_return url %}{% else %}{% url "accounting:transactions.create" "expense" as url %}{% url_keep_return url %}{% endif %}" method="post">
 | |
|   {% csrf_token %}
 | |
|   <div class="row form-group">
 | |
|     <div class="col-sm-2">
 | |
|       <label for="txn-date">{{ _("Date:")|force_escape }}</label>
 | |
|     </div>
 | |
|     <div class="col-sm-10">
 | |
|       {% now "Y-m-d" as today %}
 | |
|       <input id="txn-date" class="form-control {% if form.date.errors %} is-invalid {% endif %}" type="date" name="date" value="{% if form.is_bound %}{{ form.date.value }}{% else %}{% now "Y-m-d" %}{% endif %}" required="required" />
 | |
|       <div id="txn-date-error" class="invalid-feedback">{{ form.date.errors.0|default:"" }}</div>
 | |
|     </div>
 | |
|   </div>
 | |
| 
 | |
|   <div class="row form-group">
 | |
|     <div class="col-sm-12">
 | |
|       <ul id="debit-records" class="list-group">
 | |
|         {% for record in form.debit_records %}
 | |
|           {% with record_type="debit" no=forloop.counter order=forloop.counter %}
 | |
|             {% include "accounting/include/record_form-non-transfer.html" %}
 | |
|           {% endwith %}
 | |
|         {% empty %}
 | |
|           {% with record_type="debit" no=1 order=1 %}
 | |
|             {% include "accounting/include/record_form-non-transfer.html" %}
 | |
|           {% endwith %}
 | |
|         {% endfor %}
 | |
|       </ul>
 | |
|       <ul class="list-group">
 | |
|         <li class="list-group-item">
 | |
|           <button class="btn btn-primary btn-new" type="button" data-type="debit">
 | |
|             <i class="fas fa-plus"></i>
 | |
|           </button>
 | |
|         </li>
 | |
|         <li class="list-group-item">
 | |
|           <div class="d-flex justify-content-between align-items-center">
 | |
|             {{ _("Total")|force_escape }}
 | |
|             <span id="debit-total" class="amount">{{ form.debit_total }}</span>
 | |
|           </div>
 | |
|         </li>
 | |
|       </ul>
 | |
|     </div>
 | |
|   </div>
 | |
| 
 | |
|   <div class="row form-group">
 | |
|     <div class="col-sm-2">
 | |
|       <label for="txn-note">{{ _("Notes:")|force_escape }}</label>
 | |
|     </div>
 | |
|     <div class="col-sm-10">
 | |
|       <textarea id="txn-note" class="form-control {% if form.notes.errors %} is-invalid {% endif %}" name="notes">{{ form.notes.value|default:"" }}</textarea>
 | |
|       <div id="txn-note-error" class="invalid-feedback">{{ form.notes.errors.0|default:"" }}</div>
 | |
|     </div>
 | |
|   </div>
 | |
| 
 | |
|   <div class="row form-group">
 | |
|     <div class="col-sm-12">
 | |
|       <button class="btn btn-primary" type="submit">
 | |
|         <i class="fas fa-save"></i>
 | |
|         {{ _("Save")|force_escape }}
 | |
|       </button>
 | |
|     </div>
 | |
|   </div>
 | |
| </form>
 | |
| 
 | |
| {% endblock %}
 |