fixed matrici action 2
This commit is contained in:
+36
-49
@@ -313,53 +313,29 @@ function diffBadge($v)
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Nome (2), Cliente (3), Linee (5): senza larghezza, si dividono lo spazio restante */
|
||||||
/* Foto */
|
/* Foto */
|
||||||
#tabellaMatrici th:nth-child(1),
|
#tabellaMatrici th:nth-child(1),
|
||||||
#tabellaMatrici td:nth-child(1) {
|
#tabellaMatrici td:nth-child(1) {
|
||||||
width: 90px;
|
width: 90px;
|
||||||
max-width: 90px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Nome */
|
|
||||||
#tabellaMatrici th:nth-child(2),
|
|
||||||
#tabellaMatrici td:nth-child(2) {
|
|
||||||
width: 260px;
|
|
||||||
max-width: 260px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Cliente */
|
|
||||||
#tabellaMatrici th:nth-child(3),
|
|
||||||
#tabellaMatrici td:nth-child(3) {
|
|
||||||
width: 220px;
|
|
||||||
max-width: 220px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Difficoltà */
|
/* Difficoltà */
|
||||||
#tabellaMatrici th:nth-child(4),
|
#tabellaMatrici th:nth-child(4),
|
||||||
#tabellaMatrici td:nth-child(4) {
|
#tabellaMatrici td:nth-child(4) {
|
||||||
width: 130px;
|
width: 120px;
|
||||||
max-width: 130px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Linee */
|
|
||||||
#tabellaMatrici th:nth-child(5),
|
|
||||||
#tabellaMatrici td:nth-child(5) {
|
|
||||||
width: 220px;
|
|
||||||
max-width: 220px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fogli */
|
/* Fogli */
|
||||||
#tabellaMatrici th:nth-child(6),
|
#tabellaMatrici th:nth-child(6),
|
||||||
#tabellaMatrici td:nth-child(6) {
|
#tabellaMatrici td:nth-child(6) {
|
||||||
width: 120px;
|
width: 110px;
|
||||||
max-width: 120px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Azioni */
|
/* Azioni */
|
||||||
#tabellaMatrici th:nth-child(7),
|
#tabellaMatrici th:nth-child(7),
|
||||||
#tabellaMatrici td:nth-child(7) {
|
#tabellaMatrici td:nth-child(7) {
|
||||||
width: 260px;
|
width: 270px;
|
||||||
max-width: 260px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#tabellaMatrici td:nth-child(1) img {
|
#tabellaMatrici td:nth-child(1) img {
|
||||||
@@ -1681,8 +1657,40 @@ function diffBadge($v)
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
// ---- filtro difficoltà ----
|
||||||
|
const DIFF_BANDS = <?= json_encode(DIFF_BANDS, JSON_UNESCAPED_UNICODE) ?>;
|
||||||
|
const $diffFilter = $('<select id="diffFilter" class="form-select form-select-sm"></select>')
|
||||||
|
.append('<option value="">Difficoltà: tutte</option>');
|
||||||
|
Object.keys(DIFF_BANDS).forEach(k => $diffFilter.append($('<option>').val(k).text(DIFF_BANDS[k].label)));
|
||||||
|
$diffFilter.append('<option value="none">Non indicata</option>');
|
||||||
|
|
||||||
|
// chiamata da initComplete: la lingua italiana si carica in modo asincrono,
|
||||||
|
// quindi il box "Cerca" esiste solo a inizializzazione finita
|
||||||
|
function initDiffFilter() {
|
||||||
|
if (!$diffFilter.parent().length) $('#tabellaMatrici_filter').append($diffFilter);
|
||||||
|
}
|
||||||
|
initDiffFilter();
|
||||||
|
|
||||||
|
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex) {
|
||||||
|
if (settings.nTable.id !== 'tabellaMatrici') return true;
|
||||||
|
const f = $diffFilter.val();
|
||||||
|
if (!f) return true;
|
||||||
|
const tr = settings.aoData[dataIndex].nTr;
|
||||||
|
const td = tr && tr.querySelector('td.diff-cell');
|
||||||
|
if (!td) return false;
|
||||||
|
const n = parseInt(td.getAttribute('data-diff') || '0', 10);
|
||||||
|
if (f === 'none') return !n;
|
||||||
|
const b = DIFF_BANDS[f];
|
||||||
|
return n >= b.min && n <= b.max;
|
||||||
|
});
|
||||||
|
$diffFilter.on('change', () => $('#tabellaMatrici').DataTable().draw());
|
||||||
|
|
||||||
$('#tabellaMatrici').DataTable({
|
$('#tabellaMatrici').DataTable({
|
||||||
order: [],
|
order: [],
|
||||||
|
autoWidth: false, // le larghezze le decide il CSS (altrimenti la colonna Azioni esce dallo schermo)
|
||||||
|
initComplete: function() {
|
||||||
|
initDiffFilter();
|
||||||
|
},
|
||||||
columnDefs: [{
|
columnDefs: [{
|
||||||
targets: 0,
|
targets: 0,
|
||||||
orderable: false,
|
orderable: false,
|
||||||
@@ -1712,27 +1720,6 @@ function diffBadge($v)
|
|||||||
.attr('placeholder', 'Nome matrice, cliente…')
|
.attr('placeholder', 'Nome matrice, cliente…')
|
||||||
.addClass('form-control');
|
.addClass('form-control');
|
||||||
|
|
||||||
// ---- filtro difficoltà ----
|
|
||||||
const DIFF_BANDS = <?= json_encode(DIFF_BANDS, JSON_UNESCAPED_UNICODE) ?>;
|
|
||||||
const $diffFilter = $('<select id="diffFilter" class="form-select form-select-sm"></select>')
|
|
||||||
.append('<option value="">Difficoltà: tutte</option>');
|
|
||||||
Object.keys(DIFF_BANDS).forEach(k => $diffFilter.append($('<option>').val(k).text(DIFF_BANDS[k].label)));
|
|
||||||
$diffFilter.append('<option value="none">Non indicata</option>');
|
|
||||||
$('#tabellaMatrici_filter').append($diffFilter);
|
|
||||||
|
|
||||||
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex) {
|
|
||||||
if (settings.nTable.id !== 'tabellaMatrici') return true;
|
|
||||||
const f = $diffFilter.val();
|
|
||||||
if (!f) return true;
|
|
||||||
const tr = settings.aoData[dataIndex].nTr;
|
|
||||||
const td = tr && tr.querySelector('td.diff-cell');
|
|
||||||
if (!td) return false;
|
|
||||||
const n = parseInt(td.getAttribute('data-diff') || '0', 10);
|
|
||||||
if (f === 'none') return !n;
|
|
||||||
const b = DIFF_BANDS[f];
|
|
||||||
return n >= b.min && n <= b.max;
|
|
||||||
});
|
|
||||||
$diffFilter.on('change', () => $('#tabellaMatrici').DataTable().draw());
|
|
||||||
|
|
||||||
function resetFotoMatrice(photoUrl) {
|
function resetFotoMatrice(photoUrl) {
|
||||||
$("#fotoMatrice").val('');
|
$("#fotoMatrice").val('');
|
||||||
|
|||||||
Reference in New Issue
Block a user