<div class="container-fluid">

<h2 class="fw-bold mb-4">
Research Impact & Publication Intelligence Center
</h2>

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

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

<h6>
Publication Readiness Score
</h6>

<h1 class="text-success">
<?= (int)$stats['publication_score'] ?>%
</h1>

</div>

</div>

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

<?php

$cards = [

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

'Production Approved'
=> $stats['production_approved'],

'DOI Coverage'
=> $stats['doi_count'],

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

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

'Missing DOI'
=> $stats['missing_doi'],

'Broken Issue Links'
=> $stats['broken_issue_links']

];

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

?>

<div class="col-md">

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

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

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

<h3>
<?= (int)$value ?>
</h3>

</div>

</div>

</div>

<?php endforeach; ?>

</div>

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

<div class="card-header fw-bold">
Publication Intelligence Matrix
</div>

<div class="table-responsive">

<table class="table table-striped">

<thead>

<tr>

<th>ID</th>
<th>Submission</th>
<th>Title</th>
<th>DOI</th>
<th>Issue</th>
<th>Galley</th>

</tr>

</thead>

<tbody>

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

<tr>

<td>
<?= (int)$r['id'] ?>
</td>

<td>
<?= htmlspecialchars(
$r['submission_no']
) ?>
</td>

<td>
<?= htmlspecialchars(
$r['title']
) ?>
</td>

<td>

<?php if(!empty($r['doi'])): ?>

<span class="badge bg-success">
Available
</span>

<?php else: ?>

<span class="badge bg-danger">
Missing
</span>

<?php endif; ?>

</td>

<td>

<?= $r['issue_id']
? (int)$r['issue_id']
: '-' ?>

</td>

<td>

<?= $r['galley_id']
? (int)$r['galley_id']
: '-' ?>

</td>

</tr>

<?php endforeach; ?>

</tbody>

</table>

</div>

</div>

</div>
