check the checkbox in a devices list when one form is invalid

This commit is contained in:
Cayo Puigdefabregas 2022-02-04 13:16:27 +01:00
parent 662f75bb7b
commit a55944e379
6 changed files with 10 additions and 9 deletions

View File

@ -16,7 +16,7 @@
<div class="col-12">
{{ field.label(class_="form-label") }}: <span class="devices-count"></span>
{{ field(class_="devicesList") }}
<p class="text-danger">
<p class="text-danger pol">
You need select first some device before to do one action
</p>
<p class="enumeration-devices"></p>

View File

@ -17,7 +17,7 @@
{% endfor %}
</select>
<input class="devicesList" type="hidden" name="devices" />
<p class="text-danger">
<p class="text-danger pol">
You need select first some device for adding this in a lot
</p>
</div>

View File

@ -17,7 +17,7 @@
{% endfor %}
</select>
<input class="devicesList" type="hidden" name="device" />
<p class="text-danger">
<p class="text-danger pol">
You need select first some device for adding this in a tag
</p>
</div>

View File

@ -11,16 +11,13 @@
<form action="{{ url_for('inventory.devices.allocate_add') }}" method="post">
{{ form_new_allocate.csrf_token }}
<div class="modal-body">
<p class="text-danger" id="pol" style="display: none;">
You need select first some device before to do one action
</p>
{% for field in form_new_allocate %}
{% if field != form_new_allocate.csrf_token %}
{% if field == form_new_allocate.devices %}
<div class="col-12">
{{ field.label(class_="form-label") }}: <span class="devices-count"></span>
{{ field(class_="devicesList") }}
<p class="text-danger">
<p class="text-danger pol" style="display: none;">
You need select first some device before to do one action
</p>
<p class="enumeration-devices"></p>

View File

@ -237,7 +237,11 @@
<td>
<input type="checkbox" class="deviceSelect" data="{{ dev.id }}"
data-device-type="{{ dev.type }}" data-device-manufacturer="{{ dev.manufacturer }}"
data-device-dhid="{{ dev.devicehub_id }}" />
data-device-dhid="{{ dev.devicehub_id }}"
{% if form_new_allocate.type.data and dev.id in list_devices %}
checked="checked"
{% endif %}
/>
</td>
<td>
<a href="{{ url_for('inventory.devices.device_details', id=dev.devicehub_id)}}">

View File

@ -16,7 +16,7 @@
{% endfor %}
</select>
<input class="devicesList" type="hidden" name="devices" />
<p class="text-danger">
<p class="text-danger pol">
You need select first some device for remove this from a lot
</p>
</div>