Skip to content

Commit c4bcaed

Browse files
committed
fix: avviso tasto importa in sequenza
1 parent 4fc0252 commit c4bcaed

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

plugins/importFE/edit.php

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,23 @@ function upload(btn) {
119119
<span class="input-group-text"><i class="fa fa-search"></i></span>
120120
</div>
121121
<input type="text" class="form-control" id="search_invoice" placeholder="'.tr('Cerca fattura').'">
122-
</div>
123-
124-
<div class="btn-group btn-group-sm d-inline-flex">
125-
<button type="button" class="btn btn-warning" onclick="importAll(this)">
126-
<i class="fa fa-cloud-download"></i> '.tr('Importa in sequenza').'
127-
</button>';
122+
</div>';
128123

129124
// Ricerca automatica
130125
if (Interaction::isEnabled()) {
131126
echo '
127+
128+
<div class="btn-group btn-group-sm d-inline-flex">
129+
<button type="button" class="btn btn-warning" onclick="importAll(this)">
130+
<i class="fa fa-cloud-download"></i> '.tr('Importa in sequenza').'
131+
</button>
132132
<button type="button" class="btn btn-primary" onclick="searchInvoices(this)">
133133
<i class="fa fa-refresh"></i> '.tr('Ricerca fatture di acquisto').'
134-
</button>';
134+
</button>
135+
</div>';
135136
}
136137

137138
echo '
138-
</div>
139139
</div>
140140
</div>
141141
<div class="card-body" id="list">';
@@ -178,6 +178,17 @@ function upload(btn) {
178178
if (Interaction::isEnabled()) {
179179
echo '
180180
function importAll(btn) {
181+
// Controlla se ci sono fatture caricate nella datatable
182+
var invoiceRows = $("table tbody tr:not(#no-results-message)").length;
183+
184+
if (invoiceRows === 0) {
185+
swal({
186+
title: "'.tr('Nessuna fattura da importare').'",
187+
type: "info",
188+
});
189+
return;
190+
}
191+
181192
swal({
182193
title: "'.tr('Importare tutte le fatture in sequenza?').'",
183194
html: "'.tr('Verranno importate manualmente tutte le fatture presenti. Continuare?').'",

0 commit comments

Comments
 (0)