<div class="container-fluid py-4">

<div class="row mb-4">

<div class="col-12">

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

<div class="card-body">

<h2 class="fw-bold mb-1">

<i class="fa fa-shield-halved text-primary"></i>

Enterprise Governance Center

</h2>

<p class="text-muted mb-0">

Real-time health monitoring for workflow, submissions,
reviewers and production.

</p>

</div>

</div>

</div>

</div>

<div class="row">

<?php

$cards = [

'Workflow'   => $governance['workflow'],

'Submissions'=> $governance['submissions'],

'Reviewers'  => $governance['reviewers'],

'Production' => $governance['production']

];

foreach ($cards as $title=>$data):

?>

<div class="col-xl-3 col-md-6 mb-4">

<div class="card border-0 shadow h-100">

<div class="card-body">

<h5 class="fw-bold">

<?= htmlspecialchars($title) ?>

</h5>

<hr>

<div class="display-5 fw-bold text-primary">

<?= (int)$data['score'] ?>%

</div>

<div class="mt-3">

<div>

Healthy

<span class="badge bg-success">

<?= (int)$data['healthy'] ?>

</span>

</div>

<div class="mt-2">

Warnings

<span class="badge bg-warning text-dark">

<?= (int)$data['warnings'] ?>

</span>

</div>

<div class="mt-2">

Errors

<span class="badge bg-danger">

<?= (int)$data['errors'] ?>

</span>

</div>

</div>

</div>

</div>

</div>

<?php endforeach; ?>

</div>

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

<div class="card-header bg-dark text-white">

Workflow Health Details

</div>

<div class="card-body">

<div class="table-responsive">

<table class="table table-hover align-middle">

<thead>

<tr>

<th>Submission</th>

<th>Status</th>

<th>Stage</th>

<th>Workflow</th>

<th>Health</th>

<th>Notes</th>

</tr>

</thead>

<tbody>

<?php foreach($governance['workflow']['items'] as $row): ?>

<tr>

<td>

<?= htmlspecialchars($row['submission_no']) ?>

</td>

<td>

<?= htmlspecialchars($row['status']) ?>

</td>

<td>

<?= htmlspecialchars($row['stage']) ?>

</td>

<td>

<?= htmlspecialchars($row['workflow_stage']) ?>

</td>

<td>

<?php

$class='success';

if($row['state']=='warning') $class='warning';

if($row['state']=='error') $class='danger';

?>

<span class="badge bg-<?= $class ?>">

<?= ucfirst($row['state']) ?>

</span>

</td>

<td>

<?= htmlspecialchars(implode(', ',$row['notes'])) ?>

</td>

</tr>

<?php endforeach; ?>

</tbody>

</table>

</div>

</div>

</div>

</div>
