fix report details

This commit is contained in:
Claudio 2024-10-22 09:13:55 +02:00
parent 3ea75fcdb7
commit 6831b2bacb

View File

@ -244,7 +244,7 @@ $partsAndResults = $stmtParts->get_result();
echo '<table class="table table-bordered table-part">
<thead>
<tr>
<th class="fixed-width-analyts">Analyts Name</th>
<th class="fixed-width-analyts">Components/Analyts Name</th>
<th class="fixed-width-value">Result Value</th>
<th class="fixed-width-rating">Rating</th>
</tr>
@ -359,9 +359,9 @@ $partsAndResults = $stmtParts->get_result();
// Mostra/nasconde la riga in base al filtro di rating
if (selectedRating === '' ||
(selectedRating === 'pass' && (ratingText === 'pass' || ratingText === 'complies')) ||
(selectedRating === 'fail' && (ratingText === 'fail' || ratingText === "doesn't comply")) ||
(selectedRating === 'ambiguous' && (ratingText === 'n/a' || ratingText === 'data' || ratingText === '//'))) {
(selectedRating === 'pass' && (ratingText === 'pass' || ratingText === 'complies' || ratingText === 'p')) ||
(selectedRating === 'fail' && (ratingText === 'fail' || ratingText === "doesn't comply" || ratingText === "f")) ||
(selectedRating === 'ambiguous' && (ratingText === 'n/a' || ratingText === 'data' || ratingText === '//' || ratingText === ''))) {
$(this).show();
visibleRows++;
} else {
@ -369,19 +369,30 @@ $partsAndResults = $stmtParts->get_result();
}
});
// Nasconde l'intera tabella se non ci sono righe visibili
// Nascondi l'intera tabella e il titolo della parte se non ci sono righe visibili
if (visibleRows === 0) {
table.hide();
table.prev('h6').hide(); // Nasconde anche il titolo della parte
table.hide(); // Nasconde la tabella
table.prev('h6').hide(); // Nasconde il titolo della parte
table.prevAll('.section-separator:first').hide(); // Nasconde il titolo dell'analisi
} else {
table.show();
table.show(); // Mostra la tabella se ci sono righe visibili
table.prev('h6').show(); // Mostra il titolo della parte
table.prevAll('.section-separator:first').show(); // Mostra il titolo dell'analisi
}
});
});
// Controlla se ci sono sezioni dell'analisi senza parti visibili
$('.section-separator').each(function() {
var section = $(this);
var hasVisibleParts = section.nextUntil('.section-separator', 'h6:visible').length > 0; // Verifica se ci sono parti visibili
if (!hasVisibleParts) {
section.hide(); // Nasconde l'intestazione dell'analisi se non ci sono parti visibili
} else {
section.show(); // Mostra l'intestazione dell'analisi se ci sono parti visibili
}
});
});
});
</script>
<!-- plugin JS -->
@ -445,9 +456,9 @@ $partsAndResults = $stmtParts->get_result();
// Se l'utente non seleziona alcun valore (tutti i rating) o il rating corrisponde
if (selectedRating === '' ||
(selectedRating === 'pass' && (ratingText === 'pass' || ratingText === 'complies')) ||
(selectedRating === 'fail' && (ratingText === 'fail' || ratingText === "doesn't comply")) ||
(selectedRating === 'ambiguous' && (ratingText === 'n/a' || ratingText === 'data' || ratingText === '//'))) {
(selectedRating === 'pass' && (ratingText === 'pass' || ratingText === 'complies' || ratingText === 'p')) ||
(selectedRating === 'fail' && (ratingText === 'fail' || ratingText === "doesn't comply" || ratingText === "f")) ||
(selectedRating === 'ambiguous' && (ratingText === 'n/a' || ratingText === 'data' || ratingText === '//' || ratingText === ''))) {
$(this).show();
} else {
$(this).hide();