<?php use App\Core\Permission; ?>
<link rel="stylesheet" href="/public/assets/css/cda-communications.css">

<section class="communication-hero">
<div>
<span class="page-kicker">Centre de communication</span>
<h2>Communications</h2>
<p>Messages individuels, par atelier, groupe ou ensemble des adhérents.</p>
</div>

<?php if(Permission::can('communications.create')): ?>
<a class="button button-primary" href="/public/communications/nouvelle">
+ Nouvelle communication
</a>
<?php endif; ?>
</section>

<section class="communication-card">
<h3>Historique</h3>

<div class="campaign-list">
<?php if(!$campaigns): ?>
<div class="empty">Aucune communication.</div>
<?php endif; ?>

<?php foreach($campaigns as $campaign): ?>
<a href="/public/communications/voir?id=<?= (int)$campaign['id'] ?>">
<div>
<strong><?= htmlspecialchars((string)$campaign['libelle']) ?></strong>
<small><?= htmlspecialchars((string)$campaign['cible_type']) ?> · <?= htmlspecialchars((string)$campaign['statut']) ?></small>
</div>
<span><?= (int)$campaign['nb_envoyes'] ?>/<?= (int)$campaign['nb_destinataires'] ?></span>
</a>
<?php endforeach; ?>
</div>
</section>
