<?php
$title = 'Workflow Automation Runner';
?>

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

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

<div class="card-body">

<h2 class="fw-bold">

<i class="fa fa-gears text-primary"></i>

Workflow Automation Runner

</h2>

<hr>

<div class="alert alert-info">

Safe Mode:
Rules generate alerts only.
No automatic workflow transitions.

</div>

<form
method="post"
action="/easychair/admin/conference-home/alert/resolve-all"
class="mb-3">

<button
class="btn btn-warning">

<i class="fa fa-check-double"></i>

Resolve All Alerts

</button>

</form>

<table class="table table-hover">

<thead>

<tr>

<th>Conference</th>
<th>Status</th>
<th>Rule</th>
<th>Severity</th>
<th>Action</th>

</tr>

</thead>

<tbody>

<?php foreach($alerts as $a): ?>

<tr>

<td><?= htmlspecialchars($a['conference_name']) ?></td>
<td><?= htmlspecialchars($a['status']) ?></td>
<td><?= htmlspecialchars($a['rule_name']) ?></td>
<td><?= htmlspecialchars($a['severity']) ?></td>

<td>

<?php if(
    empty($a['is_resolved'])
): ?>

<form
method="post"
action="/easychair/admin/conference-home/alert/resolve">

<input
type="hidden"
name="alert_id"
value="<?= (int)$a['id'] ?>">

<button
class="btn btn-sm btn-success">

Resolve

</button>

</form>

<?php else: ?>

<span class="badge bg-success">

Resolved

</span>

<?php endif; ?>

</td>

</tr>

<?php endforeach; ?>

</tbody>

</table>

</div>

</div>

</div>
