add alert when no there are any device selected

This commit is contained in:
Cayo Puigdefabregas 2022-02-28 11:19:22 +01:00
parent f655bfb895
commit 692358c343
3 changed files with 25 additions and 0 deletions

View File

@ -155,5 +155,7 @@ function export_file(type_file) {
if (devices_id){ if (devices_id){
var url = "/inventory/export/"+type_file+"/?ids="+devices_id; var url = "/inventory/export/"+type_file+"/?ids="+devices_id;
window.location.href = url; window.location.href = url;
} else {
$("#exportAlertModal").click();
} }
} }

View File

@ -0,0 +1,21 @@
<div class="modal fade" id="exportErrorModal" tabindex="-1" style="display: none;" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Error export</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p class="text-danger pol">
You need select first some device for use export file
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

View File

@ -205,6 +205,7 @@
<i class="bi bi-reply"></i> <i class="bi bi-reply"></i>
Exports Exports
</button> </button>
<span class="d-none" id="exportAlertModal" data-bs-toggle="modal" data-bs-target="#exportErrorModal"></span>
<ul class="dropdown-menu" aria-labelledby="btnExport"> <ul class="dropdown-menu" aria-labelledby="btnExport">
<li> <li>
<a href="javascript:export_file('devices')" class="dropdown-item"> <a href="javascript:export_file('devices')" class="dropdown-item">
@ -372,6 +373,7 @@
{% include "inventory/allocate.html" %} {% include "inventory/allocate.html" %}
{% include "inventory/data_wipe.html" %} {% include "inventory/data_wipe.html" %}
{% include "inventory/trade.html" %} {% include "inventory/trade.html" %}
{% include "inventory/alert_export_error.html" %}
<!-- CDN --> <!-- CDN -->
<script src="https://cdn.jsdelivr.net/npm/simple-datatables@latest"></script> <script src="https://cdn.jsdelivr.net/npm/simple-datatables@latest"></script>