Accueil et tableau de bord : lire les groupes requis, plus requires_adherent (#9)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V2csyno8m71DJFKYM1vgzV
This commit is contained in:
parent
9882e3155e
commit
392c24fe74
2 changed files with 12 additions and 7 deletions
|
|
@ -93,20 +93,25 @@ require __DIR__ . '/views/layout.php';
|
||||||
<h2>Mes services</h2>
|
<h2>Mes services</h2>
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<?php foreach ($services as $s): if (!$s['visible']) continue;
|
<?php foreach ($services as $s): if (!$s['visible']) continue;
|
||||||
$accessible = !$s['requires_adherent'] || $is_adherent;
|
// Les groupes requis ont remplacé requires_adherent (supprimé par
|
||||||
|
// _service_normalize) ; une cotisation à jour dans Dolibarr vaut
|
||||||
|
// toujours le groupe des adhérents.
|
||||||
|
$restreint = !empty($s['groups']);
|
||||||
|
$accessible = service_accessible($s, $user['groups'] ?? [], (bool)($user['is_admin'] ?? false))
|
||||||
|
|| ($is_adherent && in_array(ADHERENT_GROUP, $s['groups'], true));
|
||||||
?>
|
?>
|
||||||
<div class="service-card <?= $accessible ? '' : 'locked' ?>">
|
<div class="service-card <?= $accessible ? '' : 'locked' ?>">
|
||||||
<div class="service-header">
|
<div class="service-header">
|
||||||
<strong><?= htmlspecialchars($s['name']) ?></strong>
|
<strong><?= htmlspecialchars($s['name']) ?></strong>
|
||||||
<?php if ($s['requires_adherent']): ?>
|
<?php if ($restreint): ?>
|
||||||
<span class="badge"><?= $accessible ? 'Adhérent' : 'Adhérent requis' ?></span>
|
<span class="badge"><?= $accessible ? 'Réservé' : 'Accès restreint' ?></span>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<p><?= htmlspecialchars($s['description']) ?></p>
|
<p><?= htmlspecialchars($s['description']) ?></p>
|
||||||
<?php if ($accessible): ?>
|
<?php if ($accessible): ?>
|
||||||
<a href="<?= htmlspecialchars($s['url']) ?>" target="_blank" rel="noopener">Accéder</a>
|
<a href="<?= htmlspecialchars($s['url']) ?>" target="_blank" rel="noopener">Accéder</a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<span class="text-muted small">Adhésion requise</span>
|
<span class="text-muted small"><?= in_array(ADHERENT_GROUP, $s['groups'], true) ? 'Adhésion requise' : 'Accès restreint' ?></span>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
|
||||||
|
|
@ -144,11 +144,11 @@ document.addEventListener('keydown', e => { if (e.key === 'Escape') closeEventMo
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<?php foreach ($services as $s): if (!$s['visible']) continue;
|
<?php foreach ($services as $s): if (!$s['visible']) continue;
|
||||||
$can_access = service_accessible($s, $user_groups, $is_admin); ?>
|
$can_access = service_accessible($s, $user_groups, $is_admin); ?>
|
||||||
<div class="service-card <?= $s['requires_adherent'] ? 'adherent-only' : '' ?> <?= (!$can_access) ? 'locked' : '' ?>">
|
<div class="service-card <?= !empty($s['groups']) ? 'adherent-only' : '' ?> <?= (!$can_access) ? 'locked' : '' ?>">
|
||||||
<div class="service-header">
|
<div class="service-header">
|
||||||
<strong><?= htmlspecialchars($s['name']) ?></strong>
|
<strong><?= htmlspecialchars($s['name']) ?></strong>
|
||||||
<?php if ($s['requires_adherent']): ?>
|
<?php if (!empty($s['groups'])): ?>
|
||||||
<span class="badge">Adhérent</span>
|
<span class="badge"><?= in_array(ADHERENT_GROUP, $s['groups'], true) ? 'Adhérent' : 'Réservé' ?></span>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php if ($s['description']): ?>
|
<?php if ($s['description']): ?>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue