analysis complete

This commit is contained in:
2026-04-03 11:15:33 +02:00
parent 7dfb935e33
commit 39a821357e
9 changed files with 29723 additions and 15 deletions
+136 -15
View File
@@ -48,6 +48,38 @@ $stmt = $pdo->prepare("
$stmt->execute([$iddatadb]);
$parts = $stmt->fetchAll(PDO::FETCH_ASSOC);
$partIds = array_column($parts, 'id');
$assignedAnalysesByPart = [];
if (!empty($partIds)) {
$placeholders = implode(',', array_fill(0, count($partIds), '?'));
$stmtAssigned = $pdo->prepare("
SELECT
ipa.id,
ipa.part_id,
ipa.analysis_recordkey,
ipa.analysis_name,
ipa.analysis_method,
ipa.analysis_level,
ipa.is_web_selectable,
ipa.is_accredited
FROM identification_parts_analyses ipa
WHERE ipa.part_id IN ($placeholders)
ORDER BY ipa.analysis_name ASC, ipa.id ASC
");
$stmtAssigned->execute($partIds);
$assignedRows = $stmtAssigned->fetchAll(PDO::FETCH_ASSOC);
foreach ($assignedRows as $row) {
$partId = (int)$row['part_id'];
if (!isset($assignedAnalysesByPart[$partId])) {
$assignedAnalysesByPart[$partId] = [];
}
$assignedAnalysesByPart[$partId][] = $row;
}
}
/**
* Build matrix groups from parts.
* No join for now: we use idmatrice only.
@@ -198,7 +230,9 @@ $matrixGroups = array_values($matrixGroups);
</div>
<?php endif; ?>
</div>
</div>
<div class="analysis-part-assigned-list mt-2" id="analysisAssignedListPart<?= (int)$part['id'] ?>"></div>
</div>
<?php endforeach; ?>
<?php endif; ?>
@@ -214,34 +248,50 @@ $matrixGroups = array_values($matrixGroups);
<strong>Analyses</strong>
</div>
<div class="card-body analysis-scroll-area" id="analysisRightPanel">
<div class="alert alert-info mb-3">
This area will contain analyses in the next step.
</div>
<div class="border rounded p-3 bg-light">
<div class="mb-2"><strong>Current behavior</strong></div>
<ul class="mb-0 ps-3">
<li>Click a matrix on the left</li>
<li>All parts linked to that matrix become selected</li>
<li>Analyses panel will be connected later</li>
</ul>
</div>
<div class="mt-3">
<div class="mt-1 mb-3">
<div class="small text-muted">Selected matrix:</div>
<div id="analysisCurrentMatrix" class="fw-semibold">-</div>
</div>
<div class="mt-3">
<div class="mb-3">
<div class="small text-muted">Selected parts IDs:</div>
<div id="analysisSelectedPartsIds" class="fw-semibold">-</div>
</div>
<div class="d-flex flex-wrap align-items-center gap-2 mb-3">
<div class="form-check m-0">
<input class="form-check-input" type="checkbox" id="analysisWebOnly">
<label class="form-check-label small" for="analysisWebOnly">
Web only
</label>
</div>
<div class="flex-grow-1" style="min-width: 220px;">
<input type="text" class="form-control form-control-sm" id="analysisSearchInput" placeholder="Search analyses or method">
</div>
</div>
<div id="analysisLoadingBox" class="alert alert-info mb-3 d-none">
Loading analyses...
</div>
<div id="analysisErrorBox" class="alert alert-danger mb-3 d-none"></div>
<div id="analysisEmptyBox" class="alert alert-secondary mb-3">
Select a matrix to load analyses
</div>
<div class="list-group" id="analysisList"></div>
</div>
</div>
</div>
</div>
<input type="hidden" id="analysisModalIddatadb" value="<?= (int)$iddatadb ?>">
<script type="application/json" id="analysisAssignedInitialData">
<?= json_encode($assignedAnalysesByPart, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?>
</script>
</div>
<div class="modal-footer">
@@ -301,4 +351,75 @@ $matrixGroups = array_values($matrixGroups);
#analysisSelectedPartsIds {
word-break: break-word;
}
.analysis-analysis-item {
border-radius: 8px !important;
margin-bottom: 6px;
background-color: #ffffff;
}
#analysisList .analysis-analysis-item:nth-child(even) {
background-color: #eef4ff;
}
.analysis-analysis-meta {
font-size: 0.84rem;
color: #6c757d;
}
.analysis-analysis-badges .badge {
margin-right: 4px;
margin-bottom: 4px;
}
.analysis-assigned-chip {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 4px 8px;
border: 1px solid #dbe7f3;
background: #f7fbff;
border-radius: 8px;
margin-bottom: 6px;
font-size: 0.84rem;
}
.analysis-assigned-chip-text {
min-width: 0;
flex: 1;
}
.analysis-assigned-chip-title {
font-weight: 600;
line-height: 1.2;
}
.analysis-assigned-chip-method {
color: #6c757d;
font-size: 0.78rem;
line-height: 1.2;
margin-top: 2px;
}
.analysis-remove-btn {
border: 0;
background: transparent;
color: #dc3545;
font-weight: 700;
font-size: 1rem;
line-height: 1;
padding: 0 2px;
cursor: pointer;
}
.analysis-analysis-item.analysis-selected {
border-color: #198754 !important;
background-color: #eaf7ea !important;
}
.analysis-part-assigned-list {
border-top: 1px dashed #dee2e6;
padding-top: 8px;
}
</style>