added stats and reodrder order
This commit is contained in:
@@ -151,7 +151,12 @@
|
||||
<span class="menu-item">Certificati</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="statistiche.php" class="">
|
||||
<i class="bx bx-certification icon nav-icon"></i>
|
||||
<span class="menu-item">Statistiche</span>
|
||||
</a>
|
||||
</li>
|
||||
<!-- Impostazioni -->
|
||||
<li class="menu-title" data-key="t-admin-settings">Impostazioni</li>
|
||||
|
||||
|
||||
+86
-10
@@ -120,6 +120,33 @@ $qParam = $q !== '' ? '&q=' . urlencode($q) : '';
|
||||
box-shadow: inset 0 0 0 1px #cfe8db;
|
||||
}
|
||||
|
||||
#ordersTable th.sortable {
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#ordersTable th.sortable:hover {
|
||||
color: #1ebf73;
|
||||
}
|
||||
|
||||
#ordersTable th.sortable::after {
|
||||
content: "\2195";
|
||||
margin-left: 5px;
|
||||
font-size: 11px;
|
||||
opacity: 0.35;
|
||||
}
|
||||
|
||||
#ordersTable th.sortable.asc::after {
|
||||
content: "\25B2";
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#ordersTable th.sortable.desc::after {
|
||||
content: "\25BC";
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.num-input {
|
||||
width: 80px;
|
||||
}
|
||||
@@ -203,16 +230,16 @@ $qParam = $q !== '' ? '&q=' . urlencode($q) : '';
|
||||
<table class="table table-striped mb-0" id="ordersTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Stato</th>
|
||||
<th>N. Ordine</th>
|
||||
<th>Nome</th>
|
||||
<th>Cognome</th>
|
||||
<th>Classe</th>
|
||||
<th>Ticket</th>
|
||||
<th>Scadenza</th>
|
||||
<th>Max riprogr.</th>
|
||||
<th>Riprogrammate</th>
|
||||
<th>Status</th>
|
||||
<th class="sortable" data-type="text">Stato</th>
|
||||
<th class="sortable desc" data-type="num">N. Ordine</th>
|
||||
<th class="sortable" data-type="text">Nome</th>
|
||||
<th class="sortable" data-type="text">Cognome</th>
|
||||
<th class="sortable" data-type="text">Classe</th>
|
||||
<th class="sortable" data-type="num">Ticket</th>
|
||||
<th class="sortable" data-type="date">Scadenza</th>
|
||||
<th class="sortable" data-type="num">Max riprogr.</th>
|
||||
<th class="sortable" data-type="num">Riprogrammate</th>
|
||||
<th class="sortable" data-type="text">Status</th>
|
||||
<th>Azioni</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -341,6 +368,55 @@ $qParam = $q !== '' ? '&q=' . urlencode($q) : '';
|
||||
$('#orderSearch').on('input', applySearch);
|
||||
applySearch();
|
||||
|
||||
/* ===================== ORDINAMENTO ===================== */
|
||||
var sortCol = 1,
|
||||
sortDir = -1; // di partenza: N. Ordine decrescente, come la query
|
||||
|
||||
function cellValue(row, idx, type) {
|
||||
var td = $(row).children().eq(idx);
|
||||
if (td.find('input').length) {
|
||||
// cella in modifica: usa il valore originale
|
||||
var orig = td.data('original');
|
||||
if (typeof orig === 'undefined') orig = td.attr('data-value');
|
||||
td = $('<td>').text(orig || '');
|
||||
}
|
||||
var v = td.attr('data-value');
|
||||
if (typeof v === 'undefined') v = td.text();
|
||||
v = String(v).trim();
|
||||
if (v === '' || v === '–') return null;
|
||||
if (type === 'num') {
|
||||
var num = parseFloat(v.replace(',', '.'));
|
||||
return isNaN(num) ? null : num;
|
||||
}
|
||||
if (type === 'date') return v; // formato AAAA-MM-GG: ordinabile come testo
|
||||
return norm(v);
|
||||
}
|
||||
|
||||
$('#ordersTable thead').on('click', 'th.sortable', function() {
|
||||
var th = $(this);
|
||||
var idx = th.index();
|
||||
var type = th.data('type');
|
||||
|
||||
sortDir = (sortCol === idx) ? -sortDir : 1;
|
||||
sortCol = idx;
|
||||
|
||||
$('#ordersTable thead th.sortable').removeClass('asc desc');
|
||||
th.addClass(sortDir === 1 ? 'asc' : 'desc');
|
||||
|
||||
var rows = $('#ordersTable tbody tr.order-row').get();
|
||||
rows.sort(function(a, b) {
|
||||
var va = cellValue(a, idx, type);
|
||||
var vb = cellValue(b, idx, type);
|
||||
if (va === null && vb === null) return 0;
|
||||
if (va === null) return 1; // vuoti sempre in fondo
|
||||
if (vb === null) return -1;
|
||||
if (va < vb) return -sortDir;
|
||||
if (va > vb) return sortDir;
|
||||
return 0;
|
||||
});
|
||||
$('#noResults').before(rows);
|
||||
});
|
||||
|
||||
/* ===================== SCADENZA ===================== */
|
||||
$(document).on('click', 'td.expiry-date', function() {
|
||||
var cell = $(this);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user