extra message confirm when you want delete one lot with devices

This commit is contained in:
Cayo Puigdefabregas 2022-03-07 11:24:02 +01:00
parent 9d43299592
commit 5df74d7742
3 changed files with 16 additions and 2 deletions

View File

@ -59,6 +59,16 @@ function deviceSelect() {
}
}
function removeLot() {
var devices = $(".deviceSelect");
if (devices.length > 0) {
$("#btnRemoveLots .text-danger").show();
} else {
$("#btnRemoveLots .text-danger").hide();
}
$("#activeRemoveLotModal").click();
}
function removeTag() {
var devices = $(".deviceSelect").filter(':checked');
var devices_id = $.map(devices, function(x) { return $(x).attr('data')});

View File

@ -38,7 +38,8 @@
</div>
<div class="col">
{% if lot and lot.is_temporary %}
<a href="javascript:void()" data-bs-toggle="modal" data-bs-target="#btnRemoveLots">
<span class="d-none" id="activeRemoveLotModal" data-bs-toggle="modal" data-bs-target="#btnRemoveLots"></span>
<a href="javascript:removeLot()">
<i class="bi bi-trash"></i>
Remove Lot
</a>

View File

@ -9,12 +9,15 @@
<div class="modal-body">
Are you sure that you want to remove lot <strong>{{ lot.name }}</strong>?
<p class="text-danger">
There are devices in this lot, are you sure you want to delete it?
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<a href="{{ url_for('inventory.devices.lot_del', id=lot.id)}}" type="button" class="btn btn-primary">
Save changes
Confirm
</a>
</div>