<?php $d=$data??[];$h=static fn($v)=>htmlspecialchars((string)$v,ENT_QUOTES,'UTF-8');$cl=static fn($v)=>in_array($v,['ALLOWED','PASSED','COMPATIBLE','RESOLVED'],true)?'good':(in_array($v,['WARNING'],true)?'warn':'bad'); ?>
<style>.pc{display:grid;gap:16px}.card{background:#fff;border:1px solid #dce4ef;border-radius:18px;padding:18px}.hero{background:linear-gradient(120deg,#17395c,#236f9f);color:#fff}.scroll{overflow:auto}.tbl{width:100%;border-collapse:collapse;min-width:850px}.tbl th,.tbl td{padding:10px;border-bottom:1px solid #e7edf4;text-align:left;vertical-align:top}.btn{padding:9px 13px;border:0;border-radius:9px;background:#1f64a5;color:#fff;font-weight:800}.badge{display:inline-flex;padding:5px 9px;border-radius:999px;font-size:.75rem;font-weight:900}.good{background:#dcfce7;color:#166534}.warn{background:#fef3c7;color:#92400e}.bad{background:#fee2e2;color:#991b1b}.steps{display:flex;gap:7px;flex-wrap:wrap;margin-top:8px}.step{border:1px solid #dbe4ef;border-radius:10px;padding:7px 9px;background:#f8fafc;font-size:.8rem}</style>
<div class="pc"><section class="card hero"><small>PLATFORM-023.3.5.1 · AXIOM Pipeline Core</small><h1>Enterprise Validation Center</h1><p>Pipeline unifié : préflight, confiance, compatibilité, politique et dépendances.</p><a style="color:#fff" href="/public/studio/mises-a-jour">← Centre de mises à jour</a></section>
<section class="card scroll"><h2>Packages disponibles</h2><table class="tbl"><thead><tr><th>ID</th><th>Package</th><th>Version</th><th>État</th><th>Action</th></tr></thead><tbody><?php foreach(($d['packages']??[]) as $p):?><tr><td>#<?= (int)$p['id']?></td><td><?= $h($p['nom_package'])?></td><td><?= $h($p['version_package'])?></td><td><?= $h($p['statut'])?></td><td><form method="post" action="/public/administration/plateforme/validation/simuler"><input type="hidden" name="_csrf" value="<?= $h(\App\Core\Csrf::token())?>"><input type="hidden" name="package_id" value="<?= (int)$p['id']?>"><button class="btn">Exécuter le pipeline</button></form></td></tr><?php endforeach?><?php if(empty($d['packages'])):?><tr><td colspan="5">Aucun package importé.</td></tr><?php endif?></tbody></table></section>
<section class="card"><h2>Dernières exécutions</h2><?php foreach(($d['runs']??[]) as $r):$id=(int)$r['id'];?><div style="border-top:1px solid #e7edf4;padding:14px 0"><strong><?= $h($r['package_name'])?></strong> · <?= $h($r['package_version'])?> <span class="badge <?= $cl((string)$r['decision'])?>"><?= $h($r['decision'])?></span> <strong><?= (int)$r['score']?>/100</strong><?php if($r['blocking_step']):?> · Blocage : <?= $h($r['blocking_step'])?><?php endif?><div class="steps"><?php foreach(($d['steps_by_run'][$id]??[]) as $s):?><div class="step"><strong><?= $h($s['step_label'])?></strong><br><span class="badge <?= $cl((string)$s['decision'])?>"><?= $h($s['decision'])?></span> · <?= (int)$s['score']?>/100</div><?php endforeach?></div></div><?php endforeach?><?php if(empty($d['runs'])):?><p>Aucune exécution enregistrée.</p><?php endif?></section></div>
