<div class="container-fluid">

<h2 class="fw-bold mb-4">
Enterprise Publication Sustainability & Editorial Intelligence Center
</h2>

<div class="row g-3 mb-4">

<?php

$cards = [

'Approved Publications'
=> $stats['approved'],

'Published'
=> $stats['published'],

'Assigned To Issue'
=> $stats['assigned_to_issue'],

'Approved Galleys'
=> $stats['approved_galleys'],

'Publication Sustainability'
=> $stats['publication_sustainability_score'].'%',

'Editorial Intelligence'
=> $stats['editorial_intelligence_index'].'%'

];

foreach($cards as $label=>$value):

?>

<div class="col-md-2">

<div class="card border-0 shadow-sm">

<div class="card-body text-center">

<div class="text-muted">
<?= htmlspecialchars($label) ?>
</div>

<h3>
<?= htmlspecialchars((string)$value) ?>
</h3>

</div>

</div>

</div>

<?php endforeach; ?>

</div>

<div class="card border-0 shadow-sm mb-4">

<div class="card-header fw-bold">
Editorial Findings
</div>

<div class="card-body">

<?php foreach($findings as $f): ?>

<div class="alert alert-<?= htmlspecialchars($f['severity']) ?>">

<strong>
<?= htmlspecialchars($f['title']) ?>
</strong>

<br>

<?= htmlspecialchars($f['message']) ?>

</div>

<?php endforeach; ?>

<?php if(empty($findings)): ?>

<div class="alert alert-success">
Editorial sustainability indicators are healthy.
</div>

<?php endif; ?>

</div>

</div>

<div class="card border-0 shadow-sm">

<div class="card-header fw-bold">
Issue Portfolio
</div>

<div class="table-responsive">

<table class="table table-striped">

<thead>

<tr>
<th>ID</th>
<th>Volume</th>
<th>Issue</th>
<th>Year</th>
<th>Articles</th>
</tr>

</thead>

<tbody>

<?php foreach($rows as $r): ?>

<tr>

<td><?= (int)$r['id'] ?></td>
<td><?= htmlspecialchars($r['volume_no']) ?></td>
<td><?= htmlspecialchars($r['issue_no']) ?></td>
<td><?= htmlspecialchars($r['publication_year']) ?></td>
<td><?= (int)$r['article_count'] ?></td>

</tr>

<?php endforeach; ?>

</tbody>

</table>

</div>

</div>

</div>
