Revised the record form template to display the whole-record errors.
This commit is contained in:
parent
5833af83a9
commit
1f0ec979ae
@ -20,52 +20,55 @@ 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" 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" 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 %}
|
||||
<option value=""></option>
|
||||
<li id="{{ record_type }}-{{ no }}" class="list-group-item {% if should_validate and record.non_field_errors %} list-group-item-danger {% endif %} draggable-record {{ record_type }}-record" data-no="{{ no }}">
|
||||
<div id="{{ record_type }}-{{ no }}-error">{% if should_validate and record.non_field_errors %}{{ record.non_field_errors.0 }}{% endif %}</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<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 %}
|
||||
<option value="">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</option>
|
||||
</select>
|
||||
<div id="{{ record_type }}-{{ no }}-account-error" class="invalid-feedback">{% if should_validate %}{{ record.account.errors.0|default:"" }}{% endif %}</div>
|
||||
</div>
|
||||
<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" 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" data-type="{{ record_type }}" />
|
||||
<div id="{{ record_type }}-{{ no }}-amount-error" class="invalid-feedback">{% if should_validate %}{{ record.amount.errors.0|default:"" }}{% endif %}</div>
|
||||
<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" 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 %}
|
||||
<option value=""></option>
|
||||
{% endif %}
|
||||
<option value="">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</option>
|
||||
</select>
|
||||
<div id="{{ record_type }}-{{ no }}-account-error" class="invalid-feedback">{% if should_validate %}{{ record.account.errors.0|default:"" }}{% endif %}</div>
|
||||
</div>
|
||||
<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" 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" 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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="btn-group d-none d-lg-flex btn-actions-{{ record_type }}">
|
||||
<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 }}" data-type="{{ record_type }}" data-no="{{ no }}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="btn-group-vertical d-lg-none btn-actions-{{ record_type }}">
|
||||
<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 }}" data-type="{{ record_type }}" data-no="{{ no }}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
<div>
|
||||
<div class="btn-group d-none d-lg-flex btn-actions-{{ record_type }}">
|
||||
<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 }}" data-type="{{ record_type }}" data-no="{{ no }}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="btn-group-vertical d-lg-none btn-actions-{{ record_type }}">
|
||||
<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 }}" data-type="{{ record_type }}" data-no="{{ no }}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
@ -20,44 +20,47 @@ 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" data-no="{{ no }}">
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{% 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" 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 %}
|
||||
<option value=""></option>
|
||||
<li id="{{ record_type }}-{{ no }}" class="list-group-item {% if should_validate and record.non_field_errors %} list-group-item-danger {% endif %} draggable-record {{ record_type }}-record" data-no="{{ no }}">
|
||||
<div id="{{ record_type }}-{{ no }}-error">{% if should_validate and record.non_field_errors %}{{ record.non_field_errors.0 }}{% endif %}</div>
|
||||
<div class="d-flex">
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{% if record.id.value %}
|
||||
<input type="hidden" name="{{ record_type }}-{{ no }}-id" value="{{ record.id.value }}" />
|
||||
{% endif %}
|
||||
<option value="">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</option>
|
||||
</select>
|
||||
<div id="{{ record_type }}-{{ no }}-account-error" class="invalid-feedback">{% if should_validate %}{{ record.account.errors.0|default:"" }}{% endif %}</div>
|
||||
<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" 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 %}
|
||||
<option value=""></option>
|
||||
{% endif %}
|
||||
<option value="">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</option>
|
||||
</select>
|
||||
<div id="{{ record_type }}-{{ no }}-account-error" class="invalid-feedback">{% if should_validate %}{{ record.account.errors.0|default:"" }}{% endif %}</div>
|
||||
</div>
|
||||
</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" 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" 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>
|
||||
</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" 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="btn-group-vertical btn-actions-{{ record_type }}">
|
||||
<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 }}" data-type="{{ record_type }}" data-no="{{ no }}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</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" 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>
|
||||
</div>
|
||||
<div>
|
||||
<div class="btn-group-vertical btn-actions-{{ record_type }}">
|
||||
<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 }}" data-type="{{ record_type }}" data-no="{{ no }}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user