Added forms and validators, and applied them to the transaction form in the accounting application.
This commit is contained in:
@ -33,13 +33,13 @@ First written: 2020/7/23
|
||||
{% block content %}
|
||||
|
||||
<div class="btn-group btn-actions">
|
||||
<a class="btn btn-primary" role="button" href="{% if item.pk %}{% url_keep_return "accounting:transactions.show" "expense" item %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
||||
<a class="btn btn-primary" role="button" href="{% if item.transaction %}{% url_keep_return "accounting:transactions.show" "expense" item.transaction %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
||||
<i class="fas fa-chevron-circle-left"></i>
|
||||
{% trans "Back" context "Navigation|" as text %}{{ text|force_escape }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<form id="txn-form" action="{% if item.pk %}{% url_keep_return "accounting:transactions.update" "expense" item %}{% else %}{% url_keep_return "accounting:transactions.store" "expense" %}{% endif %}" method="post">
|
||||
<form id="txn-form" action="{% if item.transaction %}{% url_keep_return "accounting:transactions.update" "expense" item.transaction %}{% else %}{% url_keep_return "accounting:transactions.store" "expense" %}{% endif %}" method="post">
|
||||
{% csrf_token %}
|
||||
{# TODO: To be done #}
|
||||
<input id="l10n-messages" type="hidden" value="{{ l10n_messages }}" />
|
||||
@ -52,8 +52,8 @@ First written: 2020/7/23
|
||||
<label for="txn-date">{% trans "Date:" context "Accounting|" as text %}{{ text|force_escape }}</label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<input id="txn-date" class="form-control {% if errors|dict:"date" %} is-invalid {% endif %}" type="date" name="date" value="{{ item.date|date:"Y-m-d" }}" required="required" />
|
||||
<div id="txn-date-error" class="invalid-feedback">{{ errors|dict:"date"|default:"" }}</div>
|
||||
<input id="txn-date" class="form-control {% if item.date.errors %} is-invalid {% endif %}" type="date" name="date" value="{{ item.date.value }}" required="required" />
|
||||
<div id="txn-date-error" class="invalid-feedback">{{ item.date.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -64,32 +64,29 @@ First written: 2020/7/23
|
||||
<li id="debit-{{ forloop.counter }}" class="list-group-item d-flex justify-content-between draggable-record debit-record">
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
{% if x.pk is not None %}
|
||||
<input type="hidden" name="debit-{{ forloop.counter }}-sn" value="{{ x.pk }}" />
|
||||
{% if x.id.value %}
|
||||
<input type="hidden" name="debit-{{ forloop.counter }}-id" value="{{ x.id.value }}" />
|
||||
{% endif %}
|
||||
<input id="debit-{{ forloop.counter }}-ord" class="debit-ord" type="hidden" name="debit-{{ forloop.counter }}-ord" value="{{ x.ord }}" />
|
||||
{% str_format "debit-{}-account" forloop.counter as field %}
|
||||
<select id="{{ field }}" class="form-control record-account debit-account {% if errors|dict:field %} is-invalid {% endif %}" name="{{ field }}">
|
||||
<input id="debit-{{ forloop.counter }}-ord" class="debit-ord" type="hidden" name="debit-{{ forloop.counter }}-ord" value="{{ x.ord.value }}" />
|
||||
<select id="debit-{{ forloop.counter }}-account" class="form-control record-account debit-account {% if x.account.errors %} is-invalid {% endif %}" name="debit-{{ forloop.counter }}-account">
|
||||
{% if x.account is not None %}
|
||||
<option value="{{ x.account.code }}" selected="selected">{{ x.account.code }} {{ x.account.title }}</option>
|
||||
<option value="{{ x.account.value|default:"" }}" selected="selected">{{ x.account.value|default:"" }} {{ x.account_title|default:"" }}</option>
|
||||
{% else %}
|
||||
<option value=""></option>
|
||||
{% endif %}
|
||||
<option value="">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</option>
|
||||
</select>
|
||||
<div id="{{ field }}-error" class="invalid-feedback">{{ errors|dict:field|default:"" }}</div>
|
||||
<div id="debit-{{ forloop.counter }}-account-error" class="invalid-feedback">{{ x.account.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
{% str_format "debit-{}-summary" forloop.counter as field %}
|
||||
<input id="{{ field }}" class="form-control record-summary {% if errors|dict:field %} is-invalid {% endif %}" type="text" name="{{ field }}" value="{{ x.summary|default:"" }}" maxlength="128" />
|
||||
<div id="{{ field }}-error" class="invalid-feedback">{{ errors|dict:field|default:"" }}</div>
|
||||
<input id="debit-{{ forloop.counter }}-summary" class="form-control record-summary {% if x.summary.errors %} is-invalid {% endif %}" type="text" name="debit-{{ forloop.counter }}-summary" value="{{ x.summary.value|default:"" }}" maxlength="128" />
|
||||
<div id="debit-{{ forloop.counter }}-summary-error" class="invalid-feedback">{{ x.summary.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
{% str_format "debit-{}-amount" forloop.counter as field %}
|
||||
<input id="{{ field }}" class="form-control record-amount debit-to-sum {% if errors|dict:field %} is-invalid {% endif %}" type="number" min="1" name="{{ field }}" value="{{ x.amount|default:"" }}" required="required" />
|
||||
<div id="{{ field }}-error" class="invalid-feedback">{{ errors|dict:field|default:"" }}</div>
|
||||
<input id="debit-{{ forloop.counter }}-amount" class="form-control record-amount debit-to-sum {% if x.amount.errors %} is-invalid {% endif %}" type="number" min="1" name="debit-{{ forloop.counter }}-amount" value="{{ x.amount.value|default:"" }}" required="required" />
|
||||
<div id="debit-{{ forloop.counter }}-amount-error" class="invalid-feedback">{{ x.amount.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -136,8 +133,8 @@ First written: 2020/7/23
|
||||
<label for="txn-note">{% trans "Notes:" context "Accounting|" as text %}{{ text|force_escape }}</label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<textarea id="txn-note" class="form-control {% if errors|dict:"notes" %} is-invalid {% endif %}" name="note">{{ item.notes|default:"" }}</textarea>
|
||||
<div id="txn-note-error" class="invalid-feedback">{{ errors|dict:"notes"|default:"" }}</div>
|
||||
<textarea id="txn-note" class="form-control {% if item.notes.errors %} is-invalid {% endif %}" name="notes">{{ item.notes.value|default:"" }}</textarea>
|
||||
<div id="txn-note-error" class="invalid-feedback">{{ item.notes.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -33,13 +33,13 @@ First written: 2020/7/23
|
||||
{% block content %}
|
||||
|
||||
<div class="btn-group btn-actions">
|
||||
<a class="btn btn-primary" role="button" href="{% if item.pk %}{% url_keep_return "accounting:transactions.show" "income" item %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
||||
<a class="btn btn-primary" role="button" href="{% if item.transaction %}{% url_keep_return "accounting:transactions.show" "income" item.transaction %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
||||
<i class="fas fa-chevron-circle-left"></i>
|
||||
{% trans "Back" context "Navigation|" as text %}{{ text|force_escape }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<form id="txn-form" action="{% if item.pk %}{% url_keep_return "accounting:transactions.update" "income" item %}{% else %}{% url_keep_return "accounting:transactions.store" "income" %}{% endif %}" method="post">
|
||||
<form id="txn-form" action="{% if item.transaction %}{% url_keep_return "accounting:transactions.update" "income" item.transaction %}{% else %}{% url_keep_return "accounting:transactions.store" "income" %}{% endif %}" method="post">
|
||||
{% csrf_token %}
|
||||
{# TODO: To be done #}
|
||||
<input id="l10n-messages" type="hidden" value="{{ l10n_messages }}" />
|
||||
@ -52,8 +52,8 @@ First written: 2020/7/23
|
||||
<label for="txn-date">{% trans "Date:" context "Accounting|" as text %}{{ text|force_escape }}</label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<input id="txn-date" class="form-control {% if errors|dict:"date" %} is-invalid {% endif %}" type="date" name="date" value="{{ item.date|date:"Y-m-d" }}" required="required" />
|
||||
<div id="txn-date-error" class="invalid-feedback">{{ errors|dict:"date"|default:"" }}</div>
|
||||
<input id="txn-date" class="form-control {% if item.date.errors %} is-invalid {% endif %}" type="date" name="date" value="{{ item.date.value }}" required="required" />
|
||||
<div id="txn-date-error" class="invalid-feedback">{{ item.date.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -64,32 +64,29 @@ First written: 2020/7/23
|
||||
<li id="credit-{{ forloop.counter }}" class="list-group-item d-flex justify-content-between draggable-record credit-record">
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
{% if x.pk is not None %}
|
||||
<input type="hidden" name="credit-{{ forloop.counter }}-sn" value="{{ x.pk }}" />
|
||||
{% if x.id.value %}
|
||||
<input type="hidden" name="credit-{{ forloop.counter }}-id" value="{{ x.id.value }}" />
|
||||
{% endif %}
|
||||
<input id="credit-{{ forloop.counter }}-ord" class="credit-ord" type="hidden" name="credit-{{ forloop.counter }}-ord" value="{{ x.ord }}" />
|
||||
{% str_format "credit-{}-account" forloop.counter as field %}
|
||||
<select id="{{ field }}" class="form-control record-account credit-account {% if errors|dict:field %} is-invalid {% endif %}" name="{{ field }}">
|
||||
<input id="credit-{{ forloop.counter }}-ord" class="credit-ord" type="hidden" name="credit-{{ forloop.counter }}-ord" value="{{ x.ord.value }}" />
|
||||
<select id="credit-{{ forloop.counter }}-account" class="form-control record-account credit-account {% if x.account.errors %} is-invalid {% endif %}" name="credit-{{ forloop.counter }}-account">
|
||||
{% if x.account is not None %}
|
||||
<option value="{{ x.account.code }}" selected="selected">{{ x.account.code }} {{ x.account.title }}</option>
|
||||
<option value="{{ x.account.value|default:"" }}" selected="selected">{{ x.account.value|default:"" }} {{ x.account_title|default:"" }}</option>
|
||||
{% else %}
|
||||
<option value=""></option>
|
||||
{% endif %}
|
||||
<option value="">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</option>
|
||||
</select>
|
||||
<div id="{{ field }}-error" class="invalid-feedback">{{ errors|dict:field|default:"" }}</div>
|
||||
<div id="credit-{{ forloop.counter }}-account-error" class="invalid-feedback">{{ x.account.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
{% str_format "credit-{}-summary" forloop.counter as field %}
|
||||
<input id="{{ field }}" class="form-control record-summary {% if errors|dict:field %} is-invalid {% endif %}" type="text" name="{{ field }}" value="{{ x.summary|default:"" }}" maxlength="128" />
|
||||
<div id="{{ field }}-error" class="invalid-feedback">{{ errors|dict:field|default:"" }}</div>
|
||||
<input id="credit-{{ forloop.counter }}-summary" class="form-control record-summary {% if x.summary.errors %} is-invalid {% endif %}" type="text" name="credit-{{ forloop.counter }}-summary" value="{{ x.summary.value|default:"" }}" maxlength="128" />
|
||||
<div id="credit-{{ forloop.counter }}-summary-error" class="invalid-feedback">{{ x.summary.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
{% str_format "credit-{}-amount" forloop.counter as field %}
|
||||
<input id="{{ field }}" class="form-control record-amount credit-to-sum {% if errors|dict:field %} is-invalid {% endif %}" type="number" min="1" name="{{ field }}" value="{{ x.amount|default:"" }}" required="required" />
|
||||
<div id="{{ field }}-error" class="invalid-feedback">{{ errors|dict:field|default:"" }}</div>
|
||||
<input id="credit-{{ forloop.counter }}-amount" class="form-control record-amount credit-to-sum {% if x.amount.errors %} is-invalid {% endif %}" type="number" min="1" name="credit-{{ forloop.counter }}-amount" value="{{ x.amount.value|default:"" }}" required="required" />
|
||||
<div id="credit-{{ forloop.counter }}-amount-error" class="invalid-feedback">{{ x.amount.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -136,8 +133,8 @@ First written: 2020/7/23
|
||||
<label for="txn-note">{% trans "Notes:" context "Accounting|" as text %}{{ text|force_escape }}</label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<textarea id="txn-note" class="form-control {% if errors|dict:"notes" %} is-invalid {% endif %}" name="note">{{ item.notes|default:"" }}</textarea>
|
||||
<div id="txn-note-error" class="invalid-feedback">{{ errors|dict:"notes"|default:"" }}</div>
|
||||
<textarea id="txn-note" class="form-control {% if item.notes.errors %} is-invalid {% endif %}" name="notes">{{ item.notes.value|default:"" }}</textarea>
|
||||
<div id="txn-note-error" class="invalid-feedback">{{ item.notes.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -33,13 +33,13 @@ First written: 2020/7/23
|
||||
{% block content %}
|
||||
|
||||
<div class="btn-group btn-actions">
|
||||
<a class="btn btn-primary" role="button" href="{% if item.pk %}{% url_keep_return "accounting:transactions.show" "transfer" item %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
||||
<a class="btn btn-primary" role="button" href="{% if item.transaction %}{% url_keep_return "accounting:transactions.show" "transfer" item.transaction %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
||||
<i class="fas fa-chevron-circle-left"></i>
|
||||
{% trans "Back" context "Navigation|" as text %}{{ text|force_escape }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<form id="txn-form" action="{% if item.pk %}{% url_keep_return "accounting:transactions.update" "transfer" item %}{% else %}{% url_keep_return "accounting:transactions.store" "transfer" %}{% endif %}" method="post">
|
||||
<form id="txn-form" action="{% if item.transaction %}{% url_keep_return "accounting:transactions.update" "transfer" item.transaction %}{% else %}{% url_keep_return "accounting:transactions.store" "transfer" %}{% endif %}" method="post">
|
||||
{% csrf_token %}
|
||||
{# TODO: To be done #}
|
||||
<input id="l10n-messages" type="hidden" value="{{ l10n_messages }}" />
|
||||
@ -55,8 +55,8 @@ First written: 2020/7/23
|
||||
<label for="txn-date">{% trans "Date:" context "Accounting|" as text %}{{ text|force_escape }}</label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<input id="txn-date" class="form-control {% if errors|dict:"date" %} is-invalid {% endif %}" type="date" name="date" value="{{ item.date|date:"Y-m-d" }}" required="required" />
|
||||
<div id="txn-date-error" class="invalid-feedback">{{ errors|dict:"date"|default:"" }}</div>
|
||||
<input id="txn-date" class="form-control {% if item.date.errors %} is-invalid {% endif %}" type="date" name="date" value="{{ item.date.value }}" required="required" />
|
||||
<div id="txn-date-error" class="invalid-feedback">{{ item.date.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -70,32 +70,29 @@ First written: 2020/7/23
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{% if x.pk is not None %}
|
||||
<input type="hidden" name="debit-{{ forloop.counter }}-sn" value="{{ x.pk }}" />
|
||||
{% if x.id.value %}
|
||||
<input type="hidden" name="debit-{{ forloop.counter }}-id" value="{{ x.id.value }}" />
|
||||
{% endif %}
|
||||
<input id="debit-{{ forloop.counter }}-ord" class="debit-ord" type="hidden" name="debit-{{ forloop.counter }}-ord" value="{{ x.ord }}" />
|
||||
{% str_format "debit-{}-account" forloop.counter as field %}
|
||||
<select id="{{ field }}" class="form-control record-account debit-account {% if errors|dict:field %} is-invalid {% endif %}" name="{{ field }}">
|
||||
<input id="debit-{{ forloop.counter }}-ord" class="debit-ord" type="hidden" name="debit-{{ forloop.counter }}-ord" value="{{ x.ord.value }}" />
|
||||
<select id="debit-{{ forloop.counter }}-account" class="form-control record-account debit-account {% if x.account.errors %} is-invalid {% endif %}" name="debit-{{ forloop.counter }}-account">
|
||||
{% if x.account is not None %}
|
||||
<option value="{{ x.account.code }}" selected="selected">{{ x.account.code }} {{ x.account.title }}</option>
|
||||
<option value="{{ x.account.value|default:"" }}" selected="selected">{{ x.account.value|default:"" }} {{ x.account_title|default:"" }}</option>
|
||||
{% else %}
|
||||
<option value=""></option>
|
||||
{% endif %}
|
||||
<option value="">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</option>
|
||||
</select>
|
||||
<div id="{{ field }}-error" class="invalid-feedback">{{ errors|dict:field|default:"" }}</div>
|
||||
<div id="debit-{{ forloop.counter }}-account-error" class="invalid-feedback">{{ x.account.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
{% str_format "debit-{}-summary" forloop.counter as field %}
|
||||
<input id="{{ field }}" class="form-control record-summary {% if errors|dict:field %} is-invalid {% endif %}" type="text" name="{{ field }}" value="{{ x.summary|default:"" }}" maxlength="128" />
|
||||
<div id="{{ field }}-error" class="invalid-feedback">{{ errors|dict:field|default:"" }}</div>
|
||||
<input id="debit-{{ forloop.counter }}-summary" class="form-control record-summary {% if x.summary.errors %} is-invalid {% endif %}" type="text" name="debit-{{ forloop.counter }}-summary" value="{{ x.summary.value|default:"" }}" maxlength="128" />
|
||||
<div id="debit-{{ forloop.counter }}-summary-error" class="invalid-feedback">{{ x.summary.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
{% str_format "debit-{}-amount" forloop.counter as field %}
|
||||
<input id="{{ field }}" class="form-control record-amount debit-to-sum {% if errors|dict:field %} is-invalid {% endif %}" type="number" min="1" name="{{ field }}" value="{{ x.amount|default:"" }}" required="required" />
|
||||
<div id="{{ field }}-error" class="invalid-feedback">{{ errors|dict:field|default:"" }}</div>
|
||||
<input id="debit-{{ forloop.counter }}-amount" class="form-control record-amount debit-to-sum {% if x.amount.errors %} is-invalid {% endif %}" type="number" min="1" name="debit-{{ forloop.counter }}-amount" value="{{ x.amount.value|default:"" }}" required="required" />
|
||||
<div id="debit-{{ forloop.counter }}-amount-error" class="invalid-feedback">{{ x.amount.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -119,11 +116,11 @@ First written: 2020/7/23
|
||||
</button>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div id="debit-total-row" class="d-flex justify-content-between align-items-center form-control {% if errors|dict:"balance" %} is-invalid {% endif %} balance-row">
|
||||
<div id="debit-total-row" class="d-flex justify-content-between align-items-center form-control {% if item.balance_error %} is-invalid {% endif %} balance-row">
|
||||
{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}
|
||||
<span id="debit-total" class="amount">{{ item.debit_total }}</span>
|
||||
</div>
|
||||
<div id="debit-total-error" class="invalid-feedback balance-error">{{ errors|dict:"balance"|default:"" }}</div>
|
||||
<div id="debit-total-error" class="invalid-feedback balance-error">{{ item.balance_error|default:"" }}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -137,32 +134,29 @@ First written: 2020/7/23
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{% if x.pk is not None %}
|
||||
<input type="hidden" name="credit-{{ forloop.counter }}-sn" value="{{ x.pk }}" />
|
||||
{% if x.id.value %}
|
||||
<input type="hidden" name="credit-{{ forloop.counter }}-id" value="{{ x.id.value }}" />
|
||||
{% endif %}
|
||||
<input id="credit-{{ forloop.counter }}-ord" class="credit-ord" type="hidden" name="credit-{{ forloop.counter }}-ord" value="{{ x.ord }}" />
|
||||
{% str_format "credit-{}-account" forloop.counter as field %}
|
||||
<select id="{{ field }}" class="form-control record-account credit-account {% if errors|dict:field %} is-invalid {% endif %}" name="{{ field }}">
|
||||
<input id="credit-{{ forloop.counter }}-ord" class="credit-ord" type="hidden" name="credit-{{ forloop.counter }}-ord" value="{{ x.ord.value }}" />
|
||||
<select id="credit-{{ forloop.counter }}-account" class="form-control record-account credit-account {% if x.account.errors %} is-invalid {% endif %}" name="credit-{{ forloop.counter }}-account">
|
||||
{% if x.account is not None %}
|
||||
<option value="{{ x.account.code }}" selected="selected">{{ x.account.code }} {{ x.account.title }}</option>
|
||||
<option value="{{ x.account.value|default:"" }}" selected="selected">{{ x.account.value|default:"" }} {{ x.account_title|default:"" }}</option>
|
||||
{% else %}
|
||||
<option value=""></option>
|
||||
{% endif %}
|
||||
<option value="">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</option>
|
||||
</select>
|
||||
<div id="{{ field }}-error" class="invalid-feedback">{{ errors|dict:field|default:"" }}</div>
|
||||
<div id="credit-{{ forloop.counter }}-account-error" class="invalid-feedback">{{ x.account.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
{% str_format "credit-{}-summary" forloop.counter as field %}
|
||||
<input id="{{ field }}" class="form-control record-summary {% if errors|dict:field %} is-invalid {% endif %}" type="text" name="{{ field }}" value="{{ x.summary|default:"" }}" maxlength="128" />
|
||||
<div id="{{ field }}-error" class="invalid-feedback">{{ errors|dict:field|default:"" }}</div>
|
||||
<input id="credit-{{ forloop.counter }}-summary" class="form-control record-summary {% if x.summary.errors %} is-invalid {% endif %}" type="text" name="credit-{{ forloop.counter }}-summary" value="{{ x.summary.value|default:"" }}" maxlength="128" />
|
||||
<div id="credit-{{ forloop.counter }}-summary-error" class="invalid-feedback">{{ x.summary.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
{% str_format "credit-{}-amount" forloop.counter as field %}
|
||||
<input id="{{ field }}" class="form-control record-amount credit-to-sum {% if errors|dict:field %} is-invalid {% endif %}" type="number" min="1" name="{{ field }}" value="{{ x.amount|default:"" }}" required="required" />
|
||||
<div id="{{ field }}-error" class="invalid-feedback">{{ errors|dict:field|default:"" }}</div>
|
||||
<input id="credit-{{ forloop.counter }}-amount" class="form-control record-amount credit-to-sum {% if x.amount.errors %} is-invalid {% endif %}" type="number" min="1" name="credit-{{ forloop.counter }}-amount" value="{{ x.amount.value|default:"" }}" required="required" />
|
||||
<div id="credit-{{ forloop.counter }}-amount-error" class="invalid-feedback">{{ x.amount.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -186,11 +180,11 @@ First written: 2020/7/23
|
||||
</button>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div id="credit-total-row" class="d-flex justify-content-between align-items-center form-control {% if errors|dict:"balance" %} is-invalid {% endif %} balance-row">
|
||||
<div id="credit-total-row" class="d-flex justify-content-between align-items-center form-control {% if item.balance_error %} is-invalid {% endif %} balance-row">
|
||||
{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}
|
||||
<span id="credit-total" class="amount">{{ item.credit_total }}</span>
|
||||
</div>
|
||||
<div id="credit-total-error" class="invalid-feedback balance-error">{{ errors|dict:"balance"|default:"" }}</div>
|
||||
<div id="credit-total-error" class="invalid-feedback balance-error">{{ item.balance_error|default:"" }}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -201,8 +195,8 @@ First written: 2020/7/23
|
||||
<label for="txn-note">{% trans "Notes:" context "Accounting|" as text %}{{ text|force_escape }}</label>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<textarea id="txn-note" class="form-control {% if errors|dict:"notes" %} is-invalid {% endif %}" name="note">{{ item.notes|default:"" }}</textarea>
|
||||
<div id="txn-note-error" class="invalid-feedback">{{ errors|dict:"notes"|default:"" }}</div>
|
||||
<textarea id="txn-note" class="form-control {% if item.notes.errors %} is-invalid {% endif %}" name="notes">{{ item.notes.value|default:"" }}</textarea>
|
||||
<div id="txn-note-error" class="invalid-feedback">{{ item.notes.errors.0|default:"" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Reference in New Issue
Block a user