| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <?php
- /** @var array $data */
- $esc = static fn(string $s): string => htmlspecialchars($s, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
- $result = $data['result'];
- $packTitle = $data['pack_title'] ?? 'Contrôle technique du process';
- $date = $data['date'] ?? date('Y-m-d');
- $bookingUrl = (string) ($data['booking_url'] ?? '');
- $score = (int) ($result['score_total'] ?? 0);
- $level = (string) ($result['level'] ?? '');
- $levelLabel = (string) ($result['level_label'] ?? '');
- $confidenceLabel = (string) ($result['confidence']['label'] ?? '');
- $pillars = (array) ($result['pillars'] ?? []);
- $risks = (array) ($result['risks_top3'] ?? []);
- $wins = (array) ($result['quick_wins_top5'] ?? []);
- $cost = $result['cost_hidden'] ?? null;
- ?>
- <!doctype html>
- <html lang="fr">
- <head>
- <meta charset="utf-8" />
- <style>
- @page { size: A4; margin: 18mm 16mm; }
- body { font-family: DejaVu Sans, Arial, sans-serif; color: #111827; font-size: 12px; }
- h1 { font-size: 18px; margin: 0 0 4px 0; }
- .muted { color: #6b7280; }
- .row { display: block; }
- .card { border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
- .score { display: table; width: 100%; }
- .score .left, .score .right { display: table-cell; vertical-align: top; }
- .big { font-size: 28px; font-weight: 700; }
- .badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-weight: 700; background: #f3f4f6; }
- .bar { height: 8px; background: #f3f4f6; border-radius: 999px; overflow: hidden; }
- .bar > span { display: block; height: 100%; background: #111827; }
- .pillars { margin-top: 8px; }
- .pillar { margin: 7px 0; }
- .pillar .top { display: table; width: 100%; }
- .pillar .top .name, .pillar .top .val { display: table-cell; }
- .pillar .top .val { text-align: right; font-weight: 700; }
- .list { margin: 6px 0 0 0; padding: 0 0 0 14px; }
- .list li { margin: 4px 0; }
- .two { display: table; width: 100%; }
- .two .col { display: table-cell; width: 50%; vertical-align: top; padding-right: 8px; }
- .two .col:last-child { padding-right: 0; padding-left: 8px; }
- .small { font-size: 11px; }
- .cta { margin-top: 10px; }
- .link { color: #111827; text-decoration: none; }
- .hr { border-top: 1px solid #e5e7eb; margin: 10px 0; }
- </style>
- </head>
- <body>
- <h1><?= $esc("Contrôle technique du process : " . $packTitle) ?></h1>
- <div class="muted small">
- Réalisé le : <?= $esc($date) ?> · Confiance du diagnostic : <?= $esc($confidenceLabel) ?>
- </div>
- <div class="card score">
- <div class="left">
- <div class="muted">Score global</div>
- <div class="big"><?= $esc((string)$score) ?>/100</div>
- <div class="badge"><?= $esc($level . " — " . $levelLabel) ?></div>
- </div>
- <div class="right">
- <div class="pillars">
- <?php foreach ($pillars as $p):
- $pScore = (int) ($p['score'] ?? 0);
- $pMax = (int) ($p['max'] ?? 20);
- $pct = $pMax > 0 ? (int) round(($pScore / $pMax) * 100) : 0;
- ?>
- <div class="pillar">
- <div class="top">
- <div class="name"><?= $esc((string) ($p['label'] ?? $p['id'] ?? '')) ?></div>
- <div class="val"><?= $esc((string)$pScore) ?>/<?= $esc((string)$pMax) ?></div>
- </div>
- <div class="bar"><span style="width: <?= $esc((string)$pct) ?>%"></span></div>
- </div>
- <?php endforeach; ?>
- </div>
- </div>
- </div>
- <div class="two">
- <div class="col">
- <div class="card">
- <strong>Top 3 risques probables</strong>
- <ol class="list">
- <?php foreach ($risks as $r): ?>
- <li>
- <strong><?= $esc((string) ($r['title'] ?? '')) ?></strong><br/>
- <span class="small"><?= $esc((string) ($r['what_happens'] ?? '')) ?></span>
- </li>
- <?php endforeach; ?>
- </ol>
- </div>
- </div>
- <div class="col">
- <div class="card">
- <strong>Actions prioritaires (30 jours)</strong>
- <ol class="list">
- <?php foreach ($wins as $w): ?>
- <li>
- <strong><?= $esc((string) ($w['title'] ?? '')) ?></strong><br/>
- <span class="small"><?= $esc((string) ($w['effect'] ?? '')) ?></span>
- </li>
- <?php endforeach; ?>
- </ol>
- </div>
- </div>
- </div>
- <div class="card">
- <strong>Coût caché estimé</strong>
- <div class="small muted">Estimation indicative, à valider par mesure réelle.</div>
- <div class="hr"></div>
- <?php if (is_array($cost)): ?>
- <div>Temps perdu estimé : <strong><?= $esc((string) ($cost['hours_per_month'] ?? '')) ?> h/mois</strong></div>
- <div>Estimation : <strong><?= $esc((string) ($cost['eur_per_month'] ?? '')) ?> €/mois</strong></div>
- <div class="small muted">Hypothèses : volume <?= $esc((string) ($cost['volume_per_month'] ?? '')) ?>/mois, coût horaire <?= $esc((string) ($cost['assumptions']['hourly_cost'] ?? '')) ?>€.</div>
- <?php else: ?>
- <div class="muted small">Non calculé (volume/cout horaire non renseignés).</div>
- <?php endif; ?>
- </div>
- <?php if ($bookingUrl !== ''): ?>
- <div class="cta small">
- Prochain pas : Revue express 20 minutes — <span class="muted">valider le diagnostic, prioriser, décider du plan minimal.</span><br/>
- Lien : <span class="link"><?= $esc($bookingUrl) ?></span>
- </div>
- <?php endif; ?>
- </body>
- </html>
|