fixed products details page (with result analysis)
This commit is contained in:
parent
a9129f4265
commit
35825a2c23
@ -203,40 +203,44 @@ $partsAndResults = $stmtParts->get_result();
|
||||
<h5 class="header-title pb-3 mt-0">Parts and Results</h5>
|
||||
<div class="table-responsive">
|
||||
<?php
|
||||
|
||||
$currentTestName = '';
|
||||
$currentPart = '';
|
||||
$currentTestName = ''; // Variabile per tracciare l'analisi corrente
|
||||
$currentPart = ''; // Variabile per tracciare la parte corrente
|
||||
|
||||
while ($row = $partsAndResults->fetch_assoc()) {
|
||||
// Debug: Stampa i dati di ogni riga
|
||||
// Questo serve per stampare i risultati in modo più leggibile e debuggare
|
||||
|
||||
$previousPart = '';
|
||||
|
||||
|
||||
// Se il nome dell'analisi cambia, crea una nuova sezione
|
||||
// Se il nome dell'analisi cambia, crea una nuova sezione per l'analisi
|
||||
if ($currentTestName != $row['testName']) {
|
||||
if ($currentTestName != '') {
|
||||
echo '</tbody></table>'; // Chiude la tabella precedente
|
||||
echo '</tbody></table>'; // Chiude la tabella precedente se esiste
|
||||
}
|
||||
|
||||
// Stampa il titolo dell'analisi
|
||||
$currentTestName = $row['testName'];
|
||||
echo '<div class="section-separator">Analysis: ' . $currentTestName . '</div>';
|
||||
|
||||
// Reset della parte corrente
|
||||
$currentPart = '';
|
||||
}
|
||||
|
||||
// Verifica se la parte corrente è diversa dalla precedente per evitare duplicazioni
|
||||
$currentPart = $row['partsDescription'] ?? 'Unknown Part';
|
||||
if ($currentPart != $previousPart) {
|
||||
// Stampa il titolo della parte solo se cambia
|
||||
// Se la parte cambia, crea una nuova sezione per la parte
|
||||
if ($currentPart != $row['partsDescription']) {
|
||||
if ($currentPart != '') {
|
||||
echo '</tbody></table>'; // Chiude la tabella della parte precedente
|
||||
}
|
||||
|
||||
// Stampa il titolo della parte
|
||||
$currentPart = $row['partsDescription'] ?? 'Unknown Part';
|
||||
echo '<h6>Part: ' . (!empty($row['partsDescription']) ? $currentPart : 'Part Not Specified') . '</h6>';
|
||||
|
||||
// Apri una nuova tabella per la parte
|
||||
echo '<table class="table table-bordered table-part"><thead>';
|
||||
echo '<tr><th class="fixed-width-analyts">Analyts Name</th><th class="fixed-width-value">Result Value</th><th class="fixed-width-rating">Rating</th></tr>';
|
||||
echo '</thead><tbody>';
|
||||
|
||||
|
||||
// Aggiorna la variabile di controllo per la parte
|
||||
$previousPart = $currentPart;
|
||||
echo '<table class="table table-bordered table-part">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="fixed-width-analyts">Analyts Name</th>
|
||||
<th class="fixed-width-value">Result Value</th>
|
||||
<th class="fixed-width-rating">Rating</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
}
|
||||
|
||||
// Classificazione del rating
|
||||
@ -249,18 +253,21 @@ $partsAndResults = $stmtParts->get_result();
|
||||
$ratingClass = 'rating-ambiguous';
|
||||
}
|
||||
|
||||
// Stampa i dettagli della riga
|
||||
// Stampa i dettagli dell'analita
|
||||
echo '<tr>';
|
||||
echo '<td>' . (!empty($row['analytsName']) ? $row['analytsName'] . ' (ID: ' . $row['result_AnalytsName'] . ')' : ' ') . '</td>';
|
||||
echo '<td>' . (!empty($row['result_Value']) ? htmlspecialchars($row['result_Value'], ENT_QUOTES, 'UTF-8') : ' ') . '</td>';
|
||||
echo '<td class="' . $ratingClass . '">' . (!empty($row['test_Rating']) ? htmlspecialchars($row['test_Rating'], ENT_QUOTES, 'UTF-8') : ' ') . '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
// Chiude l'ultima tabella se esiste
|
||||
if ($currentTestName != '') {
|
||||
echo '</tbody></table>'; // Chiude l'ultima tabella
|
||||
echo '</tbody></table>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user